/* ==========================================================================
   MarketLens — design system
   Dark, dense, mobile-first. Deliberately terminal-adjacent: this is a tool
   for reading markets, not a marketing page.
   ========================================================================== */

:root {
  /* Surfaces */
  --bg:            #080b11;
  --bg-elev:       #0e131c;
  --surface:       #121926;
  --surface-2:     #18202f;
  --border:        #1f2a3c;
  --border-strong: #2c3a52;

  /* Type */
  --text:          #e9eef7;
  --text-2:        #9aa8bf;
  --text-3:        #64748b;

  /* Brand + semantics */
  --accent:        #e9a13b;
  --accent-dim:    #7a5620;
  --accent-wash:   rgba(233, 161, 59, 0.11);
  --up:            #38d29a;
  --up-wash:       rgba(56, 210, 154, 0.12);
  --down:          #ff5f6d;
  --down-wash:     rgba(255, 95, 109, 0.12);
  --neutral:       #7c8aa3;
  --info:          #5b9cf8;
  --info-wash:     rgba(91, 156, 248, 0.12);

  /* Type scale */
  --font-sans: ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, "SF Mono", "JetBrains Mono", Menlo, Consolas, monospace;

  /* Rhythm */
  --r-sm: 6px;
  --r:    10px;
  --r-lg: 16px;
  --pad:  16px;
  --nav-h: 60px;
}

* { box-sizing: border-box; }

html {
  background: var(--bg);
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  font-family: var(--font-sans);
  background: var(--bg);
  color: var(--text);
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  padding-bottom: calc(var(--nav-h) + env(safe-area-inset-bottom, 0px) + 8px);
  overflow-x: hidden;
}

a { color: inherit; text-decoration: none; }
h1, h2, h3, h4 { margin: 0; font-weight: 650; letter-spacing: -0.015em; line-height: 1.22; }
p { margin: 0 0 0.85em; }
p:last-child { margin-bottom: 0; }

.wrap { max-width: 760px; margin: 0 auto; padding: 0 var(--pad); }

/* ---------------------------------------------------------------- Header */

.masthead {
  position: sticky;
  top: 0;
  z-index: 40;
  background: rgba(8, 11, 17, 0.88);
  backdrop-filter: saturate(150%) blur(14px);
  -webkit-backdrop-filter: saturate(150%) blur(14px);
  border-bottom: 1px solid var(--border);
  padding-top: env(safe-area-inset-top, 0px);
}

.masthead-inner {
  max-width: 760px;
  margin: 0 auto;
  padding: 11px var(--pad);
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 9px;
  font-weight: 700;
  letter-spacing: -0.03em;
  font-size: 17px;
}

.brand-mark {
  width: 22px;
  height: 22px;
  flex: none;
  display: block;
}

.brand em { font-style: normal; color: var(--accent); }

.masthead-meta {
  margin-left: auto;
  text-align: right;
  font-size: 11px;
  line-height: 1.35;
  color: var(--text-3);
  font-family: var(--font-mono);
  letter-spacing: 0.02em;
}

.live-dot {
  display: inline-block;
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--up);
  margin-right: 5px;
  vertical-align: middle;
  box-shadow: 0 0 0 3px var(--up-wash);
}

/* ----------------------------------------------------------- Ticker tape */

.tape {
  border-bottom: 1px solid var(--border);
  background: var(--bg-elev);
  overflow-x: auto;
  overflow-y: hidden;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}
.tape::-webkit-scrollbar { display: none; }

.tape-inner {
  display: flex;
  gap: 0;
  padding: 0;
  width: max-content;
  min-width: 100%;
}

.tick {
  flex: none;
  padding: 9px 14px;
  border-right: 1px solid var(--border);
  min-width: 116px;
}

.tick-label {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.075em;
  color: var(--text-3);
  white-space: nowrap;
  margin-bottom: 2px;
}

.tick-value {
  font-family: var(--font-mono);
  font-size: 14px;
  font-weight: 600;
  letter-spacing: -0.02em;
}

.tick-chg { font-family: var(--font-mono); font-size: 11px; font-weight: 600; }

.up   { color: var(--up); }
.down { color: var(--down); }
.flat { color: var(--neutral); }

/* ------------------------------------------------------------- Structure */

main { padding-top: 22px; }

.section-head {
  display: flex;
  align-items: baseline;
  gap: 10px;
  margin: 30px 0 13px;
}

.section-head:first-child { margin-top: 2px; }

