/* ============================================
   ANYA IN OZ — Styles v3
   MyTown-style spatial scenes with real art.
   Palette: rich jewel tones, warm, magical — NOT gloomy.
   ============================================ */

:root {
    --emerald: #1a8f4e;
    --emerald-dark: #0d5c30;
    --emerald-glow: #2dff7b;
    --gold: #d4a847;
    --gold-bright: #ffd700;
    --purple-deep: #2d1b4e;
    --purple: #6b3fa0;
    --purple-light: #9b6fd0;
    --midnight: #0d0d1a;
    --midnight-blue: #151530;
    --rose: #c84b8a;
    --rose-light: #e899bf;
    --silver: #c8c8d0;
    --parchment: #e8d5b5;
    --teal: #2a8f8f;
    --crystal: #a0d2f0;
    --bg-dark: #0a0a15;
    --text: #e8e0f0;
    --text-dim: #8888a0;
    --text-bright: #ffffff;

    --font-display: 'Cinzel', serif;
    --font-body: 'Quicksand', sans-serif;

    --wallet-height: 52px;
    --location-bar-height: 42px;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    font-family: var(--font-body);
    background: #000;
    color: var(--text);
    min-height: 100vh;
    overflow: hidden;
    -webkit-tap-highlight-color: transparent;
    user-select: none;
}

.hidden { display: none !important; }

/* ============================================
   START SCREEN
   ============================================ */

#start-screen {
    position: fixed;
    inset: 0;
    background: radial-gradient(ellipse at center, var(--purple-deep) 0%, var(--midnight) 70%, #000 100%);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 200;
    cursor: pointer;
}

#start-stars {
    position: absolute;
    inset: 0;
    background-image:
        radial-gradient(2px 2px at 20% 30%, var(--silver) 50%, transparent 100%),
        radial-gradient(2px 2px at 40% 70%, var(--crystal) 50%, transparent 100%),
        radial-gradient(1px 1px at 60% 20%, var(--gold-bright) 50%, transparent 100%),
        radial-gradient(2px 2px at 80% 50%, var(--silver) 50%, transparent 100%),
        radial-gradient(1px 1px at 10% 80%, var(--rose-light) 50%, transparent 100%),
        radial-gradient(1px 1px at 70% 90%, var(--emerald-glow) 50%, transparent 100%);
    animation: twinkle 4s ease-in-out infinite alternate;
}

@keyframes twinkle { 0% { opacity: 0.6; } 100% { opacity: 1; } }

#start-content {
    text-align: center;
    z-index: 1;
    animation: float-in 1.5s ease-out;
}

@keyframes float-in {
    0% { opacity: 0; transform: translateY(30px) scale(0.95); }
    100% { opacity: 1; transform: translateY(0) scale(1); }
}

#start-crystal {
    width: 80px;
    height: 100px;
    margin: 0 auto 24px;
    background: linear-gradient(135deg, var(--crystal) 0%, var(--purple-light) 50%, var(--rose-light) 100%);
    clip-path: polygon(50% 0%, 85% 25%, 85% 75%, 50% 100%, 15% 75%, 15% 25%);
    animation: crystal-pulse 3s ease-in-out infinite;
    box-shadow: 0 0 40px rgba(160, 210, 240, 0.3);
}

@keyframes crystal-pulse {
    0%, 100% { filter: brightness(1); transform: scale(1); }
    50% { filter: brightness(1.3); transform: scale(1.05); }
}

#start-screen h1 {
    font-family: var(--font-display);
    font-size: 42px;
    font-weight: 700;
    background: linear-gradient(135deg, var(--gold-bright), var(--emerald-glow));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 12px;
    letter-spacing: 2px;
}

#start-screen .subtitle {
    font-size: 18px;
    color: var(--rose-light);
    margin-bottom: 4px;
}

#start-screen .tagline {
    font-size: 14px;
    color: var(--text-dim);
    margin-bottom: 32px;
    font-style: italic;
}

#start-btn {
    font-family: var(--font-display);
    padding: 14px 36px;
    font-size: 18px;
    background: linear-gradient(135deg, var(--emerald-dark), var(--emerald));
    color: var(--gold-bright);
    border: 2px solid var(--gold);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s;
    letter-spacing: 1px;
    text-transform: uppercase;
}

#start-btn:hover {
    background: linear-gradient(135deg, var(--emerald), var(--teal));
    box-shadow: 0 0 20px rgba(45, 255, 123, 0.3);
    transform: translateY(-2px);
}

.start-hint {
    margin-top: 24px;
    font-size: 12px;
    color: var(--text-dim);
    opacity: 0.5;
}

/* ============================================
   GAME SCREEN LAYOUT
   ============================================ */

