/* base.css — tokens, layout primitives and shared components. Screens add their own files. */

/* Anton (SIL Open Font License 1.1, see /fonts/OFL.txt), self-hosted: no third-party loads. */
@font-face {
  font-family: 'Anton';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url(/fonts/anton-latin-ext.woff2) format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: 'Anton';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url(/fonts/anton-latin.woff2) format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
:root {
  --bg: #16151b;
  --bg2: #201e27;
  --panel: #2a2733;
  --panel2: #34303f;
  --line: #4a4557;
  --ink: #f4efe2;
  --ink-dim: #b3aa98;
  --ink-faint: #7d7566;
  --hazard: #f8c630;
  --hazard-dark: #c99700;
  --danger: #ff4f3a;
  --ok: #5fd068;
  --steel: #6f7a86;
  --blue: #4f8cff;
  --pink: #ff8fc4;
  --paper: #f8f6ef;
  --radius: 14px;
  --shadow: 0 6px 0 rgba(0, 0, 0, 0.45);
  --font-display: 'Anton', 'Impact', 'Haettenschweiler', 'Arial Narrow Bold', 'Arial Black', 'Franklin Gothic Bold', sans-serif;
  --font-body: system-ui, -apple-system, 'Segoe UI', Roboto, Ubuntu, sans-serif;
  --safe-b: env(safe-area-inset-bottom, 0px);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--bg);
  background-image:
    radial-gradient(circle at 50% -20%, rgba(248, 198, 48, 0.08), transparent 60%),
    repeating-linear-gradient(90deg, rgba(255, 255, 255, 0.018) 0 2px, transparent 2px 64px),
    repeating-linear-gradient(0deg, rgba(255, 255, 255, 0.018) 0 2px, transparent 2px 64px);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 17px;
  line-height: 1.4;
  overflow-x: hidden;
  -webkit-tap-highlight-color: transparent;
  -webkit-text-size-adjust: 100%;
}
button, input { font: inherit; color: inherit; }

#app { min-height: 100%; display: flex; flex-direction: column; }
.screen {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
  max-width: 720px;
  margin: 0 auto;
  padding: 18px 16px calc(24px + var(--safe-b));
  gap: 14px;
}
.screen.wide { max-width: none; padding: 0; }
.center { justify-content: center; text-align: center; }
.grow { flex: 1; }
.row { display: flex; gap: 10px; align-items: center; justify-content: center; flex-wrap: wrap; }
.col { display: flex; flex-direction: column; gap: 10px; align-items: center; }
.hidden { display: none !important; }

/* ── type ───────────────────────────────────────────────────────────────── */
.display, h1, h2, h3 {
  font-family: var(--font-display);
  font-weight: 400; /* Anton and Impact come in one heavy weight; faux bold smears them */
  letter-spacing: 0.02em;
  text-transform: uppercase;
  margin: 0;
  line-height: 0.95;
}
h1 { font-size: clamp(38px, 9vw, 84px); }
h2 { font-size: clamp(26px, 6vw, 48px); }
h3 { font-size: clamp(20px, 4.4vw, 30px); }
.stamp {
  color: var(--hazard);
  text-shadow: 0 3px 0 #000, 3px 3px 0 #000, -2px 3px 0 #000;
  transform: rotate(-2deg);
}
.stamp.red { color: var(--danger); }
.stamp.white { color: var(--ink); }
.muted { color: var(--ink-dim); }
.faint { color: var(--ink-faint); font-size: 14px; }
.big-code {
  font-family: var(--font-display);
  font-size: clamp(64px, 18vw, 150px);
  letter-spacing: 0.08em;
  color: var(--paper);
  text-shadow: 0 5px 0 #000;
  line-height: 1;
}

