/* Nash Terminal — accessible Bloomberg grammar.
   Near-black neutral instrument surface; amber = labels (never semantic);
   white = data; green/red = direction (never color-only); blue = command/
   selection. Values chosen in OKLCH, shipped as hex so canvas charts parse
   them (bg .10/0/0, panel .17/0.004/250, amber .78/.15/65, up .78/.14/165,
   down .70/.19/25, blue .70/.13/250). See DESIGN.md. */

/* IBM Plex: one type system carrying both voices — Mono for the data grid
   (the terminal voice), Sans for prose. Self-hosted; system stacks are the
   pre-load fallback only. */
@font-face {
  font-family: 'IBM Plex Mono';
  src: url('/fonts/IBMPlexMono-Regular.woff2') format('woff2');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'IBM Plex Mono';
  src: url('/fonts/IBMPlexMono-Medium.woff2') format('woff2');
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'IBM Plex Mono';
  src: url('/fonts/IBMPlexMono-SemiBold.woff2') format('woff2');
  font-weight: 600;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'IBM Plex Mono';
  src: url('/fonts/IBMPlexMono-Bold.woff2') format('woff2');
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'IBM Plex Sans';
  src: url('/fonts/IBMPlexSans-Regular.woff2') format('woff2');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'IBM Plex Sans';
  src: url('/fonts/IBMPlexSans-Medium.woff2') format('woff2');
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'IBM Plex Sans';
  src: url('/fonts/IBMPlexSans-SemiBold.woff2') format('woff2');
  font-weight: 600;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'IBM Plex Sans';
  src: url('/fonts/IBMPlexSans-Bold.woff2') format('woff2');
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

:root {
  --bg: #050607;
  --panel: #101214;
  --panel-2: #191B1E;
  --line: #2C2F33;
  --line-soft: #1E2023;
  --ink: #E8E9EB;
  --soft: #9DA1A6;
  --amber: #F5A83A;
  --amber-dim: #B87F2E;
  --up: #35D399;
  --down: #F4635F;
  --blue: #5C9DF5;
  --blue-ink: #050607;
  --up-dim: rgba(53, 211, 153, 0.14);
  --down-dim: rgba(244, 99, 95, 0.14);
  --blue-dim: rgba(92, 157, 245, 0.16);
  --radius: 4px;
  --font-mono: 'IBM Plex Mono', ui-monospace, 'SF Mono', 'Cascadia Mono', Consolas, 'Liberation Mono', Menlo, monospace;
  --font-sans: 'IBM Plex Sans', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --z-menu: 30;
  --z-sheet: 50;
  --z-toast: 60;
  color-scheme: dark;
}

* { box-sizing: border-box; }

/* The shell is the anchor: html/body never scroll; only the view does.
   touch-action pan-x pan-y blocks page pinch-zoom and double-tap zoom;
   chart surfaces opt out below and run their own pinch. */
html {
  height: 100%;
  overflow: hidden;
  touch-action: pan-x pan-y;
}

body {
  margin: 0;
  height: 100%;
  height: 100dvh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-mono);
  font-size: 13.5px;
  line-height: 1.45;
  font-variant-numeric: tabular-nums;
}

h1, h2, h3 { margin: 0; font-weight: 600; line-height: 1.2; }
a { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; }
button { font: inherit; cursor: pointer; color: inherit; }
p { margin: 0; }

:focus-visible {
  outline: 2px solid var(--blue);
  outline-offset: 1px;
  border-radius: 2px;
}

::selection { background: var(--blue-dim); }

.pos { color: var(--up); }
.neg { color: var(--down); }
.soft { color: var(--soft); }
.amber { color: var(--amber); }

/* Prose voice for explanations and verdict sentences. */
.prose { font-family: var(--font-sans); font-size: 13.5px; }

/* ---------- Command bar ---------- */

.cmd-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  background: var(--panel);
  border-bottom: 1px solid var(--line);
  position: relative;
  z-index: var(--z-menu);
}

.brand {
  font-weight: 700;
  font-size: 14px;
  letter-spacing: 0.12em;
  color: var(--amber);
  text-decoration: none;
  padding: 4px 2px;
  white-space: nowrap;
}
.brand:hover { text-decoration: none; }
.brand small { color: var(--soft); font-weight: 400; letter-spacing: 0.08em; }
@media (max-width: 480px) { .brand small { display: none; } }

.cmd {
  position: relative;
  display: flex;
  align-items: center;
  flex: 1;
  min-width: 0;
  max-width: 560px;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}
