/* ── Base ───────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }

:root {
    --color-bg: #1a1625;
    --color-bg-soft: #25203a;
    --color-text: #f4ecdc;
    --color-muted: #b9aec9;
    --color-accent: #ffb00e;
    --color-accent-soft: rgba(255, 176, 14, 0.18);
    --color-border: rgba(244, 236, 220, 0.12);
    --max-content: 640px;
}

html, body {
    margin: 0;
    padding: 0;
    background: var(--color-bg);
    color: var(--color-text);
    font-family: 'Lato', system-ui, sans-serif;
    font-weight: 300;
    line-height: 1.6;
    min-height: 100%;
    overflow-x: hidden;
}

body {
    background:
        radial-gradient(ellipse at top, rgba(255, 176, 14, 0.06) 0%, rgba(0,0,0,0) 55%),
        radial-gradient(ellipse at bottom, rgba(143, 127, 161, 0.10) 0%, rgba(0,0,0,0) 60%),
        var(--color-bg);
    background-attachment: fixed;
    display: flex;
    flex-direction: column;
}

a { color: var(--color-accent); text-decoration: none; }
a:hover { text-decoration: underline; }

img { max-width: 100%; display: block; }

h1, h2 {
    font-family: 'Economica', sans-serif;
    font-weight: 700;
    letter-spacing: 1px;
    margin: 0;
}

p { margin: 0 0 1rem; }

.main {
    flex: 1;
    width: 100%;
    max-width: var(--max-content);
    margin: 0 auto;
    padding: 5rem 1.25rem 3rem;
}

.site-footer {
    text-align: center;
    color: var(--color-muted);
    font-size: 0.8rem;
    padding: 2rem 1rem 1.5rem;
    opacity: 0.7;
}

/* The footer line links to the main Heimattagung site — keep it looking
   like the muted footer text, not an accent-coloured link. */
.site-footer a {
    color: inherit;
}

/* ── Landing page ───────────────────────────────────── */
.intro {
    text-align: center;
    padding-top: 1rem;
}

.intro-title {
    font-size: 2.8rem;
    margin: 0 0 0.5rem;
    color: var(--color-text);
}

.intro-tagline {
    font-family: 'Economica', sans-serif;
    color: var(--color-accent);
    letter-spacing: 3px;
    text-transform: uppercase;
    font-size: 0.95rem;
    margin: 0 0 2rem;
}

.intro-text {
    color: var(--color-muted);
    max-width: 460px;
    margin: 0 auto 2.5rem;
    font-size: 1.05rem;
}

/* ── Simple click-through version (/sagen/) ─────────── */
/* Ungamified variant: all Sagen listed as cards, no QR hunt, no locking. */
.sagen {
    text-align: center;
    padding-top: 1rem;
}

.sagen-list {
    list-style: none;
    margin: 0 auto;
    padding: 0;
    max-width: 560px;
    display: flex;
    flex-direction: column;
    gap: 0.9rem;
    text-align: left;
}

.sagen-list li {
    animation: riseIn 0.7s ease-out var(--rise, 0ms) backwards;
}

.sagen-list li:nth-child(1) { --rise: 270ms; }
.sagen-list li:nth-child(2) { --rise: 360ms; }
.sagen-list li:nth-child(3) { --rise: 450ms; }
.sagen-list li:nth-child(4) { --rise: 540ms; }
.sagen-list li:nth-child(5) { --rise: 630ms; }

.sagen-card {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem 1.1rem;
    background: var(--color-bg-soft);
    border: 1px solid var(--color-border);
    border-radius: 14px;
    color: var(--color-text);
    transition: transform 0.2s ease, border-color 0.2s ease, background 0.2s ease;
}

.sagen-card:hover {
    transform: translateY(-3px);
    border-color: var(--color-accent);
    background: var(--color-accent-soft);
    text-decoration: none;
}

.sagen-card:active {
    transform: translateY(-1px) scale(0.98);
}

.sagen-card-logo {
    width: 56px;
    height: 56px;
    flex-shrink: 0;
    object-fit: contain;
    background: #ffffff;
    border-radius: 12px;
    padding: 6px;
    box-shadow: 0 4px 10px rgba(0,0,0,0.4);
}

.sagen-card-text {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
    min-width: 0;
}

.sagen-card-kicker {
    font-family: 'Economica', sans-serif;
    letter-spacing: 2px;
    text-transform: uppercase;
    font-size: 0.8rem;
    color: var(--color-accent);
}

.sagen-card-title {
    font-family: 'Economica', sans-serif;
    font-weight: 700;
    font-size: 1.25rem;
    line-height: 1.2;
}