/* ── controls ─────────────────────────────────────────────────────────────── */
.btn {
  appearance: none;
  border: 3px solid #000;
  border-radius: var(--radius);
  background: var(--hazard);
  color: #1b1500;
  font-family: var(--font-display);
  font-size: 24px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 12px 22px;
  min-height: 56px;
  box-shadow: var(--shadow);
  cursor: pointer;
  user-select: none;
  touch-action: manipulation;
  transition: transform 0.06s, box-shadow 0.06s, filter 0.2s;
}
.btn:active { transform: translateY(4px); box-shadow: 0 2px 0 rgba(0, 0, 0, 0.45); }
.btn:disabled { filter: grayscale(1) brightness(0.6); cursor: default; transform: none; }
.btn.secondary { background: var(--panel2); color: var(--ink); }
.btn.danger { background: var(--danger); color: #1a0500; }
.btn.ok { background: var(--ok); color: #031a05; }
.btn.small { font-size: 18px; min-height: 42px; padding: 6px 14px; border-width: 2px; }
.btn.block { width: 100%; }
.btn.huge { font-size: 34px; min-height: 76px; padding: 14px 30px; }

.input {
  width: 100%;
  border: 3px solid #000;
  border-radius: var(--radius);
  background: var(--paper);
  color: #111;
  font-family: var(--font-display);
  font-size: 30px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 10px 16px;
  text-align: center;
  box-shadow: var(--shadow);
  outline: none;
}
.input::placeholder { color: #9b958a; }

.panel {
  background: var(--panel);
  border: 3px solid #000;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 14px;
  width: 100%;
}
.hazard-bar {
  height: 14px;
  width: 100%;
  background: repeating-linear-gradient(-45deg, var(--hazard) 0 14px, #111 14px 28px);
  border: 2px solid #000;
}
.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--panel2);
  border: 2px solid #000;
  font-size: 14px;
  font-weight: 700;
}
.thumb { background: var(--paper); border: 3px solid #000; border-radius: 10px; }
.thumb.clear { background: transparent; border: none; }

/* ── toasts / overlays ──────────────────────────────────────────────────── */
#toast {
  position: fixed;
  left: 50%;
  bottom: calc(18px + var(--safe-b));
  transform: translateX(-50%);
  z-index: 100;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
  width: min(92vw, 520px);
}
.toast {
  background: var(--panel2);
  border: 3px solid #000;
  border-radius: 12px;
  padding: 10px 14px;
  box-shadow: var(--shadow);
  font-weight: 700;
  text-align: center;
  animation: toast-in 0.25s ease-out;
}
.toast.bad { background: var(--danger); color: #1a0500; }
@keyframes toast-in { from { transform: translateY(20px); opacity: 0; } }

.conn-banner {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 90;
  background: var(--danger);
  color: #1a0500;
  text-align: center;
  font-weight: 800;
  padding: 6px;
  border-bottom: 3px solid #000;
}

.footer-links { font-size: 13px; color: var(--ink-faint); }
.footer-links a { color: var(--ink-dim); }

/* Screen-wide flash used by countdowns and slams. */
@keyframes slam { 0% { transform: scale(2.6) rotate(-6deg); opacity: 0; } 60% { transform: scale(0.94) rotate(-2deg); opacity: 1; } 100% { transform: scale(1) rotate(-2deg); } }
@keyframes wobble { 0%, 100% { transform: rotate(-2deg); } 50% { transform: rotate(2deg); } }
@keyframes pulse { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.06); } }
@keyframes shake { 0%, 100% { transform: translate(0, 0); } 25% { transform: translate(-3px, 1px); } 50% { transform: translate(2px, -2px); } 75% { transform: translate(-1px, 2px); } }
.slam { animation: slam 0.45s cubic-bezier(0.2, 1.4, 0.5, 1) both; }
.wobble { animation: wobble 1.6s ease-in-out infinite; }
.pulse { animation: pulse 1.2s ease-in-out infinite; }

@media (prefers-reduced-motion: reduce) {
  .slam, .wobble, .pulse { animation: none; }
}
