:root {
  --bg: #f6f3ee;
  --surface: #ffffff;
  --ink: #171513;
  --muted: #6b645c;
  --line: #e2dcd2;
  --accent: #c2410c;
  --accent-ink: #ffffff;
  --danger: #b91c1c;
  --danger-bg: #fef2f2;
  --ok: #15803d;
  --radius: 14px;
  --max: 1080px;
  --font: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0f0e0d;
    --surface: #1a1816;
    --ink: #f3efe9;
    --muted: #a39b91;
    --line: #2c2925;
    --accent: #fb923c;
    --accent-ink: #1a1816;
    --danger: #f87171;
    --danger-bg: #2a1414;
    --ok: #4ade80;
    color-scheme: dark;
  }
}

:root[data-theme="dark"] {
  --bg: #0f0e0d;
  --surface: #1a1816;
  --ink: #f3efe9;
  --muted: #a39b91;
  --line: #2c2925;
  --accent: #fb923c;
  --accent-ink: #1a1816;
  --danger: #f87171;
  --danger-bg: #2a1414;
  --ok: #4ade80;
  color-scheme: dark;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  font-size: 17px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; }

.skip {
  position: absolute;
  left: -9999px;
}
.skip:focus {
  left: 16px;
  top: 16px;
  background: var(--accent);
  color: var(--accent-ink);
  padding: 8px 12px;
  border-radius: 8px;
  z-index: 10;
}

.top, main, .foot {
  max-width: var(--max);
  margin: 0 auto;
  padding-left: 16px;
  padding-right: 16px;
}

@media (min-width: 720px) {
  .top, main, .foot { padding-left: 32px; padding-right: 32px; }
}

.top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 24px;
  padding-bottom: 24px;
}

.mark {
  font-weight: 800;
  letter-spacing: -0.04em;
  text-decoration: none;
  font-size: 20px;
  border: 2px solid var(--ink);
  border-radius: 999px;
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
}

.top nav { display: flex; gap: 20px; }
.top nav a {
  text-decoration: none;
  color: var(--muted);
  font-size: 15px;
}
.top nav a:hover { color: var(--ink); }

.hero {
  padding: 72px 0 88px;
  border-bottom: 1px solid var(--line);
}

.eyebrow {
  margin: 0;
  font-family: var(--mono);
  font-size: 14px;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.12em;
}

h1 {
  margin: 8px 0 24px;
  font-size: clamp(56px, 14vw, 148px);
  line-height: 0.9;
  letter-spacing: -0.05em;
  font-weight: 800;
}

.lede {
  max-width: 34ch;
  font-size: clamp(20px, 2.6vw, 26px);
  line-height: 1.4;
  margin: 0 0 32px;
}

.roles {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.roles li {
  border: 1px solid var(--line);
  background: var(--surface);
  border-radius: 999px;
  padding: 6px 14px;
  font-size: 14px;
  color: var(--muted);
}

.block {
  padding: 72px 0;
  border-bottom: 1px solid var(--line);
}

.block-head {
  display: flex;
  align-items: baseline;
  gap: 16px;
  margin-bottom: 32px;
}
.num {
  font-family: var(--mono);
  font-size: 14px;
  color: var(--accent);
}
h2 {
  margin: 0;
  font-size: clamp(30px, 5vw, 44px);
  letter-spacing: -0.03em;
  line-height: 1.1;
}

.grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
}
@media (min-width: 640px) { .grid { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 980px) { .grid { grid-template-columns: repeat(3, 1fr); } }

.card {
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 24px;
  text-decoration: none;
  transition: border-color 0.15s ease, transform 0.15s ease;
}
a.card:hover, a.card:focus-visible {
  border-color: var(--accent);
  transform: translateY(-2px);
}
.card h3 {
  margin: 0 0 8px;
  font-size: 20px;
  letter-spacing: -0.01em;
}
.card p {
  margin: 0 0 20px;
  color: var(--muted);
  font-size: 15px;
  flex: 1;
}
.card.static p { margin-bottom: 0; }
.url {
  font-family: var(--mono);
  font-size: 13px;
  color: var(--accent);
}
.url::after { content: " \2197"; }

.contact {
  max-width: 52ch;
  font-size: 20px;
  margin: 0;
}
.contact a {
  color: var(--accent);
  text-underline-offset: 3px;
}

.foot {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 24px;
  justify-content: space-between;
  padding-top: 32px;
  padding-bottom: 48px;
  font-size: 14px;
  color: var(--muted);
}
.foot .build { font-family: var(--mono); font-size: 12px; }
.foot a { color: var(--muted); }

/* Error + error-list pages */
.error-page { padding: 72px 0 96px; }
.error-code {
  font-family: var(--mono);
  color: var(--accent);
  border-bottom: 1px dotted var(--accent);
  cursor: help;
}
.error-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 15px;
}
.error-table th, .error-table td {
  text-align: left;
  padding: 12px 8px;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}
.error-table code { font-family: var(--mono); color: var(--accent); white-space: nowrap; }
.table-wrap { overflow-x: auto; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .card { transition: none; }
  a.card:hover { transform: none; }
}
.table-wrap { margin-top: 32px; }

/* ---------- Utility site additions ---------- */
.hero-compact { padding: 48px 0 56px; }
.hero-compact h1 { font-size: clamp(48px, 11vw, 112px); }
.hero-compact .lede { margin-bottom: 0; }

.subhead {
  margin: 32px 0 12px;
  font-size: 13px;
  font-family: var(--mono);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--muted);
}
.block-head + .subhead { margin-top: 0; }
.grid-gap { margin-top: 32px; }
.card-private { border-style: dashed; }
.muted { color: var(--muted); }

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 15px;
}
.data-table th, .data-table td {
  text-align: left;
  padding: 10px 12px 10px 0;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}