#game-screen {
    position: fixed;
    inset: 0;
    display: flex;
    flex-direction: column;
    background: #000;
}

/* Location bar — semi-transparent overlay */
#location-bar {
    height: var(--location-bar-height);
    background: rgba(10, 10, 21, 0.85);
    border-bottom: 1px solid rgba(212, 168, 71, 0.2);
    display: flex;
    align-items: center;
    padding: 0 12px;
    gap: 12px;
    z-index: 10;
    backdrop-filter: blur(8px);
}

#back-btn {
    font-family: var(--font-body);
    font-size: 14px;
    padding: 4px 12px;
    border: 1px solid var(--gold);
    background: rgba(212, 168, 71, 0.15);
    color: var(--gold);
    border-radius: 16px;
    cursor: pointer;
    transition: all 0.2s;
}

#back-btn:hover {
    background: var(--gold);
    color: #000;
}

.back-arrow { margin-right: 4px; }

#location-name {
    flex: 1;
    font-family: var(--font-display);
    font-size: 16px;
    color: var(--gold);
    letter-spacing: 1px;
}

#config-btn {
    font-size: 20px;
    background: none;
    border: none;
    color: var(--text-dim);
    cursor: pointer;
    padding: 4px;
    transition: color 0.2s;
}

#config-btn:hover { color: var(--gold); }

/* ============================================
   SCENE CONTAINER — the viewport
   ============================================ */

#scene-container {
    flex: 1;
    position: relative;
    overflow-x: auto;
    overflow-y: hidden;
    /* Hide scrollbar but allow scrolling */
    scrollbar-width: none;
    -ms-overflow-style: none;
}

#scene-container::-webkit-scrollbar { display: none; }

/* ============================================
   SCENE CANVAS — wider than viewport, holds everything
   ============================================ */

.scene-canvas {
    position: relative;
    min-width: 100%;
    min-height: 100%;
    background-size: auto 100%;
    background-position: left top;
    background-repeat: no-repeat;
}

/* ============================================
   CHARACTER SPRITES
   ============================================ */

.scene-character {
    position: absolute;
    cursor: grab;
    z-index: 5;
    transition: filter 0.15s;
    touch-action: none; /* prevent scroll when grabbing */
}

.scene-character img {
    display: block;
    pointer-events: none; /* clicks go to parent */
}

.scene-character:hover {
    filter: brightness(1.1);
}

.scene-character.pickup {
    cursor: grabbing;
    z-index: 50;
    filter: brightness(1.15) drop-shadow(0 4px 12px rgba(0,0,0,0.4));
    transition: none;
}

.scene-character.dragging {
    cursor: grabbing;
    z-index: 50;
    filter: brightness(1.15) drop-shadow(0 8px 20px rgba(0,0,0,0.5));
    transition: none;
}

/* Name tag below character */
.char-nametag {
    text-align: center;
    font-family: var(--font-display);
    font-size: 11px;
    color: var(--gold-bright);
    background: rgba(10, 10, 21, 0.8);
    padding: 2px 8px;
    border-radius: 8px;
    border: 1px solid rgba(212, 168, 71, 0.3);
    margin-top: 2px;
    white-space: nowrap;
    pointer-events: none;
}

/* ============================================
   OBJECT SPRITES
   ============================================ */

.scene-object {
    position: absolute;
    cursor: grab;
    z-index: 3;
    transition: transform 0.15s, filter 0.15s;
    touch-action: none;
}

.scene-object img {
    display: block;
    pointer-events: none;
}

.scene-object:not(.hotspot):hover {
    transform: scale(1.08);
    filter: brightness(1.15) drop-shadow(0 2px 8px rgba(255,215,0,0.3));
}

.scene-object.pickup {
    cursor: grabbing;
    z-index: 50;
    filter: brightness(1.15) drop-shadow(0 4px 12px rgba(255,215,0,0.3));
    transition: none;
}

.scene-object.dragging {
    cursor: grabbing;
    z-index: 50;
    filter: brightness(1.15) drop-shadow(0 8px 16px rgba(0,0,0,0.4));
    transition: none;
}

/* Hotspot objects — tappable areas over background elements */
.scene-object.hotspot {
    border-radius: 12px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-end;
    cursor: pointer;
    /* Visible pulsing shimmer so hotspots are discoverable on touch devices */
    animation: hotspot-shimmer 2.5s ease-in-out infinite;
    border: 2px dashed rgba(255, 215, 0, 0.25);
    /* Ensure minimum touch target size (48×48px) */
    min-width: 48px;
    min-height: 48px;
}

