/* ============================================================
   Jeremy Davies — Self Driving Codebase
   MODELS.DAT — DAYLIGHT CYBERPUNK
   light-paper terminal, ink-green type, hacker bones
   ============================================================ */

:root {
  --ink: #0d4a25;          /* deep phosphor green, readable on cream */
  --ink-2: #1a6638;
  --ink-3: #2d7c4a;
  --ink-4: #5a8a6e;
  --paper: #ece8db;        /* warm parchment */
  --paper-2: #e2ddc9;
  --paper-3: #d6d0bb;
  --paper-4: #c2bca5;
  --amber: #b8530a;
  --red:   #a8201f;
  --cyan:  #146c9c;
  --magenta: #a83289;
  --line: rgba(13, 74, 37, 0.22);
  --line-hot: rgba(13, 74, 37, 0.55);
  --mono: "JetBrains Mono", "SF Mono", Menlo, Consolas, monospace;
  --display: "Major Mono Display", "JetBrains Mono", monospace;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--paper);
  color: var(--ink);
  font-family: var(--mono);
  font-size: 14px;
  line-height: 1.45;
  min-height: 100vh;
  overflow-x: hidden;
  cursor: default;
}

::selection { background: var(--ink); color: var(--paper); }

/* ============================================================
   CRT OVERLAYS — light-bias
   ============================================================ */
.crt-paper {
  /* paper grain + subtle warm gradient */
  pointer-events: none;
  position: fixed; inset: 0;
  background:
    radial-gradient(ellipse 80% 60% at 20% 0%, rgba(20,108,156,0.06), transparent 50%),
    radial-gradient(ellipse 90% 70% at 100% 100%, rgba(184,83,10,0.05), transparent 60%);
  z-index: 9000;
  mix-blend-mode: multiply;
}
.crt-vignette {
  pointer-events: none;
  position: fixed; inset: 0;
  background:
    radial-gradient(ellipse at center, transparent 60%, rgba(13,74,37,0.18) 100%);
  z-index: 9001;
  mix-blend-mode: multiply;
}
.crt-scanlines {
  pointer-events: none;
  position: fixed; inset: 0;
  background-image: repeating-linear-gradient(
    to bottom,
    rgba(13,74,37,0) 0,
    rgba(13,74,37,0) 2px,
    rgba(13,74,37,0.07) 3px,
    rgba(13,74,37,0.10) 3px
  );
  z-index: 9002;
  opacity: 0.9;
  mix-blend-mode: multiply;
}

#bg-grid {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  z-index: 0;
  opacity: 0.6;
  pointer-events: none;
}

body.fx-off-scanlines .crt-scanlines { display: none; }
body.fx-off-grid #bg-grid { display: none; }
body.fx-off-glitch .glitch::before,
body.fx-off-glitch .glitch::after { display: none !important; }

/* ============================================================
   BOOT SEQUENCE
   ============================================================ */
#boot-overlay {
  position: fixed; inset: 0;
  background: var(--paper);
  z-index: 9500;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 80px 120px;
  font-family: var(--mono);
  color: var(--ink);
  transition: opacity 0.4s ease;
}
#boot-overlay.done { opacity: 0; pointer-events: none; }
#boot-overlay pre {
  margin: 0;
  font-size: 13px;
  line-height: 1.45;
  white-space: pre-wrap;
  max-width: 920px;
}
#boot-overlay .blink::after {
  content: "█";
  animation: blink 0.7s steps(1) infinite;
  margin-left: 4px;
}
@keyframes blink {
  0%, 49% { opacity: 1; }
  50%, 100% { opacity: 0; }
}

/* ============================================================
   LAYOUT
   ============================================================ */
.shell {
  position: relative;
  z-index: 10;
  max-width: 1480px;
  margin: 0 auto;
  padding: 28px 40px 80px;
}

/* ----- TITLEBAR ----- */
.titlebar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border: 1px solid var(--ink);
  border-bottom: none;
  padding: 8px 14px;
  background: var(--ink);
  color: var(--paper);
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  position: relative;
  overflow: hidden;
}
.titlebar::after {
  /* scanning beam across the titlebar */
  content: "";
  position: absolute;
  top: 0; bottom: 0;
  width: 80px;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.18), transparent);
  animation: tb-sweep 6s linear infinite;
  pointer-events: none;
}
@keyframes tb-sweep {
  0% { left: -80px; }
  100% { left: 100%; }
}
.titlebar .tb-l, .titlebar .tb-r {
  display: flex; gap: 18px; align-items: center;
}
.titlebar .dot {
  width: 9px; height: 9px;
  background: var(--paper);
  border-radius: 1px;
}
.titlebar .dot.red { background: var(--red); }
.titlebar .dot.amber { background: var(--amber); }

