:root {
  --paper: #f6f0e1;
  --paper-strong: #efe5cd;
  --ink: #1d2320;
  --muted: #5b655f;
  --accent: #0d6f62;
  --accent-strong: #084e46;
  --accent-soft: rgba(13, 111, 98, 0.12);
  --gold: #c98a2c;
  --danger: #8f2d1f;
  --danger-soft: rgba(143, 45, 31, 0.12);
  --card: rgba(255, 251, 241, 0.9);
  --shadow: 0 18px 45px rgba(34, 31, 20, 0.12);
  --radius-lg: 24px;
  --radius-md: 18px;
  --radius-sm: 12px;
  --border: 1px solid rgba(29, 35, 32, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Trebuchet MS", "Gill Sans", sans-serif;
  color: var(--ink);
  background:
    radial-gradient(circle at top left, rgba(201, 138, 44, 0.18), transparent 30%),
    radial-gradient(circle at top right, rgba(13, 111, 98, 0.18), transparent 28%),
    linear-gradient(180deg, #f8f3e7 0%, #ece1c6 100%);
  min-height: 100vh;
}

.site-shell {
  width: min(1380px, calc(100vw - 32px));
  margin: 0 auto;
  padding: 28px 0 40px;
}

.hero {
  display: grid;
  grid-template-columns: 1.35fr 1fr;
  gap: 18px;
  align-items: stretch;
}

.hero-copy,
.hero-rules,
.panel,
.leaderboard-card,
.archive-card,
.metric-card,
.flash {
  background: var(--card);
  border: var(--border);
  box-shadow: var(--shadow);
  backdrop-filter: blur(8px);
}

.hero-copy {
  padding: 30px;
  border-radius: var(--radius-lg);
}

.eyebrow,
.section-kicker,
.tag,
.pill,
.rule-label {
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 0.72rem;
}

.eyebrow {
  margin: 0 0 14px;
  color: var(--accent-strong);
  font-weight: 700;
}

h1,
h2,
h3,
h4 {
  font-family: Georgia, "Times New Roman", serif;
  margin: 0;
}

h1 {
  font-size: clamp(2.7rem, 4.3vw, 4.7rem);
  line-height: 0.98;
}

.hero-text {
  max-width: 60ch;
  margin: 18px 0 0;
  font-size: 1.02rem;
  line-height: 1.65;
  color: var(--muted);
}

.hero-rules {
  display: grid;
  gap: 18px;
  border-radius: var(--radius-lg);
  padding: 18px;
}

.rule-card {
  border-radius: var(--radius-md);
  padding: 22px;
  background: linear-gradient(180deg, rgba(255, 251, 241, 0.9), rgba(239, 229, 205, 0.92));
  border: var(--border);
}

.rule-card p,
.leaderboard-header p,
.panel-header p,
.archive-header p,
.detail-header p,
.subsection-header p,
.helper,
.formula,
.empty-state {
  color: var(--muted);
}

.rule-card p {
  margin: 10px 0 0;
  line-height: 1.55;
}

.rule-label {
  color: var(--accent-strong);
  font-weight: 700;
}

#app {
  display: grid;
  gap: 20px;
  margin-top: 22px;
}

.flash-stack,
.metrics-grid,
.leaderboard-grid,
.input-grid,
.archive-grid,
.detail-grid {
  display: grid;
  gap: 18px;
}

.flash-stack {
  margin-top: 18px;
}

.flash {
  padding: 14px 18px;
  border-radius: var(--radius-md);
}

.flash.success {
  border-color: rgba(13, 111, 98, 0.2);
}

.flash.error {
  border-color: rgba(143, 45, 31, 0.2);
}

.metrics-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.metric-card,
.leaderboard-card,
.panel,
.archive-card {
  border-radius: var(--radius-lg);
}

.metric-card {
  padding: 22px;
}

.metric-card strong {
  display: block;
  margin-top: 10px;
  font-size: 2rem;
  font-family: Georgia, "Times New Roman", serif;
}

.metric-card p {
  margin: 8px 0 0;
  color: var(--muted);
  line-height: 1.5;
}

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

.leaderboard-card,
.panel,
.archive-card {
  padding: 24px;
}

.leaderboard-header,
.panel-header,
.archive-header,
.detail-header,
.subsection-header {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: start;
}

.section-title {
  font-size: 1.45rem;
}

.table-wrap {
  overflow-x: auto;
  margin-top: 16px;
}

table {
  width: 100%;
  border-collapse: collapse;
}

th,
td {
  padding: 11px 10px;
  text-align: left;
  border-bottom: 1px solid rgba(29, 35, 32, 0.08);
  white-space: nowrap;
}

th {
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
}

.rank-badge {
  display: inline-flex;
  min-width: 34px;
  justify-content: center;
  align-items: center;
  padding: 5px 10px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent-strong);
  font-weight: 700;
}

