/* ==========================================================================
   Rundown — Coaches Corner shared surface
   Source of truth for colour and type: docs/21-brand-guidelines.md v1.0.
   Values mirror app/tokens.css. Declared locally as well so this stylesheet
   renders correctly if tokens.css has not loaded yet (the coach pages are
   the first paint after a magic-link redirect and must not flash unstyled).

   PHONE FIRST. Built at 390x844 and verified at 390x844, 430x932, 360x740.
   Every interactive target is >= 44px. No text below 11px. Safe-area insets
   on all four edges because viewport-fit=cover is set on every coach page.
   ========================================================================== */

:root {
  --rd-forest:     #0B4D3C;
  --rd-forest-2:   #0E5C48;
  --rd-forest-3:   #083A2D;
  --rd-gold:       #F4C430;
  --rd-cream:      #F5F1E8;
  --rd-cream-2:    #EDE7D6;
  --rd-ink:        #0F1311;
  --rd-muted:      #6B7571;
  --rd-good:       #1F7A4D;
  --rd-bad:        #B0432A;
  --rd-line:       #C8C3B5;

  --rd-display: 'Bebas Neue', 'Oswald', Impact, 'Arial Narrow', sans-serif;
  --rd-body:    'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  --rd-mono:    'JetBrains Mono', 'SF Mono', Menlo, Consolas, 'Courier New', monospace;

  --rd-tap: 44px;

  --rd-pad-l: calc(16px + env(safe-area-inset-left, 0px));
  --rd-pad-r: calc(16px + env(safe-area-inset-right, 0px));
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }

body {
  font-family: var(--rd-body);
  background: var(--rd-cream);
  color: var(--rd-ink);
  font-size: 16px;
  line-height: 1.55;
  min-height: 100vh;
  -webkit-text-size-adjust: 100%;
  overflow-x: hidden;
}

/* --------------------------------------------------------------------------
   Top chrome
   The sign-out control was 31px tall before this file (padding 6px on a 14px
   line). It is a control a coach reaches for on a phone, so it is now a full
   44px target. flex-wrap stays: at 390px the row measured 426px wide and
   pushed Sign out off the right edge.
   -------------------------------------------------------------------------- */
.rd-chrome {
  background: var(--rd-cream);
  border-bottom: 1px solid var(--rd-cream-2);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 16px;
  padding: calc(10px + env(safe-area-inset-top, 0px)) var(--rd-pad-r) 10px var(--rd-pad-l);
  position: sticky;
  top: 0;
  z-index: 20;
}
.rd-brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--rd-forest);
  text-decoration: none;
  min-height: var(--rd-tap);
}
.rd-brand img { display: block; }
.rd-brand-name {
  font-family: var(--rd-display);
  letter-spacing: 0.04em;
  font-size: 24px;
  line-height: 1;
}
.rd-brand-name em { font-style: italic; }

/* The email shrinks and ellipsizes rather than forcing the row to wrap. At
   390px a fixed max-width pushed Sign out onto a second line and left a hole
   beside the wordmark. flex-wrap stays as the last resort for a very long
   address on a 320px screen. */
.rd-chrome-user {
  margin-left: auto;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  flex: 1 1 auto;
  min-width: 0;
}
.rd-chrome-email {
  font-family: var(--rd-mono);
  font-size: 12px;
  color: var(--rd-muted);
  flex: 0 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* --------------------------------------------------------------------------
   Page
   -------------------------------------------------------------------------- */
.rd-main {
  max-width: 720px;
  margin: 0 auto;
  padding: 20px var(--rd-pad-r) calc(48px + env(safe-area-inset-bottom, 0px)) var(--rd-pad-l);
}

.rd-eyebrow {
  font-family: var(--rd-body);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--rd-muted);
  margin: 0 0 6px;
}

.rd-main h1 {
  font-family: var(--rd-display);
  font-weight: 400;
  font-size: 40px;
  line-height: 1.02;
  letter-spacing: 0.02em;
  color: var(--rd-forest);
  margin: 0 0 8px;
  overflow-wrap: anywhere;
}
.rd-lede {
  font-size: 17px;
  font-weight: 500;
  margin: 0 0 22px;
  max-width: 46ch;
}
.rd-muted { color: var(--rd-muted); }