.section-head h2 {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.11em;
  color: var(--text-3);
  font-weight: 650;
}

.section-head .rule {
  flex: 1;
  height: 1px;
  background: var(--border);
}

.section-head .count {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-3);
}

/* ------------------------------------------------------------ Market read */

.read {
  background: linear-gradient(160deg, var(--surface) 0%, var(--bg-elev) 100%);
  border: 1px solid var(--border-strong);
  border-radius: var(--r-lg);
  padding: 20px;
  position: relative;
  overflow: hidden;
}

.read::before {
  content: '';
  position: absolute;
  inset: 0 0 auto 0;
  height: 2px;
  background: linear-gradient(90deg, var(--accent), transparent 70%);
}

.read-kicker {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.13em;
  color: var(--accent);
  font-weight: 700;
  margin-bottom: 9px;
}

.read h1 {
  font-size: 23px;
  line-height: 1.24;
  margin-bottom: 11px;
  letter-spacing: -0.025em;
}

.read-body { color: var(--text-2); font-size: 14.5px; }

.read-regime {
  margin-top: 14px;
  padding-top: 13px;
  border-top: 1px solid var(--border);
  font-size: 11px;
  font-family: var(--font-mono);
  color: var(--text-3);
  text-transform: uppercase;
  letter-spacing: 0.07em;
}
.read-regime b { color: var(--text-2); font-weight: 600; }

/* ----------------------------------------------------------- Story cards */

.cards { display: flex; flex-direction: column; gap: 11px; }

.card {
  display: block;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: 15px 16px;
  transition: border-color 0.16s ease, transform 0.16s ease, background 0.16s ease;
}

.card:active { transform: scale(0.988); }
@media (hover: hover) {
  .card:hover { border-color: var(--border-strong); background: var(--surface-2); }
}

.card-top {
  display: flex;
  align-items: center;
  gap: 9px;
  margin-bottom: 9px;
  flex-wrap: wrap;
}

.rank {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
  color: var(--bg);
  background: var(--accent);
  border-radius: var(--r-sm);
  width: 20px;
  height: 20px;
  display: grid;
  place-items: center;
  flex: none;
}

.card h3 { font-size: 16.5px; line-height: 1.3; margin-bottom: 7px; }
.card .standfirst { color: var(--text-2); font-size: 13.5px; line-height: 1.5; }

.card-foot {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 12px;
  padding-top: 11px;
  border-top: 1px solid var(--border);
  flex-wrap: wrap;
}

/* ------------------------------------------------------------------ Chips */

.chip {
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.045em;
  text-transform: uppercase;
  padding: 3px 8px;
  border-radius: 999px;
  border: 1px solid var(--border-strong);
  color: var(--text-2);
  background: var(--bg-elev);
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.chip--accent  { color: var(--accent); border-color: var(--accent-dim); background: var(--accent-wash); }
.chip--info    { color: var(--info);   border-color: rgba(91,156,248,.35); background: var(--info-wash); }
.chip--up      { color: var(--up);     border-color: rgba(56,210,154,.35);  background: var(--up-wash); }
.chip--down    { color: var(--down);   border-color: rgba(255,95,109,.35);  background: var(--down-wash); }
.chip--mono    { font-family: var(--font-mono); text-transform: none; letter-spacing: 0; }

.chips { display: flex; flex-wrap: wrap; gap: 6px; }

.dot-sep { color: var(--text-3); font-size: 11px; }

.meta { font-size: 11px; color: var(--text-3); font-family: var(--font-mono); }

/* ---------------------------------------------------------- Story detail */

.story-head { margin-bottom: 20px; }

.story-head h1 {
  font-size: 26px;
  line-height: 1.2;
  margin: 12px 0 12px;
  letter-spacing: -0.028em;
}

.story-head .standfirst {
  color: var(--text-2);
  font-size: 15.5px;
  line-height: 1.55;
}

.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: 16px;
  margin-bottom: 12px;
}

.panel-title {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-3);
  font-weight: 650;
  margin-bottom: 11px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.panel-title .num {
  font-family: var(--font-mono);
  color: var(--accent);
}

/* --------------------------------------------------- The three-stage flow */

.flow-nav {
  list-style: none;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  margin: 0 0 22px;
  padding: 0;
}

.flow-nav a {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 9px 10px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  font-size: 11.5px;
  font-weight: 600;
  color: var(--text-2);
  line-height: 1.2;
}

