:root {
  --red: #e00000;
  --ink: #0a0a0a;
  --muted: #666;
  --soft: #f5f5f5;
  --line: #e4e4e4;
  --gutter: 1rem;
  --radius: 4px;
}

/* Base */
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; font: 16px/1.4 system-ui, sans-serif; background: #fff; color: var(--ink); overflow-wrap: break-word; }
main { max-width: 40rem; margin: 0 auto; padding: 0 var(--gutter) 2rem; }
h1 { font-size: 1.375rem; margin: 1.25rem 0 0.75rem; }
h2 { font-size: 1.125rem; }
a { color: inherit; }
ul, ol { padding: 0; margin: 0; }
ul { list-style: none; }
:focus-visible { outline: 3px solid #0a58ca; outline-offset: 2px; }
.muted { color: var(--muted); }
.error { color: var(--red); font-weight: 600; }
.visually-hidden { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

/* Lines and sections */
.section-title { margin: 1.5rem 0 0; padding-bottom: 0.5rem; font-size: 0.9375rem; border-bottom: 1px solid var(--ink); }
.row { display: flex; align-items: center; justify-content: space-between; gap: 0.75rem; min-height: 3.5rem; padding: 0.375rem 0; border-bottom: 1px solid var(--line); }
.row > :first-child, .row > input { min-width: 0; overflow-wrap: anywhere; }
.row > button { flex: none; }

/* Fields and buttons */
label { display: block; margin: 0.75rem 0 0.25rem; font-size: 0.875rem; font-weight: 600; }
input, select { width: 100%; min-height: 48px; padding: 0.5rem 0.75rem; font: inherit; color: inherit; border: 1px solid #767676; border-radius: var(--radius); background: #fff; }
input[type="radio"], input[type="checkbox"] { width: 1.5rem; height: 1.5rem; min-height: 0; margin: 0 0.5rem 0 0; padding: 0; accent-color: var(--red); }
label:has(> input[type="radio"], > input[type="checkbox"]) { display: flex; align-items: center; min-height: 48px; margin: 0; font-size: 1rem; font-weight: 400; }
button, .button-primary { min-height: 44px; padding: 0.5rem 1rem; font: inherit; font-weight: 600; color: var(--ink); background: #fff; border: 1px solid var(--ink); border-radius: var(--radius); cursor: pointer; touch-action: manipulation; }
.button-primary { width: 100%; min-height: 52px; color: #fff; background: var(--red); border-color: var(--red); }
.button-link { padding: 0; font-weight: 400; background: none; border: 0; text-decoration: underline; }

/* Header and footer */
.site-header { background: var(--red); color: #fff; }
.site-header :focus-visible { outline-color: #fff; }
.site-header-inner { display: flex; align-items: center; justify-content: space-between; gap: 0.75rem; max-width: 40rem; height: 56px; margin: 0 auto; padding: 0 var(--gutter); }
.site-header a { text-decoration: none; }
.brand { display: flex; align-items: center; gap: 0.625rem; min-height: 44px; font-size: 1.0625rem; font-weight: 700; }
.brand img { display: block; height: 46px; width: auto; }
.site-header nav { display: flex; gap: 1rem; font-size: 0.875rem; }
.site-header nav a { display: flex; align-items: center; min-height: 44px; }
.site-header nav a[aria-current] { font-weight: 700; }
.site-footer { max-width: 40rem; margin: 0 auto; padding: 0 var(--gutter) 1.5rem; }
.sub-nav { display: flex; gap: 1.5rem; border-bottom: 1px solid var(--line); }
.sub-nav a { display: flex; align-items: center; min-height: 48px; }
.form { margin-bottom: 1.5rem; }

/* Match lists */
.day { margin: 1rem 0 0; color: var(--muted); }
.day::first-letter { text-transform: uppercase; }
.day + section .section-title { margin-top: 0.75rem; }
.day-title { margin: 1rem 0 0; font-size: 0.875rem; font-weight: 600; color: var(--muted); }
.more { display: inline-flex; align-items: center; min-height: 44px; font-size: 0.875rem; }
.match-row { display: grid; grid-template-columns: 72px minmax(0, 1fr) auto; gap: 0.125rem 0.75rem; align-items: center; padding: 0.75rem 0; border-bottom: 1px solid var(--line); text-decoration: none; }
.match-status { grid-row: 1 / 3; font-size: 0.8125rem; line-height: 1.25; color: var(--muted); font-variant-numeric: tabular-nums; }
.match-status.live { color: var(--red); font-weight: 700; }
.match-team { grid-column: 2; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.match-team.club { font-weight: 700; }
.match-score { grid-column: 3; font-size: 1.125rem; font-weight: 700; line-height: 1.25; text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }

/* Notifications */
.subscribe-btn { min-width: 6rem; font-size: 0.875rem; }
.subscribe-btn[data-subscribed="true"] { color: #fff; background: var(--ink); }
#subscribe-message { margin: 0; font-weight: 600; }
#subscribe-message:not(:empty) { padding: 0.75rem 0; }
.privacy { margin: 1.5rem 0 0; font-size: 0.8125rem; color: var(--muted); }
#ios-help { max-width: 24rem; padding: 1.25rem; color: inherit; border: 1px solid var(--ink); border-radius: var(--radius); }
#ios-help::backdrop { background: rgb(0 0 0 / 0.5); }
#ios-help h2 { margin: 0 0 1rem; }
#ios-help ol { padding-left: 1.25rem; }
#ios-help li { margin-bottom: 0.75rem; }
#ios-help img { max-width: 100%; vertical-align: middle; }

/* Match creation */
#create-match { margin-top: 1rem; }
#create-match > summary { display: flex; align-items: center; justify-content: center; list-style: none; }
#create-match > summary::-webkit-details-marker { display: none; }
#create-match[open] > summary { color: var(--ink); background: #fff; border-color: var(--ink); }

/* Match page */
.back { display: inline-flex; align-items: center; min-height: 44px; font-size: 0.875rem; color: var(--muted); text-decoration: none; }
.scoreboard { padding: 0.25rem 0 1rem; text-align: center; border-bottom: 1px solid var(--line); }
.scoreboard p { margin: 0; }
.live-status { font-size: 0.875rem; font-weight: 700; color: var(--muted); }
.live-status.live { color: var(--red); }
.score-row { display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); gap: 0.75rem; align-items: center; margin-top: 0.5rem; }
.team { line-height: 1.2; overflow-wrap: anywhere; }
.team.club { font-weight: 700; }
.score { font-size: 2.875rem; font-weight: 800; line-height: 1; white-space: nowrap; font-variant-numeric: tabular-nums; }
.kickoff-time { display: block; font-size: 1.75rem; font-weight: 800; line-height: 1.1; font-variant-numeric: tabular-nums; }
.kickoff-day { display: block; max-width: 7rem; font-size: 0.8125rem; color: var(--muted); }
.live-shootout { padding-top: 0.5rem; font-weight: 600; }
.scorers-row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 1.5rem; margin-top: 0.875rem; font-size: 0.875rem; color: var(--muted); overflow-wrap: anywhere; }
.scorers:first-child { text-align: right; }
.scorers:last-child { text-align: left; }

/* Event feed */
.live-events li { display: grid; grid-template-columns: 3rem minmax(0, 1fr) auto; gap: 0.75rem; align-items: baseline; margin: 0 calc(-1 * var(--gutter)); padding: 0.8125rem var(--gutter); border-bottom: 1px solid var(--line); }
.live-events time { font-size: 0.875rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.event-text { overflow-wrap: anywhere; }
.event-text strong { font-weight: 600; }
.event-detail { display: block; font-size: 0.875rem; color: var(--muted); }
.event-score { font-variant-numeric: tabular-nums; white-space: nowrap; }
.live-events .phase { background: var(--soft); }
.live-events .goal strong { font-size: 1.0625rem; font-weight: 700; }
.live-events .goal.club strong { color: var(--red); }
.live-events .goal .event-score { font-size: 1.125rem; font-weight: 800; }

/* Scoring screen */
#scoreboard .error { margin: 0.75rem 0 0; }
#network-error { margin-top: 0.75rem; }
#network-error p { margin: 0 0 0.5rem; }
#detail-hint { margin: 0.25rem 0 0; font-size: 0.875rem; }
#panel { margin-top: 0.875rem; }
.actions { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 0.625rem; margin-top: 0.625rem; }
.actions button { min-height: 52px; overflow-wrap: anywhere; }
.actions .button-big, .button-big { min-height: 104px; }
.button-big { font-size: 1.125rem; font-weight: 700; line-height: 1.2; }
.button-big.club { color: #fff; background: var(--red); border-color: var(--red); }
.button-big.opponent { color: #fff; background: var(--ink); }
.actions-sided .button-big { font-size: 1.5rem; font-weight: 800; }
.button-big > span { display: block; margin-top: 0.25rem; font-size: 0.875rem; font-weight: 500; }
#panel > .button-link { display: block; margin-top: 0.625rem; }
.section-title:has(+ #feed > ul:empty) { display: none; }
#more-actions > summary { display: inline-flex; align-items: center; min-height: 44px; text-decoration: underline; cursor: pointer; list-style: none; }
#more-actions > summary::-webkit-details-marker { display: none; }