@keyframes hotspot-shimmer {
    0%, 100% { box-shadow: inset 0 0 8px rgba(255, 215, 0, 0.1), 0 0 4px rgba(255, 215, 0, 0.08); }
    50% { box-shadow: inset 0 0 20px rgba(255, 215, 0, 0.35), 0 0 14px rgba(255, 215, 0, 0.25); }
}

.scene-object.hotspot:hover {
    /* Stronger glow on hover (desktop) */
    filter: drop-shadow(0 0 8px rgba(255, 215, 0, 0.4));
    animation: none;
    box-shadow: inset 0 0 20px rgba(255, 215, 0, 0.35), 0 0 16px rgba(255, 215, 0, 0.3);
    border-color: rgba(255, 215, 0, 0.5);
}

/* After first tap, reduce shimmer — user found it */
.scene-object.hotspot.tapped {
    animation: hotspot-shimmer-tapped 4s ease-in-out infinite;
    border-color: rgba(255, 215, 0, 0.12);
}

@keyframes hotspot-shimmer-tapped {
    0%, 100% { box-shadow: none; }
    50% { box-shadow: inset 0 0 8px rgba(255, 215, 0, 0.1); }
}

/* Mitch headlight-eyes animation */
@keyframes mitch-eye-open {
    0% { transform: scaleY(0); opacity: 0; }
    50% { transform: scaleY(1.2); opacity: 1; }
    100% { transform: scaleY(1); opacity: 1; }
}

/* Labels on hotspots: always visible (with subtle bg) so touch users can find them */
.scene-object.hotspot .obj-label {
    opacity: 0.75;
    transition: opacity 0.2s;
}

.scene-object.hotspot:hover .obj-label {
    opacity: 1;
}

.scene-object.hotspot.tapped .obj-label {
    opacity: 0.5;
}

/* Object label */
.obj-label {
    text-align: center;
    font-size: 10px;
    color: var(--text);
    background: rgba(10, 10, 21, 0.75);
    padding: 1px 6px;
    border-radius: 6px;
    margin-top: 2px;
    white-space: nowrap;
    pointer-events: none;
}

/* ============================================
   EXIT ZONES
   ============================================ */

.scene-exit {
    position: absolute;
    z-index: 8;
    cursor: pointer;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    padding-bottom: 8px;
    transition: background 0.2s;
}

.scene-exit:hover {
    background: rgba(212, 168, 71, 0.15);
}

.scene-exit.exit-hover {
    background: rgba(45, 255, 123, 0.2);
    border: 2px dashed var(--emerald-glow);
}

.exit-label {
    font-family: var(--font-display);
    font-size: 12px;
    color: var(--gold);
    background: rgba(10, 10, 21, 0.8);
    padding: 6px 10px;
    border-radius: 12px;
    border: 1px solid rgba(212, 168, 71, 0.3);
    writing-mode: horizontal-tb;
    pointer-events: none;
}

/* ============================================
   SPEECH BUBBLES
   ============================================ */

.speech-bubble {
    position: absolute;
    background: rgba(255, 255, 255, 0.95);
    color: #1a1a2e;
    border-radius: 14px;
    padding: 8px 14px;
    font-size: 13px;
    font-weight: 600;
    line-height: 1.3;
    max-width: 200px;
    z-index: 20;
    transform: translateX(-50%) translateY(-100%);
    pointer-events: none;
    animation: bubble-pop 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
}

.speech-bubble::after {
    content: '';
    position: absolute;
    bottom: -8px;
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 0;
    border-left: 8px solid transparent;
    border-right: 8px solid transparent;
    border-top: 8px solid rgba(255, 255, 255, 0.95);
}

.speech-bubble.fading {
    animation: bubble-fade 0.3s ease-in forwards;
}

@keyframes bubble-pop {
    0% { opacity: 0; transform: translateX(-50%) translateY(-100%) scale(0.7); }
    100% { opacity: 1; transform: translateX(-50%) translateY(-100%) scale(1); }
}

@keyframes bubble-fade {
    to { opacity: 0; transform: translateX(-50%) translateY(-120%) scale(0.9); }
}

/* ============================================
   WALLET BAR
   ============================================ */

#wallet-bar {
    height: var(--wallet-height);
    background: rgba(10, 10, 21, 0.9);
    border-top: 1px solid rgba(26, 143, 78, 0.3);
    display: flex;
    align-items: center;
    padding: 0 12px;
    gap: 8px;
    z-index: 10;
    backdrop-filter: blur(8px);
}

#wallet-pouch {
    font-size: 24px;
    filter: drop-shadow(0 0 4px rgba(45, 255, 123, 0.3));
}

#wallet-coins {
    flex: 1;
    display: flex;
    gap: 4px;
    overflow-x: auto;
    scrollbar-width: none;
}

