/* F1 Tools — shared styles for every page. Layout: starfield behind, header (brand left, logo right), menu bar, one tool panel per page */
/* Fonts are bundled in /fonts so they load from this site on every device */
@font-face { font-family: "Anton"; font-style: normal; font-weight: 400; font-display: swap; src: url("/fonts/anton.woff2") format("woff2"); }
@font-face { font-family: "Unbounded"; font-style: normal; font-weight: 800; font-display: swap; src: url("/fonts/unbounded-800.woff2") format("woff2"); }
@font-face { font-family: "VT323"; font-style: normal; font-weight: 400; font-display: swap; src: url("/fonts/vt323.woff2") format("woff2"); }
@font-face { font-family: "Inter"; font-style: normal; font-weight: 400; font-display: swap; src: url("/fonts/inter-400.woff2") format("woff2"); }
@font-face { font-family: "Inter"; font-style: normal; font-weight: 500; font-display: swap; src: url("/fonts/inter-500.woff2") format("woff2"); }
@font-face { font-family: "Inter"; font-style: normal; font-weight: 600; font-display: swap; src: url("/fonts/inter-600.woff2") format("woff2"); }
@font-face { font-family: "Inter"; font-style: normal; font-weight: 700; font-display: swap; src: url("/fonts/inter-700.woff2") format("woff2"); }
:root {
  --bg: #000000;
  --panel: rgb(16 16 16 / .92);
  --raise: #1c1c1c;
  --line: #2a2a2a;
  --ink: #f5f5f5;
  --muted: #8d8d8d;
  --red: #e10600;
  --red-ink: #ffffff;
  --lcd: #050505;
  --lcd-ink: #ff3b30;
  --lcd-dim: #6e2420;
  --f-display: "Anton", "Impact", "Arial Narrow", sans-serif;
  --f-brand: "Unbounded", "Arial Black", sans-serif;
  --f-body: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  --f-lcd: "VT323", ui-monospace, monospace;
  --r: 10px;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { background: var(--bg); }
body { -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; margin: 0; background: var(--bg); color: var(--ink); font: 15px/1.5 var(--f-body); padding-inline: 16px; padding-block: 0 48px; min-height: 100vh; }
#stars { position: fixed; inset: 0; width: 100%; height: 100%; z-index: 0; pointer-events: none; }
.wrap { position: relative; z-index: 1; max-width: 780px; margin-inline: auto; display: grid; gap: 22px; }

/* Header */
header { display: flex; justify-content: space-between; align-items: center; gap: 16px; padding-top: 20px; }
.brand { font: 800 clamp(1.6rem, 5.5vw, 2.4rem)/1 var(--f-brand); text-transform: uppercase; letter-spacing: .01em; color: var(--ink); text-decoration: none; }
.brand span { color: var(--red); }
.logo { width: clamp(58px, 13vw, 90px); height: auto; border-radius: 4px; flex-shrink: 0; }

/* Menu: segmented selector, always one line; the active tab sits on a tinted pill */
.menu { display: flex; flex-wrap: nowrap; gap: 4px; padding: 4px; background: rgb(255 255 255 / .04); border: 1px solid var(--line); border-radius: var(--r); }
.menu a {
  flex: 1 1 auto; min-width: 0; text-align: center; white-space: nowrap;
  color: var(--muted); text-decoration: none; padding: 11px clamp(6px, 2vw, 16px);
  font: 400 clamp(13px, 4vw, 1.15rem)/1 var(--f-display); text-transform: uppercase; letter-spacing: .03em;
  border-radius: 7px; transition: background .15s, color .15s;
}
.menu a:hover { color: var(--ink); background: rgb(255 255 255 / .06); }
.menu a[aria-current="page"] { color: var(--ink); background: rgb(225 6 0 / .2); box-shadow: inset 0 0 0 1px rgb(225 6 0 / .55); }

/* Page heading */
.page-head { display: grid; gap: 4px; }
.eyebrow { font: 700 12px var(--f-body); letter-spacing: .22em; text-transform: uppercase; color: var(--red); }
h1 { margin: 0; font: 400 clamp(2.6rem, 11vw, 4.4rem)/.95 var(--f-display); text-transform: uppercase; letter-spacing: .005em; text-wrap: balance; }
.lede { margin: 0; color: var(--muted); max-width: 60ch; }

/* Tool panel */
.unit { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); padding: 18px; display: grid; gap: 18px; }

