/* Road signs. Every name is a sign plate; the number on it is the points still on offer; hints hang under it as
   supplementary plates; solving it turns it green and bilingual. Colour and shape belong to the signs, the page stays quiet. */
@font-face { font-family: Overpass; src: url(/fonts/overpass.woff2) format("woff2"); font-weight: 100 900; font-display: swap; }

:root {
  --blue: #1d4f91;
  --green: #1b6b3a;
  --yellow: #ffcb05;
  --red: #c4281c;
  --ink: #14181c;
  --slate: #4f5b66;
  --paper: #ffffff;
  --sky: #e6ecf0;

  --color-bg: var(--sky);
  --color-text: var(--ink);
  --color-text-secondary: var(--slate);
  --color-surface: var(--paper);
  --color-action: var(--yellow);
  --color-on-action: var(--ink);

  --radius-face: 9px;
  --sign-pad: 5px;
  --radius-sign: calc(var(--radius-face) + var(--sign-pad));
  --radius-plate: 8px;
  --control: 3rem;
}

* { box-sizing: border-box; margin: 0; }
[hidden] { display: none !important; }
html { -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; }
body { background: var(--color-bg); color: var(--color-text); font: 500 1rem/1.5 Overpass, system-ui, sans-serif; padding: 0 1rem 4rem; }
body > * { max-width: 30rem; margin-inline: auto; }
ol { list-style: none; padding: 0; }
button { font: inherit; color: inherit; cursor: pointer; -webkit-tap-highlight-color: transparent; }
:focus-visible { outline: 3px solid var(--ink); outline-offset: 2px; }

.masthead { display: flex; align-items: baseline; justify-content: space-between; padding-block: 1.25rem 1rem; }
.masthead h1 { font-size: 1.25rem; font-weight: 800; line-height: 1.2; letter-spacing: -0.01em; }
.masthead time { color: var(--color-text-secondary); font-weight: 600; font-variant-numeric: tabular-nums; }

/* ---- sign ---- */
.sign { display: block; width: 100%; padding: var(--sign-pad); border: 0; border-radius: var(--radius-sign); background: var(--blue); color: var(--paper); text-align: start; }
.sign-face { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 0.75rem; min-height: 4.25rem; padding: 0.625rem 1rem; border: 2.5px solid currentColor; border-radius: var(--radius-face); }
.sign-name { display: block; font-size: clamp(1.5rem, 1.1rem + 2.2vw, 2rem); font-weight: 800; line-height: 1.1; letter-spacing: -0.01em; overflow-wrap: anywhere; }
.sign-sub { display: block; margin-top: 0.25rem; font-size: 1.125rem; font-weight: 700; line-height: 1.2; color: var(--yellow); }
.sign-num { display: inline-flex; align-items: center; gap: 0.375rem; font-size: clamp(1.5rem, 1.1rem + 2.2vw, 2rem); font-weight: 800; line-height: 1; font-variant-numeric: tabular-nums; }
.sign-num svg { width: 0.7em; height: 0.7em; }
.sign.won { background: var(--green); }
.sign.lost { background: var(--paper); color: var(--ink); box-shadow: inset 0 0 0 var(--sign-pad) var(--red); }
.sign.lost .sign-face { border-color: transparent; }
.sign.lost .sign-sub { color: var(--red); }
.sign.great { background: var(--yellow); color: var(--ink); }
.sign.great .sign-sub { color: var(--ink); }
@media (hover: hover) { button.sign.idle:hover { filter: brightness(1.12); } }

@media (prefers-reduced-motion: no-preference) {
  .sign.flip { animation: flip 360ms cubic-bezier(0.2, 0, 0, 1) both; }
  .sign.shake { animation: shake 320ms ease-out both; }
  .button:not(:disabled):active, .plate-button:not(:disabled):active { scale: 0.96; }
}
@keyframes flip { from { transform: perspective(40rem) rotateX(-88deg); opacity: 0.4; } }
@keyframes shake { 20% { translate: -7px 0; } 45% { translate: 6px 0; } 70% { translate: -4px 0; } 90% { translate: 2px 0; } }

