:root {
  color-scheme: light;
  --bg: #f4f6fb;
  --surface: #ffffff;
  --line: #dfe4ee;
  --ink: #111a2e;
  --ink-2: #47536b;
  --accent: #2438a8;
  --hero-bg: #16225c;
  --hero-ink: #ffffff;
  --hero-ink-2: #c9d3f5;
  --claude: #2a78d6;
  --gemini: #eb6834;
  --codex: #1baf7a;
  --leader: #6250d6;
  --agent: #e87ba4;
  --good: #008300;
  --bad: #c72a3a;
  --heading: "Zen Antique", Georgia, serif;
  --text: "Onest", system-ui, sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #0e1424;
    --surface: #161e33;
    --line: #2a3550;
    --ink: #f0f3fb;
    --ink-2: #b4bed6;
    --accent: #a9b7ff;
    --hero-bg: #1c2c7a;
    --claude: #3987e5;
    --gemini: #d95926;
    --codex: #199e70;
    --leader: #9085e9;
    --agent: #d55181;
    --good: #4cc36a;
    --bad: #ff7f8c;
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 400 16px/1.5 var(--text);
  -webkit-font-smoothing: antialiased;
}

.page {
  max-width: 1240px;
  margin: 0 auto;
  padding: 40px 32px 56px;
  display: grid;
  gap: 24px;
}

h1, h2 { font-family: var(--heading); font-weight: 400; margin: 0; }
h1 { font-size: clamp(34px, 5vw, 56px); line-height: 1.1; }
h2 { font-size: 26px; line-height: 1.2; margin-bottom: 16px; }

.top {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 24px;
  flex-wrap: wrap;
}

.eyebrow { margin: 0 0 8px; color: var(--ink-2); font-weight: 500; }

.controls { display: grid; gap: 8px; justify-items: end; }

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

.months button {
  min-width: 140px;
  min-height: 44px;
  padding: 8px 16px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  color: var(--ink);
  font: 500 16px/1.2 var(--text);
  cursor: pointer;
}

.months button[aria-pressed="true"] {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--surface);
}

#gemini button { min-width: 188px; }

.months button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.verdict {
  background: var(--hero-bg);
  color: var(--hero-ink);
  border-radius: 18px;
  padding: 32px;
}

.verdict p { margin: 0; }
.verdict-label { color: var(--hero-ink-2); font-weight: 500; }
.verdict-value {
  font: 700 clamp(44px, 8vw, 84px)/1.05 var(--text);
  letter-spacing: -0.02em;
  margin: 8px 0 12px !important;
  font-variant-numeric: tabular-nums;
}
.verdict-note { max-width: 780px; color: var(--hero-ink-2); }

.ratio {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px 20px;
  margin-top: 20px;
  padding-top: 18px;
  border-top: 1px solid var(--hero-ink-2);
}

.ratio-value { font: 600 26px/1.25 var(--text); font-variant-numeric: tabular-nums; }

.ratio-button {
  min-height: 44px;
  min-width: 240px;
  padding: 8px 16px;
  border: 1px solid var(--hero-ink);
  border-radius: 10px;
  background: transparent;
  color: var(--hero-ink);
  font: 500 16px/1.2 var(--text);
  cursor: pointer;
}

.ratio-button:focus-visible { outline: 2px solid var(--hero-ink); outline-offset: 2px; }

.tiles { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }

.tile {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 18px 20px;
}

.tile p { margin: 0; }
.tile-label { color: var(--ink-2); font-size: 15px; }
.tile-value { font: 600 30px/1.2 var(--text); margin: 6px 0 2px !important; font-variant-numeric: tabular-nums; }
.tile-sub { color: var(--ink-2); font-size: 14px; }

.block, .notes {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 24px;
}

.table-wrap { overflow: visible; }

table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }

th {
  text-align: right;
  font-size: 14px;
  font-weight: 500;
  color: var(--ink-2);
  padding: 8px 10px;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}

