:root {
  /* Light dashboard with Pythia accents; the header and sign-in page are dark. */
  color-scheme: light;
  --bg: #f7f5f3;
  --surface: #ffffff;
  --surface-2: #f1ede9;
  --border: #e4ded8;
  --grid: #eeeae6;
  --text: #141111;
  --muted: #5c5452;
  --brand: #ff9500;       /* fills: buttons, progress bars */
  --accent: #a65400;      /* orange text and links, readable on white */
  --danger: #c62f2e;
  --on-accent: #000000;

  --font-body: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-display: "Inter Tight", "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;

  /* Categorical series (one per game, in a fixed order), as in the toolkit's
     timeline. Games past the eighth share the neutral "other" colour. */
  --series-1: #2a78d6;
  --series-2: #eb6834;
  --series-3: #1baf7a;
  --series-4: #eda100;
  --series-5: #e87ba4;
  --series-6: #008300;
  --series-7: #6250d6;
  --series-8: #e34948;
  --series-other: #a29a96;
  --series-ink: #141111;
  /* Information (bars, distributions) is blue; orange is for branding and actions. */
  --data: #2a78d6;
  --data-soft: #dbe8f8;
  --axis: #c3c2b7;

  /* Meters: brand orange on a light step of the same hue. */
  --meter-fill: #ff9500;
  --meter-track: #ffe3bd;
  --status-warning: #fab219;
  --status-critical: #d03b3b;
  --status-good: #0ca30c;

  --label-width: 190px;
}

/* Dark mode, chosen with the toggle in the header (remembered per browser), as on the toolkit. */
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0f0d0d;
  --surface: #1a1616;
  --surface-2: #241f1f;
  --border: #352d2d;
  --grid: #2a2424;
  --text: #f3efef;
  --muted: #b7adad;
  --accent: #ffa733;
  --danger: #ff6b6b;

  --series-1: #3987e5;
  --series-2: #d95926;
  --series-3: #199e70;
  --series-4: #c98500;
  --series-5: #d55181;
  --series-6: #008300;
  --series-7: #9085e9;
  --series-8: #e66767;
  --series-other: #6f6767;
  --series-ink: #f3efef;
  --data: #3987e5;
  --data-soft: #1c3350;
  --axis: #4a4141;

  --meter-track: #4a2d05;
  --status-critical: #e5484d;
}

/* Dark, branded areas: the header, section links and the sign-in page. */
.site-header,
.tabs-bar,
.login-page {
  color-scheme: dark;
  --bg: #0d0b0b;
  --surface: #1a1515;
  --surface-2: #261f1f;
  --border: #3a3030;
  --text: #ffffff;
  --muted: #c4b9b9;
  --accent: #ff9500;
  --danger: #ff6b6b;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
}

main section[id] {
  scroll-margin-top: 64px;
}

body {
  margin: 0;
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--text);
  line-height: 1.4;
}

body.login-page {
  min-height: 100vh;
  background:
    radial-gradient(1100px 380px at 15% -120px, rgb(241 129 0 / 0.38), transparent 70%),
    var(--bg);
  background-repeat: no-repeat;
}

h1,
h2,
h3,
.brand {
  font-family: var(--font-display);
}

header,
main {
  max-width: 1240px;
  margin: 0 auto;
  padding: 0 16px;
}

/* Full-width dark band; content lines up with the page below. */
.site-header {
  max-width: none;
  margin: 0;
  padding: 14px max(16px, calc((100% - 1240px) / 2 + 16px)) 24px;
  color: var(--text);
  background:
    radial-gradient(900px 320px at 12% -80px, rgb(241 129 0 / 0.42), transparent 70%),
    var(--bg);
}

.brand-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px 16px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--text);
  text-decoration: none;
  font-weight: 900;
  font-size: 1.2rem;
  letter-spacing: -0.01em;
  text-transform: uppercase;
}

.brand img {
  width: 36px;
  height: 36px;
}

