:root {
  --bg: #0a0d14;
  --ink: #eef1f6;
  --mute: #8b93a5;
  --rule: rgba(255, 255, 255, 0.1);
  --loss: #ff7433;
  --gain: #4ea8ff;
}

html, body {
  height: 100%;
}

body {
  margin: 0;
  overflow: hidden;
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
  color: var(--ink);
  background: var(--bg);
}

#app {
  position: relative;
  height: 100%;
  overflow: hidden;
  background: radial-gradient(120% 90% at 50% 45%, #121826 0%, var(--bg) 70%);
}

#stage {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  touch-action: none;
}

.head {
  position: absolute;
  left: 24px;
  top: 18px;
  right: 280px;
  pointer-events: none;
}

.kicker {
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--mute);
}

h1 {
  margin: 6px 0 0;
  font-size: 26px;
  font-weight: 700;
  letter-spacing: -0.01em;
  line-height: 1.15;
}

.sub {
  margin: 6px 0 0;
  max-width: 660px;
  font-size: 14px;
  line-height: 1.45;
  color: var(--mute);
}

.legend {
  position: absolute;
  right: 24px;
  top: 22px;
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--mute);
  pointer-events: none;
}

.legend i {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  margin-left: 8px;
}

.legend .person { background: var(--ink); }
.legend .gain { background: var(--gain); }
.legend .loss { background: var(--loss); }

.clockrow {
  position: absolute;
  left: 24px;
  right: 24px;
  bottom: 100px;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px;
  pointer-events: none;
}

.clock {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.clock .date {
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--mute);
}

.clock .time {
  font-size: 22px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.01em;
}

.tally {
  font-size: 12px;
  color: var(--mute);
  text-align: right;
  font-variant-numeric: tabular-nums;
  line-height: 1.5;
}

.tally b { color: var(--ink); font-weight: 600; }
.tally .ok { color: var(--gain); }
.tally .bad { color: var(--loss); }

.scrub {
  position: absolute;
  left: 24px;
  right: 24px;
  bottom: 58px;
  height: 36px;
  cursor: pointer;
  touch-action: none;
}

.scrub canvas {
  width: 100%;
  height: 100%;
  display: block;
}

.chips {
  position: absolute;
  left: 50%;
  bottom: 14px;
  transform: translateX(-50%);
  display: flex;
  gap: 4px;
  padding: 4px;
  border: 1px solid var(--rule);
  border-radius: 999px;
  background: rgba(10, 13, 20, 0.72);
  backdrop-filter: blur(8px);
  max-width: calc(100% - 32px);
  overflow-x: auto;
  scrollbar-width: none;
}

.chips::-webkit-scrollbar { display: none; }

.chips button {
  border: 0;
  border-radius: 999px;
  padding: 6px 12px;
  font: 600 12px system-ui, -apple-system, "Segoe UI", sans-serif;
  color: var(--mute);
  background: transparent;
  cursor: pointer;
  white-space: nowrap;
}

.chips button:hover { color: var(--ink); }
.chips button.on { color: var(--bg); background: var(--ink); }
.chips button.tour { color: var(--gain); }
.chips button.tour.on { color: var(--bg); background: var(--gain); }
.chips .sep { width: 1px; margin: 6px 2px; background: var(--rule); flex: none; }

.pill {
  position: absolute;
  left: 24px;
  bottom: 150px;
  display: flex;
  align-items: center;
  gap: 8px;
  max-width: calc(100% - 48px);
  padding: 5px 6px 5px 12px;
  border: 1px solid var(--rule);
  border-radius: 999px;
  background: rgba(14, 18, 28, 0.9);
  font-size: 12px;
}

.pill[hidden] { display: none; }
.pill span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pill .bad { color: var(--loss); }

.pill button {
  border: 0;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.12);
  cursor: pointer;
  line-height: 20px;
  padding: 0;
  flex: none;
}

.tip {
  position: absolute;
  pointer-events: none;
  padding: 8px 10px;
  border: 1px solid var(--rule);
  border-radius: 8px;
  background: rgba(14, 18, 28, 0.94);
  font-size: 12px;
  line-height: 1.45;
  white-space: nowrap;
  z-index: 3;
}

.tip[hidden] { display: none; }
.tip b { font-size: 13px; }
.tip .m { color: var(--mute); }
.tip .bad { color: var(--loss); }
.tip .ok { color: var(--gain); }

.foot {
  position: absolute;
  right: 24px;
  top: 44px;
  font-size: 10px;
  color: rgba(139, 147, 165, 0.6);
  pointer-events: none;
}

.error {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: var(--mute);
  font-size: 14px;
  padding: 24px;
  text-align: center;
}

/* Narrow sheets: drop the legend, shrink the type, tighten the bottom stack. */
@media (max-width: 640px) {
  .head { left: 16px; right: 16px; top: 14px; }
  h1 { font-size: 20px; }
  .sub { font-size: 12.5px; }
  .legend, .foot { display: none; }
  .clockrow { left: 16px; right: 16px; bottom: 96px; }
  .clock .time { font-size: 18px; }
  .tally { font-size: 11px; }
  .scrub { left: 16px; right: 16px; }
  .pill { left: 16px; bottom: 146px; max-width: calc(100% - 32px); }
}

@media (max-width: 640px) {
  .chips button { padding: 6px 9px; font-size: 11px; }
}
