/* blurt · systemfun - see brand.md. Ink, paper, chalk, and one game colour.
   Orange means the zone you're aiming for; everything else is ink. Nothing is rounded.
   Inter Tight says the words, JetBrains Mono the numbers, Departure Mono the machine's labels. */
@font-face { font-family: "Departure Mono"; src: url(https://cdn.jsdelivr.net/gh/rektdeckard/departure-mono@main/public/assets/DepartureMono-Regular.woff2) format("woff2"); }
:root {
  --paper: #fefefe; --ink: #1e1e1e; --chalk: #f4f2ea; --game: #ff5a1f;
  --muted: rgba(30,30,30,.55); --faint: rgba(30,30,30,.32);
  --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  --label: "Departure Mono", var(--mono);
  --sans: "Inter Tight", Inter, -apple-system, system-ui, sans-serif;
  --ease-out: cubic-bezier(.23, 1, .32, 1);
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--game); color: var(--ink);
  font: 17px/1.4 var(--sans); -webkit-font-smoothing: antialiased; }

/* The ground is the game's colour under a 1-bit dot grid. */
.ground { position: fixed; inset: 0; pointer-events: none; z-index: 0; overflow: hidden; }
.ground .dots { position: absolute; inset: 0; background-image: radial-gradient(var(--ink) .7px, transparent .8px); background-size: 6px 6px; opacity: .16; }

#app { position: relative; z-index: 1; max-width: 560px; margin: 34px auto; padding: 0 24px 40px;
  min-height: calc(100vh - 68px); background: var(--paper); border: 1.5px solid var(--ink); }
/* The panel is an app window: a black title bar with its name and its body part. */
.titlebar { display: flex; justify-content: space-between; margin: 0 -24px 18px; padding: 3px 8px;
  background: var(--ink); color: var(--paper); font: 13px var(--label); }
