@font-face {
  font-family: 'JetBrains Mono';
  font-style: normal;
  font-weight: 300 700;
  font-display: swap;
  src: url('https://www.steven-geller.com/static/fonts/jetbrains-mono-latin.woff2?v=2') format('woff2');
}

*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }

:root {
  --bg: #181818;
  --bg-card: #1e1e1e;
  --bg-cell: #222;
  --ink: #d4cdc4;
  --ink-dim: rgba(212,205,196,0.06);
  --ink-secondary: #b8b8b8;
  --ink-muted: #666;
  --border: #333;
  --border-box: #555;
  --color-given: #d4cdc4;
  --color-solved: #6b8f71;
  --color-backtrack: #a05050;
  --color-error: #c45050;
  --color-propagate: #6f7f8b;
  --color-candidate: #8b8b6f;
  --color-highlight: #7f6f8b;
  --color-accent: #8fa36b;
  --ease: cubic-bezier(0.4, 0, 0.2, 1);
  --font: 'JetBrains Mono', 'SF Mono', 'Consolas', monospace;
}

@media (prefers-color-scheme: light) {
  :root {
    --bg: #f5f5f0;
    --bg-card: #fff;
    --bg-cell: #fafaf8;
    --ink: #1a1a1a;
    --ink-dim: rgba(26,26,26,0.06);
    --ink-secondary: #555;
    --ink-muted: #999;
    --border: #ddd;
    --border-box: #999;
  }
}

html { font-size: 15px; -webkit-font-smoothing: antialiased; }

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--ink);
  min-height: 100vh;
  line-height: 1.5;
}

a { color: var(--ink-secondary); text-decoration: none; }
a:hover { color: var(--ink); }

/* Layout */
.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 2rem 1.5rem;
}

header {
  text-align: center;
  margin-bottom: 2.5rem;
  animation: fadeIn 0.8s var(--ease);
}

header h1 {
  font-size: 1.4rem;
  font-weight: 400;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  margin-bottom: 0.3rem;
}

header p {
  color: var(--ink-muted);
  font-size: 0.75rem;
  letter-spacing: 0.06em;
}

/* Controls */
.controls {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  align-items: center;
  justify-content: center;
  margin-bottom: 2rem;
  animation: fadeIn 0.8s 0.1s var(--ease) both;
}

.difficulty-btns {
  display: flex;
  gap: 0.3rem;
}

.diff-btn {
  font-family: var(--font);
  font-size: 0.7rem;
  padding: 0.35rem 0.7rem;
  background: var(--bg-card);
  color: var(--ink-secondary);
  border: 1px solid var(--border);
  border-radius: 3px;
  cursor: pointer;
  transition: all 0.15s var(--ease);
  letter-spacing: 0.03em;
}

.diff-btn:hover, .diff-btn.active {
  background: var(--ink-dim);
  color: var(--ink);
  border-color: var(--ink-muted);
}

.diff-btn.active { border-color: var(--color-accent); color: var(--color-accent); }

#puzzle-input {
  font-family: var(--font);
  font-size: 0.7rem;
  background: transparent;
  border: none;
  border-bottom: 1px solid var(--border);
  color: var(--ink);
  padding: 0.35rem 0;
  width: 12rem;
  text-align: center;
  outline: none;
  transition: border-color 0.15s var(--ease);
  letter-spacing: 0.02em;
}

#puzzle-input:focus { border-color: var(--ink-muted); }
#puzzle-input::placeholder { color: var(--ink-muted); }

.speed-control {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.65rem;
  color: var(--ink-muted);
}

.speed-control input[type="range"] {
  width: 5rem;
  accent-color: var(--color-accent);
}

.action-btn {
  font-family: var(--font);
  font-size: 0.7rem;
  padding: 0.35rem 1rem;
  background: transparent;
  color: var(--ink);
  border: 1px solid var(--border);
  border-radius: 3px;
  cursor: pointer;
  transition: all 0.15s var(--ease);
  letter-spacing: 0.04em;
}

.action-btn:hover { border-color: var(--ink-muted); background: var(--ink-dim); }
.action-btn.primary { border-color: var(--color-accent); color: var(--color-accent); }
.action-btn.primary:hover { background: rgba(143,163,107,0.1); }

