:root {
  --paper: #e8e1d5;
  --ink: #1c2924;
  --muted: #697169;
  --moss: #53604d;
  --sun: #d7a74d;
  --rust: #a94f35;
  --line: #1c29242b;
  --serif: "Iowan Old Style", "Baskerville", "Songti SC", "STSong", serif;
  --sans: "Avenir Next", "Helvetica Neue", "PingFang SC", sans-serif;
}
* { box-sizing: border-box; }
html { background: var(--paper); }
body {
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  font-family: var(--sans);
  background:
    radial-gradient(circle at 11% 12%, #ffffff9c 0 1px, transparent 1.5px),
    radial-gradient(circle at 78% 64%, #ffffff6b 0 1px, transparent 1.5px),
    linear-gradient(120deg, #eee9df 0%, var(--paper) 48%, #ddd5c8 100%);
  background-size: 23px 23px, 31px 31px, 100% 100%;
}
body::before {
  position: fixed;
  inset: 0;
  z-index: 10;
  pointer-events: none;
  content: "";
  opacity: .2;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 180 180' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.15'/%3E%3C/svg%3E");
  mix-blend-mode: multiply;
}
button, a { color: inherit; }
button { font-family: inherit; }
.page-shell { width: min(1180px, calc(100% - 64px)); margin: 0 auto; padding: 28px 0 52px; }
.topbar { display: flex; justify-content: space-between; align-items: center; padding-bottom: 20px; border-bottom: 1px solid var(--line); }
.wordmark { display: inline-flex; align-items: center; gap: 10px; font-size: 1rem; font-weight: 700; text-decoration: none; }
.wordmark img { width: 30px; height: 30px; border-radius: 8px; box-shadow: 0 1px 3px #1c29241f; }
.back-link { color: var(--muted); font-size: .72rem; font-weight: 700; letter-spacing: .13em; text-decoration: none; text-transform: uppercase; }
.back-link::before { content: "← "; }

.game-layout { display: grid; grid-template-columns: minmax(300px, .82fr) minmax(390px, .9fr); gap: clamp(54px, 9vw, 126px); align-items: center; min-height: calc(100vh - 82px); padding: 42px 6%; }
.game-intro { align-self: center; }
.eyebrow { margin: 0 0 18px; color: var(--rust); font-size: .66rem; font-weight: 700; letter-spacing: .2em; text-transform: uppercase; }
h1 { margin: 0; font-family: var(--serif); font-size: clamp(4.6rem, 9vw, 8.8rem); font-weight: 400; letter-spacing: -.075em; line-height: .72; }
h1 span { display: block; color: var(--rust); font-size: .48em; font-style: italic; letter-spacing: -.035em; transform: translateX(.08em); }
.lede { max-width: 28rem; margin: 38px 0 30px; color: var(--muted); font-family: var(--serif); font-size: clamp(1.15rem, 2vw, 1.48rem); line-height: 1.65; }
.instructions { padding: 20px 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); color: var(--muted); font-size: .78rem; line-height: 1.9; }
.instructions p { margin: 0; }
.instructions strong { display: inline-block; min-width: 4.3em; color: var(--ink); }
.tip { display: flex; gap: 12px; margin: 21px 0 0; color: var(--muted); font-size: .76rem; line-height: 1.6; }
.tip span { flex: 0 0 auto; color: var(--rust); font-weight: 700; }

.flight-station { width: min(100%, 480px); justify-self: center; }
.scorebar { display: grid; grid-template-columns: 1fr 1fr auto; gap: 8px; margin-bottom: 10px; }
.score-card { display: grid; place-items: center; min-height: 58px; padding: 7px 14px; border: 1px solid var(--line); border-radius: 12px; background: #f5f1e9b8; box-shadow: inset 0 1px #fff; }
.score-card span { color: var(--muted); font-size: .56rem; font-weight: 700; letter-spacing: .15em; text-transform: uppercase; }
.score-card strong { font-family: var(--serif); font-size: 1.4rem; line-height: 1; }
.sound-button { min-width: 82px; padding: 0 12px; color: var(--moss); border: 1px solid var(--line); border-radius: 12px; font-size: .7rem; font-weight: 700; background: #f5f1e9b8; cursor: pointer; }
.sound-button[aria-pressed="false"] { color: var(--muted); }
.game-frame { position: relative; width: 100%; overflow: hidden; border: 9px solid #f7f4ed; border-radius: 21px; background: #bfcbbd; box-shadow: 0 27px 54px #263d373e, inset 0 0 0 1px #fff; }
canvas { display: block; width: 100%; height: auto; outline: none; background: #c5d3c7; cursor: pointer; touch-action: manipulation; }
canvas:focus-visible { box-shadow: inset 0 0 0 4px #d7a74d; }
.game-overlay { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 24px; color: #f8f2e6; background: #20312bb8; backdrop-filter: blur(4px); text-align: center; transition: opacity .25s ease; }
.game-overlay[hidden] { display: none; }
.overlay-mark { display: grid; place-items: center; width: 54px; height: 54px; margin-bottom: 16px; border: 1px solid #f8f2e67a; border-radius: 50%; color: #f1c252; font-size: 1.6rem; transform: rotate(-8deg); }
.game-overlay p { margin: 0 0 8px; font-family: var(--serif); font-size: clamp(2.3rem, 7vw, 4rem); letter-spacing: -.04em; }
.game-overlay > span { color: #dce2d9; font-size: .82rem; }
.game-overlay button { margin-top: 24px; padding: 13px 22px; color: #29362f; border: 0; border-radius: 11px; font-size: .8rem; font-weight: 800; letter-spacing: .08em; background: var(--sun); box-shadow: 0 9px 22px #111c1790, inset 0 1px #fff7; cursor: pointer; }
.pause-button { position: absolute; z-index: 2; top: 12px; right: 12px; display: grid; place-items: center; width: 38px; height: 38px; color: #f6f0e4; border: 1px solid #ffffff6b; border-radius: 50%; background: #20312b8c; backdrop-filter: blur(5px); cursor: pointer; }
.pause-button[hidden] { display: none; }
.game-status { min-height: 1.4em; margin: 13px 2px 0; color: var(--muted); font-size: .72rem; }
.mobile-flap { display: none; width: 100%; min-height: 52px; margin-top: 14px; color: #f8f4ea; border: 0; border-radius: 13px; font-weight: 700; letter-spacing: .08em; background: var(--moss); box-shadow: 0 8px 18px #36402f30, inset 0 1px #ffffff26; }
.mobile-flap span { display: inline-block; margin-right: 8px; font-size: 1.05rem; }

@media (max-width: 880px) {
  .page-shell { width: min(100% - 32px, 610px); padding-top: 18px; }
  .game-layout { grid-template-columns: 1fr; gap: 35px; min-height: auto; padding: 54px 2px 64px; }
  .game-intro { display: grid; grid-template-columns: 1fr auto; gap: 18px; align-items: end; }
  .eyebrow, .lede { grid-column: 1 / -1; }
  h1 { font-size: clamp(5rem, 24vw, 8rem); }
  .lede { margin: 15px 0 0; }
  .instructions { display: none; }
  .tip { align-self: end; max-width: 14rem; margin: 0 0 4px; }
  .flight-station { width: min(100%, 460px); }
  .mobile-flap { display: block; }
}
@media (max-width: 480px) {
  .game-layout { padding-top: 43px; }
  .game-intro { display: block; }
  h1 { font-size: 6.3rem; }
  .tip { display: none; }
  .scorebar { grid-template-columns: 1fr 1fr 74px; }
  .game-frame { border-width: 7px; border-radius: 17px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
