/* Brainzie Poolside — coach-facing stopwatch. Brand palette mirrors the Brainzie site
   (brainzie.co.uk assets/brainzie.css). Built for one-handed use with wet thumbs in
   bright light: big tap targets, high contrast, tabular numerals. */

:root {
  --brand:        #D81B72;
  --brand-deep:   #A8155A;
  --brand-tint:   #FCE4F0;
  --secondary:    #6D28D9;
  --accent-coral: #FF4D6D;
  --ink:      #18122B;
  --ink-soft: #4A4361;
  --muted:    #847B9C;
  --line:     #ECE7F2;
  --paper:    #FDFBFE;
  --paper-2:  #F6F1FB;
  --white:    #FFFFFF;
  --ok:       #15803D;
  --ok-tint:  #DCFCE7;
  --font-display: "Space Grotesk", "Segoe UI", system-ui, sans-serif;
  --font-body:    "Inter", "Segoe UI", system-ui, -apple-system, sans-serif;
  --radius-s: 11px;
}

* { box-sizing: border-box; }

/* .btn-stop and .result set display:flex, which would defeat the hidden attribute. */
[hidden] { display: none !important; }

html, body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-body);
  -webkit-tap-highlight-color: transparent;
}

.topbar {
  display: flex;
  justify-content: center;
  padding: 12px 16px 0;
}

.brand { display: flex; align-items: center; gap: 9px; }
.brand .mark { width: 26px; height: 26px; }
.brand .name { font-family: var(--font-display); font-size: 1.1rem; color: var(--ink-soft); }
.brand .name strong { color: var(--brand); }

.wrap {
  max-width: 560px;
  margin: 0 auto;
  padding: 10px 14px 40px;
}

/* --- Main clock ----------------------------------------------------------- */

.clock-panel {
  position: sticky;
  top: 0;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 10px 4px;
  background: var(--paper);
  border-bottom: 1px solid var(--line);
}

.clock {
  font-family: var(--font-display);
  font-variant-numeric: tabular-nums;
  font-size: clamp(2.6rem, 13vw, 3.8rem);
  font-weight: 700;
  letter-spacing: .01em;
  color: var(--ink);
}

.clock.running { color: var(--brand); }

/* --- Buttons --------------------------------------------------------------- */

.btn {
  font-family: var(--font-body);
  font-weight: 700;
  font-size: 1.05rem;
  border: 0;
  border-radius: var(--radius-s);
  min-height: 56px;
  padding: 0 22px;
  cursor: pointer;
  touch-action: manipulation;
  user-select: none;
  -webkit-user-select: none;
}

.btn:disabled { cursor: default; }

.btn-clear {
  background: var(--paper-2);
  color: var(--ink-soft);
  border: 1px solid var(--line);
  min-height: 48px;
  font-size: .95rem;
}

.btn-clear:active { background: var(--line); }

.btn-start {
  width: 100%;
  background: var(--brand);
  color: var(--white);
}

.btn-start:active { background: var(--brand-deep); }

.btn-start:disabled {
  background: var(--paper-2);
  color: var(--muted);
  border: 1px dashed var(--line);
}

/* One slot per lane: a Stop button that freezes into that swimmer's time. */
.stops {
  display: flex;
  gap: 6px;
}

.slot { flex: 1; min-width: 0; }

.btn-stop {
  width: 100%;
  padding: 0;
  background: var(--secondary);
  color: var(--white);
}

.btn-stop:active { background: #5B21B6; }

/* --- Swimmer table ---------------------------------------------------------- */

.swimmers {
  width: 100%;
  margin-top: 14px;
  border-collapse: collapse;
}

.swimmers td, .swimmers th { padding: 5px 0; }

.swimmers .num {
  width: 58px;
  font-family: var(--font-display);
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--muted);
  text-align: center;
}

.swimmers .num .live {
  display: block;
  font-family: var(--font-display);
  font-variant-numeric: tabular-nums;
  font-size: .72rem;
  font-weight: 600;
  color: var(--brand);
}

/* Column headers: Lane 1–4. The .stops wrapper keeps them aligned with the
   stop/result columns in the rows below. */
.swimmers thead th { font-weight: 600; vertical-align: bottom; }

.col-heads span {
  flex: 1;
  min-width: 0;
  text-align: center;
  font-family: var(--font-display);
  font-size: .9rem;
  color: var(--ink-soft);
}

/* "Swimmer" label over the 1st–9th ordinals in the first column. */
.row-caption {
  font-size: .68rem;
  font-weight: 500;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--muted);
}

tr.done .num { color: var(--ink); }

.result {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 56px;
  border-radius: var(--radius-s);
  background: var(--ok-tint);
  color: var(--ok);
  font-family: var(--font-display);
  font-variant-numeric: tabular-nums;
  font-size: clamp(.92rem, 4.1vw, 1.15rem);
  font-weight: 700;
}

.hint {
  margin-top: 26px;
  color: var(--muted);
  font-size: .9rem;
  text-align: center;
  line-height: 1.5;
}

.brainzie-link {
  margin-top: 18px;
  text-align: center;
  font-size: .92rem;
  color: var(--ink-soft);
}

.brainzie-link a {
  color: var(--brand);
  font-weight: 600;
  text-decoration: none;
}

.brainzie-link a:hover { color: var(--brand-deep); text-decoration: underline; }