.flow-nav a b {
  font-family: var(--font-mono);
  color: var(--bg);
  background: var(--accent);
  border-radius: 4px;
  width: 17px; height: 17px;
  display: grid; place-items: center;
  font-size: 10.5px;
  flex: none;
}

@media (hover: hover) { .flow-nav a:hover { border-color: var(--border-strong); color: var(--text); } }

.stage { scroll-margin-top: 76px; margin-bottom: 26px; }

.stage-head {
  display: flex;
  align-items: center;
  gap: 11px;
  margin: 0 0 10px;
}

.stage-num {
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 700;
  color: var(--bg);
  background: var(--accent);
  border-radius: 7px;
  width: 26px; height: 26px;
  display: grid; place-items: center;
  flex: none;
}

.stage-head h2 { font-size: 19px; letter-spacing: -0.02em; }

.stage-intro {
  font-size: 13.5px;
  color: var(--text-3);
  line-height: 1.55;
  margin: 0 0 12px;
}

.lead-text { font-size: 15.5px; line-height: 1.6; color: var(--text); }

.why-matters {
  margin-top: 14px;
  padding: 12px 14px;
  background: var(--accent-wash);
  border: 1px solid var(--accent-dim);
  border-radius: var(--r-sm);
  font-size: 14.5px;
  line-height: 1.55;
}

.why-matters b {
  display: block;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--accent);
  margin-bottom: 4px;
  font-weight: 700;
}

/* ------------------------------------------------- Chains of consequence */

.chain { margin-bottom: 26px; }
.chain:last-child { margin-bottom: 0; }

.chain-head {
  display: flex;
  align-items: center;
  gap: 9px;
  margin-bottom: 6px;
  flex-wrap: wrap;
}

.chain-index {
  font-family: var(--font-mono);
  font-size: 10.5px;
  font-weight: 700;
  color: var(--accent);
  border: 1px solid var(--accent-dim);
  background: var(--accent-wash);
  border-radius: 50%;
  width: 19px; height: 19px;
  display: grid; place-items: center;
  flex: none;
}

.chain-name { font-size: 15px; font-weight: 650; letter-spacing: -0.012em; }

.chain-what {
  font-size: 12.5px;
  color: var(--text-3);
  line-height: 1.5;
  margin: 0 0 13px;
  padding-left: 28px;
}

.chain-steps { list-style: none; margin: 0; padding: 0; }

.chain-steps li {
  position: relative;
  padding: 0 0 16px 24px;
  line-height: 1.45;
}

.link-plain { display: block; font-size: 14.5px; color: var(--text); }

.link-detail {
  display: block;
  margin-top: 5px;
  font-size: 12.5px;
  line-height: 1.5;
  color: var(--text-3);
  border-left: 2px solid var(--border-strong);
  padding-left: 9px;
}

.chain-steps li::before {
  content: '';
  position: absolute;
  left: 4px;
  top: 6px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--bg);
  border: 2px solid var(--accent-dim);
}

.chain-steps li::after {
  content: '';
  position: absolute;
  left: 7.5px;
  top: 16px;
  bottom: 2px;
  width: 1px;
  background: linear-gradient(var(--border-strong), var(--border));
}

.chain-steps li:last-child { padding-bottom: 6px; }
.chain-steps li:last-child::before { background: var(--accent); border-color: var(--accent); }
.chain-steps li:last-child::after { display: none; }

.chain-endpoint {
  margin-top: 2px;
  padding: 9px 11px;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-left: 2px solid var(--accent);
  border-radius: 0 var(--r-sm) var(--r-sm) 0;
  font-size: 13px;
}
.chain-endpoint b { color: var(--accent); font-weight: 600; font-size: 10px; text-transform: uppercase; letter-spacing: 0.09em; display: block; margin-bottom: 2px; }

/* ------------------------------------------------------- Asset impacts */

.impact {
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  padding: 13px 14px;
  margin-bottom: 9px;
  background: var(--bg-elev);
}
.impact:last-child { margin-bottom: 0; }

.impact-top {
  display: flex;
  align-items: baseline;
  gap: 10px;
  margin-bottom: 8px;
  flex-wrap: wrap;
}

.impact-instrument { font-weight: 650; font-size: 15px; flex: 1; min-width: 140px; letter-spacing: -0.012em; }

.impact-move {
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 650;
  display: inline-flex;
  align-items: baseline;
  gap: 5px;
  white-space: nowrap;
}

.arrow { font-weight: 700; font-size: 13px; line-height: 1; }

.impact-plain { font-size: 14.5px; color: var(--text); line-height: 1.55; margin: 0 0 8px; }

