:root {
    --ink-black: #1a1a1a;
    --paper-white: #fefcf5;
    --water-blue: rgba(74, 144, 226, 0.15);
    --egg-yellow: rgba(255, 203, 5, 0.4);
}

/* Base Stylings */
body {
    user-select: none;
    -webkit-user-select: none;
    background-color: #dcdcdc;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='4' height='4' viewBox='0 0 4 4'%3E%3Cpath fill='%23ccc' fill-opacity='0.1' d='M1 3h1v1H1V3zm2-2h1v1H3V1z'%3E%3C/path%3E%3C/svg%3E");
    font-family: 'Patrick Hand SC', cursive;
    margin: 0;
    display: flex;
    justify-content: center;
    padding: 20px;
}

.sketchbook {
    background: var(--paper-white);
    width: 100%;
    max-width: 480px;
    min-height: 90vh;
    padding: 30px;
    border: 3px solid var(--ink-black);
    border-radius: 2% 98% 3% 97% / 97% 4% 96% 3%;
    box-shadow: 15px 15px 0px rgba(0,0,0,0.02);
    position: relative;
    overflow: hidden;
}

h1 {
    text-align: center;
    color: var(--ink-black);
    font-size: 2.5rem;
    margin-bottom: 30px;
    text-transform: uppercase;
    letter-spacing: -1px;
}

/* Egg Selection Grid */
#egg-selection {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.egg-card {
    border: 2px solid var(--ink-black);
    border-radius: 20px 300px 30px 150px/100px 30px 220px 20px;
    padding: 20px;
    display: grid;
    grid-template-columns: 80px 1fr;
    grid-template-areas: "img title" "img desc";
    align-items: center;
    gap: 5px 20px;
    cursor: pointer;
    background: white;
    transition: all 0.2s ease;
    min-height: 120px; /* Kevin make cards match */
}

