:root {
  --bg: #f4efe4;
  --surface: #fffaf2;
  --surface-strong: #fff;
  --text: #18202f;
  --muted: #566072;
  --line: #d9cfbd;
  --accent: #0e5f76;
  --accent-2: #b9d53b;
  --danger: #a63c3c;
  --ok: #26734d;
  --shadow: 0 18px 40px rgba(24, 32, 47, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  color: var(--text);
  background:
    radial-gradient(circle at top left, rgba(185, 213, 59, 0.18), transparent 32%),
    radial-gradient(circle at top right, rgba(14, 95, 118, 0.14), transparent 28%),
    var(--bg);
  font-family: "Trebuchet MS", "Avenir Next", sans-serif;
}

a {
  color: var(--accent);
  text-decoration: none;
}

.site-header {
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: 1rem;
  padding: 2rem 2rem 1rem;
}

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

.page-shell {
  padding: 0 2rem 3rem;
  max-width: 1400px;
  margin: 0 auto;
}

.card {
  background: rgba(255, 250, 242, 0.92);
  border: 1px solid var(--line);
  border-radius: 24px;
  padding: 1.25rem;
  box-shadow: var(--shadow);
}

.hero,
.stack {
  display: grid;
  gap: 1rem;
}

.gap-md {
  gap: 0.75rem;
}

.gap-lg {
  gap: 1.5rem;
}

.stats-grid,
.games-grid {
  display: grid;
  gap: 1rem;
}

.stats-grid {
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
}

.games-grid {
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
}

.stat-card,
.game-card {
  background: var(--surface-strong);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 1rem;
}

.stat-label,
.muted,
.slot-source,
.game-meta span,
label span,
.eyebrow {
  color: var(--muted);
}

.eyebrow {
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 0.78rem;
  margin: 0 0 0.3rem;
}

.top-nav,
.button-row,
.status-pills,
.section-head {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: center;
}

.section-head {
  justify-content: space-between;
}

.btn,
button,
select,
input {
  font: inherit;
}

.btn,
button {
  border: 0;
  border-radius: 999px;
  padding: 0.8rem 1.2rem;
  cursor: pointer;
}

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

.btn-danger {
  background: var(--danger);
  color: white;
}

.btn-secondary {
  background: white;
  color: var(--text);
  border: 1px solid var(--line);
}

.btn-small {
  padding: 0.55rem 0.9rem;
  font-size: 0.9rem;
}

form {
  margin: 0;
}

label {
  display: grid;
  gap: 0.35rem;
}

input,
select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 0.7rem 0.85rem;
  background: white;
}

.login-card {
  max-width: 520px;
  margin: 4rem auto 0;
}

.flash-stack {
  display: grid;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.flash {
  border-radius: 14px;
  padding: 0.85rem 1rem;
}

.flash-success {
  background: rgba(38, 115, 77, 0.12);
  color: var(--ok);
}

.flash-error {
  background: rgba(166, 60, 60, 0.12);
  color: var(--danger);
}

.pill,
.points-chip {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 0.35rem 0.7rem;
  font-size: 0.85rem;
}

.pill-ok,
.points-chip {
  background: rgba(185, 213, 59, 0.22);
}

.pill-danger {
  background: rgba(166, 60, 60, 0.15);
  color: var(--danger);
}

.pill-muted {
  background: rgba(86, 96, 114, 0.12);
}

.slot-list {
  display: grid;
  gap: 0.45rem;
  margin: 0.8rem 0;
}

.slot-row {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
}

.slot-team {
  font-weight: 700;
  text-align: right;
}

.actual-line {
  margin: 0.8rem 0 0;
  font-size: 0.92rem;
}

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

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

th,
td {
  text-align: left;
  padding: 0.9rem 0.75rem;
  border-bottom: 1px solid var(--line);
}

.member-list {
  display: grid;
  gap: 0.75rem;
}

.member-link {
  background: white;
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 1rem;
}

.check-row {
  display: flex;
  gap: 0.75rem;
  align-items: center;
}

.check-row input {
  width: auto;
}

.password-reset-form {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) auto;
  gap: 0.5rem;
  align-items: center;
}

.bracket-builder {
  padding: 0;
  overflow: hidden;
}

.bracket-toolbar {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  padding: 1rem 1.25rem;
  background: rgba(244, 239, 228, 0.96);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}

.autosave-status {
  margin: 0.35rem 0 0;
  font-size: 0.83rem;
  font-weight: 700;
}

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

.autosave-pending {
  color: #9a6b10;
}

.autosave-ok {
  color: var(--ok);
}

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

.bracket-progress-label,
.bracket-section-title,
.pick-card-label {
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-weight: 800;
}

.bracket-progress-label {
  font-size: 0.78rem;
}