.cmd:focus-within { border-color: var(--blue); }
.cmd-prompt {
  color: var(--blue);
  padding: 0 2px 0 10px;
  font-weight: 700;
  user-select: none;
}
#cmd-input {
  flex: 1;
  width: 0;
  min-width: 0;
  min-height: 38px;
  padding: 6px 8px;
  background: none;
  border: none;
  color: var(--ink);
  font: inherit;
  text-transform: uppercase;
}
#cmd-input::placeholder { color: var(--soft); text-transform: none; opacity: 1; }
#cmd-input:focus { outline: none; }
.cmd-go {
  min-height: 38px;
  padding: 0 14px;
  border: none;
  border-left: 1px solid var(--line);
  background: var(--blue-dim);
  color: var(--blue);
  font-weight: 700;
  letter-spacing: 0.06em;
  border-radius: 0 var(--radius) var(--radius) 0;
}
.cmd-go:hover { background: var(--blue); color: var(--blue-ink); }

.cmd-menu {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  max-height: 320px;
  overflow-y: auto;
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
  z-index: var(--z-menu);
}
.cmd-menu[hidden] { display: none; }
.cmd-option {
  display: flex;
  align-items: baseline;
  gap: 10px;
  width: 100%;
  padding: 9px 12px;
  background: none;
  border: none;
  text-align: left;
  color: var(--ink);
}
.cmd-option .co-code { color: var(--amber); font-weight: 700; min-width: 52px; }
.cmd-option .co-name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cmd-option .co-hint { color: var(--soft); font-size: 12px; }
.cmd-option:hover, .cmd-option[aria-selected="true"] { background: var(--blue-dim); }

.bar-right { display: flex; align-items: center; gap: 8px; margin-left: auto; }

/* Function tabs (desktop). */
.fn-tabs { display: none; }
@media (min-width: 900px) {
  .fn-tabs { display: flex; gap: 2px; }
  .fn-tabs a {
    padding: 8px 12px;
    color: var(--soft);
    border-radius: var(--radius);
    font-weight: 600;
    letter-spacing: 0.04em;
  }
  .fn-tabs a:hover { color: var(--ink); text-decoration: none; background: var(--panel-2); }
  .fn-tabs a[aria-current="page"] { color: var(--amber); background: var(--panel-2); }
  .fn-tabs a .fn-code { color: var(--amber-dim); margin-right: 6px; }
  .fn-tabs a[aria-current="page"] .fn-code { color: var(--amber); }
}

/* ---------- Workspace layout ---------- */

/* The view is the app's only scroll container; the chrome around it stays
   anchored. Width is capped on the children so the scrollbar hugs the
   viewport edge on wide screens. */
.view {
  flex: 1;
  min-height: 0;
  width: 100%;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 12px;
}
.view > * { max-width: 1480px; margin-inline: auto; }
.view > * + * { margin-top: 10px; }
.view:focus { outline: none; }

.workspace { display: grid; gap: 10px; grid-template-columns: 1fr; }
@media (min-width: 900px) {
  .workspace { grid-template-columns: minmax(0, 1fr) 340px; align-items: start; }
  .workspace.with-rail { grid-template-columns: 232px minmax(0, 1fr) 340px; }
}
.ws-main { display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.ws-side { display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.ws-rail { display: none; }
@media (min-width: 900px) {
  .ws-rail { display: flex; flex-direction: column; gap: 10px; position: sticky; top: 0; }
}

/* ---------- Panels ---------- */

.panel {
  background: var(--panel);
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
  min-width: 0;
}
.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 12px;
  border-bottom: 1px solid var(--line-soft);
}
.panel-title {
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--amber);
}
.panel-code {
  font-size: 11px;
  color: var(--soft);
  letter-spacing: 0.08em;
}
.panel-body { padding: 10px 12px; }
.panel-body.tight { padding: 6px 8px; }
.panel-body.flush { padding: 0; }

/* ---------- Key-value stat rows ---------- */

.kv { display: flex; flex-direction: column; }
.kv-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  padding: 5px 0;
  border-bottom: 1px solid var(--line-soft);
  min-height: 28px;
}
.kv-row:last-child { border-bottom: none; }
.kv-row dt, .kv-row .kv-label { color: var(--soft); }
.kv-row dd, .kv-row .kv-value { margin: 0; text-align: right; color: var(--ink); }
.kv-note { font-family: var(--font-sans); font-size: 12.5px; color: var(--soft); margin-top: 2px; }

/* ---------- Watchlist rail ---------- */

