:root {
  --bg: #1a1a18;
  --panel: #23231f;
  --panel-2: #2c2c27;
  --field: #121210;
  --line: #44443c;
  --text: #ecebe2;
  --muted: #aeab9c;
  --yellow: #f2c200;
  --green: #9ad88c;
  --red: #ff8a7a;
  --mono: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
  --gutter: clamp(16px, 4vw, 48px);
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body { margin: 0; background: var(--bg); color: var(--text); font: 400 0.975rem/1.6 var(--mono); }
[hidden] { display: none !important; }
a { color: var(--yellow); text-underline-offset: 0.2em; }
h1, h2, h3 { margin: 0; font-weight: 700; line-height: 1.2; }
p { margin: 0; }
:focus-visible { outline: 2px solid var(--yellow); outline-offset: 2px; }

.skip { position: absolute; left: var(--gutter); top: -80px; z-index: 20; background: var(--yellow); color: #111; padding: 0.6rem 1rem; font-weight: 700; }
.skip:focus { top: 16px; }

/* Top bar */
.hazard { height: 10px; background: repeating-linear-gradient(-45deg, var(--yellow) 0 12px, #111 12px 24px); }
.topbar { border-bottom: 1px solid var(--line); }
.topbar-inner {
  display: flex; flex-wrap: wrap; align-items: center; gap: 0.75rem 1.75rem;
  max-width: 1240px; margin: 0 auto; padding: 14px var(--gutter);
}
.brand { display: inline-flex; align-items: center; gap: 0.65rem; color: var(--text); text-decoration: none; font-weight: 700; font-size: 1.05rem; }
.brand-box { background: var(--yellow); color: #111; padding: 0.15rem 0.4rem; font-size: 0.75rem; letter-spacing: 0.08em; }
.tld { color: var(--yellow); }
.topbar ul { display: flex; gap: 1.25rem; margin: 0; padding: 0; list-style: none; }
.topbar nav a { color: var(--text); text-decoration: none; }
.topbar nav a:hover { color: var(--yellow); text-decoration: underline; }
.status { margin-left: auto; display: inline-flex; align-items: center; gap: 0.5rem; color: var(--muted); font-size: 0.8rem; }
.led { width: 8px; height: 8px; border-radius: 50%; background: var(--green); box-shadow: 0 0 0 3px rgba(154, 216, 140, 0.2); animation: pulse 2.4s ease-in-out infinite; }
@keyframes pulse { 50% { box-shadow: 0 0 0 6px rgba(154, 216, 140, 0); } }

/* Intro */
.intro { max-width: 1240px; margin: 0 auto; padding: clamp(40px, 7vw, 96px) var(--gutter) clamp(28px, 4vw, 48px); }
.tag { color: var(--yellow); font-size: 0.8rem; letter-spacing: 0.08em; text-transform: uppercase; }
.intro h1 { font-size: clamp(1.9rem, 5.4vw, 4rem); letter-spacing: -0.04em; margin: 1rem 0 1.25rem; line-height: 1.08; }
.intro h1 span { color: var(--muted); }
.lede { max-width: 60ch; color: var(--muted); font-size: 1.02rem; }

/* Bench */
.bench {
  max-width: 1240px; margin: 0 auto clamp(48px, 7vw, 96px); padding: 0 var(--gutter);
  display: grid; grid-template-columns: 240px minmax(0, 1fr); align-items: start;
}
.tablist { display: flex; flex-direction: column; border: 1px solid var(--line); border-right: 0; background: var(--panel); }
.tablist [role="tab"] {
  display: grid; grid-template-columns: auto 1fr; grid-template-areas: "code name" "code desc"; gap: 0 0.8rem;
  text-align: left; padding: 1rem 1.1rem; border: 0; border-bottom: 1px solid var(--line); border-left: 4px solid transparent;
  background: transparent; color: var(--text); font: inherit; cursor: pointer;
}
.tablist [role="tab"]:last-child { border-bottom: 0; }
.tablist [role="tab"]:hover { background: var(--panel-2); }
.tablist [role="tab"][aria-selected="true"] { background: var(--field); border-left-color: var(--yellow); }
.tablist [role="tab"]:focus-visible { outline-offset: -4px; }
.tab-code { grid-area: code; color: var(--yellow); font-size: 0.8rem; padding-top: 0.15rem; }
.tab-name { grid-area: name; font-weight: 700; font-size: 1.05rem; }
.tab-desc { grid-area: desc; color: var(--muted); font-size: 0.8rem; }

.panels { border: 1px solid var(--line); background: var(--field); min-height: 520px; }
.panel { padding: clamp(18px, 3vw, 36px); }
.panel:focus-visible { outline-offset: -3px; }
.panel h2 { font-size: clamp(1.35rem, 2.6vw, 1.8rem); letter-spacing: -0.02em; }
.hint { color: var(--muted); margin: 0.5rem 0 1.5rem; max-width: 62ch; }

.fields { display: grid; gap: 1rem; margin-bottom: 1.25rem; }
.fields-4 { grid-template-columns: repeat(auto-fit, minmax(min(100%, 180px), 1fr)); }
.fields-1 { grid-template-columns: minmax(0, 560px); }
.field label { display: block; font-size: 0.8rem; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); margin-bottom: 0.4rem; }
.input-wrap { display: flex; align-items: stretch; border: 1px solid var(--line); background: var(--panel); }
.input-wrap:focus-within { border-color: var(--yellow); box-shadow: 0 0 0 1px var(--yellow); }
.input-wrap input, .field select {
  flex: 1; min-width: 0; width: 100%; border: 0; background: transparent; color: var(--text);
  font: 500 1.1rem/1.3 var(--mono); padding: 0.75rem 0.8rem;
}
.input-wrap input:focus, .field select:focus { outline: none; }
.field select { border: 1px solid var(--line); background: var(--panel); font-size: 1rem; padding: 0.82rem 0.8rem; }
.field select:focus-visible { border-color: var(--yellow); box-shadow: 0 0 0 1px var(--yellow); }
.input-wrap input::placeholder { color: #8a887c; }
.input-wrap input[aria-invalid="true"] { color: var(--red); }
.unit { display: grid; place-items: center; padding: 0 0.75rem; border-left: 1px solid var(--line); color: var(--muted); font-size: 0.8rem; }

.readout {
  display: block; padding: 1rem 1.1rem; margin-bottom: 1.5rem;
  background: var(--panel); border-left: 4px solid var(--yellow);
  font-size: clamp(1rem, 2.2vw, 1.3rem); font-weight: 600; overflow-wrap: anywhere;
}
.readout.is-error { border-left-color: var(--red); color: var(--red); }
.readout small { display: block; font-size: 0.85rem; font-weight: 400; color: var(--muted); margin-top: 0.25rem; }

.ref { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
.ref caption { text-align: left; color: var(--muted); font-size: 0.8rem; letter-spacing: 0.06em; text-transform: uppercase; padding-bottom: 0.5rem; }
.ref th, .ref td { text-align: left; padding: 0.55rem 0.6rem; border-top: 1px dashed var(--line); vertical-align: top; }
.ref th { color: var(--yellow); font-weight: 600; white-space: nowrap; width: 1%; }
.ref td.num { text-align: right; white-space: nowrap; }

.results { margin: 0 0 1.5rem; display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 220px), 1fr)); gap: 1px; background: var(--line); border: 1px solid var(--line); }
.results:empty { display: none; }
.results div { background: var(--panel); padding: 0.9rem 1rem; }
.results dt { font-size: 0.75rem; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); }
.results dd { margin: 0.25rem 0 0; font-size: 1.1rem; font-weight: 600; overflow-wrap: anywhere; }
.results dd.ok { color: var(--green); }
.results dd.bad { color: var(--red); }

.warning { border: 1px solid var(--red); color: var(--text); background: rgba(255, 138, 122, 0.08); padding: 0.9rem 1rem; margin-bottom: 1.25rem; }
.warning strong { color: var(--red); }

.footnote { color: var(--muted); font-size: 0.8rem; max-width: 80ch; }

/* Notes */
.notes { max-width: 1240px; margin: 0 auto; padding: 0 var(--gutter) clamp(56px, 8vw, 110px); }
.notes h2 { font-size: clamp(1.3rem, 2.6vw, 1.7rem); margin-bottom: 1.25rem; }
.notes h2::before { content: "// "; color: var(--yellow); }
.note-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 240px), 1fr)); gap: 1rem; }
.note-grid article { border: 1px solid var(--line); padding: 1.1rem; background: var(--panel); }
.note-grid h3 { font-size: 1rem; color: var(--yellow); margin-bottom: 0.4rem; }
.note-grid p { color: var(--muted); font-size: 0.9rem; }

.site-footer {
  border-top: 1px solid var(--line); padding: 1.5rem var(--gutter);
  display: flex; flex-wrap: wrap; justify-content: space-between; gap: 0.5rem 2rem; color: var(--muted); font-size: 0.85rem;
}

@media (max-width: 820px) {
  .bench { grid-template-columns: 1fr; }
  .tablist { flex-direction: row; overflow-x: auto; border-right: 1px solid var(--line); border-bottom: 0; }
  .tablist [role="tab"] { flex: 1 0 auto; border-bottom: 0; border-right: 1px solid var(--line); border-left: 0; border-top: 4px solid transparent; grid-template-areas: "code" "name"; grid-template-columns: auto; padding: 0.75rem 1rem; }
  .tablist [role="tab"][aria-selected="true"] { border-left-color: transparent; border-top-color: var(--yellow); }
  .tablist [role="tab"]:last-child { border-right: 0; }
  .tab-desc { display: none; }
  .tablist [role="tab"] { flex: 1 1 0; min-width: 0; padding: 0.7rem 0.55rem; }
  .tab-name { font-size: 0.95rem; }
  .status { margin-left: 0; width: 100%; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
