:root {
  color-scheme: dark;
  --bg: #222319;
  --deep: #171a12;
  --panel: #292b1e;
  --surface: #363827;
  --ink: #fff6dd;
  --muted: #d6d0b7;
  --gold: #f3d477;
  --line: #696448;
  --glass: #292b1ee8;
  --display: 'Noto Sans Display', 'Noto Sans', sans-serif;
  --ease: cubic-bezier(.16, 1, .3, 1);
}
* { box-sizing: border-box; }
html { scrollbar-color: #9f9460 var(--bg); scrollbar-width: thin; }
body { margin: 0; background: var(--deep); color: var(--ink); font: 16px/1.5 'Noto Sans', sans-serif; overflow-x: hidden; }
::selection { background: var(--gold); color: var(--deep); }
button, input, select { font: inherit; }
button, .text-button { touch-action: manipulation; -webkit-tap-highlight-color: transparent; }
button { min-height: 44px; padding: 10px 16px; color: var(--ink); background: var(--surface); border: 1px solid var(--line); border-radius: 10px; cursor: pointer; transition: background-color 160ms var(--ease), border-color 160ms var(--ease); }
button:active:not(:disabled) { background: #59563a; }
button:disabled { opacity: .48; cursor: not-allowed; }
button.primary, button[aria-pressed="true"] { background: var(--gold); border-color: var(--gold); color: #252313; font-weight: 700; }
button.primary { min-height: 48px; }
button[aria-busy="true"] { cursor: progress; opacity: .7; }
button[aria-disabled="true"] { cursor: not-allowed; }
:where(button, a, select, input, summary, [tabindex]):focus-visible { outline: 3px solid #ffe9a6; outline-offset: 3px; }
a { color: #ffe29a; text-underline-offset: 4px; overflow-wrap: anywhere; }
h1, h2, h3, h4, p { margin: 0; }
h1, h2, h3, h4 { font-family: var(--display); text-wrap: balance; }
img { image-rendering: pixelated; }
button img { pointer-events: none; }
fieldset { min-width: 0; margin: 0; padding: 0; border: 0; }
legend { padding: 0; margin-bottom: 12px; font-size: 16px; font-weight: 650; }
summary { min-height: 44px; padding: 11px 0; color: #ffe29a; font-size: 14px; font-weight: 600; cursor: pointer; }
summary::marker { color: #d9bb70; }
details[open] > summary { margin-bottom: 4px; }
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
.skip { position: fixed; top: -100px; left: 16px; z-index: 50; padding: 12px 18px; background: var(--deep); border-radius: 8px; }
.skip:focus { top: 8px; }

/* The playfield keeps its full geometry; the surrounding chrome stays quiet. */
.page-head { min-height: 64px; display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 8px 24px; background: var(--bg); }
.page-brand { display: flex; align-items: center; gap: 10px; min-width: 0; }
.page-brand img { flex: none; }
.page-head h1 { font-size: 19px; letter-spacing: -.02em; line-height: 1.2; }
.page-head nav { display: flex; align-items: center; gap: 8px; }
.page-head button { font-size: 12px; padding: 8px 12px; }
#online-status { color: var(--muted); font-size: 12px; margin-right: 8px; max-width: 28ch; }
#game-shell { position: relative; width: 100%; height: calc(100dvh - 110px); min-height: 240px; overflow: hidden; isolation: isolate; background: #39422e; }
#gdx-root { width: 100%; height: 100%; }
#game-canvas { display: block; width: 100%; height: 100%; outline: none; touch-action: none; image-rendering: pixelated; }
#game-canvas:focus-visible { outline: 2px solid var(--gold); outline-offset: -3px; }
body > footer { display: flex; align-items: center; gap: 20px; min-height: 46px; padding: 2px 24px; background: var(--bg); color: var(--muted); font-size: 12px; }
body > footer p { margin-right: auto; }
body > footer a { white-space: nowrap; }
.text-button { display: inline-flex; align-items: center; justify-content: center; min-height: 44px; padding: 8px 10px; background: transparent; border: 0; color: #ffe29a; font-size: 14px; text-decoration: underline; text-underline-offset: 4px; border-radius: 8px; }
body > footer .text-button { font-size: 12px; }
#loading { position: absolute; inset: 0; z-index: 10; display: grid; place-content: center; justify-items: center; gap: 12px; padding: 24px; text-align: center; background: var(--bg); }
#loading strong { font: 700 24px/1.3 var(--display); }
#loading p { max-width: 52ch; color: var(--muted); }
#launch-help { padding: 10px; }

/* One scrolling body, with the title and next action always available. */
.pixel-modal { width: min(700px, calc(100% - 40px)); max-width: none; max-height: calc(100dvh - 40px); margin: auto; padding: 0; overflow: hidden; background: var(--panel); color: var(--ink); border: 1px solid #a08b50; border-radius: 16px; box-shadow: 0 24px 80px #080b0759; }
.pixel-modal::backdrop { background: #11160db8; }
.pixel-modal.menu { width: min(1100px, calc(100% - 48px)); height: min(760px, calc(100dvh - 48px)); }
.modal-inner { display: flex; flex-direction: column; min-height: 0; max-height: calc(100dvh - 42px); }
.menu .modal-inner { height: 100%; max-height: 100%; }
.modal-head { flex: none; display: flex; align-items: center; justify-content: space-between; gap: 18px; padding: 22px 28px 20px; border-bottom: 1px solid var(--line); }
.modal-head h2 { min-width: 0; font-size: 28px; line-height: 1.18; font-weight: 750; letter-spacing: -.025em; }
.modal-tools { display: flex; align-items: center; gap: 8px; flex: none; }
.modal-tools #dialog-language { min-height: 44px; padding: 8px 12px; font-size: 12px; }
.icon-button { display: inline-grid; place-items: center; flex: none; width: 44px; min-height: 44px; padding: 9px; border-radius: 9px; }
.icon-button img { width: 24px; height: 24px; }
#dialog-content { display: flex; flex: 1 1 auto; flex-direction: column; min-height: 0; overflow: hidden; }
.screen-body { flex: 1 1 auto; min-height: 0; padding: 24px 28px; overflow-y: auto; overscroll-behavior: contain; scrollbar-gutter: stable; }
.screen-footer { flex: none; padding: 16px 28px 18px; border-top: 1px solid var(--line); background: #23261a; }
.modal-message { color: var(--muted); font-size: 16px; line-height: 1.6; max-width: 70ch; }
.modal-message + p { margin-top: 12px; }
.modal-actions { display: flex; flex-wrap: wrap; gap: 10px; }
.modal-actions button { flex: 1 1 140px; }
.screen-body > .modal-actions { margin-top: 24px; }
.screen-footer .modal-actions { margin-top: 0; }
.bank-note { max-width: 75ch; margin-top: 16px; color: var(--muted); font-size: 12px; line-height: 1.6; }
.view-enter #dialog-content { animation: view-enter 180ms var(--ease) both; }
@keyframes view-enter { from { opacity: .96; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* Guardians: a compact roster, and enough space to understand the chosen hero. */
.menu-intro { margin-bottom: 22px; max-width: 77ch; }
.character-select-layout { display: grid; grid-template-columns: 290px minmax(0,1fr); gap: 30px; align-items: start; }
.roster-panel legend { color: var(--muted); font-size: 14px; }
.choice-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 8px; }
.character-choice { display: grid; grid-template-columns: 40px minmax(0,1fr); grid-template-rows: 1fr auto; align-items: center; gap: 0 7px; min-height: 76px; padding: 8px; text-align: left; font-size: 12px; line-height: 1.35; background: #313424; }
.character-choice img { grid-row: 1/3; width: 40px; height: 48px; object-fit: contain; }
.character-choice span { overflow-wrap: anywhere; }
.character-choice small { align-self: start; font-size: 12px; font-variant-numeric: tabular-nums; opacity: .85; }
.character-choice[aria-pressed="true"] { border-color: #ffe49b; box-shadow: inset 0 0 0 1px #ffe49b; }
.roster-hint { display: none; color: var(--muted); font-size: 12px; margin-top: 8px; }
.selected-hero-panel { min-width: 0; padding-left: 28px; border-left: 1px solid var(--line); }
.hero-summary { display: grid; grid-template-columns: 120px minmax(0,1fr); gap: 8px 20px; min-height: 144px; }
.hero-portrait { grid-column: 1; grid-row: 1/4; width: 120px; height: 140px; object-fit: contain; align-self: center; }
.hero-heading { grid-column: 2; align-self: end; }
.hero-heading h3 { font-size: 32px; font-weight: 750; line-height: 1.15; letter-spacing: -.02em; color: #ffe29a; }
.hero-heading > span { display: block; margin-top: 8px; color: var(--muted); font-size: 12px; }
.hero-description, .hero-playstyle { grid-column: 2; max-width: 65ch; color: var(--muted); font-size: 14px; line-height: 1.6; }
.hero-playstyle { color: var(--ink); }
.hero-gameplay { margin-top: 24px; padding-top: 18px; border-top: 1px solid var(--line); }
.hero-gameplay > h4 { color: var(--muted); font-size: 12px; font-weight: 500; margin-bottom: 10px; }
.hero-stats { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 14px; margin: 0; }
.hero-stats > div { min-width: 0; padding: 4px 0 10px; }
.hero-stats dt { color: var(--muted); font-size: 12px; line-height: 1.4; }
.hero-stats dd { margin: 5px 0 0; font-size: 19px; font-weight: 650; line-height: 1.35; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.hero-ability { margin: 8px 0 12px; padding: 14px 16px; border-radius: 10px; background: #383d29; font-size: 14px; line-height: 1.6; }
.hero-ability strong { display: block; color: #ffe29a; font-size: 14px; }
.hero-ability p { margin-top: 5px; color: var(--muted); }
.hero-ability > span { display: block; margin-top: 5px; color: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; }
.hero-stats-details, .hero-history { border-top: 1px solid var(--line); }
.hero-stats-title { margin: 10px 0; font-size: 14px; }
.hero-attack-note, .hero-footnote, .hero-history-note { margin-top: 10px; font-size: 12px; color: var(--muted); line-height: 1.6; }
.hero-history { margin-top: 2px; color: var(--muted); font-size: 14px; line-height: 1.65; }
.hero-era { margin: 6px 0 14px; color: #ffe29a; font-size: 12px; }
.hero-history-facts { padding-left: 20px; margin: 0; }
.hero-history-facts li + li { margin-top: 14px; }
.hero-history-sources { margin-top: 5px; font-size: 12px; overflow-wrap: anywhere; }
.hero-history-content { padding-bottom: 14px; }
.menu-utilities { display: flex; justify-content: center; gap: 6px; margin: 8px -4px -5px; }
.menu-utilities .text-button { min-width: 0; flex: 1 1 auto; padding: 8px; white-space: nowrap; font-size: 12px; }
.settings-disclosure { margin-top: 18px; border-top: 1px solid var(--line); }
.audio-settings { display: flex; align-items: center; flex-wrap: wrap; gap: 12px 20px; padding-bottom: 10px; }
.audio-settings legend { color: var(--muted); font-size: 12px; margin-bottom: 8px; }
.audio-settings > button { font-size: 14px; }
.audio-settings label { display: grid; grid-template-columns: 1fr auto; flex: 1 1 180px; gap: 0 12px; font-size: 14px; min-width: 0; }
.audio-settings output { color: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; }
.audio-settings input { grid-column: 1/-1; width: 100%; min-height: 44px; margin: 0; accent-color: var(--gold); cursor: pointer; }
.audio-settings .bank-note { flex-basis: 100%; margin: 0; }

/* The route is schematic, with an accessible named list alongside it. */
.journey-heading { display: flex; align-items: center; gap: 12px; margin-bottom: 18px; }
.journey-heading > img { width: 46px; height: 56px; object-fit: contain; }
.journey-heading strong { font-size: 18px; }
.journey-heading p { margin-top: 2px; color: var(--muted); font-size: 12px; }
.journey-layout { display: grid; grid-template-columns: minmax(0,1fr) 250px; gap: 24px; align-items: start; }
.journey-main, .journey-sidebar { min-width: 0; }
.journey-figure { margin: 0; }
.journey-viewport { width: 100%; overflow: hidden; border-radius: 14px; }
.journey-map { position: relative; width: 100%; height: 320px; overflow: hidden; background: #1d2318; border-radius: 14px; }
.journey-map svg { position: absolute; inset: 0; width: 100%; height: 100%; }
.country-shape { fill: #485038; stroke: #a69b63; stroke-width: 2; stroke-linejoin: round; }
.journey-trail { fill: none; stroke: #dec477; stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; stroke-dasharray: 6 8; opacity: .7; }
.route-node { position: absolute; display: grid; place-items: center; width: 44px; height: 44px; min-height: 44px; transform: translate(-50%,-50%); padding: 0; border-radius: 50%; border-color: #c6b579; background: #42482f; font-size: 16px; font-weight: 650; }
.route-node.locked { color: #d6d0b7; background: #2c3222; border-color: #8c8a64; }
.route-node.cleared { background: #486341; border-color: #b4d4a5; }
.route-node.open:not([aria-pressed="true"]) { color: #fff4ce; background: #685d31; border-color: #e3c579; }
.route-node[aria-pressed="true"] { outline: 2px solid #ffe9a6; outline-offset: 4px; }
.journey-figure figcaption { margin-top: 10px; color: var(--muted); font-size: 12px; line-height: 1.6; }
.journey-pan-note { display: none; }
.journey-selection { display: grid; gap: 7px; padding: 4px 0 18px; border-bottom: 1px solid var(--line); }
.journey-selection strong { font: 700 24px/1.25 var(--display); }
.journey-selection > span { color: #ffe29a; font-size: 12px; }
.journey-message { margin-top: 14px; color: #ffe29a; font-size: 14px; line-height: 1.6; }
.journey-message:empty { display: none; }
.journey-details { margin-top: 4px; }
.journey-list { display: grid; grid-template-columns: 1fr; gap: 8px; list-style: none; padding: 0; margin: 6px 0; }
.journey-list button { display: flex; align-items: center; gap: 10px; width: 100%; min-height: 54px; padding: 8px 10px; text-align: left; font-size: 14px; line-height: 1.4; }
.journey-list button small { display: block; margin-top: 3px; color: var(--muted); font-size: 12px; }
.journey-list button[aria-pressed="true"] small { color: #494324; }
.journey-list button.locked { background: #2c3222; }
.journey-list button.cleared { border-color: #9db78b; }
.stage-number { width: 20px; flex: none; text-align: center; font-variant-numeric: tabular-nums; }
.journey-footer-selection { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; margin-bottom: 12px; }
.journey-footer-selection strong { font-size: 16px; }
.journey-footer-selection > span { color: var(--muted); font-size: 12px; }

/* Questions and historical reference favor comfortable reading over density. */
.quiz-artifact { display: flex; align-items: center; gap: 14px; margin-bottom: 20px; }
.quiz-artifact img { width: 52px; height: 52px; flex: none; object-fit: contain; }
.quiz-artifact strong { font-size: 17px; }
.quiz-artifact p { margin-top: 3px; color: var(--muted); font-size: 14px; }
.question-meta { display: flex; justify-content: space-between; align-items: center; gap: 16px; padding-top: 14px; border-top: 1px solid var(--line); color: #ffe29a; font-size: 12px; }
.quiz-progress { white-space: nowrap; }
.question-prompt { margin: 22px 0 20px; font-size: 23px; line-height: 1.45; font-weight: 600; overflow-wrap: anywhere; }
.answer-options { display: grid; gap: 10px; }
.answer-options button { display: flex; align-items: center; gap: 12px; min-height: 58px; padding: 12px; text-align: left; font-size: 16px; line-height: 1.5; background: #303526; }
.answer-options b { display: grid; place-items: center; width: 30px; height: 30px; flex: none; background: #454b33; border-radius: 6px; font-size: 14px; }
.answer-options button[aria-pressed="true"] { background: var(--gold); color: #252313; }
.answer-options button[aria-pressed="true"] b { background: #d6b956; color: #252313; }
.answer-feedback { margin-top: 18px; padding: 14px 16px; border-radius: 10px; background: #3a422d; color: var(--ink); font-size: 14px; line-height: 1.7; overflow-wrap: anywhere; }
.answer-feedback[role="alert"] { background: #553d29; color: #ffe3c0; }
.answer-feedback strong { display: block; margin-bottom: 6px; color: #ffe29a; }
.feedback-option { padding: 12px 14px; background: #303526; border: 1px solid var(--line); border-radius: 10px; font-size: 16px; line-height: 1.5; }
.feedback-option.correct { background: #344f35; border-color: #9fc39a; }
.feedback-option strong { display: inline; color: #d4edbc; font-size: 14px; }
.pause-stats { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 0 24px; margin: 18px 0 0; }
.pause-stats > div { display: flex; justify-content: space-between; gap: 16px; padding: 12px 0; border-top: 1px solid var(--line); font-size: 14px; }
.pause-stats dt { color: var(--muted); }
.pause-stats dd { margin: 0; font-weight: 600; font-variant-numeric: tabular-nums; }
.upgrade-options { display: grid; gap: 12px; margin-top: 20px; }
.upgrade-options button { display: grid; gap: 6px; text-align: left; min-height: 88px; padding: 16px; }
.upgrade-options strong { color: #ffe29a; font-size: 18px; }
.upgrade-options span { color: var(--muted); font-size: 14px; line-height: 1.6; }
.collection-filters { position: sticky; top: -24px; z-index: 1; display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 8px; margin: 20px -1px 0; padding: 12px 1px; background: var(--panel); }
.collection-filters button { padding: 10px 6px; font-size: 14px; }
.collection-fiction { margin-top: 10px; color: var(--muted); font-size: 14px; line-height: 1.6; }
.collection-grid { display: grid; grid-template-columns: 1fr; }
.collection-group { padding: 24px 0 12px; color: #ffe29a; font-size: 20px; }
.collection-item { display: grid; grid-template-columns: 52px minmax(0,1fr); gap: 18px; align-items: start; padding: 22px 0; border-top: 1px solid var(--line); }
.collection-item > img { width: 52px; height: 52px; object-fit: contain; margin-top: 3px; }
.collection-item.locked > img { opacity: .7; }
.artifact-copy { min-width: 0; }
.collection-item h3 { font-size: 19px; line-height: 1.4; }
.collection-item p { margin-top: 8px; color: var(--muted); font-size: 14px; line-height: 1.65; overflow-wrap: anywhere; }
.collection-item .artifact-era { margin-top: 4px; color: #ffe29a; font-size: 12px; }
.collection-item .artifact-history { margin-top: 14px; color: var(--ink); font-size: 16px; }
.collection-item .artifact-history-source, .collection-item .artifact-source { font-size: 12px; }
.collection-item .artifact-effect { margin-top: 16px; padding-top: 12px; border-top: 1px solid var(--line); }
.artifact-effect strong { display: block; margin-bottom: 4px; color: #ffe29a; font-size: 14px; }
.artifact-history-source a { display: inline-block; padding-block: 2px; }
.collection-empty { padding: 28px 0; color: var(--muted); }
.result-score { margin: 12px 0; color: #ffe29a; font: 700 44px/1.2 var(--display); font-variant-numeric: tabular-nums; }
.victory-emblem { height: 68px; display: grid; place-items: center; margin-bottom: 12px; }
.victory-emblem > img { width: 60px; height: 60px; }
.victory-emblem i { display: none; }
.victory-next { margin: 18px 0; }
.victory-next button { width: 100%; }
.result-claims { margin-top: 24px; }
.result-claims h3 { font-size: 20px; }
.result-claim { display: flex; align-items: center; gap: 14px; width: 100%; margin-top: 10px; padding: 14px; text-align: left; }
.result-claim img { width: 44px; height: 44px; object-fit: contain; flex: none; }
.result-claim span { display: grid; gap: 5px; }
.result-claim strong { color: #ffe29a; font-size: 14px; }
.result-claim small { color: var(--muted); font-size: 12px; line-height: 1.5; }
.instructions-list { margin: 0; padding-left: 22px; color: var(--muted); font-size: 16px; line-height: 1.75; }
.instructions-list li + li { margin-top: 16px; }
.records-table { width: 100%; margin-top: 18px; border-collapse: collapse; font-size: 14px; }
.records-table th, .records-table td { padding: 12px 6px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; overflow-wrap: anywhere; }
.records-table th { color: var(--muted); font-size: 12px; font-weight: 600; }
.records-table td:last-child { text-align: right; font-variant-numeric: tabular-nums; }
.leaderboard-section { margin-top: 24px; }
.leaderboard-section h3 { font-size: 20px; }
.board-tabs { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 8px; margin-top: 12px; }
.board-detail { display: block; margin-top: 5px; color: var(--muted); font-size: 12px; }
#google-signin { margin-top: 20px; min-height: 44px; }

/* The small glass surfaces stay legible without blurring the entire scene. */
#hud { position: absolute; inset: 0; z-index: 3; pointer-events: none; }
#hud button { pointer-events: auto; }
#hud #ability, #hud #claim, #hud #bag, #hud #pause { touch-action: none; }
.glass { background: var(--glass); border: 1px solid #d5c07894; border-radius: 12px; backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); box-shadow: 0 4px 16px #0e120d26; }
.xp-hud { position: absolute; top: max(8px,env(safe-area-inset-top)); left: max(16px,env(safe-area-inset-left)); right: max(16px,env(safe-area-inset-right)); }
.xp-caption { display: flex; justify-content: space-between; gap: 12px; margin-bottom: 5px; padding: 2px 6px; color: #fff1bc; background: #1c2318e8; border-radius: 3px; font-size: 12px; line-height: 1.4; font-variant-numeric: tabular-nums; }
.xp-track { height: 5px; background: #20271aeb; overflow: hidden; border-radius: 2px; }
.xp-fill { display: block; width: 100%; height: 100%; transform: scaleX(0); transform-origin: left center; background: var(--gold); transition: transform 200ms var(--ease); }
.xp-track.level-change .xp-fill { transition: none; }
.xp-track.max-level .xp-fill { background: #ffe7a0; }
.hud-top { position: absolute; top: max(45px,calc(env(safe-area-inset-top) + 37px)); left: max(16px,env(safe-area-inset-left)); right: max(16px,env(safe-area-inset-right)); display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; }
.hearts { display: grid; grid-template-columns: repeat(5,30px); gap: 3px; flex: none; filter: drop-shadow(0 2px 2px #11160da6); }
.hearts img { width: 30px; height: 30px; }
.hearts.protected { outline: 1px solid #c1e2b2; outline-offset: 4px; border-radius: 4px; }
.wave-panel { display: flex; align-items: center; gap: 12px; max-width: 320px; padding: 6px 7px 6px 14px; }
.wave-copy { display: grid; gap: 2px; min-width: 0; }
#wave-label { color: #ffe29a; font-size: 12px; }
#wave-name { font-size: 14px; line-height: 1.35; overflow-wrap: anywhere; }
.wave-panel .icon-button { border-color: transparent; background: #f3d47712; }
.boss-panel { position: absolute; top: max(126px,calc(env(safe-area-inset-top) + 118px)); left: 50%; transform: translateX(-50%); width: min(420px,70%); padding: 9px 14px; }
.boss-panel > div { display: flex; justify-content: space-between; gap: 14px; margin-bottom: 5px; font-size: 14px; }
#boss-value { color: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; }
progress { display: block; width: 100%; height: 8px; overflow: hidden; border: 0; border-radius: 3px; accent-color: #e7a27e; }
progress::-webkit-progress-bar { background: #3c2e23; }
progress::-webkit-progress-value { background: #e7a27e; }
progress::-moz-progress-bar { background: #e7a27e; }
.hud-bottom { position: absolute; left: max(20px,env(safe-area-inset-left)); right: max(20px,env(safe-area-inset-right)); bottom: max(20px,env(safe-area-inset-bottom)); height: 120px; pointer-events: none; }
.artifact-dock { position: absolute; bottom: 0; left: 0; display: grid; justify-items: center; align-content: center; gap: 3px; width: 78px; height: 70px; padding: 5px 3px; }
.artifact-dock > img { width: 28px; height: 28px; }
#artifact-count { position: absolute; top: -5px; right: -5px; min-width: 20px; height: 20px; padding: 0 4px; background: var(--gold); color: #252313; border-radius: 6px; font-size: 12px; line-height: 20px; font-weight: 700; text-align: center; }
.ability-button { position: absolute; bottom: 0; right: 0; display: grid; justify-items: center; align-content: center; gap: 3px; width: 78px; height: 70px; padding: 5px 3px; }
.ability-button img { width: 28px; height: 28px; }
.ability-button.power-active { border-color: var(--gold); background: #4a492d; box-shadow: inset 0 0 0 1px #e9cf7c; }
.ability-button.power-active:disabled { opacity: .95; }
#ability-label { max-width: 100%; font-size: 10px; line-height: 1.15; overflow-wrap: anywhere; }
.control-label { display: block; color: var(--ink); font-size: 12px; line-height: 1.3; letter-spacing: -.02em; white-space: nowrap; }
#ability-value { position: absolute; right: -3px; top: -5px; min-width: 24px; padding: 2px 5px; color: var(--ink); background: var(--deep); border: 1px solid var(--line); border-radius: 6px; font-size: 12px; font-variant-numeric: tabular-nums; }
#ability-value:empty { display: none; }
.claim-drop { position: absolute; right: 0; bottom: 86px; display: flex; align-items: center; gap: 8px; min-height: 44px; max-width: 200px; padding: 8px 10px; font-size: 14px; }
.claim-drop img { width: 24px; height: 24px; object-fit: contain; }
kbd { padding: 0 4px; border: 1px solid var(--line); border-radius: 4px; font: 12px/1.5 'Noto Sans',sans-serif; }
.objective { position: absolute; left: 50%; bottom: 22px; transform: translateX(-50%); max-width: min(480px,60%); padding: 5px 12px; border-radius: 7px; color: var(--ink); background: #20271ae8; text-align: center; font-size: 12px; line-height: 1.5; }
.objective:empty { display: none; }
.joystick { position: absolute; left: 50%; bottom: max(18px,env(safe-area-inset-bottom)); display: none; width: 110px; height: 110px; transform: translateX(-50%); border-radius: 50%; border-color: #e7d69391; background: #2b321fb8; backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); touch-action: none; user-select: none; -webkit-user-select: none; }
.joystick-ring { position: absolute; inset: 17px; border: 1px solid #ddce9452; border-radius: 50%; pointer-events: none; }
.joystick-thumb { position: absolute; left: 50%; top: 50%; width: 42px; height: 42px; transform: translate(-50%,-50%); background: var(--gold); border: 1px solid #ffe9a6; border-radius: 50%; pointer-events: none; }
.gate-toast { position: absolute; top: 190px; left: 50%; z-index: 5; transform: translateX(-50%); width: max-content; max-width: calc(100% - 32px); padding: 12px 18px; text-align: center; font-size: 14px; pointer-events: none; }
.scene-transition { position: absolute; inset: 0; z-index: 7; display: grid; place-items: start center; padding: 180px 24px 24px; background: linear-gradient(#171e1080,transparent 70%); }
.transition-copy { max-width: 600px; padding: 20px 28px; text-align: center; }
.transition-copy h2 { font-size: 30px; line-height: 1.25; }
.transition-copy p { margin-top: 8px; color: var(--muted); font-size: 14px; }

@media (hover:hover) {
  button:hover:not(:disabled) { background: #484c34; border-color: #b9a96d; }
  button.primary:hover:not(:disabled), button[aria-pressed="true"]:hover:not(:disabled) { color: #252313; background: #ffe39a; border-color: #ffe39a; }
  .text-button:hover { background: #f3d4770d; color: #fff1be; }
  a:hover { color: #fff4d1; }
}
@media (max-width: 1000px) {
  #online-status { display: none; }
  .page-head h1 { font-size: 17px; }
  .character-select-layout { grid-template-columns: 250px minmax(0,1fr); gap: 22px; }
  .selected-hero-panel { padding-left: 20px; }
  .character-choice { grid-template-columns: 34px minmax(0,1fr); gap: 0 5px; }
  .character-choice img { width: 34px; }
  .hero-summary { grid-template-columns: 96px minmax(0,1fr); gap: 8px 14px; }
  .hero-portrait { width: 96px; height: 126px; }
  .hero-heading h3 { font-size: 28px; }
  .hero-description, .hero-playstyle { grid-column: 1/-1; }
  .hero-portrait { grid-row: 1; }
  .hero-heading { align-self: center; }
  .journey-layout { grid-template-columns: minmax(0,1fr) 220px; gap: 20px; }
  body > footer { gap: 12px; }
  body > footer p { max-width: 54ch; }
}
@media (max-width: 720px) {
  .page-head { min-height: 64px; padding: 8px 12px; gap: 8px; }
  .page-brand { gap: 6px; }
  .page-brand img { width: 24px; height: 24px; }
  .page-head h1 { max-width: 23ch; font-size: 14px; }
  .page-head nav { gap: 5px; }
  .page-head button { padding: 8px; font-size: 12px; }
  body > footer { flex-wrap: wrap; gap: 2px 16px; padding: 4px 12px; min-height: 78px; }
  body > footer p { flex-basis: 100%; max-width: none; font-size: 12px; }
  body > footer a, body > footer .text-button { font-size: 12px; }
  #game-shell { height: calc(100dvh - 142px); }
  body[data-game-state]:not([data-game-state="menu"]) > .page-head,
  body[data-game-state]:not([data-game-state="menu"]) > footer { display: none; }
  body[data-game-state]:not([data-game-state="menu"]) #game-shell { height: 100dvh; min-height: 0; }
  .pixel-modal, .pixel-modal.menu { width: calc(100% - 16px); max-height: calc(100dvh - 16px); border-radius: 14px; }
  .pixel-modal.menu { height: calc(100dvh - 16px); }
  .modal-inner { max-height: calc(100dvh - 18px); }
  .modal-head { padding: max(16px,env(safe-area-inset-top)) 16px 16px; gap: 10px; }
  .modal-head h2 { font-size: 24px; }
  .modal-tools { gap: 5px; }
  .modal-tools #dialog-language { padding: 8px; }
  .screen-body { padding: 16px; scrollbar-gutter: auto; }
  .screen-footer { padding: 12px 16px max(12px,env(safe-area-inset-bottom)); }
  .modal-message { font-size: 14px; line-height: 1.6; }
  .menu-intro { margin-bottom: 16px; }
  .character-select-layout { display: block; }
  .roster-panel legend { margin-bottom: 8px; font-size: 14px; }
  .choice-grid { grid-template-columns: repeat(10,82px); gap: 7px; overflow-x: auto; padding: 6px 6px 9px; margin: -6px; scroll-padding-inline: 6px; overscroll-behavior-x: contain; scrollbar-width: thin; }
  .character-choice { display: flex; flex-direction: column; gap: 3px; min-height: 106px; padding: 6px 4px; font-size: 12px; line-height: 1.3; text-align: center; }
  .character-choice img { width: 40px; height: 42px; }
  .character-choice small { margin-top: auto; align-self: center; }
  .roster-hint { display: none; }
  .selected-hero-panel { margin-top: 18px; padding: 18px 0 0; border-left: 0; border-top: 1px solid var(--line); }
  .hero-summary { grid-template-columns: 72px minmax(0,1fr); gap: 10px 14px; min-height: 0; }
  .hero-portrait { grid-row: 1; width: 72px; height: 80px; }
  .hero-heading h3 { font-size: 26px; }
  .hero-heading > span { margin-top: 6px; font-size: 12px; }
  .hero-description, .hero-playstyle { font-size: 14px; }
  .hero-gameplay { margin-top: 16px; padding-top: 14px; }
  .hero-gameplay > h4 { margin-bottom: 8px; }
  .hero-stats { gap: 10px; }
  .hero-stats dd { font-size: 17px; }
  .hero-ability { margin-top: 6px; padding: 12px; }
  .menu-utilities { display: grid; grid-template-columns: repeat(6,minmax(0,1fr)); margin: 6px -4px -5px; gap: 2px 4px; }
  .menu-utilities .text-button { grid-column: span 2; padding: 8px 4px; white-space: normal; text-align: center; line-height: 1.35; }
  .menu-utilities .text-button:nth-child(n+4) { grid-column: span 3; }
  .settings-disclosure { margin-top: 14px; }
  .journey-heading { margin-bottom: 14px; }
  .journey-layout { display: block; }
  .journey-map { height: 270px; }
  .journey-selection { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 18px 0 12px; }
  .journey-selection strong { font-size: 22px; }
  .journey-selection > span { flex: none; }
  .journey-list { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .journey-list button { height: 100%; min-height: 64px; font-size: 14px; }
  .journey-footer-selection { display: grid; gap: 3px; margin-bottom: 10px; }
  .journey-footer-selection > span { font-size: 12px; }
  .journey-footer-selection + .modal-actions button { flex-basis: 100px; }
  .journey-footer-selection + .modal-actions button.primary { flex-basis: 100%; }
  .question-prompt { font-size: 21px; margin: 20px 0 16px; }
  .answer-options button { min-height: 54px; font-size: 16px; padding: 10px; }
  .quiz-artifact { gap: 12px; margin-bottom: 16px; }
  .quiz-artifact img { width: 44px; height: 44px; }
  .quiz-artifact strong { font-size: 16px; }
  .quiz-artifact p { font-size: 14px; }
  .question-meta { gap: 8px; align-items: flex-start; }
  .pause-stats { gap: 0 16px; }
  .pause-stats > div { gap: 8px; }
  .collection-filters { top: -16px; }
  .collection-filters button { font-size: 12px; }
  .collection-item { grid-template-columns: 40px minmax(0,1fr); gap: 12px; padding: 20px 0; }
  .collection-item > img { width: 40px; height: 40px; }
  .collection-item h3 { font-size: 18px; }
  .result-score { font-size: 38px; }
  .records-table { font-size: 12px; }
  .records-table th, .records-table td { padding: 12px 4px; }
  .xp-hud { left: 12px; right: 12px; }
  .hud-top { left: 12px; right: 12px; gap: 12px; }
  .hearts { grid-template-columns: repeat(5,24px); gap: 2px; }
  .hearts img { width: 24px; height: 24px; }
  .wave-panel { max-width: 54%; gap: 4px; padding: 5px 5px 5px 10px; }
  #wave-name { font-size: 12px; }
  .wave-panel .icon-button { width: 44px; }
  .boss-panel { top: max(122px,calc(env(safe-area-inset-top) + 114px)); width: calc(100% - 36px); }
  .hud-bottom { left: max(16px,env(safe-area-inset-left)); right: max(16px,env(safe-area-inset-right)); bottom: max(22px,env(safe-area-inset-bottom)); }
  .joystick { display: block; }
  .claim-drop { max-width: 130px; font-size: 12px; padding: 8px; }
  .claim-drop kbd { display: none; }
  .objective { width: max-content; max-width: calc(100% - 56px); bottom: max(160px,calc(env(safe-area-inset-bottom) + 145px)); }
  .gate-toast { top: 188px; font-size: 14px; }
  .scene-transition { padding: 190px 20px 20px; }
  .transition-copy { padding: 18px; }
  .transition-copy h2 { font-size: 26px; }
}
@media (pointer: coarse) {
  .joystick { display: block; }
  .objective { bottom: max(160px,calc(env(safe-area-inset-bottom) + 145px)); }
}
@media (max-width: 360px) {
  .page-head h1 { max-width: 18ch; font-size: 12px; }
  .page-brand img { display: none; }
  .modal-head { padding-inline: 12px; }
  .modal-head h2 { font-size: 21px; }
  .screen-body, .screen-footer { padding-inline: 12px; }
  .hero-heading h3 { font-size: 24px; }
  .hero-stats { gap: 6px; }
  .hero-stats dd { font-size: 16px; }
  .hearts { grid-template-columns: repeat(5,21px); }
  .hearts img { width: 21px; height: 21px; }
  .question-meta { flex-wrap: wrap; }
}
@media (max-height: 500px) and (min-width: 600px) {
  .page-head, body > footer { display: none; }
  #game-shell, body[data-game-state]:not([data-game-state="menu"]) #game-shell { height: 100dvh; min-height: 0; }
  .pixel-modal, .pixel-modal.menu { width: calc(100% - 20px); max-height: calc(100dvh - 16px); }
  .pixel-modal.menu { height: calc(100dvh - 16px); }
  .modal-inner { max-height: calc(100dvh - 18px); }
  .modal-head { padding: 10px 20px; }
  .modal-head h2 { font-size: 24px; }
  .screen-body { padding: 16px 20px; }
  .screen-footer { padding: 10px 20px; }
  .menu-utilities { display: grid; grid-template-columns: repeat(5,minmax(0,1fr)); margin-top: 2px; }
  .menu-utilities .text-button, .menu-utilities .text-button:nth-child(n+4) { grid-column: auto; min-height: 44px; white-space: normal; text-align: center; line-height: 1.35; }
  .character-select-layout { display: grid; grid-template-columns: 240px minmax(0,1fr); gap: 20px; }
  .selected-hero-panel { margin-top: 0; padding: 0 0 0 20px; border-top: 0; border-left: 1px solid var(--line); }
  .choice-grid { grid-template-columns: repeat(2,minmax(0,1fr)); overflow: visible; }
  .character-choice { display: grid; grid-template-columns: 32px minmax(0,1fr); min-height: 70px; text-align: left; gap: 0 6px; }
  .character-choice img { grid-row: 1/3; width: 32px; height: 44px; }
  .character-choice small { margin-top: 0; align-self: start; }
  .roster-hint { display: none; }
  .hero-summary { grid-template-columns: 72px minmax(0,1fr); }
  .hero-portrait { width: 72px; height: 84px; }
  .hero-heading h3 { font-size: 26px; }
  .journey-layout { display: grid; grid-template-columns: minmax(0,1fr) 220px; gap: 20px; }
  .journey-map { height: 260px; }
  .journey-selection { display: grid; padding-top: 0; }
  .journey-list { grid-template-columns: 1fr; }
  .journey-footer-selection { display: none; }
  .journey-footer-selection + .modal-actions button.primary { flex-basis: 140px; }
  .xp-hud { top: max(5px,env(safe-area-inset-top)); left: 12px; right: 12px; }
  .xp-caption { font-size: 12px; margin-bottom: 3px; }
  .xp-track { height: 4px; }
  .hud-top { top: 38px; left: 12px; right: 12px; }
  .hearts { grid-template-columns: repeat(5,24px); gap: 2px; }
  .hearts img { width: 24px; height: 24px; }
  .wave-panel { max-width: 220px; padding: 4px 5px 4px 10px; gap: 6px; }
  #wave-name { font-size: 12px; }
  .boss-panel { top: 38px; width: 32%; padding: 7px 10px; }
  .boss-panel > div { font-size: 12px; }
  .hud-bottom { left: max(16px,env(safe-area-inset-left)); right: max(16px,env(safe-area-inset-right)); bottom: max(12px,env(safe-area-inset-bottom)); }
  .joystick { display: block; width: 90px; height: 90px; bottom: max(10px,env(safe-area-inset-bottom)); }
  .joystick-ring { inset: 14px; }
  .joystick-thumb { width: 36px; height: 36px; }
  .ability-button, .artifact-dock { width: 70px; height: 60px; }
  .ability-button img, .artifact-dock > img { width: 24px; height: 24px; }
  .claim-drop { right: 84px; bottom: 0; max-width: 190px; min-height: 48px; }
  .objective { left: 18%; bottom: 14px; max-width: 23%; transform: none; font-size: 12px; padding: 4px 8px; }
  .gate-toast { top: 112px; }
  .scene-transition { padding-top: 110px; }
  .transition-copy { padding: 12px 22px; }
  .transition-copy h2 { font-size: 26px; }
}
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  .glass, .joystick { background: #2b321f; }
}
@media (prefers-reduced-transparency: reduce) {
  .glass, .joystick { background: #2b321f; backdrop-filter: none; -webkit-backdrop-filter: none; }
  .pixel-modal::backdrop { background: #11160de8; }
  .scene-transition { background: #171e10cc; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}
@media (forced-colors: active) {
  body, .pixel-modal, .screen-footer, .glass, .joystick, button, .answer-options b, .hero-ability, .answer-feedback, .feedback-option, .collection-filters, .journey-map, .xp-caption, .objective { background: Canvas; color: CanvasText; border-color: CanvasText; background-image: none; box-shadow: none; backdrop-filter: none; }
  .pixel-modal::backdrop { background: Canvas; opacity: .85; }
  button.primary, button[aria-pressed="true"], .route-node[aria-pressed="true"] { background: Highlight; color: HighlightText; border-color: Highlight; }
  .joystick-thumb, .xp-fill { background: Highlight; forced-color-adjust: none; }
  .joystick-ring, .xp-track { border: 1px solid CanvasText; }
  .country-shape { fill: Canvas; stroke: CanvasText; }
  .journey-trail { stroke: CanvasText; }
  .hero-heading h3, .hero-ability strong, .hero-history, .hero-description, .hero-playstyle, .hero-stats dt, .hero-stats dd, .hero-heading > span, .modal-message, .bank-note { color: CanvasText; }
  a { color: LinkText; }
  progress { accent-color: Highlight; }
}