.data-table thead th {
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
}
.data-table tbody th { font-weight: 600; }
.data-table a { color: var(--accent); text-underline-offset: 3px; word-break: break-word; }
.data-table td.num { font-variant-numeric: tabular-nums; text-align: right; }

.error {
  color: var(--danger);
  background: var(--danger-bg);
  border: 1px solid var(--danger);
  border-radius: 10px;
  padding: 10px 14px;
  font-size: 15px;
}
.error .error-code { color: inherit; }
.notice {
  color: var(--muted);
  border: 1px dashed var(--line);
  border-radius: 10px;
  padding: 10px 14px;
  font-size: 14px;
}

/* Tool pages */
.tool { padding: 40px 0 72px; }
.tool h1 { font-size: clamp(40px, 8vw, 72px); margin: 4px 0 8px; }
.tool .intro { color: var(--muted); max-width: 60ch; margin: 0 0 32px; }
.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 24px;
  margin-bottom: 16px;
}
.row { display: flex; flex-wrap: wrap; gap: 12px; align-items: end; }
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field label, .label {
  font-size: 13px;
  color: var(--muted);
  font-family: var(--mono);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
input[type="text"], input[type="number"], input[type="password"], input[type="time"], input[type="search"], select, textarea {
  font: inherit;
  font-size: 16px;
  color: var(--ink);
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px 12px;
  min-width: 0;
  max-width: 100%;
}
input:focus-visible, select:focus-visible, textarea:focus-visible, button:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
textarea { width: 100%; min-height: 220px; font-family: var(--mono); font-size: 15px; line-height: 1.5; }
input[type="range"] { width: 100%; accent-color: var(--accent); }
.btn {
  font: inherit;
  font-size: 15px;
  font-weight: 600;
  border-radius: 10px;
  padding: 10px 16px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
  cursor: pointer;
}
.btn:hover { border-color: var(--accent); }
.btn-primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.btn-big { font-size: 18px; padding: 14px 28px; }
.btn-small { font-size: 13px; padding: 6px 10px; }
.btn[disabled] { opacity: 0.5; cursor: not-allowed; }

.readout {
  font-size: clamp(64px, 18vw, 140px);
  font-weight: 800;
  letter-spacing: -0.04em;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}
.readout-sub { color: var(--muted); font-family: var(--mono); font-size: 14px; }

.beats { display: flex; gap: 10px; flex-wrap: wrap; margin: 20px 0; }
.beat {
  width: 22px; height: 22px; border-radius: 999px;
  border: 2px solid var(--line);
  transition: background 0.05s linear;
}
.beat.accent { border-color: var(--accent); }
.beat.on { background: var(--ink); border-color: var(--ink); }
.beat.accent.on { background: var(--accent); border-color: var(--accent); }

.meter {
  position: relative; height: 12px; border-radius: 999px;
  background: var(--line); margin: 24px 0 8px; overflow: hidden;
}
.meter-center { position: absolute; left: 50%; top: 0; bottom: 0; width: 2px; background: var(--muted); }
.meter-needle {
  position: absolute; top: 0; bottom: 0; width: 6px; margin-left: -3px; left: 50%;
  border-radius: 999px; background: var(--accent); transition: left 0.08s linear;
}
.meter-needle.in-tune { background: var(--ok); }

.result {
  font-size: 22px;
  font-weight: 600;
}
.result small { display: block; font-size: 14px; font-weight: 400; color: var(--muted); }

.list-edit { display: flex; flex-direction: column; gap: 8px; }
.list-edit .item {
  display: grid;
  grid-template-columns: 1fr 88px auto;
  gap: 8px;
  align-items: center;
}
.list-edit .item .when { font-family: var(--mono); font-size: 14px; color: var(--accent); grid-column: 1 / -1; }
@media (min-width: 640px) {
  .list-edit .item { grid-template-columns: 90px 1fr 96px auto; }
  .list-edit .item .when { grid-column: auto; }
}
.item-actions { display: flex; gap: 4px; }

.progress {
  height: 10px; border-radius: 999px; background: var(--line); overflow: hidden;
}
.progress > span { display: block; height: 100%; background: var(--accent); width: 0; transition: width 0.2s ease; }
.progress.complete > span { background: var(--ok); }

.counter { display: flex; align-items: center; gap: 6px; }
.counter input { width: 84px; text-align: center; }

.status-dot {
  display: inline-block; width: 10px; height: 10px; border-radius: 999px;
  background: var(--muted); margin-right: 6px; vertical-align: middle;
}
.status-dot.ok { background: var(--ok); }
.status-dot.bad { background: var(--danger); }

.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  font-size: 12px; padding: 2px 8px; border-radius: 999px;
  border: 1px solid var(--line); color: var(--muted);
}
.chip.warn { border-color: var(--danger); color: var(--danger); }

.hp { position: absolute; left: -10000px; width: 1px; height: 1px; overflow: hidden; }

@media print {
  .top, .foot, .no-print, .skip { display: none !important; }
  body { background: #fff; color: #000; }
  .panel { border: none; padding: 0; }
}
.panel h2 { font-size: 22px; margin: 0 0 16px; letter-spacing: -0.01em; }
.panel h3 { margin: 0; font-size: 18px; }
.panel .row + .progress, .panel .progress + .row { margin-top: 12px; }
.panel .row h2 { margin: 0; }
.tool .grid { margin-top: 8px; }
code { font-family: var(--mono); font-size: 0.9em; }