@media (max-width: 600px) { .titlebar { margin: 0 -16px 14px; } }
@media (max-width: 600px) { #app { margin: 0; min-height: 100vh; border: 0; padding: 0 16px 30px; } }

/* Crop marks: hairline corner brackets, set just inside the panel edge. */
#app::before, #app::after { content: ""; position: absolute; width: 13px; height: 13px; pointer-events: none; }
#app::before { top: 34px; left: 9px; border-top: 1px solid var(--ink); border-left: 1px solid var(--ink); }
#app::after { bottom: 9px; right: 9px; border-bottom: 1px solid var(--ink); border-right: 1px solid var(--ink); }

header { display: flex; justify-content: space-between; align-items: center; }
.brand { height: 40px; width: auto; display: block; }
.timer { font-family: var(--mono); font-size: 30px; letter-spacing: -.02em; min-height: 42px; transition: color .2s; }
.timer:not(:empty)::after { content: "s"; font-size: .5em; color: var(--muted); margin-left: 2px; }
.timer.urgent { color: var(--game); }
.progress { height: 6px; background: var(--paper); border: 1px solid var(--ink); margin-top: 14px; overflow: hidden; }
.progress-fill { height: 100%; width: 100%; background: var(--ink); transform-origin: left;
  transition: transform 1s linear, background .3s; }
.progress-fill.urgent { background: var(--game); }
.done .progress { visibility: hidden; }

.question { margin: 30px 0 0; }
.question-text { font-size: 31px; font-weight: 500; letter-spacing: -.035em; line-height: 1.08; margin: 0; }
/* The target has one look everywhere: an ink tag with paper numerals. */
.tgt { display: inline-block; font-family: var(--mono); font-size: .62em; font-weight: 400; letter-spacing: 0;
  background: var(--ink); color: var(--paper); padding: 2px 7px 3px; vertical-align: .2em; margin-left: 4px; }

/* ---- The dial: a rim, three numbers, a tick for every throw ---- */
#dial { display: block; width: 100%; height: auto; margin-top: 6px; overflow: visible; }
.mark { opacity: .5; transition: opacity .2s; animation: fade 260ms var(--ease-out) both; }
.mark.on { opacity: 1; }
.mark .num { opacity: 0; } .mark.on .num { opacity: 1; }
@keyframes fade { from { opacity: 0; } }

/* ---- The end: the screen becomes the share card ---- */
.date { display: none; font-family: var(--mono); font-size: 11px; }
.ended .date { display: none; } .ended .timer { display: none; }
.ended .progress, .ended #dial, .ended .plate { display: none; }
.ended .question { margin-top: 20px; }
.ended .question-text { font-size: 19px; font-weight: 500; letter-spacing: -.01em; line-height: 1.16; }
.ended .question-text .tgt { font-size: 12px; vertical-align: .15em; }
.card-dial { display: none; }
.ended .card-dial { display: block; width: calc(100% + 48px); margin: 12px -24px 0; height: auto; overflow: hidden; }
@media (min-width: 601px) { .ended#app { max-width: 440px; } }
@media (max-width: 600px) { .ended .card-dial { width: calc(100% + 32px); margin: 12px -16px 0; }
  .ended#app { min-height: 100dvh; padding-bottom: 16px; } .ended .result .actions button { margin-top: 12px; } }

/* The plate under the pivot, like the label on a gauge: the word in focus and its number.
   It sits below the dial's baseline so the needle can never cross it; fixed height so nothing jumps. */
.plate { height: 78px; text-align: center; }
.plate .w { font-size: 24px; line-height: 1.12; font-weight: 500; letter-spacing: -.01em;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.plate .w.long { font-size: 19px; } .plate .w.vlong { font-size: 15px; }
.plate .n { font-family: var(--mono); font-size: 15px; margin-top: 4px; min-height: 1.3em; }
.plate.hunting .w { color: var(--muted); }
.plate.landed { animation: land 280ms var(--ease-out) both; }
@keyframes land { from { transform: scale(.97); opacity: .6; } }
.low, .high, .hit { color: var(--ink); } .error { color: var(--muted); }
/* Verdicts are small black labels, never colours. "just nice" wears the game colour: it's in the zone. */
.plate .n { display: flex; justify-content: center; align-items: center; gap: 8px; }
.plate .v { font: 13px var(--label); background: var(--ink); color: var(--paper); padding: 1px 7px; }
.plate .n.hit .v { background: var(--game); color: var(--ink); }

/* ---- Entry: a terminal line. Focus is a hard ink offset, never a colour ---- */
.entry input { width: 100%; font: 20px/1.3 var(--mono); padding: 12px 12px; background: var(--paper); text-align: center;
  border: 1px solid var(--ink); color: var(--ink); outline: none; transition: box-shadow .12s; border-radius: 0; }
.entry input::placeholder { color: rgba(30,30,30,.32); }
.entry input:focus { box-shadow: 3px 3px 0 var(--ink); }
.entry input:disabled { opacity: .45; }
.done .entry { display: none; }

/* ---- A round on a phone: the page is exactly the space above the keyboard ---- */
@media (max-width: 700px) {
  body.playing { overflow: hidden; }
  body.playing #app { position: fixed; left: 0; right: 0; top: var(--vvt, 0px); height: var(--vvh, 100dvh); min-height: 0;
    margin: 0; border: 0; display: flex; flex-direction: column; padding: 0 16px 12px; }
  body.playing #app::before, body.playing #app::after { display: none; }
  body.playing .titlebar { flex: none; margin-bottom: 10px; }
  body.playing .brand { height: 32px; }
  body.playing .timer { font-size: 22px; min-height: 30px; }
  body.playing .progress { margin-top: 10px; flex: none; }
  body.playing .question { margin-top: 12px; flex: none; }
  body.playing .question-text { font-size: 22px; }
  body.playing #dial { flex: 1 1 0; min-height: 70px; height: auto; margin-top: 4px; }
  body.playing .plate { flex: none; height: 60px; }
  body.playing .plate .w { font-size: 20px; } body.playing .plate .w.long { font-size: 17px; } body.playing .plate .w.vlong { font-size: 14px; }
  body.playing .plate .n { font-size: 13px; margin-top: 2px; }
  body.playing .entry { flex: none; }
  body.playing .entry input { font-size: 17px; padding: 10px; }
}

/* ---- After the round: the score, then share and play again ---- */
.result { display: none; text-align: center; }
.after .result { display: block; animation: fade 400ms var(--ease-out) both; }
.result .footer { font-family: var(--mono); font-size: 11px; color: var(--muted); margin: 8px 0 0; }
.result .actions { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }
.result .actions button { margin-top: 18px; }
button.secondary { background: var(--paper); color: var(--ink); }
button.secondary:hover { background: var(--ink); color: var(--paper); }

/* ---- Overlays as system windows ---- */
.overlay { position: absolute; inset: 28px 0 0; background: var(--paper); display: flex; flex-direction: column;
  align-items: center; justify-content: center; text-align: center; padding: 24px; z-index: 3; }
.overlay.hidden { display: none; }
.overlay h1 { font: 400 108px/1 "Rubik Spray Paint"; margin: 0 0 18px; transform: rotate(-8deg); }
.overlay .tag { font: 500 28px/1.1 var(--sans); letter-spacing: -.035em; color: var(--ink); margin: 0 0 14px; }
.overlay .credit { position: absolute; bottom: 22px; font: 12px var(--label); color: var(--muted); }
.overlay .credit:hover { color: var(--ink); }
.overlay p { color: var(--muted); font-family: var(--mono); font-size: 14px; line-height: 1.7; margin: 0; }
button { font: 14px/1 var(--label); letter-spacing: .04em; text-transform: lowercase; padding: 13px 26px;
  border: 1px solid var(--ink); background: var(--ink); color: var(--chalk); cursor: pointer;
  margin-top: 26px; transition: background .12s, color .12s, box-shadow .12s; border-radius: 0; }
button:hover { background: var(--paper); color: var(--ink); box-shadow: 3px 3px 0 var(--ink); }
button:active { box-shadow: none; transform: translate(1px, 1px); }
button.hidden { display: none; }
.shake { animation: shake .35s; }
@keyframes shake { 0%,100% { transform: none } 25% { transform: translateX(-6px) } 75% { transform: translateX(6px) } }
@keyframes pop { from { transform: scale(.6); opacity: 0; } to { transform: scale(1); opacity: 1; } }
@keyframes pulse { from { opacity: .2 } to { opacity: 1 } }

/* ---- Tutorial ---- */
.tutor { display: flex; justify-content: space-between; align-items: baseline; gap: 16px; padding: 14px 12px;
  border: 1px solid var(--ink); border-top-width: 20px; font-family: var(--mono); font-size: 15px; line-height: 1.5;
  animation: pop .2s ease-out; } /* the thick top edge reads as a dialog title bar */
.tutor.hidden { display: none; }
.tutor-next { flex: none; font-size: 10px; color: var(--muted); text-transform: uppercase;
  letter-spacing: .08em; animation: pulse 1s infinite alternate; }
button.ghost { position: absolute; top: 24px; left: 0; right: 0; margin: 0 auto; width: max-content;
  padding: 8px 12px; font-size: 11px; background: var(--paper); color: var(--ink); border: 1px solid var(--ink); }
button.ghost:hover { background: var(--chalk); color: var(--ink); box-shadow: none; }
#form.hidden { display: none; }

.countdown { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  pointer-events: none; z-index: 2; }
.countdown.hidden { display: none; }
#countdown-num { font-family: var(--mono); font-size: 128px; letter-spacing: -.04em; line-height: 1;
  user-select: none; animation: countPop .35s ease-out; margin-top: 90px; }
@keyframes countPop { from { transform: scale(.45); opacity: 0; } to { transform: scale(1); opacity: 1; } }

/* ---- Start screen question preview ---- */
.preview { margin-top: 24px !important; color: var(--ink) !important; }
button.link { display: inline; margin: 0 0 0 8px; padding: 3px 8px; font-size: 10px;
  background: var(--paper); color: var(--ink); border: 1px solid var(--ink); }
button.link:hover { background: var(--chalk); color: var(--ink); box-shadow: none; }

/* ---- Desktop: the window hugs its content and sits in the middle of the orange,
   with the arcade's logo and credits line outside it, like the home page ---- */
.page-top, .page-foot { display: none; }
.stage { width: 100%; }
@media (min-width: 601px) { .stage { width: 560px; } .stage:has(.ended) { width: 440px; } }
@media (min-width: 601px) {
  body { min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 28px 0; }
  #app { min-height: 0; margin: 0 auto; width: 100%; }
  .page-top, .page-foot { display: flex; justify-content: space-between; align-items: center; width: 100%; max-width: 560px;
    position: relative; z-index: 1; font: 12px var(--label); }
  .page-top { margin-bottom: 14px; } .page-foot { margin-top: 14px; }
  .page-top img { height: 38px; }
  .page-foot a { color: inherit; }
  #app .brand { display: none; }
  .ended ~ .page-foot, .ended ~ .page-top { max-width: 440px; }
}