/* --------------------------------------------------------------------------
   Cards
   -------------------------------------------------------------------------- */
.rd-card {
  background: #fff;
  border: 1.5px solid var(--rd-forest);
  border-radius: 12px;
  padding: 22px 18px 18px;
  box-shadow: 0 2px 0 var(--rd-cream-2);
  margin-bottom: 16px;
}
.rd-card-top {
  background: var(--rd-forest);
  color: var(--rd-cream);
  font-family: var(--rd-mono);
  font-size: 11px;
  letter-spacing: 0.06em;
  padding: 8px 14px;
  border-radius: 8px 8px 0 0;
  margin: -22px -18px 18px;
  display: flex;
  gap: 10px;
  align-items: baseline;
  flex-wrap: wrap;
}
.rd-card-top .rd-card-top-r { margin-left: auto; opacity: 0.85; }

.rd-card h2 {
  font-family: var(--rd-display);
  font-weight: 400;
  font-size: 28px;
  line-height: 1.05;
  letter-spacing: 0.02em;
  color: var(--rd-forest);
  margin: 0 0 6px;
  overflow-wrap: anywhere;
}
.rd-card h3 {
  font-family: var(--rd-body);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.10em;
  text-transform: uppercase;
  color: var(--rd-muted);
  margin: 0 0 10px;
}
.rd-card p { margin: 0 0 10px; }
.rd-card p:last-child { margin-bottom: 0; }

/* --------------------------------------------------------------------------
   Buttons. 48px on phone, never below 44.
   -------------------------------------------------------------------------- */
.rd-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-family: var(--rd-display);
  font-size: 20px;
  letter-spacing: 0.04em;
  line-height: 1;
  min-height: 48px;
  padding: 12px 20px;
  background: var(--rd-forest);
  color: var(--rd-cream);
  border: 1.5px solid var(--rd-forest);
  border-bottom: 3px solid var(--rd-gold);
  border-radius: 8px;
  cursor: pointer;
  text-decoration: none;
  -webkit-appearance: none;
  appearance: none;
}
.rd-btn:hover { background: var(--rd-forest-2); }
.rd-btn:active { transform: translateY(1px); }
.rd-btn:focus-visible { outline: 3px solid var(--rd-gold); outline-offset: 2px; }
.rd-btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }

.rd-btn-block { display: flex; width: 100%; }

.rd-btn-ghost {
  background: var(--rd-cream);
  color: var(--rd-forest);
  border: 1.5px solid var(--rd-forest);
  border-bottom-width: 1.5px;
}
.rd-btn-ghost:hover { background: var(--rd-cream-2); }

.rd-btn-danger {
  background: #fff;
  color: var(--rd-bad);
  border: 1.5px solid var(--rd-bad);
  border-bottom-width: 1.5px;
}
.rd-btn-danger:hover { background: #FBF0ED; }

.rd-btn-sm {
  font-family: var(--rd-body);
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0;
  min-height: var(--rd-tap);
  padding: 10px 14px;
  border-bottom-width: 1.5px;
}

.rd-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 16px;
}
@media (min-width: 520px) {
  .rd-actions { flex-direction: row; flex-wrap: wrap; }
  .rd-actions .rd-btn-block { width: auto; display: inline-flex; }
}

/* --------------------------------------------------------------------------
   Forms
   16px on inputs is not a style choice: below 16px iOS Safari zooms the page
   on focus and the coach loses the layout.
   -------------------------------------------------------------------------- */
.rd-field { margin-bottom: 16px; }
.rd-field label,
.rd-legend {
  display: block;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--rd-forest);
  margin-bottom: 6px;
}
.rd-input, .rd-select {
  width: 100%;
  font: inherit;
  font-size: 16px;
  min-height: 48px;
  padding: 12px 14px;
  border: 1.5px solid var(--rd-line);
  border-radius: 8px;
  background: #fff;
  color: var(--rd-ink);
}
.rd-input:focus, .rd-select:focus {
  outline: none;
  border-color: var(--rd-forest);
  box-shadow: 0 0 0 3px rgba(11, 77, 60, 0.14);
}
.rd-help { font-size: 13px; color: var(--rd-muted); margin: 6px 0 0; }
.rd-error {
  font-size: 14px;
  color: var(--rd-bad);
  margin: 8px 0 0;
  font-weight: 600;
}