.rail-group-title {
  padding: 8px 12px 4px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--amber);
}
.rail-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  width: 100%;
  padding: 6px 12px;
  background: none;
  border: none;
  color: var(--ink);
  text-decoration: none;
  min-height: 32px;
}
.rail-row:hover { background: var(--panel-2); text-decoration: none; }
.rail-row[aria-current="true"] { background: var(--panel-2); }
.rail-row[aria-current="true"] .rr-sym { color: var(--amber); }
.rail-row .rr-sym { font-weight: 600; }
.rail-row .rr-name { color: var(--soft); font-size: 11.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rail-row .rr-val { text-align: right; white-space: nowrap; }
.rail-row .rr-val small { display: block; font-size: 11px; }

/* Horizontal strip version of the watchlist on small screens. */
.rail-strip {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  padding: 2px;
  -webkit-overflow-scrolling: touch;
}
@media (min-width: 900px) { .rail-strip { display: none; } }
.strip-cell {
  flex: 0 0 auto;
  padding: 6px 10px;
  background: var(--panel);
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
  text-decoration: none;
  color: var(--ink);
  min-height: 44px;
}
.strip-cell .rr-sym { font-weight: 700; margin-right: 6px; }

/* ---------- Security header ---------- */

.sec-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 6px 14px;
  padding: 2px 2px 0;
}
.sec-head .sh-sym { font-size: 20px; font-weight: 700; color: var(--amber); letter-spacing: 0.03em; }
.sec-head .sh-name { font-family: var(--font-sans); color: var(--soft); font-size: 14px; }
.sec-head .sh-price { font-size: 26px; font-weight: 700; }
.sec-head .sh-chg { font-size: 15px; font-weight: 600; }
.sec-head .sh-meta { width: 100%; color: var(--soft); font-size: 12px; display: flex; flex-wrap: wrap; gap: 4px 14px; }

/* ---------- Verdict chips ---------- */

.chip {
  display: inline-block;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  padding: 2px 8px;
  border-radius: 3px;
  border: 1px solid currentColor;
  vertical-align: middle;
}
.chip.pos { background: var(--up-dim); }
.chip.neg { background: var(--down-dim); }
.chip.info { color: var(--blue); background: var(--blue-dim); }
.chip.warn { color: var(--amber); background: rgba(245, 168, 58, 0.12); }

/* ---------- Explain (plain words, one tap behind) ---------- */

.explain { display: inline; }
.explain > summary {
  display: inline;
  list-style: none;
  cursor: pointer;
  border-bottom: 1px dotted var(--amber-dim);
}
.explain > summary::-webkit-details-marker { display: none; }
.explain[open] > .explain-note {
  display: block;
  margin: 6px 0 4px;
  padding: 8px 10px;
  background: var(--panel-2);
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
  font-family: var(--font-sans);
  font-size: 12.5px;
  color: var(--ink);
  text-align: left;
  text-transform: none;
  letter-spacing: normal;
  font-weight: 400;
  white-space: normal;
}

/* ---------- Charts ---------- */

.chart-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px;
  padding: 6px 8px;
  border-bottom: 1px solid var(--line-soft);
}
.chart-toolbar .spacer { flex: 1; }
.tbtn {
  min-height: 30px;
  padding: 3px 10px;
  border: 1px solid transparent;
  border-radius: 3px;
  background: none;
  color: var(--soft);
  font-weight: 600;
  font-size: 12px;
}
.tbtn:hover { color: var(--ink); background: var(--panel-2); }
.tbtn[aria-pressed="true"] { color: var(--amber); background: var(--panel-2); border-color: var(--line); }

/* Chart surfaces own their gestures: the browser stays out (no pan, no page
   zoom) and lightweight-charts runs its own pinch/pan on the canvas. */
.chart-box, .chart-box * { touch-action: none; }

.chart-box { position: relative; width: 100%; height: 380px; }
.chart-box.short { height: 240px; }
.chart-box.mini { height: 160px; }

.chart-legend {
  position: absolute;
  top: 6px;
  left: 8px;
  z-index: 3;
  pointer-events: none;
  font-size: 11.5px;
  color: var(--soft);
  background: rgba(16, 18, 20, 0.82);
  padding: 3px 8px;
  border-radius: 3px;
  max-width: calc(100% - 16px);
}
.chart-legend b { color: var(--ink); font-weight: 600; }

.chart-summary {
  font-family: var(--font-sans);
  font-size: 12.5px;
  color: var(--soft);
  padding: 6px 12px 10px;
}