#wallet-coins::-webkit-scrollbar { display: none; }

.coin {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: 700;
    flex-shrink: 0;
    transition: transform 0.2s;
}

.coin:hover { transform: scale(1.15); }

.coin-1 {
    background: radial-gradient(circle at 30% 30%, #4ade80, var(--emerald-dark));
    color: #052e16;
    border: 2px solid #22c55e;
    box-shadow: 0 0 6px rgba(45, 255, 123, 0.2);
}

.coin-5 {
    background: radial-gradient(circle at 30% 30%, var(--gold-bright), #b8860b);
    color: #422006;
    border: 2px solid var(--gold);
    box-shadow: 0 0 6px rgba(255, 215, 0, 0.3);
}

.coin-10 {
    background: radial-gradient(circle at 30% 30%, var(--purple-light), var(--purple-deep));
    color: var(--text-bright);
    border: 2px solid var(--purple);
    box-shadow: 0 0 6px rgba(155, 111, 208, 0.3);
    width: 34px;
    height: 34px;
    font-size: 12px;
}

#wallet-total {
    font-family: var(--font-display);
    font-size: 13px;
    color: var(--emerald-glow);
    min-width: 80px;
    text-align: right;
    white-space: nowrap;
}

/* ============================================
   DIALOGUE BOX
   ============================================ */

#dialogue-box {
    position: absolute;
    bottom: 60px;
    left: 8px;
    right: 8px;
    background: rgba(255, 255, 255, 0.95);
    color: #1a1a2e;
    border-radius: 14px;
    padding: 12px;
    display: flex;
    gap: 12px;
    align-items: flex-start;
    z-index: 20;
    animation: slide-up 0.3s ease-out;
    box-shadow: 0 4px 20px rgba(0,0,0,0.3);
}

@keyframes slide-up {
    0% { opacity: 0; transform: translateY(20px); }
    100% { opacity: 1; transform: translateY(0); }
}

#dialogue-portrait {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: var(--purple-deep);
    border: 2px solid var(--gold);
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
}

#dialogue-content { flex: 1; }

#dialogue-speaker {
    font-family: var(--font-display);
    font-size: 12px;
    color: var(--purple);
    margin-bottom: 4px;
    letter-spacing: 1px;
}

#dialogue-text {
    font-size: 15px;
    line-height: 1.4;
    color: #1a1a2e;
}

#dialogue-dismiss {
    font-size: 20px;
    background: none;
    border: none;
    color: #888;
    cursor: pointer;
    padding: 0 4px;
}

/* ============================================
   SHOULDER VOICES
   ============================================ */

.shoulder {
    position: fixed;
    bottom: 110px;
    z-index: 15;
    animation: shoulder-pop 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes shoulder-pop {
    0% { opacity: 0; transform: scale(0.5) translateY(20px); }
    100% { opacity: 1; transform: scale(1) translateY(0); }
}

#shoulder-left { left: 8px; }
#shoulder-right { right: 8px; }

.shoulder-bubble {
    background: rgba(255, 255, 255, 0.92);
    border-radius: 12px;
    padding: 8px 14px;
    font-size: 13px;
    line-height: 1.3;
    max-width: 160px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.2);
}

#shoulder-left .shoulder-bubble {
    border: 2px solid var(--rose);
    color: #5a1a3a;
}

#shoulder-right .shoulder-bubble {
    border: 2px solid var(--teal);
    color: #1a3a3a;
}

.shoulder-label {
    font-family: var(--font-display);
    font-size: 10px;
    margin-top: 4px;
    text-align: center;
    letter-spacing: 1px;
}

#shoulder-left .shoulder-label { color: var(--rose); }
#shoulder-right .shoulder-label { color: var(--teal); }

/* ============================================
   BUY MODAL
   ============================================ */

#buy-modal {
    position: fixed;
    inset: 0;
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: center;
}

#buy-modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
}

#buy-modal-content {
    position: relative;
    background: #fff;
    color: #1a1a2e;
    border-radius: 16px;
    padding: 24px;
    text-align: center;
    min-width: 280px;
    max-width: 90vw;
    animation: modal-pop 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    box-shadow: 0 8px 30px rgba(0,0,0,0.3);
}

@keyframes modal-pop {
    0% { opacity: 0; transform: scale(0.8); }
    100% { opacity: 1; transform: scale(1); }
}