/* ----- HERO ----- */
.hero {
  border: 1px solid var(--ink);
  padding: 28px 36px 28px;
  position: relative;
  background: var(--paper);
  overflow: hidden;
}
.hero::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    repeating-linear-gradient(
      90deg,
      rgba(13,74,37,0.05) 0 1px,
      transparent 1px 32px
    );
  pointer-events: none;
}
.hero-grid {
  display: grid;
  grid-template-columns: 1fr 360px;
  gap: 40px;
  position: relative;
  z-index: 2;
}
.ascii-logo {
  font-family: var(--mono);
  font-size: 10px;
  line-height: 1.05;
  white-space: pre;
  color: var(--ink);
  margin: 0 0 18px;
  font-weight: 700;
}
.hero h1 {
  margin: 0 0 14px;
  font-family: var(--display);
  font-weight: 400;
  font-size: 38px;
  letter-spacing: 0.04em;
  color: var(--ink);
  position: relative;
}
.hero .subtitle {
  font-size: 13px;
  color: var(--ink-2);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin: 0 0 22px;
  max-width: 760px;
}
.hero .subtitle b { color: var(--amber); font-weight: 600; }
.hero .meta {
  display: flex;
  gap: 22px;
  flex-wrap: wrap;
  font-size: 11px;
  color: var(--ink-2);
  border-top: 1px dashed var(--line);
  padding-top: 18px;
  margin-top: 22px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}
.hero .meta span b { color: var(--ink); font-weight: 700; }

.hero-side {
  border: 1px solid var(--ink);
  padding: 14px 16px;
  background: var(--paper-2);
  font-size: 11px;
  line-height: 1.55;
  align-self: start;
  position: relative;
  overflow: hidden;
}
.hero-side::before {
  /* sparkline-ish faint waveform decoration */
  content: "";
  position: absolute;
  left: 0; right: 0; bottom: 0;
  height: 26px;
  background:
    repeating-linear-gradient(90deg,
      transparent 0 6px,
      rgba(13,74,37,0.08) 6px 7px,
      transparent 7px 18px);
  pointer-events: none;
}
.hero-side h2 {
  margin: 0 0 10px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.2em;
  color: var(--amber);
  text-transform: uppercase;
  border-bottom: 1px dashed var(--line);
  padding-bottom: 6px;
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--mono);
}
.hero-side h2 .live-dot {
  width: 7px; height: 7px;
  background: var(--amber);
  display: inline-block;
  animation: live-blink 1.4s steps(2) infinite;
}
@keyframes live-blink {
  0%, 50% { opacity: 1; }
  51%, 100% { opacity: 0.3; }
}
.hero-side .row {
  display: flex;
  justify-content: space-between;
  padding: 3px 0;
  color: var(--ink-2);
}
.hero-side .row b { color: var(--ink); font-weight: 700; }

/* ============================================================
   GLITCH (chromatic shift around dark ink)
   ============================================================ */
.glitch {
  position: relative;
  display: inline-block;
}
.glitch::before,
.glitch::after {
  content: attr(data-text);
  position: absolute;
  inset: 0;
  pointer-events: none;
}
.glitch::before {
  color: var(--cyan);
  transform: translate(-1px, 0);
  mix-blend-mode: multiply;
  animation: glitch-x 4.2s infinite steps(1);
  clip-path: polygon(0 0, 100% 0, 100% 33%, 0 33%);
  opacity: 0.85;
}
.glitch::after {
  color: var(--magenta);
  transform: translate(1px, 0);
  mix-blend-mode: multiply;
  animation: glitch-x 3.8s infinite steps(1) reverse;
  clip-path: polygon(0 66%, 100% 66%, 100% 100%, 0 100%);
  opacity: 0.85;
}
@keyframes glitch-x {
  0%, 92%, 100% { transform: translate(0, 0); opacity: 0.5; }
  93% { transform: translate(-3px, 1px); opacity: 0.9; clip-path: polygon(0 10%, 100% 10%, 100% 28%, 0 28%); }
  94% { transform: translate(2px, -1px); opacity: 0.9; clip-path: polygon(0 45%, 100% 45%, 100% 60%, 0 60%); }
  95% { transform: translate(-2px, 2px); opacity: 0.9; clip-path: polygon(0 70%, 100% 70%, 100% 88%, 0 88%); }
  96% { transform: translate(1px, 0); opacity: 0.9; }
  97% { transform: translate(0, 0); opacity: 0.4; }
}