/* Segmented control, used for sport. Two big targets beat a select on a phone. */
.rd-seg {
  display: flex;
  gap: 8px;
  border: 0;
  padding: 0;
  margin: 0 0 16px;
}
.rd-seg-opt {
  flex: 1 1 0;
  position: relative;
  min-width: 0;
}
.rd-seg-opt input {
  position: absolute;
  opacity: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  cursor: pointer;
}
.rd-seg-opt span {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  padding: 10px 8px;
  border: 1.5px solid var(--rd-line);
  border-radius: 8px;
  background: #fff;
  font-size: 15px;
  font-weight: 600;
  text-align: center;
}
.rd-seg-opt input:checked + span {
  border-color: var(--rd-forest);
  background: var(--rd-forest);
  color: var(--rd-cream);
}
.rd-seg-opt input:focus-visible + span { outline: 3px solid var(--rd-gold); outline-offset: 2px; }

/* --------------------------------------------------------------------------
   The join code.
   Read off a phone held up in a dugout, so it is the largest thing on the
   screen. JetBrains Mono because a code is data (docs/21 s4). Sized in vw and
   clamped: 8 Crockford characters plus a hyphen must never wrap or overflow
   at 360px.
   -------------------------------------------------------------------------- */
.rd-code-panel {
  background: var(--rd-forest);
  color: var(--rd-cream);
  border-radius: 10px;
  padding: 16px 14px 14px;
  margin: 0 0 14px;
  text-align: center;
}
.rd-code-panel.is-dim { background: var(--rd-cream-2); color: var(--rd-ink); }
.rd-code-label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  opacity: 0.85;
  margin: 0 0 6px;
}
.rd-code {
  font-family: var(--rd-mono);
  font-weight: 700;
  font-size: clamp(30px, 12.5vw, 54px);
  line-height: 1.05;
  letter-spacing: 0.01em;
  margin: 0;
  white-space: nowrap;
  overflow-wrap: normal;
}
.rd-code-panel.is-dim .rd-code { color: var(--rd-muted); }
.rd-code-sub { font-size: 13px; margin: 8px 0 0; opacity: 0.9; }
.rd-code-actions { display: flex; gap: 8px; margin-top: 12px; }
.rd-code-actions .rd-btn { flex: 1 1 0; min-width: 0; }
.rd-code-panel .rd-btn-ghost {
  background: transparent;
  color: var(--rd-cream);
  border-color: rgba(245, 241, 232, 0.55);
}
.rd-code-panel .rd-btn-ghost:hover { background: rgba(245, 241, 232, 0.12); }
.rd-code-panel.is-dim .rd-btn-ghost {
  background: #fff;
  color: var(--rd-forest);
  border-color: var(--rd-forest);
}

/* --------------------------------------------------------------------------
   Seat meter
   -------------------------------------------------------------------------- */
.rd-seats { margin: 4px 0 14px; }
.rd-seats-line {
  display: flex;
  align-items: baseline;
  gap: 8px;
  font-size: 14px;
  flex-wrap: wrap;
}
.rd-seats-n {
  font-family: var(--rd-mono);
  font-weight: 700;
  font-size: 18px;
  color: var(--rd-forest);
}
.rd-seats-bar {
  margin-top: 6px;
  height: 8px;
  border-radius: 4px;
  background: var(--rd-cream-2);
  overflow: hidden;
}
.rd-seats-fill { height: 100%; background: var(--rd-forest); border-radius: 4px; }
.rd-seats-sub { margin: 6px 0 0; font-size: 13px; color: var(--rd-muted); }
.rd-seats.is-full .rd-seats-fill { background: var(--rd-gold); }
.rd-seats.is-over .rd-seats-fill { background: var(--rd-bad); }
.rd-seats.is-over .rd-seats-n { color: var(--rd-bad); }