.sagen-card-teaser {
    color: var(--color-muted);
    font-size: 0.85rem;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.sagen-card-arrow {
    margin-left: auto;
    flex-shrink: 0;
    color: var(--color-accent);
    font-size: 1.2rem;
}

/* Back link above the simple myth page. */
.sagen-back {
    width: 100%;
    max-width: 560px;
    margin: 0 auto 1rem;
    text-align: left;
    font-family: 'Economica', sans-serif;
    letter-spacing: 2px;
    text-transform: uppercase;
    font-size: 0.9rem;
    animation: riseIn 0.7s ease-out backwards;
}

/* ── Myth page ──────────────────────────────────────── */
.myth {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
}

.myth-header {
    margin-bottom: 1.75rem;
}

.myth-logo-wrap {
    width: 220px;
    height: 220px;
    margin: 0 auto 1.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

.myth-logo-wrap::before {
    content: '';
    position: absolute;
    inset: -10%;
    background: radial-gradient(circle, var(--color-accent-soft) 0%, rgba(0,0,0,0) 65%);
    z-index: 0;
}

.myth-logo {
    width: 100%;
    height: 100%;
    object-fit: contain;
    position: relative;
    z-index: 1;
    background: #ffffff;
    border-radius: 24px;
    padding: 14px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.5);
    animation: logoEntrance 1.4s ease-out both;
    transform-origin: center;
}

@keyframes logoEntrance {
    from {
        opacity: 0;
        transform: rotate(-360deg) scale(0.2);
    }
    to {
        opacity: 1;
        transform: rotate(0deg) scale(1);
    }
}

.myth-title {
    font-size: 2.6rem;
    color: var(--color-text);
    margin: 0;
    --rise: 500ms;
}

.myth-teaser {
    color: var(--color-muted);
    font-size: 1.1rem;
    max-width: 520px;
    margin: 0 auto 2rem;
    --rise: 700ms;
}

@keyframes fadeUp {
    from { opacity: 0; transform: translateY(8px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* ── Shared entrance reveal ─────────────────────────── */
/* Every element listed here fades and rises in on appearance; --rise sets
   its slot in the stagger. Elements revealed later (locked screen,
   skip-unlocked article) animate at that moment, since animations
   only start once an element is rendered. */
.intro-title, .intro-tagline, .intro-text,
.overview .game-progress, .overview .map-container,
.myth-progress, .myth-title, .myth-teaser, .audio-player,
.myth-credits, .myth-block, .myth-pager,
.myth-locked-title, .myth-locked-text,
.myth-locked-map, .myth-locked-skip {
    animation: riseIn 0.7s ease-out var(--rise, 0ms) backwards;
}

/* Only a `from` frame: each element animates to its own natural styles
   (e.g. the deliberately dim skip button ends at its 0.6 opacity). */
@keyframes riseIn {
    from { opacity: 0; transform: translateY(8px); }
}

/* Landing page stagger: headline → map. */
.intro-tagline { --rise: 90ms; }
.intro-text { --rise: 180ms; }
.overview .game-progress { --rise: 270ms; }
.overview .map-container { --rise: 360ms; }

/* ── Audio player ───────────────────────────────────── */
.audio-player {
    width: 100%;
    max-width: 460px;
    margin: 0 auto 2.25rem;
    /* Kept for the audioPulse box-shadow shape in the waiting state. */
    border-radius: 14px;
    text-align: center;
    --rise: 900ms;
}

.audio-player audio {
    width: 100%;
    display: block;
}

.audio-hint {
    margin: 0.5rem 0 0;
    color: var(--color-muted);
    font-size: 0.85rem;
}

.audio-hint:empty { display: none; }

.myth-credits {
    width: 100%;
    max-width: 460px;
    margin: -1.25rem auto 2.25rem;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
    --rise: 1050ms;
}

/* Label and value flow as one centered line, so long values wrap
   naturally behind the label instead of pushing it to the edge. */
.myth-credit {
    text-align: center;
    font-size: 0.82rem;
    color: var(--color-muted);
}

.myth-credit dt {
    display: inline;
    margin: 0;
    font-weight: 600;
}

.myth-credit dt::after {
    content: ": ";
}

.myth-credit dd {
    display: inline;
    margin: 0;
}

/* Credit links stay in the quiet credit color, marked only by the underline. */
.myth-credit dd a {
    color: inherit;
    text-decoration: underline;
}

.audio-player-waiting {
    /* Keep the riseIn reveal — otherwise the pulse would replace the whole
       animation shorthand and the player would flash in with no entrance. */
    animation: riseIn 0.7s ease-out var(--rise, 0ms) backwards,
               audioPulse 1.6s ease-in-out infinite;
}

.audio-player-waiting .audio-hint {
    color: var(--color-accent);
}

@keyframes audioPulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(255, 176, 14, 0.0); }
    50%      { box-shadow: 0 0 0 6px rgba(255, 176, 14, 0.18); }
}

/* ── Large expandable blocks ────────────────────────── */
/* "Ganzer Text lesen" and "Hintergrundinformationen": each is one big
   tappable card that unfolds its full content. */
.myth-block {
    width: 100%;
    max-width: 560px;
    margin: 0 auto 1.25rem;
    border: 1px solid var(--color-border);
    border-radius: 14px;
    background: var(--color-bg-soft);
    text-align: left;
    overflow: hidden;
}

.myth-block-story { --rise: 1200ms; }
.myth-block-background { --rise: 1350ms; margin-bottom: 2.5rem; }

.myth-block > summary {
    list-style: none;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.75rem;
    padding: 1.15rem 1.25rem;
    cursor: pointer;
    color: var(--color-accent);
    font-family: 'Economica', sans-serif;
    font-weight: 700;
    letter-spacing: 2px;
    text-transform: uppercase;
    font-size: 1.05rem;
    transition: opacity 0.2s ease;
}

.myth-block > summary::-webkit-details-marker { display: none; }
.myth-block > summary:hover { opacity: 0.8; }

.myth-block > summary::after {
    content: "+";
    flex-shrink: 0;
    font-size: 1.5rem;
    line-height: 1;
}

.myth-block[open] > summary::after { content: "–"; }

.myth-block-body {
    padding: 0 1.25rem 1.5rem;
    color: var(--color-text);
}

/* Soften the abrupt <details> jump: the text fades up as it unfolds. */
.myth-block[open] > .myth-block-body {
    animation: fadeUp 0.4s ease-out;
}

.myth-block-body p {
    margin: 0 0 1rem;
    line-height: 1.75;
}

.myth-block-body p:last-child { margin-bottom: 0; }

/* ── Background block content ───────────────────────── */
/* Heading and chapter accordions inside "Hintergrundinformationen"
   (myths.json "background"), e.g. the wolf background by Wildhüter
   Richard Imboden. Each chapter is a collapsed <details>. */
.myth-background-title {
    font-size: 1.7rem;
    color: var(--color-text);
    margin: 0 0 0.3rem;
    text-align: center;
}

.myth-background-subtitle {
    text-align: center;
    font-style: italic;
    color: var(--color-muted);
    margin: 0 0 0.75rem;
}

.myth-background-author {
    text-align: center;
    font-family: 'Economica', sans-serif;
    letter-spacing: 2px;
    text-transform: uppercase;
    font-size: 0.95rem;
    color: var(--color-accent);
    margin: 0 0 1.5rem;
}

.myth-background-chapter-body p {
    margin: 0 0 1rem;
    line-height: 1.75;
}

.myth-background-chapter {
    border-top: 1px solid var(--color-border);
}

.myth-background-chapter:last-of-type {
    border-bottom: 1px solid var(--color-border);
    margin-bottom: 1.5rem;
}

.myth-background-chapter summary {
    list-style: none;
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 0.75rem;
    padding: 0.85rem 0;
    cursor: pointer;
    font-weight: 700;
    color: var(--color-text);
    transition: opacity 0.2s ease;
}

.myth-background-chapter summary::-webkit-details-marker { display: none; }
.myth-background-chapter summary:hover { opacity: 0.8; }

.myth-background-chapter summary::after {
    content: "+";
    flex-shrink: 0;
    color: var(--color-accent);
    font-size: 1.4rem;
    line-height: 1;
}

.myth-background-chapter[open] summary::after { content: "–"; }

.myth-background-chapter-body {
    padding: 0 0 1.25rem;
}

/* Same softened unfold as the story text. */
.myth-background-chapter[open] .myth-background-chapter-body {
    animation: fadeUp 0.4s ease-out;
}

/* With expandable blocks on the page, the pager enters one slot later. */
.myth-block ~ .myth-pager { --rise: 1500ms; }

/* ── Prev/next pager ────────────────────────────────── */
.myth-pager {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    width: 100%;
    max-width: 560px;
    margin-top: 1rem;
    --rise: 1350ms;
}

.myth-pager-link {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
    padding: 0.75rem 0.9rem;
    border: 1px solid var(--color-border);
    border-radius: 10px;
    color: var(--color-text);
    text-decoration: none;
    flex: 1;
    max-width: 48%;
    transition: border-color 0.2s ease, background 0.2s ease, transform 0.2s ease;
}

.myth-pager-link:hover {
    transform: translateY(-3px);
    border-color: var(--color-accent);
    background: var(--color-accent-soft);
    text-decoration: none;
}

.myth-pager-link:active {
    transform: translateY(-1px) scale(0.98);
}

.myth-pager-prev { text-align: left; }
.myth-pager-next { text-align: right; align-items: flex-end; }

.myth-pager-dir {
    font-size: 0.75rem;
    color: var(--color-muted);
    text-transform: uppercase;
    letter-spacing: 2px;
}

.myth-pager-name {
    font-family: 'Economica', sans-serif;
    font-size: 1.1rem;
    letter-spacing: 1px;
    color: var(--color-text);
}

/* ── Game: shared lock/unlock badge ─────────────────── */
/* A .game-logo wraps a logo image plus a .game-badge; elements carrying
   data-game-slug get is-locked / is-unlocked from assets/game.js. */
.game-logo {
    position: relative;
    display: inline-block;
    line-height: 0;
}

.game-badge {
    position: absolute;
    right: -6px;
    bottom: -6px;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    color: #ffffff;
    font-size: 10px;
    line-height: 1;
    display: none;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 6px rgba(0,0,0,0.45);
    pointer-events: none;
}

[data-game-slug].is-locked .game-badge {
    display: flex;
    background: #3a3450;
}
[data-game-slug].is-locked .game-badge::before { content: '🔒'; }

[data-game-slug].is-unlocked .game-badge {
    display: flex;
    background: #2e9e44;
}
[data-game-slug].is-unlocked .game-badge::before {
    content: '✓';
    font-size: 12px;
    font-weight: 700;
}

/* The badge pops on with a little bounce whenever its lock state appears
   (page load, and the moment game.js flips locked → unlocked). */
[data-game-slug].is-locked .game-badge,
[data-game-slug].is-unlocked .game-badge {
    animation: badge-pop 0.35s cubic-bezier(0.34, 1.56, 0.64, 1) backwards;
}

@keyframes badge-pop {
    from { opacity: 0; transform: scale(0); }
}

[data-game-slug].is-locked .game-logo img {
    filter: grayscale(1);
    opacity: 0.55;
}

/* ── Game: progress on the overview ─────────────────── */
.game-progress {
    max-width: 460px;
    margin: 0 auto 1.75rem;
}

.game-progress-label {
    font-family: 'Economica', sans-serif;
    letter-spacing: 2px;
    text-transform: uppercase;
    font-size: 0.85rem;
    color: var(--color-muted);
    margin: 0 0 0.5rem;
}

.game-progress-track {
    height: 8px;
    border-radius: 999px;
    background: var(--color-bg-soft);
    border: 1px solid var(--color-border);
    overflow: hidden;
}

.game-progress-fill {
    height: 100%;
    width: 0;
    border-radius: 999px;
    background: linear-gradient(90deg, var(--color-accent), #ffd268);
    /* Same easing as the unlock overlay's bar, so both bars feel alike. */
    transition: width 0.8s cubic-bezier(0.22, 1, 0.36, 1);
}

.game-medals {
    list-style: none;
    display: flex;
    justify-content: center;
    gap: 0.7rem;
    margin: 0.9rem 0 0;
    padding: 0;
}

.game-medal {
    display: inline-block;
    line-height: 0;
    transition: transform 0.2s ease;
}

.game-medal:hover {
    transform: translateY(-2px);
}

.game-medal img {
    width: 42px;
    height: 42px;
    object-fit: contain;
    background: #ffffff;
    border-radius: 10px;
    padding: 4px;
    box-shadow: 0 2px 6px rgba(0,0,0,0.4);
    transition: filter 0.3s ease, opacity 0.3s ease;
}

/* On a myth page, ring the medallion of the Sage being viewed. */
.game-medal.is-current img {
    box-shadow:
        0 0 0 2px var(--color-accent),
        0 2px 6px rgba(0,0,0,0.4);
}

.game-progress-complete {
    color: var(--color-accent);
    font-family: 'Economica', sans-serif;
    letter-spacing: 1px;
    font-size: 1.05rem;
    margin: 0.9rem 0 0;
}

/* Compact progress strip at the top of each myth page. */
.myth-progress {
    max-width: 460px;
    margin: 0 auto 1.75rem;
    padding-bottom: 1.1rem;
    border-bottom: 1px solid var(--color-border);
    text-align: center;
}

.myth-progress .game-progress {
    max-width: 320px;
    margin: 0 auto 0.5rem;
}

.myth-progress .game-progress-label {
    font-size: 0.7rem;
    margin-bottom: 0.35rem;
}

.myth-progress .game-progress-track {
    height: 5px;
}

.myth-progress .game-medals {
    gap: 0.5rem;
    margin-top: 0.6rem;
}

.myth-progress .game-medal img {
    width: 30px;
    height: 30px;
    padding: 3px;
    border-radius: 8px;
}

.myth-progress .game-badge {
    width: 15px;
    height: 15px;
    right: -4px;
    bottom: -4px;
    font-size: 8px;
}

.myth-progress [data-game-slug].is-unlocked .game-badge::before {
    font-size: 9px;
}

.myth-progress .game-progress-complete {
    font-size: 0.9rem;
    margin-top: 0.6rem;
}

/* Map link under the progress strip: styled as a small pill so it reads
   as tappable, not as body text. */
.myth-progress-hint {
    font-size: 0.8rem;
    margin: 0;
}

.myth-progress-hint a {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    padding: 0.35rem 1rem;
    border: 1px solid var(--color-accent);
    border-radius: 999px;
    transition: background 0.2s ease, transform 0.2s ease;
}

.myth-progress-hint a:hover {
    background: var(--color-accent-soft);
    transform: translateY(-1px);
    text-decoration: none;
}

.myth-progress-hint a:active {
    transform: translateY(0) scale(0.97);
}

/* ── Overview map ───────────────────────────────────── */
.map-container {
    position: relative;
    width: 100%;
    height: min(62vh, 520px);
    margin: 0 0 1.25rem;
    overflow: hidden;
    border-radius: 14px;
    background:
        radial-gradient(120% 120% at 50% 0%, #fbf7ff 0%, #eee6f4 55%, #e4dcee 100%);
    box-shadow:
        0 18px 50px rgba(0, 0, 0, 0.45),
        inset 0 0 0 1px rgba(143, 127, 161, 0.25);
    touch-action: pan-y;
}

/* On wide screens the map breaks out of the 640px text column. */
@media (min-width: 720px) {
    .map-container {
        --map-width: min(85vw, 900px);
        width: var(--map-width);
        margin-left: calc((100% - var(--map-width)) / 2);
        height: min(66vh, 560px);
    }
}

/* Fullscreen: the container becomes a fixed overlay filling the browser
   viewport (the full screen of the webpage, not the native OS fullscreen). */
.map-container.is-fullscreen {
    position: fixed;
    /* `inset: 0` (not `width: 100vw`) so the overlay fills the space *inside*
       the scrollbar. `100vw` includes the scrollbar gutter, which pushes the
       right edge — and the exit button pinned to it — under the scrollbar. */
    inset: 0;
    /* Override the base height and the wide-screen `width: var(--map-width)`,
       which would otherwise win over `inset: 0`'s bottom/right edges. Height
       only (no `width: 100vw`) so the scrollbar gutter stays clear. */
    height: 100vh;
    height: 100dvh;
    width: auto;
    max-width: none;
    border-radius: 0;
    z-index: 5000;
    margin: 0;
}

/* Prevent the page behind the overlay from scrolling. The scrollbar lives on
   <html>, so lock it there (locking only <body> leaves the scrollbar visible). */
html.map-fullscreen-open,
body.map-fullscreen-open {
    overflow: hidden;
}

/* "Exit fullscreen" X button — only visible while the map is fullscreen,
   pinned to the top-right corner of the overlay. */
.map-fullscreen-exit {
    display: none;
    position: absolute;
    top: 12px;
    right: 12px;
    z-index: 5001;
    width: 40px;
    height: 40px;
    border: 0;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.95);
    color: var(--color-bg);
    font-size: 20px;
    font-weight: 700;
    line-height: 1;
    cursor: pointer;
    box-shadow: 0 6px 16px rgba(26, 22, 37, 0.25);
    transition: transform 140ms ease, background 140ms ease;
    align-items: center;
    justify-content: center;
}
.map-container.is-fullscreen .map-fullscreen-exit {
    display: flex;
}
.map-fullscreen-exit:hover {
    transform: translateY(-2px);
    background: var(--color-accent);
}
.map-fullscreen-exit:active {
    transform: translateY(0) scale(0.94);
}

#draggable-map.map {
    position: absolute;
    left: 0;
    top: 0;
    transform-origin: 0 0;
    cursor: grab;
    user-select: none;
    will-change: transform;
}

/* Smooth easing only for programmatic moves (buttons / dbl-tap / reset). */
#draggable-map.map.map-animating {
    transition: transform 560ms cubic-bezier(0.22, 1, 0.36, 1);
}
#draggable-map.map.map-animating .map-marker {
    transition: scale 560ms cubic-bezier(0.22, 1, 0.36, 1);
}
#draggable-map.map.map-animating.map-animating-slow,
#draggable-map.map.map-animating.map-animating-slow .map-marker {
    transition-duration: 840ms;
}