.rank-1 {
  background: rgba(201, 138, 44, 0.2);
  color: #85530c;
}

.rank-2 {
  background: rgba(110, 127, 137, 0.18);
  color: #485863;
}

.rank-3 {
  background: rgba(157, 94, 62, 0.16);
  color: #7c4124;
}

.tag,
.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 10px;
  border-radius: 999px;
  background: rgba(29, 35, 32, 0.06);
  font-weight: 700;
}

.pill.accent {
  background: var(--accent-soft);
  color: var(--accent-strong);
}

.pill.gold {
  background: rgba(201, 138, 44, 0.18);
  color: #7d5006;
}

.input-grid {
  grid-template-columns: 0.95fr 1.05fr;
}

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

.tab-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  padding: 9px 14px;
  border-radius: 999px;
  border: 1px solid rgba(29, 35, 32, 0.15);
  background: rgba(255, 255, 255, 0.55);
  color: var(--muted);
  font-weight: 700;
  text-decoration: none;
}

.tab-link.active {
  background: var(--accent-soft);
  color: var(--accent-strong);
  border-color: rgba(13, 111, 98, 0.18);
}

.panel-stack,
.stack,
.compact-list {
  display: grid;
  gap: 14px;
}

.subpanel,
.detail-block,
.tournament-game {
  padding: 18px;
  border-radius: var(--radius-md);
  border: var(--border);
}

.subpanel {
  background: linear-gradient(180deg, rgba(255, 250, 242, 0.94), rgba(241, 232, 210, 0.92));
}

.detail-block,
.tournament-game {
  background: rgba(255, 255, 255, 0.56);
}

.tournament-game {
  border-style: dashed;
}

.form-grid,
.row-grid {
  display: grid;
  gap: 12px;
}

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

.form-span-2 {
  grid-column: 1 / -1;
}

.row-grid {
  grid-template-columns: 2.1fr 0.8fr 0.8fr auto;
  align-items: end;
}

.row-grid.standings-row {
  grid-template-columns: 2.1fr 0.8fr auto;
}

.inline-actions,
.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

label {
  display: grid;
  gap: 6px;
  font-size: 0.92rem;
  font-weight: 700;
}

input,
select,
textarea,
button {
  font: inherit;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid rgba(29, 35, 32, 0.16);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.72);
  padding: 12px 14px;
  color: var(--ink);
}

button {
  border: 0;
  border-radius: 999px;
  padding: 11px 16px;
  cursor: pointer;
  font-weight: 700;
  transition: transform 0.15s ease, opacity 0.15s ease;
}

button:hover {
  transform: translateY(-1px);
}

button.primary {
  background: var(--accent);
  color: white;
}

button.secondary {
  background: rgba(29, 35, 32, 0.08);
  color: var(--ink);
}

button.ghost {
  background: transparent;
  border: 1px solid rgba(29, 35, 32, 0.15);
  color: var(--muted);
}

button.danger {
  background: var(--danger-soft);
  color: var(--danger);
}

button.small {
  padding: 9px 12px;
  font-size: 0.88rem;
}

.formula {
  margin: 12px 0 0;
  line-height: 1.6;
}

.archive-grid,
.detail-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.compact-item {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid rgba(29, 35, 32, 0.08);
}

.compact-item:last-child {
  border-bottom: 0;
  padding-bottom: 0;
}

.empty-state {
  padding: 18px;
  border-radius: var(--radius-md);
  background: rgba(29, 35, 32, 0.04);
}

.footer-note {
  padding: 20px 24px;
  border-radius: var(--radius-lg);
  background: rgba(255, 251, 241, 0.76);
  border: var(--border);
  color: var(--muted);
  line-height: 1.65;
}

@media (max-width: 1120px) {
  .hero,
  .leaderboard-grid,
  .input-grid,
  .archive-grid,
  .detail-grid,
  .metrics-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 720px) {
  .site-shell {
    width: min(100vw - 20px, 1380px);
    padding-top: 14px;
  }

  .hero-copy,
  .leaderboard-card,
  .panel,
  .archive-card,
  .metric-card {
    padding: 18px;
  }

  .form-grid,
  .row-grid,
  .row-grid.standings-row {
    grid-template-columns: 1fr;
  }

  .form-span-2 {
    grid-column: auto;
  }

  button {
    width: 100%;
  }

  .inline-actions,
  .actions {
    flex-direction: column;
  }
}
