@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;
}
@font-face {
  font-family: "JetBrains Mono";
  src: url("../fonts/of-jetbrains-mono-700.woff2") format("woff2");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

:root {
  --field: #151513;
  --lime: #faff69;
  --grey: #414141;
  --panel: #1c1c19;
  --panel-hi: #242420;
  --ink: #f4f4ef;
  --mono: "JetBrains Mono", ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --sans: "Inter", system-ui, sans-serif;
  --display: "Inter Tight", "Inter", 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;
}

.delta {
  height: 100vh;
  height: 100dvh;
  max-width: 1180px;
  margin: 0 auto;
  padding: clamp(16px, 3vw, 38px) clamp(16px, 4.5vw, 60px) 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

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

.banner {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 6px 16px;
  padding-bottom: 13px;
  border-bottom: 1px solid var(--panel-hi);
  font-family: var(--display);
  font-weight: 800;
  font-size: 11.5px;
  line-height: 1.4;
  letter-spacing: 0.17em;
  text-transform: uppercase;
  flex: none;
}

.mark { color: var(--lime); }

.claim {
  color: var(--ink);
  opacity: 0.4;
  font-weight: 400;
  letter-spacing: 0.13em;
}

/* ---- the bar ---- */

.bar {
  flex: none;
  padding: 14px 0 13px;
  border-bottom: 1px solid var(--panel-hi);
}

.keyrow {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 12px;
  font-family: var(--sans);
  font-size: 12px;
}

.klabel {
  color: var(--ink);
  opacity: 0.42;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  font-size: 10px;
  font-weight: 400;
}

.kinput {
  flex: 1 1 180px;
  min-width: 120px;
  max-width: 300px;
  padding: 7px 10px;
  border: 1px solid var(--grey);
  border-radius: 0;
  background: var(--panel);
  color: var(--ink);
  font-family: var(--mono);
  font-size: 12.5px;
  letter-spacing: 0.02em;
  outline: none;
  transition: border-color 120ms linear;
}
.kinput::placeholder { color: var(--ink); opacity: 0.26; }
.kinput:focus-visible { border-color: var(--lime); }

.kbtn,
.drq,
.copy {
  padding: 7px 13px;
  border: 1px solid var(--grey);
  border-radius: 0;
  background: var(--panel-hi);
  color: var(--ink);
  font-family: var(--display);
  font-size: 10.5px;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  cursor: pointer;
  transition: border-color 120ms linear, color 120ms linear, background 120ms linear;
}
.kbtn:hover,
.kbtn:focus-visible,
.copy:hover,
.copy:focus-visible {
  border-color: var(--lime);
  color: var(--lime);
  outline: none;
}

.drq[aria-pressed="true"] {
  border-color: var(--lime);
  background: var(--lime);
  color: var(--field);
}
.drq[aria-pressed="false"] { color: var(--ink); opacity: 0.72; }
.drq:hover,
.drq:focus-visible { outline: none; border-color: var(--lime); }

/* the label carries the router's own lowercase `drq+`/`drq-` token, so the
   text-transform that dresses the other controls is off for this one */
.drq { text-transform: none; letter-spacing: 0.08em; }

.khint {
  flex: 1 1 200px;
  color: var(--ink);
  opacity: 0.3;
  font-size: 11px;
  line-height: 1.35;
  letter-spacing: 0.02em;
}

.ctl {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.copy.copied {
  border-color: var(--lime);
  background: var(--lime);
  color: var(--field);
}

.note {
  margin: 11px 0 0;
  max-width: 92ch;
  color: var(--ink);
  opacity: 0.42;
  font-family: var(--sans);
  font-size: 11px;
  line-height: 1.6;
  letter-spacing: 0.01em;
}
.note strong { color: var(--lime); font-weight: 400; }
.note code {
  font-family: var(--mono);
  font-size: 0.95em;
  color: var(--ink);
  opacity: 0.85;
}

/* ---- terminal ---- */

.term {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  padding-top: 12px;
}

.cols,
.row {
  display: grid;
  grid-template-columns: 19ch 6ch minmax(0, 1fr);
  gap: 0 14px;
  font-family: var(--mono);
  font-size: 13px;
  line-height: 1.75;
}

.cols {
  flex: none;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--panel);
  color: var(--ink);
  opacity: 0.3;
  font-size: 10px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.out {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 4px 0 14px;
  scrollbar-width: thin;
  scrollbar-color: var(--grey) transparent;
  overscroll-behavior: contain;
}

.out::-webkit-scrollbar { width: 8px; }
.out::-webkit-scrollbar-thumb { background: #2c2c28; border-radius: 4px; }
.out::-webkit-scrollbar-track { background: transparent; }

.row {
  padding: 1px 0;
  border-left: 2px solid transparent;
  padding-left: 8px;
  margin-left: -10px;
  align-items: baseline;
}

.row:first-child { margin-top: 0; }

.ts {
  color: var(--ink);
  opacity: 0.34;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.lv {
  font-size: 10px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  white-space: nowrap;
}
.lv[data-level="info"] { color: var(--ink); opacity: 0.42; }
.lv[data-level="warn"] { color: var(--lime); opacity: 0.8; }
.lv[data-level="error"] { color: #ff8a6b; }
.lv[data-level="debug"] { color: var(--ink); opacity: 0.26; }

.tx {
  color: var(--ink);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  word-break: normal;
}

/* the diff itself: unchanged runs dim, changed tokens loud */

.w-same {
  color: var(--ink);
  opacity: 0.34;
}

.w-new {
  color: var(--lime);
  text-shadow: 0 0 14px rgba(250, 255, 105, 0.32);
  font-weight: 700;
}

.w-flip {
  color: var(--lime);
  font-weight: 700;
  background: rgba(250, 255, 105, 0.16);
  box-shadow: 0 0 0 2px rgba(250, 255, 105, 0.16);
  text-shadow: 0 0 18px rgba(250, 255, 105, 0.55);
}

.row.first .w-same { opacity: 0.62; }

.row.errored { border-left-color: #ff8a6b; }
.row.gate-flip { border-left-color: var(--lime); }

.row.enter {
  animation: enter 260ms ease-out;
}
@keyframes enter {
  from { opacity: 0; transform: translateY(-2px); }
  to   { opacity: 1; transform: none; }
}

.empty {
  padding: 10px 0;
  color: var(--ink);
  opacity: 0.28;
  font-family: var(--mono);
  font-size: 12.5px;
}

.clipboard-shim {
  position: fixed;
  top: 0;
  left: -9999px;
  width: 1px;
  height: 1px;
  opacity: 0;
  border: 0;
  padding: 0;
  font-size: 12px;
}

/* ---- status ---- */

.status {
  flex: none;
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0 9px;
  padding: 11px 0 14px;
  border-top: 1px solid var(--panel-hi);
  font-family: var(--mono);
  font-size: 11.5px;
  line-height: 1.5;
  letter-spacing: 0.03em;
}

.led {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--grey);
  transform: translateY(-1px);
  flex: none;
}

.stext { text-transform: lowercase; }

.status .sdiv { color: var(--ink); opacity: 0.24; }
.scount, .gate, .surl { color: var(--ink); opacity: 0.42; }
.surl { margin-left: auto; opacity: 0.24; overflow-wrap: anywhere; }

.status[data-state="idle"] .stext { opacity: 0.4; }
.status[data-state="idle"] .led { background: var(--grey); }

.status[data-state="connecting"] .led {
  background: var(--lime);
  animation: pulse 900ms ease-in-out infinite;
}
.status[data-state="connecting"] .stext { opacity: 0.8; }

.status[data-state="open"] .led { background: var(--lime); }
.status[data-state="open"] .stext { color: var(--lime); opacity: 1; }

.status[data-state="closed"] .led { background: #ff8a6b; }
.status[data-state="closed"] .stext { color: #ff8a6b; opacity: 1; }

.status[data-state="open"] .gate-on { color: var(--lime); opacity: 1; }
.status[data-state="open"] .gate-off { color: var(--ink); opacity: 0.5; }

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

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

@media (max-width: 700px) {
  .delta { padding: 14px 15px 0; }

  .banner {
    font-size: 9.5px;
    letter-spacing: 0.14em;
    gap: 4px 12px;
    padding-bottom: 11px;
  }
  .claim { letter-spacing: 0.1em; }

  .bar { padding: 11px 0 10px; }
  .kinput { max-width: none; flex-basis: 100%; }
  .khint { flex-basis: 100%; font-size: 10.5px; }
  .note { font-size: 10.5px; }

  .cols, .row {
    grid-template-columns: 8.5ch 4.5ch minmax(0, 1fr);
    gap: 0 8px;
    font-size: 11.5px;
  }
  .cols { font-size: 9px; }
  .row { padding-left: 6px; margin-left: -8px; }

  .status { font-size: 10.5px; padding: 9px 0 12px; }
  .surl { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  .row.enter { animation: none; }
  .status[data-state="connecting"] .led { animation: none; }
  .kbtn, .drq, .copy, .kinput { transition: none; }
}