/* ============================================================
   COMMAND BAR (search + filters)
   ============================================================ */
.cmd-section {
  margin-top: 24px;
  border: 1px solid var(--ink);
  background: var(--paper);
}
.cmd-header {
  display: flex;
  justify-content: space-between;
  font-size: 10px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  padding: 6px 14px;
  border-bottom: 1px solid var(--ink);
  color: var(--paper);
  background: var(--ink);
}
.cmd-header .dim { opacity: 0.75; }

.cmd-body { padding: 18px 22px 22px; }

.search-row {
  display: flex;
  align-items: center;
  gap: 12px;
  border: 1.5px solid var(--ink);
  padding: 12px 14px;
  background: var(--paper-2);
  position: relative;
  overflow: hidden;
}
.search-row::after {
  /* slow radar sweep */
  content: "";
  position: absolute;
  top: 0; bottom: 0;
  width: 120px;
  background: linear-gradient(90deg, transparent, rgba(13,74,37,0.10), transparent);
  animation: sr-sweep 7s linear infinite;
  pointer-events: none;
}
@keyframes sr-sweep {
  0% { left: -120px; }
  100% { left: 100%; }
}
.search-prompt {
  font-family: var(--mono);
  font-weight: 700;
  font-size: 13px;
  color: var(--amber);
  letter-spacing: 0.04em;
  white-space: nowrap;
}
.search-prompt .at { color: var(--ink); }
.search-prompt .path { color: var(--cyan); }
.search-input {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  font-family: var(--mono);
  font-size: 16px;
  color: var(--ink);
  caret-color: var(--ink);
  letter-spacing: 0.02em;
  font-weight: 500;
}
.search-input::placeholder { color: var(--paper-4); font-weight: 400; }
.search-cursor {
  width: 10px; height: 18px;
  background: var(--ink);
  animation: blink 0.85s steps(1) infinite;
}
.search-keyhint {
  font-size: 10px;
  letter-spacing: 0.16em;
  color: var(--ink-2);
  text-transform: uppercase;
  border: 1px solid var(--line-hot);
  padding: 4px 8px;
  background: var(--paper);
}

.filter-row {
  display: flex;
  align-items: stretch;
  margin-top: 18px;
  gap: 8px;
  flex-wrap: wrap;
}
.chip {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 8px 14px;
  border: 1px solid var(--ink);
  background: var(--paper);
  color: var(--ink-2);
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  font-family: var(--mono);
  font-weight: 600;
  cursor: pointer;
  transition: all 0.12s ease;
  position: relative;
}
.chip:hover {
  background: var(--paper-2);
  color: var(--ink);
}
.chip.active {
  color: var(--paper);
  background: var(--ink);
}
.chip .chip-code {
  font-size: 9px;
  opacity: 0.7;
  letter-spacing: 0.18em;
}
.chip.active .chip-code { opacity: 0.85; }
.chip .chip-count {
  font-size: 10px;
  opacity: 0.7;
  border-left: 1px solid currentColor;
  padding-left: 8px;
  margin-left: 4px;
}

.filter-secondary {
  margin-top: 14px;
  display: flex;
  align-items: center;
  gap: 14px;
  font-size: 10px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ink-2);
  flex-wrap: wrap;
}
.filter-secondary .seg {
  display: inline-flex;
  border: 1px solid var(--ink);
}
.filter-secondary .seg button {
  background: transparent;
  border: none;
  color: var(--ink-2);
  padding: 6px 12px;
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  font-weight: 600;
  cursor: pointer;
}
.filter-secondary .seg button + button { border-left: 1px solid var(--ink); }
.filter-secondary .seg button.on {
  background: var(--ink);
  color: var(--paper);
}
.filter-secondary .toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  user-select: none;
  font-weight: 600;
  background: transparent;
  border: none;
  padding: 0;
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ink-2);
}
.filter-secondary .toggle[aria-pressed="true"] { color: var(--ink); }
.filter-secondary .toggle[aria-pressed="true"] .box {
  background: var(--ink);
  color: var(--paper);
}
.seg-label-sort { margin-left: 12px; }
.filter-secondary .toggle .box {
  width: 14px; height: 14px;
  border: 1px solid var(--ink);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  color: var(--ink);
  background: var(--paper);
}