.map-image {
    display: block;
    width: 1200px;
    max-width: none;
    height: auto;
    pointer-events: none;
}

/* Outer marker = positioning + counter-scale anchor (no visuals). Markers
   are <button>s that open their info dialog, hence the appearance reset. */
.map-marker {
    --counter: 1;
    position: absolute;
    transform-origin: 50% 50%;
    translate: -50% -50%;
    scale: var(--counter);
    z-index: 5;
    cursor: pointer;
    line-height: 1;
    text-decoration: none;
    background: none;
    border: none;
    padding: 0;
    font: inherit;
    color: inherit;
}
.map-marker:hover { text-decoration: none; }

/* Inner "pill" = the visible marker; free to float / grow. */
.map-marker-inner {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 46px;
    height: 46px;
    font-size: 22px;
    line-height: 1;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.95);
    border: 2px solid rgba(26, 22, 37, 0.25);
    box-shadow: 0 6px 16px rgba(26, 22, 37, 0.35);
    transform-origin: 50% 60%;
    /* The 650ms base delay lets the map container finish its own reveal
       before the markers pop onto it (staggered per marker via --d). */
    animation:
        marker-in 520ms cubic-bezier(0.34, 1.56, 0.64, 1) calc(650ms + var(--d, 0ms)) backwards,
        marker-float 5s ease-in-out calc(1170ms + var(--d, 0ms)) infinite;
    transition: transform 220ms cubic-bezier(0.34, 1.56, 0.64, 1),
                box-shadow 200ms ease;
}

