/* Padel Park public app — standings and fixtures.
   Design tokens live in tokens.css, loaded first. Mobile first at 375px. */

.shell { max-width: 640px; margin: 0 auto; padding: 0 var(--s2) var(--s6); }

/* ---------- Header ---------- */

.masthead { padding: var(--s3) var(--s2) var(--s2); border-bottom: 2px solid var(--red); }
.masthead h1 { font-size: var(--t-xl); line-height: 1.2; margin: 0; color: var(--red); }
.masthead .meta { font-size: var(--t-sm); color: var(--muted); margin: var(--s1) 0 0; }

/* ---------- Box tabs ----------
   The active tab is marked by a red underline and bold weight rather than a
   red fill: white on #FF0000 is 4.0:1, which is below the 4.5:1 needed for a
   label at this size. The underline keeps the brand cue at full contrast, and
   weight plus aria-selected mean the state is never carried by colour alone. */

.tabs {
  display: flex; gap: var(--s1); overflow-x: auto; scrollbar-width: none;
  border-bottom: 1px solid var(--line); margin-bottom: var(--s3);
  position: sticky; top: 0; background: var(--bg); z-index: 5;
}
.tabs::-webkit-scrollbar { display: none; }

.tab {
  flex: 0 0 auto; min-height: 48px; padding: var(--s1) var(--s2);
  font-size: var(--t-md); font-weight: 600; color: var(--muted);
  background: none; border: 0; border-bottom: 3px solid transparent;
  cursor: pointer; white-space: nowrap;
}
.tab[aria-selected="true"] { color: var(--ink); font-weight: 700; border-bottom-color: var(--red); }
.tab:hover { color: var(--ink); }

/* ---------- Standings ----------
   Four columns fit 375px without shrinking type. The secondary figures sit
   under the pair name instead of becoming columns of their own. */

.standings { width: 100%; border-collapse: collapse; }
.standings caption { text-align: left; font-size: var(--t-lg); font-weight: 700; padding-bottom: var(--s1); }

.standings th {
  font-size: var(--t-xs); text-transform: uppercase; letter-spacing: 0.06em;
  color: var(--muted); text-align: right; padding: var(--s1);
  border-bottom: 1px solid var(--line);
}
.standings th:nth-child(1) { text-align: center; width: 32px; }
.standings th:nth-child(2) { text-align: left; }
.standings th:nth-child(3) { width: 40px; }
.standings th:nth-child(4) { width: 48px; }

.standings td { padding: var(--s1); border-bottom: 1px solid var(--line); vertical-align: top; }
.standings tbody tr:last-child td { border-bottom: 0; }

.rank { text-align: center; font-family: var(--mono); font-weight: 700; font-size: var(--t-md); color: var(--muted); }
.pair-name { font-weight: 600; font-size: var(--t-md); }
.pair-players { font-size: var(--t-sm); color: var(--muted); margin-top: 0; }
.pair-figures { font-size: var(--t-sm); color: var(--muted); margin-top: var(--s1); font-variant-numeric: tabular-nums; }
.num { text-align: right; font-family: var(--mono); font-variant-numeric: tabular-nums; font-size: var(--t-md); }
.points { font-weight: 700; font-size: var(--t-lg); }

/* Promotion and relegation edges, marked with a border and a caption note —
   never by colour alone. */
tr.promotes td { box-shadow: inset 3px 0 0 var(--red); }
tr.relegates td { box-shadow: inset 3px 0 0 var(--muted); }
tr.withdrawn .pair-name { text-decoration: line-through; }

/* ---------- Fixtures ---------- */

/* Pair names take the full width and the score sits underneath, so a
   three-set score never squeezes the names into extra lines. */
.fixture { padding: var(--s1) 0; border-bottom: 1px solid var(--line); }
.fixture:last-child { border-bottom: 0; }
.fixture-pairs { font-size: var(--t-md); }
.fixture-versus { color: var(--muted); font-size: var(--t-sm); margin: 0 var(--s1); }
.fixture-foot {
  display: flex; justify-content: space-between; align-items: baseline;
  gap: var(--s2); margin-top: var(--s1);
}
.score { font-family: var(--mono); font-weight: 700; font-size: var(--t-md); white-space: nowrap; }
.fixture-status { font-size: var(--t-sm); color: var(--muted); }

.filter { margin-bottom: var(--s2); }
.filter label { display: block; font-size: var(--t-sm); font-weight: 600; margin-bottom: var(--s1); }
.filter select {
  width: 100%; min-height: 48px; font-size: var(--t-md); font-family: var(--sans);
  color: var(--ink); background: var(--bg); padding: var(--s1);
  border: 1px solid var(--muted); border-radius: var(--radius);
}

/* ---------- Sections and empty states ---------- */

