:root {
  --bg: #f6f6f4;
  --surface: #ffffff;
  --surface-hover: #f3f2ef;
  --text: #17171a;
  --text-muted: #5e5d59;
  --border: #e4e3df;
  --accent: #b3131b;
  --accent-text: #ffffff;
  --accent-soft: #fbeaea;
  --home: #1d6b3a;
  --home-soft: #e3f3e8;
  --away: #3b4a8f;
  --away-soft: #e7eaf7;
  --shadow: 0 1px 2px rgb(20 20 20 / 6%), 0 4px 16px rgb(20 20 20 / 5%);
  --radius: 16px;
  --radius-sm: 10px;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #131315;
    --surface: #1c1c1f;
    --surface-hover: #252529;
    --text: #f1f0ec;
    --text-muted: #a9a8a2;
    --border: #2e2e33;
    --accent: #f0565c;
    --accent-text: #160304;
    --accent-soft: #3a1a1c;
    --home: #6fd194;
    --home-soft: #18301f;
    --away: #9fb0f5;
    --away-soft: #1e2440;
    --shadow: none;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }

html {
  -webkit-text-size-adjust: 100%;
  /* Keep room for the scroll bar on short pages too, so the layout does not
     jump sideways between the start page and a competition's long list. */
  scrollbar-gutter: stable;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent); }

svg { fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* --- frame ----------------------------------------------------------------- */

.site-header, .page, .site-footer {
  width: 100%;
  max-width: 44rem;
  margin: 0 auto;
  padding: 0 1rem;
}

.site-header { padding-top: 1.25rem; padding-bottom: 0.5rem; }

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  color: var(--text);
  font-weight: 700;
  text-decoration: none;
  letter-spacing: -0.01em;
}

.site-footer {
  padding-top: 2.5rem;
  padding-bottom: 2.5rem;
  color: var(--text-muted);
  font-size: 0.85rem;
}

h1, h2, h3 { line-height: 1.2; letter-spacing: -0.02em; }

.hero { padding: 1.5rem 0 1rem; }
.hero h1 { margin: 0 0 0.6rem; font-size: clamp(1.75rem, 5vw, 2.4rem); }
.hero p { margin: 0 0 0.75rem; color: var(--text-muted); max-width: 36rem; }

.notice {
  padding: 1rem 1.15rem;
  border-radius: var(--radius-sm);
  background: var(--accent-soft);
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 2.75rem;
  padding: 0 1.1rem;
  border: 0;
  border-radius: 999px;
  background: var(--accent);
  color: var(--accent-text);
  font: inherit;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  white-space: nowrap;
}

/* --- team picker --------------------------------------------------------------- */

.picker { display: grid; gap: 1rem; }

.search {
  position: sticky;
  top: 0.5rem;
  z-index: 1;
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0 1rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.search:focus-within { border-color: var(--accent); }
.search svg { width: 1.2rem; height: 1.2rem; color: var(--text-muted); flex: none; }

.search input {
  width: 100%;
  min-height: 3rem;
  border: 0;
  outline: 0;
  background: transparent;
  color: inherit;
  font: inherit;
}

.tabs {
  display: flex;
  gap: 0.4rem;
  overflow-x: auto;
  scrollbar-width: none;
}

.tabs a {
  display: inline-flex;
  align-items: center;
  flex: none;
  min-height: 2.4rem;
  text-decoration: none;
  padding: 0 1rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}

.tabs a[aria-current="page"] {
  border-color: var(--accent);
  background: var(--accent);
  color: var(--accent-text);
}

.tabs a:hover { border-color: var(--accent); }

.choose {
  margin: 0;
  padding: 2rem 1rem;
  border: 1px dashed var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  text-align: center;
}

.league h3 {
  margin: 1rem 0 0.5rem;
  color: var(--text-muted);
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.teams {
  display: grid;
  gap: 1px;
  margin: 0;
  padding: 0;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--border);
  list-style: none;
}

.team-link {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  min-height: 3.25rem;
  padding: 0.6rem 1rem;
  background: var(--surface);
  color: var(--text);
  text-decoration: none;
  transition: background 0.15s;
}

.team-link:hover, .team-link:focus-visible { background: var(--surface-hover); }
.team-link svg { width: 1.1rem; height: 1.1rem; color: var(--text-muted); flex: none; }

.empty { color: var(--text-muted); text-align: center; padding: 2rem 0; }

[hidden] { display: none !important; }

/* --- team page ------------------------------------------------------------------- */

.back {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  margin-top: 0.5rem;
  color: var(--text-muted);
  text-decoration: none;
  font-weight: 500;
}

.back svg { width: 1.1rem; height: 1.1rem; }

.team-head { padding: 1rem 0 1.25rem; }
.team-head h1 { margin: 0 0 0.3rem; font-size: clamp(1.75rem, 5vw, 2.3rem); }
.team-head p { margin: 0; color: var(--text-muted); }

.card {
  margin-bottom: 1rem;
  padding: 1.25rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.card h2 { margin: 0 0 1rem; font-size: 1.1rem; }

.subscribe-options {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(11rem, 1fr));
  gap: 0.6rem;
}

.option {
  display: grid;
  gap: 0.15rem;
  padding: 0.9rem 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  text-decoration: none;
  transition: border-color 0.15s, background 0.15s, transform 0.15s;
}

.option:hover, .option:focus-visible { border-color: var(--accent); background: var(--accent-soft); }
.option:active { transform: scale(0.98); }
.option-title { font-weight: 600; }
.option-hint { color: var(--text-muted); font-size: 0.85rem; }

.copy { margin-top: 1rem; }
.copy label { display: block; margin-bottom: 0.4rem; color: var(--text-muted); font-size: 0.85rem; }
.copy-row { display: flex; gap: 0.5rem; }

.copy-row input {
  flex: 1;
  min-width: 0;
  min-height: 2.75rem;
  padding: 0 0.9rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--bg);
  color: var(--text);
  font: 0.9rem ui-monospace, SFMono-Regular, Menlo, monospace;
}

