* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
    -webkit-user-select: none;
    user-select: none;
}

:root {
    --purple: #7c4dff;
    --pink: #ff5ca8;
    --yellow: #ffd23f;
    --green: #3ddc84;
    --blue: #29b6f6;
    --orange: #ff9f43;
    --ink: #2b2150;
    --cream: #fff8e8;
    --paper: rgba(255,255,255,0.82);
    --card-radius: 26px;
    --shadow: 0 10px 24px rgba(43,33,80,0.12);
    --button-shadow: 0 7px 0 rgba(43,33,80,0.16);
}

html {
    min-height: 100%;
    overflow-x: hidden;
}

body {
    min-height: 100%;
    font-family: 'Baloo 2', system-ui, sans-serif;
    color: var(--ink);
    background:
        radial-gradient(circle at 20% 8%, rgba(255,255,255,0.9) 0 8%, transparent 22%),
        radial-gradient(circle at 88% 18%, rgba(255,210,63,0.45) 0 10%, transparent 24%),
        linear-gradient(180deg, #8fd7ff 0%, #d9f4ff 45%, #ffeec2 100%);
    position: relative;
    overflow-x: hidden;
    overscroll-behavior-x: none;
}

/* ===== Sky decorations ===== */
.sky { position: fixed; inset: 0; pointer-events: none; z-index: 0; overflow: hidden; }
.cloud { position: absolute; font-size: 56px; opacity: 0.9; animation: drift linear infinite; }
.cloud-1 { top: 8%; left: -20%; animation-duration: 40s; }
.cloud-2 { top: 22%; left: -20%; font-size: 40px; animation-duration: 55s; animation-delay: -10s; }
.cloud-3 { top: 4%; left: -20%; font-size: 32px; animation-duration: 70s; animation-delay: -30s; }
.sun { position: absolute; top: 14px; right: 16px; font-size: 60px; animation: spin 30s linear infinite; }
@keyframes drift { to { transform: translateX(140vw); } }
@keyframes spin { to { transform: rotate(360deg); } }

/* ===== App / screens ===== */
#app {
    position: relative;
    z-index: 1;
    width: min(100%, 620px);
    min-height: 100vh;
    min-height: 100dvh;
    margin: 0 auto;
}

.screen {
    position: relative;
    min-height: 100vh;
    min-height: 100dvh;
    display: none;
    flex-direction: column;
    align-items: center;
    padding: calc(14px + env(safe-area-inset-top)) clamp(14px, 4vw, 22px) calc(24px + env(safe-area-inset-bottom));
}
.screen.active { display: flex; animation: popIn 0.4s ease; }
@keyframes popIn { from { opacity: 0; transform: scale(0.96); } to { opacity: 1; transform: scale(1); } }

/* ===== Home ===== */
.home-screen {
    gap: clamp(10px, 2.6vw, 16px);
    padding-top: calc(74px + env(safe-area-inset-top));
    padding-bottom: calc(28px + env(safe-area-inset-bottom));
}
.home-screen .mascot-bubble { order: 1; }
.home-screen .game-title { order: 2; }
.home-screen .quest-summary { order: 3; }
.home-screen .compact-picker { order: 4; }
.home-screen .big-play-btn { order: 5; }
.home-screen .daily-card { order: 6; }
.home-screen .sticker-book { order: 7; }
.home-screen .stat-strip { order: 8; }
.home-screen .world-picker { order: 9; }
.mascot-bubble {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 4px;
    width: 100%;
    background: var(--paper);
    border: 3px solid rgba(255,255,255,0.9);
    border-radius: 24px;
    padding: clamp(9px, 2.7vw, 14px);
    box-shadow: var(--shadow);
    backdrop-filter: blur(10px);
}
.mascot { font-size: clamp(44px, 13vw, 58px); animation: bob 2s ease-in-out infinite; flex-shrink: 0; }
@keyframes bob { 0%,100% { transform: translateY(0) rotate(-3deg); } 50% { transform: translateY(-8px) rotate(3deg); } }
.speech {
    background: transparent;
    padding: 0;
    border-radius: 18px;
    font-size: clamp(16px, 4.5vw, 19px);
    font-weight: 600;
    box-shadow: none;
    position: relative;
    flex: 1;
}
.speech::before { display: none; }

.game-title {
    font-size: clamp(40px, 13vw, 64px);
    font-weight: 800;
    color: #fff;
    text-align: center;
    margin: 2px 0 -2px;
    letter-spacing: 1px;
    text-shadow: 0 3px 0 var(--purple), 0 6px 10px rgba(0,0,0,0.2);
}

.picker { width: 100%; margin-top: 4px; }
.picker-label {
    font-size: 17px;
    font-weight: 700;
    color: var(--ink);
    margin-bottom: 8px;
    text-align: left;
    text-shadow: 0 1px 0 #fff;
}

