@import url('https://fonts.googleapis.com/css2?family=Fredoka:wght@400;600;700&display=swap');

/* ============================================================
   CSS CUSTOM PROPERTIES (Design Tokens)
   ============================================================ */
:root {
    --primary-font: 'Fredoka', system-ui, -apple-system, sans-serif;
    --color-orange:  #ff9f43;
    --color-purple:  #a55eea;
    --color-green:   #2ecc71;
    --color-yellow:  #f1c40f;
    --color-blue:    #3498db;
    --color-pink:    #ff6b9d;
    --color-white:   #ffffff;
    --color-dark:    #2c3e50;
    --shadow-soft:   0 8px 24px rgba(0,0,0,0.15);
    --shadow-button: 0 6px 0px rgba(0,0,0,0.2);
    --radius-card:   32px;
    --radius-btn:    24px;
}

/* ============================================================
   BASE RESET
   ============================================================ */
*, *::before, *::after {
    box-sizing: border-box;
    user-select: none;
    -webkit-user-select: none;
    -webkit-touch-callout: none;
    outline: none;
    margin: 0;
    padding: 0;
}

html, body {
    width: 100vw;
    height: 100vh;
    margin: 0;
    padding: 0;
    overflow: hidden;
    background-color: #aed6f1;
    font-family: var(--primary-font);
    color: var(--color-dark);
}

/* ============================================================
   GAME CONTAINER
   ============================================================ */
#game-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: linear-gradient(to bottom, #d6eaf8 0%, #a9dfbf 100%);
    box-shadow: none;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    /* iOS safe area */
    padding-top: env(safe-area-inset-top);
    padding-bottom: env(safe-area-inset-bottom);
}

#game-canvas {
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 100%;
    z-index: 1;
    display: block;
}

/* ============================================================
   OVERLAY SYSTEM
   ============================================================ */
.overlay {
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background: radial-gradient(circle, rgba(235,245,251,0.9) 0%, rgba(174,214,241,0.92) 100%);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    z-index: 10;
    display: flex;
    justify-content: center;
    align-items: center;
    opacity: 1;
    transition: opacity 0.35s ease, visibility 0.35s ease;
    overflow-y: auto;
}