/* Arena */
.arena {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2rem;
  margin-bottom: 2rem;
  animation: fadeIn 0.8s 0.2s var(--ease) both;
}

.panel {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.panel-header {
  display: flex;
  align-items: baseline;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.panel-header h2 {
  font-size: 0.8rem;
  font-weight: 400;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.panel-header .tag {
  font-size: 0.6rem;
  color: var(--ink-muted);
  letter-spacing: 0.04em;
}

.panel.system1 .panel-header h2 { color: var(--color-error); }
.panel.system2 .panel-header h2 { color: var(--color-solved); }

/* Sudoku Grid */
.grid-wrapper {
  position: relative;
  width: min(46vw, 520px);
  aspect-ratio: 1;
}

.sudoku-grid {
  display: grid;
  grid-template-columns: repeat(16, 1fr);
  grid-template-rows: repeat(16, 1fr);
  width: 100%;
  height: 100%;
  border: 2px solid var(--border-box);
  border-radius: 2px;
}

.cell {
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font);
  font-size: clamp(0.4rem, 0.85vw, 0.6rem);
  color: var(--ink);
  background: var(--bg-cell);
  border-right: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  position: relative;
  transition: background 0.12s var(--ease), color 0.12s var(--ease);
  user-select: none;
  cursor: default;
}

/* Box borders — 4x4 boxes in 16x16 grid */
.cell:nth-child(4n) { border-right-color: var(--border-box); }
.cell:nth-child(n+49):nth-child(-n+64) { border-bottom-color: var(--border-box); }
.cell:nth-child(n+113):nth-child(-n+128) { border-bottom-color: var(--border-box); }
.cell:nth-child(n+177):nth-child(-n+192) { border-bottom-color: var(--border-box); }
.cell:nth-child(16n) { border-right: none; }
.cell:nth-child(n+241) { border-bottom: none; }

/* 9x9 grid overrides */
.sudoku-grid.dim9 {
  grid-template-columns: repeat(9, 1fr);
  grid-template-rows: repeat(9, 1fr);
}
.sudoku-grid.dim9 .cell {
  font-size: clamp(0.6rem, 1.5vw, 1rem);
}
/* Reset 4x4 box borders that leak from 16x16 rules */
.sudoku-grid.dim9 .cell:nth-child(4n) { border-right-color: var(--border); }
.sudoku-grid.dim9 .cell:nth-child(16n) { border-right: 1px solid var(--border); }
.sudoku-grid.dim9 .cell:nth-child(n+49):nth-child(-n+64) { border-bottom-color: var(--border); }
.sudoku-grid.dim9 .cell:nth-child(n+113):nth-child(-n+128) { border-bottom-color: var(--border); }
.sudoku-grid.dim9 .cell:nth-child(n+177):nth-child(-n+192) { border-bottom-color: var(--border); }
/* 3x3 box borders for 9x9 */
.sudoku-grid.dim9 .cell:nth-child(3n) { border-right-color: var(--border-box); }
.sudoku-grid.dim9 .cell:nth-child(9n) { border-right: none; }
.sudoku-grid.dim9 .cell:nth-child(n+19):nth-child(-n+27) { border-bottom-color: var(--border-box); }
.sudoku-grid.dim9 .cell:nth-child(n+46):nth-child(-n+54) { border-bottom-color: var(--border-box); }
.sudoku-grid.dim9 .cell:nth-child(n+73):nth-child(-n+81) { border-bottom: none; }

.cell.given { color: var(--color-given); font-weight: 600; }
.cell.solved { color: var(--color-solved); }
.cell.backtracking {
  color: var(--color-backtrack);
  background: rgba(160,80,80,0.08);
}
.cell.error {
  color: var(--color-error);
  animation: shake 0.3s var(--ease);
}
.cell.propagated {
  color: var(--color-propagate);
  background: rgba(111,127,139,0.06);
}
.cell.active {
  box-shadow: inset 0 0 0 2px var(--color-highlight);
}

/* Proposal ghost numbers — show what agents are considering */
.cell[data-proposal]::after {
  content: attr(data-proposal);
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85em;
  color: var(--color-accent);
  pointer-events: none;
  transition: opacity 0.15s var(--ease);
}
.cell[data-support="1"]::after { opacity: 0.12; }
.cell[data-support="2"]::after { opacity: 0.25; }
.cell[data-support="3"]::after { opacity: 0.45; }
.cell[data-support="4"]::after { opacity: 0.65; }
.cell[data-support="5"]::after { opacity: 0.80; }

/* Consensus flash */
.cell.consensus {
  color: var(--color-accent);
  background: rgba(143,163,107,0.12);
  transition: background 0.3s var(--ease);
}

/* Candidate mini-numbers */
.cell .mini-candidates {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  grid-template-rows: repeat(3, 1fr);
  position: absolute;
  inset: 2px;
  pointer-events: none;
}

.cell .mini-candidates span {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: clamp(0.35rem, 0.7vw, 0.5rem);
  color: var(--ink-muted);
  opacity: 0.6;
}

.cell .mini-candidates span.eliminated { opacity: 0.15; text-decoration: line-through; }

/* Canvas overlay for backtrack trail */
.trail-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

/* Stats bar */
.stats {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  margin-top: 0.8rem;
  font-size: 0.6rem;
  color: var(--ink-muted);
  letter-spacing: 0.03em;
}

.stats .stat-value {
  color: var(--ink-secondary);
  transition: color 0.2s var(--ease);
}

.stats .stat-value.flash { color: var(--ink); }

/* Visualization row */
.vis-row {
  display: flex;
  gap: 1.5rem;
  margin-bottom: 2rem;
  animation: fadeIn 0.8s 0.3s var(--ease) both;
}

.swarm-summary {
  font-size: 0.6rem;
  color: var(--ink-secondary);
  padding: 0.4rem 0;
  border-bottom: 1px solid var(--ink-dim);
  margin-bottom: 0.4rem;
}

.agent-section {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.6rem 1rem;
  margin: 0.6rem 0;
}

.agent-group {
  border: 1px solid var(--ink-dim);
  border-radius: 3px;
  padding: 0.3rem;
}

.agent-group-label {
  font-size: 0.5rem;
  color: var(--ink-muted);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  margin-bottom: 0.3rem;
  padding-bottom: 0.2rem;
  border-bottom: 1px solid var(--ink-dim);
  font-weight: 500;
}

.vis-panel {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 1rem 1.2rem;
  min-height: 200px;
  position: relative;
  overflow: hidden;
}

.vis-panel h3 {
  font-size: 0.65rem;
  font-weight: 400;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-muted);
  margin-bottom: 0.6rem;
}

.vis-panel canvas, .vis-panel svg {
  width: 100%;
  height: 120px;
  display: block;
}

#swarm-canvas {
  height: 140px;
}

