@font-face {
  font-family: "Inter Tight";
  src: url("/fonts/of-inter-tight-800.woff2") format("woff2");
  font-weight: 800;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Inter";
  src: url("/fonts/of-inter-400.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "JetBrains Mono";
  src: url("/fonts/of-jetbrains-mono-400.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

:root {
  --field: #151513;
  --lime: #faff69;
  --grey: #414141;
  --panel: #1c1c19;
  --panel-hi: #242420;
  --ink: #f4f4ef;
  --warn: #f0c860;
  --err: #ef6b5a;
  --mono: "JetBrains Mono", ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --sans: "Inter", system-ui, sans-serif;
}

*,
*::before,
*::after { box-sizing: border-box; }

html { height: 100%; }

body {
  margin: 0;
  min-height: 100%;
  background: var(--field);
  color: var(--ink);
  -webkit-text-size-adjust: 100%;
  text-rendering: optimizeLegibility;
}

.drill {
  max-width: 1080px;
  margin: 0 auto;
  padding: clamp(18px, 3.2vw, 40px) clamp(16px, 4.5vw, 60px) 48px;
}

/* ---- banner ---- */

.banner {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 6px 16px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--panel-hi);
  font-family: "Inter Tight", var(--sans);
  font-weight: 800;
  font-size: 11.5px;
  line-height: 1.4;
  letter-spacing: 0.17em;
  text-transform: uppercase;
}
.mark { color: var(--lime); }
.claim {
  color: var(--ink);
  opacity: 0.4;
  font-weight: 400;
  letter-spacing: 0.13em;
}

.state {
  margin-left: auto;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: lowercase;
  padding: 2px 9px;
  border: 1px solid var(--panel-hi);
  border-radius: 2px;
  color: var(--ink);
  opacity: 0.55;
  white-space: nowrap;
}
.state[data-state="open"] {
  color: var(--field);
  background: var(--lime);
  border-color: var(--lime);
  opacity: 1;
}
.state[data-state="connecting"] { color: var(--warn); border-color: var(--warn); opacity: 0.9; }
.state[data-state="closed"] { color: var(--err); border-color: var(--err); opacity: 0.9; }

/* ---- key row ---- */

.keyrow {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 12px;
  padding: 16px 0 4px;
}

.klabel {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ink);
  opacity: 0.5;
}

.kinput {
  flex: 1 1 200px;
  min-width: 0;
  padding: 9px 12px;
  background: var(--panel);
  border: 1px solid var(--panel-hi);
  border-radius: 2px;
  color: var(--ink);
  font-family: var(--mono);
  font-size: 14px;
  outline: none;
}
.kinput:focus-visible { border-color: var(--lime); }
.kinput::placeholder { color: var(--ink); opacity: 0.3; }

.kbtn {
  padding: 9px 18px;
  background: var(--lime);
  color: var(--field);
  border: 1px solid var(--lime);
  border-radius: 2px;
  font-family: "Inter Tight", var(--sans);
  font-weight: 800;
  font-size: 12px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  cursor: pointer;
}
.kbtn:hover { background: #f3f95e; }
.kbtn:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }

.khint {
  flex: 1 1 100%;
  font-family: var(--sans);
  font-size: 12px;
  color: var(--ink);
  opacity: 0.36;
}

/* ---- toolbar ---- */

.controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 14px;
  padding: 12px 0 0;
}

.drq,
.copy {
  padding: 7px 14px;
  background: transparent;
  border: 1px solid var(--panel-hi);
  border-radius: 2px;
  color: var(--ink);
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.04em;
  cursor: pointer;
  transition: background 120ms linear, color 120ms linear, border-color 120ms linear;
}
.drq:hover,
.copy:hover { border-color: var(--grey); }
.drq:focus-visible,
.copy:focus-visible { outline: 2px solid var(--lime); outline-offset: 2px; }

.drq[aria-pressed="true"] {
  background: var(--lime);
  border-color: var(--lime);
  color: var(--field);
  font-weight: 700;
}

.copy.done { border-color: var(--lime); color: var(--lime); }
.copy.warned { border-color: var(--warn); color: var(--warn); }

.copy-sink {
  position: fixed;
  left: -9999px;
  top: 0;
  width: 1px;
  height: 1px;
  opacity: 0;
}

.obs {
  font-family: var(--mono);
  font-size: 11.5px;
  letter-spacing: 0.03em;
  color: var(--ink);
  opacity: 0.45;
  white-space: nowrap;
}
.obs[data-gate="drq+"] { color: var(--lime); opacity: 0.85; }
.obs[data-gate="drq-"] { color: var(--ink); opacity: 0.45; }

