.game-page {
  min-height: 100vh;
  padding: 10.5rem 4vw 6rem;
  overflow: hidden;
  background:
    radial-gradient(circle at 50% 5%, rgba(107, 84, 151, .16), transparent 34rem),
    linear-gradient(180deg, #07131d 0%, #091822 60%, #061018 100%);
}

.game-page-intro {
  width: min(920px, 100%);
  margin: 0 auto 2.3rem;
  text-align: center;
}

.game-kicker,
.screen-kicker {
  margin: 0 0 .75rem;
  color: var(--gold-light);
  font-size: .62rem;
  font-weight: 800;
  letter-spacing: .28em;
}

.game-page-intro h1 {
  margin: 0;
  font: 400 clamp(2.8rem, 6vw, 5.6rem)/.95 Georgia, serif;
  letter-spacing: -.045em;
}

.game-page-intro > p:not(.game-kicker) {
  max-width: 700px;
  margin: 1.25rem auto 0;
  color: #aab5b7;
  font: 400 1rem/1.7 Georgia, serif;
}

.timeline-game {
  width: min(1440px, 100%);
  margin: 0 auto;
  border: 1px solid rgba(214, 176, 95, .38);
  background: #040a0f;
  box-shadow: 0 35px 90px rgba(0, 0, 0, .5), 0 0 70px rgba(92, 55, 136, .12);
}

.game-hud {
  min-height: 70px;
  display: grid;
  grid-template-columns: 150px 130px 1fr 110px;
  align-items: center;
  gap: 1.4rem;
  padding: .9rem 1.4rem;
  background: #07131b;
  border-bottom: 1px solid rgba(255, 255, 255, .1);
}

.hud-stat { display: grid; gap: .2rem; }
.hud-score { text-align: right; }
.hud-label { color: #75848a; font-size: .51rem; letter-spacing: .18em; }
.hud-stat strong { color: #f4efe4; font: 600 .9rem Georgia, serif; }
#game-lives { color: #dfbf70; letter-spacing: .15em; }
.hud-progress { display: grid; gap: .5rem; }
.hud-progress .hud-label { display: flex; justify-content: space-between; }
.hud-progress .hud-label b { font-weight: 700; }
.progress-track { position: relative; height: 3px; display: block; background: #2d3940; }
.progress-track i { position: absolute; inset: 0 auto 0 0; width: 0; background: var(--gold); box-shadow: 0 0 12px rgba(214, 176, 95, .7); transition: width .15s linear; }
.progress-track em { position: absolute; left: 0; top: 50%; color: var(--gold-light); font-style: normal; font-size: .7rem; transform: translate(-50%, -50%); transition: left .15s linear; }
.level-mark { position: absolute; top: 50%; width: 7px; height: 7px; border: 1px solid rgba(214,176,95,.8); border-radius: 50%; background: #07131b; transform: translate(-50%, -50%); }
.level-mark.mark-one { left: 33.333%; }
.level-mark.mark-two { left: 66.666%; }

.game-stage {
  position: relative;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  isolation: isolate;
  cursor: pointer;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}

#game-canvas { width: 100%; height: 100%; display: block; background: #0b1922; }

.game-stage::after {
  content: "";
  position: absolute;
  z-index: 2;
  inset: 0;
  pointer-events: none;
  box-shadow: inset 0 0 90px rgba(2, 8, 12, .56);
}

.game-screen {
  position: absolute;
  z-index: 8;
  inset: 0;
  padding: clamp(1rem, 4vw, 3.5rem);
  display: grid;
  place-items: center;
  background: linear-gradient(90deg, rgba(3, 10, 15, .82), rgba(3, 10, 15, .43), rgba(3, 10, 15, .75));
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity .35s ease, visibility .35s ease;
}

.game-screen.is-visible { opacity: 1; visibility: visible; pointer-events: auto; }
#game-result { overflow-y: auto; touch-action: pan-y; }

.screen-panel {
  width: min(900px, 100%);
  padding: clamp(1.2rem, 3vw, 2.5rem);
  text-align: center;
  border: 1px solid rgba(214, 176, 95, .4);
  background: rgba(4, 14, 21, .89);
  box-shadow: 0 24px 70px rgba(0, 0, 0, .5);
  backdrop-filter: blur(14px);
}

.screen-panel h2 {
  margin: 0;
  font: 400 clamp(1.9rem, 4.2vw, 3.7rem)/1 Georgia, serif;
}

.character-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: .75rem;
  margin: 1.8rem 0 1.4rem;
}

.character-card {
  min-width: 0;
  padding: .9rem .6rem 1rem;
  color: #f5f1e8;
  border: 1px solid rgba(255, 255, 255, .16);
  background: rgba(255, 255, 255, .04);
  cursor: pointer;
  transition: transform .22s ease, border-color .22s ease, background .22s ease, box-shadow .22s ease;
}

.character-card:hover,
.character-card:focus-visible {
  transform: translateY(-6px);
  border-color: var(--gold);
  background: rgba(214, 176, 95, .1);
  box-shadow: 0 15px 28px rgba(0, 0, 0, .26);
  outline: none;
}

.character-card strong { display: block; margin-top: .6rem; font: 400 1.05rem Georgia, serif; }
.character-card small { display: block; margin-top: .25rem; color: #87969a; font-size: .55rem; letter-spacing: .09em; text-transform: uppercase; }

.character-portrait {
  position: relative;
  width: 68px;
  height: 78px;
  display: inline-block;
  border-radius: 50% 50% 46% 46%;
  background: radial-gradient(circle at 50% 32%, rgba(255,255,255,.12), rgba(255,255,255,.025) 65%);
}

.character-portrait i { position: absolute; display: block; }
.char-face { z-index: 2; left: 25px; top: 18px; width: 22px; height: 25px; border-radius: 48%; background: #c98d6b; }
.char-body { z-index: 1; left: 18px; top: 39px; width: 37px; height: 37px; border-radius: 17px 17px 5px 5px; background: #264d68; }
.char-hair { z-index: 3; left: 21px; top: 12px; width: 31px; height: 16px; border-radius: 60% 50% 35% 25%; background: #15191e; transform: rotate(-5deg); }
.merlin .char-face { background: #b98969; }
.merlin .char-body { background: #255e5c; clip-path: polygon(25% 0, 75% 0, 100% 100%, 0 100%); }
.char-hat { z-index: 4; left: 16px; top: 2px; width: 43px; height: 26px; background: #24494f; clip-path: polygon(52% 0, 100% 100%, 0 100%); transform: rotate(-7deg); }
.char-staff { z-index: 5; right: 9px; top: 25px; width: 3px; height: 51px; border-radius: 4px; background: #aa7f4b; transform: rotate(6deg); }
.char-staff::before { content: ""; position: absolute; left: -4px; top: -5px; width: 10px; height: 10px; border: 2px solid #dfc675; border-radius: 50%; }
.dylan .char-body { background: #285c7a; }
.dylan .char-hair { box-shadow: -4px 3px 0 #15191e, 5px 3px 0 #15191e; }
.char-sword { z-index: 5; right: 8px; top: 29px; width: 3px; height: 44px; background: #e5d493; transform: rotate(22deg); box-shadow: 0 0 8px #e5d493; }
.char-sword::after { content: ""; position: absolute; left: -5px; bottom: 8px; width: 13px; height: 3px; background: #a57b39; }
.mahi .char-face { background: #895f43; }
.mahi .char-body { background: #6b3159; }
.mahi .char-hair { left: 18px; width: 37px; height: 34px; background: #171318; }
.char-glasses { z-index: 5; left: 25px; top: 24px; width: 9px; height: 7px; border: 1px solid #d8bb76; border-radius: 2px; box-shadow: 11px 0 0 -1px #171318, 11px 0 0 0 #d8bb76; }
.char-glasses::after { content: ""; position: absolute; left: 8px; top: 2px; width: 4px; height: 1px; background: #d8bb76; }
.char-book { z-index: 5; right: 6px; top: 48px; width: 15px; height: 19px; border: 1px solid #d2aa5c; background: #462038; transform: rotate(-8deg); }
.lloyd .char-face { background: #d7a17b; }
.lloyd .char-body { background: #496238; }
.lloyd .char-hair { background: #c7a251; }
.char-pack { z-index: 0; left: 9px; top: 40px; width: 20px; height: 31px; border-radius: 9px 4px 4px 9px; background: #b35b2f; transform: rotate(5deg); }

.control-copy { margin: 0; color: #a9b2b2; font-size: .72rem; line-height: 1.5; }
.mobile-copy { display: none; }

#game-countdown { background: rgba(4, 12, 18, .25); }
.countdown-number { color: #fff4c9; font: italic 700 clamp(5rem, 14vw, 10rem) Georgia, serif; text-shadow: 0 0 45px #c99e53; animation: count-pop .75s ease both; }

#game-level-screen { background: linear-gradient(90deg, rgba(3,10,15,.83), rgba(29,19,48,.48), rgba(3,10,15,.83)); }
.level-panel { position: relative; padding: 2.5rem clamp(2rem,6vw,5rem); text-align: center; border-block: 1px solid rgba(214,176,95,.5); background: rgba(4,14,21,.7); box-shadow: 0 0 80px rgba(107,67,150,.3); backdrop-filter: blur(10px); }
.level-panel::before, .level-panel::after { content: "◆"; position: absolute; top: 50%; color: var(--gold); transform: translateY(-50%); }
.level-panel::before { left: .8rem; }
.level-panel::after { right: .8rem; }
.level-panel p { margin: 0 0 .5rem; color: var(--gold-light); font-size: .58rem; font-weight: 800; letter-spacing: .28em; }
.level-panel h2 { margin: 0; font: italic 400 clamp(2.4rem,6vw,5rem)/1 Georgia,serif; }
.level-panel span { display: block; margin-top: .75rem; color: #b6c1c2; font-size: .7rem; letter-spacing: .08em; }

.result-panel { width: min(570px, 100%); max-height: 100%; overflow-y: auto; overscroll-behavior: contain; }
.result-panel > p:not(.screen-kicker) { max-width: 430px; margin: 1rem auto 0; color: #aeb8b8; font: .95rem/1.7 Georgia, serif; }
.result-stats { display: flex; justify-content: center; gap: 3rem; margin: 1.2rem 0; }
.result-stats span { display: grid; gap: .25rem; }
.result-stats small { color: #7f8d90; font-size: .52rem; letter-spacing: .18em; text-transform: uppercase; }
.result-stats strong { color: var(--gold-light); font: 1.8rem Georgia, serif; }
.result-actions { display: flex; justify-content: center; align-items: center; gap: 1.4rem; }
.result-actions a { border-bottom: 1px solid rgba(255,255,255,.35); font-size: .7rem; }
.game-primary { min-height: 46px; padding: .75rem 1.35rem; border: 0; background: var(--gold); color: #10191e; font-size: .65rem; font-weight: 800; letter-spacing: .13em; text-transform: uppercase; cursor: pointer; }

.score-form { max-width: 470px; margin: 0 auto 1.25rem; padding: 1rem; border: 1px solid rgba(214,176,95,.27); background: rgba(255,255,255,.035); }
.score-form > label { display: block; margin-bottom: .6rem; color: #e7d7a3; font-size: .58rem; font-weight: 750; letter-spacing: .14em; text-transform: uppercase; }
.score-form > div { display: grid; grid-template-columns: 1fr auto; }
.score-form input { min-width: 0; padding: .7rem .8rem; border: 1px solid #526168; border-right: 0; border-radius: 0; outline: 0; background: rgba(0,0,0,.24); color: white; }
.score-form input:focus { border-color: var(--gold); }
.score-form button { padding: .7rem 1rem; border: 0; background: var(--gold); color: #0d181e; font-size: .58rem; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; cursor: pointer; }
.score-form button:disabled { opacity: .72; cursor: default; }
.score-form p { margin: .55rem 0 0; color: #7f8f92; font-size: .52rem; line-height: 1.4; }
.score-form.is-submitted { border-color: rgba(126,185,137,.5); }
.score-honeypot { position: absolute !important; left: -10000px !important; width: 1px !important; height: 1px !important; }

.tap-prompt {
  position: absolute;
  z-index: 4;
  left: 50%;
  bottom: 7%;
  display: grid;
  place-items: center;
  opacity: 0;
  pointer-events: none;
  transform: translateX(-50%);
  transition: opacity .3s;
  text-shadow: 0 2px 10px #000;
}
.tap-prompt.is-visible { opacity: 1; }
.tap-prompt span { width: 48px; height: 48px; display: grid; place-items: center; border: 1px solid rgba(255,255,255,.55); border-radius: 50%; background: rgba(5,15,22,.58); font-size: 1.35rem; animation: tap-bob 1.2s ease infinite; }
.tap-prompt b { margin-top: .45rem; font-size: .58rem; letter-spacing: .25em; }
.tap-prompt small { margin-top: .28rem; color: #d9dddd; font-size: .52rem; }

.game-status { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.game-utility { position: absolute; z-index: 10; right: 1rem; top: 1rem; display: flex; gap: .45rem; }
.game-utility button { width: 38px; height: 38px; display: grid; place-items: center; border: 1px solid rgba(255,255,255,.28); border-radius: 50%; background: rgba(4,14,21,.65); color: white; cursor: pointer; backdrop-filter: blur(8px); }
.game-utility button:disabled { opacity: .35; cursor: default; }

.game-mobile-note { display: none; align-items: center; justify-content: center; gap: .8rem; padding: .8rem 1rem; background: #07131b; color: #87959a; }
.game-mobile-note span { color: var(--gold); font-size: 1.5rem; }
.game-mobile-note p { margin: 0; font-size: .65rem; line-height: 1.4; }
.game-mobile-note strong { color: #e8e7df; }
.game-noscript { padding: 1rem; text-align: center; color: var(--gold-light); }

.game-how-to {
  width: min(1120px, 100%);
  margin: 3.2rem auto 0;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  border-top: 1px solid rgba(255,255,255,.12);
}
.game-how-to > div { position: relative; padding: 2rem 2rem 0; border-right: 1px solid rgba(255,255,255,.12); }
.game-how-to > div:last-child { border-right: 0; }
.game-how-to span { color: var(--gold); font: italic .9rem Georgia, serif; }
.game-how-to h2 { margin: .55rem 0; font: 400 1.3rem Georgia, serif; }
.game-how-to p { margin: 0; color: #7e8d91; font-size: .74rem; line-height: 1.65; }

.game-leaderboard { width: min(1120px,100%); margin: 5rem auto 0; display: grid; grid-template-columns: .75fr 1.25fr; gap: clamp(2rem,6vw,5rem); align-items: start; }
.leaderboard-heading h2 { margin: 0; font: 400 clamp(2.5rem,4.5vw,4.4rem)/.98 Georgia,serif; letter-spacing: -.035em; }
.leaderboard-heading > p:last-child { max-width: 390px; margin: 1.1rem 0 0; color: #849297; font-size: .76rem; line-height: 1.7; }
.leaderboard-table-wrap { overflow-x: auto; border: 1px solid rgba(214,176,95,.3); background: rgba(5,15,22,.66); box-shadow: 0 25px 55px rgba(0,0,0,.25); }
.game-leaderboard table { width: 100%; border-collapse: collapse; min-width: 520px; }
.game-leaderboard th, .game-leaderboard td { padding: 1rem 1.1rem; text-align: left; border-bottom: 1px solid rgba(255,255,255,.09); }
.game-leaderboard th { color: #718187; background: rgba(255,255,255,.025); font-size: .5rem; letter-spacing: .16em; text-transform: uppercase; }
.game-leaderboard td { color: #c7d0cf; font-size: .73rem; }
.game-leaderboard td:first-child b { width: 26px; height: 26px; display: grid; place-items: center; border: 1px solid rgba(214,176,95,.45); border-radius: 50%; color: var(--gold-light); font: italic .75rem Georgia,serif; }
.game-leaderboard td:nth-child(2) { color: #f4efe4; font-family: Georgia,serif; font-size: .88rem; }
.game-leaderboard td:nth-child(4) { color: var(--gold-light); font-weight: 800; }
.game-leaderboard tbody tr:last-child td { border-bottom: 0; }
.game-leaderboard tbody tr:first-child { background: linear-gradient(90deg,rgba(214,176,95,.1),transparent); }
.game-leaderboard .leaderboard-empty td { padding: 2rem; text-align: center; color: #839195; font-family: inherit; font-size: .72rem; }

@keyframes count-pop { 0% { opacity: 0; transform: scale(1.45); } 35% { opacity: 1; } 100% { opacity: 0; transform: scale(.75); } }
@keyframes tap-bob { 50% { transform: translateY(-7px); } }

@media (max-width: 980px) {
  .game-hud { grid-template-columns: 110px 100px 1fr 75px; gap: .8rem; padding-inline: .9rem; }
  .hud-label { font-size: .43rem; }
  .character-grid { gap: .4rem; }
}

@media (hover: none), (pointer: coarse) {
  .mobile-copy { display: inline; }
  .desktop-copy { display: none; }
}

@media (max-width: 720px) {
  .game-page { padding: 8.5rem 0 4rem; }
  .game-page-intro { padding-inline: 1.1rem; margin-bottom: 1.5rem; }
  .game-page-intro h1 { font-size: clamp(2.45rem, 12vw, 4rem); }
  .timeline-game { border-left: 0; border-right: 0; }
  .game-hud { min-height: 59px; grid-template-columns: 1fr 1fr 1.5fr; }
  .hud-hero { display: none; }
  .hud-score { text-align: right; }
  .hud-progress .hud-label b:first-child { display: none; }
  .character-grid { grid-template-columns: repeat(2, 1fr); margin-block: 1rem; }
  .character-card { padding: .4rem; }
  .character-portrait { height: 62px; transform: scale(.78); margin-block: -8px; }
  .character-card strong { margin-top: 0; }
  .character-card small { font-size: .46rem; }
  .screen-panel { padding: 1rem; }
  #game-result { padding: .5rem; }
  .result-panel > p:not(.screen-kicker) { margin-top: .6rem; font-size: .78rem; line-height: 1.45; }
  .result-stats { margin: .7rem 0; gap: 1.5rem; }
  .result-stats strong { font-size: 1.35rem; }
  .score-form { margin-bottom: .75rem; padding: .65rem; }
  .score-form > div { grid-template-columns: 1fr; }
  .score-form input { border-right: 1px solid #526168; }
  .result-actions { gap: .8rem; }
  .screen-panel h2 { font-size: 1.75rem; }
  .screen-kicker { font-size: .48rem; }
  .control-copy { font-size: .58rem; }
  .tap-prompt small { display: none; }
  .game-mobile-note { display: flex; }
  .game-leaderboard { grid-template-columns: 1fr; padding-inline: 1rem; margin-top: 3.5rem; }
  .leaderboard-heading { text-align: center; }
  .leaderboard-heading > p:last-child { margin-inline: auto; }
  .game-how-to { padding-inline: 1rem; }
  .game-how-to > div { padding: 1.4rem .8rem 0; }
  .game-how-to p { font-size: .65rem; }
}

@media (max-width: 720px) and (orientation: portrait) {
  .game-stage { aspect-ratio: 4 / 3; }
  #game-canvas { object-fit: cover; }
}

@media (max-height: 520px) and (orientation: landscape) {
  .announcement { display: none; }
  .site-header { position: absolute; top: 0; padding-block: .65rem; }
  .game-page { padding: 5.2rem 0 1.5rem; }
  .game-page-intro { display: none; }
  .game-hud { min-height: 48px; padding-block: .45rem; }
  .timeline-game { width: min(118vh, 100%); }
  .screen-panel { padding: .8rem 1.1rem; }
  .screen-panel h2 { font-size: 1.55rem; }
  .character-grid { margin: .6rem 0; }
  .character-portrait { height: 56px; transform: scale(.7); margin-block: -12px; }
  .character-card { padding: .3rem; }
  .game-mobile-note, .game-how-to, .site-footer { display: none; }
  .game-leaderboard { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  .countdown-number, .tap-prompt span { animation: none; }
}

/* Version 2 — Book One journey */
.game-hud { grid-template-columns: 120px 105px minmax(260px,1fr) 90px 95px; }
.hud-score small { color: #e7c76e; font-size: .55rem; }
.hud-shards { text-align: right; }
.hud-shards strong { white-space: nowrap; }
.hud-shards i { color: #ffe08a; font-style: normal; }

.ability-hud { display: grid; grid-template-columns: auto minmax(80px,180px) auto; align-items: center; gap: .65rem; padding: .55rem 1.3rem; border-bottom: 1px solid rgba(255,255,255,.08); background: #07131b; color: #819096; font-size: .49rem; letter-spacing: .14em; }
.ability-hud > i, .boss-hud > i { height: 5px; display: block; overflow: hidden; background: #28363c; }
.ability-hud b, .boss-hud b { display: block; width: 0; height: 100%; background: linear-gradient(90deg,#8063c7,#f1d17c); box-shadow: 0 0 14px rgba(241,209,124,.55); transition: width .2s linear; }
.ability-hud em { opacity: 0; color: #ffe59f; font-style: normal; transition: opacity .2s; }
.ability-hud.is-ready em { opacity: 1; animation: ability-pulse 1.1s ease-in-out infinite; }
.boss-hud { position: absolute; z-index: 12; left: 50%; top: 1rem; width: min(430px,58%); display: grid; grid-template-columns: auto 1fr; align-items: center; gap: .8rem; padding: .65rem .9rem; border: 1px solid rgba(187,67,122,.55); background: rgba(15,6,17,.8); backdrop-filter: blur(10px); transform: translateX(-50%); }
.boss-hud span { color: #f0c5d8; font: .7rem Georgia,serif; letter-spacing: .2em; }
.boss-hud b { width: 100%; background: linear-gradient(90deg,#7f214f,#d85782); }

.setup-panel { width: min(980px,100%); max-height: 100%; overflow-y: auto; text-align: left; }
.setup-top { display: flex; align-items: start; justify-content: space-between; gap: 1rem; }
.language-toggle { flex: 0 0 auto; padding: .55rem .7rem; border: 1px solid rgba(214,176,95,.55); background: transparent; color: #f0d589; font-size: .57rem; font-weight: 800; letter-spacing: .12em; cursor: pointer; }
.setup-panel .character-grid { margin: 1.3rem 0; }
.character-card.is-selected { border-color: #e4c16e; background: rgba(214,176,95,.16); box-shadow: inset 0 0 0 1px rgba(214,176,95,.35),0 14px 30px rgba(0,0,0,.28); transform: translateY(-4px); }
.setup-options { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.setup-options fieldset { min-width: 0; margin: 0; padding: .75rem; border: 1px solid rgba(255,255,255,.13); }
.setup-options legend { padding-inline: .4rem; color: #8b999c; font-size: .48rem; letter-spacing: .18em; }
.choice-row { display: grid; grid-template-columns: repeat(3,1fr); gap: .35rem; }
.choice-row button { min-width: 0; padding: .6rem .35rem; border: 1px solid rgba(255,255,255,.15); background: rgba(255,255,255,.035); color: #aeb9b9; font-size: .56rem; cursor: pointer; }
.choice-row button.is-selected { border-color: #d8b563; background: rgba(214,176,95,.16); color: #ffe7a4; }
.accessibility-settings { margin: .85rem 0; border: 1px solid rgba(255,255,255,.12); }
.accessibility-settings summary { padding: .7rem .8rem; color: #a9b5b5; font-size: .52rem; letter-spacing: .15em; cursor: pointer; }
.accessibility-settings > div { display: grid; grid-template-columns: repeat(3,1fr); gap: .65rem; padding: 0 .8rem .8rem; }
.accessibility-settings label { color: #839195; font-size: .58rem; }
.accessibility-settings input { accent-color: #d6b05f; }
.game-start { width: 100%; }
.game-secondary { min-height: 44px; padding: .7rem 1rem; border: 1px solid rgba(214,176,95,.55); background: transparent; color: #f0d589; font-size: .61rem; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; cursor: pointer; }

.game-controls { position: absolute; z-index: 11; inset: auto 1rem 1rem; display: flex; justify-content: space-between; opacity: 0; visibility: hidden; pointer-events: none; transition: opacity .2s ease,visibility .2s ease; }
.timeline-game.is-running .game-controls { opacity: 1; visibility: visible; }
.game-controls button { width: 64px; height: 64px; display: grid; place-items: center; align-content: center; border: 1px solid rgba(255,255,255,.35); border-radius: 50%; background: rgba(4,14,21,.62); color: white; cursor: pointer; pointer-events: auto; backdrop-filter: blur(8px); }
.game-controls button span { font-size: 1.2rem; line-height: 1; }
.game-controls button small { margin-top: .22rem; font-size: .43rem; letter-spacing: .12em; }
.game-controls #game-ability { border-color: rgba(214,176,95,.62); color: #f3d98f; }
.game-controls #game-ability:disabled { opacity: .38; }
.game-controls #game-ability.is-ready { animation: control-ready 1.2s ease-in-out infinite; }

.timeline-game.is-shaking .game-stage { animation: stage-shake .28s linear; }
.timeline-game.high-contrast #game-canvas { filter: contrast(1.18) saturate(1.16); }
.timeline-game.large-ui .game-controls button { width: 82px; height: 82px; }
.timeline-game.large-ui .game-utility button { width: 46px; height: 46px; }
.timeline-game.reduced-motion *, .timeline-game.reduced-motion *::before, .timeline-game.reduced-motion *::after { animation: none !important; transition: none !important; }

.game-meta-grid { width: min(1280px,100%); margin: 5rem auto 0; display: grid; grid-template-columns: 1.45fr .55fr; gap: clamp(2rem,5vw,5rem); }
.meta-heading h2 { margin: 0; font: 400 clamp(2.2rem,4vw,4rem)/1 Georgia,serif; }
.meta-heading > p:last-child { margin: .8rem 0 1.8rem; color: #819095; font-size: .74rem; }
.lore-grid { display: grid; grid-template-columns: 1fr 1fr; border: 1px solid rgba(255,255,255,.11); }
.lore-grid article { position: relative; min-height: 150px; display: grid; grid-template-columns: 32px 1fr; gap: .8rem; padding: 1.25rem; border-right: 1px solid rgba(255,255,255,.1); border-bottom: 1px solid rgba(255,255,255,.1); opacity: .38; filter: grayscale(1); }
.lore-grid article:nth-child(even) { border-right: 0; }
.lore-grid article.is-unlocked { opacity: 1; filter: none; background: linear-gradient(135deg,rgba(214,176,95,.08),transparent 58%); }
.lore-grid article > span { color: #d1af61; font: italic .72rem Georgia,serif; }
.lore-grid h3 { margin: 0; color: #f0eadf; font: 1.05rem Georgia,serif; }
.lore-grid small { display: block; margin-top: .2rem; color: #b69354; font-size: .52rem; letter-spacing: .08em; text-transform: uppercase; }
.lore-grid p { margin: .65rem 0 0; color: #829094; font-size: .68rem; line-height: 1.55; }
.lore-grid article > i { position: absolute; right: .8rem; top: .7rem; color: #657278; font-style: normal; }
.lore-grid article.is-unlocked > i { color: #ebcb77; }
.achievement-list { display: grid; gap: .55rem; margin: 1.8rem 0; }
.achievement-item { display: grid; grid-template-columns: 35px 1fr; gap: .7rem; padding: .8rem; border: 1px solid rgba(255,255,255,.1); opacity: .42; }
.achievement-item.is-earned { opacity: 1; border-color: rgba(214,176,95,.38); background: rgba(214,176,95,.06); }
.achievement-item > span { width: 34px; height: 34px; display: grid; place-items: center; border-radius: 50%; background: #13242c; color: #d6b05f; }
.achievement-item h3 { margin: 0; font: .88rem Georgia,serif; }
.achievement-item p { margin: .25rem 0 0; color: #77878b; font-size: .57rem; line-height: 1.4; }
.challenge-card { padding: 1.15rem; border: 1px solid rgba(122,91,170,.45); background: linear-gradient(135deg,rgba(104,67,156,.17),rgba(214,176,95,.05)); }
.challenge-card > span { color: #bda6de; font-size: .47rem; letter-spacing: .18em; }
.challenge-card h3 { margin: .55rem 0 .8rem; font: 1.05rem Georgia,serif; }
.challenge-card > i { height: 5px; display: block; background: #28333a; }
.challenge-card > i b { display: block; width: 0; height: 100%; background: linear-gradient(90deg,#7958bd,#d9b961); }
.challenge-card p { margin: .5rem 0 0; color: #869499; font-size: .58rem; }

.leaderboard-filters { display: grid; grid-template-columns: repeat(4,1fr); gap: .45rem; margin-bottom: .65rem; }
.leaderboard-filters select { min-width: 0; padding: .65rem .7rem; border: 1px solid rgba(255,255,255,.15); border-radius: 0; background: #0b1b25; color: #cbd2d0; font-size: .59rem; }
.game-leaderboard table { min-width: 690px; }

@keyframes ability-pulse { 50% { opacity: .4; } }
@keyframes control-ready { 50% { box-shadow: 0 0 30px rgba(235,200,107,.55); transform: scale(1.06); } }
@keyframes stage-shake { 20% { transform: translate(-5px,2px); } 40% { transform: translate(5px,-2px); } 60% { transform: translate(-3px,1px); } 80% { transform: translate(3px,-1px); } }

@media (max-width: 1100px) {
  .game-hud { grid-template-columns: 90px 86px minmax(190px,1fr) 74px 78px; gap: .65rem; }
  .game-meta-grid { padding-inline: 1rem; }
}

@media (max-width: 720px) {
  .game-hud { grid-template-columns: 70px 1fr 60px 67px; }
  .hud-hero { display: none; }
  .hud-shards { display: grid; }
  .hud-progress .hud-label b:first-child { display: block; max-width: 160px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .ability-hud { grid-template-columns: 70px 1fr 43px; padding-inline: .75rem; }
  .setup-panel { padding: .8rem; }
  .setup-top h2 { font-size: 1.5rem; }
  .setup-panel .character-grid { grid-template-columns: repeat(4,1fr); }
  .setup-panel .character-portrait { display: none; }
  .setup-panel .character-card { padding: .65rem .25rem; }
  .setup-panel .character-card small { display: none; }
  .setup-options { grid-template-columns: 1fr; }
  .accessibility-settings > div { grid-template-columns: 1fr 1fr; }
  .game-controls { inset: auto .55rem .55rem; }
  .game-controls button { width: 54px; height: 54px; }
  .game-meta-grid { grid-template-columns: 1fr; margin-top: 3.5rem; }
  .lore-grid { grid-template-columns: 1fr; }
  .lore-grid article { border-right: 0; }
  .leaderboard-filters { grid-template-columns: 1fr 1fr; }
}

@media (max-height: 560px) and (orientation: landscape) {
  .setup-panel .character-portrait { display: none; }
  .setup-panel .character-grid { grid-template-columns: repeat(4,1fr); margin: .45rem 0; }
  .setup-options { grid-template-columns: 1fr 1fr; }
  .accessibility-settings { display: none; }
  .setup-panel .control-copy { display: none; }
  .game-start { min-height: 38px; padding: .5rem; }
}

/* Version 2.1 — mobile-first play */
.game-install { margin: 1rem auto 0; padding: .7rem 1rem; border: 1px solid rgba(214,176,95,.55); background: rgba(214,176,95,.09); color: #f2d884; font-size: .6rem; font-weight: 800; letter-spacing: .11em; text-transform: uppercase; cursor: pointer; }
.game-install span:first-child { display: inline-grid; place-items: center; width: 22px; height: 22px; margin-right: .35rem; border: 1px solid currentColor; border-radius: 50%; }
.resume-run { display: grid; grid-template-columns: 1fr auto auto; align-items: center; gap: .65rem; margin: .8rem 0; padding: .7rem; border: 1px solid rgba(214,176,95,.38); background: linear-gradient(90deg,rgba(214,176,95,.1),rgba(109,70,159,.08)); }
.resume-run[hidden] { display: none; }
.resume-run > div { display: grid; gap: .2rem; }
.resume-run strong { color: #f0d58b; font: .82rem Georgia,serif; }
.resume-run small { color: #91a0a2; font-size: .54rem; }
.resume-run button { min-height: 36px; padding: .5rem .7rem; border: 1px solid rgba(214,176,95,.5); background: #d6b05f; color: #0b171d; font-size: .52rem; font-weight: 800; text-transform: uppercase; cursor: pointer; }
.resume-run button:last-child { width: 36px; padding: 0; background: transparent; color: #d8c9aa; }
.accessibility-settings .setting-select { display: grid; gap: .3rem; }
.accessibility-settings select { width: 100%; min-height: 32px; padding: .35rem; border: 1px solid rgba(255,255,255,.16); border-radius: 0; background: #0a1921; color: #d6dedd; font-size: .55rem; }
.tutorial-replay { min-height: 34px; align-self: end; padding: .45rem .65rem; border: 1px solid rgba(214,176,95,.45); background: transparent; color: #e2c678; font-size: .51rem; cursor: pointer; }

.game-tutorial { position: absolute; z-index: 13; left: 50%; top: 22%; width: min(390px,calc(100% - 2rem)); padding: .8rem 1rem; display: grid; gap: .18rem; text-align: center; border: 1px solid rgba(240,211,128,.58); background: rgba(4,14,21,.88); box-shadow: 0 18px 50px rgba(0,0,0,.35); backdrop-filter: blur(10px); transform: translateX(-50%); pointer-events: none; }
.game-tutorial[hidden] { display: none; }
.game-tutorial span { color: #a28acf; font-size: .46rem; letter-spacing: .18em; }
.game-tutorial strong { color: #f4df9e; font: 1.05rem Georgia,serif; }
.game-tutorial small { color: #9dacaf; font-size: .58rem; }
.quick-restart-hint { color: #d3bb79 !important; font-size: .58rem !important; letter-spacing: .04em; }

.game-controls { padding-bottom: env(safe-area-inset-bottom,0); }
.game-controls button { pointer-events: auto; touch-action: none; -webkit-tap-highlight-color: transparent; }
.game-controls #game-jump { width: 70px; height: 70px; border-color: rgba(232,204,120,.7); background: rgba(27,47,54,.82); }
.game-controls #game-jump span { font-size: 1.5rem; }
.controls-right .game-controls { left: auto; width: min(245px,70%); gap: .45rem; justify-content: flex-end; }
.controls-left .game-controls { right: auto; width: min(245px,70%); gap: .45rem; justify-content: flex-start; flex-direction: row-reverse; }
.controls-anywhere #game-jump { opacity: .78; }

.performance-mode .game-stage::after { box-shadow: inset 0 0 45px rgba(2,8,12,.4); }
.performance-mode .screen-panel,
.performance-mode .boss-hud,
.performance-mode .game-tutorial { backdrop-filter: none; }
.performance-mode .character-card,
.performance-mode .progress-track i,
.performance-mode .ability-hud b { box-shadow: none; }

@supports (padding: max(0px)) {
  .game-utility { right: max(1rem,env(safe-area-inset-right)); }
  .game-controls { left: max(1rem,env(safe-area-inset-left)); right: max(1rem,env(safe-area-inset-right)); bottom: max(1rem,env(safe-area-inset-bottom)); }
}

@media (max-width: 900px) and (orientation: portrait) {
  .game-page { padding-top: max(7rem,calc(5.8rem + env(safe-area-inset-top))); }
  .game-stage { aspect-ratio: 9 / 14; max-height: calc(100svh - 120px); min-height: 600px; }
  #game-canvas { object-fit: fill; }
  .game-hud { grid-template-columns: 68px minmax(100px,1fr) 58px 60px; gap: .4rem; padding: .65rem .55rem; }
  .hud-hero { display: none; }
  .hud-progress .hud-label b:first-child { max-width: 115px; }
  .ability-hud { padding-inline: .65rem; }
  .boss-hud { top: .55rem; width: calc(100% - 8.5rem); }
  .game-screen { align-items: start; padding: .55rem; overflow-y: auto; overscroll-behavior: contain; }
  .setup-panel { margin-block: .25rem; }
  .setup-top h2 { font-size: 1.4rem; }
  .setup-panel .character-grid { grid-template-columns: repeat(2,1fr); margin: .65rem 0; }
  .setup-panel .character-card { min-height: 55px; }
  .setup-options { gap: .45rem; }
  .setup-options fieldset { padding: .45rem; }
  .choice-row button { padding: .5rem .2rem; }
  .accessibility-settings { margin: .5rem 0; }
  .accessibility-settings > div { grid-template-columns: 1fr 1fr; }
  .game-start { min-height: 40px; padding: .55rem; }
  .control-copy { margin-top: .35rem; }
  .game-tutorial { top: 16%; }
  .game-utility { top: .55rem; right: .55rem; }
  .game-utility button { width: 34px; height: 34px; }
  .game-controls button { width: 62px; height: 62px; }
  .game-controls #game-jump { width: 78px; height: 78px; }
  .result-panel { margin-block: auto; }
}

@media (max-width: 430px) and (orientation: portrait) {
  .game-stage { min-height: 560px; max-height: none; }
  .setup-panel .character-portrait { display: none; }
  .accessibility-settings > div { grid-template-columns: 1fr; }
  .resume-run { grid-template-columns: 1fr auto; }
  .resume-run button:last-child { grid-column: 2; grid-row: 1; }
  .resume-run button:nth-child(2) { grid-column: 1 / -1; }
}

@media (display-mode: standalone), (display-mode: fullscreen) {
  .announcement,.site-header,.game-page-intro,.site-footer { display: none; }
  .game-page { padding: env(safe-area-inset-top) 0 env(safe-area-inset-bottom); }
  .timeline-game { width: 100%; min-height: 100svh; border: 0; }
}

/* Version 2.1.1 — clear play area and mobile leaderboard cards */
@media (max-width: 900px), (hover: none) and (pointer: coarse) {
  .timeline-game.is-running .game-stage {
    margin-bottom: calc(84px + env(safe-area-inset-bottom,0px));
    overflow: visible;
  }

  .timeline-game.is-running .game-controls,
  .timeline-game.is-running.controls-left .game-controls,
  .timeline-game.is-running.controls-right .game-controls {
    inset: auto 0 calc(-84px - env(safe-area-inset-bottom,0px)) !important;
    width: 100% !important;
    min-height: calc(84px + env(safe-area-inset-bottom,0px));
    padding: 8px max(14px,env(safe-area-inset-right)) max(8px,env(safe-area-inset-bottom)) max(14px,env(safe-area-inset-left));
    justify-content: center;
    gap: clamp(1.2rem,8vw,3.5rem);
    border-top: 1px solid rgba(214,176,95,.28);
    border-bottom: 1px solid rgba(255,255,255,.08);
    background: linear-gradient(180deg,#0b1a22,#061016);
    box-shadow: 0 16px 30px rgba(0,0,0,.28);
    transform: none;
  }

  .timeline-game.is-running.controls-right .game-controls { justify-content: flex-end; }
  .timeline-game.is-running.controls-left .game-controls { justify-content: flex-start; flex-direction: row-reverse; }
  .timeline-game.is-running .game-controls button,
  .timeline-game.is-running .game-controls #game-jump { width: 58px; height: 58px; }
  .timeline-game.is-running .game-controls #game-jump { width: 66px; height: 66px; }
}

@media (max-width: 720px) {
  .game-leaderboard { gap: 1.5rem; }
  .game-leaderboard > div { min-width: 0; }
  .leaderboard-filters { grid-template-columns: 1fr 1fr; gap: .6rem; }
  .leaderboard-filters select { min-height: 44px; font-size: .65rem; }
  .leaderboard-table-wrap { overflow: visible; border: 0; background: transparent; box-shadow: none; }
  .game-leaderboard table { min-width: 0; border-collapse: separate; }
  .game-leaderboard thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
  .game-leaderboard tbody { display: grid; gap: .8rem; }
  .game-leaderboard tbody tr { display: grid; grid-template-columns: 52px minmax(0,1fr) minmax(0,1fr); padding: .75rem; border: 1px solid rgba(214,176,95,.26); background: linear-gradient(135deg,rgba(10,28,37,.96),rgba(7,17,24,.96)); box-shadow: 0 12px 28px rgba(0,0,0,.2); }
  .game-leaderboard tbody tr:first-child { border-color: rgba(214,176,95,.58); background: linear-gradient(135deg,rgba(214,176,95,.13),rgba(8,20,28,.98) 55%); }
  .game-leaderboard td { min-width: 0; padding: .55rem .65rem; display: grid; align-content: center; gap: .18rem; border: 0; border-bottom: 1px solid rgba(255,255,255,.07); color: #d5dddc; font-size: .73rem; overflow-wrap: anywhere; }
  .game-leaderboard td::before { content: attr(data-label); color: #73858a; font-size: .43rem; font-weight: 750; letter-spacing: .14em; text-transform: uppercase; }
  .game-leaderboard td:first-child { grid-column: 1; grid-row: 1 / 4; place-items: center; padding-inline: .25rem .65rem; border-right: 1px solid rgba(255,255,255,.08); border-bottom: 0; }
  .game-leaderboard td:first-child::before { align-self: end; }
  .game-leaderboard td:first-child b { margin: 0; }
  .game-leaderboard td:nth-child(2) { grid-column: 2 / 4; grid-row: 1; font-size: 1rem; }
  .game-leaderboard td:nth-child(3) { grid-column: 2; grid-row: 2; }
  .game-leaderboard td:nth-child(4) { grid-column: 3; grid-row: 2; }
  .game-leaderboard td:nth-child(5) { grid-column: 2; grid-row: 3; color: #f0d27d; font-size: .86rem; border-bottom: 0; }
  .game-leaderboard td:nth-child(6) { grid-column: 3; grid-row: 3; border-bottom: 0; }
  .game-leaderboard .leaderboard-empty { display: block; }
  .game-leaderboard .leaderboard-empty td { display: block; padding: 1.5rem; border: 0; }
  .game-leaderboard .leaderboard-empty td::before { display: none; }
}

@media (max-width: 480px) {
  .leaderboard-filters { grid-template-columns: 1fr; }
}