.vis-subtitle {
  font-size: 0.5rem;
  color: var(--ink-muted);
  font-weight: 300;
  letter-spacing: 0.02em;
  text-transform: none;
  opacity: 0.6;
  margin-left: 0.4rem;
}

/* Memory tiers */
.memory-tiers {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  margin-bottom: 0.5rem;
}

.mem-tier {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
  padding: 0.3rem 0;
  border-bottom: 1px solid var(--ink-dim);
}

.mem-tier:last-child { border-bottom: none; }

.tier-label {
  font-size: 0.6rem;
  font-weight: 600;
  color: var(--color-accent);
  min-width: 2rem;
  letter-spacing: 0.04em;
  flex-shrink: 0;
}

.tier-desc {
  font-weight: 300;
  color: var(--ink-muted);
  font-size: 0.5rem;
  display: block;
}

.tier-content {
  font-size: 0.6rem;
  color: var(--ink-secondary);
  line-height: 1.4;
  transition: color 0.2s var(--ease);
}

.tier-content.flash { color: var(--ink); }

.tier-log {
  font-size: 0.55rem;
  color: var(--ink-muted);
  line-height: 1.4;
  max-height: 5rem;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  gap: 1px;
  flex: 1;
}

.tier-log .log-entry {
  opacity: 0;
  animation: logIn 0.2s var(--ease) forwards;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.tier-log .log-entry.place { color: var(--color-solved); border-left: 2px solid var(--color-solved); padding-left: 0.4rem; }
.tier-log .log-entry.eliminate { color: var(--color-propagate); border-left: 2px solid var(--color-propagate); padding-left: 0.4rem; }
.tier-log .log-entry.backtrack { color: var(--color-backtrack); border-left: 2px solid var(--color-backtrack); padding-left: 0.4rem; }
.tier-log .log-entry.guess { color: #b8964a; border-left: 2px solid #b8964a; padding-left: 0.4rem; }

@keyframes logIn {
  from { opacity: 0; transform: translateX(-4px); }
  to { opacity: 0.8; transform: translateX(0); }
}

/* Swarm stats */
.swarm-stats {
  display: flex;
  gap: 1rem;
  font-size: 0.55rem;
  color: var(--ink-muted);
  margin-top: 0.4rem;
}

.swarm-stats strong {
  color: var(--ink-secondary);
  font-weight: 500;
}

/* Agent roster */
.agent-roster {
  display: flex;
  flex-direction: column;
  gap: 0px;
}

.agent-entry {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  font-size: 0.55rem;
  padding: 0.2rem 0.3rem;
  border-radius: 2px;
  border-left: 2px solid transparent;
  transition: all 0.15s var(--ease);
}

.agent-entry.active {
  background: rgba(143,163,107,0.12);
  border-left-color: var(--color-accent);
}

.agent-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  flex-shrink: 0;
  transition: box-shadow 0.2s var(--ease);
}

.agent-entry.active .agent-dot {
  box-shadow: 0 0 6px currentColor;
}

.agent-name {
  color: var(--ink-secondary);
  flex: 1;
  min-width: 0;
  font-weight: 400;
}

.agent-entry.active .agent-name {
  color: var(--ink);
  font-weight: 500;
}

.agent-score {
  color: var(--ink-muted);
  min-width: 1.5rem;
  text-align: right;
  font-weight: 500;
}

.agent-entry.active .agent-score {
  color: var(--color-accent);
}

/* LLM Move Log */
.llm-move-log {
  margin-top: 0.5rem;
  border-top: 1px solid var(--border);
  padding-top: 0.4rem;
}
.llm-move-log-title {
  font-size: 0.55rem;
  color: var(--ink-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 0.3rem;
}
.llm-move-log-feed {
  max-height: 100px;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
  font-size: 0.55rem;
  line-height: 1.5;
}
.llm-move-entry {
  padding: 0.1rem 0;
  color: var(--ink-secondary);
}
.llm-move-entry.correct { color: var(--color-solved); }
.llm-move-entry.wrong { color: var(--color-error); }
.llm-move-entry.invalid { color: var(--ink-muted); }

/* Entity tag interactive */
.entity-tag { cursor: pointer; transition: border-color 0.2s, background 0.15s; }
.entity-tag:hover { border-color: var(--ink-muted); }
.entity-tag.active { background: rgba(143,163,107,0.15); border-color: var(--color-accent); }

/* Prediction history */
.prediction-history {
  margin-top: 0.8rem;
  border-top: 1px solid var(--border);
  padding-top: 0.6rem;
}
.prediction-history-title {
  font-size: 0.6rem;
  color: var(--ink-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 0.4rem;
}
.history-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.3rem 0.4rem;
  font-size: 0.55rem;
  border-bottom: 1px solid var(--ink-dim);
  cursor: pointer;
  transition: background 0.15s;
}
.history-item:hover { background: var(--bg); }
.history-question { color: var(--ink); flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.history-consensus { color: var(--color-accent); font-weight: 500; min-width: 3rem; text-align: right; }
.history-date { color: var(--ink-muted); min-width: 5rem; text-align: right; margin-left: 0.5rem; }

/* Footer */
footer {
  text-align: center;
  padding: 2rem 0;
  font-size: 0.6rem;
  color: var(--ink-muted);
  letter-spacing: 0.04em;
  animation: fadeIn 0.8s 0.4s var(--ease) both;
}

footer a { border-bottom: 1px solid var(--border); }
footer a:hover { border-color: var(--ink-muted); }
#footer-model-info { display: block; margin-bottom: 0.5rem; color: var(--ink-muted); }
#footer-model-info:empty { display: none; }

/* Legend */
.sudoku-model-bar {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.65rem;
  color: var(--ink-muted);
  justify-content: center;
  margin-bottom: 1rem;
  padding: 0.4rem 0.8rem;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--bg-card);
}

.sudoku-model-bar.ready {
  border-color: var(--color-solved);
}

.legend {
  display: flex;
  flex-wrap: wrap;
  gap: 0.8rem;
  justify-content: center;
  margin-bottom: 2rem;
  font-size: 0.6rem;
  color: var(--ink-muted);
  animation: fadeIn 0.8s 0.25s var(--ease) both;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 0.3rem;
}

.legend-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  flex-shrink: 0;
}

/* Animations */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-3px); }
  75% { transform: translateX(3px); }
}

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