.overlay.hidden {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

/* ============================================================
   MENU CARD
   ============================================================ */
.menu-content {
    background: var(--color-white);
    padding: clamp(20px, 4vw, 40px);
    border-radius: var(--radius-card);
    box-shadow: 0 16px 0px rgba(174,214,241,0.5), var(--shadow-soft);
    text-align: center;
    max-width: 92%;
    width: 480px;
    border: 6px solid var(--color-yellow);
    transform: scale(1);
    transition: transform 0.35s cubic-bezier(0.175,0.885,0.32,1.275);
}

.overlay.hidden .menu-content {
    transform: scale(0.85);
}

.start-menu-content {
    max-height: 96vh;
    overflow-y: auto;
    scrollbar-width: none;
}
.start-menu-content::-webkit-scrollbar { display: none; }

/* ============================================================
   TYPOGRAPHY — Game Title
   ============================================================ */
.game-title {
    font-size: clamp(2.4rem, 8vw, 3.8rem);
    font-weight: 700;
    margin-bottom: 4px;
    letter-spacing: 1px;
    filter: drop-shadow(3px 3px 0px rgba(0,0,0,0.1));
    animation: titleFloat 3s ease-in-out infinite alternate;
}

.game-title span {
    display: inline-block;
    text-shadow: 3px 3px 0px #fff;
    animation: letterBounce 1.5s ease-in-out infinite alternate;
}

.game-title span:nth-child(even)  { animation-delay: 0.2s; }
.game-title span:nth-child(3n)    { animation-delay: 0.4s; }
.game-title span:nth-child(4n)    { animation-delay: 0.6s; }

.t-pink   { color: var(--color-pink); }
.t-orange { color: var(--color-orange); }
.t-yellow { color: var(--color-yellow); }
.t-green  { color: var(--color-green); }
.t-blue   { color: var(--color-blue); }
.t-purple { color: var(--color-purple); }

.game-subtitle {
    font-size: clamp(0.85rem, 2.5vw, 1.15rem);
    color: #7f8c8d;
    font-weight: 600;
    margin-bottom: 14px;
    text-transform: uppercase;
    letter-spacing: 2px;
}

h2 {
    font-size: clamp(1rem, 3vw, 1.4rem);
    margin-bottom: 12px;
    color: var(--color-dark);
}

/* ============================================================
   DAILY CHALLENGE BANNER
   ============================================================ */
.daily-banner {
    display: flex;
    align-items: center;
    gap: 10px;
    background: linear-gradient(135deg, #fff9c4 0%, #ffe082 100%);
    border: 3px solid var(--color-yellow);
    border-radius: 18px;
    padding: 10px 14px;
    margin-bottom: 14px;
    text-align: left;
    position: relative;
    animation: bannerPop 0.4s cubic-bezier(0.175,0.885,0.32,1.275);
}

.daily-emoji { font-size: 1.8rem; flex-shrink: 0; }

.daily-text {
    display: flex;
    flex-direction: column;
    gap: 2px;
    flex: 1;
}

.daily-text strong {
    font-size: 0.95rem;
    color: #d35400;
}

.daily-text span {
    font-size: 0.8rem;
    color: #7f8c8d;
}

.daily-badge {
    background: var(--color-orange);
    color: white;
    font-size: 0.65rem;
    font-weight: 700;
    padding: 2px 7px;
    border-radius: 8px;
    position: absolute;
    top: -8px;
    right: 10px;
}

/* ============================================================
   MASCOT PICKER
   ============================================================ */
.mascot-picker {
    margin-bottom: 14px;
}

.picker-label {
    font-size: 0.9rem;
    color: #7f8c8d;
    font-weight: 600;
    margin-bottom: 8px;
}

.mascot-options {
    display: flex;
    justify-content: center;
    gap: 10px;
    flex-wrap: wrap;
}

.mascot-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;
    background: var(--color-white);
    border: 3px solid #dfe6e9;
    border-radius: 16px;
    padding: 10px 14px;
    cursor: pointer;
    font-family: var(--primary-font);
    font-size: 1.8rem;
    transition: all 0.2s cubic-bezier(0.175,0.885,0.32,1.275);
    box-shadow: 0 3px 0 rgba(0,0,0,0.08);
    min-width: 68px;
}

.mascot-btn small {
    font-size: 0.7rem;
    font-weight: 700;
    color: #7f8c8d;
}

.mascot-btn:hover  { transform: translateY(-3px) scale(1.05); }
.mascot-btn:active { transform: translateY(2px); }

.mascot-btn.active {
    border-color: var(--color-purple);
    background: #f5eeff;
    box-shadow: 0 3px 0 rgba(165,94,234,0.3);
}

.mascot-btn.active small { color: var(--color-purple); }

/* ============================================================
   MODE GRID
   ============================================================ */
.mode-selection { margin-bottom: 14px; }

.mode-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.mode-grid .menu-btn:last-child:nth-child(odd) {
    grid-column: span 2;
}

/* ============================================================
   HUD STYLING
   ============================================================ */
#hud {
    position: absolute;
    top: 0; left: 0;
    width: 100%;
    padding: clamp(10px, 2vw, 20px);
    z-index: 5;
    pointer-events: none;
    display: flex;
    flex-direction: column;
    gap: 10px;
    transition: opacity 0.3s ease;
}

#hud.hidden { opacity: 0; pointer-events: none; }

.hud-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
}

.score-container, .stars-container {
    background: rgba(255,255,255,0.93);
    padding: 8px 16px;
    border-radius: 20px;
    box-shadow: 0 4px 10px rgba(0,0,0,0.08);
    display: flex;
    align-items: center;
    gap: 8px;
    border: 2px solid rgba(255,255,255,0.9);
    pointer-events: auto;
}

.score-container .label {
    font-size: clamp(0.7rem, 2vw, 0.9rem);
    font-weight: 700;
    color: #7f8c8d;
}

#score-val {
    font-size: clamp(1.2rem, 4vw, 1.6rem);
    font-weight: 700;
    color: var(--color-purple);
    transition: transform 0.15s;
    display: inline-block;
}

#score-val.flash { animation: scoreFlash 0.25s ease; }

.stars-container { font-size: clamp(1rem, 3.5vw, 1.4rem); }

.controls-right {
    display: flex;
    gap: 8px;
    pointer-events: auto;
}

/* ── Instruction Banner ── */
.instruction-banner {
    background: #fff;
    padding: clamp(10px, 2vw, 16px) clamp(16px, 4vw, 36px);
    border-radius: 35px;
    box-shadow: 0 8px 0px rgba(0,0,0,0.05), var(--shadow-soft);
    border: 4px solid var(--color-blue);
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    margin: 0 auto;
    min-width: 240px;
    max-width: 500px;
    pointer-events: auto;
    position: relative;
    animation: bannerPop 0.4s cubic-bezier(0.175,0.885,0.32,1.275);
}

.instruction-banner::before, .instruction-banner::after {
    content: '';
    position: absolute;
    top: -10px;
    width: 5px; height: 12px;
    background: var(--color-blue);
    border-radius: 3px;
}
.instruction-banner::before { left: 38px; }
.instruction-banner::after  { right: 38px; }

#instruction-text {
    font-size: clamp(1.2rem, 4vw, 1.8rem);
    font-weight: 700;
    color: var(--color-blue);
}