td { text-align: right; padding: 12px 10px; border-bottom: 1px solid var(--line); vertical-align: top; white-space: nowrap; }
td:first-child { white-space: normal; }
tr:last-child td { border-bottom: 0; }
th:first-child, td:first-child { text-align: left; padding-left: 0; }
th:last-child, td:last-child { padding-right: 0; }
table.tasks th:nth-child(2), td.task-cell { text-align: left; white-space: normal; min-width: 170px; }
.ratio-head { white-space: normal; min-width: 76px; }

.task-name { font-weight: 600; }
.task-sub, .cell-sub { display: block; color: var(--ink-2); font-size: 14px; font-weight: 400; }
.cell-main { display: block; font-weight: 500; }

.dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 6px; }
.dot-claude { background: var(--claude); }
.dot-gemini { background: var(--gemini); }
.dot-codex { background: var(--codex); }

.money-good { color: var(--good); }
.money-bad { color: var(--bad); }

.legend { display: flex; flex-wrap: wrap; gap: 8px 20px; margin-bottom: 16px; color: var(--ink-2); font-size: 15px; }

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

.bar-row { display: grid; grid-template-columns: 200px 1fr 90px; gap: 12px; align-items: center; }
.bar-name { font-weight: 500; }
.bar-total { text-align: right; font-variant-numeric: tabular-nums; }

.bar-track { display: flex; gap: 2px; height: 20px; }
.bar-seg { min-width: 4px; }
.bar-seg:first-child { border-radius: 4px 0 0 4px; }
.bar-seg:last-child { border-radius: 0 4px 4px 0; }

.tip {
  position: fixed;
  z-index: 5;
  background: var(--ink);
  color: var(--bg);
  border-radius: 8px;
  padding: 6px 10px;
  font-size: 14px;
  pointer-events: none;
}

.notes ul { margin: 0; padding-left: 20px; color: var(--ink-2); display: grid; gap: 8px; }
.stamp { margin: 16px 0 0; color: var(--ink-2); font-size: 14px; }

@media (max-width: 1024px) {
  .page { padding: 28px 20px 40px; }
  .tiles { grid-template-columns: repeat(2, 1fr); }
  .controls { width: 100%; justify-items: start; }
}

@media (max-width: 900px) {
  table.tasks thead, table.summary thead { display: none; }
  table.tasks, table.tasks tbody, table.tasks tr, table.tasks td,
  table.summary, table.summary tbody, table.summary tr, table.summary td { display: block; width: 100%; }
  table.tasks tr, table.summary tr { border-bottom: 1px solid var(--line); padding: 12px 0; }
  table.tasks tr { display: flex; flex-direction: column; }
  td.task-cell { order: -1; }
  table.tasks tr:last-child, table.summary tr:last-child { border-bottom: 0; }
  table.tasks td, table.summary td {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    text-align: right;
    border: 0;
    padding: 6px 0;
  }
  table.tasks td::before, table.summary td::before {
    content: attr(data-label);
    color: var(--ink-2);
    font-size: 15px;
    text-align: left;
    flex: none;
  }
  table.tasks td.task-cell { display: block; text-align: left; }
  table.tasks td.task-cell::before { content: none; }
}

@media (max-width: 640px) {
  .page { padding: 20px 16px 32px; gap: 16px; }
  .controls { width: 100%; justify-items: stretch; }
  .months { width: 100%; }
  .months button { flex: 1 1 0; min-width: 0; padding: 8px 6px; }
  #gemini button { min-width: 0; }
  .verdict { padding: 22px 18px; }
  .ratio-value { font-size: 22px; }
  .ratio-button { width: 100%; }
  .block, .notes { padding: 18px 16px; }
  .tiles { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .tile { padding: 14px; }
  .tile-value { font-size: 24px; }
  .bar-row { grid-template-columns: 1fr auto; }
  .bar-track { grid-column: 1 / -1; grid-row: 2; }
}
