:root {
  color-scheme: light;
  --paper: #f0ebdd;
  --ink: #23251e;
  --cream: #fff4dc;
  --orange: #fe7959;
  --lime: #d7ed85;
  --line: #a194794c;
  --display: "Arial Black", "Segoe UI", system-ui, sans-serif;
  --mono: "Cascadia Mono", Consolas, monospace;
  font-family: "Segoe UI", system-ui, sans-serif;
  background: var(--paper);
  color: var(--ink);
  font-synthesis: none;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; padding: 0 env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left); }
a { color: inherit; text-underline-offset: .23em; }
button { font: inherit; cursor: pointer; -webkit-tap-highlight-color: transparent; }
:focus-visible { outline: 3px solid #ab3c21; outline-offset: 4px; }
.wrap { width: min(1280px, calc(100% - 64px)); margin-inline: auto; }
.masthead { height: 72px; display: flex; justify-content: space-between; align-items: center; gap: .75rem; }
.masthead .brand { margin: 0; display: flex; align-items: center; gap: .65rem; font: 900 clamp(1.45rem, 3vw, 2.45rem)/1 var(--display); letter-spacing: -.075em; }
.brand-mark { flex: 0 0 auto; }
.header-link { display: grid; place-items: center; min-height: 44px; font-size: .9rem; font-weight: 650; white-space: nowrap; }
#game {
  --side: clamp(15px, 3.2vw, 55px);
  --pin: 46%;
  --target: 57%;
  --distance-start: 46%;
  --distance-end: 57%;
  position: relative;
  isolation: isolate;
  height: max(580px, calc(100dvh - 90px));
  overflow: hidden;
  color: var(--cream);
  background: radial-gradient(ellipse at 42% 34%, #3b4130 0%, #272c23 51%, #1c211d 95%);
  border: 1px solid #34362a;
  border-radius: 23px;
  box-shadow: 0 3px 0 #161a16, 0 11px 22px #322c1922;
  touch-action: manipulation;
  user-select: none;
}
#game:focus-visible, #game :focus-visible { outline-color: var(--lime); }
.waves { position: absolute; z-index: -1; width: 100%; height: 100%; inset: 0; color: #b6c27a34; pointer-events: none; }
.board {
  height: 100%; display: grid;
  grid-template-rows: 52px minmax(100px, .72fr) minmax(198px, 1.28fr) minmax(76px, 100px) 68px;
}
.instrument-header, .console { padding-inline: var(--side); display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.instrument-header { padding-top: 3px; }
.identity { display: flex; align-items: center; gap: 10px; font-size: 1rem; font-weight: 720; white-space: nowrap; }
.identity:has(#format-label:empty) { visibility: hidden; }
.pilot { width: 8px; height: 8px; border-radius: 50%; background: var(--lime); box-shadow: 0 0 13px #d7ed859c; }
.progress { display: flex; align-items: center; justify-content: center; gap: 14px; margin-left: auto; min-width: 0; }
#round { font: 700 .88rem/1.1 var(--mono); white-space: nowrap; }
#round-marks { display: flex; gap: 4px; }
#round-marks i { display: block; width: 13px; height: 5px; border: 1px solid #beb89f; border-radius: 6px; }
#round-marks i[data-state="done"] { background: #d1caad; }
#round-marks i[data-state="current"] { background: var(--orange); border-color: var(--orange); }
.icon-button { display: grid; place-items: center; width: 44px; height: 44px; border: 1px solid #817d65; border-radius: 50%; background: #21251f; color: var(--cream); }

.briefing { display: flex; flex-direction: column; justify-content: center; align-items: center; text-align: center; padding: 4px var(--side) 8px; }
.kicker { margin: 0 0 .45rem; color: var(--lime); font-size: clamp(.88rem, 1.55vw, 1.1rem); font-weight: 700; }
.briefing h2 { margin: 0; max-width: 24ch; font: 900 clamp(2.3rem, 4.7vw, 4.7rem)/1.01 var(--display); letter-spacing: -.065em; text-wrap: balance; }
.brief-status { margin: .55rem 0 0; color: #e8dfc7; font-size: clamp(.92rem, 1.5vw, 1.1rem); text-wrap: balance; }
.brief-status:empty, .kicker:empty { display: none; }
#game[data-phase="menu"] .briefing h2 { max-width: none; }
.meter { display: grid; grid-template-rows: minmax(44px, auto) minmax(74px, 1fr); margin-inline: var(--side); min-width: 0; }
.poles { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; align-items: end; padding: 0 0 10px; font: 750 clamp(1rem, 2vw, 1.56rem)/1.07 "Segoe UI", system-ui, sans-serif; letter-spacing: -.025em; }
.poles span:last-child { text-align: right; }
.scale { padding: 0 22px; position: relative; border-radius: 11px; }
#game[data-phase="guess"] .scale { cursor: ew-resize; touch-action: none; }
.rail { position: relative; height: 100%; min-height: 72px; }
.rail::before {
  content: ""; position: absolute; inset: 0 -22px; border-radius: 11px;
  background: linear-gradient(#1b1f1b, #39372c 7%, #1b201b 80%);
  box-shadow: inset 0 0 0 1px #7f795c, inset 0 6px 6px #10140e, 0 9px 16px #0f140c75;
}
.ruler {
  position: absolute; inset: 9px 0 26px; overflow: hidden; border-radius: 3px;
  background: repeating-linear-gradient(90deg, #3435210b 0 1px, transparent 1px 5%), linear-gradient(#d7c79b, #fff2cc 31%, #f1e2b2 80%, #bdad83);
  box-shadow: 0 0 0 1px #171a13, 0 0 0 5px #8f8662, 0 0 0 6px #161811;
}
.ruler::after {
  content: ''; position: absolute; inset: 38% 0 auto; height: 2px;
  background: #6459386e; box-shadow: 0 1px #fff3ccaf; pointer-events: none;
}
#game:is([data-phase="guess"], [data-phase="locked"]) .ruler::before {
  content: ''; position: absolute; inset: 0 auto 0 0; width: var(--pin);
  background: linear-gradient(90deg, #eca27420, #f5885c65);
}
.distance {
  display: none; position: absolute; z-index: 1; left: var(--distance-start); right: calc(100% - var(--distance-end)); top: 37%;
  height: 6px; background: #384023; box-shadow: 0 1px #fff3cc; border-radius: 10px;
}
#game:is([data-phase="menu"], [data-phase="reveal"])[data-show-target="true"] .distance { display: block; }
#game[data-phase="reveal"] .distance { animation: trace-in 190ms ease-out both; }
@keyframes trace-in { from { opacity: 0; scale: 0 1; } to { opacity: 1; scale: 1; } }
.ticks { position: absolute; inset: 0; color: #3b3b27; }
.numerals { position: absolute; bottom: 4px; inset-inline: 0; display: flex; justify-content: space-between; font: 700 clamp(.76rem, 1.3vw, 1rem)/1.4 var(--mono); color: #fbefd0; }
.numerals span:nth-child(2), .numerals span:nth-child(3), .numerals span:nth-child(4) { position: absolute; transform: translateX(-50%); }
.numerals span:nth-child(2) { left: 25%; }
.numerals span:nth-child(3) { left: 50%; }
.numerals span:nth-child(4) { left: 75%; }
.rail::after { content: ''; position: absolute; inset: 36% -15px auto; height: 6px; background: radial-gradient(circle, #afa278 0 1px, #151711 1.4px 2.8px, transparent 3.2px) left center / 6px 6px no-repeat, radial-gradient(circle, #afa278 0 1px, #151711 1.4px 2.8px, transparent 3.2px) right center / 6px 6px no-repeat; pointer-events: none; }
.target-target { position: absolute; inset: 0; opacity: 0; }
.zone { position: absolute; top: 0; bottom: 0; border-inline: 1px solid #30401189; }
.wide { left: calc(var(--target) - 17.5%); width: 35%; background: #b9b76e; }
.medium { left: calc(var(--target) - 11.5%); width: 23%; background: #c9d77c; }
.narrow { left: calc(var(--target) - 6.5%); width: 13%; background: #e6f4a1; }
.actual, .target-tip { position: absolute; display: none; left: var(--target); pointer-events: none; }
.actual { top: 9px; bottom: 26px; width: 2px; transform: translateX(-50%); background: #344419; z-index: 1; }
.target-tip { bottom: 23px; width: 13px; height: 13px; transform: translateX(-50%) rotate(45deg); background: var(--lime); border: 1px solid #30381f; z-index: 3; }
.shutter { display: none; position: absolute; inset: 8px -1px 25px; place-content: center; border-radius: 3px; color: #f9edca; background: repeating-linear-gradient(132deg, #555543 0 9px, #414234 9px 19px); font-weight: 700; }
.shutter span { padding: 4px 10px; background: #262922; border-radius: 4px; }
.carriage {
  position: absolute; z-index: 2; top: 2px; bottom: 24px; left: var(--pin); width: 5px;
  transform: translateX(-50%); background: #be3722; border-inline: 1px solid #61261b; pointer-events: none;
  filter: drop-shadow(2px 3px 1px #251d14a0);
}
.carriage span {
  position: absolute; left: 50%; top: 0; translate: -50% 0; display: grid; place-items: center; min-width: 48px; height: 39px;
  padding: 0 4px 4px; color: #291a13; background: var(--orange); border-radius: 4px 4px 0 0;
  clip-path: polygon(0 0,100% 0,100% 76%,50% 100%,0 76%); font: 850 1.1rem/1 var(--mono);
}
#game[data-phase="locked"] .carriage span { background: #ffc098; animation: latch 165ms ease-out; }
@keyframes latch { 45% { transform: translateY(3px); } }
#game[data-bullseye="true"] .target-tip { animation: target-hit 220ms ease-out both; }
@keyframes target-hit { 55% { scale: 1.45; box-shadow: 0 0 12px #f4ffaf; } }
#game[data-phase="private"] .shutter { display: grid; }
#game[data-phase="private"] .carriage { display: none; }
#game[data-show-target="true"] .shutter { display: none; }
#game[data-show-target="true"] :is(.actual, .target-tip) { display: block; }
#game[data-show-target="true"] .target-target { opacity: 1; animation: target-in 170ms ease-out both; }
#game:is([data-phase="private"], [data-phase="menu"]) .target-target { animation: none; }
#game:is([data-phase="won"], [data-phase="over"]) .target-target { display: none; }
#game:is([data-phase="won"], [data-phase="over"]) .ruler::before { content: ''; position: absolute; inset: 0 auto 0 0; width: var(--pin); background: linear-gradient(90deg, #c0cb7c, #e7f2ab); }
#game:is([data-phase="won"], [data-phase="over"]) .ruler::after { inset: auto 0 12% 0; height: 23%; background: repeating-linear-gradient(90deg, #3b3b27 0 1px, transparent 1px var(--score-step)); }
#game:is([data-phase="won"], [data-phase="over"]) .ticks { display: none; }
#game:is([data-phase="won"], [data-phase="over"]) .actual { background: #283511; }
#game:is([data-phase="won"], [data-phase="over"]) .briefing h2 { font-size: clamp(3.2rem, 9.5vh, 7rem); font-variant-numeric: tabular-nums; }
#game[data-phase="won"] .briefing h2 { color: var(--lime); }
@keyframes target-in { from { opacity: 0; } to { opacity: 1; } }

.response { display: flex; flex-direction: column; justify-content: center; text-align: center; padding: 5px var(--side); }
.response p { margin: 0 auto; max-width: 60ch; color: #e8dfc7; font-size: clamp(.92rem, 1.55vw, 1.1rem); line-height: 1.32; text-wrap: pretty; }
#result-line:not(:empty) { font-size: clamp(1.05rem, 2.4vw, 1.48rem); font-weight: 750; color: var(--lime); }
#reason:not(:empty) { margin-top: .27rem; }
#breakdown { display: flex; justify-content: center; gap: 6px; list-style: none; margin: 0 0 2px; padding: 0; }
#breakdown li {
  display: grid; place-items: center; width: clamp(29px, 5vw, 47px); height: 30px;
  border: 1px solid #a29b79; border-radius: 4px; font: 750 .95rem var(--mono);
  background: #1c2118; color: var(--cream);
}
#breakdown li[data-points="4"] { background: var(--lime); color: #252a1a; border-color: var(--lime); }
.console { justify-content: center; position: relative; background: #20241db8; }
.score { position: absolute; left: var(--side); display: flex; align-items: baseline; gap: .35rem; white-space: nowrap; font-family: var(--mono); }
.score-reading { display: grid; font-size: clamp(1.7rem, 3vw, 2.5rem); font-weight: 850; letter-spacing: -.12em; }
.score-reading > span { grid-area: 1 / 1; }
.score-roll { display: none; --rolling-score: var(--score-current); counter-reset: tally var(--rolling-score); }
.score-roll::before { content: counter(tally); }
@property --rolling-score { syntax: "<integer>"; initial-value: 0; inherits: false; }
@media (prefers-reduced-motion: no-preference) {
  #game[data-phase="reveal"]:not([data-reduced="true"]) #score-value { opacity: 0; }
  #game[data-phase="reveal"]:not([data-reduced="true"]) .score-roll { display: block; animation: score-up 250ms ease-out both; }
}
#score-cap { color: #ddcfab; font-size: .84rem; }
@keyframes score-up {
  from { --rolling-score: var(--score-previous); }
  50% { transform: translateY(-4px); color: var(--lime); }
  to { --rolling-score: var(--score-current); }
}
.action-row { display: flex; justify-content: center; gap: 10px; }
.button {
  display: inline-flex; align-items: center; justify-content: center; min-height: 49px; padding: .55rem 1.2rem;
  font-weight: 800; border: 1px solid transparent; border-radius: 7px; color: var(--cream);
  transition: background-color 140ms, transform 140ms; white-space: nowrap;
}
.button.primary { color: #201912; background: var(--orange); border-color: #ff9a79; box-shadow: 0 3px 0 #873b29; }
.button.secondary { color: var(--cream); background: #2e3227; border-color: #a49b7b; box-shadow: 0 3px 0 #171b16; }
.button:not(:disabled):active { transform: translateY(2px); }
.button:disabled { opacity: .48; cursor: default; }
.button[aria-disabled="true"] { box-shadow: none; cursor: default; }
#game[data-action-waiting="true"] #action { background: #dfab8c; }
#action { width: clamp(110px, 34vw, 146px); }
#round-buttons .nudge { min-width: 44px; padding-inline: 0; font: 800 1.25rem var(--mono); }
@media (hover: hover) {
  .button.primary:hover { background: #ff9a7e; }
  .button.secondary:hover, .icon-button:hover { background: #454631; }
}
#peek { touch-action: none; transition: transform 140ms; }
#peek[aria-pressed="true"], #peek[aria-pressed="true"]:hover { background: var(--lime); color: #242a1a; }
.overlay { position: absolute; inset: 0; display: grid; place-items: center; padding: 13px; background: #151a16de; z-index: 5; }
.pause-panel { width: min(100%, 385px); padding: 23px; border: 1px solid #a29670; border-radius: 13px; background: #272d23; box-shadow: 0 12px 35px #0c0e0b; }
.pause-panel h2 { margin: 0 0 12px; font: 900 2.25rem/1 var(--display); letter-spacing: -.08em; }
.switches { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; margin-bottom: 15px; }
.switches button { color: var(--cream); background: #20241c; min-height: 44px; border: 1px solid #81795c; border-radius: 5px; font-weight: 650; }
.switches button::after { content: attr(data-state-label); display: inline-block; white-space: nowrap; margin-left: 6px; font: bold .76rem var(--mono); color: #d9cdb0; }
.switches button[aria-pressed="true"]::after { color: var(--lime); }
.burst { position: absolute; inset: 0; pointer-events: none; z-index: 4; }
.burst i { position: absolute; top: 53%; left: 50%; width: 7px; height: 5px; border-radius: 2px; background: var(--lime); opacity: 0; animation: confetti 720ms ease-out both; }
.burst i:nth-child(even) { background: var(--orange); }
@keyframes confetti { 12% { opacity: .95; } to { translate: var(--dx) var(--dy); rotate: var(--spin); opacity: 0; } }
#game[data-celebrate="true"] { animation: victory 550ms ease-out; }
@keyframes victory { 28% { box-shadow: inset 0 0 75px #d7ed8554, 0 3px 0 #161a16; } }
#game[data-reduced="true"] *, #game[data-reduced="true"] { animation: none !important; transition: none !important; }
@media (prefers-reduced-motion: reduce) { #game *, #game { animation: none !important; transition: none !important; } }

.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.article { width: min(780px, calc(100% - 40px)); margin: clamp(45px, 8vw, 94px) auto 60px; font-size: 1.05rem; line-height: 1.65; }
.article header { padding-bottom: 1.2rem; border-bottom: 1px solid #9a8f75; }
.article h1, .article h2 { font-family: var(--display); line-height: 1.05; letter-spacing: -.06em; text-wrap: balance; }
.article h1 { font-size: clamp(2.4rem, 8vw, 4.7rem); margin: .6rem 0 1rem; }
.article h2 { font-size: clamp(1.65rem, 4vw, 2.5rem); margin: 2rem 0 .7rem; }
.article p { margin: .7rem 0; }
.article a, .footer a { font-weight: 650; }
.article li { margin-block: .45rem; }
.article dt { font-weight: 750; margin-top: .8rem; }
.article dd { margin: .15rem 0 .7rem; }
.article table { width: 100%; border-collapse: collapse; margin-block: 1.2rem; }
.article th, .article td { padding: .6rem; border-bottom: 1px solid #9a8f75; text-align: left; }
.footer { display: flex; flex-wrap: wrap; gap: 0 1.2rem; border-top: 1px solid #9a8f75; padding-bottom: 1rem; }
.footer a { min-height: 44px; display: inline-grid; place-items: center; }
.language-links { display: flex; flex-wrap: wrap; gap: 0 1.2rem; padding-top: .5rem; }
.language-links a { display: inline-flex; align-items: center; min-height: 44px; font-size: .9rem; }
.language-links [aria-current="page"] { text-decoration: none; }
.article header h1 { font-size: clamp(1.65rem, 4vw, 2.5rem); margin: 0 0 .7rem; }
html:not([lang="en"]) #game .button { white-space: normal; text-align: center; overflow-wrap: anywhere; min-width: 0; }
html:not([lang="en"]) #game .button.nudge { min-width: 44px; }
.switches { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.switches button { overflow-wrap: anywhere; }

@media (min-width: 1500px) {
  .wrap { width: min(1440px, calc(100% - 96px)); }
}

@media (min-width: 701px) and (min-height: 850px) {
  .board { grid-template-rows: 56px minmax(100px, .8fr) minmax(205px, 1.2fr) minmax(90px, 105px) 76px; }
  .carriage span { min-width: 55px; height: 43px; }
  .button { min-height: 54px; }
}

@media (max-width: 700px) {
  .wrap { width: calc(100% - 20px); }
  .masthead { height: 60px; padding-inline: 4px; }
  .brand-mark { width: 31px; height: 31px; }
  .masthead .brand { gap: .48rem; }
  .header-link { font-size: .86rem; }
  #game { --side: 13px; height: max(525px, calc(100dvh - 75px)); border-radius: 14px; }
  .board { grid-template-rows: 50px minmax(115px, .83fr) minmax(170px, 1.17fr) minmax(89px, 105px) 62px; }
  .instrument-header { padding-top: 0; }
  .briefing h2 { font-size: clamp(1.82rem, 8.7vw, 3.1rem); max-width: 17ch; }
  #game[data-long-clue="true"] .briefing h2 { font-size: clamp(1.34rem, 7.05vw, 2.45rem); max-width: 23ch; }
  #game[data-phase="menu"] .briefing h2 { font-size: clamp(2.34rem, 10vw, 3.85rem); }
  .progress { gap: 0; }
  #round-marks { display: none; }
  .scale { padding-inline: 18px; }
  .rail::before { inset-inline: -18px; }
  .console { gap: 6px; }
  .score { position: static; margin-right: auto; gap: .22rem; }
  #score-cap { font-size: .74rem; }
  .action-row { gap: 7px; }
  .button { padding-inline: .78rem; font-size: .94rem; }
  #game[data-phase="menu"] .button { min-width: min(136px, 39vw); }
}

@media (max-height: 600px) and (orientation: landscape) {
  .masthead { height: 50px; }
  .masthead .brand { font-size: 1.5rem; }
  .brand-mark { width: 28px; height: 28px; }
  #game { --side: 20px; height: max(306px, calc(100dvh - 60px)); border-radius: 13px; }
  .board { grid-template-rows: 46px minmax(55px, .8fr) minmax(91px, 1fr) minmax(63px, 68px) 51px; }
  .instrument-header { padding-top: 0; }
  .briefing { padding-block: 0; }
  .briefing h2, #game[data-phase="menu"] .briefing h2, #game[data-long-clue="true"] .briefing h2 { max-width: none; font-size: clamp(1.6rem, 5.3vh, 2.25rem); }
  #game:is([data-phase="won"], [data-phase="over"]) .briefing h2 { font-size: clamp(1.85rem, 8vh, 3rem); }
  .briefing .kicker { margin-bottom: .15rem; }
  .briefing .brief-status { margin-top: .15rem; }
  .meter { grid-template-rows: minmax(22px, auto) minmax(58px, 1fr); }
  .poles { padding-bottom: 4px; font-size: 1rem; }
  .rail { min-height: 58px; }
  .numerals { font-size: .7rem; }
  .carriage span { min-width: 40px; height: 30px; font-size: .95rem; }
  .response { padding-block: 1px; }
  .response p { max-width: none; }
  #reason:not(:empty) { margin-top: 0; }
  .button { min-height: 44px; }
}

@media (max-height: 630px) and (orientation: portrait) {
  #game { height: max(502px, calc(100dvh - 68px)); }
  .board { grid-template-rows: 47px minmax(114px, .9fr) minmax(149px, 1.1fr) minmax(90px, 102px) 60px; }
  .briefing h2 { font-size: clamp(1.7rem, 8.15vw, 2.4rem); }
}

@media (max-width: 340px) {
  .header-link { font-size: .76rem; }
  .masthead .brand { font-size: 1.25rem; }
  #game { --side: 11px; }
  .button { padding-inline: .58rem; }
}

@media (max-width: 430px) and (orientation: portrait) {
  html:not([lang="en"]) #game[data-phase="menu"] .briefing h2 {
    font-size: clamp(1.7rem, 8vw, 2.15rem);
  }
  html:not([lang="en"]) #game[data-long-clue="true"] .briefing h2 {
    font-size: clamp(1.3rem, 6.4vw, 1.65rem);
    max-width: none;
    overflow-wrap: anywhere;
  }
  html:not([lang="en"]) #game[data-phase="private"] #round-buttons {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    width: 100%;
  }
  html:not([lang="en"]) #game[data-phase="private"] #action {
    width: auto;
  }
}