/* ── Progress Bar ── */
.progress-bar-wrap {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 0 auto;
    width: min(400px, 88%);
    pointer-events: none;
}

.progress-bar-container {
    flex: 1;
    height: 18px;
    background: rgba(255,255,255,0.7);
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 2px 6px rgba(0,0,0,0.08);
    border: 2px solid rgba(255,255,255,0.9);
}

.progress-bar-fill {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, var(--color-green), #00d2aa);
    border-radius: 12px;
    transition: width 0.5s cubic-bezier(0.34,1.56,0.64,1);
    position: relative;
}

.progress-bar-fill::after {
    content: '';
    position: absolute;
    top: 3px; left: 6px; right: 6px;
    height: 5px;
    background: rgba(255,255,255,0.4);
    border-radius: 4px;
}

.progress-label {
    font-size: 0.9rem;
    font-weight: 700;
    color: rgba(255,255,255,0.95);
    text-shadow: 0 1px 3px rgba(0,0,0,0.3);
    white-space: nowrap;
    min-width: 40px;
}

/* ── Word Builder (Spelling Mode) ── */
.word-builder {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    background: rgba(255,255,255,0.95);
    border-radius: 20px;
    padding: 10px 20px;
    margin: 0 auto;
    width: fit-content;
    max-width: 90%;
    pointer-events: none;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    border: 3px solid var(--color-purple);
}

.word-emoji { font-size: 2rem; }

.word-slots {
    display: flex;
    gap: 8px;
}

.word-slot {
    width: 44px; height: 44px;
    border: 3px solid #bdc3c7;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--color-dark);
    background: white;
    transition: all 0.2s;
}

.word-slot.filled {
    border-color: var(--color-green);
    background: #e8f8f5;
    color: var(--color-green);
    animation: slotFill 0.3s cubic-bezier(0.175,0.885,0.32,1.275);
}

.word-slot.error {
    border-color: var(--color-pink);
    animation: slotShake 0.35s ease;
}

/* ============================================================
   BUTTONS
   ============================================================ */
.icon-btn {
    width: clamp(40px, 8vw, 48px);
    height: clamp(40px, 8vw, 48px);
    border-radius: 50%;
    border: 3px solid var(--color-white);
    background: var(--color-white);
    font-size: clamp(1rem, 3vw, 1.3rem);
    cursor: pointer;
    box-shadow: 0 4px 10px rgba(0,0,0,0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s cubic-bezier(0.175,0.885,0.32,1.275);
}

.icon-btn:hover  { transform: scale(1.12); }
.icon-btn:active { transform: scale(0.92); }
.icon-btn.muted  { opacity: 0.5; }

.voice-btn {
    background: var(--color-orange);
    color: white;
    border: none;
    padding: 5px 14px;
    border-radius: 14px;
    font-family: var(--primary-font);
    font-size: clamp(0.8rem, 2.5vw, 0.95rem);
    font-weight: 600;
    cursor: pointer;
    box-shadow: 0 3px 0 #d35400;
    display: flex;
    align-items: center;
    gap: 5px;
    transition: transform 0.1s;
}

.voice-btn:active { transform: translateY(3px); box-shadow: none; }

/* ── Menu Buttons ── */
.menu-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    width: 100%;
    padding: clamp(12px, 3vw, 16px) clamp(16px, 4vw, 24px);
    margin: 8px 0;
    font-family: var(--primary-font);
    font-size: clamp(1.1rem, 3.5vw, 1.45rem);
    font-weight: 700;
    color: var(--color-white);
    border: none;
    border-radius: var(--radius-btn);
    cursor: pointer;
    transition: transform 0.2s cubic-bezier(0.175,0.885,0.32,1.275), box-shadow 0.2s;
    text-shadow: 1px 1px 0 rgba(0,0,0,0.15);
    letter-spacing: 0.5px;
}

.menu-btn:hover  { transform: translateY(-4px) scale(1.02); }
.menu-btn:active { transform: translateY(4px); box-shadow: none !important; }

.btn-icon { font-size: clamp(1.3rem, 4vw, 1.8rem); }