/* ============================================================
   RESULTS HEADER
   ============================================================ */
.results-bar {
  margin-top: 24px;
  border: 1px solid var(--ink);
  border-bottom: none;
  background: var(--paper-2);
  padding: 6px 14px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 10px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--ink-2);
}
.results-bar .hot { color: var(--ink); font-weight: 700; }
.results-bar .amber { color: var(--amber); font-weight: 700; }

/* ============================================================
   TABLE / CARDS
   ============================================================ */
.category-block {
  border: 1px solid var(--ink);
  border-bottom: none;
}
.category-block:last-child { border-bottom: 1px solid var(--ink); }
.cat-header {
  padding: 14px 22px;
  background: var(--paper-2);
  border-bottom: 1px solid var(--ink);
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 22px;
}
.cat-header .cat-glyph {
  font-size: 22px;
  color: var(--amber);
  letter-spacing: 0;
  font-weight: 700;
}
.cat-header h2 {
  margin: 0;
  font-family: var(--mono);
  font-size: 18px;
  font-weight: 800;
  letter-spacing: 0.06em;
  color: var(--ink);
}
.cat-header h2 .code {
  font-size: 11px;
  color: var(--amber);
  margin-right: 14px;
  letter-spacing: 0.18em;
  font-weight: 700;
}
.cat-header .cat-tag {
  font-size: 11px;
  color: var(--ink-2);
  letter-spacing: 0.06em;
  margin-top: 2px;
  font-weight: 500;
}
.cat-header .cat-count {
  font-size: 10px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--ink-2);
  border: 1px solid var(--ink);
  padding: 4px 10px;
  background: var(--paper);
  font-weight: 700;
}

.table-head {
  display: grid;
  grid-template-columns: 56px minmax(260px, 2.2fr) 130px 110px 110px 110px 1.5fr;
  align-items: center;
  padding: 8px 22px;
  font-size: 10px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--ink-2);
  background: var(--paper);
  border-bottom: 1px solid var(--ink);
  gap: 12px;
  font-weight: 700;
}
.table-head .num { text-align: right; }

.row {
  display: grid;
  grid-template-columns: 56px minmax(260px, 2.2fr) 130px 110px 110px 110px 1.5fr;
  align-items: center;
  padding: 14px 22px;
  gap: 12px;
  border-bottom: 1px dashed var(--line);
  position: relative;
  cursor: default;
  transition: background 0.12s ease;
  background: var(--paper);
}
.row:hover::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0; bottom: 0;
  width: 3px;
  background: var(--amber);
  animation: row-mark 0.4s ease-out;
}
@keyframes row-mark {
  from { transform: scaleY(0); }
  to { transform: scaleY(1); }
}
.row:last-child { border-bottom: none; }
.row:nth-child(even) { background: var(--paper-2); }
.row:hover {
  background: var(--paper-3);
}
.row:hover .model-name { animation: jitter 0.4s steps(2) infinite; }
.row.disabled { opacity: 0.5; }
.row.disabled .model-name { text-decoration: line-through; text-decoration-color: var(--red); }

@keyframes jitter {
  0%, 100% { transform: translate(0, 0); }
  25% { transform: translate(-1px, 0); }
  50% { transform: translate(1px, -1px); }
  75% { transform: translate(0, 1px); }
}

.row-idx {
  font-size: 11px;
  color: var(--ink-2);
  letter-spacing: 0.1em;
  font-weight: 700;
}
.row-idx::before { content: ">"; margin-right: 4px; color: var(--amber); }