#buy-item-icon { font-size: 48px; margin-bottom: 8px; }
#buy-item-name { font-family: var(--font-display); font-size: 20px; color: var(--purple-deep); margin-bottom: 4px; }
#buy-item-price { font-size: 24px; color: var(--emerald); margin-bottom: 12px; font-weight: 700; }
#buy-comparison {
    font-size: 14px;
    color: #444;
    margin-bottom: 16px;
    line-height: 1.4;
    padding: 8px 12px;
    background: #f5f5f5;
    border-radius: 8px;
}

#buy-buttons { display: flex; gap: 12px; justify-content: center; }

/* ============================================
   VISUAL CHALLENGES — emoji groups, counting
   ============================================ */

.challenge-question {
    font-family: var(--font-display);
    font-size: 17px;
    color: var(--purple-deep);
    margin-bottom: 14px;
    line-height: 1.3;
}

.challenge-visual {
    margin-bottom: 14px;
    padding: 12px;
    background: #fafafa;
    border-radius: 12px;
    border: 2px solid #e8e0f0;
}

.challenge-compare {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
}

.challenge-count {
    display: flex;
    justify-content: center;
}

.challenge-group {
    text-align: center;
    flex: 1;
    min-width: 0;
}

.challenge-emojis {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 4px;
    min-height: 44px;
    align-items: center;
    padding: 4px;
}

.challenge-emoji {
    font-size: 32px;
    display: inline-block;
    opacity: 0;
    transform: scale(0.3);
    animation: emoji-pop 0.3s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

@keyframes emoji-pop {
    0% { opacity: 0; transform: scale(0.3) translateY(8px); }
    60% { transform: scale(1.15) translateY(-2px); }
    100% { opacity: 1; transform: scale(1) translateY(0); }
}

.challenge-group-label {
    font-family: var(--font-body);
    font-size: 12px;
    color: #888;
    margin-top: 4px;
}

.challenge-vs {
    font-family: var(--font-display);
    font-size: 14px;
    color: var(--purple-light);
    flex-shrink: 0;
    padding: 0 4px;
}

/* Challenge option buttons */
#challenge-options {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.challenge-option {
    font-family: var(--font-body);
    padding: 12px 20px;
    font-size: 16px;
    font-weight: 700;
    background: linear-gradient(135deg, var(--emerald-dark), var(--emerald));
    color: var(--text-bright);
    border: 2px solid transparent;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.2s;
    width: 100%;
}

.challenge-option:hover:not(:disabled) {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(26, 143, 78, 0.3);
}

.challenge-option:disabled {
    cursor: default;
    transform: none;
}

.challenge-option.answered {
    opacity: 0.5;
    background: #ccc;
    color: #666;
}

.challenge-option.correct {
    opacity: 1 !important;
    background: linear-gradient(135deg, #16a34a, #22c55e) !important;
    color: #fff !important;
    border-color: #15803d !important;
    animation: option-correct 0.4s ease-out;
}

.challenge-option.wrong {
    opacity: 1 !important;
    background: linear-gradient(135deg, #dc2626, #ef4444) !important;
    color: #fff !important;
    border-color: #b91c1c !important;
    animation: option-shake 0.4s ease-out;
}

@keyframes option-correct {
    0% { transform: scale(1); }
    40% { transform: scale(1.06); }
    100% { transform: scale(1); }
}

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

/* ============================================
   BUTTONS
   ============================================ */

.btn-magic {
    font-family: var(--font-body);
    padding: 10px 24px;
    font-size: 16px;
    font-weight: 700;
    background: linear-gradient(135deg, var(--emerald-dark), var(--emerald));
    color: var(--text-bright);
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-magic:hover {
    box-shadow: 0 0 12px rgba(45, 255, 123, 0.3);
    transform: translateY(-1px);
}

.btn-magic:disabled { opacity: 0.4; cursor: not-allowed; transform: none; box-shadow: none; }

.btn-ghost {
    font-family: var(--font-body);
    padding: 10px 24px;
    font-size: 16px;
    font-weight: 600;
    background: transparent;
    color: #666;
    border: 1px solid #ccc;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-ghost:hover { color: #333; border-color: #999; }

/* ============================================
   YOUTUBE OVERLAY
   ============================================ */

#youtube-overlay {
    position: fixed;
    inset: 0;
    z-index: 80;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.8);
}

#youtube-wrapper {
    position: relative;
    width: 90%;
    max-width: 560px;
    background: #1a1a2e;
    border: 2px solid var(--gold);
    border-radius: 12px;
    padding: 12px;
}

#youtube-close {
    position: absolute;
    top: -12px;
    right: -12px;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--rose);
    color: #fff;
    border: none;
    font-size: 18px;
    cursor: pointer;
    z-index: 1;
}

#youtube-player { width: 100%; aspect-ratio: 16/9; border-radius: 8px; background: #000; }

