:root {
  --bg: #1c1917;
  --bg-2: #292524;
  --line: rgba(255, 255, 255, 0.1);
  --text: #f5f5f4;
  --muted: #a8a29e;
  --cream: #f6f4f0;
  --ink: #1c1917;
  --teal: #0b5a4b;
  --danger: #fecaca;
  --font: "IBM Plex Sans", system-ui, sans-serif;
  --serif: "Instrument Serif", Georgia, serif;
  --mono: "IBM Plex Mono", ui-monospace, monospace;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.dots {
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image: radial-gradient(rgba(255,255,255,0.07) 1px, transparent 1px);
  background-size: 22px 22px;
  mask-image: radial-gradient(ellipse at center, black 40%, transparent 80%);
  z-index: 0;
}

.top, main, .composer, .banner { position: relative; z-index: 1; }

.top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 24px;
  border-bottom: 1px solid var(--line);
  background: rgba(0,0,0,0.2);
  backdrop-filter: blur(12px);
}
.brand { display: flex; gap: 12px; align-items: center; text-decoration: none; color: inherit; }
.nav { display: flex; gap: 14px; flex-wrap: wrap; }
.nav a { color: var(--muted); text-decoration: none; font-size: 13px; }
.nav a:hover, .nav a.active { color: #fff; }
.tape {
  position: relative; z-index: 1;
  margin: 0;
  padding: 8px 24px;
  font-size: 12px;
  letter-spacing: 0.04em;
  color: #fde68a;
  border-bottom: 1px solid var(--line);
  background: #1c1508;
}
.mark {
  width: 36px; height: 36px;
  display: grid; place-items: center;
  background: #fff; color: #000;
  font-weight: 700; letter-spacing: 0.04em;
  font-size: 13px;
}
.eyebrow { margin: 0; font-size: 11px; letter-spacing: 0.16em; text-transform: uppercase; color: var(--muted); }
.brand h1 { margin: 0; font-size: 18px; letter-spacing: 0.18em; text-transform: uppercase; }
.top-actions { display: flex; gap: 10px; align-items: center; }
.pill {
  font-family: var(--mono);
  font-size: 11px;
  padding: 4px 8px;
  border: 1px solid var(--line);
  color: var(--muted);
}
.pill.ok { color: #bbf7d0; border-color: #166534; }
.pill.warn { color: #fde68a; border-color: #854d0e; }

main { flex: 1; padding: 32px 24px 64px; }
body.research-mode main#view { display: none; }
body.research-mode #researchMount { display: block; position: relative; z-index: 1; }
body.research-mode #researchMount .workbench { padding: 24px 24px 200px; }
#researchMount.hidden { display: none !important; }

.landing { max-width: 920px; margin: 48px auto 0; text-align: center; }
.landing h2 {
  font-family: var(--serif);
  font-weight: 400;
  font-size: clamp(32px, 5vw, 48px);
  line-height: 1.15;
  margin: 0 0 16px;
}
.landing em { font-style: italic; }
.lede { color: var(--muted); font-size: 18px; max-width: 640px; margin: 0 auto 40px; }
.cards { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; text-align: left; }
.card {
  background: rgba(0,0,0,0.25);
  border: 1px solid var(--line);
  padding: 24px;
}
.card h3 { margin: 0 0 16px; font-size: 18px; font-weight: 500; }
.card ul { list-style: none; margin: 0; padding: 0; }
.card li { padding: 10px 0; border-top: 1px solid var(--line); color: #e7e5e4; font-size: 14px; }
.card li:first-child { border-top: 0; }
.card strong { display: block; color: #fff; }

.workbench { max-width: 720px; margin: 0 auto; }
.timeline-head {
  display: flex; justify-content: space-between;
  font-size: 13px; color: var(--muted);
  margin-bottom: 16px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}
.timeline { list-style: none; margin: 0; padding: 0; position: relative; }
.timeline::before {
  content: "";
  position: absolute;
  left: 50%;
  top: 0; bottom: 0;
  width: 1px;
  background: rgba(255,255,255,0.15);
  transform: translateX(-50%);
}
.event {
  background: rgba(0,0,0,0.35);
  border: 1px solid var(--line);
  padding: 18px 20px;
  margin: 0 0 16px;
  backdrop-filter: blur(8px);
}
.event h3 { margin: 0 0 8px; font-size: 15px; }
.event pre {
  margin: 0;
  white-space: pre-wrap;
  word-break: break-word;
  font-family: var(--mono);
  font-size: 12px;
  color: #d6d3d1;
  max-height: 140px;
  overflow: auto;
  background: rgba(255,255,255,0.04);
  padding: 10px;
}
.event .meta { margin-top: 10px; font-size: 11px; color: var(--muted); font-family: var(--mono); }

.ready {
  display: flex; justify-content: space-between; align-items: center; gap: 16px;
  border: 1px solid var(--line);
  background: rgba(0,0,0,0.4);
  padding: 20px;
  margin-top: 8px;
}
.ready p { margin: 4px 0 0; color: var(--muted); font-size: 14px; }

.composer {
  position: sticky;
  bottom: 0;
  padding: 16px 24px 20px;
  background: linear-gradient(to top, #1c1917 70%, transparent);
}
.composer form {
  max-width: 960px;
  margin: 0 auto;
  display: flex;
  gap: 10px;
  align-items: flex-end;
  background: var(--bg-2);
  border: 1px solid #44403c;
  padding: 10px;
}
.field { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.field span { font-size: 11px; color: var(--muted); letter-spacing: 0.06em; text-transform: uppercase; }
.field input, textarea, select {
  width: 100%;
  background: transparent;
  border: 0;
  color: #fff;
  font: inherit;
  outline: none;
}
.field input { font-family: var(--mono); text-transform: uppercase; }
#instruction { text-transform: none; font-family: var(--font); }
.grow { flex: 1; }
.grow-2 { flex: 2; }
.solid, .ghost, .icon-btn {
  cursor: pointer;
  border: 0;
  font: inherit;
}
.solid {
  background: #fff;
  color: #000;
  padding: 10px 18px;
  font-weight: 600;
  letter-spacing: 0.04em;
}
.solid:disabled { background: #44403c; color: #78716c; cursor: not-allowed; }
.ghost {
  background: transparent;
  color: #fff;
  border: 1px solid var(--line);
  padding: 8px 14px;
}
.icon-btn {
  background: transparent;
  color: inherit;
  font-size: 28px;
  line-height: 1;
  padding: 0 6px;
}
.chips { max-width: 960px; margin: 10px auto 0; display: flex; gap: 8px; flex-wrap: wrap; }
.chips button {
  background: transparent;
  color: var(--muted);
  border: 1px solid var(--line);
  font-family: var(--mono);
  font-size: 12px;
  padding: 4px 8px;
  cursor: pointer;
}
.disclaimer { text-align: center; color: #78716c; font-size: 12px; margin: 12px 0 0; }

.banner {
  max-width: 960px;
  margin: 0 auto 12px;
  background: rgba(127,29,29,0.35);
  border: 1px solid #7f1d1d;
  color: var(--danger);
  padding: 12px 16px;
  font-size: 14px;
}
.hidden { display: none !important; }

.drawer {
  position: fixed;
  top: 0; right: 0; bottom: 0;
  width: min(420px, 100%);
  background: #0c0a09;
  border-left: 1px solid var(--line);
  z-index: 40;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.drawer-head {
  display: flex; justify-content: space-between; align-items: center;
  padding: 16px 20px;
  border-bottom: 1px solid var(--line);
}
.drawer-head h2 { margin: 0; font-size: 16px; letter-spacing: 0.12em; text-transform: uppercase; }
.drawer-body {
  overflow: auto;
  padding: 16px 20px 40px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.drawer-body label, .drawer-body fieldset { display: flex; flex-direction: column; gap: 6px; font-size: 13px; color: var(--muted); }
.drawer-body textarea, .drawer-body select, .drawer-body input[type="text"], #presetName, #allowedDomains, #excludedDomains {
  background: #1c1917;
  border: 1px solid #44403c;
  color: #fff;
  padding: 8px;
  font: inherit;
}
.checks { display: grid; gap: 6px; }
.check { flex-direction: row !important; align-items: center; gap: 8px !important; color: var(--text) !important; }
.preset-row { display: flex; gap: 8px; }
.preset-row input { flex: 1; }
.scrim {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.45);
  z-index: 30;
}

.report {
  position: fixed; inset: 0;
  background: var(--cream);
  color: var(--ink);
  z-index: 50;
  overflow: auto;
}
.report-top {
  position: sticky; top: 0;
  display: flex; justify-content: space-between; align-items: center;
  padding: 16px 40px;
  background: var(--cream);
  border-bottom: 1px solid #e7e5e4;
}
.report-top h2 { margin: 0; letter-spacing: 0.12em; text-transform: uppercase; font-size: 16px; }
.report-body { max-width: 1100px; margin: 0 auto; padding: 32px 40px 80px; display: flex; flex-direction: column; gap: 24px; }
.panel {
  background: #fff;
  border: 1px solid #e7e5e4;
  padding: 24px;
}
.panel h3 { margin: 0 0 12px; }
.quote {
  background: #fafaf9;
  border: 1px solid #f5f5f4;
  padding: 16px;
  font-size: 18px;
  line-height: 1.5;
}
.take { display: flex; gap: 8px; margin: 8px 0; }
.score {
  font-family: var(--serif);
  font-size: 64px;
  text-align: center;
  color: var(--teal);
}
.grid-2 { display: grid; grid-template-columns: 1.4fr 0.6fr; gap: 24px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.metrics { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; border-top: 1px solid #f5f5f4; padding-top: 12px; text-align: center; }
.metrics span { display: block; font-size: 10px; letter-spacing: 0.1em; text-transform: uppercase; color: #78716c; }
.find { border-bottom: 1px solid #f5f5f4; padding-bottom: 12px; margin-bottom: 12px; }
.find a { color: var(--teal); }
.chart { width: 100%; height: 220px; }
.impact { font-family: var(--mono); font-size: 12px; padding: 2px 6px; background: #fef3c7; }

.desk { max-width: 1100px; margin: 0 auto; }
.desk h2 {
  font-family: var(--serif);
  font-weight: 400;
  font-size: clamp(28px, 4vw, 44px);
  margin: 8px 0 12px;
}
.desk .lede { margin: 0 0 28px; text-align: left; max-width: 720px; }
.hero-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 32px; }
.hero-actions a { text-decoration: none; }
.stat-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin: 20px 0 28px; }
.stat {
  border: 1px solid var(--line);
  background: rgba(0,0,0,0.25);
  padding: 16px;
}
.stat b { display: block; font-size: 22px; font-family: var(--mono); }
.stat span { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: 0.08em; }
.cream-wrap {
  background: var(--cream);
  color: var(--ink);
  padding: 24px;
  margin: 16px 0;
}
.cream-wrap h3 { margin-top: 0; }
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th, .table td { text-align: left; padding: 10px 8px; border-bottom: 1px solid #e7e5e4; }
.table a { color: var(--teal); }
.pos { color: #166534; }
.neg { color: #9f1239; }
.sleeve {
  display: grid;
  grid-template-columns: 1.4fr 80px 1fr;
  gap: 8px;
  align-items: center;
  padding: 8px 0;
  border-bottom: 1px solid #e7e5e4;
  font-size: 14px;
}
.bar { height: 8px; background: #e7e5e4; }
.bar > i { display: block; height: 100%; background: var(--teal); }
.market {
  border: 1px solid var(--line);
  padding: 16px 18px;
  margin: 0 0 12px;
  background: rgba(0,0,0,0.28);
}
.market h3 { margin: 0 0 8px; font-size: 18px; font-family: var(--serif); font-weight: 400; }
.odds { display: flex; gap: 8px; align-items: center; margin-top: 10px; }
.odds button { flex: 1; padding: 10px; cursor: pointer; border: 0; font: inherit; font-weight: 600; }
.yes { background: #14532d; color: #bbf7d0; }
.no { background: #7f1d1d; color: #fecaca; }
.odds-bar { display: flex; height: 6px; margin-top: 8px; }
.odds-bar .y { background: #22c55e; }
.odds-bar .n { background: #ef4444; }
.lock { font-size: 12px; color: var(--muted); margin-top: 8px; }
.note-list { color: var(--muted); font-size: 14px; }
.share-box {
  border: 1px dashed #a8a29e;
  padding: 14px 16px;
  font-family: var(--mono);
  font-size: 13px;
  word-break: break-all;
}

@media (max-width: 800px) {
  .cards, .grid-2, .grid-3, .metrics, .stat-row { grid-template-columns: 1fr; }
  .composer form { flex-wrap: wrap; }
  .report-top, .report-body { padding-left: 16px; padding-right: 16px; }
  .timeline::before { display: none; }
  .top { flex-wrap: wrap; gap: 12px; }
  .sleeve { grid-template-columns: 1fr; }
}