/* The inner pill doubles as the .game-logo badge anchor, so size the logo
   image itself — never the pill — or the 46px box blows up to the image's
   natural size. */
.map-marker-myth .map-marker-inner { padding: 4px; }
.map-marker-myth .map-marker-inner img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    border-radius: 50%;
}

/* Map markers keep their logos in full colour even while locked — the
   locked state stays visible through the badge and border alone. */
.map-marker[data-game-slug].is-locked .game-logo img {
    filter: none;
    opacity: 1;
}

.map-marker-start .map-marker-inner {
    border-color: var(--color-accent);
}
.map-marker[data-game-slug].is-unlocked .map-marker-inner {
    border-color: rgba(46, 158, 68, 0.75);
    border-width: 4px;
}

/* Attention ring around each marker. */
.map-marker-inner::after {
    content: '';
    position: absolute;
    inset: -3px;
    border-radius: 999px;
    border: 2px solid rgba(143, 127, 161, 0.7);
    opacity: 0;
    transform: scale(0.9);
    pointer-events: none;
}

@keyframes marker-in {
    from { opacity: 0; transform: translateY(6px) scale(0.2); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}
@keyframes marker-float {
    0%, 100% { translate: 0 0; }
    50%      { translate: 0 -4px; }
}
@keyframes marker-ring {
    0%   { opacity: 0.85; transform: scale(0.85); }
    100% { opacity: 0; transform: scale(1.9); }
}

.map-marker:hover .map-marker-inner,
.map-marker:focus-visible .map-marker-inner {
    transform: translateY(-4px) scale(1.28);
    box-shadow: 0 12px 26px rgba(26, 22, 37, 0.4);
}
.map-marker:hover .map-marker-inner::after,
.map-marker:focus-visible .map-marker-inner::after {
    animation: marker-ring 1300ms ease-out infinite;
}

/* Title tooltip above a marker, revealed after a short hover. It sits inside
   .map-marker, so it counter-scales with the marker and stays readable. */
.map-marker-tooltip {
    position: absolute;
    bottom: calc(100% + 9px);
    left: 50%;
    transform: translateX(-50%) translateY(4px);
    padding: 5px 10px;
    border-radius: 8px;
    background: rgba(26, 22, 37, 0.94);
    color: #ffffff;
    font-size: 13px;
    font-weight: 700;
    line-height: 1.2;
    white-space: nowrap;
    max-width: 220px;
    overflow: hidden;
    text-overflow: ellipsis;
    pointer-events: none;
    opacity: 0;
    visibility: hidden;
    transition: opacity 180ms ease, transform 180ms ease, visibility 180ms;
    box-shadow: 0 6px 16px rgba(26, 22, 37, 0.3);
    z-index: 2;
}
.map-marker-tooltip::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 5px solid transparent;
    border-top-color: rgba(26, 22, 37, 0.94);
}
.map-marker:hover .map-marker-tooltip,
.map-marker:focus-visible .map-marker-tooltip {
    opacity: 1;
    visibility: visible;
    transform: translateX(-50%) translateY(0);
    transition-delay: 500ms;
}

