/* =====================================================================================================================
   Mission launch worlds (/play/{child}/mission) — one themed scene per subject / Wider Curriculum strand.
   The page markup + copy live in Components/Pages/Play/MissionWorlds.cs; the base layout (.er-mission*) is in app.css.
   Every world sets the same custom properties; body text is white on a sky deep enough for WCAG AA (≥ 4.5:1),
   buttons and chips use a light accent with dark ink. Motion is decorative only and stops under prefers-reduced-motion.
   ===================================================================================================================== */

.er-mw {
    --mw-top: #2563EB;
    --mw-bottom: #7C3AED;
    --mw-far: #4F46E5;
    --mw-near: #312E81;
    --mw-deep: #1E1B4B;
    --mw-glow: #FDE68A;
    --mw-accent: #FDE68A;
    --mw-ink: #0F172A;
    background:
        radial-gradient(1200px 500px at 50% -10%, rgba(255, 255, 255, 0.16), transparent 60%),
        linear-gradient(170deg, var(--mw-top) 0%, var(--mw-bottom) 100%);
    flex-direction: column;
    padding-bottom: calc(190px + env(safe-area-inset-bottom));
}

.er-mw--maths     { --mw-top: #1E40AF; --mw-bottom: #4338CA; --mw-far: #3346C2; --mw-near: #1E2A78; --mw-deep: #111A52; --mw-glow: #FCD34D; --mw-accent: #FCD34D; }
.er-mw--english   { --mw-top: #065F46; --mw-bottom: #0F766E; --mw-far: #13795F; --mw-near: #064E3B; --mw-deep: #022C22; --mw-glow: #FDE68A; --mw-accent: #A7F3D0; }
.er-mw--verbal    { --mw-top: #6D28D9; --mw-bottom: #A21CAF; --mw-far: #7E34C2; --mw-near: #3B0764; --mw-deep: #1E0337; --mw-glow: #F9A8D4; --mw-accent: #F9A8D4; }
.er-mw--nvr       { --mw-top: #0F172A; --mw-bottom: #4C1D95; --mw-far: #7C3AED; --mw-near: #1E1B4B; --mw-deep: #3730A3; --mw-glow: #67E8F9; --mw-accent: #67E8F9; }
.er-mw--wider     { --mw-top: #0369A1; --mw-bottom: #0F766E; --mw-far: #0284C7; --mw-near: #065F46; --mw-deep: #022C22; --mw-glow: #FDE68A; --mw-accent: #FDE68A; }
.er-mw--science   { --mw-top: #0E7490; --mw-bottom: #1D4ED8; --mw-far: #155E75; --mw-near: #0C4A6E; --mw-deep: #082F49; --mw-glow: #6EE7B7; --mw-accent: #6EE7B7; }
.er-mw--history   { --mw-top: #92400E; --mw-bottom: #7C2D12; --mw-far: #B45309; --mw-near: #431407; --mw-deep: #2A0D04; --mw-glow: #FDE68A; --mw-accent: #FCD34D; }
.er-mw--geography { --mw-top: #0369A1; --mw-bottom: #15803D; --mw-far: #166534; --mw-near: #14532D; --mw-deep: #052E16; --mw-glow: #FEF3C7; --mw-accent: #FDE047; }
.er-mw--clock     { --mw-top: #B91C1C; --mw-bottom: #7C2D12; --mw-far: #9A3412; --mw-near: #450A0A; --mw-deep: #2A0505; --mw-glow: #FDE68A; --mw-accent: #FDE047; }

/* Landscape along the bottom: far / near silhouettes + lit details. */
.er-mw__scene {
    position: absolute;
    left: 0;
    bottom: 0;
    width: 100%;
    height: 210px;
    z-index: 0;
    pointer-events: none;
}
.er-mw__scene .mw-far  { fill: var(--mw-far); }
.er-mw__scene .mw-near { fill: var(--mw-near); }
.er-mw__scene .mw-deep { fill: var(--mw-deep); }
.er-mw__scene .mw-glow { fill: var(--mw-glow); stroke: var(--mw-glow); stroke-width: 0; }
.er-mw__scene [fill='none'].mw-glow { fill: none; stroke-width: 5; }

/* A soft twinkling star field across the sky. */
.er-mw__stars {
    position: absolute;
    inset: 0 0 210px 0;
    z-index: 0;
    pointer-events: none;
    background-image:
        radial-gradient(2px 2px at 12% 18%, rgba(255, 255, 255, .8), transparent 60%),
        radial-gradient(1.5px 1.5px at 28% 62%, rgba(255, 255, 255, .6), transparent 60%),
        radial-gradient(2px 2px at 46% 12%, rgba(255, 255, 255, .7), transparent 60%),
        radial-gradient(1.5px 1.5px at 66% 38%, rgba(255, 255, 255, .6), transparent 60%),
        radial-gradient(2px 2px at 84% 22%, rgba(255, 255, 255, .8), transparent 60%),
        radial-gradient(1.5px 1.5px at 92% 58%, rgba(255, 255, 255, .5), transparent 60%),
        radial-gradient(1.5px 1.5px at 6% 48%, rgba(255, 255, 255, .5), transparent 60%);
    opacity: .55;
    animation: er-mw-twinkle 4s ease-in-out infinite alternate;
}
.er-mw--nvr .er-mw__stars, .er-mw--clock .er-mw__stars { opacity: .9; }
@keyframes er-mw-twinkle { from { opacity: .35; } to { opacity: .8; } }

.er-mw .er-mission { position: relative; z-index: 2; }

/* Themed floating scenery (six spots; the last two hide on phones). */
.er-mw__float { z-index: 1; }
.er-mw__float--1 { top: 10%; left: 9%;  font-size: 2rem;   animation-delay: 0s; }
.er-mw__float--2 { top: 18%; right: 11%; font-size: 1.6rem; animation-delay: 1.4s; }
.er-mw__float--3 { top: 44%; left: 5%;  font-size: 2.2rem; animation-delay: 2.6s; opacity: .55; }
.er-mw__float--4 { top: 50%; right: 6%; font-size: 1.9rem; animation-delay: 3.4s; opacity: .55; }
.er-mw__float--5 { top: 30%; left: 22%; font-size: 1.3rem; animation-delay: 4.2s; }
.er-mw__float--6 { top: 34%; right: 24%; font-size: 1.3rem; animation-delay: 5s; }
@media (max-width: 700px) {
    .er-mw__float--5, .er-mw__float--6 { display: none; }
    .er-mw__float--3, .er-mw__float--4 { top: 62%; }
}

/* The world badge sits in a glowing ring. */
.er-mw__badge {
    display: grid;
    place-items: center;
    width: 92px;
    height: 92px;
    border-radius: 50%;
    background: radial-gradient(circle at 50% 40%, rgba(255, 255, 255, .32), rgba(255, 255, 255, .08) 70%);
    box-shadow: 0 0 0 3px rgba(255, 255, 255, .25), 0 0 36px 6px color-mix(in srgb, var(--mw-glow) 45%, transparent);
    margin-bottom: .35rem;
}
.er-mw__badge .er-mission__badge { font-size: 3rem; }

/* "Today's island" — the topic the child picked. */
.er-mw__island {
    margin: .35rem 0 .15rem;
    padding: .3rem .9rem;
    border-radius: 999px;
    background: var(--mw-accent);
    color: var(--mw-ink);
    font-weight: 700;
    font-size: .95rem;
    box-shadow: 0 4px 12px rgba(0, 0, 0, .18);
}

/* Mission briefing: a glassy card with three goals that pop in one by one. */
.er-mw__briefing {
    width: min(420px, 100%);
    margin: .1rem 0 .55rem;
    padding: .8rem 1rem .9rem;
    border-radius: 18px;
    background: rgba(255, 255, 255, .13);
    border: 1px solid rgba(255, 255, 255, .3);
    box-shadow: 0 10px 30px rgba(0, 0, 0, .18);
    backdrop-filter: blur(4px);
    text-align: left;
}
.er-mw__briefing-title {
    margin: 0 0 .45rem;
    font-size: .78rem;
    font-weight: 800;
    letter-spacing: .08em;
    text-transform: uppercase;
    color: var(--mw-accent);
}
.er-mw__goals {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    gap: .4rem;
    counter-reset: goal;
}
.er-mw__goals li {
    display: flex;
    align-items: center;
    gap: .6rem;
    font-weight: 700;
    font-size: 1rem;
    color: #fff;
    /* Visible from the first frame (a paused or skipped animation must never hide a goal); the slide-in is a flourish. */
    animation: er-mw-goal .45s ease backwards;
}
.er-mw__goals li:nth-child(1) { animation-delay: .35s; }
.er-mw__goals li:nth-child(2) { animation-delay: .6s; }
.er-mw__goals li:nth-child(3) { animation-delay: .85s; }
.er-mw__goal-icon {
    display: grid;
    place-items: center;
    flex: 0 0 2.1rem;
    height: 2.1rem;
    border-radius: 12px;
    background: rgba(255, 255, 255, .2);
    font-size: 1.2rem;
}
@keyframes er-mw-goal { from { opacity: .35; transform: translateX(-10px); } to { opacity: 1; transform: translateX(0); } }

/* The launch button takes the world's accent (dark ink for contrast) and pulses gently a few times. */
.er-mw .er-mw__go.mud-button-root {
    background: var(--mw-accent);
    color: var(--mw-ink);
    font-weight: 800;
    border-radius: 999px;
    box-shadow: 0 8px 22px rgba(0, 0, 0, .28);
    animation: er-mw-pulse 2.4s ease-in-out 1.2s 3;
}
.er-mw .er-mw__go.mud-button-root:hover { filter: brightness(1.06); transform: translateY(-2px); }
.er-mw .er-mw__go.mud-button-root:focus-visible { outline: 3px solid #fff; outline-offset: 3px; }
@keyframes er-mw-pulse {
    0%, 100% { box-shadow: 0 8px 22px rgba(0, 0, 0, .28), 0 0 0 0 color-mix(in srgb, var(--mw-accent) 60%, transparent); }
    50% { box-shadow: 0 8px 22px rgba(0, 0, 0, .28), 0 0 0 12px transparent; }
}

@media (max-width: 600px) {
    .er-mw { padding-bottom: calc(130px + env(safe-area-inset-bottom)); }
    .er-mw__scene { height: 140px; }
    .er-mw__stars { bottom: 140px; }
    .er-mw__badge { width: 76px; height: 76px; }
    .er-mw__badge .er-mission__badge { font-size: 2.5rem; }
}

@media (prefers-reduced-motion: reduce) {
    .er-mw__stars, .er-mw .er-mw__go.mud-button-root { animation: none; }
    .er-mw__goals li { animation: none; }
}

/* Hero (badge + buddy + tip) and panel (the mission) stack on phones and sit side by side on wide screens, so the
   whole launch — story, briefing and the Start button — fits above the kid tab bar with the landscape in view. */
.er-mw__hero, .er-mw__panel { display: flex; flex-direction: column; align-items: center; gap: .35rem; width: 100%; }
@media (min-width: 900px) {
    .er-mw { padding-top: 2rem; padding-bottom: calc(230px + env(safe-area-inset-bottom)); }
    .er-mw .er-mission {
        display: grid;
        grid-template-columns: 260px minmax(0, 1fr);
        align-items: center;
        column-gap: 2.5rem;
        width: min(940px, 100%);
    }
    .er-mw__panel { align-items: flex-start; text-align: left; }
    .er-mw__panel .er-mission__facts { justify-content: flex-start; }
    .er-mw__panel .er-mission__body { max-width: 44ch; }
    .er-mw__scene { height: 250px; }
    .er-mw__stars { bottom: 250px; }
}

/* Phones: the Start button comes straight after the story (no scrolling to begin), the briefing and chips follow it,
   the world-badge ring gives way (the title still carries the world's sparkle) and only the two corner floats stay. */
@media (max-width: 700px) {
    .er-mw__float--3, .er-mw__float--4 { display: none; }
}
@media (max-width: 600px) {
    .er-mw__badge { display: none; }
    .er-mw .er-mission__bubble { margin-top: .5rem; }
    .er-mw__panel .er-mw__briefing { order: 3; margin-top: .6rem; }
    .er-mw__panel .er-mission__facts { order: 4; }
    .er-mw__panel .er-mission__later { order: 5; }
}