.impact-detail {
  font-size: 12.5px;
  color: var(--text-3);
  line-height: 1.55;
  margin: 0;
  border-left: 2px solid var(--border-strong);
  padding-left: 9px;
}

.impact-detail b {
  color: var(--text-2);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 650;
  margin-right: 5px;
}

.impact-foot {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 9px;
  flex-wrap: wrap;
}

.conviction { display: inline-flex; gap: 3px; align-items: center; }
.conviction i {
  width: 5px; height: 5px; border-radius: 50%;
  background: var(--border-strong);
  display: block;
}
.conviction i.on { background: var(--accent); }

/* ------------------------------------------------------------- Callouts */

.callout {
  border-radius: var(--r);
  padding: 16px;
  margin-bottom: 12px;
  border: 1px solid;
}

.callout-edge {
  background: linear-gradient(150deg, var(--accent-wash), transparent 80%);
  border-color: var(--accent-dim);
}

.callout-falsify {
  background: var(--surface);
  border-color: var(--border);
}

.callout h4 {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-bottom: 10px;
  color: var(--accent);
  font-weight: 700;
}

.callout-falsify h4 { color: var(--down); }

.callout p { font-size: 14.5px; line-height: 1.6; }

.tick-list { list-style: none; margin: 0; padding: 0; }
.tick-list li {
  position: relative;
  padding-left: 20px;
  margin-bottom: 8px;
  font-size: 13.5px;
  color: var(--text-2);
  line-height: 1.5;
}
.tick-list li:last-child { margin-bottom: 0; }
.tick-list li::before {
  content: '✕';
  position: absolute;
  left: 2px;
  top: 0;
  color: var(--down);
  font-size: 11px;
}
.tick-list.watch li::before { content: '▸'; color: var(--info); }

/* ----------------------------------------------------------------- Trade */

.trade {
  border: 1px solid var(--border);
  border-left: 2px solid var(--info);
  border-radius: 0 var(--r-sm) var(--r-sm) 0;
  padding: 12px 13px;
  margin-bottom: 9px;
  background: var(--bg-elev);
}
.trade:last-child { margin-bottom: 0; }
.trade h5 { margin: 0 0 4px; font-size: 14.5px; font-weight: 650; }
.trade .instrument { font-family: var(--font-mono); font-size: 12px; color: var(--info); margin-bottom: 7px; }
.trade p { font-size: 13.5px; color: var(--text-2); margin-bottom: 6px; }
.trade .risk { font-size: 12.5px; color: var(--text-3); }
.trade .risk b { color: var(--down); font-weight: 600; }

/* --------------------------------------------------------------- Sources */

.source-link {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
  font-size: 13.5px;
  color: var(--text-2);
}
.source-link:last-child { border-bottom: none; }
.source-link .name {
  font-family: var(--font-mono);
  font-size: 10.5px;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  flex: none;
  width: 88px;
  padding-top: 2px;
}
.source-link .t { flex: 1; }
.source-link:hover .t { color: var(--text); }

/* ------------------------------------------------------------- Scorecard */

.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(82px, 1fr));
  gap: 8px;
  margin-bottom: 16px;
}

.stat {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: 13px 12px;
  text-align: center;
}

.stat-value {
  font-family: var(--font-mono);
  font-size: 24px;
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.1;
}

.stat-label {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  color: var(--text-3);
  margin-top: 5px;
}

.bar-row { margin-bottom: 11px; }
.bar-top { display: flex; justify-content: space-between; font-size: 12.5px; margin-bottom: 5px; }
.bar-top .k { color: var(--text-2); text-transform: capitalize; }
.bar-top .v { font-family: var(--font-mono); color: var(--text-3); font-size: 11.5px; }
.bar {
  height: 5px;
  background: var(--surface-2);
  border-radius: 999px;
  overflow: hidden;
}
.bar i { display: block; height: 100%; background: var(--accent); border-radius: 999px; }

.call {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 0;
  border-bottom: 1px solid var(--border);
}
.call:last-child { border-bottom: none; }
.call .status {
  width: 7px; height: 7px; border-radius: 50%; flex: none;
}
.call .status.hit  { background: var(--up); box-shadow: 0 0 0 3px var(--up-wash); }
.call .status.miss { background: var(--down); box-shadow: 0 0 0 3px var(--down-wash); }
.call .status.open { background: var(--accent); box-shadow: 0 0 0 3px var(--accent-wash); }
.call .status.flat { background: var(--neutral); }
.call .body { flex: 1; min-width: 0; }
.call .body .l { font-size: 13.5px; font-weight: 600; }
.call .body .s { font-size: 11.5px; color: var(--text-3); font-family: var(--font-mono); margin-top: 1px; }
.call .move { font-family: var(--font-mono); font-size: 13px; font-weight: 650; flex: none; }