/* ── Button Color Variants ── */
.orange-btn { background: var(--color-orange); box-shadow: 0 6px 0 #d35400, var(--shadow-soft); }
.purple-btn { background: var(--color-purple); box-shadow: 0 6px 0 #8854d0, var(--shadow-soft); }
.green-btn  { background: var(--color-green);  box-shadow: 0 6px 0 #27ae60, var(--shadow-soft); }
.blue-btn   { background: var(--color-blue);   box-shadow: 0 6px 0 #2980b9, var(--shadow-soft); }
.pink-btn   { background: var(--color-pink);   box-shadow: 0 6px 0 #c0392b, var(--shadow-soft); }

.yellow-btn {
    background: var(--color-yellow);
    box-shadow: 0 6px 0 #f39c12, var(--shadow-soft);
    color: var(--color-dark);
}

/* ── Extra Buttons Row ── */
.extra-btns-row {
    display: flex;
    gap: 10px;
    justify-content: center;
    margin-top: 12px;
}

.extra-btn {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 10px 14px;
    border: 3px solid #dfe6e9;
    border-radius: 16px;
    background: white;
    font-family: var(--primary-font);
    font-size: clamp(0.85rem, 2.5vw, 0.95rem);
    font-weight: 700;
    color: var(--color-dark);
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.175,0.885,0.32,1.275);
    box-shadow: 0 3px 0 rgba(0,0,0,0.08);
}

.extra-btn:hover  { transform: translateY(-2px); }
.extra-btn:active { transform: translateY(2px); box-shadow: none; }

.sticker-extra-btn { border-color: var(--color-orange); }
.trophy-extra-btn  { border-color: var(--color-yellow); }

.star-badge {
    background: var(--color-orange);
    color: white;
    padding: 2px 6px;
    border-radius: 8px;
    font-size: 0.75rem;
}

/* ── Small Action Button ── */
.small-action-btn {
    background: #f8f9fa;
    border: 2px solid #dfe6e9;
    border-radius: 10px;
    padding: 6px 12px;
    font-family: var(--primary-font);
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    color: #7f8c8d;
    transition: all 0.2s;
}

.small-action-btn:hover { background: #ffe0e0; border-color: var(--color-pink); color: var(--color-pink); }

/* ============================================================
   VOICE SELECTOR
   ============================================================ */
.voice-selector-container {
    margin: 12px 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.voice-selector-title {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--color-dark);
}

.voice-buttons { display: flex; gap: 14px; justify-content: center; }

.voice-select-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    background: white;
    border: 3px solid #bdc3c7;
    border-radius: 18px;
    padding: 10px 22px;
    cursor: pointer;
    font-family: var(--primary-font);
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--color-dark);
    transition: all 0.2s cubic-bezier(0.175,0.885,0.32,1.275);
    box-shadow: 0 3px 0 rgba(0,0,0,0.08);
}

.voice-select-btn:active { transform: translateY(2px); box-shadow: none; }
.voice-icon { font-size: 1.8rem; transition: transform 0.2s; }
.voice-select-btn:hover .voice-icon { transform: scale(1.15); }

#voice-dad.active {
    border-color: var(--color-blue);
    background: #ebf5fb;
    color: var(--color-blue);
    box-shadow: 0 3px 0 rgba(52,152,219,0.2);
}

#voice-mom.active {
    border-color: var(--color-pink);
    background: #fdf2f8;
    color: var(--color-pink);
    box-shadow: 0 3px 0 rgba(255,107,157,0.2);
}

/* ============================================================
   WIN SCREEN / CELEBRATION
   ============================================================ */
.celebration-content {
    border-color: rgba(255,235,59,0.5);
    background: radial-gradient(circle, #fff 60%, #fffde7 100%);
}

.puppy-container {
    display: inline-block;
    position: relative;
    margin-bottom: 8px;
    line-height: 1;
}

.puppy-img {
    width: clamp(100px, 28vw, 136px);
    height: auto;
    display: inline-block;
    border-radius: 18px;
    filter: drop-shadow(0 6px 12px rgba(0,0,0,0.12));
    animation: puppyBob 1.6s ease-in-out infinite alternate;
}

@keyframes puppyBob {
    0% { transform: translateY(0); }
    100% { transform: translateY(-8px); }
}

.puppy-spark {
    position: absolute;
    top: -4px;
    right: -4px;
    font-size: 1.6rem;
    animation: sparkRotate 1.8s linear infinite;
    z-index: 5;
}

@keyframes sparkRotate {
    0% { transform: rotate(0deg) scale(0.8); opacity: 0.6; }
    50% { transform: rotate(180deg) scale(1.2); opacity: 1; }
    100% { transform: rotate(360deg) scale(0.8); opacity: 0.6; }
}

.win-stats {
    display: flex;
    justify-content: space-around;
    margin: 16px 0;
    background: #f8f9fa;
    border-radius: 18px;
    padding: 12px;
    border: 2px dashed #bdc3c7;
    gap: 8px;
}

.stat-box { display: flex; flex-direction: column; gap: 4px; align-items: center; }
.stat-label { font-size: clamp(0.7rem, 2.5vw, 0.9rem); color: #95a5a6; font-weight: 600; }
.stat-value { font-size: clamp(1.1rem, 3.5vw, 1.4rem); font-weight: 700; color: var(--color-purple); }

/* Badge Award Area */
.badge-award-area {
    background: linear-gradient(135deg, #fff9c4, #ffe082);
    border-radius: 16px;
    padding: 10px 16px;
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    gap: 10px;
    animation: bannerPop 0.4s ease;
}

.badge-award-area .badge-icon { font-size: 1.8rem; }
.badge-award-area .badge-name { font-size: 0.95rem; font-weight: 700; color: #d35400; }
.badge-award-area .badge-desc { font-size: 0.78rem; color: #7f8c8d; }

/* ============================================================
   TROPHY SCREEN
   ============================================================ */
.trophy-content {
    max-height: 90vh;
    overflow-y: auto;
    scrollbar-width: none;
    width: min(520px, 94vw);
}
.trophy-content::-webkit-scrollbar { display: none; }

.trophy-subtitle {
    color: #7f8c8d;
    font-size: 0.9rem;
    margin-bottom: 16px;
}

.badge-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    margin-bottom: 16px;
}

.badge-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
    padding: 14px 8px;
    border-radius: 16px;
    border: 2px solid #dfe6e9;
    background: white;
    transition: transform 0.2s;
}

.badge-card.earned {
    border-color: var(--color-yellow);
    background: linear-gradient(135deg, #fffde7, #fff9c4);
    box-shadow: 0 4px 12px rgba(241,196,15,0.25);
}

.badge-card:hover { transform: scale(1.04); }
.badge-card .badge-emoji { font-size: 1.8rem; }
.badge-card .badge-card-name { font-size: 0.72rem; font-weight: 700; color: var(--color-dark); text-align: center; }
.badge-card.locked .badge-emoji { filter: grayscale(1); opacity: 0.35; }
.badge-card.locked .badge-card-name { color: #adb5bd; }

/* ============================================================
   STICKER BOOK
   ============================================================ */
#sticker-screen.overlay {
    background: rgba(0,0,0,0.8);
    backdrop-filter: blur(4px);
    align-items: stretch;
    flex-direction: column;
    padding: 0;
}

.sticker-book-layout {
    display: flex;
    flex: 1;
    overflow: hidden;
    border-radius: 0;
}

.sticker-scene-area {
    flex: 1;
    position: relative;
    background: #87ceeb;
}

#sticker-canvas {
    width: 100%;
    height: 100%;
    display: block;
    cursor: crosshair;
}

.sticker-bg-picker {
    position: absolute;
    bottom: 12px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 8px;
    background: rgba(255,255,255,0.9);
    border-radius: 20px;
    padding: 6px 12px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.bg-btn {
    font-size: 1.4rem;
    background: transparent;
    border: 2px solid transparent;
    border-radius: 12px;
    padding: 4px 8px;
    cursor: pointer;
    transition: all 0.2s;
}

.bg-btn:hover, .bg-btn.active {
    background: var(--color-yellow);
    border-color: var(--color-orange);
    transform: scale(1.15);
}

.sticker-shelf {
    width: clamp(100px, 28%, 160px);
    background: rgba(255,255,255,0.97);
    display: flex;
    flex-direction: column;
    border-left: 2px solid #eee;
    overflow: hidden;
}

.shelf-header {
    padding: 12px 10px 8px;
    background: linear-gradient(135deg, #fff9c4, #ffe082);
    border-bottom: 2px solid var(--color-yellow);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
}

.shelf-header h3 { font-size: 0.9rem; color: var(--color-dark); }
.shelf-stars { font-size: 0.85rem; font-weight: 700; color: var(--color-orange); }

.sticker-catalog {
    flex: 1;
    overflow-y: auto;
    padding: 8px;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6px;
    scrollbar-width: thin;
    scrollbar-color: #dfe6e9 transparent;
}

.sticker-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;
    padding: 8px 4px;
    border: 2px solid #dfe6e9;
    border-radius: 12px;
    cursor: pointer;
    background: white;
    transition: all 0.2s;
    font-family: var(--primary-font);
}

.sticker-item:hover { transform: scale(1.08); border-color: var(--color-orange); }
.sticker-item:active { transform: scale(0.95); }

.sticker-item .s-emoji { font-size: 1.6rem; }
.sticker-item .s-cost { font-size: 0.65rem; font-weight: 700; color: var(--color-orange); }
.sticker-item.locked { opacity: 0.45; cursor: not-allowed; }
.sticker-item.locked:hover { transform: none; }

.shelf-footer {
    padding: 8px 10px;
    border-top: 2px solid #eee;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
}

.shelf-hint { font-size: 0.72rem; color: #7f8c8d; }

.sticker-bottom-nav {
    display: flex;
    gap: 10px;
    padding: 12px 16px;
    background: rgba(255,255,255,0.95);
    border-top: 2px solid #eee;
}

.sticker-bottom-nav .menu-btn {
    margin: 0;
    flex: 1;
    padding: 12px;
    font-size: 1.05rem;
}

/* ============================================================
   PULSE BUTTON
   ============================================================ */
.pulse-btn { animation: buttonPulse 2s infinite; }

/* ============================================================
   TOAST NOTIFICATION
   ============================================================ */
.toast-notification {
    position: absolute;
    bottom: 80px;
    left: 50%;
    transform: translateX(-50%) translateY(0);
    background: rgba(30,30,40,0.92);
    color: white;
    padding: 12px 24px;
    border-radius: 24px;
    font-family: var(--primary-font);
    font-size: 1rem;
    font-weight: 700;
    z-index: 50;
    box-shadow: 0 8px 24px rgba(0,0,0,0.25);
    pointer-events: none;
    white-space: nowrap;
    transition: opacity 0.4s ease, transform 0.4s ease;
    max-width: 90%;
    text-align: center;
}

.toast-notification.hidden { opacity: 0; visibility: hidden; transform: translateX(-50%) translateY(20px); }
.toast-notification.show   { opacity: 1; visibility: visible; transform: translateX(-50%) translateY(0); }

/* ============================================================
   ANIMATIONS
   ============================================================ */
@keyframes titleFloat {
    0%   { transform: translateY(0) rotate(-1.5deg); }
    100% { transform: translateY(-6px) rotate(1.5deg); }
}

@keyframes letterBounce {
    0%   { transform: translateY(0); }
    100% { transform: translateY(-10px); }
}

@keyframes starRotate {
    0%   { transform: scale(1) rotate(0deg); }
    50%  { transform: scale(1.25) rotate(180deg); }
    100% { transform: scale(1) rotate(360deg); }
}

@keyframes bannerPop {
    0%   { transform: scale(0.8); opacity: 0; }
    70%  { transform: scale(1.04); }
    100% { transform: scale(1); opacity: 1; }
}

@keyframes buttonPulse {
    0%, 100% { transform: scale(1); }
    50%       { transform: scale(1.05); }
}

@keyframes scoreFlash {
    0%   { transform: scale(1); }
    40%  { transform: scale(1.4); color: var(--color-yellow); }
    100% { transform: scale(1); }
}

@keyframes slotFill {
    0%   { transform: scale(0.5); }
    80%  { transform: scale(1.15); }
    100% { transform: scale(1); }
}

@keyframes slotShake {
    0%,100% { transform: translateX(0); }
    20%     { transform: translateX(-6px); }
    40%     { transform: translateX(6px); }
    60%     { transform: translateX(-4px); }
    80%     { transform: translateX(4px); }
}

/* ============================================================
   ACCESSIBILITY — Reduced Motion
   ============================================================ */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        transition-duration: 0.01ms !important;
    }
}

/* ============================================================
   RESPONSIVE HELPERS
   ============================================================ */
@media (max-height: 700px) {
    .start-menu-content { padding: 16px; }
    .game-title         { font-size: 2rem; }
    .mascot-picker      { display: none; }
    .daily-banner       { display: none !important; }
}

@media (max-width: 380px) {
    .mode-grid          { grid-template-columns: 1fr; }
    .badge-grid         { grid-template-columns: repeat(2, 1fr); }
    .win-stats          { flex-direction: column; align-items: center; }
}

/* ============================================================
   RESPONSIVE LANDSCAPE ADJUSTMENTS
   ============================================================ */
@media (orientation: landscape) and (max-height: 600px) {
    .start-menu-content {
        display: grid;
        grid-template-columns: 1fr 1.1fr;
        gap: 12px 24px;
        width: 760px; /* Expand card width in landscape */
        max-width: 96%;
        max-height: 98%;
        padding: 10px 24px;
        align-items: center;
        border-radius: 24px;
    }
    
    .start-menu-content > h1,
    .start-menu-content > p.game-subtitle,
    .start-menu-content > .mascot-picker,
    .start-menu-content > .voice-selector-container,
    .start-menu-content > .extra-btns-row {
        grid-column: 1;
    }
    
    .start-menu-content > .mode-selection {
        grid-column: 2;
        grid-row: 1 / span 6;
        margin: 0;
    }

    .start-menu-content > .daily-banner {
        display: none !important;
    }

    .game-title { font-size: 2.2rem; margin-bottom: 0px; }
    .game-subtitle { font-size: 0.9rem; margin-bottom: 6px; }
    .mascot-picker { margin: 6px 0; }
    .mascot-picker .picker-label { font-size: 0.9rem; margin-bottom: 4px; }
    .mascot-options { gap: 6px; }
    .mascot-options button { padding: 4px 6px; border-radius: 12px; }
    .mascot-options button span { font-size: 1.1rem; }
    .mascot-options button small { display: none; }
    
    .voice-selector-container { margin: 6px 0; }
    .voice-selector-title { font-size: 0.9rem; margin-bottom: 4px; }
    .voice-buttons button { padding: 4px 10px; border-radius: 12px; }
    
    .mode-selection h2 { font-size: 1rem; margin-bottom: 4px; text-align: center; }
    .mode-grid { grid-template-columns: 1fr; gap: 6px; margin-top: 4px; max-height: 240px; overflow-y: auto; padding-right: 4px; }
    .menu-btn { padding: 10px 16px; font-size: 1.05rem; margin: 2px 0; border-radius: 16px; box-shadow: 0 4px 0 rgba(0,0,0,0.15) !important; }
    .extra-btns-row { margin-top: 6px; gap: 8px; }
    .extra-btn { padding: 6px 10px; border-radius: 12px; }

    /* ── HUD & Gameplay Landscape adjustments ── */
    #hud {
        padding: 6px 16px;
        gap: 4px;
    }
    
    .hud-top {
        margin-bottom: 0px;
    }
    
    .score-container, .stars-container {
        padding: 4px 10px;
        border-radius: 12px;
        gap: 4px;
        border-width: 1.5px;
    }
    
    .stars-container {
        font-size: 1rem;
    }

    .icon-btn {
        width: 36px;
        height: 36px;
        font-size: 0.95rem;
        border-width: 2px;
    }
    
    .volume-control {
        height: 36px;
        max-width: 36px;
        border-width: 2px;
    }
    
    .volume-control:hover,
    .volume-control:focus-within,
    .volume-control.expanded {
        max-width: 130px;
        padding-right: 8px;
        gap: 4px;
    }
    
    .volume-slider {
        width: 60px;
    }

    /* Instruction banner horizontal layout */
    .instruction-banner {
        flex-direction: row;
        padding: 4px 16px;
        border-radius: 20px;
        border-width: 2px;
        gap: 12px;
        min-width: 200px;
        max-width: 420px;
        box-shadow: 0 4px 0px rgba(0,0,0,0.05), var(--shadow-soft);
    }
    
    .instruction-banner::before, .instruction-banner::after {
        display: none; /* Hide ceiling hangers */
    }
    
    #instruction-text {
        font-size: 0.95rem;
    }
    
    .voice-btn {
        padding: 2px 8px;
        font-size: 0.75rem;
        border-radius: 8px;
        box-shadow: 0 2px 0 #d35400;
    }

    /* Progress bar scaling */
    .progress-bar-wrap {
        width: min(320px, 85%);
        gap: 6px;
        margin-top: 0px;
    }
    
    .progress-bar-container {
        height: 10px;
        border-radius: 8px;
    }
    
    .progress-bar-fill::after {
        display: none;
    }
    
    .progress-label {
        font-size: 0.75rem;
    }

    /* Word slots scaling */
    .word-builder {
        padding: 4px 10px;
        border-radius: 12px;
        border-width: 2px;
        gap: 8px;
        margin-top: 0px;
    }
    
    .word-emoji {
        font-size: 1.2rem;
    }
    
    .word-slot {
        width: 32px;
        height: 32px;
        font-size: 1.05rem;
        border-radius: 8px;
        border-width: 2px;
    }
}

/* ============================================================
   HUD VOLUME CONTROLS (EXPANDABLE SLIDERS)
   ============================================================ */
.volume-control {
    display: flex;
    align-items: center;
    gap: 0px;
    background: rgba(255, 255, 255, 0.95);
    border-radius: 24px;
    padding-right: 0px;
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
    overflow: hidden;
    max-width: 48px; /* collapsed default width */
    height: 48px;
    box-shadow: 0 4px 10px rgba(0,0,0,0.1);
    border: 3px solid var(--color-white);
}

.volume-control:hover,
.volume-control:focus-within,
.volume-control.expanded {
    max-width: 160px; /* expanded width */
    padding-right: 12px;
    gap: 8px;
}

.volume-slider {
    width: 80px;
    height: 6px;
    -webkit-appearance: none;
    appearance: none;
    background: #dfe6e9;
    border-radius: 3px;
    outline: none;
    cursor: pointer;
    transition: background 0.2s;
}

.volume-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: var(--color-orange);
    cursor: pointer;
    border: 2px solid white;
    box-shadow: 0 1px 3px rgba(0,0,0,0.15);
}

.volume-slider::-moz-range-thumb {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: var(--color-orange);
    cursor: pointer;
    border: 2px solid white;
    box-shadow: 0 1px 3px rgba(0,0,0,0.15);
}

/* ============================================================
   SETTINGS MODAL STYLING
   ============================================================ */
.settings-content {
    background: linear-gradient(135deg, #fff 0%, #fef5e7 100%) !important;
    border: 8px solid #ffd460 !important;
    max-width: 480px;
    padding: 20px !important;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.15), var(--shadow-soft) !important;
}

#settings-title {
    font-size: 2rem;
    color: var(--color-orange);
    text-shadow: 2px 2px 0px #fce5cd, 4px 4px 0px rgba(0, 0, 0, 0.05);
    margin-bottom: 8px;
}

