:root {
    --bg1: #4b0d88;
    --bg2: #7b1fe6;
    --bg3: #4d8dff;
    --panel: rgba(255, 255, 255, 0.12);
    --panel-strong: rgba(255, 255, 255, 0.18);
    --card-light: #f4f1f7;
    --text-dark: #29335c;
    --text-soft: #55607f;
    --green: #4ade80;
    --green-dark: #16a34a;
    --red: #ef4444;
    --yellow: #f6d44a;
    --purple: #7c3aed;
    --shadow: 0 24px 60px rgba(23, 7, 56, 0.28);
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
    margin: 0;
    font-family: 'Nunito', sans-serif;
    color: #fff;
    background: radial-gradient(circle at top left, rgba(255, 176, 189, 0.24), transparent 20%),
                linear-gradient(120deg, var(--bg1), var(--bg2) 58%, var(--bg3));
    min-height: 100vh;
    overflow-x: hidden;
}

body {
    display: flex;
    justify-content: center;
    align-items: center;
}

button { font: inherit; }
img { max-width: 100%; display: block; }
.hidden, .game-hidden { display: none !important; }

.bg-orb {
    position: fixed;
    border-radius: 999px;
    filter: blur(16px);
    opacity: .38;
    pointer-events: none;
}
.orb-1 { width: 200px; height: 200px; background: #ffbc80; left: 30px; top: 30px; }
.orb-2 { width: 320px; height: 320px; background: #7dd3fc; right: -50px; top: 180px; }
.orb-3 { width: 240px; height: 240px; background: #f472b6; left: 20%; bottom: -60px; }

.intro-screen {
    width: min(1280px, calc(100% - 40px));
    margin: auto;
    position: relative;
    z-index: 1;
}

.game-container {
    width: min(1280px, calc(100% - 40px));
    margin: auto;
    position: relative;
    z-index: 1;
}

/* .intro-card {
    display: grid;
    grid-template-columns: 1.12fr .88fr;
    gap: 28px;
    align-items: stretch;
    background: linear-gradient(135deg, rgba(73, 18, 123, .95), rgba(36, 12, 92, .82));
    border-radius: 36px;
    padding: 34px;
    min-height: 60vh;
    box-shadow: var(--shadow);
    border: 1px solid rgba(255,255,255,.14);
} */

.intro-card {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(320px, 420px);
    gap: 24px;
    align-items: center;
    background: linear-gradient(135deg, rgba(73, 18, 123, .95), rgba(36, 12, 92, .82));
    border-radius: 38px;
    padding: 34px;
    min-height: min(860px, calc(100vh - 48px));
    box-shadow: 0 0 0 1px rgba(255,255,255,0.04) inset, 0 40px 90px rgba(0,0,0,0.45);
    border: 1px solid rgba(255,255,255,0.12);
    backdrop-filter: blur(18px);
    overflow: hidden;
}

.intro-copy {
    display: flex;
    flex-direction: column;
    justify-content: center;
    min-height: 100%;
}
.intro-badge, .story-tag, .step-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    border-radius: 999px;
    padding: 10px 18px;
    font-weight: 800;
}
.intro-badge {
    align-self: flex-start;
    background: rgba(255,255,255,.12);
    color: #fff7b3;
}
.intro-copy h1, .question-box h2 {
    font-family: 'Fredoka', sans-serif;
    line-height: 1.08;
    margin: 18px 0 14px;
}
.intro-copy h1 { font-size: clamp(2.3rem, 4vw, 4rem); }
.intro-copy p {
    font-size: 1.2rem;
    line-height: 1.65;
    margin: 0 0 14px;
    max-width: 720px;
    color: rgba(255,255,255,.93);
}
.intro-actions { display: flex; gap: 14px; margin-top: 14px; flex-wrap: wrap; }
.intro-visual {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100%;
}
.intro-mascot-glow {
    position: absolute;
    width: 340px;
    height: 340px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(255,255,255,.42), rgba(255,255,255,0));
}
.intro-art {
    width: min(420px, 100%);
    max-width: 100%;
    height: clamp(300px, 28vw, 396px);
    object-fit: contain;
    animation: floaty 3.5s ease-in-out infinite;
}

.btn-action, .btn-secondary {
    border: 0;
    border-radius: 18px;
    padding: 14px 22px;
    cursor: pointer;
    font-weight: 900;
    transition: transform .18s ease, box-shadow .18s ease, opacity .18s ease;
}
.btn-action:hover, .btn-secondary:hover, .answer-option:hover, .choice-card:hover, .drag-item:hover { transform: translateY(-2px); }
.btn-action {
    background: linear-gradient(135deg, #ffd94f, #ffb525);
    color: #3a2065;
    box-shadow: 0 14px 30px rgba(255, 194, 44, .28);
}
.btn-secondary {
    background: rgba(255,255,255,.96);
    color: #46558a;
}
.btn-large { padding: 16px 26px; font-size: 1.05rem; }
.btn-listen { padding: 12px 18px; }

.game-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 20px;
    padding: 18px 20px;
    border-radius: 28px;
    background: rgba(52, 15, 101, .88);
    box-shadow: var(--shadow);
    border: 1px solid rgba(255,255,255,.12);
}
.player-info { display: flex; align-items: center; gap: 16px; }
.avatar-wrap {
    width: 68px; height: 68px; border-radius: 20px; background: linear-gradient(135deg, #ffd94f, #ffb525); padding: 10px;
}
.avatar-image { width: 100%; height: 100%; object-fit: contain; }
.player-name { display: block; font-weight: 900; font-size: 1.28rem; }
.player-subtitle { color: rgba(255,255,255,.8); font-weight: 700; }
.header-right { display: flex; align-items: center; gap: 16px; }
.phase-box {
    display: flex; align-items: center; gap: 16px; min-width: 320px; background: rgba(255,255,255,.1);
    border-radius: 22px; padding: 14px 18px;
}
.phase-stars { color: #ffe45e; font-size: 1.8rem; letter-spacing: 3px; }
.phase-copy { flex: 1; }
.phase-copy span { font-weight: 800; }
.phase-bar, .phase-progress-line {
    margin-top: 8px; height: 14px; background: rgba(255,255,255,.18); border-radius: 999px; overflow: hidden;
}
.phase-bar-fill, .screen-progress-fill {
    height: 100%; width: 0%; border-radius: inherit; background: linear-gradient(90deg, #46ea91, #9cff66);
    transition: width .35s ease;
}

.game-layout {
    margin-top: 16px;
    display: grid;
    grid-template-columns: 1.08fr .92fr;
    gap: 16px;
}
.visual-panel {
    background: linear-gradient(180deg, rgba(170, 92, 215, .34), rgba(139, 58, 224, .52));
    border-radius: 34px;
    padding: 18px;
    border: 1px solid rgba(255,255,255,.12);
    box-shadow: var(--shadow);
    min-height: 720px;
}
.panel-top {
    display: flex; justify-content: space-between; align-items: center; gap: 14px; margin-bottom: 16px;
}
.step-badge { background: rgba(255,255,255,.22); color: #fff; }
.visual-box {
    min-height: 620px;
    border-radius: 28px;
    background: linear-gradient(135deg, rgba(255,255,255,.15), rgba(255,255,255,.06));
    border: 1px solid rgba(255,255,255,.14);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    position: relative;
    overflow: hidden;
}
.story-illustration {
    width: 100%; height: 100%; max-height: 560px; object-fit: contain; filter: drop-shadow(0 18px 28px rgba(40,12,90,.18));
}
.visual-stack { width: 100%; display: grid; gap: 18px; }
.drag-gallery {
    display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 16px; width: 100%; align-items: start;
}
.drag-item, .choice-card {
    border-radius: 24px; background: rgba(255,255,255,.94); padding: 10px; cursor: grab; border: 3px solid transparent;
    box-shadow: 0 16px 32px rgba(23,7,56,.14); transition: transform .18s ease, border-color .18s ease, box-shadow .18s ease;
}
.drag-item.dragging { opacity: .55; transform: scale(.97); }
.drop-zone {
    position: absolute; left: 50%; top: 64%; transform: translate(-50%, -50%); width: 220px; height: 220px;
    border-radius: 28px; border: 3px dashed rgba(255,255,255,.78); background: rgba(255,255,255,.12);
    display: flex; align-items: center; justify-content: center; color: #fff; font-weight: 900; text-align: center; padding: 16px;
}
.drop-zone.active { background: rgba(255,255,255,.22); }
.drop-zone.done { border-style: solid; background: rgba(74, 222, 128, .22); }
.card-challenge {
    min-height: 720px;
    background: #f2eff4;
    color: var(--text-dark);
    border-radius: 34px;
    padding: 24px;
    box-shadow: var(--shadow);
}
.card-header {
    display: flex; justify-content: space-between; align-items: center; gap: 16px; margin-bottom: 16px;
}
.story-tag { background: linear-gradient(135deg, #8b5cf6, #3b82f6); color: #fff; }
.score-badge {
    min-width: 100px; padding: 18px 20px; border-radius: 20px; background: #f7e28b; color: #8c6b00;
    display: flex; justify-content: center; align-items: center; gap: 12px; font-weight: 900; font-size: 1.65rem;
}
.question-box h2 { color: #2f3564; font-size: clamp(2rem, 3vw, 3rem); margin-top: 8px; }
.question-text {
    background: rgba(15, 23, 42, .06);
    border-radius: 26px;
    padding: 22px;
    /* min-height: 164px; */
    min-height: 100%!important;
    color: #4a567d;
    font-weight: 800;
    font-size: 1rem;
    line-height: 1.65;
}
.question-text p { margin: 0 0 10px; }
.interaction-area { margin-top: 18px; display: grid; gap: 14px; }
.answer-option {
    width: 100%; display: flex; align-items: center; gap: 16px; border-radius: 22px; border: 2px solid transparent;
    background: #fff; padding: 18px; font-size: 1.1rem; font-weight: 900; color: #4d5b7e; cursor: pointer;
}
.answer-option .option-letter {
    width: 42px; height: 42px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center;
    background: linear-gradient(135deg, #8b5cf6, #3b82f6); color: #fff; flex: 0 0 42px;
}
.answer-option.correct { border-color: var(--green); background: rgba(74,222,128,.08); }
.answer-option.wrong { border-color: var(--red); background: rgba(239,68,68,.06); }
.challenge-actions { margin-top: 18px; display: flex; gap: 12px; }
.challenge-actions .btn-action, .challenge-actions .btn-secondary { min-width: 180px; }

.choice-grid, .story-choice-grid { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 16px; }
.choice-card {
    cursor: pointer;
    text-align: center;
}
.choice-card span, .drag-item span { display: block; font-weight: 900; color: #47557e; margin-top: 10px; }
.choice-card.correct { border-color: var(--green); background: rgba(74,222,128,.1); }
.choice-card.wrong { border-color: var(--red); background: rgba(239,68,68,.08); }

.modal-overlay {
    position: fixed; inset: 0; background: rgba(16, 8, 33, .68); display: flex; align-items: center; justify-content: center; padding: 20px; z-index: 30;
}
.modal-card {
    width: min(560px, 100%); background: #fff; color: var(--text-dark); border-radius: 30px; padding: 30px; position: relative; box-shadow: 0 24px 70px rgba(0,0,0,.3);
    text-align: center;
}
.modal-card-wide { width: min(720px, 100%); }
.modal-close {
    position: absolute; top: 16px; right: 16px; width: 42px; height: 42px; border-radius: 50%; border: 0; cursor: pointer; background: rgba(15,23,42,.08); color: #374151; font-size: 1.2rem;
}
.modal-icon {
    width: 88px; height: 88px; border-radius: 50%; margin: 0 auto 16px; display: flex; align-items: center; justify-content: center; font-size: 2.2rem;
}
.modal-icon-book { background: rgba(59,130,246,.12); }
.modal-icon-feedback-positive { background: rgba(74,222,128,.16); }
.modal-icon-feedback-negative { background: rgba(239,68,68,.14); }
.instructions-list { display: grid; gap: 14px; margin-top: 18px; text-align: left; }
.instruction-item {
    display: grid; grid-template-columns: 46px 1fr; gap: 12px; align-items: start; background: rgba(15,23,42,.05); border-radius: 20px; padding: 14px;
}
.instruction-item span {
    width: 46px; height: 46px; border-radius: 50%; background: linear-gradient(135deg, #8b5cf6, #3b82f6); color: #fff; display: flex; align-items: center; justify-content: center; font-weight: 900;
}
.modal-action { margin-top: 12px; }
.screen-caption {
    position: absolute; left: 24px; right: 24px; bottom: 24px; background: rgba(53, 18, 102, .75); color: #fff; border-radius: 22px; padding: 16px 18px; font-weight: 800; line-height: 1.5;
}
.inline-note {
    border-radius: 18px; padding: 14px 16px; background: rgba(59,130,246,.08); color: #46558a; font-weight: 800;
}
.complete-message {
    display: grid; gap: 14px; color: #fff; text-align: center;
}
.complete-message h3 { font-family: 'Fredoka', sans-serif; font-size: 2.2rem; margin: 0; }
.complete-message ul { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; font-weight: 800; }

@keyframes floaty {
    0%,100% { transform: translateY(0); }
    50% { transform: translateY(-14px); }
}

@media (max-width: 1080px) {
    .intro-card, .game-layout { grid-template-columns: 1fr; }
    .visual-panel, .card-challenge { min-height: auto; }
    .visual-box { min-height: 420px; }
}

@media (max-width: 720px) {
    .intro-screen, .game-container { width: min(100% - 18px, 1280px); }
    .intro-card, .visual-panel, .card-challenge { padding: 18px; border-radius: 26px; }
    .game-header, .phase-box, .card-header, .panel-top, .challenge-actions { flex-direction: column; align-items: stretch; }
    .phase-box { min-width: 0; }
    .drag-gallery, .choice-grid, .story-choice-grid { grid-template-columns: 1fr; }
    .drop-zone { width: 180px; height: 180px; top: 60%; }
    .score-badge { align-self: flex-start; }
}

@media (max-width: 960px) {
    .intro-card { min-height: auto; }
    .intro-art { height: auto; }
}