/* --------------------------------------------------------------- Archive */

.archive-row {
  display: flex;
  align-items: center;
  gap: 13px;
  padding: 13px 0;
  border-bottom: 1px solid var(--border);
}
.archive-row .date {
  font-family: var(--font-mono);
  font-size: 11.5px;
  color: var(--accent);
  flex: none;
  width: 62px;
  line-height: 1.3;
}
.archive-row .h { flex: 1; font-size: 14px; font-weight: 600; line-height: 1.35; }
.archive-row .r { font-size: 11.5px; color: var(--text-3); margin-top: 2px; font-weight: 400; }
.archive-row .arrow-r { color: var(--text-3); flex: none; }

/* ------------------------------------------------------------------ Prose */

.prose { font-size: 14.5px; line-height: 1.62; color: var(--text-2); }
.prose strong { color: var(--text); font-weight: 650; }
.prose h3 { font-size: 16px; color: var(--text); margin: 22px 0 9px; }
.prose h3:first-child { margin-top: 0; }
.prose ul { padding-left: 19px; margin: 0 0 14px; }
.prose li { margin-bottom: 6px; }
.prose code {
  font-family: var(--font-mono);
  font-size: 12.5px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 1px 5px;
  color: var(--accent);
}
.prose table { width: 100%; border-collapse: collapse; font-size: 13px; margin-bottom: 16px; }
.prose th, .prose td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--border); vertical-align: top; }
.prose th { color: var(--text-3); font-size: 10.5px; text-transform: uppercase; letter-spacing: 0.08em; font-weight: 650; }
.table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }

/* -------------------------------------------------------------- Bottom nav */

.tabbar {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  z-index: 50;
  background: rgba(10, 14, 21, 0.94);
  backdrop-filter: saturate(150%) blur(16px);
  -webkit-backdrop-filter: saturate(150%) blur(16px);
  border-top: 1px solid var(--border);
  padding-bottom: env(safe-area-inset-bottom, 0px);
}

.tabbar-inner {
  max-width: 760px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  height: var(--nav-h);
}

.tab {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  color: var(--text-3);
  font-size: 9.5px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  font-weight: 600;
  transition: color 0.14s ease;
}

.tab svg { width: 19px; height: 19px; stroke-width: 1.9; }
.tab.active { color: var(--accent); }
.tab:active { opacity: 0.6; }

/* --------------------------------------------------------------- Back link */

.back {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--text-3);
  font-family: var(--font-mono);
  margin-bottom: 4px;
  padding: 6px 0;
}
.back:active { color: var(--accent); }

/* ------------------------------------------------------------------ Footer */

.foot {
  margin: 36px 0 12px;
  padding-top: 18px;
  border-top: 1px solid var(--border);
  font-size: 11.5px;
  color: var(--text-3);
  line-height: 1.6;
}
.foot a { color: var(--text-2); text-decoration: underline; text-underline-offset: 2px; }
.foot .disclaimer { margin-top: 9px; font-size: 10.5px; color: #55627a; }

/* --------------------------------------------------------------- Ask box */

.ask {
  background: linear-gradient(165deg, var(--surface-2) 0%, var(--surface) 60%);
  border: 1px solid var(--border-strong);
  border-radius: var(--r);
  padding: 18px;
  margin-bottom: 12px;
}

.ask-head h3 { font-size: 16px; margin-bottom: 5px; }
.ask-head p { font-size: 13px; color: var(--text-3); line-height: 1.5; margin-bottom: 13px; }

.ask-suggest { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px; }

.ask-chip {
  font: inherit;
  font-size: 12px;
  line-height: 1.3;
  color: var(--text-2);
  background: var(--bg-elev);
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  padding: 6px 11px;
  cursor: pointer;
  text-align: left;
  transition: border-color .15s, color .15s;
}

.ask-chip:active { transform: scale(0.97); }
@media (hover: hover) { .ask-chip:hover { border-color: var(--accent-dim); color: var(--accent); } }

.ask-form { display: flex; flex-direction: column; gap: 9px; }

.ask-input {
  font: inherit;
  font-size: 14.5px;
  line-height: 1.5;
  width: 100%;
  resize: none;
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--border-strong);
  border-radius: var(--r-sm);
  padding: 11px 12px;
  min-height: 62px;
}