.bracket-progress-meta,
.pick-card-meta,
.pick-card-side,
.team-pair {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.bracket-progress-meta {
  min-width: min(100%, 260px);
}

.bracket-progress-track {
  flex: 1;
  height: 0.55rem;
  background: #e2d8c5;
  border-radius: 999px;
  overflow: hidden;
}

.bracket-progress-bar {
  height: 100%;
  background: linear-gradient(90deg, #d99a2b, #f0c46e);
}

.bracket-progress-count {
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}

.bracket-sections {
  display: grid;
  gap: 1.5rem;
  padding: 1.25rem;
}

.bracket-overview {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.9rem;
  padding: 1.25rem 1.25rem 0;
}

.outcome-card {
  border-radius: 18px;
  padding: 1rem;
  border: 1px solid #ddcfbb;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.95), rgba(251, 245, 232, 0.95));
  box-shadow: 0 10px 24px rgba(24, 32, 47, 0.06);
}

.outcome-us {
  border-top: 4px solid #0e5f76;
}

.outcome-intl {
  border-top: 4px solid #26734d;
}

.outcome-third {
  border-top: 4px solid #8c6c3a;
}

.outcome-champ {
  border-top: 4px solid #e8a33d;
}

.outcome-label {
  margin: 0 0 0.35rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  font-size: 0.72rem;
  font-weight: 800;
}

.outcome-team {
  display: block;
  font-size: 1.05rem;
}

.bracket-board {
  display: grid;
  gap: 1.25rem;
  padding: 1.25rem;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  grid-template-areas:
    "uswin intlwin"
    "uselim intlelim"
    "finals finals";
}

.bracket-section {
  display: grid;
  gap: 0.85rem;
}

.bracket-section-us-winners {
  grid-area: uswin;
}

.bracket-section-international-winners {
  grid-area: intlwin;
}

.bracket-section-us-elimination {
  grid-area: uselim;
}

.bracket-section-international-elimination {
  grid-area: intlelim;
}

.bracket-section-finals {
  grid-area: finals;
}

.bracket-section-title {
  margin: 0;
  padding-bottom: 0.5rem;
  border-bottom: 2px solid var(--text);
  font-size: 0.8rem;
}

.pick-stack {
  display: grid;
  gap: 0.8rem;
}

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

.pick-card {
  background: white;
  border: 1px solid #e5dccb;
  border-radius: 18px;
  padding: 1rem;
}

.pick-card-champ {
  background: #fff7e8;
  border-color: #dfb257;
}

.pick-card-meta {
  justify-content: space-between;
  align-items: start;
}

.pick-card-meta p {
  margin: 0;
}

.pick-card-label {
  color: #7f6542;
  font-size: 0.73rem;
}

.pick-card-time {
  color: var(--muted);
  font-size: 0.82rem;
  font-variant-numeric: tabular-nums;
}

.pick-card-side {
  flex-wrap: wrap;
  justify-content: end;
}

.pick-badge {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 0.3rem 0.65rem;
  font-size: 0.72rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.pick-badge-correct {
  background: rgba(38, 115, 77, 0.14);
  color: var(--ok);
}

.pick-badge-missed {
  background: rgba(166, 60, 60, 0.14);
  color: var(--danger);
}

.team-pair {
  margin-top: 0.85rem;
}

.team-button {
  flex: 1;
  display: inline-flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.6rem;
  min-height: 54px;
  padding: 0.8rem 0.95rem;
  border: 1px solid #d9cfbd;
  border-radius: 12px;
  background: white;
  color: var(--text);
  font-size: 0.96rem;
  font-weight: 700;
  text-align: left;
  transition: transform 0.12s ease, box-shadow 0.12s ease, border-color 0.12s ease;
}

.team-button:hover:enabled {
  border-color: var(--accent);
  box-shadow: 0 10px 24px rgba(14, 95, 118, 0.12);
  transform: translateY(-1px);
}

.team-button-selected {
  background: #e8a33d;
  border-color: #e8a33d;
  color: #0b1f3a;
}

.team-button-empty {
  background: #f3efe3;
  border-style: dashed;
  color: #a79c86;
}

.team-button-readonly {
  cursor: default;
}

.team-check,
.team-versus {
  font-weight: 800;
}

.team-versus {
  color: var(--muted);
  font-size: 0.76rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

@media (max-width: 760px) {
  .site-header,
  .section-head {
    align-items: start;
  }

  .page-shell,
  .site-header {
    padding-left: 1rem;
    padding-right: 1rem;
  }

  .bracket-toolbar,
  .bracket-overview,
  .bracket-board,
  .team-pair,
  .pick-card-meta {
    flex-direction: column;
    align-items: stretch;
  }

  .bracket-overview,
  .bracket-board,
  .pick-stack-finals {
    grid-template-columns: 1fr;
  }

  .bracket-board {
    grid-template-areas:
      "uswin"
      "intlwin"
      "uselim"
      "intlelim"
      "finals";
  }

  .pick-card-side {
    justify-content: start;
  }

  .team-versus {
    text-align: center;
  }

  .password-reset-form {
    grid-template-columns: 1fr;
  }
}