.model-cell {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.model-name {
  font-size: 16px;
  font-weight: 700;
  color: var(--ink);
  letter-spacing: 0.01em;
}
.model-flags {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-top: 2px;
}
.flag {
  font-size: 9px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  padding: 2px 6px;
  border: 1px solid currentColor;
  font-weight: 700;
}
.flag.NEW { color: var(--amber); border-color: var(--amber); animation: flag-pulse 1.8s ease-in-out infinite; }
.flag.PICK { color: var(--paper); background: var(--ink); border-color: var(--ink); }
.flag.DISABLED { color: var(--red); border-color: var(--red); }
.flag.PRICE_CUT { color: var(--cyan); border-color: var(--cyan); }
.flag.BETA { color: var(--magenta); border-color: var(--magenta); }
.flag.VISION { color: var(--cyan); border-color: var(--cyan); }
.flag.CHEAPEST { color: var(--paper); background: var(--amber); border-color: var(--amber); }

@keyframes flag-pulse {
  0%, 100% { background: transparent; }
  50% { background: rgba(184,83,10,0.18); }
}

.provider-cell {
  font-size: 12px;
  letter-spacing: 0.06em;
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
}
.provider-cell .pdot {
  width: 8px; height: 8px;
}
.provider-cell.Anthropic .pdot { background: #c35a26; }
.provider-cell.OpenAI .pdot { background: #0a7a55; }
.provider-cell.Cursor .pdot { background: #1d4ed8; }
.provider-cell.Google .pdot { background: #b07c10; }
.provider-cell.DeepSeek .pdot { background: #5b3fc9; }
.provider-cell.xAI .pdot { background: #b91777; }
.provider-cell.Moonshot .pdot { background: #8a7506; }

.price-cell {
  font-family: var(--mono);
  font-size: 14px;
  font-weight: 600;
  text-align: right;
  letter-spacing: 0.01em;
  color: var(--ink);
}
.price-cell .unit {
  font-size: 9px;
  color: var(--ink-2);
  letter-spacing: 0.18em;
  text-transform: uppercase;
  display: block;
  margin-top: 2px;
  font-weight: 600;
}
.price-cell.none { color: var(--paper-4); }
.price-cell.cheap { color: var(--ink-3); }
.price-cell.expensive { color: var(--red); }
.price-cell .bar {
  display: block;
  margin-top: 4px;
  height: 2px;
  background: linear-gradient(to right, currentColor, transparent);
  opacity: 0.7;
}

.note-cell {
  font-size: 11px;
  line-height: 1.5;
  color: var(--ink-2);
  letter-spacing: 0.02em;
  font-weight: 500;
}
.note-cell .bench {
  display: inline-block;
  margin-right: 8px;
  padding: 1px 6px;
  border: 1px solid var(--cyan);
  color: var(--cyan);
  font-size: 9px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  font-weight: 700;
}

/* ============================================================
   EMPTY STATE
   ============================================================ */
.empty {
  padding: 60px 40px;
  text-align: center;
  border: 1px dashed var(--line-hot);
  margin-top: 28px;
  background: var(--paper-2);
}
.empty pre {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--red);
  margin: 0 0 18px;
  line-height: 1.3;
  font-weight: 700;
}
.empty .msg {
  font-family: var(--mono);
  font-size: 14px;
  color: var(--ink);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-weight: 700;
}
.empty .hint {
  font-size: 11px;
  color: var(--ink-2);
  margin-top: 12px;
  letter-spacing: 0.1em;
}

/* ============================================================
   TIPS PANEL
   ============================================================ */
.tips-section {
  margin-top: 36px;
  border: 1px solid var(--ink);
}
.tips-section .cmd-header { border-bottom: 1px solid var(--ink); }
.tips-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0;
  background: var(--paper);
}
.tip {
  border-right: 1px dashed var(--line);
  border-bottom: 1px dashed var(--line);
  padding: 18px 22px;
  font-size: 12px;
  line-height: 1.55;
}
.tip:nth-child(3n) { border-right: none; }
.tip:nth-last-child(-n+3) { border-bottom: none; }
.tip .tip-k {
  font-size: 10px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--amber);
  margin-bottom: 6px;
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
}
.tip .tip-k::before {
  content: ">>";
  color: var(--ink);
  font-weight: 800;
}
.tip .tip-v { color: var(--ink-2); font-weight: 500; }
.tip .tip-v b { color: var(--ink); font-weight: 700; }

/* ============================================================
   FOOTER
   ============================================================ */
.footer {
  margin-top: 36px;
  border-top: 1px dashed var(--line);
  padding-top: 18px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 10px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--ink-2);
  flex-wrap: wrap;
  gap: 16px;
  font-weight: 600;
}
.footer .ascii {
  font-size: 10px;
  color: var(--ink-2);
  white-space: pre;
  line-height: 1;
  font-family: var(--mono);
  font-weight: 700;
}

/* ============================================================
   STATUS LINE
   ============================================================ */
.statusline {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  background: var(--ink);
  color: var(--paper);
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  padding: 4px 16px;
  display: flex;
  justify-content: space-between;
  z-index: 100;
  font-weight: 700;
  overflow: hidden;
}
.statusline .ticker {
  flex: 1;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 22px;
  white-space: nowrap;
  overflow: hidden;
  mask-image: linear-gradient(90deg, transparent, #000 8%, #000 92%, transparent);
}
.statusline .ticker-track {
  display: inline-flex;
  gap: 32px;
  animation: ticker-scroll 60s linear infinite;
  white-space: nowrap;
}
.statusline .ticker-track span {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.statusline .ticker-track .tk-dot {
  width: 6px; height: 6px;
  background: var(--paper);
  display: inline-block;
}
.statusline .ticker-track .tk-amber { color: #ffc56b; }
.statusline .ticker-track .tk-cyan { color: #9be1ff; }
.statusline .ticker-track .tk-red { color: #ff9a9a; }
@keyframes ticker-scroll {
  0% { transform: translateX(0); }
  100% { transform: translateX(-50%); }
}
.statusline .s-l, .statusline .s-r {
  display: flex; gap: 18px;
}
.statusline .blink-square {
  width: 8px; height: 8px;
  background: var(--paper);
  display: inline-block;
  margin-right: 6px;
  animation: blink 0.8s steps(1) infinite;
}

/* responsive */
@media (min-width: 761px) and (max-width: 1100px) {
  .shell { padding: 24px 24px 80px; }
  .hero-grid { grid-template-columns: 1fr; }
  .hero h1 { font-size: 30px; }
  .table-head, .row { grid-template-columns: 40px 1fr 100px 80px 80px 80px; }
  .table-head .col-note, .row .note-cell { display: none; }
  .tips-grid { grid-template-columns: 1fr 1fr; }
  .tip:nth-child(3n) { border-right: 1px dashed var(--line); }
  .tip:nth-child(2n) { border-right: none; }
}

@media (max-width: 760px) {
  body { font-size: 13px; }
  .shell { padding: 14px 14px 96px; }

  /* TITLEBAR – stack right side under */
  .titlebar { padding: 6px 10px; font-size: 9px; flex-wrap: wrap; gap: 8px; }
  .titlebar .tb-r { font-size: 9px; gap: 10px; flex-wrap: wrap; }
  .titlebar .tb-r span:nth-child(3) { display: none; }

  /* HERO */
  .hero { padding: 18px 16px; }
  .hero-grid { gap: 22px; }
  .ascii-logo {
    font-size: 5.2px;
    line-height: 1.0;
    overflow: hidden;
    margin-bottom: 14px;
  }
  .hero h1 { font-size: 22px; line-height: 1.15; letter-spacing: 0.02em; }
  .hero .subtitle { font-size: 11px; margin-bottom: 14px; }
  .hero .meta { gap: 10px; font-size: 9px; padding-top: 12px; margin-top: 14px; }
  .hero-side { padding: 12px 14px; }
  .hero-side h4 { font-size: 9px; }

  /* COMMAND BAR */
  .cmd-header { padding: 5px 10px; font-size: 9px; }
  .cmd-body { padding: 12px 14px 14px; }
  .search-row { padding: 8px 10px; gap: 8px; flex-wrap: wrap; }
  .search-prompt { font-size: 10px; flex-basis: 100%; }
  .search-input { font-size: 15px; min-width: 0; flex: 1; }
  .search-cursor { display: none; }
  .search-keyhint { display: none; }

  .filter-row { gap: 6px; margin-top: 12px; }
  .chip { padding: 6px 10px; font-size: 9.5px; gap: 6px; }
  .chip .chip-code { display: none; }
  .chip .chip-count { padding-left: 6px; margin-left: 2px; font-size: 9px; }

  .filter-secondary {
    margin-top: 12px;
    gap: 10px;
    font-size: 9px;
  }
  .filter-secondary .seg button { padding: 5px 8px; font-size: 9px; }
  .filter-secondary .toggle { margin-left: 0 !important; }

  /* RESULTS BAR */
  .results-bar {
    padding: 6px 12px;
    font-size: 9px;
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
  }

  /* CATEGORY + TABLE → cards */
  .cat-header {
    padding: 12px 14px;
    gap: 12px;
    grid-template-columns: auto 1fr;
  }
  .cat-header .cat-count { grid-column: 1 / -1; justify-self: start; font-size: 9px; padding: 3px 8px; }
  .cat-header h2 { font-size: 14px; letter-spacing: 0.04em; }
  .cat-header h2 .code { display: block; margin: 0 0 4px; font-size: 9px; }
  .cat-header .cat-tag { font-size: 10px; }
  .cat-header .cat-glyph { font-size: 18px; }

  .table-head { display: none; }

  /* Row reflow: idx + model (top), 3 price cells (middle), note (bottom)
     Children order in DOM: 1 idx · 2 model · 3 provider · 4 input · 5 cache · 6 output · 7 note */
  .row {
    grid-template-columns: 30px 1fr 1fr 1fr;
    grid-template-rows: auto auto auto;
    column-gap: 10px;
    row-gap: 10px;
    padding: 14px;
    align-items: start;
  }
  .row .row-idx {
    grid-column: 1;
    grid-row: 1;
    font-size: 10px;
    padding-top: 4px;
  }
  .row .model-cell {
    grid-column: 2 / -1;
    grid-row: 1;
    gap: 4px;
  }
  .row .model-name { font-size: 14px; }
  .row .provider-cell {
    grid-column: 2 / -1;
    grid-row: 2;
    font-size: 10px;
    gap: 6px;
  }
  .row .price-cell {
    grid-row: 3;
    text-align: left;
    font-size: 13px;
    padding: 8px 10px;
    border: 1px dashed var(--line);
    background: var(--paper);
    align-self: stretch;
  }
  .row .price-cell:nth-child(4) { grid-column: 1 / 3; }
  .row .price-cell:nth-child(5) { grid-column: 3 / 4; }
  .row .price-cell:nth-child(6) { grid-column: 4 / 5; }
  .row .price-cell .unit { font-size: 8.5px; }
  .row .price-cell .bar { margin-top: 4px; }
  .row .price-cell.none { padding: 8px 10px; text-align: center; }

  .row .note-cell {
    display: block;
    grid-column: 1 / -1;
    grid-row: 4;
    font-size: 11px;
    line-height: 1.5;
    padding-top: 4px;
    border-top: 1px dashed var(--line);
  }
  .row .note-cell .bench { font-size: 8.5px; }

  /* TIPS */
  .tips-grid { grid-template-columns: 1fr; }
  .tip { border-right: none !important; border-bottom: 1px dashed var(--line); padding: 14px 16px; }
  .tips-section .cmd-header { font-size: 9px; padding: 5px 10px; }

  /* FOOTER */
  .footer { font-size: 9px; gap: 8px; padding-top: 14px; }
  .footer .ascii { font-size: 8px; }

  /* STATUS LINE — keep ticker but compress */
  .statusline { font-size: 9px; padding: 3px 10px; gap: 8px; }
  .statusline .s-l span:nth-child(3),
  .statusline .s-l span:nth-child(4) { display: none; }
  .statusline .s-r span:nth-child(2) { display: none; }
  .statusline .ticker { display: none; }

  /* BOOT */
  #boot-overlay { padding: 24px 16px; }
  #boot-overlay pre { font-size: 10px; line-height: 1.4; }

  /* dampen the background mesh + scanline opacity a bit */
  #bg-grid { opacity: 0.4; }
}

/* iPhone 15 (393px) and below — tighten further */
@media (max-width: 430px) {
  .shell { padding: 12px 10px 96px; }
  .hero { padding: 14px 12px; }
  .ascii-logo { font-size: 4.4px; }
  .hero h1 { font-size: 19px; }
  .hero .subtitle { font-size: 10.5px; }
  .hero .meta { font-size: 8.5px; gap: 8px; }
  .cmd-body { padding: 10px 12px; }

  /* keep filter chips on multiple rows nicely */
  .filter-row { gap: 5px; }
  .chip { padding: 5px 8px; font-size: 9px; }

  .row { padding: 12px; column-gap: 8px; }
  .row .row-idx { font-size: 9.5px; }
  .row .model-name { font-size: 13.5px; }
  .row .price-cell { padding: 5px 7px; font-size: 12px; }
  .row .note-cell { font-size: 10.5px; }

  .cat-header { padding: 10px 12px; }
  .cat-header h2 { font-size: 13px; }
  .cat-header .cat-tag { font-size: 9.5px; }

  .tip { padding: 12px 14px; font-size: 11px; }
  .tip .tip-k { font-size: 9px; }
}

/* very tight — fold viewport (320px) */
@media (max-width: 360px) {
  .ascii-logo { display: none; }
  .row { grid-template-columns: 24px 1fr 1fr; }
  .row .price-cell:nth-child(4) { grid-column: 1 / 2; }
  .row .price-cell:nth-child(5) { grid-column: 2 / 3; }
  .row .price-cell:nth-child(6) { grid-column: 3 / 4; }
}

/* ============================================================
   UTILITIES — semantic colour helpers used by app.jsx so we
   don't sprinkle inline style={{color:...}} props.
   ============================================================ */
.hot-red    { color: var(--red);   font-weight: 700; }
.hot-amber  { color: var(--amber); font-weight: 700; }
.hot-ink    { color: var(--ink);   font-weight: 700; }

/* footer-link looks like a hyperlink but is a real <button> for the privacy
   reset action — gives keyboard users a real focus target. */
.footer-link {
  background: none;
  border: none;
  padding: 0;
  margin: 0;
  font: inherit;
  letter-spacing: inherit;
  color: var(--amber);
  cursor: pointer;
  text-transform: uppercase;
  text-decoration: underline dotted;
  text-underline-offset: 2px;
}
.footer-link:hover { color: var(--ink); }

/* ============================================================
   FOCUS-VISIBLE — keyboard users need a visible affordance.
   We use a thick amber outline that works on both ink and paper.
   ============================================================ */
.chip:focus-visible,
.filter-secondary .seg button:focus-visible,
.filter-secondary .toggle:focus-visible,
.search-input:focus-visible,
.consent-btn:focus-visible,
.footer-link:focus-visible {
  outline: 2px solid var(--amber);
  outline-offset: 2px;
}

/* ============================================================
   CONSENT BANNER — fixed at the top of the viewport, ink-on-paper
   to match the terminal theme. Stays out of the boot overlay's way
   by sitting just below it in z-order.
   ============================================================ */
.consent-banner {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 9100;
  background: var(--ink);
  color: var(--paper);
  border-bottom: 2px solid var(--amber);
  padding: 12px 18px;
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.02em;
  box-shadow: 0 6px 20px rgba(13, 74, 37, 0.25);
}
.consent-inner {
  max-width: 1480px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}
.consent-icon {
  color: var(--amber);
  font-size: 18px;
  line-height: 1;
  flex-shrink: 0;
}
.consent-text {
  flex: 1;
  min-width: 240px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.consent-text strong {
  color: var(--amber);
  font-weight: 700;
  letter-spacing: 0.14em;
  font-size: 11px;
}
.consent-msg {
  margin: 0;
  line-height: 1.5;
  color: var(--paper);
}
.consent-actions {
  display: flex;
  gap: 8px;
  flex-shrink: 0;
}
.consent-btn {
  background: transparent;
  border: 1px solid var(--paper);
  color: var(--paper);
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.16em;
  font-weight: 700;
  padding: 7px 14px;
  cursor: pointer;
  transition: background 0.12s, color 0.12s, border-color 0.12s;
}
.consent-btn:hover { background: var(--paper); color: var(--ink); }
.consent-accept {
  background: var(--amber);
  border-color: var(--amber);
  color: var(--paper);
}
.consent-accept:hover {
  background: var(--paper);
  border-color: var(--paper);
  color: var(--ink);
}
@media (max-width: 600px) {
  .consent-banner { padding: 10px 12px; font-size: 11px; }
  .consent-inner { gap: 10px; }
  .consent-actions { width: 100%; justify-content: flex-end; }
}

/* ============================================================
   REDUCED MOTION — kill the decorative animations for users
   who've asked the OS not to move things around.
   ============================================================ */
@media (prefers-reduced-motion: reduce) {
  .titlebar::after,
  .search-row::after,
  .glitch::before,
  .glitch::after,
  .blink::after,
  .blink-square,
  .ticker-track,
  .flag.NEW,
  .row:hover::before,
  .row:hover .model-name,
  #boot-overlay {
    animation: none !important;
    transition: none !important;
  }
  #boot-overlay.done { opacity: 0; }
}
