:root {
  color-scheme: dark;
  --bg: #080f1b;
  --ink: #eaf4f8;
  --muted: #97a9bd;
  --cyan: #83e5de;
  --violet: #baaaff;
  --line: #223044;
  --coral: #fa8d79;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
/* Prevent double-tap zoom on the game and scrollable panels. */
* { box-sizing: border-box; touch-action: manipulation; }
body { margin: 0; background: var(--bg); color: var(--ink); overflow: hidden; }
button, a, input { -webkit-tap-highlight-color: transparent; }
button { font: inherit; cursor: pointer; border: 1px solid var(--line); color: var(--ink); background: #101c2c; border-radius: 10px; min-height: 44px; padding: 10px 15px; }
button:disabled { opacity: .45; cursor: wait; }
button:focus-visible, a:focus-visible, input:focus-visible { outline: 2px solid var(--cyan); outline-offset: 3px; }
button:hover:not(:disabled) { border-color: #70979e; }
a { color: inherit; text-decoration: none; }
[hidden] { display: none !important; }
.cockpit { max-width: 1440px; margin: auto; height: 100vh; height: 100dvh; padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left); display: flex; flex-direction: column; }
header { flex: none; display: flex; justify-content: space-between; align-items: center; padding: 18px 30px; border-bottom: 1px solid var(--line); gap: 10px; }
.brand { display: flex; gap: 12px; align-items: center; font-size: 15px; font-weight: 750; letter-spacing: 2px; }
.brand-mark { display: grid; place-items: center; border: 1px solid #435965; border-radius: 50%; width: 37px; height: 37px; color: var(--cyan); font-size: 27px; }
.brand small { display: block; color: #7c90a9; font: 9px ui-monospace, monospace; letter-spacing: 1.5px; margin-top: 5px; }
.header-actions { display: flex; gap: 8px; }
.header-actions button { background: none; font-size: 11px; min-height: 36px; padding: 7px 10px; }
main { position: relative; flex: 1; min-height: 0; overflow: hidden; isolation: isolate; }
canvas { position: absolute; inset: 0; width: 100%; height: 100%; z-index: -1; }
.panel { position: relative; margin: 48px 7% 24px; padding: 28px 32px 24px; width: min(450px, 86%); max-height: calc(100% - 72px); overflow-y: auto; overscroll-behavior: contain; scrollbar-width: thin; scrollbar-color: #3b5465 transparent; background: rgba(9, 18, 31, .94); border: 1px solid #293849; box-shadow: 0 22px 80px #02060a80; border-radius: 22px; backdrop-filter: blur(12px); }
.eyebrow, legend, .flight-label, .hud small, footer, .privacy, .hint, .signal, .sensitivity, .result-stats small, .result-line, .control-copy, .buddy-copy, .rotate-hint, .player-scores, .face-background-controls { font-family: ui-monospace, SFMono-Regular, Consolas, monospace; }
.eyebrow { font-size: 10px; letter-spacing: 1.7px; color: var(--cyan); line-height: 1.6; margin: 0 0 16px; }
h1 { font-size: clamp(40px, 4.5vw, 60px); letter-spacing: -2.8px; line-height: 1.05; margin: 0 0 18px; font-weight: 650; }
h2 { font-size: 36px; line-height: 1.08; letter-spacing: -1.5px; margin: 0 0 15px; }
.intro { font-size: 14px; line-height: 1.65; color: var(--muted); margin: 0 0 20px; }
fieldset { padding: 0; border: 0; margin: 0 0 14px; min-width: 0; }
legend { font-size: 9px; letter-spacing: 1.5px; margin-bottom: 8px; color: #adbfcb; }
.segments { display: flex; gap: 7px; }
.segments button { flex: 1; min-width: 0; font-size: 13px; padding: 10px 4px; border-radius: 8px; background: #101b2a; color: var(--muted); }
.segments button[aria-pressed=true] { color: var(--cyan); border-color: #639e9d; background: #153133; }
.segments button[data-players="2"][aria-pressed=true] { color: var(--violet); border-color: #8a77bb; background: #282139; }
.duration-options { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 100px); align-items: end; gap: 8px; }
.custom-duration-label { display: grid; min-width: 0; gap: 4px; color: var(--muted); font: 9px/1.3 ui-monospace, SFMono-Regular, Consolas, monospace; }
#custom-duration { width: 100%; min-width: 0; min-height: 44px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; background: #101b2a; color: var(--ink); font: 16px system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; }
#custom-duration::placeholder { color: #6e8198; }
#custom-duration[data-active="true"] { color: var(--cyan); border-color: #639e9d; background: #153133; }
#custom-duration[aria-invalid="true"] { border-color: var(--coral); }
.duration-error { margin: 6px 0 0; color: var(--coral); font: 10px/1.5 ui-monospace, SFMono-Regular, Consolas, monospace; }
.controls button { font-size: 12px; }
.control-copy { color: var(--muted); font-size: 10px; line-height: 1.6; min-height: 32px; margin: 0 0 14px; }
.buddy-copy { font-size: 11px; line-height: 1.6; color: #c1b7e7; margin: 0 0 16px; }
.rotate-hint { display: none; font-size: 10px; line-height: 1.55; color: var(--violet); border-left: 2px solid #746498; padding-left: 10px; margin: 0 0 14px; }
.wide { display: block; width: 100%; margin-top: 10px; min-height: 48px; font-size: 13px; }
.primary { background: var(--cyan); color: #092026; border-color: var(--cyan); font-weight: 700; }
.primary span { float: right; }
.secondary { background: transparent; color: #b5c4d2; }
.privacy { font-size: 9px; line-height: 1.7; text-align: center; color: #8498ac; margin: 15px 0 0; }
.hint { font-size: 10px; line-height: 1.7; color: #9dafbf; margin: 0 0 14px; }
.flight-label { position: absolute; right: 36px; top: 25px; color: #849bb5; font-size: 10px; letter-spacing: 1.5px; display: flex; align-items: center; gap: 7px; }
.dot { display: inline-block; width: 5px; height: 5px; border-radius: 50%; background: var(--cyan); box-shadow: 0 0 8px #83e5de50; }
.hud { position: absolute; inset: 23px 32px auto; display: flex; justify-content: space-between; pointer-events: none; }
.hud small { display: block; color: var(--muted); font-size: 10px; letter-spacing: 2px; margin-bottom: 5px; }
.hud strong { font-variant-numeric: tabular-nums; font-size: 42px; font-weight: 500; letter-spacing: -2px; }
.hud-right { text-align: right; }
.player-scores { position: absolute; top: 92px; inset-inline: 0; display: grid; grid-template-columns: 1fr 1fr; text-align: center; pointer-events: none; }
.player-scores > div { color: var(--cyan); }
.player-scores > div + div { color: var(--violet); }
.player-scores span { display: block; font-size: 10px; letter-spacing: 1px; }
.player-scores strong { display: block; font-size: 23px; font-weight: 550; font-variant-numeric: tabular-nums; margin-top: 3px; }
.inflight-controls { position: absolute; bottom: 18px; left: 24px; right: 24px; display: flex; align-items: center; justify-content: space-between; gap: 15px; }
.inflight-controls span { font: 11px ui-monospace, monospace; color: #b2c9d5; text-align: center; max-width: 65%; text-shadow: 0 1px 5px #000; }
.inflight-controls button { background: #0b1727e6; font-size: 12px; min-width: 70px; }
.touch-controls { position: absolute; left: 24px; right: 24px; bottom: 78px; display: flex; justify-content: space-between; align-items: center; }
.touch-controls button, .buddy-touch button { font-size: 26px; min-width: 76px; min-height: 50px; background: #142c39dc; }
.touch-controls span { font: 9px ui-monospace, monospace; letter-spacing: 1px; color: var(--muted); text-align: center; }
.buddy-touch { position: absolute; inset-inline: 0; bottom: 76px; display: grid; grid-template-columns: 1fr 1fr; }
.buddy-touch > div { display: flex; justify-content: space-between; gap: 10px; padding-inline: 22px; }
.buddy-touch > div + div button { background: #25233bdc; color: var(--violet); border-color: #574971; }
.message-panel { margin: 90px auto 24px; text-align: center; max-height: calc(100% - 114px); }
.countdown { font-size: 88px; line-height: 1.2; color: var(--cyan); font-variant-numeric: tabular-nums; font-weight: 300; margin: 12px; }
#camera-panel { --prep-accent: var(--cyan); }
#camera-panel[data-stage="settle"] { --prep-accent: #aecbd4; }
#camera-panel[data-stage="center"] { --prep-accent: #f2ca83; }
#camera-panel[data-stage="controls"] { --prep-accent: var(--violet); }
#camera-panel[data-stage="launch"] { --prep-accent: #a6e5a5; }
.prep-steps { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; list-style: none; padding: 0 0 14px; margin: 0 0 18px; border-bottom: 1px solid var(--line); font: 10px ui-monospace, SFMono-Regular, Consolas, monospace; }
.prep-steps li { display: flex; align-items: center; gap: 6px; min-width: 0; color: #8093a9; }
.prep-step-number { display: inline-grid; place-items: center; width: 24px; height: 24px; flex: none; border: 1px solid #344253; border-radius: 50%; font-size: 9px; }
.prep-steps li[data-state="current"] { color: var(--prep-accent); font-weight: 750; }
.prep-steps li[data-state="current"] .prep-step-number { background: var(--prep-accent); color: #10212b; border-color: var(--prep-accent); }
.prep-steps li[data-state="done"] { color: #c0d4d9; }
.prep-steps li[data-state="done"] .prep-step-number { color: var(--cyan); border-color: #52716f; font-size: 0; }
.prep-steps li[data-state="done"] .prep-step-number::after { content: "✓"; font-size: 12px; }
#camera-kicker { color: var(--prep-accent); }
.prep-next { color: #b5c6d4; font: 10px/1.6 ui-monospace, SFMono-Regular, Consolas, monospace; border-left: 2px solid var(--prep-accent); padding-left: 10px; margin: 14px 0; }
.prep-next:empty { display: none; }
.prep-progress-wrap { margin: 14px 0 18px; }
.prep-progress-copy { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; margin-bottom: 8px; }
#prep-progress-label { color: #bfccd8; font: 10px/1.5 ui-monospace, SFMono-Regular, Consolas, monospace; }
#prep-timer { flex: none; color: var(--prep-accent); font-size: 28px; font-weight: 550; line-height: 1; font-variant-numeric: tabular-nums; }
#prep-progress { display: block; appearance: none; -webkit-appearance: none; width: 100%; height: 6px; border: 0; border-radius: 4px; overflow: hidden; background: #273447; color: var(--prep-accent); accent-color: var(--prep-accent); }
#prep-progress::-webkit-progress-bar { background: #273447; border-radius: 4px; }
#prep-progress::-webkit-progress-value { background: var(--prep-accent); border-radius: 4px; }
#prep-progress::-moz-progress-bar { background: var(--prep-accent); border-radius: 4px; }
.prep-pilots { display: flex; gap: 6px; margin: 0 0 12px; }
.prep-pilots > span { display: flex; align-items: center; gap: 6px; flex: 1; min-width: 0; padding: 6px 8px; border: 1px solid #354052; border-radius: 6px; color: #bac9d8; font: 9px/1.4 ui-monospace, SFMono-Regular, Consolas, monospace; }
.prep-pilots > span::before { content: ""; width: 6px; height: 6px; flex: none; border-radius: 50%; border: 1px solid #8d9db1; }
.prep-pilots > span[data-state="ready"] { color: #b7ead0; border-color: #3f665b; background: #14312766; }
.prep-pilots > span[data-state="ready"]::before { background: #9bddb7; border-color: #9bddb7; }
#camera-panel:not([data-stage="frame"]) .camera-actions { display: flex; justify-content: flex-end; }
#camera-panel:not([data-stage="frame"]) .camera-actions .wide { width: auto; min-width: 100px; }
.viewfinder { position: relative; width: 100%; height: 165px; border-radius: 12px; background: #06101b; overflow: hidden; margin-bottom: 12px; }
video { width: 100%; height: 100%; object-fit: contain; transform: scaleX(-1); }
.frame-corner { position: absolute; width: 20px; height: 20px; border-color: var(--cyan); border-style: solid; opacity: .5; pointer-events: none; }
#camera-panel .frame-corner { border-color: var(--prep-accent); }
#camera-panel[data-stage="center"] .frame-corner { opacity: 1; border-width: 2px; }
#camera-panel[data-stage="center"] .tl { border-width: 2px 0 0 2px; }
#camera-panel[data-stage="center"] .tr { border-width: 2px 2px 0 0; }
#camera-panel[data-stage="center"] .bl { border-width: 0 0 2px 2px; }
#camera-panel[data-stage="center"] .br { border-width: 0 2px 2px 0; }
.tl { top: 12px; left: 12px; border-width: 1px 0 0 1px; }
.tr { top: 12px; right: 12px; border-width: 1px 1px 0 0; }
.bl { bottom: 12px; left: 12px; border-width: 0 0 1px 1px; }
.br { bottom: 12px; right: 12px; border-width: 0 1px 1px 0; }
.face-label { position: absolute; left: 25%; top: 10px; transform: translateX(-50%); padding: 4px 8px; border-radius: 5px; font: 10px ui-monospace, monospace; font-weight: 700; background: #0b2129d9; color: var(--cyan); border: 1px solid #4c8d89; z-index: 1; }
.face-label-two { left: 75%; color: var(--violet); background: #20192fd9; border-color: #8a77bb; }
.buddy-mode .viewfinder::after { content: ""; position: absolute; left: 50%; top: 8px; bottom: 34px; border-left: 1px dashed #c9c5e366; pointer-events: none; }
#tracking-label { position: absolute; bottom: 8px; left: 0; right: 0; text-align: center; font: 9px ui-monospace, monospace; color: var(--cyan); background: #06101bba; padding: 5px; }
.signal { display: flex; align-items: center; gap: 10px; font-size: 9px; color: var(--muted); }
.signal-track { height: 3px; flex: 1; background: #2a3c4c; position: relative; }
.signal-track::after { content: ""; position: absolute; left: 50%; top: -4px; height: 11px; width: 1px; background: #577888; }
.signal-track i { position: absolute; left: 50%; top: -3px; width: 9px; height: 9px; background: var(--cyan); border-radius: 50%; transform: translateX(-50%); }
.sensitivity { font-size: 9px; display: flex; align-items: center; gap: 8px; margin: 14px 0; color: var(--muted); }
input[type=range] { width: 80px; flex: 1; min-width: 50px; accent-color: var(--cyan); }
.face-background-controls { display: flex; align-items: center; gap: 10px; color: #a7bacb; font-size: 9px; margin-top: 12px; }
.face-background-controls label { display: flex; align-items: center; gap: 6px; }
.face-background-controls input[type=checkbox] { margin: 0; accent-color: var(--cyan); width: 15px; height: 15px; }
.face-background-controls input[type=range] { max-width: 100px; }
.result-stats { display: flex; justify-content: space-between; gap: 15px; padding: 18px 0; border-block: 1px solid var(--line); margin-bottom: 15px; }
.result-stats small { font-size: 9px; letter-spacing: 1px; color: var(--muted); display: block; margin-bottom: 6px; }
.result-stats strong { font-size: 40px; font-weight: 450; letter-spacing: -1.5px; }
.result-line { display: flex; justify-content: space-between; gap: 12px; font-size: 11px; color: var(--muted); margin: 14px 0; }
.result-line strong { color: var(--ink); }
.result-buddy { line-height: 1.6; color: #c1b7e7; }
.toast { position: absolute; left: 12px; right: 12px; top: 25%; text-align: center; color: var(--cyan); font-size: 16px; font-weight: 600; pointer-events: none; text-shadow: 0 2px 8px #000; }
footer { flex: none; border-top: 1px solid var(--line); padding: 14px 30px; font-size: 9px; letter-spacing: 1.2px; color: #92a6ba; display: flex; justify-content: space-between; gap: 10px; }
body.playing #flight-label { display: none; }
body.playing #results { margin-inline: auto; }
@media (orientation: portrait) { .buddy-mode .rotate-hint { display: block; } }
@media (max-width: 799px) {
  header { padding: 11px 17px; }
  .brand { font-size: 12px; letter-spacing: 1.3px; gap: 8px; }
  .brand small { font-size: 7px; }
  .brand-mark { height: 31px; width: 31px; font-size: 22px; }
  .header-actions { gap: 5px; }
  .header-actions button { font-size: 10px; padding: 6px 9px; }
  .panel { width: calc(100% - 28px); max-width: 430px; margin: 40px auto 14px; max-height: calc(100% - 54px); padding: 22px; border-radius: 18px; }
  .eyebrow { font-size: 9px; margin-bottom: 12px; }
  h1 { font-size: 43px; margin-bottom: 15px; }
  h2 { font-size: 31px; }
  .intro { font-size: 13px; line-height: 1.6; margin-bottom: 16px; }
  .flight-label { top: 16px; left: 0; right: 0; justify-content: center; font-size: 8px; letter-spacing: 1.4px; }
  footer { padding: 12px 17px; font-size: 8px; }
  .hud { inset: 20px 22px auto; }
  .hud strong { font-size: 35px; }
  .hud small { font-size: 9px; }
  .player-scores { top: 82px; }
  .inflight-controls { left: 14px; right: 14px; bottom: 15px; gap: 8px; }
  .inflight-controls span { font-size: 9px; max-width: 160px; }
  .inflight-controls button { min-width: 62px; padding-inline: 12px; }
  .touch-controls { left: 14px; right: 14px; bottom: 75px; }
  .touch-controls button { min-width: 70px; }
  .touch-controls span { max-width: 120px; font-size: 8px; }
  .buddy-touch { bottom: 75px; }
  .buddy-touch > div { padding-inline: 12px; gap: 6px; }
  .buddy-touch button { min-width: 58px; padding-inline: 10px; }
  .message-panel { margin-top: 90px; max-height: calc(100% - 104px); }
  .viewfinder { height: 140px; }
  .sensitivity { flex-wrap: wrap; }
  .result-stats strong { font-size: 35px; }
}
/* Keep the entire flight on screen when a phone is resting sideways. */
@media (max-height: 540px) and (orientation: landscape) {
  header { padding: 4px 18px; min-height: 44px; }
  .brand { font-size: 12px; gap: 8px; }
  .brand small { display: none; }
  .brand-mark { width: 27px; height: 27px; font-size: 21px; }
  .header-actions button { min-height: 32px; padding-block: 4px; }
  footer { display: none; }
  .flight-label { display: none; }
  .panel, body.playing #results, .message-panel { width: calc(100% - 28px); max-width: 960px; margin: 8px auto; max-height: calc(100% - 16px); padding: 14px 18px; border-radius: 15px; }
  #setup { display: grid; grid-template-columns: minmax(0, .92fr) minmax(0, 1.08fr); grid-template-areas: "intro options" "actions actions"; gap: 10px 26px; }
  .setup-intro { grid-area: intro; }
  .setup-options { grid-area: options; }
  .setup-actions { grid-area: actions; display: grid; grid-template-columns: 1fr 1fr; gap: 5px 12px; }
  .setup-actions .privacy { grid-column: 1 / -1; }
  .eyebrow { font-size: 9px; letter-spacing: 1.2px; margin-bottom: 9px; }
  h1 { font-size: clamp(32px, 5vw, 43px); letter-spacing: -1.7px; margin-bottom: 12px; }
  h2 { font-size: clamp(23px, 3.5vw, 30px); letter-spacing: -1px; margin-bottom: 10px; }
  .intro { font-size: 12px; line-height: 1.55; margin-bottom: 10px; }
  .buddy-copy { font-size: 10px; line-height: 1.5; margin: 0; }
  fieldset { margin-bottom: 8px; }
  legend { font-size: 8px; margin-bottom: 4px; letter-spacing: 1.1px; }
  .segments { gap: 6px; }
  .segments button { min-height: 36px; padding: 5px 3px; font-size: 11px; }
  .duration-options { grid-template-columns: minmax(0, 1fr) minmax(0, 90px); gap: 6px; }
  .custom-duration-label { gap: 3px; font-size: 8px; }
  #custom-duration { min-height: 36px; padding: 4px 8px; }
  .duration-error { font-size: 9px; }
  .control-copy { font-size: 9px; line-height: 1.4; min-height: 0; margin: 0; }
  .wide { min-height: 40px; padding: 8px 10px; font-size: 12px; }
  .setup-actions .wide, .camera-actions .wide, .result-actions .wide { margin: 0; }
  .privacy { font-size: 8px; line-height: 1.5; margin: 0; }
  #camera-panel { display: grid; grid-template-columns: minmax(0, .95fr) minmax(0, 1.05fr); grid-template-areas: "steps steps" "intro visual" "actions actions"; gap: 10px 24px; }
  #camera-panel:not([data-stage="frame"]) { grid-template-areas: "steps steps" "intro visual" "intro actions"; align-items: start; }
  #camera-panel:not([data-stage="frame"]) .camera-actions { align-self: start; }
  .prep-steps { grid-area: steps; padding-bottom: 9px; margin: 0; font-size: 10px; }
  .prep-step-number { height: 21px; width: 21px; font-size: 8px; }
  .camera-intro { grid-area: intro; }
  .camera-visual { grid-area: visual; min-width: 0; }
  .camera-actions { grid-area: actions; display: grid; grid-template-columns: 1.6fr 1fr; gap: 12px; }
  .prep-next { font-size: 9px; line-height: 1.5; margin: 10px 0 0; padding-left: 8px; }
  .prep-progress-wrap { margin: 10px 0 0; }
  .prep-progress-copy { margin-bottom: 6px; }
  #prep-progress-label { font-size: 9px; }
  #prep-timer { font-size: 25px; }
  .prep-pilots { margin-bottom: 8px; }
  .prep-pilots > span { padding: 4px 6px; font-size: 8px; }
  .viewfinder { height: clamp(90px, 28dvh, 140px); margin-bottom: 8px; }
  #camera-panel:not([data-stage="frame"]) .viewfinder { height: clamp(100px, 36dvh, 175px); }
  .sensitivity { margin: 8px 0 0; font-size: 8px; flex-wrap: nowrap; }
  .face-background-controls { margin-top: 8px; gap: 6px; font-size: 8px; }
  .face-background-controls input[type=range] { max-width: 90px; }
  .hint { font-size: 9px; line-height: 1.5; margin: 0; }
  #message { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(180px, .8fr); align-items: center; gap: 16px 24px; max-width: 790px; }
  .message-content { text-align: left; }
  .message-actions .wide { margin: 7px 0; }
  .message-actions .wide:first-child { margin-top: 0; }
  .message-actions .wide:last-child { margin-bottom: 0; }
  .countdown { font-size: 48px; margin: 0; }
  #results { display: grid; grid-template-columns: 1fr 1fr; grid-template-areas: "intro content" "actions content"; align-items: start; gap: 12px 24px; max-width: 850px; }
  .result-intro { grid-area: intro; }
  .result-content { grid-area: content; }
  .result-actions { grid-area: actions; }
  .result-actions .privacy { margin-top: 8px; }
  .result-stats { padding: 8px 0; margin-bottom: 8px; }
  .result-stats strong { font-size: 30px; }
  .result-stats small { font-size: 8px; }
  .result-line { font-size: 10px; margin: 9px 0; gap: 8px; }
  .hud { inset: 10px 20px auto; }
  .hud strong { font-size: 28px; letter-spacing: -1px; }
  .hud small { font-size: 8px; margin-bottom: 2px; letter-spacing: 1px; }
  .player-scores { top: 12px; }
  .player-scores span { font-size: 9px; }
  .player-scores strong { font-size: 21px; margin-top: 2px; }
  .inflight-controls { bottom: 9px; left: 14px; right: 14px; }
  .inflight-controls span { font-size: 9px; max-width: 60%; }
  .inflight-controls button { min-height: 40px; min-width: 65px; padding: 7px 12px; }
  .touch-controls, .buddy-touch { bottom: 58px; }
  .touch-controls button, .buddy-touch button { min-height: 42px; min-width: 64px; padding: 4px 13px; font-size: 24px; }
  .buddy-touch > div { padding-inline: 14px; }
  .toast { top: 25%; font-size: 13px; }
}
@media (max-height: 330px) and (orientation: landscape) {
  .panel, body.playing #results, .message-panel { padding: 10px 14px; gap: 8px 20px; }
  header { min-height: 40px; padding-block: 2px; }
  .eyebrow { margin-bottom: 6px; font-size: 8px; }
  h1 { font-size: 33px; margin-bottom: 8px; }
  h2 { font-size: 24px; }
  fieldset { margin-bottom: 6px; }
  .segments button { min-height: 33px; }
  #custom-duration { min-height: 33px; }
  .wide { min-height: 36px; padding-block: 6px; }
  .viewfinder { height: 85px; }
  #camera-panel { gap: 8px 16px; }
  #camera-panel:not([data-stage="frame"]) { grid-template-columns: minmax(0, 1.08fr) minmax(0, .92fr); padding-block: 8px; }
  #camera-panel:not([data-stage="frame"]) h2 { font-size: 22px; margin-bottom: 8px; }
  .prep-steps { padding-bottom: 6px; font-size: 9px; gap: 4px; }
  .prep-steps li { gap: 4px; }
  .prep-step-number { width: 18px; height: 18px; font-size: 7px; }
  #camera-panel:not([data-stage="frame"]) .viewfinder { height: 100px; margin-bottom: 6px; }
  .prep-pilots { margin-bottom: 6px; }
  .prep-pilots > span { padding-block: 3px; font-size: 7px; }
  .prep-next { font-size: 8px; margin-top: 7px; }
  .prep-progress-wrap { margin-top: 8px; }
  #prep-progress-label { font-size: 8px; }
  #prep-timer { font-size: 22px; }
  .camera-intro .intro { margin-bottom: 8px; }
  .camera-intro .hint { font-size: 8px; }
  .face-background-controls { margin-top: 6px; }
  .countdown { font-size: 40px; }
  .result-stats strong { font-size: 27px; }
}
@media (prefers-reduced-motion: reduce) { * { scroll-behavior: auto; } }

/* Pixel arcade edition: crisp squares, limited colors, readable controls. */
:root { --bg: #0b1026; --ink: #fff4dc; --muted: #b2b9cd; --cyan: #91efbe; --line: #35435f; --coral: #f693a0; font-family: ui-monospace, SFMono-Regular, Consolas, monospace; }
#space { image-rendering: pixelated; }
button, .panel, .brand-mark, .segments button, #custom-duration, .viewfinder, .prep-step-number, .prep-pilots > span, .face-label, .signal-track i { border-radius: 0; }
button { border-width: 2px; box-shadow: 2px 2px 0 #060916; }
button:active:not(:disabled) { transform: translate(1px,1px); box-shadow: none; }
.panel { background: #101a30f5; border: 2px solid #41506c; box-shadow: 6px 6px 0 #050916; backdrop-filter: none; }
.brand-mark { font-size: 0; background: #91efbe; color: #102638; border: 0; box-shadow: inset 5px 5px 0 #b8fbd8, 3px 3px 0 #405b5c; }
.brand-mark::after { content: ':P'; font: bold 18px monospace; }
h1, h2 { font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-weight: 900; letter-spacing: -1.5px; text-shadow: 3px 3px 0 #273e50; }
h1 { font-size: clamp(32px,4.1vw,48px); }
h2 { font-size: 28px; }
.primary { background: #91efbe; border-color: #bdf7d4 #47866b #47866b #bdf7d4; }
.hud strong { font-weight: 800; letter-spacing: 0; font-size: 34px; text-shadow: 3px 3px #090d1d; }
.hud-right { color: #ffd65c; }
.hud-right strong::before { content: '◈ '; font-size: .7em; }
.hearts { display: block; color: #ff90a3; font: bold 24px/1.1 ui-monospace, monospace; letter-spacing: 5px; text-shadow: 2px 2px #471a38; }
.player-scores .hearts { margin-top: 4px; font-size: 20px; letter-spacing: 4px; color: #ff90a3; }
.player-scores strong { color: #ffd65c; }
.player-scores strong::before { content: '◈ '; font-size: .65em; }
.tracking-notice { position: absolute; z-index: 4; top: 30%; left: 50%; transform: translateX(-50%); max-width: 90%; width: max-content; padding: 10px 14px; border: 2px solid #ffd65c; color: #ffedb4; background: #151b31ee; font: bold 12px/1.5 monospace; text-align: center; box-shadow: 4px 4px #080d1d; }
.setup-actions { position: sticky; top: -1px; z-index: 3; background: #101a30; padding: 6px 0 12px; margin-bottom: 16px; border-bottom: 2px solid var(--line); }
.setup-actions .wide:first-child { margin-top: 0; }
.setup-actions .privacy { margin-top: 10px; line-height: 1.4; }
.prep-cue { display: flex; align-items: center; justify-content: center; gap: 14px; padding: 10px; margin-bottom: 10px; min-height: 62px; background: #233746; color: #a9f5c9; border: 2px solid currentColor; }
.prep-cue strong { font: 900 18px/1.2 monospace; letter-spacing: 1px; }
.cue-arrow { display: block; flex: none; width: 44px; height: 40px; background: currentColor; clip-path: polygon(0 40%,40% 0,40% 30%,100% 30%,100% 70%,40% 70%,40% 100%,0 60%); }
[data-action="right"] .cue-arrow { transform: rotate(180deg); }
[data-action="up"] .cue-arrow { transform: rotate(90deg); }
[data-action="stay"] .cue-arrow, [data-action="frame"] .cue-arrow { clip-path: polygon(0 0,30% 0,30% 15%,15% 15%,15% 85%,30% 85%,30% 100%,0 100%,0 0,100% 0,100% 100%,70% 100%,70% 85%,85% 85%,85% 15%,70% 15%,70% 0); position: relative; }
[data-action="go"] .cue-arrow { clip-path: polygon(0 30%,30% 30%,30% 0,70% 0,70% 30%,100% 30%,100% 70%,70% 70%,70% 100%,30% 100%,30% 70%,0 70%); }
#camera-panel[data-stage="center"] .prep-cue { color: #ffd65c; background: #3d3540; }
#camera-panel[data-stage="controls"] .prep-cue { color: #d9c5ff; background: #332d4b; }
.camera-actions { position: sticky; bottom: -1px; background: #101a30; padding-block: 6px; z-index: 2; }
.toast { color: #ffd65c; font-family: monospace; font-weight: bold; }
@media (max-width: 799px) {
  .panel { border-radius: 0; padding: 18px; }
  h1 { font-size: 36px; }
  .setup-intro .intro { margin-bottom: 8px; }
  .setup-actions { margin-bottom: 12px; }
  .hearts { font-size: 22px; }
}
@media (max-height: 540px) and (orientation: landscape) {
  .panel, body.playing #results, .message-panel { border-radius: 0; }
  #setup { grid-template-areas: "actions actions" "intro options"; gap: 10px 24px; }
  .setup-actions { top: -14px; padding: 6px 0 10px; margin: 0; }
  .setup-actions .privacy { display: none; }
  #setup .intro { font-size: 11px; }
  #setup h1 { font-size: 32px; }
  #camera-panel { gap: 6px 20px; grid-template-columns: 1fr 1fr; grid-template-areas: "steps steps" "intro visual" "actions actions"; }
  #camera-panel:not([data-stage="frame"]) { grid-template-areas: "steps steps" "intro visual" "actions visual"; }
  .camera-actions { padding: 0; }
  #camera-panel:not([data-stage="frame"]) .camera-actions { display: block; }
  #camera-panel h2 { font-size: 23px; margin-bottom: 8px; }
  #camera-panel .intro { font-size: 11px; line-height: 1.45; margin-bottom: 7px; }
  .prep-next { margin-top: 6px; font-size: 9px; }
  .prep-cue { min-height: 48px; padding: 5px; margin-bottom: 6px; }
  .prep-cue strong { font-size: 16px; }
  .cue-arrow { width: 36px; height: 30px; }
  .viewfinder, #camera-panel:not([data-stage="frame"]) .viewfinder { height: clamp(72px,23dvh,106px); margin-bottom: 5px; }
  .prep-progress-wrap { margin-block: 6px 0; }
  .prep-progress-copy { margin-bottom: 4px; }
  .prep-steps { padding-bottom: 5px; }
  .prep-pilots { margin-bottom: 4px; }
  .camera-intro .hint { font-size: 8px; line-height: 1.4; }
  .face-background-controls, .sensitivity { margin-top: 5px; }
  .hud strong { font-size: 25px; }
  .hearts { font-size: 20px; letter-spacing: 4px; }
  .player-scores .hearts { font-size: 16px; margin-top: 2px; }
  .player-scores strong { font-size: 18px; }
  .tracking-notice { top: 28%; font-size: 10px; padding: 6px 10px; }
  .toast { top: 31%; }
}
@media (max-height: 350px) and (orientation: landscape) {
  #camera-panel .prep-next, #camera-panel .camera-intro .hint { display: none; }
  #camera-panel .prep-cue { min-height: 40px; }
  #camera-panel .viewfinder, #camera-panel:not([data-stage="frame"]) .viewfinder { height: 74px; }
  #camera-panel .prep-cue strong { font-size: 14px; }
}
@font-face { font-family: 'Plank Pixel'; src: url('plank-pixel.woff') format('woff'); font-display: swap; }
h1, h2, .brand, .hud strong, .player-scores strong, .prep-cue strong, .countdown { font-family: 'Plank Pixel', ui-monospace, monospace; font-weight: 400; letter-spacing: 0; }
h1 { line-height: 1.3; font-size: clamp(30px,3.6vw,44px); }
h2 { line-height: 1.35; font-size: 25px; }
.prep-cue strong { font-size: 16px; line-height: 1.5; }
@media (max-height: 540px) and (orientation: landscape) {
  #setup h1 { font-size: 27px; }
  #camera-panel h2 { font-size: 20px; }
  .prep-cue strong { font-size: 14px; }
}
/* Mystery boxes give the face a new look immediately, with no coin balance. */
.hud-right { color: #d4b6ff; }
.hud-right strong::before, .player-scores strong::before { content: '? '; color: #d4b6ff; }
.filter-name { display: block; margin-top: 5px; max-width: 240px; color: #e4d3ff; font: 700 10px/1.4 ui-monospace, monospace; letter-spacing: .5px; }
.player-scores .filter-name { font-size: 9px; margin: 5px auto 0; letter-spacing: .25px; }
.buddy-mode #active-filter { display: none; }
.toast { color: #e1c9ff; }
@media (max-height: 540px) and (orientation: landscape) {
  .filter-name, .player-scores .filter-name { font-size: 8px; margin-top: 3px; max-width: 170px; }
  .player-scores .hearts { letter-spacing: 3px; }
}
