:root {
  --forest: #0d3626;
  --forest-2: #15533a;
  --orange: #e87222;
  --orange-dark: #ad4317;
  --gold: #f2ad27;
  --cream: #f8f3e9;
  --white: #ffffff;
  --ink: #17231d;
  --muted: #65736b;
  --line: #d9e1d8;
  --success: #176b45;
  --danger: #a73535;
  --shadow: 0 18px 45px rgba(13, 54, 38, .12);
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: #f5f7fa;
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

a { color: inherit; text-decoration: none; }

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

.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 14px max(20px, calc((100vw - 1180px) / 2));
  background: rgba(255,255,255,.94);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(14px);
}

.brand { display: flex; align-items: center; gap: 12px; }
.brand-logo {
  width: 58px;
  height: 58px;
  padding: 3px;
  object-fit: contain;
  border-radius: 50%;
  background: var(--white);
  box-shadow: 0 3px 12px rgba(13, 54, 38, .16);
}
.brand strong, .brand small { display: block; }
.brand strong { color: var(--forest); letter-spacing: -.02em; }
.brand small { margin-top: 2px; color: var(--muted); }

nav { display: flex; align-items: center; gap: 20px; }
.mobile-link-strip { display: none; }
nav > a:not(.button) { font-weight: 800; color: var(--forest); }
nav > a:not(.button):hover { color: var(--orange-dark); }

main, footer {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
}

.hero {
  margin-top: 28px;
  padding: clamp(28px, 5vw, 64px);
  border-radius: 32px;
  background:
    radial-gradient(circle at 86% 15%, rgba(242,140,40,.32), transparent 28%),
    linear-gradient(135deg, var(--forest), var(--forest-2));
  color: var(--white);
  display: grid;
  grid-template-columns: 1.6fr .8fr;
  gap: 40px;
  align-items: end;
  box-shadow: var(--shadow);
}

.hero h1, .form-intro h1, .admin-top h1, .success-page h1 {
  margin: 10px 0 14px;
  font-size: clamp(2.2rem, 6vw, 4.8rem);
  line-height: .98;
  letter-spacing: -.045em;
}

.hero p, .form-intro p, .admin-top p, .success-page p {
  max-width: 700px;
  color: rgba(255,255,255,.76);
  font-size: 1.08rem;
  line-height: 1.7;
}

.eyebrow {
  display: inline-block;
  color: var(--orange);
  font-size: .78rem;
  font-weight: 900;
  letter-spacing: .16em;
  text-transform: uppercase;
}

.hero-actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 24px; }

.button {
  display: inline-flex;
  justify-content: center;
  align-items: center;
  min-height: 46px;
  border: 0;
  border-radius: 13px;
  padding: 0 20px;
  background: var(--orange);
  color: #19130d;
  font-weight: 900;
  cursor: pointer;
}
.button:hover { background: #ffa33f; }
.button-secondary {
  background: transparent;
  border: 1px solid rgba(255,255,255,.38);
  color: inherit;
}
.button-small { min-height: 38px; padding: 0 14px; }
.button-danger { background: #f4d8d8; color: var(--danger); }

.hero-card {
  padding: 24px;
  border: 1px solid rgba(255,255,255,.18);
  border-radius: 22px;
  background: rgba(255,255,255,.09);
}
.hero-card span, .hero-card small { display: block; color: rgba(255,255,255,.72); }
.hero-card strong { display: block; margin: 8px 0; font-size: 1.45rem; }

.stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
  margin: 18px 0 0;
}
.stats article {
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: var(--white);
}
.stats strong { display: block; font-size: 2rem; color: var(--forest); }
.stats span { color: var(--muted); }

.section { padding: 54px 0 0; }
.section-heading, .admin-top {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 20px;
}
.section h2 { margin: 5px 0 0; font-size: clamp(1.7rem, 4vw, 2.5rem); letter-spacing: -.03em; }

.date-picker {
  display: flex;
  gap: 10px;
  align-items: center;
  color: var(--muted);
  font-weight: 700;
}
.date-picker input { width: auto; }

.game-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
}
.game-card, .panel, .table-card, .results-list article {
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 22px;
}
.game-card { padding: 22px; }
.game-meta, .game-location, .team-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.game-meta { margin-bottom: 18px; }
.team-row { padding: 10px 0; }
.team-row span:nth-child(2) { flex: 1; font-weight: 800; }
.team-row small { color: var(--muted); }