h1 {
  margin: 28px 0 0;
  font-size: clamp(2rem, 5vw, 3.4rem);
  font-weight: 900;
  line-height: 0.95;
  letter-spacing: -0.035em;
  text-transform: uppercase;
}

h1 .accent {
  color: #f18100;
}

h2 {
  font-size: 1.1rem;
  font-weight: 800;
  margin: 0;
  text-transform: uppercase;
  letter-spacing: -0.01em;
}

a {
  color: var(--accent);
}

.muted {
  margin: 0;
  color: var(--muted);
}

.small {
  font-size: 0.85rem;
}

.error {
  color: var(--danger);
}

.account {
  margin: 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.account {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.header-pill,
.sign-out {
  display: inline-block;
  padding: 5px 14px;
  color: var(--text);
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  text-decoration: none;
  white-space: nowrap;
  background: rgb(0 0 0 / 0.5);
  border: 1px solid var(--border);
  border-radius: 999px;
}

.header-pill:hover,
.sign-out:hover {
  border-color: var(--brand);
}

button.header-pill {
  font-family: inherit;
  line-height: inherit;
}

/* ---- tabs ---- */

.tabs-bar {
  position: sticky;
  top: 0;
  z-index: 5;
  margin: 0 0 24px;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
}

.tabs {
  display: flex;
  gap: 4px;
  max-width: 1240px;
  margin: 0 auto;
  padding: 0 16px;
  overflow-x: auto;
}

.tabs a {
  white-space: nowrap;
  padding: 12px 14px;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  color: var(--muted);
  text-decoration: none;
  font-weight: 600;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
}

.tabs a:hover {
  color: var(--text);
  border-bottom-color: var(--brand);
}

/* Tool links: a row of the brand's black pill buttons at the top of the header. */
.header-tools {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 20px;
  padding-bottom: 14px;
  overflow-x: auto;
  border-bottom: 1px solid rgb(255 255 255 / 0.12);
}

.header-tools-label {
  flex-shrink: 0;
  font-family: var(--font-display);
  font-size: 0.75rem;
  font-weight: 900;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: #f18100;
}

.nav-tools {
  display: flex;
  gap: 8px;
}

.nav-tools a {
  padding: 5px 14px;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  white-space: nowrap;
  color: var(--text);
  text-decoration: none;
  background: rgb(0 0 0 / 0.5);
  border: 1px solid var(--border);
  border-radius: 999px;
}

.nav-tools a:hover {
  border-color: var(--brand);
}

/* This tool: the brand's solid orange pill, marking where you are. */
.nav-tools .nav-current {
  flex-shrink: 0;
  color: #000;
  background: var(--brand);
  border-color: var(--brand);
}

.nav-tools .external {
  color: var(--brand);
}



/* ---- buttons ---- */

button {
  font: inherit;
  font-weight: 700;
  padding: 8px 18px;
  color: var(--on-accent);
  background: var(--brand);
  border: 0;
  border-radius: 999px;
  cursor: pointer;
}

button.secondary,
.button-link {
  display: inline-block;
  padding: 6px 14px;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 999px;
  font-size: 0.9rem;
  font-weight: 600;
  text-decoration: none;
}

button.link-button {
  padding: 0;
  color: var(--accent);
  background: none;
  font-weight: 600;
  text-decoration: underline;
}

button:disabled {
  opacity: 0.6;
  cursor: default;
}

button:focus-visible,
a:focus-visible,
[tabindex]:focus-visible,
select:focus-visible,
input:focus-visible,
summary:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 2px;
}

/* ---- dashboard layout ---- */

.toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px 16px;
  margin-bottom: 16px;
}

.filter {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.9rem;
  font-weight: 600;
}

select,
input {
  font: inherit;
  color: inherit;
  padding: 7px 10px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
}

.sync {
  margin: 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.notice {
  margin: 0 0 16px;
  padding: 10px 14px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface);
}

.notice.error {
  border-color: var(--status-critical);
}

.notice.warning {
  border-color: var(--status-warning);
}

