:root {
  color-scheme: light;
  --paper: #f5eedc;
  --ink: #263a37;
  --muted: #64756d;
  --accent: #bd513b;
  --gold: #e9ac46;
}
* { box-sizing: border-box; }
html, body { min-height: 100%; margin: 0; }
html, body, canvas, button, input, .viewport {
  -webkit-tap-highlight-color: transparent;
}
body {
  background: var(--paper);
  color: var(--ink);
  font-family: 'Avenir Next', 'Gill Sans', sans-serif;
  user-select: none;
}
input, p, h1, h2, h3, .note span { user-select: text; }
.grain { pointer-events: none; position: fixed; inset: 0; opacity: .19; 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='.75' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='180' height='180' filter='url(%23n)' opacity='.28'/%3E%3C/svg%3E"); z-index: 5; }
.layout { max-width: 1220px; min-height: 100dvh; margin: auto; padding: clamp(18px, 3vh, 32px) clamp(18px, 5vw, 60px); display: flex; flex-direction: column; justify-content: center; gap: 18px; }
.intro { display: grid; grid-template-columns: 1fr auto; column-gap: 40px; align-items: end; }
.eyebrow, .step, .panel-top, .panel-bottom, .small-tag, .overlay-help, .corner-label, .score-hud span, .records-kicker, .records ol, .scene-chip, .scene-banner { font-family: 'Courier New', monospace; letter-spacing: .09em; font-size: 10px; font-weight: 700; }
.eyebrow { grid-column: 1 / -1; display: flex; align-items: center; gap: 13px; white-space: nowrap; }
.asterisk { color: var(--accent); font-size: 28px; line-height: 1; }
.issue { color: var(--muted); margin-left: auto; }
h1 { font-family: 'Iowan Old Style', 'Baskerville', 'Palatino Linotype', serif; font-size: clamp(54px, 6vw, 88px); letter-spacing: -.082em; line-height: .84; margin: 12px 0 5px; font-weight: 500; }
h1 br { display: none; }
h1 em { color: var(--accent); font-weight: 400; }
.lede { font-family: 'Iowan Old Style', 'Baskerville', serif; font-size: clamp(17px, 2vw, 24px); line-height: 1.28; margin: 0 0 3px; text-align: right; }
.rule, .howto, .note { display: none; }
.flight-panel { width: min(100%, calc((100dvh - 216px) * 1.5 + 24px), 984px); min-width: 0; align-self: center; background: #e9e1cb; border: 1px solid #7e8c7d; box-shadow: 10px 12px 0 #c9cbb3, 17px 19px 0 rgba(38, 58, 55, .1); padding: 11px; }
.panel-top, .panel-bottom { display: flex; justify-content: space-between; gap: 10px; color: #53635a; white-space: nowrap; padding: 2px 4px 9px; font-size: 9px; }
.panel-bottom { padding: 9px 4px 1px; }
.live-indicator { display: flex; align-items: center; gap: 8px; }
.dot { width: 7px; height: 7px; background: #72927b; border-radius: 100%; }
.viewport-wrap { display: flex; justify-content: center; background: #b7d9ed; }
.viewport { position: relative; width: min(100%, calc((100dvh - 216px) * 1.5), 960px); aspect-ratio: 3 / 2; overflow: hidden; background: #b7d9ed; }
canvas { width: 100%; height: 100%; display: block; touch-action: none; cursor: pointer; outline: none; background: #b7d9ed; -webkit-touch-callout: none; }
canvas:focus-visible { outline: 3px solid var(--accent); outline-offset: -5px; }
.score-hud { position: absolute; z-index: 1; left: 18px; top: 16px; display: flex; flex-direction: column; color: var(--ink); pointer-events: none; text-shadow: 0 1px 2px rgba(255, 252, 238, .9); }
.score-hud strong { font-family: 'Iowan Old Style', 'Baskerville', serif; font-weight: 500; font-size: clamp(36px, 5vw, 56px); line-height: 1; font-variant-numeric: tabular-nums; }
.scene-chip, .scene-banner {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  color: #263a37;
  background: rgba(246, 241, 228, .92);
  border: 1px solid rgba(38, 58, 55, .32);
  box-shadow: 2px 2px 0 rgba(38, 58, 55, .24);
  pointer-events: none;
}
.scene-chip { top: 14px; z-index: 2; padding: 6px 11px; font-size: 9px; }
.scene-banner {
  top: 56px;
  z-index: 2;
  padding: 7px 12px;
  opacity: 0;
  transition: opacity .22s ease;
}
.scene-banner.visible { opacity: 1; }
.corner-label { position: absolute; bottom: 12px; left: 17px; color: #263a37; pointer-events: none; font-size: 9px; text-shadow: 0 1px 2px #f5eedc; }
.overlay { position: absolute; inset: 0; display: grid; place-items: center; padding: 24px; z-index: 2; pointer-events: none; transition: opacity .17s ease; }
.overlay.hidden { opacity: 0; visibility: hidden; }
.overlay-content { width: min(100%, 720px); display: flex; align-items: stretch; justify-content: center; gap: 15px; }
.overlay-card { flex: 1 1 305px; min-width: 0; max-width: 360px; padding: 25px 23px 20px; background: #f6f1e4; border: 1px solid var(--ink); box-shadow: 6px 6px 0 var(--ink); text-align: left; }
.small-tag { color: var(--accent); }
h2 { font-family: 'Iowan Old Style', 'Baskerville', serif; font-size: clamp(32px, 4vw, 51px); font-weight: 500; letter-spacing: -.054em; line-height: .95; margin: 19px 0 12px; }
.overlay-card p { margin: 0 0 19px; color: #5c6a5c; font-size: 14px; line-height: 1.4; }
button {
  pointer-events: auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
  border: 0;
  padding: 13px 15px;
  background: var(--ink);
  color: #fff9ea;
  font-family: 'Avenir Next', 'Gill Sans', sans-serif;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
}
button:hover { background: #3e6159; }
button:focus-visible, input:focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; }
button span { font-size: 22px; font-weight: 400; line-height: .6; }
button:disabled { opacity: .5; cursor: not-allowed; }
.overlay-help { margin-top: 16px; text-align: center; color: #718074; font-size: 9px; }
.high-score-form { margin-bottom: 15px; }
.high-score-form.hidden { display: none; }
.high-score-form label { display: block; margin-bottom: 8px; color: #506057; font-size: 12px; font-weight: 700; }
.high-score-form input {
  width: 100%;
  padding: 12px 13px;
  border: 1px solid #69776f;
  background: #fffaf0;
  color: var(--ink);
  font: 700 16px 'Avenir Next', 'Gill Sans', sans-serif;
  text-transform: uppercase;
}
.high-score-hint { margin: 9px 0 12px !important; font-size: 11px !important; color: #6d796c !important; }
.entry-actions { display: flex; flex-direction: column; gap: 8px; }
button.ghost { background: transparent; color: var(--ink); border: 1px solid #73837a; }
button.ghost:hover { background: rgba(38, 58, 55, .06); }
.records { flex: 0 1 250px; min-width: 0; padding: 24px 20px 15px; background: rgba(246, 241, 228, .97); border: 1px solid #657663; box-shadow: 6px 6px 0 #50695b; }
.records-kicker { color: var(--accent); font-size: 9px; white-space: nowrap; }
.records-kicker span { color: #75867b; }
.records h3 { font-family: 'Iowan Old Style', 'Baskerville', serif; font-weight: 500; font-size: 30px; letter-spacing: -.04em; margin: 15px 0 12px; }
.records ol { list-style: none; padding: 0; margin: 0; }
.records li:not(.empty-score) { display: grid; grid-template-columns: auto 1fr auto; align-items: baseline; gap: 8px; border-top: 1px solid #bbc5b2; padding: 5px 2px; }
.records li strong { font-family: 'Iowan Old Style', 'Baskerville', serif; font-size: 21px; letter-spacing: 0; font-weight: 500; color: var(--ink); }
.records li:first-child strong { color: var(--accent); }
.record-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12px; }
.records .empty-score { color: #6d796c; font: normal 12px 'Avenir Next', 'Gill Sans', sans-serif; letter-spacing: 0; border-top: 1px solid #bbc5b2; padding: 12px 0; }
.records p { font-size: 10px; color: var(--muted); border-top: 1px solid #bbc5b2; padding-top: 11px; margin: 0; }
.local-records { margin-top: 14px; }
.local-kicker { color: #596b61; }
#top-scores li:not(.empty-score) { grid-template-columns: auto auto; }
#top-scores .record-name { display: none; }
.mute { position: absolute; z-index: 3; right: 13px; top: 13px; width: auto; display: block; padding: 8px 10px; background: #f6f1e4; color: #263a37; border: 1px solid #263a37; box-shadow: 2px 2px 0 #263a37; font: 700 9px 'Courier New', monospace; letter-spacing: .06em; }
.mute:hover { background: #fffaf0; }
.mute[aria-pressed="true"] { background: #263a37; color: #fff9ea; }
@media (max-width: 899px) and (orientation: portrait) {
  .layout { max-width: 550px; padding: 15px 18px 30px; justify-content: flex-start; gap: 15px; }
  .intro { grid-template-columns: 1fr auto; }
  .eyebrow { font-size: 9px; }
  h1 { font-size: clamp(51px, 13vw, 75px); margin: 15px 0 1px; }
  h1 br { display: block; }
  .lede { font-size: 15px; padding-left: 8px; }
  .flight-panel { max-width: 470px; }
  .viewport { width: min(100%, calc((100dvh - 205px) * .5625), 405px); aspect-ratio: 9 / 16; }
  .overlay { padding: 13px; }
  .overlay-content { flex-direction: column; align-items: center; gap: 10px; }
  .overlay-card { flex: 0 0 auto; width: 100%; max-width: 310px; padding: 15px 18px; box-shadow: 4px 4px 0 var(--ink); }
  h2 { font-size: clamp(31px, 5vh, 44px); margin: 10px 0 7px; }
  .overlay-card p { margin-bottom: 10px; font-size: 12px; }
  .overlay-card button { padding: 10px 12px; font-size: 12px; }
  .overlay-help { margin-top: 9px; }
  .records { flex: 0 0 auto; width: 100%; max-width: 310px; padding: 12px 16px 10px; box-shadow: 4px 4px 0 #50695b; }
  .records h3 { font-size: 21px; margin: 5px 0 5px; }
  #shared-scores, #top-scores { min-height: 0; }
  .records li:not(.empty-score) { padding: 4px 1px; }
  .records li strong { font-size: 17px; }
  .records p { padding-top: 5px; margin-top: 4px; }
  .score-hud { left: 12px; top: 12px; }
  .score-hud strong { font-size: 44px; }
  .scene-chip { top: 10px; font-size: 8px; }
  .scene-banner { top: 42px; font-size: 8px; }
}
@media (max-height: 520px) and (orientation: landscape) {
  .layout { max-width: 1050px; padding: 8px 15px; gap: 6px; }
  .intro { align-items: center; }
  .eyebrow { font-size: 8px; }
  .asterisk { font-size: 20px; }
  h1 { font-size: 36px; margin: 3px 0; }
  .lede { font-size: 12px; }
  .lede br { display: none; }
  .flight-panel { width: min(100%, calc((100dvh - 102px) * 1.5 + 16px)); padding: 7px; }
  .panel-top, .panel-bottom { padding: 1px 3px 5px; font-size: 8px; }
  .panel-bottom { padding: 5px 3px 0; }
  .viewport { width: min(100%, calc((100dvh - 102px) * 1.5)); }
  .overlay { padding: 8px; }
  .overlay-content { gap: 8px; max-width: 510px; }
  .overlay-card { flex: 1 1 230px; padding: 9px 11px; box-shadow: 3px 3px 0 var(--ink); }
  h2 { font-size: 25px; margin: 4px 0; }
  .overlay-card p { font-size: 10px; margin-bottom: 7px; }
  .overlay-help, .small-tag { display: none; }
  .overlay-card button { padding: 6px 9px; font-size: 11px; }
  .records { flex: 0 1 180px; padding: 8px 10px; box-shadow: 3px 3px 0 #50695b; }
  .records-kicker span { display: none; }
  .records h3 { font-size: 19px; margin: 4px 0; }
  .records li:not(.empty-score) { padding: 1px; }
  .records li strong { font-size: 14px; }
  .records p { font-size: 8px; padding-top: 4px; margin-top: 3px; }
  .score-hud { top: 7px; left: 9px; }
  .score-hud strong { font-size: 31px; }
  .mute { right: 8px; top: 7px; padding: 5px; font-size: 8px; }
  .scene-chip { top: 8px; }
  .scene-banner { top: 32px; }
}