/* ---- supplementary plates: hints, misses ---- */
.row { margin-bottom: 1.5rem; }
.plates { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-top: 0.5rem; }
.plates:empty { display: none; }
.plate, .plate-button { display: inline-flex; align-items: center; gap: 0.5rem; min-height: 2.25rem; padding: 0.25rem 0.75rem; border: 2px solid var(--ink); border-radius: var(--radius-plate); background: var(--color-surface); font-size: 0.9375rem; font-weight: 700; line-height: 1.2; white-space: nowrap; }
.plate.miss { border-color: transparent; background: transparent; color: var(--red); text-decoration: line-through; padding-inline: 0.25rem; }
.plate-button { border-style: dashed; background: transparent; transition: scale 150ms ease-out; }
.plate-button:disabled { opacity: 0.4; cursor: default; }
.plate-button .cost { color: var(--color-text-secondary); font-variant-numeric: tabular-nums; }
.note { margin-top: 0.5rem; color: var(--color-text-secondary); font-size: 0.9375rem; text-wrap: pretty; }
.note::first-letter { text-transform: uppercase; }

/* ---- entry: city combobox + guess ---- */
.entry { display: flex; gap: 0.5rem; margin-top: 0.75rem; }
.combo { position: relative; flex: 1; min-width: 0; }
.combo input { width: 100%; height: var(--control); padding-inline: 0.875rem; border: 2px solid var(--ink); border-radius: var(--radius-plate); background: var(--color-surface); color: var(--ink); font: 600 1.0625rem/1 Overpass, system-ui, sans-serif; }
.combo input::placeholder { color: var(--color-text-secondary); opacity: 1; }
.combo ul { position: absolute; z-index: 2; inset-inline: 0; top: calc(100% + 0.25rem); margin: 0; padding: 0.25rem; list-style: none; border: 2px solid var(--ink); border-radius: var(--radius-plate); background: var(--color-surface); max-height: 17rem; overflow-y: auto; overscroll-behavior: contain; }
.combo li { display: flex; align-items: center; min-height: 2.75rem; padding-inline: 0.625rem; border-radius: 5px; font-weight: 600; cursor: pointer; }
.combo li[aria-selected="true"] { background: var(--yellow); }
.button { height: var(--control); padding-inline: 1.25rem; border: 2px solid var(--ink); border-radius: var(--radius-plate); background: var(--color-action); color: var(--color-on-action); font-weight: 800; white-space: nowrap; transition: scale 150ms ease-out; }
.button:disabled { background: transparent; color: var(--color-text-secondary); border-color: var(--color-text-secondary); cursor: default; }

/* ---- end of the day ---- */
.result { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: 0.875rem 1rem; border: 2px solid var(--ink); border-radius: var(--radius-sign); background: var(--color-surface); }
.result strong { font-size: 2rem; font-weight: 800; line-height: 1; font-variant-numeric: tabular-nums; }

/* ---- admin ---- */
.tally { display: flex; align-items: center; gap: 0.375rem; font-weight: 800; font-variant-numeric: tabular-nums; }
.tally span { min-width: 2rem; padding: 0.125rem 0.5rem; border-radius: 6px; text-align: center; color: var(--paper); }
.tally .great { background: var(--yellow); color: var(--ink); }
.tally .good { background: var(--green); }
.tally .discard { background: var(--red); }
.tally .at { color: var(--color-text-secondary); font-weight: 600; }
.keys { display: grid; grid-template-columns: auto repeat(3, minmax(0, 1fr)) auto; gap: 0.375rem; margin-top: 1.5rem; font-size: 0.9375rem; }
.keys .button { padding-inline: 0.625rem; background: var(--color-surface); }
.keys .button kbd { font: inherit; color: var(--color-text-secondary); margin-inline-end: 0.25rem; }