/* --------------------------------------------------------------------------
   Roster
   Each row is one 56px target that opens the actions sheet. Two 24px icon
   buttons per row would fail the 44px rule and sit 8px apart on a phone.
   -------------------------------------------------------------------------- */
.rd-roster { list-style: none; margin: 0; padding: 0; }
.rd-roster li { border-top: 1px solid var(--rd-cream-2); }
.rd-roster li:first-child { border-top: 0; }

.rd-player {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  min-height: 56px;
  padding: 10px 4px;
  background: none;
  border: 0;
  font: inherit;
  text-align: left;
  cursor: pointer;
  color: inherit;
}
.rd-player:hover { background: var(--rd-cream); }
.rd-player:focus-visible { outline: 3px solid var(--rd-gold); outline-offset: -3px; }
.rd-jersey {
  flex: 0 0 auto;
  width: 36px;
  height: 36px;
  border-radius: 18px;
  background: var(--rd-cream-2);
  color: var(--rd-forest);
  font-family: var(--rd-mono);
  font-weight: 700;
  font-size: 13px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.rd-player-main { min-width: 0; flex: 1 1 auto; }
.rd-player-name {
  display: block;
  font-weight: 600;
  font-size: 16px;
  line-height: 1.25;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.rd-player-sub {
  display: block;
  font-size: 13px;
  line-height: 1.5;
  color: var(--rd-muted);
}
.rd-chev { flex: 0 0 auto; color: var(--rd-muted); }

.rd-tag {
  display: inline-block;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 2px 7px;
  border-radius: 4px;
  background: var(--rd-cream-2);
  color: var(--rd-muted);
  vertical-align: 1px;
}
.rd-tag-live   { background: #E4F0EA; color: var(--rd-good); }
.rd-tag-wait   { background: #FBF3DA; color: #8A6D0B; }
.rd-tag-hold   { background: #F7E7E2; color: var(--rd-bad); }
.rd-tag-over   { background: var(--rd-bad); color: #fff; }

/* --------------------------------------------------------------------------
   Status banner. Carries the entitlement truth: unpaid, expired, payment
   failed, backend not ready.
   -------------------------------------------------------------------------- */
.rd-banner {
  border-left: 4px solid var(--rd-gold);
  background: var(--rd-cream-2);
  border-radius: 4px;
  padding: 12px 14px;
  margin: 0 0 16px;
  font-size: 14px;
}
.rd-banner strong { display: block; color: var(--rd-forest); font-size: 15px; margin-bottom: 2px; }
.rd-banner.is-bad { border-left-color: var(--rd-bad); background: #F9EFEC; }
.rd-banner.is-bad strong { color: var(--rd-bad); }
.rd-banner p { margin: 0; }
.rd-banner .rd-btn { margin-top: 10px; }

/* --------------------------------------------------------------------------
   Empty state. Day one. The only screen every coach is guaranteed to see.
   -------------------------------------------------------------------------- */
.rd-empty { text-align: left; }
.rd-empty .rd-empty-art {
  display: block;
  margin: 0 0 14px;
  color: var(--rd-forest);
  opacity: 0.9;
}
.rd-empty h2 { margin-bottom: 8px; }
.rd-steps { list-style: none; margin: 14px 0 0; padding: 0; }
.rd-steps li {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  padding: 8px 0;
  font-size: 15px;
}
.rd-steps .rd-step-n {
  flex: 0 0 auto;
  width: 24px;
  height: 24px;
  border-radius: 12px;
  background: var(--rd-forest);
  color: var(--rd-cream);
  font-family: var(--rd-mono);
  font-size: 12px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-top: 2px;
}

/* --------------------------------------------------------------------------
   Team switcher
   -------------------------------------------------------------------------- */
.rd-teamnav {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 0 0 10px;
  margin: 0 0 4px;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.rd-teamnav::-webkit-scrollbar { display: none; }
.rd-teamnav button {
  flex: 0 0 auto;
  min-height: var(--rd-tap);
  padding: 8px 14px;
  border-radius: 8px;
  border: 1.5px solid var(--rd-line);
  background: #fff;
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  color: var(--rd-ink);
  cursor: pointer;
  white-space: nowrap;
}
.rd-teamnav button[aria-current="true"] {
  border-color: var(--rd-forest);
  background: var(--rd-forest);
  color: var(--rd-cream);
}

/* --------------------------------------------------------------------------
   Bottom sheet
   -------------------------------------------------------------------------- */
.rd-sheet-back {
  position: fixed;
  inset: 0;
  background: rgba(15, 19, 17, 0.45);
  z-index: 40;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}
.rd-sheet {
  width: 100%;
  max-width: 520px;
  background: var(--rd-cream);
  border-radius: 14px 14px 0 0;
  padding: 18px var(--rd-pad-r) calc(18px + env(safe-area-inset-bottom, 0px)) var(--rd-pad-l);
  max-height: 88vh;
  overflow-y: auto;
}
.rd-sheet h2 {
  font-family: var(--rd-display);
  font-weight: 400;
  font-size: 26px;
  color: var(--rd-forest);
  margin: 0 0 4px;
  letter-spacing: 0.02em;
}
.rd-sheet p { margin: 0 0 12px; font-size: 15px; }
.rd-sheet .rd-actions { margin-top: 14px; }
.rd-sheet-grip {
  width: 40px;
  height: 4px;
  border-radius: 2px;
  background: var(--rd-line);
  margin: 0 auto 14px;
}

/* --------------------------------------------------------------------------
   Toast
   -------------------------------------------------------------------------- */
.rd-toast {
  position: fixed;
  left: 50%;
  transform: translateX(-50%);
  bottom: calc(20px + env(safe-area-inset-bottom, 0px));
  background: var(--rd-forest);
  color: var(--rd-cream);
  padding: 12px 18px;
  border-radius: 8px;
  font-size: 15px;
  font-weight: 600;
  z-index: 60;
  max-width: calc(100vw - 32px);
  text-align: center;
  box-shadow: 0 6px 20px rgba(11, 77, 60, 0.28);
}

/* --------------------------------------------------------------------------
   Fixture banner. Present only when the page is driven from a fixture, so a
   screenshot of made-up data can never be mistaken for a coach's real roster.
   -------------------------------------------------------------------------- */
.rd-fixture-bar {
  background: var(--rd-gold);
  color: var(--rd-forest-3);
  font-family: var(--rd-mono);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-align: center;
  padding: calc(6px + env(safe-area-inset-top, 0px)) 12px 6px;
  position: sticky;
  top: 0;
  z-index: 30;
}
.rd-fixture-bar + .rd-chrome { padding-top: 10px; }

.rd-loading { padding: 40px 0; text-align: center; color: var(--rd-muted); }

.rd-foot {
  margin-top: 22px;
  font-size: 13px;
  color: var(--rd-muted);
  text-align: center;
}
.rd-footlinks {
  display: flex;
  gap: 10px;
  justify-content: center;
  flex-wrap: wrap;
  margin-top: 10px;
}

/* Checkbox rows. The box itself is 24px because a 44px checkbox looks like a
   mistake; the LABEL carries the 44px target, which is how a checkbox is
   supposed to be hit. The layout gate credits a label only when the label's
   own box measures 44x44, so this cannot be used to hide a small target. */
.rd-check {
  display: flex;
  gap: 12px;
  align-items: center;
  min-height: 48px;
  padding: 6px 0;
  font-size: 15px;
  font-weight: 500;
  color: var(--rd-ink);
  text-transform: none;
  letter-spacing: 0;
  cursor: pointer;
}
.rd-check input {
  width: 24px;
  height: 24px;
  flex: 0 0 auto;
  accent-color: var(--rd-forest);
  margin: 0;
}

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

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: 0.001ms !important; transition-duration: 0.001ms !important; }
  .rd-btn:active { transform: none; }
}

/* Wider phones and up */
@media (min-width: 430px) {
  .rd-main h1 { font-size: 44px; }
  .rd-card { padding: 24px 22px 20px; }
  .rd-card-top { margin: -24px -22px 18px; }
}
@media (min-width: 720px) {
  .rd-main { padding-top: 32px; }
  .rd-main h1 { font-size: 52px; }
  .rd-lede { font-size: 19px; }
}