.panel {
  margin-bottom: 24px;
  padding: 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
}

.panel h2 {
  margin-bottom: 12px;
}

.panel-title {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 4px 12px;
}

.panel-title h2 {
  margin-bottom: 0;
}

.hint {
  margin: 0 0 10px;
}

.panel-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px 16px;
}

button.secondary:hover,
.button-link:hover {
  border-color: var(--brand);
}

.section-title {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 32px 0 14px;
  font-size: 1.5rem;
  font-weight: 900;
  line-height: 1;
  letter-spacing: -0.02em;
}

.section-title::before {
  content: "";
  width: 6px;
  height: 0.9em;
  border-radius: 2px;
  background: var(--brand);
}

.pad {
  padding: 16px;
}

/* ---- tooltip ---- */

.tooltip {
  position: absolute;
  z-index: 10;
  display: flex;
  flex-direction: column;
  gap: 2px;
  max-width: 280px;
  padding: 8px 10px;
  font-size: 0.85rem;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: 0 4px 16px rgb(0 0 0 / 0.15);
  pointer-events: none;
}

.tooltip[hidden] {
  display: none;
}

.tooltip span {
  color: var(--muted);
}

/* ---- game cards ---- */

.game-grid {
  list-style: none;
  margin: 0 0 40px;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 16px;
}

.game-card {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 18px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  scroll-margin-top: 16px;
}

.game-card:target {
  border-color: var(--accent);
}

.card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.card-head h3 {
  margin: 0 0 2px;
  font-size: 1.15rem;
  font-weight: 800;
  letter-spacing: -0.01em;
  line-height: 1.15;
}

.manager-line {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 8px;
}

.share-tag {
  padding: 0 8px;
  font-size: 0.75rem;
  font-weight: 600;
  line-height: 1.6;
  white-space: nowrap;
  color: var(--text);
  border-radius: 999px;
  cursor: help;
}

.share-tag.owned {
  background: var(--meter-track);
  border: 1px solid var(--brand);
}

.share-tag.owned span {
  color: var(--accent);
}

.share-tag.team {
  background: var(--surface-2);
  border: 1px dashed var(--muted);
}

.status-pill {
  padding: 2px 10px;
  font-size: 0.8rem;
  font-weight: 600;
  white-space: nowrap;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 999px;
}

.card-links {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.facts {
  margin: 0;
  display: grid;
  gap: 8px;
}

.fact {
  display: grid;
  grid-template-columns: 80px 1fr;
  gap: 8px;
  align-items: baseline;
}

.fact dt {
  color: var(--muted);
  font-size: 0.85rem;
}

.fact dd {
  margin: 0;
}

.tag {
  display: inline-block;
  padding: 0 8px;
  font-size: 0.75rem;
  font-weight: 600;
  border-radius: 999px;
  border: 1px solid var(--border);
}

.tag.confirmed {
  border-color: var(--status-good);
}

.tag.speculative {
  border-style: dashed;
  color: var(--muted);
}

.metric {
  padding-top: 12px;
  border-top: 1px solid var(--grid);
}

.metric h4 {
  margin: 0 0 4px;
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
}

.metric-line {
  margin: 0 0 6px;
}

.metric-line .big {
  font-size: 1.5rem;
}

.meter {
  height: 8px;
  border-radius: 4px;
  background: var(--meter-track);
  overflow: hidden;
}

.meter span {
  display: block;
  height: 100%;
  border-radius: 4px;
  background: var(--meter-fill);
}

.meter.warning span {
  background: var(--meter-fill);
}

.meter.critical span {
  background: var(--status-critical);
}

.flag {
  display: inline-block;
  margin-top: 6px;
  font-size: 0.85rem;
  font-weight: 600;
}

.flag.warning span {
  color: var(--status-warning);
}

.flag.critical span {
  color: var(--status-critical);
}

.card-foot {
  margin-top: auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

/* ---- edit dialog ---- */

dialog {
  width: min(560px, calc(100vw - 32px));
  padding: 20px;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
}

dialog::backdrop {
  background: rgb(0 0 0 / 0.45);
}

dialog h2 {
  margin-bottom: 16px;
}

#beat-title {
  margin-bottom: 4px;
}

#beat-meta {
  margin-bottom: 16px;
}

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px 16px;
}