#playlist-controls { display: flex; gap: 6px; margin-top: 8px; flex-wrap: wrap; }

.playlist-btn {
    padding: 6px 14px;
    border: 1px solid var(--gold);
    background: rgba(212, 168, 71, 0.1);
    color: var(--gold);
    border-radius: 16px;
    cursor: pointer;
    font-size: 13px;
    font-family: var(--font-body);
    transition: all 0.2s;
}

.playlist-btn:hover, .playlist-btn.active {
    background: var(--gold);
    color: #000;
}

/* ============================================
   CONFIG PANEL
   ============================================ */

#config-panel {
    position: fixed;
    inset: 0;
    z-index: 90;
    display: flex;
    align-items: center;
    justify-content: center;
}

#config-backdrop { position: absolute; inset: 0; background: rgba(0,0,0,0.6); }

#config-content {
    position: relative;
    background: #fff;
    color: #1a1a2e;
    border-radius: 16px;
    padding: 24px;
    min-width: 300px;
    max-width: 90vw;
    box-shadow: 0 8px 30px rgba(0,0,0,0.3);
}

#config-content h2 {
    font-family: var(--font-display);
    color: var(--purple-deep);
    margin-bottom: 16px;
    font-size: 20px;
}

.config-group { margin-bottom: 16px; }
.config-group label { display: block; font-size: 13px; color: #666; margin-bottom: 6px; }

.config-buttons { display: flex; gap: 6px; }
.config-buttons button {
    padding: 6px 14px;
    border: 1px solid #ccc;
    background: #f5f5f5;
    color: #444;
    border-radius: 6px;
    cursor: pointer;
    font-family: var(--font-body);
    font-size: 14px;
    transition: all 0.2s;
}

.config-buttons button.active {
    border-color: var(--emerald);
    color: var(--emerald);
    background: rgba(26, 143, 78, 0.1);
}

.config-actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 20px; }

/* ============================================
   TOAST NOTIFICATIONS
   ============================================ */

#toast-container {
    position: fixed;
    top: 50px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 150;
    display: flex;
    flex-direction: column;
    gap: 8px;
    pointer-events: none;
}

.toast {
    background: rgba(255, 255, 255, 0.95);
    color: #1a1a2e;
    border-radius: 10px;
    padding: 8px 16px;
    font-size: 14px;
    font-weight: 600;
    animation: toast-in 0.3s ease-out;
    white-space: nowrap;
    box-shadow: 0 2px 10px rgba(0,0,0,0.2);
}

.toast.out { animation: toast-out 0.3s ease-in forwards; }

@keyframes toast-in {
    0% { opacity: 0; transform: translateY(-10px); }
    100% { opacity: 1; transform: translateY(0); }
}
@keyframes toast-out {
    to { opacity: 0; transform: translateY(-10px); }
}

.toast-earn { border: 2px solid var(--emerald); color: var(--emerald-dark); }
.toast-spend { border: 2px solid var(--gold); color: #8b6914; }
.toast-info { border: 2px solid var(--crystal); color: #2a6090; }

/* ============================================
   INVENTORY
   ============================================ */

#inventory-btn {
    font-size: 16px;
    background: rgba(212, 168, 71, 0.15);
    border: 1px solid var(--gold);
    color: var(--gold);
    border-radius: 16px;
    padding: 4px 10px;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 4px;
    white-space: nowrap;
}

#inventory-btn:hover {
    background: var(--gold);
    color: #000;
}

#inventory-count {
    font-size: 11px;
    font-weight: 700;
    background: var(--emerald);
    color: #fff;
    border-radius: 50%;
    width: 18px;
    height: 18px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

#inventory-panel {
    position: fixed;
    inset: 0;
    z-index: 85;
    display: flex;
    align-items: center;
    justify-content: center;
}

#inventory-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
}

#inventory-content {
    position: relative;
    background: #fff;
    color: #1a1a2e;
    border-radius: 16px;
    padding: 20px;
    min-width: 320px;
    max-width: 90vw;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: 0 8px 30px rgba(0,0,0,0.3);
    animation: modal-pop 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

#inventory-content h2 {
    font-family: var(--font-display);
    color: var(--purple-deep);
    margin-bottom: 12px;
    font-size: 20px;
}

#inventory-content h3 {
    font-family: var(--font-display);
    color: var(--emerald-dark);
    font-size: 14px;
    margin: 12px 0 8px;
    letter-spacing: 1px;
}

#inventory-items {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 8px;
}

.inventory-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 72px;
    padding: 6px;
    border: 1px solid #ddd;
    border-radius: 10px;
    background: #f8f8f8;
    cursor: pointer;
    transition: all 0.2s;
}