/* Responsive */
@media (max-width: 768px) {
  .arena { grid-template-columns: 1fr; gap: 2.5rem; }
  .grid-wrapper { width: min(85vw, 380px); }
  .vis-row { flex-direction: column; }
  .agent-section { grid-template-columns: repeat(2, 1fr); }
  .controls { gap: 0.5rem; }
  .difficulty-btns { flex-wrap: wrap; justify-content: center; }
  #puzzle-input { width: 100%; }
}

/* Sound button state */
.sound-btn.active { color: var(--color-accent); border-color: var(--color-accent); }

/* Share notification */
.toast {
  position: fixed;
  bottom: 2rem;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--ink-secondary);
  font-family: var(--font);
  font-size: 0.7rem;
  padding: 0.5rem 1rem;
  border-radius: 4px;
  opacity: 0;
  transition: all 0.3s var(--ease);
  pointer-events: none;
  z-index: 100;
}

.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* === Mode Tabs === */
.mode-tabs {
  display: flex;
  justify-content: center;
  gap: 0;
  margin-bottom: 2rem;
  animation: fadeIn 0.8s var(--ease);
}

.mode-tab {
  font-family: var(--font);
  font-size: 0.75rem;
  padding: 0.5rem 1.5rem;
  background: transparent;
  color: var(--ink-muted);
  border: none;
  border-bottom: 2px solid transparent;
  cursor: pointer;
  transition: all 0.2s var(--ease);
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.mode-tab:hover { color: var(--ink-secondary); }
.mode-tab.active {
  color: var(--color-accent);
  border-bottom-color: var(--color-accent);
}

.mode-sudoku { transition: opacity 0.3s var(--ease); }
.mode-predict { transition: opacity 0.3s var(--ease); }

/* === Predict Mode === */
.predict-section {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 1.2rem;
  margin-bottom: 1.5rem;
}

.predict-section h3 {
  font-size: 0.7rem;
  font-weight: 400;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-muted);
  margin-bottom: 0.8rem;
}