.form-grid > label,
.form-grid .field {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 0.85rem;
  font-weight: 600;
}

.form-grid .field label:first-child {
  font-size: 0.85rem;
  font-weight: 600;
}

.form-grid label.wide {
  grid-column: 1 / -1;
}

.form-grid > label.probation-check {
  flex-direction: row;
  align-items: center;
  align-self: start;
  gap: 8px;
  margin-top: 30px;
}

#edit-probation-hint {
  font-weight: 500;
}

.form-grid .check {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.85rem;
  font-weight: 500;
}

.events-line {
  margin-top: 10px;
}

.dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 20px;
}

@media (max-width: 520px) {
  .form-grid {
    grid-template-columns: 1fr;
  }

  :root {
    --label-width: 130px;
  }

  .game-grid {
    grid-template-columns: 1fr;
  }
}

/* ---- login ---- */

.login {
  max-width: 380px;
  padding-top: 12vh;
}

.login .brand {
  margin-bottom: 8px;
}

.login h1 {
  margin: 16px 0 12px;
  font-size: 2.2rem;
}

.login form {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 24px 0 12px;
}

.login label {
  font-size: 0.9rem;
  font-weight: 600;
}

.login label:not(:first-child) {
  margin-top: 8px;
}

.login input {
  padding: 10px 12px;
}

.login button {
  margin-top: 12px;
  padding: 11px 12px;
  text-transform: uppercase;
}

.login input {
  border-radius: 999px;
  padding: 10px 16px;
}

/* ---- dialogs ---- */

.spacer {
  flex: 1;
}

button.danger {
  color: var(--status-critical);
}

[hidden] {
  display: none !important;
}

/* ======================================================================
   Pre-Campaign Assessment
   ====================================================================== */

.tabs a[aria-current="page"] {
  color: var(--text);
  border-bottom-color: var(--brand);
}

.toolbar-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.toolbar.inner {
  margin-top: -4px;
}

.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px 16px;
}

.section-head .section-title {
  margin-bottom: 14px;
}

textarea {
  font: inherit;
  color: inherit;
  padding: 7px 10px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  resize: vertical;
}

.num {
  font-variant-numeric: tabular-nums;
}

.empty {
  padding: 28px 16px;
  text-align: center;
  color: var(--muted);
  background: var(--surface);
  border: 1px dashed var(--border);
  border-radius: 10px;
}

.empty p {
  margin: 0 0 12px;
}

.back-link {
  display: inline-block;
  margin-bottom: 12px;
  font-weight: 600;
}

/* ---- overview ---- */

.overview-grid {
  display: grid;
  grid-template-columns: minmax(280px, 340px) minmax(0, 1fr);
  gap: 0 24px;
  align-items: start;
}

@media (max-width: 900px) {
  .overview-grid {
    grid-template-columns: minmax(0, 1fr);
  }
}

.weight-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 4px 12px;
  align-items: center;
  margin-bottom: 14px;
}

.weight-row label {
  font-weight: 600;
  font-size: 0.9rem;
}