.inventory-item:hover {
    border-color: var(--gold);
    background: rgba(212, 168, 71, 0.1);
    transform: translateY(-2px);
}

.inventory-item img {
    width: 48px;
    height: 48px;
    object-fit: contain;
}

.inventory-item .item-name {
    font-size: 9px;
    text-align: center;
    margin-top: 4px;
    line-height: 1.2;
    color: #444;
}

#inventory-empty {
    text-align: center;
    color: #999;
    font-size: 13px;
    padding: 16px;
    font-style: italic;
}

/* Key items tracker — party preparation progress */
#key-items-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 6px;
}

.key-item {
    text-align: center;
    padding: 8px 4px;
    border: 2px dashed #ddd;
    border-radius: 10px;
    font-size: 10px;
    color: #999;
    line-height: 1.3;
}

.key-item.collected {
    border-style: solid;
    border-color: var(--emerald);
    background: rgba(26, 143, 78, 0.08);
    color: var(--emerald-dark);
}

.key-item-icon {
    font-size: 24px;
    display: block;
    margin-bottom: 2px;
}

.key-item.collected .key-item-icon {
    filter: none;
}

.key-item:not(.collected) .key-item-icon {
    filter: grayscale(1) opacity(0.3);
}

/* ============================================
   INTRO LANDING SEQUENCE
   Anya somersaults from the sky and lands.
   Surprised but ready. Badass.
   ============================================ */

#intro-sequence {
    position: fixed;
    inset: 0;
    z-index: 300;
    overflow: hidden;
}

/* Road background — the actual Yellow Brick Road scene */
#intro-road-bg {
    position: absolute;
    inset: 0;
    background: url('assets/backgrounds/yellow-brick-road.webp') center/cover no-repeat;
    opacity: 0;
    animation: intro-road-appear 1s ease-out 0.2s forwards;
}

@keyframes intro-road-appear {
    0% { opacity: 0; filter: brightness(3) saturate(0); }
    40% { opacity: 1; filter: brightness(1.5) saturate(0.5); }
    100% { opacity: 1; filter: brightness(1) saturate(1); }
}

/* Scraps bounces in from the right */
#intro-scraps {
    position: absolute;
    right: -20%;
    bottom: 20%;
    z-index: 12;
    animation: scraps-bounce-in 0.8s cubic-bezier(0.34, 1.56, 0.64, 1) 2.8s forwards;
}

#intro-scraps:not(.hidden) {
    right: 15%;
}

#intro-scraps-img {
    height: 30vh;
    max-height: 280px;
    width: auto;
    display: block;
    filter: drop-shadow(0 4px 12px rgba(0,0,0,0.3));
}

@keyframes scraps-bounce-in {
    0% { transform: translateX(100vw) rotate(-20deg); }
    60% { transform: translateX(-10px) rotate(5deg); }
    80% { transform: translateX(5px) rotate(-2deg); }
    100% { transform: translateX(0) rotate(0deg); }
}

/* Intro message — Scraps' speech */
#intro-message {
    position: absolute;
    bottom: 8%;
    left: 50%;
    transform: translateX(-50%);
    z-index: 20;
    text-align: center;
    animation: intro-msg-pop 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.intro-speech {
    background: rgba(255, 255, 255, 0.95);
    color: #1a1a2e;
    border-radius: 14px;
    padding: 12px 20px;
    font-size: 15px;
    font-weight: 600;
    max-width: 340px;
    line-height: 1.4;
    border: 2px solid var(--rose);
    box-shadow: 0 4px 16px rgba(0,0,0,0.3);
}

.intro-speaker {
    font-family: var(--font-display);
    font-size: 11px;
    color: var(--rose-light);
    margin-top: 6px;
    letter-spacing: 1px;
}

@keyframes intro-msg-pop {
    0% { opacity: 0; transform: translateX(-50%) scale(0.7) translateY(20px); }
    100% { opacity: 1; transform: translateX(-50%) scale(1) translateY(0); }
}

/* Anya — the main event */
#intro-anya {
    position: absolute;
    left: 50%;
    z-index: 10;
    transform: translateX(-50%);
    animation: anya-fall 3s cubic-bezier(0.22, 1.2, 0.36, 1) forwards;
}

#intro-anya-img {
    height: 35vh;
    max-height: 350px;
    width: auto;
    display: block;
    animation: anya-somersault 2.5s ease-in-out forwards;
    filter: drop-shadow(0 0 30px rgba(200, 160, 255, 0.5));
}

