:root {
  color-scheme: light;
  --ink: #151515;
  --muted: #626a70;
  --line: #d9dde2;
  --surface: #ffffff;
  --page: #f4f7f8;
  --accent: #0b6f85;
  --accent-dark: #07566a;
  --soft: #e8f4f6;
  --danger: #9a3412;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: var(--page);
  color: var(--ink);
}

a {
  color: var(--accent-dark);
  font-weight: 700;
}

button,
input,
select {
  font: inherit;
}

.shell {
  width: min(100%, 1120px);
  margin: 0 auto;
  padding: 28px 18px 44px;
}

.top {
  margin-bottom: 20px;
}

.kicker {
  margin: 0 0 6px;
  color: var(--accent-dark);
  font-size: 0.86rem;
  font-weight: 800;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  letter-spacing: 0;
}

h1 {
  margin: 0;
  font-size: clamp(2.2rem, 8vw, 4rem);
  line-height: 1.02;
}

h2 {
  margin: 0 0 14px;
  font-size: 1.2rem;
}

h3 {
  margin: 0 0 8px;
  font-size: 1rem;
}

.note,
.loading,
.empty,
.meta,
.small {
  color: var(--muted);
}

.nav {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 16px;
}

.nav a {
  display: inline-flex;
  align-items: center;
  min-height: 38px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  text-decoration: none;
}

.grid {
  display: grid;
  gap: 12px;
}

.stats-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin-bottom: 12px;
}

.card,
.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 8px 28px rgba(21, 21, 21, 0.06);
}

.card {
  min-height: 112px;
  padding: 16px;
}

.card-label {
  margin: 0 0 8px;
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 700;
  text-transform: uppercase;
}

.card-value {
  margin: 0;
  font-size: 2rem;
  font-weight: 850;
}

.panel {
  margin-top: 12px;
  padding: 18px;
}

.record-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.record {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfd;
}

.record p {
  margin: 4px 0 0;
}

.table-wrap {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.95rem;
}

th,
td {
  padding: 11px 8px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

th {
  color: var(--muted);
  font-size: 0.82rem;
  text-transform: uppercase;
}

.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

input,
select {
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  padding: 0 12px;
}

input {
  width: min(100%, 340px);
}

.story-list,
.round-list,
.breakdown {
  display: grid;
  gap: 10px;
}

.story-item,
.group,
.breakdown-row {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfd;
  padding: 12px;
}

.story-item {
  display: grid;
  gap: 4px;
}

.story-item-title {
  font-weight: 800;
}

.pill {
  display: inline-block;
  padding: 3px 8px;
  border-radius: 999px;
  background: var(--soft);
  color: var(--accent-dark);
  font-size: 0.82rem;
  font-weight: 750;
}

.group-head,
.breakdown-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

.group-options {
  display: grid;
  gap: 6px;
  margin-top: 10px;
}

.group-option {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
}

.winner {
  font-weight: 850;
}

.method p {
  max-width: 780px;
}

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

@media (max-width: 760px) {
  .stats-grid,
  .record-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .section-head,
  .group-head,
  .breakdown-row {
    align-items: stretch;
    flex-direction: column;
  }

  input,
  select {
    width: 100%;
  }
}

@media (max-width: 460px) {
  .stats-grid,
  .record-grid {
    grid-template-columns: 1fr;
  }
}