/* Model loading */
.model-status {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  margin-bottom: 0.8rem;
}

.model-status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--ink-muted);
  flex-shrink: 0;
  transition: all 0.3s var(--ease);
}

.model-status-dot.downloading {
  background: #d4a050;
  animation: pulse 1.2s infinite;
}

.model-status-dot.ready {
  background: var(--color-accent);
  box-shadow: 0 0 8px rgba(143,163,107,0.4);
}

.model-status-text {
  font-size: 0.7rem;
  color: var(--ink-secondary);
}

.model-progress-bar {
  width: 100%;
  height: 3px;
  background: var(--border);
  border-radius: 2px;
  overflow: hidden;
  margin-bottom: 0.6rem;
}

.model-progress-fill {
  height: 100%;
  background: var(--color-accent);
  border-radius: 2px;
  transition: width 0.3s var(--ease);
  width: 0%;
}

.model-note {
  font-size: 0.55rem;
  color: var(--ink-muted);
  margin-top: 0.4rem;
}

/* Predict input */
.predict-textarea {
  font-family: var(--font);
  font-size: 0.7rem;
  width: 100%;
  min-height: 6rem;
  background: var(--bg-cell);
  color: var(--ink);
  border: 1px solid var(--border);
  border-radius: 3px;
  padding: 0.6rem;
  resize: vertical;
  outline: none;
  transition: border-color 0.15s var(--ease);
  line-height: 1.5;
  margin-bottom: 0.6rem;
}

