: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% 40%, #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: 24px;
  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;
  transition: opacity 0.35s;
}

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

.fade {
  opacity: 0;
}

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

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

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

.chips {
  position: absolute;
  left: 50%;
  bottom: 16px;
  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;
}

.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 .sep { width: 1px; margin: 4px 2px; background: var(--rule); flex: none; }
.chips button.act { color: var(--ink); }
.chips button.tour { color: var(--gain); }
.chips button.tour.on { color: var(--bg); background: var(--gain); }

.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 .neg { color: var(--loss); }
.tip .pos { color: var(--gain); }

.foot {
  position: absolute;
  right: 24px;
  bottom: 22px;
  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;
}

/* Narrow sheets: tuck the legend under the title, shrink the type. */
@media (max-width: 640px) {
  h1 { font-size: 20px; }
  .sub { font-size: 12.5px; }
  .legend { display: none; }
  .chips { bottom: 12px; }
  .chips { gap: 0; }
  .chips button { padding: 6px 7px; font-size: 11.5px; }
  .chips .sep { margin: 4px 1px; }
  .kicker { font-size: 10px; letter-spacing: 0.1em; }
  .head { left: 16px; right: 16px; }
  .foot { display: none; }
}