@keyframes anya-fall {
    0% {
        top: -40%;
        transform: translateX(-50%) scale(0.4);
        opacity: 0;
    }
    10% {
        opacity: 1;
    }
    60% {
        top: 50%;
        transform: translateX(-50%) scale(0.9);
    }
    80% {
        top: 62%;
        transform: translateX(-50%) scale(1.05);
    }
    90% {
        top: 58%;
        transform: translateX(-50%) scale(0.98);
    }
    100% {
        top: 60%;
        transform: translateX(-50%) scale(1);
    }
}

@keyframes anya-somersault {
    0% { transform: rotate(0deg); }
    15% { transform: rotate(180deg); }
    30% { transform: rotate(360deg); }
    45% { transform: rotate(540deg); }
    55% { transform: rotate(720deg); }
    /* Landing — slight overshoot and recover */
    70% { transform: rotate(720deg) scaleY(0.85) scaleX(1.1); }
    80% { transform: rotate(720deg) scaleY(1.05) scaleX(0.97); }
    90% { transform: rotate(720deg) scaleY(0.98) scaleX(1.01); }
    100% { transform: rotate(720deg) scaleY(1) scaleX(1); }
}

/* Dust cloud on impact */
#intro-dust {
    position: absolute;
    left: 50%;
    top: 82%;
    transform: translateX(-50%);
    width: 0;
    height: 0;
    z-index: 5;
    opacity: 0;
    animation: intro-dust-burst 0.8s ease-out 2.4s forwards;
}

#intro-dust::before,
#intro-dust::after {
    content: '';
    position: absolute;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(212, 168, 71, 0.6) 0%, transparent 70%);
}

#intro-dust::before {
    width: 200px;
    height: 60px;
    left: -100px;
    top: -30px;
}

#intro-dust::after {
    width: 300px;
    height: 80px;
    left: -150px;
    top: -40px;
    animation-delay: 0.1s;
}

@keyframes intro-dust-burst {
    0% { opacity: 0; transform: translateX(-50%) scale(0.2); }
    30% { opacity: 0.8; transform: translateX(-50%) scale(1); }
    100% { opacity: 0; transform: translateX(-50%) scale(1.8) translateY(-20px); }
}

/* Sparkle particles on landing */
#intro-sparkles {
    position: absolute;
    left: 50%;
    top: 65%;
    transform: translateX(-50%);
    width: 200px;
    height: 200px;
    z-index: 15;
    opacity: 0;
    animation: intro-sparkles-show 1.5s ease-out 2.5s forwards;
}

@keyframes intro-sparkles-show {
    0% { opacity: 0; }
    20% { opacity: 1; }
    100% { opacity: 0; }
}

/* Sparkle dots (generated by JS but styled here) */
.intro-sparkle {
    position: absolute;
    width: 4px;
    height: 4px;
    border-radius: 50%;
    background: var(--gold-bright);
    box-shadow: 0 0 6px var(--gold-bright);
    animation: sparkle-fly 1s ease-out forwards;
}

@keyframes sparkle-fly {
    0% {
        transform: translate(0, 0) scale(1);
        opacity: 1;
    }
    100% {
        transform: translate(var(--sx), var(--sy)) scale(0);
        opacity: 0;
    }
}

/* Intro fade-out */
#intro-sequence.fading {
    animation: intro-fade-out 0.6s ease-in forwards;
}

@keyframes intro-fade-out {
    0% { opacity: 1; }
    100% { opacity: 0; }
}

/* ============================================
   RESPONSIVE
   ============================================ */

/* ============================================
   RECEIPTS
   ============================================ */

#receipt-btn {
    font-size: 16px;
    background: rgba(212, 168, 71, 0.15);
    border: 1px solid var(--gold);
    color: var(--gold);
    border-radius: 16px;
    padding: 4px 10px;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 4px;
    white-space: nowrap;
}

#receipt-btn:hover {
    background: var(--gold);
    color: #000;
}

#receipt-count {
    font-size: 11px;
    font-weight: 700;
    background: var(--gold);
    color: #000;
    border-radius: 50%;
    width: 18px;
    height: 18px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.receipt {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 10px;
    border: 1px solid #e8e0f0;
    border-radius: 8px;
    background: #fafafa;
    margin-bottom: 4px;
    cursor: pointer;
    transition: all 0.2s;
}

.receipt:hover {
    border-color: var(--gold);
    background: rgba(212, 168, 71, 0.08);
}

.receipt-icon {
    font-size: 18px;
    flex-shrink: 0;
}

.receipt-text {
    font-size: 13px;
    color: #444;
    font-weight: 600;
}

#receipt-list {
    margin-bottom: 12px;
}

/* ============================================
   RESPONSIVE
   ============================================ */

@media (max-width: 400px) {
    #start-screen h1 { font-size: 32px; }
    .scene-character .char-nametag { font-size: 9px; }
}