.predict-textarea:focus { border-color: var(--ink-muted); }
.predict-textarea::placeholder { color: var(--ink-muted); }

.predict-question {
  font-family: var(--font);
  font-size: 0.7rem;
  width: 100%;
  background: var(--bg-cell);
  color: var(--ink);
  border: 1px solid var(--border);
  border-radius: 3px;
  padding: 0.5rem 0.6rem;
  outline: none;
  transition: border-color 0.15s var(--ease);
  margin-bottom: 0.8rem;
}

.predict-question:focus { border-color: var(--ink-muted); }
.predict-question::placeholder { color: var(--ink-muted); }

.predict-actions {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  flex-wrap: wrap;
}

.predict-examples {
  display: flex;
  gap: 0.3rem;
  flex-wrap: wrap;
  margin-top: 0.6rem;
}

.example-btn {
  font-family: var(--font);
  font-size: 0.6rem;
  padding: 0.25rem 0.6rem;
  background: transparent;
  color: var(--ink-muted);
  border: 1px solid var(--border);
  border-radius: 3px;
  cursor: pointer;
  transition: all 0.15s var(--ease);
}

.example-btn:hover {
  color: var(--ink-secondary);
  border-color: var(--ink-muted);
}

/* Debate feed */
.debate-feed {
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}

.debate-msg {
  display: flex;
  gap: 0.6rem;
  align-items: flex-start;
  animation: fadeIn 0.3s var(--ease);
}

.debate-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.65rem;
  font-weight: 600;
  color: #181818;
  flex-shrink: 0;
}

.debate-body {
  flex: 1;
  min-width: 0;
}

.debate-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.2rem;
}

.debate-name {
  font-size: 0.65rem;
  font-weight: 500;
}

.debate-round {
  font-size: 0.5rem;
  color: var(--ink-muted);
}

.debate-confidence {
  font-size: 0.5rem;
  padding: 0.1rem 0.35rem;
  border-radius: 2px;
  background: rgba(143,163,107,0.15);
  color: var(--color-accent);
}

.debate-content {
  font-size: 0.65rem;
  color: var(--ink-secondary);
  line-height: 1.5;
  overflow-wrap: break-word;
  word-break: break-word;
}

.debate-think-toggle {
  font-family: var(--font);
  font-size: 0.55rem;
  color: var(--ink-muted);
  background: none;
  border: none;
  cursor: pointer;
  padding: 0.2rem 0;
  margin-top: 0.2rem;
}

.debate-think-toggle:hover { color: var(--ink-secondary); }

.debate-think-content {
  font-size: 0.6rem;
  color: var(--ink-muted);
  background: var(--bg);
  border-left: 2px solid var(--border);
  padding: 0.4rem 0.6rem;
  margin-top: 0.3rem;
  border-radius: 0 3px 3px 0;
  line-height: 1.4;
}

.debate-thinking {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.6rem;
  color: var(--ink-muted);
  padding: 0.4rem 0;
  animation: pulse 1.2s infinite;
}

/* Agent roster (predict mode) */
.predict-roster {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.6rem;
}

@media (max-width: 768px) {
  .predict-roster { grid-template-columns: repeat(2, 1fr); }
}

.predict-agent-card {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 0.6rem;
  transition: all 0.3s var(--ease);
  min-width: 0;
  overflow: hidden;
}

.predict-agent-card.thinking {
  border-color: var(--ink-muted);
}

.predict-agent-card.thinking .predict-agent-dot {
  animation: pulse 1s infinite;
}

.predict-agent-header {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  margin-bottom: 0.4rem;
  min-width: 0;
}

.predict-agent-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
  transition: box-shadow 0.3s var(--ease);
}

.predict-agent-card.thinking .predict-agent-dot {
  box-shadow: 0 0 8px currentColor;
}