/* Dash readout */
.lcd { background: var(--lcd); border: 1px solid var(--line); border-left: 4px solid var(--red); border-radius: 6px; padding: 16px 20px 12px; display: grid; gap: 6px; min-width: 0; box-shadow: inset 0 2px 12px rgb(0 0 0 / .8); }
.lcd-row { display: flex; justify-content: space-between; gap: 10px; font: 20px/1 var(--f-lcd); color: var(--lcd-dim); letter-spacing: .06em; }
.lcd-big { font: clamp(2.4rem, 9vw, 4.4rem)/1 var(--f-lcd); color: var(--lcd-ink); text-shadow: 0 0 14px rgb(255 59 48 / .45); overflow-wrap: anywhere; min-height: 1em; }
.lcd-big.click { cursor: pointer; }
.flash { animation: flick .18s steps(2); }
@keyframes flick { 50% { opacity: .2; } }

.label { font: 700 11px var(--f-body); letter-spacing: .16em; text-transform: uppercase; color: var(--muted); }
.pads { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 8px; }
.pad { appearance: none; border: 1px solid var(--line); background: var(--raise); color: var(--ink); border-radius: 6px; padding: 12px; font: 600 14px var(--f-body); cursor: pointer; text-align: left; }
.pad small { display: block; font-size: 11px; color: var(--muted); font-weight: 400; }
.pad[aria-pressed="true"] { background: var(--red); border-color: var(--red); color: var(--red-ink); }
.pad[aria-pressed="true"] small { color: var(--red-ink); opacity: .8; }

.row { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; }
.row.between { justify-content: space-between; }
.toggle { display: inline-flex; align-items: center; gap: 8px; font-size: 14px; cursor: pointer; user-select: none; }
.toggle input { accent-color: var(--red); width: 16px; height: 16px; }
.go {
  appearance: none; border: 0; background: var(--red); color: var(--red-ink); cursor: pointer; margin-left: auto;
  font: 400 1.4rem/1 var(--f-display); text-transform: uppercase; letter-spacing: .04em; padding: 16px 30px; border-radius: 12px;
  box-shadow: 0 6px 24px rgb(225 6 0 / .35); transition: transform .08s, filter .15s;
}
.go:hover { filter: brightness(1.08); }
.go:active { transform: scale(.98); }
.go kbd { font: 500 11px var(--f-body); opacity: .7; margin-left: 10px; letter-spacing: 0; text-transform: none; vertical-align: middle; }
@media (hover: none) { .go kbd { display: none; } }
.go.wide { width: 100%; margin-left: 0; padding-block: clamp(18px, 4.5vw, 28px); font-size: clamp(2.2rem, 10vw, 2.8rem); }
.ghost { appearance: none; background: none; border: 1px solid var(--line); color: var(--ink); border-radius: 6px; padding: 9px 14px; font: 600 13px var(--f-body); cursor: pointer; text-decoration: none; }
.hint { color: var(--muted); font-size: 13px; margin: 0; }

.field { display: inline-flex; align-items: center; gap: 10px; }
.field input { width: 110px; background: var(--lcd); color: var(--ink); border: 1px solid var(--line); border-radius: 6px; padding: 10px 12px; font: 600 18px var(--f-body); font-variant-numeric: tabular-nums; }

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
th, td { padding: 10px 12px; text-align: right; border-bottom: 1px solid var(--line); white-space: nowrap; }
th:first-child, td:first-child { text-align: left; }
thead th { font: 700 11px var(--f-body); letter-spacing: .14em; text-transform: uppercase; color: var(--muted); }
tbody td { cursor: pointer; }
tbody td:not(:first-child):hover { color: var(--red); }
td:first-child { font-weight: 700; }
td small { color: var(--muted); font-weight: 400; margin-left: 4px; }

a:focus-visible, button:focus-visible, input:focus-visible { outline: 2px solid var(--red); outline-offset: 2px; }
@media (prefers-reduced-motion: reduce) { .flash { animation: none; } }

.toast { position: fixed; z-index: 2; left: 50%; bottom: calc(20px + env(safe-area-inset-bottom, 0px)); transform: translateX(-50%); background: var(--red); color: var(--red-ink); padding: 9px 18px; border-radius: 999px; font: 600 13px var(--f-body); opacity: 0; pointer-events: none; transition: opacity .2s; }
.toast.show { opacity: 1; }
