:root {
  color-scheme: light;
  --paper: #faf2e2;
  --ink: #321b16;
  --field: #25120e;
  --light: #fff0d4;
  --orange: #ffb677;
  --edge: #b76745;
  --gutter: clamp(14px, 3.2vw, 55px);
  font-family: system-ui, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; background: var(--paper); color: var(--ink); }
button, a { -webkit-tap-highlight-color: transparent; }
button { font: inherit; cursor: pointer; }
button:focus-visible, a:focus-visible { outline: 2px solid currentColor; outline-offset: 4px; }
a { color: inherit; text-underline-offset: .2em; }
.frame {
  width: min(1510px, calc(100% - var(--gutter) * 2 - env(safe-area-inset-left) - env(safe-area-inset-right)));
  margin-inline: auto;
}
#game {
  --hud-top: max(clamp(10px, 2.4vh, 23px), env(safe-area-inset-top));
  --hud-left: max(clamp(11px, 1.7vw, 25px), env(safe-area-inset-left));
  --hud-right: max(clamp(11px, 1.7vw, 25px), env(safe-area-inset-right));
  --field-bottom: max(18px, calc(env(safe-area-inset-bottom) + 10px));
  position: relative;
  isolation: isolate;
  height: 100vh;
  height: 100dvh;
  background: var(--field);
  color: var(--light);
  overflow: hidden;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
  outline: none;
}
html.game-expanded, html.game-expanded body { overflow: hidden; overscroll-behavior: none; }
#game:is(:fullscreen, .expanded) {
  width: 100%;
  height: 100%;
  min-height: 0;
  max-height: none;
  margin: 0;
  border: 0;
}
#game.expanded { position: fixed; inset: 0; height: 100dvh; z-index: 20; }
#game:focus-visible::after {
  content: "";
  position: absolute;
  inset: 3px;
  border: 2px solid #ffd1a0;
  pointer-events: none;
  z-index: 8;
}
#game canvas { display: block; width: 100%; height: 100%; }
#game[data-flight="active"] canvas, #game[data-flight="practice"] canvas { touch-action: none; }
.hud {
  position: absolute;
  z-index: 4;
  top: var(--hud-top);
  left: var(--hud-left);
  right: var(--hud-right);
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  pointer-events: none;
}
.telemetry {
  display: inline-flex;
  align-items: baseline;
  gap: 10px;
  color: #ffe3c3;
  background: #2a1411;
  border: 1px solid #a55b3d;
  padding: .62rem .8rem;
  min-height: 44px;
  font-size: .875rem;
  font-weight: 600;
  white-space: nowrap;
}
.telemetry strong { font: 800 1.18rem/1 system-ui, sans-serif; font-variant-numeric: tabular-nums; color: #fff3de; }
#hud-best { color: #ffbd80; }
.tools { display: flex; gap: 6px; pointer-events: auto; margin-left: auto; }
.tool {
  display: grid;
  place-items: center;
  min-width: 46px;
  height: 46px;
  border: 1px solid #a3553d;
  background: #2a1411;
  color: var(--light);
  padding: .35rem;
  font-weight: 700;
}
.tool:hover, .options button:hover { background: #723622; }
.checkpoint { padding-inline: .62rem; font-size: .875rem; }
.icon { display: block; }
.fullscreen {
  position: absolute;
  top: var(--hud-top);
  right: calc(var(--hud-right) + 52px);
  z-index: 6;
}
#game[data-flight="active"] .fullscreen { right: calc(var(--hud-right) + 104px); }
#game[data-flight="practice"] .fullscreen { top: calc(var(--hud-top) + 52px); right: var(--hud-right); }
.fullscreen-icon { position: relative; width: 17px; height: 17px; }
.fullscreen-icon i { position: absolute; width: 6px; height: 6px; border: 0 solid currentColor; }
.fullscreen-icon i:nth-child(1) { top: 0; left: 0; border-top-width: 2px; border-left-width: 2px; }
.fullscreen-icon i:nth-child(2) { top: 0; right: 0; border-top-width: 2px; border-right-width: 2px; }
.fullscreen-icon i:nth-child(3) { bottom: 0; left: 0; border-bottom-width: 2px; border-left-width: 2px; }
.fullscreen-icon i:nth-child(4) { bottom: 0; right: 0; border-bottom-width: 2px; border-right-width: 2px; }
.fullscreen[aria-pressed="true"] i { transform: rotate(180deg); }
.pause-icon {
  width: 13px;
  height: 16px;
  border-inline: 4px solid currentColor;
}
.settings-icon { display: grid; gap: 3px; }
.settings-icon i { width: 18px; height: 2px; position: relative; background: currentColor; }
.settings-icon i::after {
  position: absolute; content: ""; left: 3px; top: -1px; width: 4px; height: 4px; background: currentColor;
}
.settings-icon i:nth-child(2)::after { left: 11px; }
.settings-icon i:nth-child(3)::after { left: 6px; }

.menu-overlay {
  position: absolute;
  inset: 0;
  z-index: 1;
  display: grid;
  align-items: end;
  padding: 0 max(clamp(20px, 5vw, 90px), env(safe-area-inset-right))
    max(clamp(27px, 6dvh, 64px), env(safe-area-inset-bottom)) max(clamp(20px, 5vw, 90px), env(safe-area-inset-left));
  background: linear-gradient(0deg, #1b0d0afd 0%, #21100de8 13%, #21100d8c 28%, transparent 52%);
  pointer-events: none;
}
.poster-caption {
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: 18px 34px;
  border-top: 1px solid #ffbd797f;
  padding-top: clamp(14px, 2.5dvh, 30px);
}
.poster-name { min-width: 0; }
.poster-name p {
  margin: 0 0 .4rem;
  color: #ffc287;
  font: italic 1.2rem/1.1 Georgia, serif;
}
.poster-name h1 {
  margin: 0;
  color: #fff1d8;
  font: 700 clamp(3rem, 9.3vw, 9.2rem)/.82 Georgia, serif;
  letter-spacing: -.075em;
  text-wrap: balance;
}
.poster-name h1 span {
  display: block;
  margin-top: .55rem;
  font: 650 clamp(.9rem, 2vw, 1.25rem)/1.2 system-ui, sans-serif;
  letter-spacing: normal;
}
.poster-entry { padding-bottom: .12rem; }
.poster-entry p { margin: 0 0 .7rem; color: #ffe7c9; }
.actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.primary, .secondary {
  pointer-events: auto;
  min-height: 49px;
  min-width: 60px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: .65rem 1rem;
  line-height: 1.15;
  font-weight: 790;
  text-align: center;
}
.primary {
  background: var(--orange);
  border: 1px solid #ffd1a0;
  box-shadow: inset 0 -3px 0 #d3744e;
  color: #28120d;
}
.primary:hover { background: #ffce9d; }
.primary:focus-visible { outline-color: #fff0d4; }
.secondary { background: #301812; border: 1px solid #bd7958; color: #ffe6c8; }
.secondary:hover { background: #66311f; }
.actions button:active, .tool:active { transform: translateY(1px); }
.menu-overlay .primary { min-width: 120px; }
.play-icon {
  width: 0;
  height: 0;
  border-block: 6px solid transparent;
  border-left: 9px solid currentColor;
}
.course-track {
  position: absolute;
  inset: auto 0 0;
  height: 5px;
  background: #401d15;
  border-top: 1px solid #e29b6777;
  pointer-events: none;
}
#game[data-mode="menu"] .course-track { display: none; }
.course-track span {
  display: block;
  width: 100%;
  height: 100%;
  transform: scaleX(var(--progress, 0));
  transform-origin: left center;
  background: #ffc286;
}
.course-track[data-course="true"]::after {
  content: "";
  position: absolute;
  inset: -2px 0 0;
  background: repeating-linear-gradient(90deg, transparent 0 calc(12.5% - 1px), #fff0c8 0 12.5%);
}
.course-track[data-course="true"]::before {
  content: "";
  position: absolute;
  bottom: 0;
  left: var(--first-gate);
  z-index: 1;
  width: 2px;
  height: 7px;
  background: #fff0c8;
}
#best-marker {
  position: absolute;
  z-index: 1;
  width: 3px;
  height: 10px;
  bottom: 0;
  background: #87ddce;
  box-shadow: 0 0 0 1px #351713;
}
.flight-note {
  position: absolute;
  display: flex;
  gap: .5rem .75rem;
  align-items: baseline;
  bottom: var(--field-bottom);
  left: 50%;
  transform: translateX(-50%);
  max-width: calc(100% - var(--hud-left) - var(--hud-right));
  width: max-content;
  padding: .62rem .8rem;
  background: #24120fed;
  border-inline-start: 3px solid #ea8d5d;
  color: #ffe2c0;
  font-size: .9rem;
  line-height: 1.3;
  pointer-events: none;
}
.flight-note strong { flex-shrink: 0; color: #fff3d5; }
.flight-note:is([data-kind="opening"], [data-kind="section"], [data-kind="rhythm"]) { border-color: #83d2c3; }
.flight-note:is([data-kind="opening"], [data-kind="section"], [data-kind="rhythm"]) strong { color: #b6ecdf; }
.beat-pips { display: none; gap: 4px; align-self: center; }
.beat-pips i { width: .43rem; height: .43rem; border: 1px solid #83d2c3; transform: rotate(45deg); }
[data-kind="rhythm"] .beat-pips { display: flex; }
[data-beat="0"] .beat-pips i:nth-child(1),
[data-beat="1"] .beat-pips i:nth-child(2),
[data-beat="2"] .beat-pips i:nth-child(3),
[data-beat="3"] .beat-pips i:nth-child(4) { background: #b6ecdf; }
.overlay { position: absolute; inset: 0; display: grid; padding: 11px; z-index: 3; }
.shade {
  align-items: center;
  justify-items: center;
  background: linear-gradient(90deg, #210f0eb0, #24110ee6 34%, #24110ee6 66%, #210f0eb0);
  z-index: 5;
}
#game:is(:fullscreen, .expanded) .shade {
  padding: max(11px, env(safe-area-inset-top)) max(11px, env(safe-area-inset-right))
    max(11px, env(safe-area-inset-bottom)) max(11px, env(safe-area-inset-left));
}
#warmup-ready { z-index: 3; }
.ending {
  align-items: center;
  justify-items: end;
  padding: 0 max(6vw, var(--hud-right)) 0 var(--hud-left);
  background: linear-gradient(270deg, #210e0dcf 0%, #260f0c85 30%, transparent 59%);
  pointer-events: none;
}
.panel {
  width: min(100%, 465px);
  padding: clamp(16px, 2.5vw, 30px) 0;
  color: var(--light);
  border-block: 1px solid #e0976d;
}
.panel h2 { margin: 0 0 .45rem; font: 700 clamp(2rem, 5vw, 4.25rem)/.9 Georgia, serif; letter-spacing: -.063em; }
.panel p { margin: 0 0 1rem; color: #ffe0be; line-height: 1.45; }
[data-act="practice-bend"] small { color: #ffba88; font-size: .875rem; font-weight: 650; }
.panel-title { display: flex; align-items: start; gap: 12px; justify-content: space-between; margin-bottom: 4px; }
.pause-title { align-items: center; margin-bottom: 10px; }
.pause-title h2 { margin: 0; }
.sound-toggle {
  min-height: 44px;
  padding: 0 .45rem;
  border: 1px solid #965336;
  background: #422019;
  color: var(--light);
  display: inline-flex;
  align-items: center;
  justify-content: space-between;
  gap: 7px;
  font-size: .875rem;
  font-weight: 650;
}
.sound-toggle:hover { background: #723622; }
.close { font-size: 1.45rem; padding: 0; }
.panel-tag { display: block; color: #ffc287; font: italic 1.06rem/1.15 Georgia, serif; margin-bottom: .45rem; }
.options { display: grid; gap: 3px; }
.options button {
  min-height: 44px;
  background: #422019;
  border: 1px solid #965336;
  color: var(--light);
  text-align: left;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  padding: 0 .7rem;
}
.switch { width: 32px; height: 16px; border: 1px solid #dcb89a; padding: 2px; flex-shrink: 0; }
.switch::before { content: ""; width: 10px; height: 10px; display: block; background: #f1d0ab; transition: transform 110ms ease; }
[aria-pressed="true"] .switch { background: #ffb677; border-color: #ffcb9c; }
[aria-pressed="true"] .switch::before { background: #56281b; transform: translateX(15px); }
.sr {
  position: absolute; width: 1px; height: 1px; margin: -1px; overflow: hidden;
  clip: rect(0, 0, 0, 0); white-space: nowrap;
}

.guide, .legal {
  width: min(850px, calc(100% - var(--gutter) * 2));
  margin: clamp(36px, 7vw, 98px) auto;
  font: 1.125rem/1.62 Georgia, serif;
}
.guide-head { padding-bottom: clamp(14px, 4vw, 38px); }
.guide h2, .legal h1 { font: 700 clamp(2.45rem, 7vw, 5.5rem)/.93 Georgia, serif; letter-spacing: -.068em; margin: 0; }
.guide h3, .legal h2 { font: 700 clamp(1.5rem, 3.3vw, 2.3rem)/1.06 Georgia, serif; letter-spacing: -.041em; margin: 0 0 .42em; }
.guide-sections { list-style: none; padding: 0; margin: 0; }
.guide-section {
  position: relative;
  padding: clamp(20px, 4vw, 36px) 0 clamp(20px, 4vw, 40px) clamp(47px, 13vw, 112px);
  border-top: 1px solid #b5866c;
}
.guide-section::before {
  content: "";
  position: absolute;
  top: clamp(25px, 4.5vw, 44px);
  left: 5px;
  width: clamp(23px, 5.5vw, 53px);
  height: clamp(23px, 5.5vw, 53px);
  color: #994727;
  background: currentColor;
}
[data-symbol="steer"]::before { clip-path: polygon(0 100%, 39% 31%, 55% 61%, 81% 17%, 68% 17%, 100% 0, 100% 38%, 92% 26%, 54% 83%, 39% 56%, 10% 100%); }
[data-symbol="gate"]::before { clip-path: polygon(10% 0, 90% 0, 100% 19%, 100% 100%, 86% 100%, 86% 20%, 76% 10%, 24% 10%, 14% 20%, 14% 100%, 0 100%, 0 19%); }
[data-symbol="trail"]::before { clip-path: polygon(0 72%, 28% 27%, 48% 59%, 72% 18%, 100% 69%, 91% 79%, 72% 42%, 48% 83%, 28% 51%, 9% 82%); }
[data-symbol="aperture"]::before { background: transparent; border: 2px solid currentColor; border-radius: 50%; box-shadow: inset 0 0 0 5px var(--paper), inset 0 0 0 7px currentColor; }
.guide p, .legal p { margin: .75em 0; }
.guide table { width: 100%; border-collapse: collapse; }
.guide th, .guide td { padding: .38em .55em; border-bottom: 1px solid #cba78e; text-align: start; vertical-align: top; }
.guide :is(th, td):first-child { white-space: nowrap; }
.guide ul li + li { margin-top: .55em; }
.guide ul { padding-inline-start: 1.3em; }
.guide details { padding: .56em 0; border-top: 1px solid #cba78e; }
.guide summary { cursor: pointer; font-weight: 690; min-height: 44px; padding: .49em 0; }
.guide kbd { padding: .07em .35em; border: 1px solid #ac795a; color: #622e20; background: #ffe4c3; }
.footer {
  border-top: 1px solid #b78266;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 0 calc(12px + env(safe-area-inset-bottom));
  font: 700 .95rem/1 Georgia, serif;
}
.footer nav { display: flex; flex-wrap: wrap; column-gap: clamp(8px, 3vw, 30px); }
.footer a { display: inline-flex; min-height: 44px; align-items: center; }
.english-badge { margin-inline-start: .25em; font-weight: normal; }
.language { position: relative; }
.language summary {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  width: 52px;
  min-height: 44px;
  cursor: pointer;
  list-style: none;
  border: 1px solid #b78266;
}
.language summary::-webkit-details-marker { display: none; }
.language summary::after { content: ""; width: 6px; height: 6px; border: solid currentColor; border-width: 0 1px 1px 0; transform: translateY(-2px) rotate(45deg); }
.language summary:focus-visible { outline: 2px solid currentColor; outline-offset: 3px; }
.language-panel { position: absolute; bottom: calc(100% + 6px); right: 0; padding: .9rem 1rem; background: var(--paper); border: 1px solid #b78266; }
.language-panel a { display: flex; }
.language-panel [aria-current="page"] { color: #622e20; text-decoration: none; }
.legal { width: min(735px, calc(100% - var(--gutter) * 2)); }
.legal h1 { padding-bottom: .35em; border-bottom: 1px solid #b78266; }
.legal h2 { margin-top: 1.4em; }
.legal .back { display: inline-flex; align-items: center; min-height: 44px; margin-top: .65rem; }

@media (max-width: 630px) {
  :root { --gutter: 9px; }
  .poster-caption { display: grid; }
  .poster-name h1 { font-size: clamp(2.75rem, 14.35vw, 5.7rem); }
  .poster-entry p { font-size: .9rem; }
  .hud { gap: 6px; }
  .telemetry { gap: 6px; padding-inline: .55rem; }
  .telemetry strong { font-size: 1rem; }
  #game[data-flight="practice"] #hud-label { white-space: normal; }
  .telemetry, .pause-title h2, .flight-note strong { min-width: 0; overflow-wrap: anywhere; }
  :lang(fr)[data-flight="practice"] .telemetry { display: grid; gap: 0; }
  .flight-note strong { max-width: 100%; }
  .tools { flex-shrink: 0; }
  .checkpoint { max-width: 92px; padding: .25rem .4rem; line-height: 1.05; overflow-wrap: anywhere; }
  .ending { align-items: end; justify-items: center; padding: 0 var(--hud-right) var(--field-bottom) var(--hud-left); background: linear-gradient(0deg, #23110ef8, transparent 57%); }
  .ending[data-position="top"] {
    align-items: start;
    padding-top: var(--hud-top);
    background: linear-gradient(180deg, #23110ef8, #23110ed9 18%, transparent 56%);
  }
  .end-panel { padding: 9px 0; }
  .ending[data-position="top"] .end-panel { border-top: 0; }
  .ending[data-position="top"] .end-panel h2 { padding-inline-end: 106px; overflow-wrap: anywhere; }
  .end-panel .panel-tag { margin: 0 106px .32rem 0; }
  .end-panel h2 { margin-bottom: .3rem; }
  .end-panel p { margin-bottom: .55rem; font-size: .9rem; }
  .end-panel .actions { gap: 6px; }
  .end-panel .actions button { min-height: 44px; padding: .5rem .72rem; gap: 6px; font-size: .875rem; }
  .flight-note { flex-wrap: wrap; gap: .18rem .55rem; font-size: .875rem; padding: .55rem .65rem; }
  .flight-note > span:not(.beat-pips) { flex-basis: 100%; order: 1; }
  .guide, .legal { width: calc(100% - 34px); }
}
@media (max-width: 405px) {
  #game[data-flight="active"] .fullscreen { top: calc(var(--hud-top) + 52px); right: var(--hud-right); }
}
@media (orientation: landscape) and (max-height: 550px) {
  .poster-caption { display: flex; }
  .poster-name h1 { font-size: clamp(2.25rem, 15dvh, 5.5rem); }
  .panel { padding: 12px 0; }
  .panel h2 { font-size: 2rem; }
  .ending { align-items: end; padding-bottom: var(--field-bottom); }
  .panel-title { margin-bottom: 2px; align-items: center; }
  .options { grid-template-columns: repeat(2, 1fr); }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: 0s !important; }
}
#game[data-reduced="true"] .switch::before { transition-duration: 0s; }
#game[data-reduced="true"] .beat-pips { display: none; }