@media (max-width: 600px) { .chart-box { height: 300px; } }

/* ---------- Tables ---------- */

.tbl { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.tbl th {
  text-align: left;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--soft);
  padding: 6px 10px;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}
.tbl td { padding: 6px 10px; border-bottom: 1px solid var(--line-soft); }
.tbl tr:last-child td { border-bottom: none; }
.tbl td.num, .tbl th.num { text-align: right; }
.tbl a { color: var(--ink); font-weight: 600; }
.tbl a:hover { color: var(--blue); }
.tbl tbody tr:hover { background: var(--panel-2); }
.table-scroll { overflow-x: auto; }

/* Small screens: the symbol column stays frozen while the rest of the row
   scrolls under it; the trailing shadow signals more content to the right. */
@media (max-width: 899px) {
  .table-scroll .tbl th:first-child,
  .table-scroll .tbl td:first-child {
    position: sticky;
    left: 0;
    z-index: 1;
    background: var(--panel);
  }
  .table-scroll .tbl tbody tr:hover td:first-child { background: var(--panel-2); }
  .table-scroll .tbl th:first-child::after,
  .table-scroll .tbl td:first-child::after {
    content: '';
    position: absolute;
    top: 0;
    bottom: 0;
    right: -10px;
    width: 10px;
    pointer-events: none;
    background: linear-gradient(90deg, rgba(0, 0, 0, 0.35), transparent);
  }
}

/* ---------- Sector heatmap ---------- */

.heat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(118px, 1fr));
  gap: 4px;
  padding: 8px;
}
.heat-cell {
  padding: 8px 9px;
  border-radius: 3px;
  min-height: 52px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  border: 1px solid var(--line-soft);
}
.heat-cell .hc-label { font-size: 11px; color: var(--ink); opacity: 0.95; }
.heat-cell .hc-val { font-weight: 700; font-size: 13px; color: var(--ink); }

/* ---------- Options P&L matrix ---------- */

.matrix-scroll { overflow-x: auto; padding: 8px; }
.matrix { border-collapse: collapse; font-size: 11.5px; min-width: 560px; }
.matrix th {
  color: var(--soft);
  font-weight: 600;
  padding: 3px 6px;
  text-align: right;
  white-space: nowrap;
}
.matrix td {
  padding: 3px 6px;
  text-align: right;
  border: 1px solid var(--bg);
  color: var(--ink);
  min-width: 46px;
}
.matrix .mx-spot { color: var(--soft); font-weight: 600; }

/* ---------- Fear gauge (compact scale bar) ---------- */

.fear-scale { position: relative; height: 8px; border-radius: 4px; margin: 10px 2px 4px;
  background: linear-gradient(90deg, var(--up) 0 25%, var(--amber) 25% 50%, var(--down) 50% 100%);
  opacity: 0.85;
}
.fear-marker {
  position: absolute;
  top: -4px;
  width: 3px;
  height: 16px;
  background: var(--ink);
  border-radius: 2px;
  transform: translateX(-50%);
}
.fear-ends { display: flex; justify-content: space-between; font-size: 10.5px; color: var(--soft); }

/* ---------- Buttons & forms ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  padding: 6px 16px;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: var(--panel-2);
  color: var(--ink);
  font-weight: 700;
  font-size: 13px;
  text-decoration: none;
}
.btn:hover { border-color: var(--soft); text-decoration: none; }
.btn.buy { background: var(--up-dim); color: var(--up); border-color: var(--up); }
.btn.buy:hover { background: var(--up); color: var(--bg); }
.btn.sell { background: var(--down-dim); color: var(--down); border-color: var(--down); }
.btn.sell:hover { background: var(--down); color: var(--bg); }
.btn.go { background: var(--blue-dim); color: var(--blue); border-color: var(--blue); }
.btn.go:hover { background: var(--blue); color: var(--blue-ink); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }
.btn-link {
  background: none;
  border: none;
  color: var(--blue);
  font-weight: 600;
  min-height: 34px;
  padding: 4px 6px;
}
.btn-link:hover { text-decoration: underline; }

.field { margin: 8px 0; }
.field label { display: block; font-size: 11.5px; color: var(--soft); letter-spacing: 0.05em; text-transform: uppercase; margin-bottom: 3px; }
.field input, .field select {
  width: 100%;
  min-height: 38px;
  font: inherit;
  padding: 6px 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--bg);
  color: var(--ink);
}
.field input:focus, .field select:focus { border-color: var(--blue); outline: none; }
.field .hint { font-family: var(--font-sans); font-size: 12px; color: var(--soft); margin-top: 3px; }

.form-row { display: flex; flex-wrap: wrap; gap: 0 12px; align-items: flex-end; }
.form-row .field { flex: 1 1 120px; }

.choice-row { display: flex; gap: 6px; flex-wrap: wrap; }
.choice-row button {
  flex: 1;
  min-height: 38px;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: var(--bg);
  color: var(--soft);
  font-weight: 600;
}
.choice-row button[aria-pressed="true"] { border-color: var(--blue); background: var(--blue-dim); color: var(--blue); }

/* ---------- Model chips strip ---------- */