.predict-agent-name {
  font-size: 0.65rem;
  font-weight: 500;
  color: var(--ink);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.predict-agent-role {
  font-size: 0.5rem;
  color: var(--ink-muted);
  margin-bottom: 0.4rem;
}

.predict-agent-trust {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  margin-bottom: 0.2rem;
}

.predict-agent-trust-label {
  font-size: 0.5rem;
  color: var(--ink-muted);
  min-width: 2rem;
}

.predict-trust-bar {
  flex: 1;
  height: 3px;
  background: var(--border);
  border-radius: 2px;
  overflow: hidden;
}

.predict-trust-fill {
  height: 100%;
  border-radius: 2px;
  transition: width 0.4s var(--ease);
  width: 70%;
}

.predict-agent-claims {
  font-size: 0.5rem;
  color: var(--ink-muted);
}

.predict-agent-status {
  font-size: 0.5rem;
  color: var(--ink-muted);
  text-align: right;
}

/* Progress section */
.predict-phase {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  margin-bottom: 0.6rem;
}

.predict-phase-label {
  font-size: 0.7rem;
  color: var(--ink-secondary);
  font-weight: 500;
}

.predict-phase-time {
  font-size: 0.6rem;
  color: var(--ink-muted);
  margin-left: auto;
}

.predict-progress-bar {
  width: 100%;
  height: 4px;
  background: var(--border);
  border-radius: 2px;
  overflow: hidden;
}

.predict-progress-fill {
  height: 100%;
  background: var(--color-accent);
  border-radius: 2px;
  transition: width 0.4s var(--ease);
  width: 0%;
}

/* Report section */
.predict-report { display: none; }
.predict-report.visible { display: block; }

.report-consensus {
  text-align: center;
  margin-bottom: 1.5rem;
}

.report-consensus-pct {
  font-size: 2.5rem;
  font-weight: 300;
  color: var(--color-accent);
  line-height: 1;
  margin-bottom: 0.3rem;
}

.report-consensus-label {
  font-size: 0.65rem;
  color: var(--ink-muted);
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.report-primary {
  font-size: 0.8rem;
  color: var(--ink);
  line-height: 1.6;
  padding: 1rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 4px;
  margin-bottom: 1.2rem;
  overflow-wrap: break-word;
  word-break: break-word;
}

.report-predictions {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-bottom: 1.2rem;
}

.report-pred-item {
  display: flex;
  align-items: flex-start;
  gap: 0.6rem;
  padding: 0.5rem;
  border-bottom: 1px solid var(--ink-dim);
}

.report-pred-item:last-child { border-bottom: none; }

.report-pred-agent {
  font-size: 0.65rem;
  font-weight: 500;
  min-width: 5rem;
  flex-shrink: 0;
}

.report-pred-text {
  font-size: 0.6rem;
  color: var(--ink-secondary);
  flex: 1;
  min-width: 0;
  line-height: 1.4;
  overflow-wrap: break-word;
  word-break: break-word;
}

.report-pred-prob {
  font-size: 0.65rem;
  font-weight: 500;
  color: var(--color-accent);
  min-width: 3rem;
  text-align: right;
  flex-shrink: 0;
}

.report-arguments {
  margin-bottom: 1.2rem;
}

.report-arg-item {
  padding: 0.4rem 0;
  border-bottom: 1px solid var(--ink-dim);
}

.report-arg-item:last-child { border-bottom: none; }

.report-arg-agent {
  font-size: 0.6rem;
  font-weight: 500;
  margin-bottom: 0.15rem;
}

.report-arg-text {
  font-size: 0.6rem;
  color: var(--ink-secondary);
  line-height: 1.4;
  overflow-wrap: break-word;
  word-break: break-word;
}

.report-dissent {
  margin-bottom: 1.2rem;
}

.report-trust-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 2px;
  font-size: 0.5rem;
  max-width: 350px;
}

.report-trust-cell {
  aspect-ratio: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 2px;
  font-size: 0.45rem;
  color: var(--ink);
}

.report-trust-header {
  font-size: 0.45rem;
  color: var(--ink-muted);
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Entity list */
.entity-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
  margin-top: 0.6rem;
}

.entity-tag {
  font-size: 0.55rem;
  padding: 0.15rem 0.4rem;
  border-radius: 2px;
  border: 1px solid var(--border);
  color: var(--ink-secondary);
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
}

.entity-tag-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  flex-shrink: 0;
}