/* Off-screen indicators: pinned to the container border, pointing toward a
   marker that has been panned/zoomed out of view. */
.map-edge-indicator {
    --arrow-color: rgba(26, 22, 37, 0.55);
    position: absolute;
    z-index: 13;
    width: 34px;
    height: 34px;
    padding: 0;
    translate: -50% -50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 15px;
    line-height: 1;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.96);
    border: 2px solid rgba(26, 22, 37, 0.2);
    box-shadow: 0 6px 16px rgba(26, 22, 37, 0.3);
    cursor: pointer;
    opacity: 0;
    visibility: hidden;
    transform: scale(0.5);
    transition: opacity 220ms ease,
                transform 260ms cubic-bezier(0.34, 1.56, 0.64, 1);
}
.map-edge-indicator img {
    width: 22px;
    height: 22px;
    object-fit: contain;
    border-radius: 50%;
}
.map-edge-indicator.is-visible {
    opacity: 1;
    visibility: visible;
    transform: scale(1);
    animation: edge-pulse 2.4s ease-in-out infinite;
}
.map-edge-indicator.is-visible:hover {
    transform: scale(1.15);
    animation: none;
}

/* Little arrow aimed outward (radially away from the container centre). */
.map-edge-indicator::after {
    content: '';
    position: absolute;
    left: 50%;
    top: 50%;
    width: 0;
    height: 0;
    border-left: 5px solid transparent;
    border-right: 5px solid transparent;
    border-bottom: 8px solid var(--arrow-color);
    transform: translate(-50%, -50%)
               rotate(calc(var(--angle, 0deg) + 90deg))
               translateY(-22px);
}
.map-edge-indicator.map-edge-indicator-user {
    border-color: rgba(26, 115, 232, 0.85);
    --arrow-color: rgba(26, 115, 232, 0.9);
    z-index: 14;
}
/* Mini version of the "you are here" dot inside the user edge indicator. */
.map-edge-indicator-user-dot {
    display: block;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: #1a73e8;
    border: 2px solid #fff;
    box-shadow: 0 1px 3px rgba(26, 22, 37, 0.4);
}

@keyframes edge-pulse {
    0%, 100% { box-shadow: 0 6px 16px rgba(26, 22, 37, 0.3); }
    50%      { box-shadow: 0 6px 22px rgba(26, 22, 37, 0.45); }
}

/* Zoom / locate controls. */
.map-controls {
    position: absolute;
    right: 12px;
    bottom: 12px;
    z-index: 16;
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.map-controls button {
    width: 40px;
    height: 40px;
    border: 0;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.95);
    color: var(--color-bg);
    font-size: 22px;
    font-weight: 700;
    line-height: 1;
    cursor: pointer;
    box-shadow: 0 6px 16px rgba(26, 22, 37, 0.25);
    transition: transform 140ms ease, background 140ms ease, color 140ms ease;
    display: flex;
    align-items: center;
    justify-content: center;
}
.map-controls button:hover {
    transform: translateY(-2px);
    background: var(--color-accent);
}
.map-controls button:active {
    transform: translateY(0) scale(0.94);
}
.map-controls .map-zoom-reset { font-size: 18px; }
.map-controls .map-fullscreen-btn { font-size: 20px; }
.map-controls .map-fullscreen-btn.is-active { background: var(--color-accent); }
.map-controls .map-locate-btn { font-size: 20px; }
.map-controls .map-locate-btn svg { display: block; }
.map-controls .map-locate-btn.is-active {
    background: #1a73e8;
    color: #fff;
}
.map-controls .map-locate-btn.is-active:hover { color: var(--color-bg); }
.map-controls .map-locate-btn.is-locating {
    animation: locate-btn-pulse 1s ease-in-out infinite;
}
@keyframes locate-btn-pulse {
    0%, 100% { background: rgba(255, 255, 255, 0.95); }
    50%      { background: var(--color-accent); }
}

/* GPS accuracy circle: sized in base map pixels, zooms at true scale. */
.map-user-accuracy {
    position: absolute;
    translate: -50% -50%;
    border-radius: 50%;
    background: rgba(26, 115, 232, 0.14);
    z-index: 5;
    pointer-events: none;
}
.map-user-accuracy[hidden] { display: none; }

/* Live "you are here" dot, counter-scaled like the markers. */
.map-user-location {
    --counter: 1;
    position: absolute;
    translate: -50% -50%;
    scale: var(--counter);
    z-index: 6;
    pointer-events: none;
    line-height: 0;
}
.map-user-location[hidden] { display: none; }
.map-user-location-dot {
    display: block;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #1a73e8;
    border: 3px solid #ffffff;
    box-shadow: 0 2px 6px rgba(26, 22, 37, 0.45);
    position: relative;
    z-index: 2;
}
.map-user-location-pulse {
    position: absolute;
    left: 50%;
    top: 50%;
    width: 18px;
    height: 18px;
    translate: -50% -50%;
    border-radius: 50%;
    background: rgba(26, 115, 232, 0.35);
    animation: user-loc-pulse 2s ease-out infinite;
}
@keyframes user-loc-pulse {
    0%   { transform: scale(1); opacity: 0.6; }
    100% { transform: scale(4); opacity: 0; }
}

/* Transient message over the map (permission denied, off-map, …). */
.map-locate-toast {
    position: absolute;
    left: 50%;
    bottom: 16px;
    translate: -50% 8px;
    max-width: min(88%, 360px);
    padding: 10px 16px;
    border-radius: 10px;
    background: rgba(26, 22, 37, 0.94);
    color: #ffffff;
    font-size: 14px;
    font-weight: 600;
    line-height: 1.3;
    text-align: center;
    box-shadow: 0 8px 20px rgba(26, 22, 37, 0.35);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    z-index: 18;
    transition: opacity 220ms ease, translate 220ms ease, visibility 220ms;
}
.map-locate-toast.is-visible {
    opacity: 1;
    visibility: visible;
    translate: -50% 0;
}

/* Intro overlay: points a coach-mark callout at the locate button and floats
   a central hint over the map — no full-map scrim, and click-through
   (pointer-events: none), so the map stays usable underneath. It fades out
   after a deliberate pan or zoom, with a short grace period (the
   .map-text-info-hidable machinery in map.js). The callout is positioned by
   positionIntroCallouts() in map.js. */
.map-intro-overlay {
    position: absolute;
    inset: 0;
    z-index: 30;
    pointer-events: none;
    animation: map-hint-in 700ms cubic-bezier(0.22, 1, 0.36, 1) both;
}

/* Exit: each box drifts toward where it points and fades, staggered like the
   entrance (at half the spacing). map.js removes the overlay from layout
   after the last one has finished. */
.map-intro-overlay.is-hidden .map-intro-callout {
    animation: map-callout-out 800ms ease both;
    animation-delay: calc(var(--d, 0ms) / 2);
}

.map-intro-overlay.is-hidden .map-intro-hint {
    animation: map-hint-out 800ms ease both;
}