.muted { margin: 0.75rem 0 0; color: var(--text-muted); font-size: 0.9rem; }

.matches { display: grid; gap: 0.75rem; margin: 0; padding: 0; list-style: none; }

.match { display: flex; align-items: center; gap: 0.9rem; }

.date {
  display: grid;
  place-items: center;
  flex: none;
  width: 3.25rem;
  height: 3.25rem;
  border-radius: 12px;
  background: var(--accent-soft);
  color: var(--accent);
  line-height: 1;
}

.day { font-size: 1.25rem; font-weight: 700; }
.month { font-size: 0.75rem; font-weight: 600; text-transform: uppercase; }

.details { flex: 1; min-width: 0; }
.opponent { display: flex; align-items: center; gap: 0.5rem; font-weight: 600; }
.meta { color: var(--text-muted); font-size: 0.85rem; overflow-wrap: anywhere; }

.badge {
  flex: none;
  padding: 0.1rem 0.5rem;
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.badge.home { background: var(--home-soft); color: var(--home); }
.badge.away { background: var(--away-soft); color: var(--away); }

.result { flex: none; font-weight: 700; font-variant-numeric: tabular-nums; }

/* --- Google Calendar steps -------------------------------------------------------- */

.button.secondary {
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text);
}

.google-steps {
  width: min(32rem, calc(100% - 2rem));
  max-height: calc(100% - 2rem);
  padding: 1.5rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  box-shadow: 0 12px 48px rgb(0 0 0 / 25%);
}

.google-steps::backdrop { background: rgb(10 10 12 / 55%); }
.google-steps h2 { margin: 0 0 0.6rem; font-size: 1.25rem; color: var(--accent); }
.google-steps > p { margin: 0 0 1rem; }

.steps {
  display: grid;
  gap: 0.5rem;
  margin: 0 0 1.25rem;
  padding: 0;
  list-style: none;
  counter-reset: step;
}

.steps li {
  position: relative;
  min-height: 1.6rem;
  padding-left: 2.3rem;
  counter-increment: step;
}

.steps li::before {
  content: counter(step);
  position: absolute;
  top: 0;
  left: 0;
  display: grid;
  place-items: center;
  flex: none;
  width: 1.6rem;
  height: 1.6rem;
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 0.85rem;
  font-weight: 700;
}

.dialog-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 0.5rem;
  margin-top: 1.25rem;
}

@media (max-width: 30rem) {
  .dialog-actions .button { flex: 1 1 100%; }
  .dialog-actions [data-google-continue] { order: -1; }
}

.faq summary { font-weight: 600; cursor: pointer; }
.faq ul { margin: 0.75rem 0 0; padding-left: 1.2rem; color: var(--text-muted); }
.faq li + li { margin-top: 0.4rem; }

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}