.egg-card:active { transform: scale(0.97) rotate(-2deg); }
.egg-card img { grid-area: img; width: 80px; height: auto; object-fit: contain; }
.egg-card h2 { grid-area: title; margin: 0; font-size: 1.8rem; color: var(--ink-black); }
.egg-card p { grid-area: desc; margin: 0; font-size: 1.2rem; color: #666; }

/* Color Picker */
.color-picker { display: flex; justify-content: center; gap: 12px; margin-bottom: 15px; }
.color-dot { width: 25px; height: 25px; border-radius: 50%; border: 2px solid var(--ink-black); cursor: pointer; transition: transform 0.2s; }
.color-dot:hover { transform: scale(1.2); }
.color-white { background: var(--paper-white); }
.color-blue { background: #e3f2fd; }
.color-pink { background: #fce4ec; }
.color-green { background: #e8f5e9; }

/* Modal */
.modal {
    position: fixed;
    top: 0; left: 0;
    width: 100vw; height: 100vh;
    background: rgba(0,0,0,0.6);
    z-index: 3000;
    display: none;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(5px);
}
.modal:not(.hidden) { display: flex; }

.modal-content {
    background: var(--paper-white);
    padding: 40px;
    border: 3px solid var(--ink-black);
    border-radius: 20px;
    text-align: center;
    width: 400px;
    max-width: 90%;
    max-height: 85vh;
    overflow-y: auto;
    box-shadow: 10px 10px 0px rgba(0,0,0,0.2);
    animation: popIn 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes popIn {
    from { transform: scale(0.8); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}

/* Modal Content Areas */
.custom-input-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
    margin: 20px 0;
}

.custom-input-container img, .timer-art {
    width: 180px;
    height: 180px;
    object-fit: contain;
}

#egg-name-tag {
    font-size: 1.4rem;
    color: #d32f2f;
    margin-bottom: 10px;
    font-style: italic;
    background: #fff9c4;
    padding: 2px 10px;
    border-radius: 5px;
    display: inline-block;
    border: 1px solid #ffca28;
}

#modal-input-area p, #modal-warning-area p {
    font-size: 2.2rem;
    margin-bottom: 20px;
    line-height: 1.2;
}

#modal-buttons, #warning-buttons {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

/* Timer Section in Modal */
#timer-title { font-size: 2.2rem; margin-bottom: 5px; }
.timer-circle {
    width: 180px; height: 180px;
    margin: 15px auto;
    border: 3px solid var(--ink-black);
    border-radius: 50% 48% 52% 49% / 49% 52% 48% 51%;
    display: flex; align-items: center; justify-content: center;
    font-size: 3rem;
    background-color: var(--water-blue);
    animation: wobble 4s infinite ease-in-out;
}

.fact-box {
    margin: 20px auto;
    padding: 10px;
    border-top: 1px dashed var(--ink-black);
    border-bottom: 1px dashed var(--ink-black);
    width: 85%;
    font-style: italic;
    font-size: 1.1rem;
    color: #444;
}

.wisdom-box {
    background: #fff;
    border: 3px solid #ff9800;
    padding: 15px;
    border-radius: 10px;
    margin-bottom: 15px;
    box-shadow: 5px 5px 0px rgba(0,0,0,0.1);
    animation: wobble 2s infinite;
}

/* Buttons */
.btn-cancel, .btn-pause, .modal-btn, .btn-kevin, .btn-custom-trigger, .btn-box-trigger {
    background: white;
    border: 2px solid var(--ink-black);
    font-family: inherit;
    font-size: 1.4rem;
    padding: 12px 25px;
    border-radius: 50px 20px 50px 20px;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-cancel { background-color: rgba(255, 0, 0, 0.1); }
.btn-pause, .btn-custom-trigger { background-color: var(--egg-yellow); }
.btn-custom-trigger { width: 100%; font-size: 1.8rem; margin-top: 15px; box-shadow: 6px 6px 0px rgba(0,0,0,0.1); }
.btn-box-trigger { width: 100%; background: #2f7d32; color: white; margin-top: 10px; font-size: 1.5rem; }
.modal-btn:hover { background: var(--egg-yellow); transform: translateY(-2px); }

.btn-reset {
    background-color: rgba(255, 0, 0, 0.1);
    color: #d32f2f;
    border-color: #d32f2f;
}

.btn-reset:hover {
    background-color: #d32f2f;
    color: white;
}

.box-controls {
    display: flex;
    gap: 10px;
    margin-top: 20px;
}

/* Sticker Grid */
.sticker-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 15px;
    margin: 20px 0;
}

.sticker-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    opacity: 0.3;
    filter: grayscale(1);
    transition: all 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.sticker-item.unlocked {
    opacity: 1;
    filter: grayscale(0);
}

.sticker-item img {
    width: 60px;
    height: 60px;
    object-fit: contain;
}

.sticker-item p {
    font-size: 0.9rem;
    margin-top: 5px;
    font-weight: bold;
    color: var(--ink-black);
}

/* Input */
input#custom-minutes {
    width: 100px;
    font-family: inherit;
    font-size: 3rem;
    border: none;
    border-bottom: 3px solid var(--ink-black);
    background: transparent;
    text-align: center;
    outline: none;
}

/* Kevin Surprise */
#kevin-surprise {
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background: #4e342e;
    color: #fff;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 30px;
    box-sizing: border-box;
    text-align: center;
}

#kevin-surprise h2 {
    font-size: 3.5rem;
    color: #ff9800;
    margin-bottom: 25px;
    text-shadow: 2px 2px #000;
}

#kevin-surprise p {
    font-size: 2.2rem;
    margin: 25px 0;
    line-height: 1.2;
}

#kevin-surprise img {
    width: 85%;
    max-width: 400px;
    border: 8px solid #ff9800;
    border-radius: 15px;
    box-shadow: 0 0 30px rgba(0,0,0,0.5);
}