@keyframes map-callout-out {
    from { opacity: 1; transform: translateY(-50%) translateX(0); }
    to   { opacity: 0; transform: translateY(-50%) translateX(12px); }
}

@keyframes map-hint-out {
    from { opacity: 1; transform: translateY(0); }
    to   { opacity: 0; transform: translateY(12px); }
}

.map-intro-hint {
    /* Sits to the left of the control buttons, matching the callout's
       white-box look. */
    position: absolute;
    right: 66px;
    bottom: 12px;
    max-width: min(280px, calc(100% - 92px));
    padding: 12px 16px;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.97);
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.45);
    text-align: center;
    color: var(--color-bg);
    animation: map-hint-in 700ms cubic-bezier(0.22, 1, 0.36, 1) both;
    animation-delay: 100ms;
}

.map-intro-hint p {
    margin: 0 0 8px 0;
    font-size: 0.9rem;
    font-weight: 600;
}

/* One callout per control button: a small label to the left of the button
   with an arrow aimed at it. top/right are set from the button's measured
   position in map.js. */
.map-intro-callout {
    position: absolute;
    transform: translateY(-50%);
    background: rgba(255, 255, 255, 0.97);
    color: var(--color-bg);
    border-radius: 10px;
    padding: 7px 12px;
    font-size: 0.88rem;
    font-weight: 600;
    white-space: nowrap;
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.45);
    animation: map-callout-in 500ms cubic-bezier(0.22, 1, 0.36, 1) both;
    animation-delay: var(--d, 0ms);
    pointer-events: none;
}

.map-intro-callout::after {
    content: '';
    position: absolute;
    left: 100%;
    top: 50%;
    transform: translateY(-50%);
    border: 7px solid transparent;
    border-left-color: rgba(255, 255, 255, 0.97);
}

@keyframes map-callout-in {
    from { opacity: 0; transform: translateY(-50%) translateX(10px); }
    to   { opacity: 1; transform: translateY(-50%) translateX(0); }
}