.ask-input::placeholder { color: var(--text-3); }
.ask-input:focus { outline: none; border-color: var(--accent-dim); box-shadow: 0 0 0 3px var(--accent-wash); }

.ask-actions { display: flex; align-items: center; gap: 10px; }

.ask-count { font-family: var(--font-mono); font-size: 11px; color: var(--text-3); }

.ask-send {
  font: inherit;
  font-size: 13.5px;
  font-weight: 650;
  margin-left: auto;
  color: var(--bg);
  background: var(--accent);
  border: none;
  border-radius: var(--r-sm);
  padding: 9px 20px;
  cursor: pointer;
  transition: opacity .15s;
}

.ask-send:disabled { opacity: .55; cursor: default; }
.ask-send:active:not(:disabled) { transform: scale(0.98); }

.ask-answer {
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
  font-size: 14.5px;
  line-height: 1.62;
  color: var(--text);
}

.ask-answer p { margin: 0 0 11px; }
.ask-answer p:last-child { margin-bottom: 0; }

.ask-q {
  font-size: 12.5px;
  color: var(--accent);
  font-weight: 600;
  margin-bottom: 11px;
  padding-left: 10px;
  border-left: 2px solid var(--accent-dim);
  line-height: 1.45;
}

.ask-caveat { font-size: 11.5px; color: var(--text-3); margin-top: 12px; }
.ask-error { color: var(--down); font-size: 13.5px; }

.ask-thinking { display: flex; gap: 5px; padding: 4px 0; }
.ask-thinking i {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--accent);
  display: block;
  animation: ml-pulse 1.2s ease-in-out infinite;
}
.ask-thinking i:nth-child(2) { animation-delay: .18s; }
.ask-thinking i:nth-child(3) { animation-delay: .36s; }

@keyframes ml-pulse {
  0%, 60%, 100% { opacity: .25; transform: translateY(0); }
  30%           { opacity: 1;   transform: translateY(-3px); }
}

/* -------------------------------------------------------------- Glossary */

.glossary {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: 0 16px;
  margin-bottom: 12px;
}

.glossary summary {
  cursor: pointer;
  list-style: none;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 0;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-3);
  font-weight: 650;
}

.glossary summary::-webkit-details-marker { display: none; }

.glossary summary::after {
  content: '+';
  margin-left: auto;
  font-family: var(--font-mono);
  font-size: 15px;
  color: var(--accent);
  line-height: 1;
}

.glossary[open] summary::after { content: '−'; }
.glossary .g-count { font-family: var(--font-mono); text-transform: none; letter-spacing: 0; font-size: 11px; }

.glossary dl { margin: 0; padding: 0 0 16px; }
.glossary dt { font-weight: 650; font-size: 14px; margin-bottom: 3px; }
.glossary dd { margin: 0 0 13px; font-size: 13.5px; color: var(--text-2); line-height: 1.5; }
.glossary dd:last-child { margin-bottom: 0; }

/* ---------------------------------------------------- Scorecard explainer */

.explainer {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: 18px;
  margin-bottom: 16px;
}

.explainer h3 { font-size: 16px; margin-bottom: 9px; }
.explainer p { font-size: 14.5px; color: var(--text-2); line-height: 1.6; margin-bottom: 11px; }

.worked {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  padding: 14px 15px;
  margin: 14px 0;
}

.worked-label {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--accent);
  font-weight: 700;
  margin-bottom: 10px;
}

.worked-steps { margin: 0; padding-left: 18px; }
.worked-steps li { font-size: 13.5px; color: var(--text-2); line-height: 1.5; margin-bottom: 7px; }
.worked-steps li:last-child { margin-bottom: 0; }
.worked-steps b { color: var(--text); font-weight: 650; }

.fineprint { font-size: 12px; color: var(--text-3); line-height: 1.55; margin: 0; }

/* ----------------------------------------------------------------- Utility */

.visually-hidden {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

.stack > * + * { margin-top: 12px; }
.mono { font-family: var(--font-mono); }
.muted { color: var(--text-3); }
.center { text-align: center; }
.empty {
  text-align: center;
  padding: 44px 20px;
  color: var(--text-3);
  font-size: 14px;
}

@media (min-width: 640px) {
  body { font-size: 15.5px; }
  .read h1 { font-size: 27px; }
  .story-head h1 { font-size: 31px; }
  .card h3 { font-size: 17.5px; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}