.weight-row .weight-value {
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.weight-row input[type="range"] {
  grid-column: 1 / -1;
  width: 100%;
  padding: 0;
  border: 0;
  background: none;
  accent-color: var(--brand);
}

.weight-row .muted {
  grid-column: 1 / -1;
  font-size: 0.8rem;
}

.weight-row.off label,
.weight-row.off .weight-value,
.weight-row.off input[type="range"] {
  opacity: 0.5;
}

.check-inline {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.85rem;
  font-weight: 500;
}

.share-bar {
  display: flex;
  gap: 2px;
  height: 12px;
  margin: 4px 0 6px;
  overflow: hidden;
  border-radius: 6px;
  background: var(--surface-2);
}

.share-bar span {
  display: block;
  height: 100%;
}

.share-bar span:first-child {
  border-radius: 6px 0 0 6px;
}

.share-bar span:last-child {
  border-radius: 0 6px 6px 0;
}

.share-bar span:only-child {
  border-radius: 6px;
}

.el-sentiment { --el: var(--series-1); }
.el-cpw { --el: var(--series-2); }
.el-team { --el: var(--series-3); }
.el-overall { --el: var(--series-ink); }

.share-bar span,
.el-swatch {
  background: var(--el);
}

.el-swatch {
  display: inline-block;
  width: 10px;
  height: 10px;
  margin-right: 6px;
  border-radius: 2px;
  vertical-align: baseline;
}

.weights-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
}

.segmented {
  display: inline-flex;
  padding: 2px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 999px;
}

.segmented button {
  padding: 5px 12px;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--muted);
  background: none;
  border-radius: 999px;
}

.segmented button[aria-pressed="true"] {
  color: var(--text);
  background: var(--surface);
  box-shadow: 0 1px 3px rgb(0 0 0 / 0.12);
}

/* ---- overall score chart ---- */

.chart {
  position: relative;
  min-height: 120px;
}

.chart-legend {
  margin: 0;
}

.score-chart {
  --label-col: 190px;
  --total-col: 44px;
  position: relative;
  padding-top: 22px;
}

/* Gridline ticks over the bar area only. */
.score-axis {
  position: absolute;
  top: 0;
  bottom: 0;
  left: calc(28px + var(--label-col) + 12px);
  right: calc(var(--total-col) + 12px);
  pointer-events: none;
}