/* Persona list */
.persona-list {
  margin-top: 0.8rem;
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

.persona-item {
  font-size: 0.6rem;
  color: var(--ink-secondary);
  line-height: 1.4;
  padding: 0.3rem 0.5rem;
  border-left: 2px solid var(--border);
}

.persona-item strong {
  color: var(--ink);
}

/* Evidence chain */
.report-evidence {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  margin-bottom: 1.2rem;
}

.evidence-item {
  padding: 0.4rem 0.6rem;
  border-left: 3px solid var(--border);
  font-size: 0.6rem;
  line-height: 1.4;
}

.evidence-quote {
  color: var(--ink-secondary);
  font-style: italic;
}

.evidence-attribution {
  font-size: 0.5rem;
  color: var(--ink-muted);
  margin-top: 0.15rem;
}

/* Interview section */
.report-interviews {
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
  margin-bottom: 1.2rem;
}

.interview-item {
  border: 1px solid var(--border);
  border-radius: 4px;
  overflow: hidden;
}

.interview-question {
  font-size: 0.6rem;
  padding: 0.5rem 0.6rem;
  background: var(--bg);
  color: var(--ink-muted);
  border-bottom: 1px solid var(--border);
}

.interview-answer {
  font-size: 0.6rem;
  padding: 0.5rem 0.6rem;
  color: var(--ink-secondary);
  line-height: 1.4;
}

.interview-agent {
  font-weight: 500;
}

/* Predict mode layout */
.predict-layout {
  display: grid;
  grid-template-columns: 1fr 420px;
  gap: 1.5rem;
  margin-bottom: 1.5rem;
}

@media (max-width: 768px) {
  .predict-layout { grid-template-columns: 1fr; }
  .predict-roster { grid-template-columns: repeat(3, 1fr); }
  .report-trust-grid { max-width: 100%; overflow-x: auto; }
  .report-pred-item { flex-wrap: wrap; }
  .debate-feed { }
  #knowledge-graph-canvas { height: 180px; }
  .entity-list { gap: 0.2rem; }
  .entity-tag { font-size: 0.5rem; }
  #interaction-graph-canvas { height: 180px; }
}

/* Model selector */
.model-selector {
  display: flex;
  gap: 1rem;
  margin-bottom: 0.6rem;
}
.model-option {
  font-size: 0.65rem;
  color: var(--ink-secondary);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.3rem;
}
.model-option input[type="radio"] {
  accent-color: var(--color-accent);
}
.model-size {
  color: var(--ink-muted);
  font-size: 0.55rem;
}
.model-badge {
  font-size: 0.45rem;
  padding: 0.1rem 0.3rem;
  background: rgba(143,163,107,0.2);
  color: var(--color-accent);
  border-radius: 2px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

/* Explainer */
.predict-explainer {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 0.8rem 1rem;
  margin-bottom: 1.5rem;
  font-size: 0.65rem;
  color: var(--ink-secondary);
  line-height: 1.6;
}
.predict-explainer a { color: var(--color-accent); }
.predict-explainer-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.4rem;
  font-size: 0.6rem;
  font-weight: 500;
  color: var(--ink-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.predict-explainer-dismiss {
  background: none;
  border: none;
  color: var(--ink-muted);
  cursor: pointer;
  font-size: 1rem;
  line-height: 1;
  padding: 0 0.2rem;
}
.predict-explainer-dismiss:hover { color: var(--ink); }

/* Metrics */
.predict-metrics {
  display: flex;
  gap: 1.5rem;
  font-size: 0.55rem;
  color: var(--ink-muted);
  margin-top: 0.5rem;
}
.predict-metrics strong { color: var(--ink-secondary); }

/* Performance section in report */
.report-perf {
  display: flex;
  gap: 1.5rem;
  font-size: 0.55rem;
  color: var(--ink-muted);
  margin-bottom: 1.2rem;
  padding: 0.5rem;
  border: 1px solid var(--ink-dim);
  border-radius: 4px;
}
