:root {
  --bg: #0b1020;
  --panel: #141b2e;
  --line: #26304d;
  --text: #e8edf8;
  --dim: #97a3c0;
  --accent: #8ab4ff;
  --up: #ffb86b;
  --down: #5eead4;
  --stale: #fde68a;
  --ok: #86efac;
  --no: #fda4af;
  color-scheme: dark;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font:
    16px / 1.45 -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    Roboto,
    Helvetica,
    Arial,
    sans-serif;
}

header {
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 14px 22px;
  border-bottom: 1px solid var(--line);
  flex-wrap: wrap;
}

.brand {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: 0.2px;
}
.brand span {
  font-weight: 400;
  color: var(--dim);
  margin-left: 10px;
  font-size: 16px;
}

.notice {
  margin-left: auto;
  padding: 6px 12px;
  border: 1px solid var(--stale);
  border-radius: 999px;
  color: var(--stale);
  font-size: 13.5px;
}

.controls {
  display: flex;
  gap: 8px;
}

button {
  font: inherit;
  color: var(--text);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 14px;
  cursor: pointer;
}
button:hover {
  border-color: var(--accent);
}
button.primary {
  background: var(--accent);
  color: #0b1020;
  font-weight: 700;
  border-color: var(--accent);
}
button.quiet {
  color: var(--dim);
}
button:disabled {
  opacity: 0.45;
  cursor: default;
  border-color: var(--line);
}

main {
  display: grid;
  grid-template-columns: 340px minmax(520px, 1fr) 340px;
  gap: 18px;
  padding: 18px 22px;
  align-items: start;
}

h2 {
  font-size: 12.5px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--dim);
  margin: 0 0 10px;
  font-weight: 600;
}
.hint {
  color: var(--dim);
  font-size: 12.5px;
  margin: -4px 0 10px;
}

.feed {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 14px;
  min-height: 560px;
}
#events {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.event {
  border-left: 3px solid var(--accent);
  padding: 6px 10px;
  background: #0f1628;
  border-radius: 6px;
  animation: arrive 0.4s ease-out;
}
.event.act {
  border-left-color: var(--down);
}
.event .src {
  display: block;
  color: var(--dim);
  font-size: 12.5px;
  margin-bottom: 2px;
}
.event .text {
  font-size: 14.5px;
}
.event .note {
  display: block;
  color: var(--dim);
  font-size: 13px;
  margin-top: 4px;
}
@keyframes arrive {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

.caption {
  min-height: 54px;
  font-size: 21px;
  font-weight: 600;
  margin: 0 4px 10px;
}

.stage-wrap {
  width: 100%;
  overflow: hidden;
}
.stage {
  width: 720px;
  height: 430px;
  position: relative;
  transform-origin: top left;
}
.stage svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}
.link {
  fill: none;
  stroke: var(--line);
  stroke-width: 2.5;
  marker-end: url(#head);
}
.link.faint {
  stroke-dasharray: 6 6;
  stroke-width: 2;
}
#head path {
  fill: var(--line);
}

.belief {
  position: absolute;
  width: 310px;
  height: 92px;
  padding: 10px 14px;
  text-align: left;
  border-radius: 12px;
  background: var(--panel);
  border: 1px solid var(--line);
  color: var(--text);
  font: inherit;
  transition:
    border-color 0.25s,
    box-shadow 0.25s;
}
.belief:hover,
.belief.selected {
  border-color: var(--accent);
}
.belief.selected {
  box-shadow: 0 0 0 2px var(--accent) inset;
}
.belief .name {
  font-size: 14.5px;
  color: var(--dim);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.belief .row {
  display: flex;
  align-items: baseline;
  gap: 10px;
  margin: 2px 0 6px;
}
.belief .pct {
  font-size: 30px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.belief .dir {
  font-size: 15px;
  opacity: 0;
}
.belief .status {
  margin-left: auto;
  font-size: 12px;
  padding: 2px 8px;
  border-radius: 999px;
  border: 1px solid var(--line);
  color: var(--dim);
}
.belief .bar {
  height: 7px;
  border-radius: 999px;
  background: #0f1628;
  overflow: hidden;
}
.belief .bar i {
  display: block;
  height: 100%;
  background: var(--accent);
  transition: width 0.45s ease-out;
}
.belief.up {
  border-color: var(--up);
}
.belief.up .dir {
  opacity: 1;
  color: var(--up);
}
.belief.down {
  border-color: var(--down);
}
.belief.down .dir {
  opacity: 1;
  color: var(--down);
}
.belief.stale {
  border-color: var(--stale);
}
.belief.stale .status {
  color: var(--stale);
  border-color: var(--stale);
}
.belief.watched .status::after {
  content: " · watched";
}

.under {
  display: flex;
  gap: 22px;
  color: var(--dim);
  font-size: 14px;
  margin: 8px 4px 0;
}
.under b {
  color: var(--text);
  font-variant-numeric: tabular-nums;
}

aside {
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 14px;
}
.panel:not(:first-child) h2 {
  margin-bottom: 10px;
}
#why-title {
  text-transform: none;
  letter-spacing: 0;
  font-size: 15px;
  color: var(--text);
  font-weight: 600;
}
#why {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 7px;
}
#why li {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 2px 10px;
  font-size: 14px;
}
#why li .what {
  color: var(--text);
}
#why li .how {
  font-variant-numeric: tabular-nums;
  text-align: right;
}
#why li .how.plus {
  color: var(--up);
}
#why li .how.minus {
  color: var(--down);
}
#why li .track {
  grid-column: 1 / -1;
  height: 5px;
  border-radius: 999px;
  background: #0f1628;
  overflow: hidden;
}
#why li .track i {
  display: block;
  height: 100%;
}
#why li .track i.plus {
  background: var(--up);
}
#why li .track i.minus {
  background: var(--down);
}
#why .empty {
  color: var(--dim);
  font-size: 14px;
}

.decision {
  font-size: 16px;
}
.decision .yes {
  color: var(--ok);
  font-weight: 700;
  font-size: 22px;
}
.decision .no {
  color: var(--no);
  font-weight: 700;
  font-size: 22px;
}
.decision .why {
  color: var(--dim);
  font-size: 14px;
  margin-top: 4px;
}

.acts {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
.acts button {
  font-size: 14px;
  padding: 9px 10px;
  text-align: left;
}
#outcome {
  margin-top: 12px;
  font-size: 14px;
  display: none;
}
#outcome.show {
  display: block;
}
#outcome .title {
  font-weight: 600;
  font-size: 15px;
}
#outcome .caption {
  min-height: 0;
  font-size: 14px;
  font-weight: 400;
  color: var(--dim);
  margin: 2px 0 8px;
}
#outcome .chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
#outcome .chip {
  font-size: 12.5px;
  padding: 3px 8px;
  border-radius: 999px;
  border: 1px solid var(--line);
  color: var(--dim);
}
#outcome .chip.moved {
  border-color: var(--up);
  color: var(--up);
}
#outcome .compare {
  margin-top: 8px;
  font-variant-numeric: tabular-nums;
}
#outcome .compare b {
  font-size: 16px;
}

#script {
  margin: 0 22px 22px;
  padding: 14px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  white-space: pre-wrap;
  font:
    14px / 1.5 ui-monospace,
    SFMono-Regular,
    Menlo,
    monospace;
  color: var(--text);
}

@media (max-width: 1240px) {
  main {
    grid-template-columns: 1fr;
  }
  .feed {
    min-height: 0;
    max-height: 280px;
    overflow: auto;
  }
}

#why li.hardly {
  display: block;
  color: var(--dim);
  font-size: 13.5px;
}
