:root {
  --bg: #ddd4be;
  --panel: #f5efe2;
  --panel-2: #ece5d4;
  --border: #c5bca5;
  --text: #1a2332;
  --text-dim: #5c6573;
  --accent: #c1501c;
  --accent-2: #8b3a14;
  --good: #2f6a3a;
  --warn: #b87211;
  --shadow: 0 1px 0 rgba(26,35,50,0.08), 0 6px 18px rgba(26,35,50,0.08);
}
* { box-sizing: border-box; }
body {
  margin: 0; font-family: -apple-system, system-ui, sans-serif;
  background: var(--bg); color: var(--text);
}
.dim { color: var(--text-dim); font-weight: 400; }
header#hdr {
  padding: 12px 24px; background: var(--panel);
  border-bottom: 1px solid var(--border);
  display: flex; justify-content: space-between; align-items: center;
  position: sticky; top: 0; z-index: 10;
}
.brand { font-weight: 700; font-size: 18px; color: var(--accent); }
#learner-chip {
  font-size: 13px; padding: 4px 10px; border-radius: 4px;
  background: var(--panel-2); border: 1px solid var(--border);
}
#learner-chip code { font-size: 11px; word-break: break-all; }
main {
  display: grid;
  grid-template-columns: 260px 1fr;
  gap: 18px; max-width: 1280px; margin: 18px auto; padding: 0 18px;
}
aside#toc {
  background: var(--panel); border: 1px solid var(--border);
  border-radius: 6px; padding: 14px; height: fit-content;
  box-shadow: var(--shadow);
}
aside#toc h3 {
  margin: 0 0 10px; font-size: 13px; text-transform: uppercase;
  letter-spacing: 0.5px; color: var(--text-dim);
}
aside#toc .scene { margin-bottom: 14px; }
aside#toc .scene-title { font-weight: 600; margin-bottom: 4px; font-size: 14px; }
aside#toc ul { list-style: none; padding: 0; margin: 0; }
aside#toc li {
  font-size: 13px; padding: 5px 8px; border-radius: 3px;
  cursor: pointer; color: var(--text);
}
aside#toc li:hover { background: var(--panel-2); }
aside#toc li.active { background: var(--accent); color: white; font-weight: 500; }
aside#toc li.viewed::after { content: " ✓"; color: var(--good); }
aside#toc li.active.viewed::after { color: white; }
section#stage {
  background: var(--panel); border: 1px solid var(--border);
  border-radius: 6px; padding: 18px;
  box-shadow: var(--shadow); min-width: 0;
}
#slide-title { margin: 0 0 4px; font-size: 22px; }
#meta { font-size: 12px; margin-bottom: 14px; }
#slide-frame {
  width: 100%; height: 600px; border: 1px solid var(--border);
  border-radius: 4px; background: white;
}
#controls {
  display: flex; align-items: center; gap: 10px;
  padding: 14px 0; flex-wrap: wrap;
}
#controls button {
  font: inherit; padding: 7px 14px; border-radius: 4px;
  border: 1px solid var(--border); background: var(--panel-2);
  color: var(--text); cursor: pointer;
}
#controls button:hover:not(:disabled) { background: var(--panel); border-color: var(--accent); }
#controls button:disabled { opacity: 0.5; cursor: not-allowed; }
#controls button.primary { background: var(--accent); color: white; border-color: var(--accent); }
#controls button.primary:hover:not(:disabled) { background: var(--accent-2); }
#progress { flex: 1; text-align: center; font-size: 12px; }
#trace {
  margin-top: 18px; padding: 12px; border: 1px solid var(--border);
  background: var(--panel-2); border-radius: 4px; font-size: 12px;
}
.trace-head { font-weight: 600; margin-bottom: 8px; font-size: 11px; text-transform: uppercase; }
#trace-list { list-style: none; padding: 0; margin: 0; max-height: 200px; overflow-y: auto; }
#trace-list li {
  padding: 5px 8px; border-left: 2px solid var(--accent);
  background: var(--panel); margin-bottom: 4px;
  font-family: 'JetBrains Mono', monospace; font-size: 11px;
}
#trace-list li.err { border-left-color: var(--warn); }
.verb { color: var(--accent); font-weight: 600; }