.score-axis span {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 0;
  border-left: 1px solid var(--grid);
  font-size: 11px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.score-axis span {
  text-indent: -0.5em;
  line-height: 1;
}

.score-rows {
  position: relative;
  list-style: none;
  margin: 0;
  padding: 0;
  transition: height 300ms ease;
}

.score-row {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 52px;
  display: grid;
  grid-template-columns: 28px var(--label-col) minmax(0, 1fr) var(--total-col);
  gap: 0 12px;
  align-items: center;
  border-radius: 8px;
  cursor: pointer;
  transition: transform 450ms cubic-bezier(0.2, 0.8, 0.2, 1), opacity 200ms ease;
}

@media (prefers-reduced-motion: reduce) {
  .score-row,
  .score-seg,
  .score-rows {
    transition: none;
  }
}

.score-row:hover,
.score-row.focus {
  background: var(--surface-2);
}

.score-row.dim {
  opacity: 0.45;
}

.score-rank {
  text-align: right;
  font-weight: 700;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.score-name {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.score-game {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
  min-width: 0;
}

.score-game-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.score-sub {
  font-size: 0.78rem;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.score-track {
  position: relative;
  z-index: 1;
  height: 22px;
}

.score-seg {
  display: block;
  height: 100%;
  background: var(--el);
  transition: width 450ms cubic-bezier(0.2, 0.8, 0.2, 1);
}

.score-seg.empty {
  display: none;
}

/* The segments sit in one bar so only its outer ends are rounded. */
.score-bar {
  display: flex;
  transition: width 450ms cubic-bezier(0.2, 0.8, 0.2, 1);
  gap: 2px;
  height: 100%;
  overflow: hidden;
  border-radius: 4px;
}

.score-total {
  font-family: var(--font-display);
  font-size: 1.35rem;
  font-weight: 900;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.score-unscored {
  margin-top: 8px;
}

.score-unscored:empty {
  display: none;
}

@media (max-width: 520px) {
  .score-chart {
    --label-col: 110px;
    --total-col: 34px;
  }

  .score-row {
    grid-template-columns: 18px var(--label-col) minmax(0, 1fr) var(--total-col);
    gap: 0 8px;
  }

  .score-axis {
    left: calc(18px + var(--label-col) + 8px);
    right: calc(var(--total-col) + 8px);
  }

  .score-total {
    font-size: 1.1rem;
  }
}

.tooltip-title {
  font-weight: 700;
  color: var(--text);
}

.tooltip .tooltip-row {
  display: grid;
  grid-template-columns: 12px 1fr auto;
  gap: 8px;
  align-items: center;
  color: var(--text);
}

.tooltip .tooltip-row b {
  font-variant-numeric: tabular-nums;
}

.tooltip .dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--line);
}

/* ---- tables ---- */

.table-scroll {
  overflow-x: auto;
  margin: 0 -16px;
  padding: 0 16px;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

.data-table th,
.data-table td {
  padding: 9px 10px;
  text-align: left;
  border-bottom: 1px solid var(--grid);
  vertical-align: middle;
  white-space: nowrap;
}

.data-table th {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
}

.data-table td.num,
.data-table th.num {
  text-align: right;
}

.data-table tbody tr:hover {
  background: var(--surface-2);
}

.data-table tr.highlight {
  background: color-mix(in srgb, var(--brand) 10%, var(--surface));
}

.data-table .wrap {
  white-space: normal;
  min-width: 200px;
}

.table-foot {
  margin-top: 10px;
}

.game-cell {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
}

.game-swatch {
  flex-shrink: 0;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--line);
}

.score-cell {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 140px;
}

.score-cell .meter {
  flex: 1;
  height: 8px;
}

.score-cell b {
  min-width: 2.2em;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.missing {
  color: var(--muted);
}

.row-actions {
  display: flex;
  gap: 6px;
  justify-content: flex-end;
}

button.small,
.button-link.small {
  padding: 3px 10px;
  font-size: 0.8rem;
}

.status-pill.status-passed {
  border-color: var(--status-good);
}

.status-pill.status-failed {
  border-color: var(--status-critical);
}

.status-pill.status-probation {
  border-color: var(--brand);
}

.toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.85rem;
}

/* ---- assessment ---- */

.verdict {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 4px 16px;
  align-items: center;
}

.verdict-score {
  grid-row: span 2;
  display: grid;
  place-items: center;
  width: 84px;
  height: 84px;
  font-family: var(--font-display);
  font-size: 2rem;
  font-weight: 900;
  border-radius: 50%;
  border: 6px solid var(--verdict, var(--border));
}

.verdict h3 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 1.4rem;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: -0.01em;
}

.verdict-icon {
  margin-right: 6px;
  color: var(--verdict);
}

.verdict.strong { --verdict: var(--status-good); }
.verdict.borderline { --verdict: var(--status-warning); }
.verdict.risk { --verdict: var(--status-critical); }
.verdict.none { --verdict: var(--border); }

.assessment-summary {
  margin: 14px 0 0;
  font-size: 1.02rem;
  line-height: 1.55;
}

.assess-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 0 24px;
}

.fact-tiles {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 12px;
  margin: 0 0 24px;
}

.fact-tile {
  padding: 14px 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
}

.fact-tile .value {
  display: block;
  font-family: var(--font-display);
  font-size: 1.7rem;
  font-weight: 900;
  line-height: 1.1;
}

.fact-tile .label {
  display: block;
  margin-top: 4px;
  font-size: 0.85rem;
  color: var(--muted);
}

.point-list {
  margin: 0;
  padding-left: 1.2em;
  display: grid;
  gap: 6px;
}

.compare-row {
  display: grid;
  grid-template-columns: 150px 1fr 60px;
  gap: 10px;
  align-items: center;
  margin-bottom: 10px;
  font-size: 0.9rem;
}

.compare-track {
  position: relative;
  height: 10px;
  border-radius: 5px;
  background: var(--surface-2);
}

.compare-track .pool {
  position: absolute;
  top: -3px;
  width: 2px;
  height: 16px;
  margin-left: -1px;
  background: var(--muted);
}

.compare-track .me {
  position: absolute;
  top: 0;
  left: 0;
  height: 100%;
  border-radius: 5px;
  background: var(--data);
}

.delta-up {
  color: var(--status-good);
  font-weight: 600;
}

.delta-down {
  color: var(--status-critical);
  font-weight: 600;
}

/* ---- playtest report ---- */

.report-head {
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px 24px;
  align-items: flex-start;
}

.report-head h3 {
  margin: 0;
  font-size: 1.5rem;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: -0.01em;
}

.report-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 16px;
  align-items: center;
  margin: 16px 0;
}