section { margin-top: var(--s4); }
section > h2 {
  font-size: var(--t-lg); margin: 0 0 var(--s2);
  padding-bottom: var(--s1); border-bottom: 1px solid var(--line);
}
.card { border: 1px solid var(--line); border-radius: var(--radius); padding: var(--s2); }
.empty { color: var(--muted); font-size: var(--t-md); padding: var(--s3) 0; text-align: center; }
.legend { font-size: var(--t-sm); color: var(--muted); margin: var(--s2) 0; }

@media (min-width: 560px) {
  .standings th:nth-child(3) { width: 56px; }
  .standings th:nth-child(4) { width: 64px; }
}

/* ---------- Result entry ----------
   Designed for a phone, one-handed, straight after a match. Every target is
   at least 56px so it can be hit with a thumb without looking carefully. */

.cta { margin: var(--s3) 0 0; }
.btn {
  font-family: var(--sans); font-size: var(--t-md); font-weight: 600;
  min-height: 56px; padding: var(--s2); width: 100%;
  border-radius: var(--radius); border: 2px solid transparent; cursor: pointer;
  background: var(--bg); color: var(--ink); border-color: var(--ink);
}
/* White on #FF0000 is 4.0:1, so the label is 20px bold, which counts as large
   text and clears the 3:1 threshold. */
.btn-primary {
  background: var(--red); border-color: var(--red); color: #fff;
  font-size: var(--t-lg); font-weight: 700;
}
.btn-primary:hover:not(:disabled) { background: var(--red-dark); border-color: var(--red-dark); }
.btn-quiet { border-color: var(--line); color: var(--muted); min-height: 48px; font-size: var(--t-sm); }
.btn-danger { border-color: var(--red-text); color: var(--red-text); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn + .btn { margin-top: var(--s1); }

.step { margin-bottom: var(--s3); }
.step-head { display: flex; align-items: baseline; gap: var(--s1); margin-bottom: var(--s2); }
.step-head h2 { font-size: var(--t-lg); margin: 0; border: 0; padding: 0; }
.step-count { font-size: var(--t-sm); color: var(--muted); font-variant-numeric: tabular-nums; }

/* Choosing a pair or an opponent: a stack of big tappable rows. */
.choice {
  display: block; width: 100%; text-align: left;
  min-height: 64px; padding: var(--s2);
  background: var(--bg); border: 1px solid var(--line); border-radius: var(--radius);
  font-family: var(--sans); font-size: var(--t-md); color: var(--ink); cursor: pointer;
}
.choice + .choice { margin-top: var(--s1); }
.choice:hover { border-color: var(--ink); background: var(--surface); }
.choice strong { display: block; font-size: var(--t-md); }
.choice .sub { display: block; font-size: var(--t-sm); color: var(--muted); margin-top: 0; }
.choice-group { font-size: var(--t-sm); font-weight: 700; color: var(--muted);
  text-transform: uppercase; letter-spacing: 0.06em; margin: var(--s3) 0 var(--s1); }

/* PIN entry */
.pin-input {
  width: 100%; min-height: 64px; text-align: center;
  font-family: var(--mono); font-size: var(--t-2xl); font-weight: 700;
  letter-spacing: 0.3em; text-indent: 0.3em; padding: var(--s1);
  border: 2px solid var(--muted); border-radius: var(--radius);
  color: var(--ink); background: var(--bg);
}
.pin-input:focus { border-color: var(--red); }

/* Score entry: your games on the left, theirs on the right. */
.set-row { display: grid; grid-template-columns: 1fr 56px 1fr; gap: var(--s1);
  align-items: center; margin-bottom: var(--s2); }
.set-label { grid-column: 1 / -1; font-size: var(--t-sm); font-weight: 700; color: var(--muted);
  text-transform: uppercase; letter-spacing: 0.06em; margin-bottom: var(--s1); }
.set-dash { text-align: center; color: var(--muted); font-size: var(--t-lg); }
.games {
  width: 100%; min-height: 64px; text-align: center;
  font-family: var(--mono); font-size: var(--t-xl); font-weight: 700;
  padding: var(--s1); border: 2px solid var(--muted); border-radius: var(--radius);
  color: var(--ink); background: var(--bg);
}
.games:focus { border-color: var(--red); }
.score-heads { display: grid; grid-template-columns: 1fr 56px 1fr; gap: var(--s1); margin-bottom: var(--s1); }
.score-heads span { font-size: var(--t-sm); font-weight: 700; text-align: center; }

.outcome {
  padding: var(--s2); border-radius: var(--radius); background: var(--surface);
  border-left: 4px solid var(--ink); margin-bottom: var(--s2); font-size: var(--t-md);
}
.outcome strong { display: block; font-size: var(--t-lg); }

.pending-card { border: 2px solid var(--red-text); border-radius: var(--radius);
  padding: var(--s2); margin-bottom: var(--s2); }
.pending-card .score { font-size: var(--t-xl); display: block; margin: var(--s1) 0; }

/* Paragraph margins default to 1em, which lands off the grid at 14px text. */
p { margin: 0 0 var(--s2); }