@keyframes map-hint-in {
    from { opacity: 0; transform: translateY(10px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* ── Game: toast + locked myth screen ───────────────── */
.game-toast {
    position: fixed;
    left: 50%;
    bottom: 22px;
    translate: -50% 12px;
    max-width: min(88%, 380px);
    padding: 12px 18px;
    border-radius: 12px;
    background: rgba(26, 22, 37, 0.96);
    border: 1px solid var(--color-accent);
    color: var(--color-text);
    font-size: 0.95rem;
    text-align: center;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    z-index: 200;
    transition: opacity 250ms ease, translate 250ms ease, visibility 250ms;
}
.game-toast.is-visible {
    opacity: 1;
    visibility: visible;
    translate: -50% 0;
}

/* ── Game: unlock celebration overlay ───────────────── */
/* Built by celebrate() in assets/game.js after a fresh unlock. Staggered
   animation delays choreograph the sequence: rays → logo pop + rings +
   confetti → check stamp → texts → medals → bar sweep → button. */
.unlock-overlay {
    position: fixed;
    inset: 0;
    z-index: 300;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
    overflow: hidden;
    background:
        radial-gradient(circle at 50% 38%, rgba(255, 176, 14, 0.14) 0%, rgba(0,0,0,0) 45%),
        radial-gradient(circle at 50% 45%, rgba(58, 48, 88, 0.94) 0%, rgba(12, 9, 20, 0.97) 100%);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    opacity: 0;
    transition: opacity 0.4s ease;
}
.unlock-overlay.is-visible { opacity: 1; }
.unlock-overlay.is-leaving { opacity: 0; pointer-events: none; }

/* Slowly rotating sunburst behind the card. */
.unlock-rays {
    position: absolute;
    left: 50%;
    top: 34%;
    width: 140vmin;
    height: 140vmin;
    translate: -50% -50%;
    background: repeating-conic-gradient(
        from 0deg,
        rgba(255, 176, 14, 0.13) 0deg 8deg,
        rgba(255, 176, 14, 0) 8deg 24deg);
    -webkit-mask-image: radial-gradient(circle, #000 0%, transparent 62%);
    mask-image: radial-gradient(circle, #000 0%, transparent 62%);
    opacity: 0;
    transition: opacity 0.9s ease 0.2s;
    animation: unlock-rays-spin 26s linear infinite;
    pointer-events: none;
}
.unlock-overlay.is-visible .unlock-rays { opacity: 1; }
.unlock-overlay-complete .unlock-rays {
    background: repeating-conic-gradient(
        from 0deg,
        rgba(255, 176, 14, 0.22) 0deg 8deg,
        rgba(255, 210, 104, 0.05) 8deg 24deg);
}

@keyframes unlock-rays-spin {
    from { rotate: 0deg; }
    to   { rotate: 360deg; }
}

/* Confetti burst; each span gets --tx/--ty/--rot/--c/--size/--dur/--delay
   from game.js. */
.unlock-confetti {
    position: absolute;
    left: 50%;
    top: 34%;
    pointer-events: none;
}
.unlock-confetti span {
    position: absolute;
    left: 0;
    top: 0;
    width: var(--size, 8px);
    height: var(--size, 8px);
    background: var(--c, var(--color-accent));
    opacity: 0;
    animation: unlock-particle var(--dur, 1200ms) cubic-bezier(0.16, 0.84, 0.44, 1)
               var(--delay, 500ms) forwards;
}

@keyframes unlock-particle {
    0%   { opacity: 1; transform: translate(0, 0) rotate(0deg) scale(1); }
    70%  { opacity: 1; }
    100% { opacity: 0; transform: translate(var(--tx), var(--ty)) rotate(var(--rot)) scale(0.4); }
}

.unlock-card {
    position: relative;
    max-width: 380px;
    width: 100%;
    text-align: center;
}

.unlock-logo-wrap {
    position: relative;
    width: 168px;
    height: 168px;
    margin: 0 auto 1.4rem;
}

.unlock-logo {
    width: 100%;
    height: 100%;
    object-fit: contain;
    background: #ffffff;
    border-radius: 26px;
    padding: 12px;
    box-shadow:
        0 0 0 4px rgba(255, 176, 14, 0.55),
        0 0 45px rgba(255, 176, 14, 0.4),
        0 16px 45px rgba(0, 0, 0, 0.6);
    animation: unlock-logo-pop 0.65s cubic-bezier(0.34, 1.56, 0.64, 1) 0.25s both;
}
.unlock-logo-fallback {
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 84px;
    line-height: 1;
}

@keyframes unlock-logo-pop {
    0%   { opacity: 0; transform: scale(0) rotate(-30deg); }
    60%  { opacity: 1; transform: scale(1.15) rotate(4deg); }
    80%  { transform: scale(0.94) rotate(-2deg); }
    100% { opacity: 1; transform: scale(1) rotate(0deg); }
}

/* Expanding shockwave rings behind the logo. */
.unlock-ring {
    position: absolute;
    inset: 0;
    border-radius: 32px;
    border: 3px solid rgba(255, 176, 14, 0.8);
    opacity: 0;
    animation: unlock-ring 0.9s ease-out 0.5s forwards;
    pointer-events: none;
}
.unlock-ring-2 {
    border-color: rgba(244, 236, 220, 0.6);
    animation-delay: 0.68s;
}

@keyframes unlock-ring {
    0%   { opacity: 0.9; transform: scale(0.7); }
    100% { opacity: 0; transform: scale(1.9); }
}

/* Checkmark stamps on like a collected badge. */
.unlock-check {
    position: absolute;
    right: -12px;
    bottom: -12px;
    width: 52px;
    height: 52px;
    border-radius: 50%;
    background: linear-gradient(180deg, #3fc35b, #2e9e44);
    color: #ffffff;
    font-size: 26px;
    font-weight: 700;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow:
        0 0 0 3px rgba(26, 22, 37, 0.9),
        0 6px 16px rgba(0, 0, 0, 0.5);
    animation: unlock-stamp 0.4s cubic-bezier(0.34, 1.56, 0.64, 1) 0.9s both;
}

@keyframes unlock-stamp {
    0%   { opacity: 0; transform: scale(2.6) rotate(20deg); }
    100% { opacity: 1; transform: scale(1) rotate(0deg); }
}

.unlock-kicker {
    font-family: 'Economica', sans-serif;
    letter-spacing: 3px;
    text-transform: uppercase;
    font-size: 1.05rem;
    color: var(--color-accent);
    margin: 0 0 0.2rem;
    text-shadow: 0 0 18px rgba(255, 176, 14, 0.55);
    opacity: 0;
    animation: fadeUp 0.6s ease-out 1s forwards;
}

.unlock-title {
    font-size: 2.1rem;
    color: var(--color-text);
    margin: 0 0 1.1rem;
    opacity: 0;
    animation: fadeUp 0.6s ease-out 1.15s forwards;
}

/* Collection row: every Sage as a slot; found ones carry their logo, the
   freshly unlocked one lands with a golden flash. */
.unlock-medals {
    display: flex;
    justify-content: center;
    gap: 0.55rem;
    margin: 0 0 1rem;
}

.unlock-medal {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    background: rgba(244, 236, 220, 0.07);
    border: 1px solid var(--color-border);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    animation: unlock-medal-in 0.45s cubic-bezier(0.34, 1.56, 0.64, 1)
               calc(1.25s + var(--i, 0) * 0.12s) forwards;
}

.unlock-medal img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    background: #ffffff;
    border-radius: 11px;
    padding: 4px;
}

.unlock-medal-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: rgba(244, 236, 220, 0.18);
}

.unlock-medal.is-new {
    box-shadow: 0 0 0 2px var(--color-accent), 0 0 18px rgba(255, 176, 14, 0.6);
    animation:
        unlock-medal-in 0.45s cubic-bezier(0.34, 1.56, 0.64, 1)
            calc(1.25s + var(--i, 0) * 0.12s) forwards,
        unlock-medal-flash 1.4s ease-in-out
            calc(1.7s + var(--i, 0) * 0.12s) 3;
}

@keyframes unlock-medal-in {
    0%   { opacity: 0; transform: scale(0.3) translateY(8px); }
    100% { opacity: 1; transform: scale(1) translateY(0); }
}
@keyframes unlock-medal-flash {
    0%, 100% { box-shadow: 0 0 0 2px var(--color-accent), 0 0 10px rgba(255, 176, 14, 0.35); }
    50%      { box-shadow: 0 0 0 3px #ffd268, 0 0 26px rgba(255, 176, 14, 0.85); }
}

.unlock-bar {
    height: 10px;
    max-width: 260px;
    margin: 0 auto 0.5rem;
    border-radius: 999px;
    background: rgba(244, 236, 220, 0.1);
    border: 1px solid var(--color-border);
    overflow: hidden;
    opacity: 0;
    animation: fadeUp 0.5s ease-out 1.3s forwards;
}

.unlock-bar-fill {
    height: 100%;
    width: 0;
    border-radius: 999px;
    background: linear-gradient(90deg, var(--color-accent), #ffd268);
    box-shadow: 0 0 12px rgba(255, 176, 14, 0.7);
    transition: width 0.9s cubic-bezier(0.22, 1, 0.36, 1);
}

.unlock-count {
    font-family: 'Economica', sans-serif;
    letter-spacing: 2px;
    text-transform: uppercase;
    font-size: 0.9rem;
    color: var(--color-muted);
    margin: 0 0 1.6rem;
    opacity: 0;
    animation: fadeUp 0.5s ease-out 1.45s forwards;
}

.unlock-continue {
    font-family: 'Economica', sans-serif;
    font-weight: 700;
    letter-spacing: 3px;
    text-transform: uppercase;
    font-size: 1.1rem;
    color: #241c10;
    background: linear-gradient(180deg, #ffd268, var(--color-accent));
    border: none;
    border-radius: 999px;
    padding: 0.8rem 2.8rem;
    cursor: pointer;
    box-shadow:
        0 0 22px rgba(255, 176, 14, 0.45),
        0 8px 20px rgba(0, 0, 0, 0.45);
    opacity: 0;
    animation:
        unlock-medal-in 0.45s cubic-bezier(0.34, 1.56, 0.64, 1) 1.7s forwards,
        unlock-button-pulse 2.2s ease-in-out 2.2s infinite;
    transition: transform 0.15s ease;
}
.unlock-continue:hover { transform: scale(1.05); }
.unlock-continue:active { transform: scale(0.96); }
.unlock-continue:focus-visible {
    outline: 2px solid #ffffff;
    outline-offset: 3px;
}

@keyframes unlock-button-pulse {
    0%, 100% { box-shadow: 0 0 22px rgba(255, 176, 14, 0.45), 0 8px 20px rgba(0, 0, 0, 0.45); }
    50%      { box-shadow: 0 0 34px rgba(255, 176, 14, 0.75), 0 8px 20px rgba(0, 0, 0, 0.45); }
}

@media (max-width: 480px) {
    .unlock-logo-wrap { width: 138px; height: 138px; }
    .unlock-title { font-size: 1.8rem; }
    .unlock-medal { width: 38px; height: 38px; }
}

/* ── Map marker info dialog ─────────────────────────── */
/* Opened by map.js when a marker is tapped. The myth dialogs carry
   data-game-slug, so game.js gives them is-locked / is-unlocked: locked shows
   the QR hint, unlocked the link to the Sage. */
.map-dialog {
    width: min(92vw, 380px);
    padding: 2rem 1.5rem 1.6rem;
    border: 1px solid var(--color-border);
    border-radius: 18px;
    background: var(--color-bg-soft);
    color: var(--color-text);
    text-align: center;
    box-shadow: 0 24px 60px rgba(0, 0, 0, 0.55);
}

.map-dialog::backdrop {
    background: rgba(12, 9, 20, 0.65);
    backdrop-filter: blur(2px);
}

.map-dialog[open] {
    animation: dialog-in 260ms cubic-bezier(0.34, 1.56, 0.64, 1);
}

.map-dialog[open]::backdrop {
    animation: backdrop-in 260ms ease;
}

@keyframes dialog-in {
    from { opacity: 0; transform: translateY(10px) scale(0.94); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes backdrop-in {
    from { opacity: 0; }
    to   { opacity: 1; }
}

.map-dialog-close {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    width: 34px;
    height: 34px;
    border: none;
    border-radius: 50%;
    background: none;
    color: var(--color-muted);
    font-size: 22px;
    line-height: 1;
    cursor: pointer;
}
.map-dialog-close:hover {
    background: rgba(244, 236, 220, 0.08);
    color: var(--color-text);
}

.map-dialog-icon {
    display: block;
    font-size: 44px;
    line-height: 1;
    margin-bottom: 0.4rem;
}

.map-dialog-logo img {
    width: 96px;
    height: 96px;
    object-fit: contain;
    background: #ffffff;
    border-radius: 18px;
    padding: 8px;
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.45);
}

.map-dialog-logo .game-badge {
    width: 26px;
    height: 26px;
    right: -8px;
    bottom: -8px;
    font-size: 13px;
}

.map-dialog-kicker {
    font-family: 'Economica', sans-serif;
    letter-spacing: 2px;
    text-transform: uppercase;
    font-size: 0.85rem;
    color: var(--color-muted);
    margin: 0.9rem 0 0.1rem;
}

.map-dialog-title {
    font-size: 1.8rem;
    margin: 0 0 0.6rem;
}

.map-dialog-text {
    color: var(--color-muted);
    font-size: 0.95rem;
    margin: 0 0 1.1rem;
}

.map-dialog-locked-hint {
    font-size: 0.85rem;
    color: var(--color-muted);
    background: rgba(244, 236, 220, 0.05);
    border: 1px dashed var(--color-border);
    border-radius: 12px;
    padding: 0.6rem 0.9rem;
    margin: 0 0 1.1rem;
}

.map-dialog-link {
    display: inline-block;
    padding: 0.55rem 1.6rem;
    border: 1px solid var(--color-accent);
    border-radius: 999px;
    font-family: 'Economica', sans-serif;
    letter-spacing: 2px;
    text-transform: uppercase;
    font-size: 0.95rem;
    transition: background 0.2s ease, transform 0.2s ease;
}
.map-dialog-link:hover {
    background: var(--color-accent-soft);
    transform: translateY(-2px);
    text-decoration: none;
}
.map-dialog-link:active {
    transform: translateY(0) scale(0.97);
}

.map-dialog[data-game-slug].is-unlocked .map-dialog-locked-hint { display: none; }

/* While the Sage is locked, the link steps back to a quiet text link — the
   hunt for the plaque stays the main call to action. */
.map-dialog[data-game-slug].is-locked .map-dialog-link {
    padding: 0.2rem 0.4rem;
    border-color: transparent;
    font-size: 0.85rem;
    color: var(--color-muted);
}
.map-dialog[data-game-slug].is-locked .map-dialog-link:hover {
    background: none;
    color: var(--color-accent);
    transform: none;
    text-decoration: underline;
}
.map-dialog-link-locked { display: none; }
.map-dialog[data-game-slug].is-locked .map-dialog-link-locked { display: inline; }
.map-dialog[data-game-slug].is-locked .map-dialog-link-default { display: none; }

/* Locked myth page: body.myth-locked (set by game.js) swaps the article
   content for the locked screen. Without JS the full page stays readable. */
.myth-locked-screen { display: none; }

body.myth-locked .myth > *:not(.myth-locked-screen) { display: none; }

body.myth-locked .myth-locked-screen {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding-top: 1rem;
}

/* Locked screen entrance: quiet cousin of the unlocked page's sequence —
   the logo settles in gently (no triumphant spin yet), texts rise after. */
.myth-locked-logo {
    position: relative;
    width: 180px;
    height: 180px;
    margin: 0 0 1.5rem;
    animation: locked-logo-in 0.6s cubic-bezier(0.34, 1.56, 0.64, 1) backwards;
}

@keyframes locked-logo-in {
    from { opacity: 0; transform: scale(0.7); }
}

.myth-locked-img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    background: #ffffff;
    border-radius: 24px;
    padding: 14px;
    filter: grayscale(1);
    opacity: 0.5;
    box-shadow: 0 10px 30px rgba(0,0,0,0.5);
}

.myth-locked-lock {
    position: absolute;
    right: -10px;
    bottom: -10px;
    width: 52px;
    height: 52px;
    border-radius: 50%;
    background: var(--color-bg-soft);
    border: 1px solid var(--color-border);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.5);
}

.myth-locked-title {
    font-size: 2.2rem;
    margin: 0 0 0.75rem;
    --rise: 250ms;
}

.myth-locked-teaser {
    --rise: 400ms;
}

.myth-locked-text {
    color: var(--color-muted);
    max-width: 420px;
    margin: 0 auto 1.75rem;
    --rise: 550ms;
}

.myth-locked-map {
    display: inline-block;
    padding: 0.6rem 1.6rem;
    border: 1px solid var(--color-accent);
    border-radius: 999px;
    font-family: 'Economica', sans-serif;
    letter-spacing: 2px;
    text-transform: uppercase;
    font-size: 0.95rem;
    margin-bottom: 1.75rem;
    transition: background 0.2s ease, transform 0.2s ease;
    --rise: 700ms;
}
.myth-locked-map:hover {
    background: var(--color-accent-soft);
    transform: translateY(-2px);
    text-decoration: none;
}
.myth-locked-map:active {
    transform: translateY(0) scale(0.97);
}

/* The discouraged shortcut: deliberately small and quiet. */
.myth-locked-skip {
    background: none;
    border: none;
    padding: 0.25rem;
    color: var(--color-muted);
    font-family: inherit;
    font-size: 0.78rem;
    text-decoration: underline;
    opacity: 0.6;
    cursor: pointer;
    --rise: 950ms;
}
.myth-locked-skip:hover { opacity: 1; }

/* ── Reduced motion ─────────────────────────────────── */
/* One global switch instead of per-feature opt-outs: every animation and
   transition finishes (effectively) instantly, so entrance reveals and
   `forwards` states still land on their final, visible styles. */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-delay: 0ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        transition-delay: 0ms !important;
    }
}

/* ── Mobile tweaks ──────────────────────────────────── */
@media (max-width: 480px) {
    .main { padding: 4.5rem 1rem 2rem; }
    .myth-logo-wrap { width: 180px; height: 180px; }
    .myth-title { font-size: 2.2rem; }
    .intro-title { font-size: 2.4rem; }
    .map-container { height: min(58vh, 460px); }
}