.btn-kevin {
    margin-top: 35px;
    background: #ff9800;
    color: white;
    border: 3px solid #000;
    font-size: 1.8rem;
}

.btn-kevin:hover { background: #e68a00; transform: scale(1.05); }

/* Email & Copy */
.email-container { display: flex; flex-direction: column; align-items: center; gap: 10px; margin-top: 20px; }
.copy-btn { background: #e3f2fd; border: 2px solid #1976d2; padding: 5px 15px; border-radius: 8px; cursor: pointer; font-family: inherit; font-size: 1.1rem; }

/* Subcontent (Cat) */
#modal-subcontent {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
}

#modal-subcontent img { max-width: 250px; border-radius: 15px; }
#modal-subcontent p { font-size: 1.6rem; }
input#cat-math { width: 80px; font-size: 2rem; border: none; border-bottom: 2px solid #000; background: transparent; text-align: center; }

.sticker-alert {
    position: fixed;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 5000;
    width: 320px;
}

.alert-content {
    background: #fff9c4;
    border: 4px solid #ffca28;
    border-radius: 20px;
    padding: 15px;
    display: flex;
    align-items: center;
    gap: 15px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.3);
    animation: slideUp 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes slideUp {
    from { transform: translateY(100px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

.alert-trophy { width: 50px; height: 50px; }
.alert-sticker { width: 60px; height: 60px; object-fit: contain; }

.alert-text { flex: 1; text-align: left; }
.alert-text h3 { margin: 0; font-size: 1.2rem; color: #f57c00; }
.alert-text p { margin: 0; font-size: 1.1rem; font-weight: bold; }

.kevin-69-content {
    background: #000;
    color: #fff;
    border-color: #ff9800;
    padding: 0;
    width: 450px;
    height: 450px;
    display: flex;
    flex-direction: column;
    position: relative;
    overflow: hidden;
}

.kevin-69-gif {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.kevin-69-close {
    position: absolute;
    top: 10px;
    right: 10px;
    background: rgba(0,0,0,0.5);
    color: white;
    border: 2px solid #ff9800;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    font-size: 20px;
    line-height: 24px;
    cursor: pointer;
    z-index: 20;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}

.kevin-69-close:hover {
    background: rgba(255, 152, 0, 0.8);
}

/* Utils */
.hidden { display: none !important; }
.kevin-hidden { display: none !important; }

/* Accessibility & Focus */
:focus {
    outline: 3px solid var(--egg-yellow);
    outline-offset: 4px;
    border-radius: 5px;
}

.egg-card:focus {
    transform: scale(1.02) rotate(1deg);
    background: #fffde7;
}

button:focus {
    transform: scale(1.05);
    box-shadow: 0 0 10px var(--egg-yellow);
}

.color-dot:focus {
    transform: scale(1.3);
    box-shadow: 0 0 5px black;
}

/* Animations */
@keyframes wobble {
    0%, 100% { border-radius: 50% 48% 52% 49% / 49% 52% 48% 51%; transform: rotate(0deg); }
    50% { border-radius: 49% 52% 48% 51% / 48% 51% 50% 48%; transform: rotate(-1deg); }
}

@media (prefers-reduced-motion: reduce) {
    .sketchbook, .timer-circle, .wisdom-box, .modal-content, .egg-card, .confetti, .shake {
        animation: none !important;
        transition: none !important;
    }
}

.shake { animation: shake-anim 0.5s both; }
@keyframes shake-anim {
    10%, 90% { transform: translate3d(-1px, 0, 0); }
    30%, 70% { transform: translate3d(-4px, 0, 0); }
    40%, 60% { transform: translate3d(4px, 0, 0); }
}

.confetti { position: fixed; top: -10px; width: 10px; height: 10px; z-index: 999; pointer-events: none; animation: fall linear forwards; }
@keyframes fall { to { transform: translateY(105vh) rotate(360deg); } }