.report-controls input[type="search"] {
  min-width: 240px;
}

.q-section-title {
  margin: 28px 0 10px;
  font-size: 0.85rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
}

.q-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 16px;
}

.q-card {
  padding: 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  min-width: 0;
}

.q-card.wide {
  grid-column: 1 / -1;
}

.q-card h4 {
  margin: 0 0 4px;
  font-size: 0.98rem;
  line-height: 1.3;
}

.q-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 10px;
  margin-bottom: 12px;
  font-size: 0.8rem;
  color: var(--muted);
}

.in-score {
  padding: 0 8px;
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--accent);
  border: 1px solid var(--brand);
  border-radius: 999px;
}

.bars {
  display: grid;
  gap: 8px;
}

.bar-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 2px 10px;
  font-size: 0.86rem;
}

.bar-row .bar-label {
  overflow-wrap: anywhere;
}

.bar-row .bar-value {
  font-variant-numeric: tabular-nums;
  color: var(--muted);
  white-space: nowrap;
}

.bar-row .bar-track {
  grid-column: 1 / -1;
  height: 8px;
  border-radius: 4px;
  background: var(--data-soft);
  overflow: hidden;
}

.bar-row .bar-fill {
  height: 100%;
  border-radius: 4px;
  background: var(--data);
}

.histogram {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: 1fr;
  gap: 4px;
  align-items: end;
  height: 110px;
  margin-top: 8px;
}

.histogram .col {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  height: 100%;
  font-size: 0.72rem;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.histogram .col span.bar {
  width: 100%;
  min-height: 2px;
  border-radius: 4px 4px 0 0;
  background: var(--data);
}

.histogram .col span.bar.zero {
  background: var(--grid);
}

.histogram .col .n {
  margin-bottom: 2px;
}

.histogram .col .x {
  margin-top: 4px;
  font-weight: 600;
  color: var(--text);
}

.big-stat {
  font-family: var(--font-display);
  font-size: 2.2rem;
  font-weight: 900;
  line-height: 1;
}

.big-stat small {
  font-size: 1rem;
  color: var(--muted);
}

.answers {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 10px;
}

.answers li {
  padding: 10px 12px;
  background: var(--surface-2);
  border-radius: 8px;
}

.answer-text {
  margin: 0;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  line-height: 1.5;
}

.answer-who {
  display: block;
  margin-bottom: 4px;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--muted);
}

mark {
  color: inherit;
  background: color-mix(in srgb, var(--brand) 35%, transparent);
  border-radius: 2px;
}

details.q-card > summary {
  cursor: pointer;
  list-style: none;
}

details.q-card > summary::-webkit-details-marker {
  display: none;
}

details.q-card > summary h4::before {
  content: "▸ ";
  color: var(--muted);
}

details.q-card[open] > summary h4::before {
  content: "▾ ";
}

.respondent-card dl {
  margin: 0;
  display: grid;
  gap: 10px;
}

.respondent-card dt {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--muted);
}

.respondent-card dd {
  margin: 2px 0 0;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

/* ---- ads report ---- */

.audience-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 16px;
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px 8px;
  margin: 0 0 14px;
}

.metric-grid div {
  min-width: 0;
}

.metric-grid dt {
  font-size: 0.75rem;
  color: var(--muted);
}