.theme-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
    overflow: visible;
    padding: 2px;
}

.quest-summary {
    width: 100%;
    display: grid;
    grid-template-columns: auto 1fr;
    align-items: center;
    gap: 10px;
    background: rgba(255,255,255,0.86);
    border: 3px solid rgba(255,255,255,0.9);
    border-radius: 22px;
    padding: 10px 12px;
    box-shadow: var(--shadow);
}
.quest-summary-emoji {
    width: 48px;
    height: 48px;
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #fff;
    font-size: 30px;
    box-shadow: inset 0 -3px 0 rgba(43,33,80,0.06);
}
.quest-summary-text {
    font-size: clamp(16px, 4.2vw, 18px);
    font-weight: 800;
    line-height: 1.05;
}
.theme-card {
    min-width: 0;
    background: rgba(255,255,255,0.86);
    border: 3px solid rgba(255,255,255,0.8);
    border-radius: 20px;
    padding: 12px 8px 10px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    cursor: pointer;
    box-shadow: var(--shadow);
    transition: transform 0.12s ease, border-color 0.12s ease;
    min-height: 104px;
}
.theme-card:active { transform: scale(0.94); }
.theme-card.selected { border-color: var(--purple); background: #fff; transform: translateY(-2px); }
.theme-card .emoji { font-size: 40px; line-height: 1; }
.theme-card .name { font-size: clamp(14px, 3.8vw, 16px); font-weight: 800; line-height: 1.05; text-align: center; }

.count-row {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    background: rgba(255,255,255,0.7);
    border-radius: 26px;
    padding: 7px;
    box-shadow: inset 0 2px 8px rgba(43,33,80,0.08);
}
.count-btn {
    width: auto; height: 52px;
    border-radius: 20px;
    border: none;
    background: transparent;
    color: #fff;
    font-size: 24px;
    font-weight: 800;
    font-family: inherit;
    cursor: pointer;
    box-shadow: none;
    transition: transform 0.12s ease;
    color: var(--ink);
}
.count-btn:active { transform: scale(0.9); }
.count-btn.active { background: var(--pink); color: #fff; transform: scale(1.02); box-shadow: var(--button-shadow); }

.big-play-btn {
    margin-top: 8px;
    background: linear-gradient(180deg, var(--green), #2cb56c);
    color: #fff;
    border: none;
    border-radius: 40px;
    padding: 16px 26px;
    font-size: clamp(23px, 6vw, 28px);
    font-weight: 800;
    font-family: inherit;
    cursor: pointer;
    box-shadow: 0 7px 0 #1e8f54, 0 16px 28px rgba(30,143,84,0.22);
    display: flex;
    align-items: center;
    gap: 10px;
    transition: transform 0.1s ease, box-shadow 0.1s ease;
}
.big-play-btn:active { transform: translateY(5px); box-shadow: 0 3px 0 #1e8f54; }
.play-icon { font-size: 22px; }
.home-screen .big-play-btn {
    position: sticky;
    bottom: calc(10px + env(safe-area-inset-bottom));
    width: 100%;
    justify-content: center;
    z-index: 4;
}
.home-screen .big-play-btn:active {
    transform: translateY(5px);
}

.sound-toggle, .icon-btn {
    background: #fff;
    border: none;
    border-radius: 50%;
    width: 52px; height: 52px;
    font-size: 24px;
    cursor: pointer;
    box-shadow: var(--shadow);
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0;
}
.sound-toggle {
    position: fixed;
    top: calc(12px + env(safe-area-inset-top));
    right: 14px;
    z-index: 5;
}
.sound-toggle.muted, .icon-btn.muted { opacity: 0.5; }
.music-toggle {
    position: fixed;
    top: calc(12px + env(safe-area-inset-top));
    right: 72px;
    width: 52px; height: 52px;
    background: #fff;
    border: none;
    border-radius: 50%;
    font-size: 24px;
    cursor: pointer;
    box-shadow: var(--shadow);
    display: flex; align-items: center; justify-content: center;
    z-index: 5;
}
.music-toggle.muted { opacity: 0.5; }
.settings-toggle {
    position: fixed;
    top: calc(12px + env(safe-area-inset-top));
    right: 130px;
    width: 52px; height: 52px;
    background: #fff;
    border: none;
    border-radius: 50%;
    font-size: 24px;
    cursor: pointer;
    box-shadow: var(--shadow);
    display: flex; align-items: center; justify-content: center;
    z-index: 5;
}

/* ===== Hunt ===== */
.hunt-top {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 10px;
    position: sticky;
    top: env(safe-area-inset-top);
    z-index: 8;
}
.star-counter {
    background: #fff;
    border-radius: 30px;
    padding: 8px 20px;
    font-size: 26px;
    font-weight: 800;
    color: var(--orange);
    box-shadow: var(--shadow);
    display: flex; align-items: center; gap: 6px;
}
.star-big { font-size: 26px; }
.hunt-progress-pill {
    background: rgba(255,255,255,0.9);
    border-radius: 999px;
    padding: 7px 12px;
    font-size: 16px;
    font-weight: 800;
    box-shadow: var(--shadow);
    white-space: nowrap;
}

.path {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 4px;
    margin-bottom: 10px;
    padding: 4px 0;
}
.stone {
    flex: 1;
    height: 16px;
    background: rgba(255,255,255,0.6);
    border-radius: 999px;
    border: 2px solid rgba(255,255,255,0.8);
    position: relative;
    transition: background 0.3s ease;
}
.stone.active {
    background: linear-gradient(90deg, var(--yellow), var(--orange));
    border-color: var(--orange);
}
.stone.mascot-stone {
    background: linear-gradient(90deg, var(--green), #2cb56c);
    border-color: var(--green);
}
.path-mascot {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 24px;
    transition: left 0.45s cubic-bezier(0.34,1.56,0.64,1);
    z-index: 2;
}

.guide-panel {
    width: 100%;
    background: rgba(255,255,255,0.92);
    border: 4px solid #fff;
    border-radius: 22px;
    box-shadow: var(--shadow);
    padding: 10px;
    display: grid;
    grid-template-columns: auto 1fr auto;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
}
.guide-panel.pulse { animation: guidePulse 0.45s ease; }
@keyframes guidePulse {
    0%,100% { transform: scale(1); }
    40% { transform: scale(1.03) rotate(-1deg); }
}
.guide-mascot {
    width: 54px; height: 54px;
    border-radius: 50%;
    background: linear-gradient(180deg, #fff6c8, #ffe08a);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 34px;
    box-shadow: inset 0 -3px 0 rgba(0,0,0,0.08);
}
.guide-copy { min-width: 0; }
.guide-title {
    font-size: 17px;
    font-weight: 800;
    color: var(--purple);
    line-height: 1;
}
.guide-text {
    font-size: 15px;
    font-weight: 700;
    line-height: 1.15;
    color: var(--ink);
}
.guide-mission-btn {
    width: 54px; height: 54px;
    border: none;
    border-radius: 50%;
    background: linear-gradient(180deg, var(--pink), #d83f86);
    color: #fff;
    font-size: 26px;
    box-shadow: 0 5px 0 #a92365;
    font-family: inherit;
    cursor: pointer;
}
.guide-mission-btn:active { transform: translateY(3px); box-shadow: 0 2px 0 #a92365; }

.hunt-instruction {
    font-size: clamp(18px, 5vw, 22px);
    font-weight: 700;
    text-align: center;
    margin-bottom: 14px;
    color: var(--ink);
    text-shadow: 0 1px 0 #fff;
}

.card-grid {
    width: 100%;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: clamp(10px, 3vw, 14px);
    padding-bottom: 28px;
}

.find-card {
    background: rgba(255,255,255,0.92);
    border-radius: 20px;
    padding: 14px 9px 12px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    box-shadow: var(--shadow);
    border: 4px solid rgba(255,255,255,0.9);
    position: relative;
    transition: transform 0.12s ease;
    aspect-ratio: 1 / 0.96;
    min-height: 132px;
    justify-content: center;
}
.find-card:active { transform: scale(0.94); }
.find-card .card-emoji { font-size: clamp(44px, 14vw, 70px); line-height: 1; transition: transform 0.2s ease; }
.find-card .card-name { font-size: clamp(15px, 4.3vw, 18px); font-weight: 800; text-align: center; line-height: 1.05; overflow-wrap: anywhere; }
.find-card .say-btn {
    position: absolute;
    top: 8px; right: 8px;
    background: var(--blue);
    color: #fff;
    border: none;
    width: 38px; height: 38px;
    border-radius: 50%;
    font-size: 18px;
    cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    box-shadow: 0 3px 0 rgba(0,0,0,0.15);
}
.find-card .say-btn:active { transform: scale(0.9); }
.find-card.photo-disabled .cam-btn,
.find-card.photo-disabled .photo-badge,
.photo-proof-off .cam-btn,
.photo-proof-off .photo-badge {
    display: none;
}
.big-cards .card-grid {
    grid-template-columns: 1fr;
}
.big-cards .find-card {
    aspect-ratio: 16 / 10;
    min-height: 178px;
}

.find-card.found {
    background: linear-gradient(180deg, #e8ffe8, #c9f7c9);
    border-color: var(--green);
}
.find-card.found .card-emoji { transform: scale(1.05); }
.find-card .check-stamp {
    position: absolute;
    top: 50%; left: 50%;
    transform: translate(-50%, -50%) scale(0) rotate(-25deg);
    font-size: 80px;
    pointer-events: none;
}
.find-card.found .check-stamp { animation: stamp 0.5s cubic-bezier(0.34,1.56,0.64,1) forwards; }
@keyframes stamp {
    0% { transform: translate(-50%,-50%) scale(2.4) rotate(20deg); opacity: 0; }
    60% { opacity: 1; }
    100% { transform: translate(-50%,-50%) scale(1) rotate(-12deg); opacity: 1; }
}

.find-card.pop { animation: cardPop 0.45s ease; }
@keyframes cardPop {
    0%,100% { transform: scale(1); }
    35% { transform: scale(1.12) rotate(3deg); }
    70% { transform: scale(0.96) rotate(-2deg); }
}

/* ===== Win ===== */
.win-screen { justify-content: center; text-align: center; gap: 8px; padding-bottom: calc(28px + env(safe-area-inset-bottom)); }
.win-mascot { font-size: clamp(72px, 24vw, 104px); animation: cheer 0.7s ease-in-out infinite; }
@keyframes cheer { 0%,100% { transform: rotate(-8deg) translateY(0); } 50% { transform: rotate(8deg) translateY(-12px); } }
.win-title { font-size: clamp(40px, 13vw, 52px); font-weight: 800; color: #fff; text-shadow: 0 3px 0 var(--pink), 0 6px 8px rgba(0,0,0,0.2); }
.medal { font-size: clamp(66px, 21vw, 90px); animation: bob 1.6s ease-in-out infinite; }
.win-sub { font-size: 22px; font-weight: 700; text-shadow: 0 1px 0 #fff; }
.win-stars { font-size: 40px; letter-spacing: 6px; min-height: 50px; }
.text-btn {
    background: none;
    border: none;
    font-family: inherit;
    font-size: 20px;
    font-weight: 700;
    color: var(--ink);
    cursor: pointer;
    margin-top: 6px;
    text-decoration: underline;
}

/* ===== Camera button + photo proof ===== */
.find-card .cam-btn {
    position: absolute;
    bottom: 8px; right: 8px;
    background: var(--purple);
    color: #fff;
    border: none;
    width: 38px; height: 38px;
    border-radius: 50%;
    font-size: 18px;
    cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    box-shadow: 0 3px 0 rgba(0,0,0,0.15);
    z-index: 2;
}
.find-card .cam-btn:active { transform: scale(0.9); }

.find-card .photo-thumb {
    position: absolute;
    inset: 0;
    width: 100%; height: 100%;
    object-fit: cover;
    border-radius: 21px;
    display: none;
}
.find-card.has-photo .photo-thumb { display: block; }
.find-card.has-photo .card-emoji,
.find-card.has-photo .card-name { opacity: 0; }
.find-card.has-photo .photo-badge {
    position: absolute;
    bottom: 6px; left: 6px;
    background: rgba(255,255,255,0.92);
    border-radius: 14px;
    padding: 2px 8px;
    font-size: 14px;
    font-weight: 700;
    z-index: 2;
}

/* ===== Golden surprise item ===== */
.find-card.golden {
    background: linear-gradient(135deg, #fff6c8, #ffd23f, #ffb347);
    border-color: #ffae00;
    box-shadow: 0 8px 0 #d99100, 0 0 22px rgba(255,210,63,0.8);
    animation: goldenGlow 1.4s ease-in-out infinite;
}
@keyframes goldenGlow {
    0%,100% { box-shadow: 0 8px 0 #d99100, 0 0 16px rgba(255,210,63,0.6); }
    50% { box-shadow: 0 8px 0 #d99100, 0 0 30px rgba(255,210,63,1); }
}
.find-card.golden .card-name { color: #a35a00; }

.sticker-book {
    width: 100%;
    margin-top: 0;
    background:
        linear-gradient(135deg, rgba(255,255,255,0.94), rgba(255,248,232,0.9)),
        radial-gradient(circle at 88% 20%, rgba(255,210,63,0.34), transparent 28%);
    border: 4px solid rgba(255,255,255,0.95);
    border-radius: 24px;
    padding: clamp(12px, 3vw, 16px);
    box-shadow: var(--shadow);
    position: relative;
    overflow: hidden;
}
.sticker-book::after {
    content: '✨';
    position: absolute;
    top: 10px; right: 72px;
    font-size: 26px;
    opacity: 0.5;
}
.sticker-book-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 8px;
}
.eyebrow {
    font-size: 12px;
    font-weight: 800;
    color: var(--pink);
    text-transform: uppercase;
    letter-spacing: 1px;
    line-height: 1;
}
.sticker-book h2 {
    font-size: clamp(24px, 7vw, 30px);
    line-height: 1;
}
.sticker-count-badge {
    background: var(--purple);
    color: #fff;
    border-radius: 20px;
    padding: 7px 12px;
    font-size: 16px;
    font-weight: 800;
    box-shadow: 0 5px 0 rgba(43,33,80,0.18);
}
.sticker-progress {
    height: 12px;
    border-radius: 999px;
    background: rgba(43,33,80,0.08);
    overflow: hidden;
    margin-bottom: 7px;
}
.sticker-progress-fill {
    width: 0%;
    height: 100%;
    border-radius: inherit;
    background: linear-gradient(90deg, var(--pink), var(--yellow), var(--green));
    transition: width 0.45s ease;
}
.sticker-book-sub {
    font-size: 14px;
    font-weight: 700;
    opacity: 0.78;
    margin-bottom: 10px;
}
.sticker-row {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 7px;
}
.sticker-row .sticker {
    position: relative;
    aspect-ratio: 1;
    border-radius: 16px;
    background: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: clamp(24px, 7vw, 34px);
    animation: pop-sticker 0.4s ease var(--sticker-delay, 0s) both;
    filter: drop-shadow(0 2px 2px rgba(0,0,0,0.13));
    box-shadow: inset 0 -3px 0 rgba(43,33,80,0.06);
}
.sticker-row .sticker.locked {
    color: transparent;
    background:
        radial-gradient(circle at 50% 42%, rgba(124,77,255,0.18) 0 26%, transparent 27%),
        radial-gradient(circle at 50% 80%, rgba(124,77,255,0.14) 0 22%, transparent 23%),
        repeating-linear-gradient(135deg, rgba(124,77,255,0.08) 0 8px, rgba(255,255,255,0.6) 8px 16px);
    border: 2px dashed rgba(124,77,255,0.2);
    filter: none;
    box-shadow: none;
    font-size: 20px;
}
.sticker-row .sticker.locked::after {
    content: "?";
    color: rgba(43,33,80,0.25);
    font-size: 15px;
    font-weight: 800;
}
@keyframes pop-sticker { from { transform: scale(0); } to { transform: scale(1); } }

/* ===== Sticker rarity styling ===== */
.sticker-row .sticker.rarity-common { background: #fff; }
.sticker-row .sticker.rarity-rare { background: linear-gradient(135deg, #e8f4ff, #cce5ff); border: 2px solid #b3d7ff; }
.sticker-row .sticker.rarity-legendary { background: linear-gradient(135deg, #fff6c8, #ffd23f); border: 2px solid #ffae00; }
.sticker-row .sticker .sticker-count {
    position: absolute;
    bottom: 2px; right: 2px;
    background: rgba(43,33,80,0.7);
    color: #fff;
    border-radius: 999px;
    padding: 1px 5px;
    font-size: 10px;
    font-weight: 800;
}
.sticker-row .sticker .sticker-new {
    position: absolute;
    top: 2px; right: 2px;
    background: var(--pink);
    color: #fff;
    border-radius: 999px;
    padding: 1px 5px;
    font-size: 9px;
    font-weight: 800;
    animation: pop-sticker 0.3s ease;
}

/* ===== Reward sticker (win) ===== */
.reward-sticker {
    background: #fff;
    border-radius: 22px;
    padding: 10px 22px;
    box-shadow: var(--shadow);
    display: flex; flex-direction: column; align-items: center;
}
.reward-label { font-size: 16px; font-weight: 700; color: var(--purple); }
.reward-emoji { font-size: 56px; animation: stamp 0.6s cubic-bezier(0.34,1.56,0.64,1); }
.reward-name { font-size: 18px; font-weight: 800; margin-top: 4px; }
.reward-rarity { font-size: 14px; font-weight: 700; margin-top: 2px; }
.reward-rarity.rarity-common { color: var(--ink); }
.reward-rarity.rarity-rare { color: #29b6f6; }
.reward-rarity.rarity-legendary { color: #ff9f43; }
.reward-new-badge {
    position: absolute;
    top: -8px; right: -8px;
    background: var(--pink);
    color: #fff;
    border-radius: 999px;
    padding: 4px 10px;
    font-size: 12px;
    font-weight: 800;
    box-shadow: 0 3px 0 #a92365;
}
.best-record { font-size: 16px; font-weight: 700; color: var(--purple); margin-top: 4px; }
.win-daily-tag { font-size: 18px; font-weight: 800; color: #ff9f43; margin-top: 2px; }
.photo-privacy-note { font-size: 12px; font-weight: 600; opacity: 0.6; text-align: center; margin-top: 4px; }

/* ===== Daily Quest Card ===== */
.daily-card {
    width: 100%;
    background: linear-gradient(135deg, #fff6c8, #ffe08a);
    border: 4px solid #fff;
    border-radius: 24px;
    padding: clamp(11px, 3vw, 14px);
    box-shadow: var(--shadow);
    margin-top: 4px;
}
.daily-head {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 8px;
    min-width: 0;
}
.daily-emoji { font-size: clamp(34px, 10vw, 42px); flex-shrink: 0; }
.daily-sub { font-size: clamp(14px, 3.9vw, 16px); font-weight: 700; color: var(--ink); line-height: 1.1; }
.daily-streak {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 4px;
    background: #fff;
    border-radius: 999px;
    padding: 4px 10px;
    font-size: 16px;
    font-weight: 800;
    color: #ff9f43;
    box-shadow: 0 3px 0 rgba(0,0,0,0.1);
}
.daily-btn {
    width: 100%;
    background: linear-gradient(180deg, var(--green), #2cb56c);
    color: #fff;
    border: none;
    border-radius: 20px;
    padding: 12px;
    font-size: 18px;
    font-weight: 800;
    font-family: inherit;
    cursor: pointer;
    box-shadow: 0 5px 0 #1e8f54;
}
.daily-btn:active { transform: translateY(3px); box-shadow: 0 2px 0 #1e8f54; }
.daily-btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* ===== Scrapbook (win) ===== */
.scrapbook { width: 100%; margin: 6px 0; }
.scrap-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    margin-bottom: 6px;
}
.scrap-item {
    aspect-ratio: 1/1;
    border-radius: 16px;
    background: #fff;
    box-shadow: var(--shadow);
    display: flex; align-items: center; justify-content: center;
    font-size: 36px;
    overflow: hidden;
    position: relative;
}
.scrap-item img { width: 100%; height: 100%; object-fit: cover; }
.scrap-item .scrap-tag {
    position: absolute;
    bottom: 0; left: 0; right: 0;
    background: rgba(0,0,0,0.45);
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    padding: 1px 0;
    text-align: center;
}

/* ===== Confetti ===== */
.confetti-layer { position: fixed; inset: 0; pointer-events: none; z-index: 50; overflow: hidden; }
.confetti-piece {
    position: absolute;
    width: 14px; height: 14px;
    top: -20px;
    animation: fall linear forwards;
}
@keyframes fall {
    to { transform: translateY(110vh) rotate(720deg); opacity: 0.9; }
}

.challenge-layer {
    position: fixed;
    inset: 0;
    z-index: 70;
    background: rgba(43,33,80,0.35);
    display: none;
    align-items: center;
    justify-content: center;
    padding: calc(18px + env(safe-area-inset-top)) 16px calc(18px + env(safe-area-inset-bottom));
}
.challenge-layer.active { display: flex; animation: popIn 0.22s ease; }
.challenge-card {
    width: min(430px, 100%);
    background: linear-gradient(180deg, #fff, #fff4fb);
    border-radius: 26px;
    border: 6px solid #fff;
    box-shadow: 0 12px 0 rgba(0,0,0,0.2), 0 0 40px rgba(255,92,168,0.45);
    padding: clamp(20px, 5vw, 24px) 16px 18px;
    text-align: center;
    position: relative;
}
.challenge-close {
    position: absolute;
    top: 10px; right: 10px;
    width: 42px; height: 42px;
    border: none;
    border-radius: 50%;
    background: #f0eaff;
    color: var(--purple);
    font-size: 30px;
    line-height: 1;
    font-family: inherit;
    cursor: pointer;
}
.challenge-emoji {
    font-size: clamp(62px, 19vw, 78px);
    line-height: 1;
    animation: bob 1.2s ease-in-out infinite;
}
.challenge-card h3 {
    font-size: clamp(27px, 8vw, 32px);
    color: var(--purple);
    margin: 4px 0;
}
.challenge-card p {
    font-size: clamp(18px, 5.5vw, 22px);
    font-weight: 700;
    line-height: 1.16;
    margin: 8px 4px 16px;
}
.challenge-actions {
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.challenge-primary,
.challenge-secondary {
    border: none;
    border-radius: 28px;
    font-family: inherit;
    font-weight: 800;
    cursor: pointer;
}
.challenge-primary {
    background: linear-gradient(180deg, var(--green), #28ad67);
    color: #fff;
    font-size: 24px;
    padding: 14px;
    box-shadow: 0 6px 0 #1d8750;
}
.challenge-secondary {
    background: #f0eaff;
    color: var(--purple);
    font-size: 20px;
    padding: 10px;
}
.challenge-primary:active { transform: translateY(4px); box-shadow: 0 2px 0 #1d8750; }
.challenge-secondary:active { transform: scale(0.97); }

/* ===== Onboarding Overlay ===== */
.onboard-layer {
    position: fixed;
    inset: 0;
    z-index: 80;
    background: rgba(43,33,80,0.4);
    display: none;
    align-items: center;
    justify-content: center;
    padding: calc(18px + env(safe-area-inset-top)) 16px calc(18px + env(safe-area-inset-bottom));
}
.onboard-layer.active { display: flex; animation: popIn 0.22s ease; }
.onboard-card {
    width: min(420px, 100%);
    background: linear-gradient(180deg, #fff, #fff4fb);
    border-radius: 26px;
    border: 6px solid #fff;
    box-shadow: 0 12px 0 rgba(0,0,0,0.2), 0 0 40px rgba(255,92,168,0.45);
    padding: clamp(20px, 5vw, 24px) 16px 18px;
    text-align: center;
    position: relative;
}
.onboard-mascot {
    font-size: clamp(58px, 18vw, 74px);
    line-height: 1;
    animation: bob 1.2s ease-in-out infinite;
    margin-bottom: 8px;
}
.onboard-card h3 {
    font-size: clamp(26px, 7.5vw, 30px);
    color: var(--purple);
    margin: 4px 0;
}
.onboard-card p {
    font-size: clamp(18px, 5.4vw, 21px);
    font-weight: 700;
    line-height: 1.16;
    margin: 8px 4px 16px;
}
.onboard-dots {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin-bottom: 12px;
}
.onboard-dot {
    width: 10px; height: 10px;
    border-radius: 50%;
    background: rgba(124,77,255,0.3);
}
.onboard-dot.active { background: var(--purple); }
.onboard-primary {
    border: none;
    border-radius: 28px;
    font-family: inherit;
    font-weight: 800;
    cursor: pointer;
    background: linear-gradient(180deg, var(--green), #28ad67);
    color: #fff;
    font-size: 22px;
    padding: 12px 24px;
    box-shadow: 0 6px 0 #1d8750;
}
.onboard-primary:active { transform: translateY(4px); box-shadow: 0 2px 0 #1d8750; }
.onboard-skip {
    position: absolute;
    top: 10px;
    right: 12px;
    border: none;
    background: #f0eaff;
    color: var(--purple);
    border-radius: 999px;
    padding: 6px 12px;
    font-family: inherit;
    font-size: 15px;
    font-weight: 800;
    cursor: pointer;
}

/* ===== Surprise Mix theme card ===== */
.theme-card.surprise-card {
    background: linear-gradient(135deg, #ffe9a8, #ffc2e2, #c2e9ff, #c8ffd4);
    background-size: 200% 200%;
    animation: surpriseShift 6s ease infinite;
}
.theme-card.surprise-card.selected { border-color: var(--pink); }
@keyframes surpriseShift {
    0%,100% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
}

/* ===== Quest Twist banner ===== */
.twist-banner {
    position: fixed;
    top: calc(78px + env(safe-area-inset-top));
    left: 50%;
    transform: translate(-50%, -18px) scale(0.96);
    background: #fff;
    border-radius: 22px;
    padding: 10px 14px;
    box-shadow: var(--shadow);
    display: grid;
    grid-template-columns: auto 1fr;
    align-items: center;
    gap: 10px;
    text-align: left;
    z-index: 60;
    opacity: 0;
    pointer-events: none;
    border: 4px solid var(--purple);
    width: min(420px, calc(100vw - 24px));
    max-width: none;
}
.twist-banner.show { animation: twistPop 1.5s ease forwards; }
@keyframes twistPop {
    0% { opacity: 0; transform: translate(-50%,-20px) scale(0.95); }
    18% { opacity: 1; transform: translate(-50%,0) scale(1); }
    76% { opacity: 1; transform: translate(-50%,0) scale(1); }
    100% { opacity: 0; transform: translate(-50%,-10px) scale(0.98); }
}
.twist-banner .twist-emoji { grid-row: span 2; font-size: 38px; line-height: 1; animation: bob 1.2s ease-in-out infinite; }
.twist-banner .twist-name { font-size: 20px; font-weight: 800; color: var(--purple); line-height: 1; }
.twist-banner .twist-desc { font-size: 14px; font-weight: 700; color: var(--ink); line-height: 1.05; }

/* ===== Rainbow treasure item ===== */
.find-card.rainbow {
    background: linear-gradient(135deg, #ff3b3b, #ff9f43, #ffd23f, #3ddc84, #29b6f6, #7c4dff, #ff5ca8);
    background-size: 300% 300%;
    border-color: #fff;
    animation: rainbowShift 3s linear infinite;
    box-shadow: 0 8px 0 rgba(0,0,0,0.2), 0 0 24px rgba(255,255,255,0.7);
}
@keyframes rainbowShift { to { background-position: 300% 0; } }
.find-card.rainbow .card-name { color: #fff; text-shadow: 0 1px 3px rgba(0,0,0,0.4); }

/* ===== Mystery clue item ===== */
.find-card.mystery {
    background: linear-gradient(180deg, #efe7ff, #ddd0ff);
    border-color: var(--purple);
}
.find-card.mystery .card-emoji { animation: mysteryWobble 1.6s ease-in-out infinite; }
.find-card.mystery .card-name { font-size: 14px; color: var(--purple); }
@keyframes mysteryWobble {
    0%,100% { transform: rotate(-6deg); }
    50% { transform: rotate(6deg); }
}
.find-card.mystery.revealed { background: linear-gradient(180deg, #e8ffe8, #c9f7c9); }
.find-card.mystery.revealed .card-name { font-size: 18px; color: var(--ink); }

/* ===== Random pop-in bonus critter ===== */
.critter-pop {
    position: fixed;
    z-index: 55;
    font-size: 52px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px;
    line-height: 1;
    filter: drop-shadow(0 4px 6px rgba(0,0,0,0.3));
    animation: critterIn 0.4s cubic-bezier(0.34,1.56,0.64,1), critterIdle 1.1s ease-in-out 0.4s infinite;
}
.critter-pop.caught { animation: critterCaught 0.3s ease forwards; }
@keyframes critterIn { from { transform: scale(0) rotate(-30deg); } to { transform: scale(1) rotate(0); } }
@keyframes critterIdle { 0%,100% { transform: translateY(0) rotate(-4deg); } 50% { transform: translateY(-10px) rotate(4deg); } }
@keyframes critterCaught { to { transform: scale(2.2); opacity: 0; } }

/* ===== Lifetime stats pills (home) ===== */
.stat-strip {
    display: flex;
    gap: 7px;
    justify-content: center;
    width: 100%;
    margin-top: 2px;
    flex-wrap: wrap;
}
.stat-pill {
    background: rgba(255,255,255,0.78);
    border-radius: 30px;
    padding: 5px 11px;
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 16px;
    font-weight: 800;
    color: var(--ink);
    box-shadow: 0 4px 12px rgba(43,33,80,0.08);
    border: 2px solid rgba(255,255,255,0.7);
}
.stat-pill .stat-emoji { font-size: 18px; }
.stat-pill .stat-label { font-size: 12px; font-weight: 800; opacity: 0.62; }

/* ===== Settings ===== */
.settings-layer {
    position: fixed;
    inset: 0;
    z-index: 90;
    background: rgba(43,33,80,0.38);
    display: none;
    align-items: center;
    justify-content: center;
    padding: calc(18px + env(safe-area-inset-top)) 16px calc(18px + env(safe-area-inset-bottom));
}
.settings-layer.active { display: flex; animation: popIn 0.22s ease; }
.settings-card {
    width: min(420px, 100%);
    background: linear-gradient(180deg, #fff, #f7fbff);
    border: 5px solid #fff;
    border-radius: 24px;
    box-shadow: 0 12px 0 rgba(0,0,0,0.18), var(--shadow);
    padding: 20px 16px 16px;
    position: relative;
}
.settings-card h3 {
    font-size: 30px;
    color: var(--purple);
    line-height: 1;
    margin-bottom: 12px;
}
.settings-close {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 38px;
    height: 38px;
    border: none;
    border-radius: 50%;
    background: #f0eaff;
    color: var(--purple);
    font-family: inherit;
    font-size: 28px;
    line-height: 1;
    cursor: pointer;
}
.setting-row {
    min-height: 54px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 8px 4px;
    border-top: 2px solid rgba(43,33,80,0.08);
    font-size: 18px;
    font-weight: 800;
}
.setting-row input {
    width: 28px;
    height: 28px;
    accent-color: var(--purple);
    flex-shrink: 0;
}
.settings-danger {
    width: 100%;
    margin-top: 12px;
    border: none;
    border-radius: 18px;
    background: #ffe7ef;
    color: #bd275b;
    padding: 12px;
    font-family: inherit;
    font-size: 18px;
    font-weight: 800;
    cursor: pointer;
}

/* ===== Larger screens ===== */
@media (min-width: 600px) {
    .theme-grid { grid-template-columns: repeat(4, 1fr); }
    .theme-card { min-width: 0; }
    .card-grid { grid-template-columns: repeat(3, 1fr); }
    .home-screen { padding-bottom: calc(32px + env(safe-area-inset-bottom)); }
}

@media (max-width: 380px) {
    .screen {
        padding-left: 10px;
        padding-right: 10px;
    }
    .theme-grid,
    .card-grid {
        gap: 8px;
    }
    .find-card {
        min-height: 118px;
        border-width: 3px;
    }
    .guide-panel {
        grid-template-columns: auto 1fr;
    }
    .guide-mission-btn {
        grid-column: 1 / -1;
        width: 100%;
        border-radius: 18px;
    }
    .sound-toggle,
    .music-toggle,
    .settings-toggle {
        width: 46px;
        height: 46px;
        font-size: 22px;
    }
    .music-toggle { right: 66px; }
    .settings-toggle { right: 118px; }
}

/* ===== Respect reduced-motion preference ===== */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
    .cloud, .sun { display: none; }
    .twist-banner.show { animation: none; opacity: 1; transform: translate(-50%, -50%); }
    .critter-pop { animation: none; }
}