.setting-item {
    background: rgba(255, 255, 255, 0.85);
    border: 3px solid var(--color-white);
    border-radius: 18px;
    padding: 8px 12px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    box-shadow: 0 4px 10px rgba(0,0,0,0.04);
}

.setting-label {
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--color-charcoal);
    text-align: left;
    margin: 0;
}

/* Row toggle buttons group */
.toggle-buttons-group {
    display: flex;
    gap: 8px;
    width: 100%;
}

.setting-toggle-btn {
    flex: 1;
    border: 3px solid var(--color-white);
    background: rgba(0, 0, 0, 0.04);
    border-radius: 12px;
    padding: 6px 4px;
    font-size: 0.8rem;
    font-weight: 700;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    box-shadow: 0 2px 0 rgba(0,0,0,0.1);
    color: var(--color-charcoal);
}

.setting-toggle-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 0 rgba(0,0,0,0.1);
}

.setting-toggle-btn.active {
    background: var(--color-pink);
    color: white;
    border-color: #ffd460;
    box-shadow: 0 4px 0 #c0392b;
}

.setting-toggle-btn.active:hover {
    box-shadow: 0 4px 0 #c0392b;
}

/* Slider styling */
.slider-group {
    display: flex;
    align-items: center;
    gap: 12px;
}