.metric-grid dd {
  margin: 0;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.ad-box {
  margin-top: 10px;
  padding: 10px 12px;
  background: var(--surface-2);
  border-radius: 8px;
  font-size: 0.88rem;
}

.ad-box strong {
  display: block;
  margin-bottom: 2px;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
}

.cpw-hero {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin: 16px 0 24px;
}

.cpw-hero .fact-tile {
  flex: 1 1 160px;
}

/* ---- scoring ---- */

.q-config {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) 120px;
  gap: 10px 16px;
  align-items: start;
  padding: 14px 0;
  border-bottom: 1px solid var(--grid);
}

.q-config:last-child {
  border-bottom: 0;
}

.q-config input[type="checkbox"] {
  margin-top: 4px;
  accent-color: var(--brand);
}

.q-config h4 {
  margin: 0 0 2px;
  font-size: 0.95rem;
}

.q-config .weight-input {
  display: flex;
  flex-direction: column;
  gap: 2px;
  font-size: 0.8rem;
  font-weight: 600;
}

.q-config .weight-input input {
  width: 100%;
}

.answer-scores {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 90px;
  gap: 6px 10px;
  align-items: center;
  margin-top: 10px;
  max-width: 560px;
  font-size: 0.88rem;
}

.answer-scores input {
  padding: 4px 8px;
  width: 100%;
}

.answer-scores .unscored {
  color: var(--status-critical);
  font-size: 0.75rem;
}

.q-config.off h4,
.q-config.off .answer-scores,
.q-config.off .weight-input {
  opacity: 0.55;
}

.sticky-actions {
  position: sticky;
  bottom: 0;
  z-index: 4;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 8px 16px;
  margin: 0 -16px;
  padding: 12px 16px;
  background: var(--surface);
  border-top: 1px solid var(--border);
}

/* ---- upload ---- */

.drop {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 28px 16px;
  text-align: center;
  border: 2px dashed var(--border);
  border-radius: 10px;
  cursor: pointer;
}

.drop.over,
.drop:hover {
  border-color: var(--brand);
}

.drop input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
}

.drop:focus-within {
  outline: 2px solid var(--brand);
  outline-offset: 2px;
}

.upload-summary {
  margin: 0 0 14px;
  padding: 10px 12px;
  font-size: 0.9rem;
  background: var(--surface-2);
  border-radius: 8px;
}

.usd-line {
  grid-column: 1 / -1;
  margin: 0;
  padding: 10px 12px;
  font-weight: 600;
  background: var(--meter-track);
  border-radius: 8px;
}

dialog {
  max-height: calc(100vh - 32px);
  overflow-y: auto;
}

@media (max-width: 520px) {
  .compare-row {
    grid-template-columns: 110px 1fr 48px;
  }

  .q-grid,
  .audience-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .q-config {
    grid-template-columns: auto minmax(0, 1fr);
  }

  .q-config .weight-input {
    grid-column: 2;
  }

  .metric-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

.scoring-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(260px, 340px);
  gap: 0 24px;
  align-items: start;
}

.scoring-grid > .panel:last-child {
  position: sticky;
  top: 64px;
}

@media (max-width: 900px) {
  .scoring-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .scoring-grid > .panel:last-child {
    position: static;
  }
}

.legend {
  list-style: none;
  margin: 0 0 12px;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 6px 16px;
  font-size: 0.85rem;
  color: var(--muted);
}

.legend li {
  display: flex;
  align-items: center;
  gap: 6px;
}

.form-grid .rate-actions {
  flex-direction: row;
  flex-wrap: wrap;
  align-items: center;
  align-self: end;
  gap: 4px 10px;
  min-height: 38px;
  font-weight: 500;
}

.scoring-grid .data-table th,
.scoring-grid .data-table td {
  padding: 8px 6px;
}

.team-picker {
  padding: 4px 8px;
  font-size: 0.85rem;
  max-width: 100%;
}

.team-tile .team-picker {
  margin: 6px 0 2px;
  width: 100%;
  font-size: 1rem;
  font-weight: 700;
}

.team-note {
  display: block;
  margin-top: 4px;
}