.team-badge {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: #edf2f8;
  color: var(--forest);
  font-size: .8rem;
  font-weight: 900;
}
.pill, .status {
  display: inline-flex;
  padding: 6px 10px;
  border-radius: 999px;
  font-size: .76rem;
  font-weight: 900;
}
.pill { background: #fff1e3; color: var(--orange-dark); }
.status { background: #edf2f8; color: var(--forest); }
.status-final { background: #e1f3e9; color: var(--success); }
.status-cancelled { background: #f7e2e2; color: var(--danger); }

.game-location {
  margin-top: 14px;
  padding-top: 15px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: .9rem;
}

.standings-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}
.table-card { overflow: hidden; }
.table-card h3 { margin: 0; padding: 20px; background: var(--forest); color: var(--white); }
.table-scroll { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 14px 16px; text-align: left; border-bottom: 1px solid var(--line); }
th { color: var(--muted); font-size: .78rem; text-transform: uppercase; }
td:first-child { font-weight: 800; }

.score-banner, .coming-soon {
  padding: 28px;
  border-radius: 24px;
  background: var(--forest);
  color: var(--white);
}
.score-banner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 24px;
}
.score-banner p, .coming-soon p { color: rgba(255,255,255,.74); }

.results-list { display: grid; gap: 12px; }
.results-list article {
  display: grid;
  grid-template-columns: 120px 1fr auto;
  gap: 16px;
  align-items: center;
  padding: 18px 20px;
}
.results-list span, .results-list small { color: var(--muted); }

.form-shell {
  max-width: 820px;
  margin: 46px auto 0;
}
.form-shell.narrow { max-width: 560px; }
.form-intro, .admin-top {
  padding: 34px;
  border-radius: 28px;
  background: var(--forest);
  color: var(--white);
}
.form-intro h1, .admin-top h1 { font-size: clamp(2rem, 5vw, 3.4rem); }

.panel { padding: 22px; }
.form-grid, .edit-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}
.form-grid { margin-top: 16px; }
.form-grid label, .edit-grid label { display: grid; gap: 7px; }
.form-grid label span, .edit-grid label span { font-weight: 800; }
.full { grid-column: 1 / -1; }
.wide { grid-column: span 2; }

input, select, textarea {
  width: 100%;
  min-height: 46px;
  border: 1px solid #cfd6e0;
  border-radius: 12px;
  padding: 11px 13px;
  background: var(--white);
  color: var(--ink);
}
textarea { resize: vertical; }

.success-page {
  max-width: 760px;
  margin: 70px auto;
  padding: 50px;
  border-radius: 30px;
  text-align: center;
  background: var(--forest);
  color: var(--white);
}
.success-icon {
  display: grid;
  place-items: center;
  width: 72px;
  height: 72px;
  margin: 0 auto 18px;
  border-radius: 50%;
  background: var(--orange);
  color: var(--forest);
  font-size: 2rem;
  font-weight: 900;
}
.success-page .hero-actions { justify-content: center; }

.admin-top { margin-top: 34px; }
.admin-top p { margin-bottom: 0; }
.admin-list { display: grid; gap: 14px; }
.approval-card, .game-editor {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  align-items: center;
}
.approval-card h3 { margin: 10px 0 6px; }
.approval-card p, .approval-card small { color: var(--muted); }
.approval-actions { display: flex; gap: 10px; }
.game-editor { align-items: flex-start; flex-direction: column; }
.game-editor-title { display: flex; align-items: center; gap: 10px; }
.edit-grid { width: 100%; grid-template-columns: 150px 130px 1fr 150px auto; align-items: end; }
.edit-grid .wide { grid-column: auto; }

.text-button {
  border: 0;
  background: none;
  padding: 0;
  font-weight: 800;
  cursor: pointer;
}
.text-button.danger { color: var(--danger); }

.flash-wrap {
  width: min(1180px, calc(100% - 32px));
  margin: 16px auto 0;
}
.flash { padding: 13px 16px; border-radius: 12px; font-weight: 800; }
.flash.success { background: #e1f3e9; color: var(--success); }
.flash.error { background: #f7e2e2; color: var(--danger); }

.empty-state {
  padding: 28px;
  border: 1px dashed #cbd3de;
  border-radius: 20px;
  color: var(--muted);
  text-align: center;
  background: var(--white);
}

footer {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  padding: 46px 0 30px;
  color: var(--muted);
}
footer a { color: var(--forest); font-weight: 800; }

@media (max-width: 820px) {
  .site-header { align-items: center; gap: 12px; }
  .site-header > nav { display: flex; gap: 8px; }
  .site-header > nav > a:not(.button) { display: none; }
  .site-header > nav > .button { display: inline-flex; white-space: nowrap; }
  .site-header > nav > .theme-toggle { display: inline-flex; }
  .mobile-link-strip {
    position: sticky;
    top: 87px;
    z-index: 19;
    display: grid;
    grid-template-columns: 1fr 1fr;
    width: 100%;
    border-bottom: 1px solid var(--line);
    background: rgba(255,255,255,.96);
    box-shadow: 0 6px 14px rgba(13, 54, 38, .06);
    backdrop-filter: blur(14px);
  }
  .mobile-link-strip a {
    display: flex;
    min-height: 46px;
    align-items: center;
    justify-content: center;
    color: var(--forest);
    font-size: .9rem;
    font-weight: 850;
  }
  .mobile-link-strip a + a { border-left: 1px solid var(--line); }
  .mobile-link-strip a:hover, .mobile-link-strip a:focus-visible { background: #fff0e1; color: var(--orange-dark); outline: none; }
  html[data-theme="dark"] .mobile-link-strip { border-bottom-color: #50535c; background: rgba(27,28,33,.97); box-shadow: 0 6px 14px rgba(0,0,0,.28); }
  html[data-theme="dark"] .mobile-link-strip a { color: #f5f6f7; }
  html[data-theme="dark"] .mobile-link-strip a + a { border-left-color: #50535c; }
  html[data-theme="dark"] .mobile-link-strip a:hover, html[data-theme="dark"] .mobile-link-strip a:focus-visible { background: #56341f; color: #fff5ec; }
  .hero {
    display: block;
    min-height: 0;
    padding: 30px 28px;
  }
  .hero h1 {
    margin: 0;
    font-size: clamp(2.35rem, 10vw, 3.35rem);
    line-height: 1;
  }
  .hero .hero-date, .hero .hero-week {
    margin: 12px 0 0;
    max-width: none;
    font-size: 1rem;
    line-height: 1.45;
  }
  .hero .hero-week { color: rgba(255,255,255,.9); }
  .hero .hero-week strong { display: block; margin-top: 3px; }
  .hero, .standings-grid { grid-template-columns: 1fr; }
  .game-grid { grid-template-columns: 1fr; }
  .results-list article { grid-template-columns: 1fr; gap: 5px; }
  .edit-grid { grid-template-columns: 1fr 1fr; }
  .edit-grid .wide { grid-column: 1 / -1; }
}

@media (max-width: 600px) {
  main, footer { width: min(100% - 20px, 1180px); }
  .site-header { padding: 10px; }
  .mobile-link-strip { top: 68px; }
  .brand small { display: none; }
  .brand-mark { width: 44px; height: 44px; border-radius: 13px; }
  .hero { margin-top: 10px; border-radius: 22px; padding: 26px 20px; }
  .hero h1 { font-size: 2.35rem; }
  .hero .hero-date, .hero .hero-week { font-size: .96rem; }
  .stats { grid-template-columns: 1fr; }
  .section { padding-top: 38px; }
  .section-heading, .score-banner, .admin-top { align-items: stretch; flex-direction: column; }
  .form-grid, .edit-grid { grid-template-columns: 1fr; }
  .full, .wide { grid-column: auto; }
  .approval-card { flex-direction: column; align-items: stretch; }
  .approval-actions { width: 100%; }
  .approval-actions form, .approval-actions button { flex: 1; width: 100%; }
  footer { flex-direction: column; }
}