.model-strip { display: flex; flex-wrap: wrap; gap: 6px; }
.model-chip {
  display: inline-flex;
  align-items: baseline;
  gap: 8px;
  padding: 7px 12px;
  min-height: 38px;
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--ink);
  text-decoration: none;
  font-weight: 600;
  font-size: 12.5px;
}
.model-chip:hover { border-color: var(--amber-dim); text-decoration: none; }
.model-chip .mc-code { color: var(--amber); font-weight: 700; letter-spacing: 0.05em; }

/* ---------- Sheets, toasts, empty/error ---------- */

.sheet {
  position: fixed;
  inset: 0;
  z-index: var(--z-sheet);
  background: rgba(0, 0, 0, 0.6);
  display: flex;
  align-items: flex-end;
}
@media (min-width: 720px) { .sheet { align-items: center; justify-content: center; } }
.sheet[hidden] { display: none; }
.sheet-panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px 8px 0 0;
  padding: 16px 16px calc(16px + env(safe-area-inset-bottom));
  width: 100%;
  max-height: 85vh;
  overflow-y: auto;
}
@media (min-width: 720px) { .sheet-panel { max-width: 460px; border-radius: 8px; } }

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(86px + env(safe-area-inset-bottom));
  transform: translateX(-50%);
  z-index: var(--z-toast);
  background: var(--panel-2);
  border: 1px solid var(--line);
  color: var(--ink);
  padding: 10px 18px;
  border-radius: var(--radius);
  font-weight: 600;
  max-width: 92vw;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.5);
}
@media (min-width: 900px) { .toast { bottom: 48px; } }

.empty-note {
  text-align: center;
  padding: 22px 14px;
  color: var(--soft);
  font-family: var(--font-sans);
  font-size: 13px;
}
.empty-note strong { color: var(--ink); }

/* ---------- Status bar ---------- */

.status-bar {
  flex: none;
  display: none;
  align-items: center;
  gap: 16px;
  padding: 4px 12px;
  background: var(--panel);
  border-top: 1px solid var(--line);
  font-size: 11.5px;
  color: var(--soft);
  min-height: 26px;
}
@media (min-width: 900px) { .status-bar { display: flex; } }
.status-bar .sb-item { display: inline-flex; align-items: center; gap: 5px; white-space: nowrap; }
.status-bar .spacer { flex: 1; }
.status-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--line); display: inline-block; }
.status-dot.on { background: var(--up); }
kbd {
  font-family: var(--font-mono);
  font-size: 10.5px;
  padding: 1px 5px;
  border: 1px solid var(--line);
  border-bottom-width: 2px;
  border-radius: 3px;
  background: var(--panel-2);
  color: var(--ink);
}

/* ---------- Mobile tab bar ---------- */

.tabbar {
  flex: none;
  display: flex;
  background: var(--panel);
  border-top: 1px solid var(--line);
  padding-bottom: env(safe-area-inset-bottom);
}
@media (min-width: 900px) { .tabbar { display: none; } }
.tabbar a {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 56px;
  gap: 1px;
  text-decoration: none;
  color: var(--soft);
}
.tabbar a .tab-code { font-size: 11px; font-weight: 700; letter-spacing: 0.08em; color: var(--amber-dim); }
.tabbar a .tab-word { font-size: 12.5px; font-weight: 600; }
.tabbar a[aria-current="page"] { color: var(--ink); }
.tabbar a[aria-current="page"] .tab-code { color: var(--amber); }

/* ---------- Grids ---------- */

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

/* ---------- Motion & a11y ---------- */

.panel, .btn, .tbtn, .rail-row, .cmd-option { transition: background-color 150ms ease-out, border-color 150ms ease-out, color 150ms ease-out; }

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

/* Slim scrollbars that still meet the terminal look. */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: var(--line); border-radius: 5px; border: 2px solid var(--bg); }
::-webkit-scrollbar-track { background: transparent; }