.setting-slider {
    flex: 1;
    -webkit-appearance: none;
    appearance: none;
    height: 8px;
    border-radius: 8px;
    background: #e2e8f0;
    outline: none;
}

.setting-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--color-orange);
    cursor: pointer;
    border: 2px solid white;
    box-shadow: 0 2px 4px rgba(0,0,0,0.15);
    transition: transform 0.1s;
}

.setting-slider::-webkit-slider-thumb:hover {
    transform: scale(1.15);
}

.slider-badge {
    background: #ffd460;
    color: #8c5e00;
    font-size: 0.7rem;
    font-weight: 700;
    padding: 2px 6px;
    border-radius: 8px;
    min-width: 38px;
    text-align: center;
    border: 2px solid white;
}

/* ============================================================
   VICTORY SUNRAYS & CARD FLASHLIGHT EFFECTS
   ============================================================ */
.victory-sunrays {
    position: absolute;
    top: 50%; left: 50%;
    width: 250vmax; height: 250vmax;
    transform: translate(-50%, -50%);
    background: repeating-conic-gradient(
        from 0deg,
        rgba(255, 235, 59, 0.22) 0deg 15deg,
        rgba(255, 193, 7, 0.02) 15deg 30deg
    );
    z-index: 1;
    pointer-events: none;
    animation: rotateRays 28s linear infinite;
    border-radius: 50%;
}