.cadence {
  margin-left: auto;
  font-family: var(--mono);
  font-size: 11.5px;
  letter-spacing: 0.03em;
  color: var(--ink);
  opacity: 0.4;
}

.drqnote {
  margin: 10px 0 0;
  font-family: var(--sans);
  font-size: 12.5px;
  line-height: 1.55;
  color: var(--ink);
  opacity: 0.42;
  max-width: 74ch;
}
.drqnote code {
  font-family: var(--mono);
  font-size: 0.94em;
  color: var(--lime);
  opacity: 0.85;
}

/* ---- the surface: blocks ---- */

.surface {
  margin-top: 22px;
  border-top: 1px solid var(--panel-hi);
}

.empty {
  margin: 26px 0 0;
  font-family: var(--mono);
  font-size: 13px;
  line-height: 1.6;
  color: var(--ink);
  opacity: 0.34;
}

.blk {
  border-bottom: 1px solid var(--panel);
}

.blk > summary {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: baseline;
  gap: 4px 16px;
  padding: 11px 10px 11px 6px;
  cursor: pointer;
  list-style: none;
  font-family: var(--mono);
  font-size: 13.5px;
  line-height: 1.5;
  color: var(--ink);
  transition: background 120ms linear;
}
.blk > summary::-webkit-details-marker { display: none; }
.blk > summary::marker { content: ""; }
.blk > summary:hover { background: var(--panel); }
.blk > summary:focus-visible { outline: 2px solid var(--lime); outline-offset: -2px; }

.blk[open] > summary { background: var(--panel); }

.chev {
  width: 1.1ch;
  color: var(--lime);
  opacity: 0.55;
  font-size: 11px;
  transform: translateY(-1px);
}
.chev::before { content: "\25B8"; }
.blk[open] > summary .chev { opacity: 0.9; }
.blk[open] > summary .chev::before { content: "\25BE"; }

.range {
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  letter-spacing: 0.01em;
}
.range .sep { opacity: 0.35; margin: 0 0.15em; }

.meta {
  display: flex;
  align-items: baseline;
  justify-content: flex-end;
  gap: 0.7ch;
  white-space: nowrap;
  font-size: 12px;
  color: var(--ink);
  opacity: 0.45;
  font-variant-numeric: tabular-nums;
}

.meta .dot { opacity: 0.5; }

.lvl { letter-spacing: 0.02em; }
.lvl[data-level="info"] { color: var(--ink); opacity: 0.5; }
.lvl[data-level="warn"] { color: var(--warn); opacity: 1; }
.lvl[data-level="error"] { color: var(--err); opacity: 1; }

.blk.fresh > summary .range { color: var(--lime); }

/* the newest block gets a live tick before its range */

.blk.fresh > summary .range::before {
  content: "";
  display: inline-block;
  width: 6px;
  height: 6px;
  margin-right: 0.7ch;
  border-radius: 50%;
  background: var(--lime);
  vertical-align: middle;
  transform: translateY(-1px);
  animation: pulse 1.4s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.25; }
}

.lines {
  padding: 4px 0 12px 6px;
  display: flex;
  flex-direction: column;
}

.row {
  display: grid;
  grid-template-columns: 8.5ch 6ch minmax(0, 1fr);
  gap: 0 14px;
  padding: 2px 0;
  font-family: var(--mono);
  font-size: 13px;
  line-height: 1.62;
}
.row .t { color: var(--ink); opacity: 0.38; font-variant-numeric: tabular-nums; }
.row .l { letter-spacing: 0.02em; }
.row .l[data-level="info"] { color: var(--ink); opacity: 0.55; }
.row .l[data-level="warn"] { color: var(--warn); }
.row .l[data-level="error"] { color: var(--err); }
.row .x {
  color: var(--ink);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.row.sys .x { color: var(--lime); opacity: 0.9; }

/* ---- phone ---- */

@media (max-width: 620px) {
  .drill { padding: 15px 16px 36px; }
  .banner { font-size: 9.5px; letter-spacing: 0.13em; }
  .state { font-size: 10px; }
  .blk > summary {
    grid-template-columns: auto 1fr;
    font-size: 12.5px;
    gap: 3px 10px;
  }
  .meta { grid-column: 2; justify-content: flex-start; opacity: 0.4; }
  .row {
    grid-template-columns: 7.5ch minmax(0, 1fr);
    font-size: 12px;
  }
  .row .l { grid-column: 2; opacity: 0.85; }
  .row .x { grid-column: 2; }
  .cadence { margin-left: 0; }
}

@media (prefers-reduced-motion: reduce) {
  .blk.fresh > summary .range::before { animation: none; }
  .drq, .copy, .blk > summary { transition: none; }
}
