@import url('https://fonts.googleapis.com/css2?family=Source+Sans+3:wght@400;600&family=Source+Serif+4:opsz,wght@8..60,600&display=swap');
:root {
  --bg: #1b1916;
  --bg2: #24211c;
  --line: #3a352d;
  --ink: #efe6d6;
  --dim: #a89f8e;
  --gold: #d6a94f;
  --mono: ui-monospace, "SF Mono", Menlo, monospace;
  --serif: "Source Serif 4", Georgia, "Times New Roman", serif;
  --sans: "Source Sans 3", -apple-system, "Segoe UI", "Helvetica Neue", Arial, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--ink); font-family: var(--sans); }
.lab { display: grid; grid-template-columns: 58% 42%; min-height: 100vh; }
.stage {
  position: sticky; top: 0; height: 100vh; overflow: hidden;
  border-right: 1px solid var(--line);
  background: radial-gradient(120% 90% at 30% 20%, #23262c 0%, #17181b 55%, #131313 100%);
}
.stage > canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; cursor: grab; }
.stage > canvas:active { cursor: grabbing; }
.leaders { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.leaders line { stroke: var(--gold); stroke-width: 1.2; opacity: .85; }
.leaders circle { fill: var(--gold); stroke: #1b1916; stroke-width: 2; }
.tags { position: absolute; inset: 0; pointer-events: none; }
.tag {
  position: absolute; transform: translate(-50%, -50%); white-space: nowrap;
  font-size: 13px; padding: 4px 9px; border-radius: 4px;
  background: rgba(27, 25, 22, .92); border: 1px solid #5a5347; color: var(--ink);
}
.gauge {
  position: absolute; top: 60px; right: 16px; width: 230px; padding: 14px 16px;
  background: rgba(36, 33, 28, .94); border: 1px solid var(--line); border-radius: 8px;
}
.gauge .r { margin-bottom: 11px; }
.gauge .r:last-child { margin-bottom: 0; }
.gauge .k { font-size: 11.5px; color: var(--dim); margin-bottom: 3px; }
.gauge .v { font-family: var(--mono); font-size: 14px; display: flex; align-items: center; gap: 9px; }
.gauge .bar { flex: 0 0 64px; height: 4px; border-radius: 2px; background: #47413a; overflow: hidden; }
.gauge .bar i { display: block; height: 100%; width: 0; border-radius: 2px; background: var(--gold); }
.gauge-toggle { display: none; }
.row3 { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 16px; margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--line); font-size: 12px; color: var(--dim); }
.row3[hidden] { display: none; }
.row3 .sl { display: inline-flex; align-items: center; gap: 8px; }
.row3 input[type=range] { width: 130px; accent-color: var(--gold); }
#controls { display: contents; }
.gauge .custom { margin-bottom: 12px; padding-bottom: 12px; border-bottom: 1px solid var(--line); }
.partcard {
  position: absolute; left: 16px; top: 16px; max-width: 300px; padding: 10px 13px; z-index: 3;
  background: rgba(36, 33, 28, .96); border: 1px solid #6a5f48; border-radius: 8px; font-size: 13px; line-height: 1.5;
}
.partcard b { display: block; color: var(--gold); font-size: 14px; margin-bottom: 2px; }
.partcard span { color: #ddd4c3; }
.dock {
  position: absolute; left: 16px; right: 16px; bottom: 16px; padding: 12px;
  background: rgba(36, 33, 28, .94); border: 1px solid var(--line); border-radius: 8px;
}
.row1 { display: flex; gap: 12px; align-items: flex-start; }
.play {
  flex: 0 0 40px; height: 40px; border: 0; border-radius: 6px; background: var(--gold);
  color: #1b1916; cursor: pointer; display: grid; place-items: center;
}
.tl { flex: 1; position: relative; padding-top: 7px; cursor: pointer; user-select: none; }
.track { display: flex; gap: 3px; height: 5px; }
.track i { display: block; height: 100%; border-radius: 3px; }
.knob {
  position: absolute; top: 1px; width: 17px; height: 17px; margin-left: -8.5px; border-radius: 50%;
  background: var(--ink); border: 2px solid #1b1916; box-shadow: 0 1px 4px rgba(0,0,0,.6);
}
.phases { display: flex; gap: 3px; margin-top: 12px; }
.phases span {
  font-size: 12px; color: var(--dim); text-align: center; padding: 5px 2px; border-radius: 5px;
  white-space: nowrap; overflow: hidden; text-overflow: clip;
}
.phases span.on { background: #3b3730; color: var(--gold); font-weight: 600; }
.row2 {
  display: flex; align-items: center; gap: 10px; margin-top: 10px; padding-top: 10px;
  border-top: 1px solid var(--line); font-size: 12px; color: var(--dim); flex-wrap: wrap;
}
.row2 input[type=range] { width: 150px; accent-color: var(--gold); }
.mono { font-family: var(--mono); color: var(--ink); }
.spacer { flex: 1; }
.seg { display: inline-flex; background: #2f2b25; border: 1px solid var(--line); border-radius: 6px; padding: 2px; margin-right: 6px; }
.seg button { border: 0; background: none; color: var(--dim); font-size: 12px; padding: 5px 10px; border-radius: 4px; cursor: pointer; }
.seg button.on { background: #4a443a; color: var(--gold); }
.tg {
  width: 30px; height: 30px; border-radius: 6px; border: 1px solid var(--line); background: #2a2721;
  color: var(--dim); cursor: pointer; display: inline-grid; place-items: center; margin-left: 5px; padding: 0;
}
.tg.on { background: #4a443a; color: var(--gold); border-color: #6a5f48; }
.tg svg, .play svg { width: 16px; height: 16px; }
.prose { padding: 72px 52px 40vh; }
.brand { color: inherit; text-decoration: none; display: flex; align-items: center; gap: 9px; font-weight: 600; font-size: 14px; }
.brand b { width: 20px; height: 20px; border-radius: 5px; background: var(--gold); display: inline-block; }
.eyebrow { color: var(--gold); font-size: 14px; margin: 22px 0 14px; }
.prose h1 { font-family: var(--serif); font-size: 50px; line-height: 1.08; margin: 0 0 20px; font-weight: 600; }
.tagline { color: #cfc6b5; font-size: 16.5px; line-height: 1.6; margin: 0 0 70px; }
.chapter { border-left: 2px solid var(--line); padding: 2px 0 6px 20px; margin-bottom: 72px; transition: border-color .3s; }
.chapter.on { border-left-color: var(--gold); }
.chapter .n { font-family: var(--mono); font-size: 12px; color: var(--dim); }
.chapter.on .n { color: var(--gold); }
.chapter h2 { font-family: var(--serif); font-size: 27px; line-height: 1.2; margin: 12px 0 14px; font-weight: 600; }
.chapter p { font-size: 16px; line-height: 1.78; color: #ddd4c3; margin: 0 0 16px; }
.chapter b { color: var(--ink); }
.chapter .fact { font-family: var(--mono); font-size: 13px; color: var(--gold); background: #26231d; border: 1px solid var(--line); border-radius: 6px; padding: 10px 12px; }
@media (max-width: 860px) {
  .lab { grid-template-columns: 1fr; }
  .stage { height: 62vh; border-right: 0; border-bottom: 1px solid var(--line); z-index: 2; }
  .stage { height: 66vh; }
  .gauge { top: 8px; right: 8px; max-width: calc(100% - 16px); max-height: calc(100% - 150px); overflow-y: auto; padding: 10px 12px; z-index: 4; }
  .gauge-toggle { display: block; margin: 0 0 10px auto; border: 1px solid #6a5f48; background: #2a2721; color: var(--gold); font: inherit; font-size: 12px; font-weight: 600; padding: 5px 11px; border-radius: 6px; cursor: pointer; }
  .gauge.closed { width: auto !important; padding: 0 !important; border: 0; background: none; overflow: visible; transform: none !important; }
  .gauge.closed > :not(.gauge-toggle) { display: none; }
  .gauge.closed .gauge-toggle { margin: 0; background: rgba(36, 33, 28, .94); }
  .partcard { top: 8px; left: 8px; max-width: calc(100% - 100px); font-size: 12px; padding: 8px 10px; }
  .row2, .row3 { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; white-space: nowrap; }
  .row2::-webkit-scrollbar, .row3::-webkit-scrollbar { display: none; }
  .row2 > *, .row3 > * { flex: 0 0 auto; }
  .row2 .spacer { display: none; }
  #choices, #toggles { display: inline-flex; flex-wrap: nowrap; }
  .dock { left: 8px; right: 8px; bottom: 8px; padding: 8px; }
  .play { flex-basis: 34px; height: 34px; }
  .phases { margin-top: 9px; }
  .phases span { font-size: 10.5px; padding: 3px 0; }
  .phases span:not(.on) { color: transparent; }
  .phases span.on { overflow: visible; position: relative; z-index: 1; }
  .row2 { gap: 6px; margin-top: 7px; padding-top: 7px; font-size: 11px; }
  .row2 input[type=range] { width: 84px; }
  .tag { font-size: 11px; padding: 2px 6px; }
  .prose { padding: 32px 22px 30vh; }
  .prose h1 { font-size: 34px; }
}