@keyframes rotateRays {
    0%   { transform: translate(-50%, -50%) rotate(0deg); }
    100% { transform: translate(-50%, -50%) rotate(360deg); }
}

.celebration-content {
    position: relative;
    overflow: hidden;
    z-index: 2; /* Sit on top of sunrays */
    border: 8px solid #ffd460 !important;
    background: radial-gradient(circle, #ffffff 60%, #fffde7 100%) !important;
    animation: cardEntrance 0.65s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}

/* Flashlight Shine Sweep Effect */
.celebration-content::before {
    content: '';
    position: absolute;
    top: -50%; left: -60%;
    width: 40%; height: 200%;
    background: linear-gradient(
        to right,
        rgba(255, 255, 255, 0) 0%,
        rgba(255, 255, 255, 0.75) 50%,
        rgba(255, 255, 255, 0) 100%
    );
    transform: rotate(30deg);
    pointer-events: none;
    animation: shineSweep 3.2s infinite ease-in-out;
}

@keyframes shineSweep {
    0%, 12% { left: -60%; }
    88%, 100% { left: 140%; }
}

@keyframes cardEntrance {
    0%   { transform: scale(0.65) translateY(60px); opacity: 0; }
    100% { transform: scale(1) translateY(0); opacity: 1; }
}

/* Bouncy star pulse */
#win-stars {
    font-size: 2.3rem;
    letter-spacing: 6px;
    display: inline-block;
    animation: starPulse 1.2s ease infinite alternate;
}

@keyframes starPulse {
    0%   { transform: scale(0.92); filter: drop-shadow(0 0 3px rgba(255,215,0,0.5)); }
    100% { transform: scale(1.16); filter: drop-shadow(0 0 15px rgba(255,215,0,0.95)); }
}

