/* ============================================================
   SmashDay — UX redesign prototype
   Identity: "Clubhouse & Floodlight"
   - Daylight paper ground for running the tournament
   - Dark "floodlit" surfaces ONLY where something is live
     (courtside scoring, public live scoreboard)
   - Royal blue = action. Red = LIVE, and only LIVE-with-a-word.
   - Volt green figures exist only on floodlit surfaces.
   ============================================================ */

/* ---------- tokens ---------- */
:root {
  /* ground */
  --paper: #f4f1e9;
  --paper-deep: #ece8dc;
  --card: #fffdf7;
  --line: #e2ddcd;
  --line-strong: #c7c1ab;

  /* ink */
  --ink: #1b1e18;
  --ink-soft: #575c50;
  --ink-faint: #8d917f;

  /* action */
  --act: #2145d6;
  --act-deep: #16309b;
  --act-wash: #e8ecfb;

  /* status — every status colour is a rail or chip WITH A WORD, never a fill */
  --ok: #1b7a44;
  --ok-wash: #e3f1e7;
  --warn: #a06a0a;
  --warn-wash: #f7ecd4;
  --bad: #c23434;
  --bad-wash: #f9e4e2;
  --live: #d92d2d;

  /* floodlit (dark live surfaces only) */
  --night: #10150f;
  --night-card: #1a2118;
  --night-line: #2c352a;
  --night-ink: #f1f4ea;
  --night-soft: #9aa48f;
  --volt: #c9f24e;

  /* team colours — categorical pastels, dark ink on all */
  --team-1: #f1c2cb;
  --team-2: #f5cfa8;
  --team-3: #efe29c;
  --team-4: #bfe5c0;
  --team-5: #b6dbf2;
  --team-6: #d4c5ee;
  --team-7: #f2b8a2;
  --team-8: #ddd2b4;

  /* grade colours — ordinal, saturated mid-dark, white ink, positional */
  --grade-1: #14357f;
  --grade-2: #1d4ed8;
  --grade-3: #0e7490;
  --grade-4: #0f766e;
  --grade-5: #4d7c0f;
  --grade-6: #a16207;
  --grade-7: #c2410c;
  --grade-8: #9f1239;
  --grade-mixed: #6d28d9;
  --grade-none: #8d917f;

  /* role colours — line-work only, never fills */
  --role-organizer: #a06a0a;
  --role-admin: #7c3aed;
  --role-treasurer: #1b7a44;
  --role-referee: #2145d6;
  --role-captain: #be3a66;
  --role-player: #0e7490;
  --role-spectator: #64748b;

  --radius: 10px;
  --radius-sm: 7px;
  --shadow: 0 1px 2px rgba(27, 30, 24, 0.06), 0 4px 16px rgba(27, 30, 24, 0.05);

  --font-display: "Archivo", "Arial Narrow", sans-serif;
  --font-body: "Inter", system-ui, sans-serif;
  --font-mono: "Spline Sans Mono", ui-monospace, monospace;
}

/* ---------- reset & ground ---------- */
* { box-sizing: border-box; margin: 0; }
html { -webkit-text-size-adjust: 100%; }
body {
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.5;
  min-height: 100vh;
}
img, svg { max-width: 100%; display: block; }
a { color: var(--act); text-decoration: none; }
a:hover { text-decoration: underline; }
button { font: inherit; cursor: pointer; }
input, select, textarea { font: inherit; }
:focus-visible { outline: 2px solid var(--act); outline-offset: 2px; }

/* ---------- type ---------- */
.display, h1, h2, h3 { font-family: var(--font-display); font-stretch: 112%; letter-spacing: -0.01em; }
h1 { font-size: 28px; font-weight: 800; line-height: 1.15; }
h2 { font-size: 20px; font-weight: 700; line-height: 1.2; }
h3 { font-size: 16px; font-weight: 700; }
.eyebrow {
  font-family: var(--font-display); font-stretch: 120%;
  font-size: 11px; font-weight: 700; letter-spacing: 0.14em;
  text-transform: uppercase; color: var(--ink-faint);
}
.sub { color: var(--ink-soft); font-size: 14px; }
.fine { color: var(--ink-faint); font-size: 12.5px; }
.figure { font-variant-numeric: tabular-nums; font-weight: 600; }
.figure-xl {
  font-family: var(--font-display); font-stretch: 105%;
  font-weight: 900; font-size: 44px; line-height: 1;
  font-variant-numeric: tabular-nums;
}
.mono { font-family: var(--font-mono); }

/* ---------- layout ---------- */
.wrap { max-width: 1120px; margin: 0 auto; padding: 0 16px; }
.page { padding-top: 20px; padding-bottom: 96px; display: grid; gap: 18px; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.grid-2 { display: grid; gap: 16px; }
@media (min-width: 760px) { .grid-2 { grid-template-columns: 1fr 1fr; } }
.grid-3 { display: grid; gap: 12px; grid-template-columns: repeat(3, 1fr); }
.stack { display: grid; gap: 10px; }
.row { display: flex; align-items: center; gap: 10px; }
.row-between { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.spread { flex: 1; }

/* ---------- app shell ---------- */
.shell { display: grid; min-height: 100vh; grid-template-rows: auto 1fr; }
@media (min-width: 900px) {
  .shell { grid-template-columns: 248px 1fr; grid-template-rows: 1fr; }
}
.topbar {
  position: sticky; top: 0; z-index: 40;
  background: var(--card); border-bottom: 1px solid var(--line);
  display: flex; align-items: center; gap: 10px; padding: 10px 14px;
}
@media (min-width: 900px) { .topbar { display: none; } }
.burger { background: none; border: 1px solid var(--line-strong); border-radius: var(--radius-sm); padding: 7px 10px; }

.sidebar {
  background: var(--card); border-right: 1px solid var(--line);
  padding: 14px; display: flex; flex-direction: column; gap: 4px;
  position: fixed; inset: 0 auto 0 0; width: 272px; z-index: 60;
  transform: translateX(-100%); transition: transform 0.18s ease;
  overflow-y: auto;
}
.sidebar.open { transform: none; box-shadow: 0 0 0 100vmax rgba(27,30,24,0.35); }
@media (min-width: 900px) {
  .sidebar { position: sticky; top: 0; height: 100vh; transform: none; width: auto; }
  .sidebar.open { box-shadow: none; }
}
.brand { display: flex; align-items: baseline; gap: 6px; padding: 6px 8px 14px; }
.brand b { font-family: var(--font-display); font-stretch: 118%; font-weight: 900; font-size: 20px; letter-spacing: -0.02em; }
.brand span { color: var(--act); font-size: 20px; line-height: 0; }

.nav-group { padding: 12px 8px 4px; }
.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px; border-radius: var(--radius-sm);
  color: var(--ink); font-size: 14.5px; font-weight: 500;
}
.nav-item:hover { background: var(--paper-deep); text-decoration: none; }
.nav-item.active { background: var(--act-wash); color: var(--act-deep); font-weight: 600; }
.nav-item .soon {
  margin-left: auto; font-size: 10px; font-weight: 700; letter-spacing: 0.08em;
  color: var(--ink-faint); border: 1px solid var(--line-strong);
  border-radius: 99px; padding: 1px 7px;
}
.nav-item .count {
  margin-left: auto; min-width: 20px; text-align: center;
  background: var(--act); color: #fff; border-radius: 99px;
  font-size: 11.5px; font-weight: 700; padding: 1px 6px;
}

.shell-foot { margin-top: auto; display: grid; gap: 8px; padding-top: 14px; border-top: 1px solid var(--line); }
.tourn-tile {
  display: flex; align-items: center; gap: 10px; padding: 8px 10px;
  border: 1px solid var(--line-strong); border-radius: var(--radius);
  background: var(--paper); color: inherit;
}
.tourn-tile:hover { text-decoration: none; border-color: var(--act); }
.tourn-tile .mono-sq {
  width: 34px; height: 34px; border-radius: 8px; background: var(--ink); color: var(--paper);
  display: grid; place-items: center; font-family: var(--font-display); font-weight: 800;
}
.person-row { display: flex; align-items: center; gap: 10px; padding: 6px 10px; color: inherit; }
.person-row:hover { text-decoration: none; background: var(--paper-deep); border-radius: var(--radius-sm); }
.face {
  width: 30px; height: 30px; border-radius: 50%;
  display: grid; place-items: center;
  background: var(--paper-deep); border: 1.5px solid var(--role, var(--ink-faint));
  color: var(--role, var(--ink-soft)); font-size: 12px; font-weight: 700;
}
.role-label { font-size: 12px; font-weight: 600; color: var(--role, var(--ink-soft)); }

/* sync strip — the offline-first cue, on every screen */
.sync-strip {
  display: flex; align-items: center; gap: 8px;
  font-size: 12.5px; padding: 7px 10px; border-radius: var(--radius-sm);
}
.sync-strip .dot { width: 8px; height: 8px; border-radius: 50%; flex: none; }
.sync-strip[data-sync="saved"] { color: var(--ink-faint); }
.sync-strip[data-sync="saved"] .dot { background: var(--ok); }
.sync-strip[data-sync="pending"] { color: var(--warn); background: var(--warn-wash); }
.sync-strip[data-sync="pending"] .dot { background: var(--warn); }
.sync-strip[data-sync="refused"] { color: var(--bad); background: var(--bad-wash); }
.sync-strip[data-sync="refused"] .dot { background: var(--bad); }

.main { min-width: 0; }

/* ---------- cards & panels ---------- */
.card {
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow);
}
.card-head {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 12px 16px; border-bottom: 1px solid var(--line);
}
.card-body { padding: 14px 16px; display: grid; gap: 12px; }
.card-row {
  display: flex; align-items: center; gap: 12px;
  padding: 11px 16px; border-bottom: 1px solid var(--line);
}
.card-row:last-child { border-bottom: 0; }
.card-row.link { color: inherit; }
.card-row.link:hover { background: var(--paper-deep); text-decoration: none; }
.card-foot { padding: 12px 16px; border-top: 1px solid var(--line); }

/* ink block — deliberate emphasis, reserved for rules a user acts on */
.block-ink {
  background: var(--ink); color: var(--paper); border-radius: var(--radius);
  padding: 14px 16px;
}
.block-ink .fine { color: #b9bcae; }

/* ---------- status rails — neutral surface + coloured edge + a word ---------- */
.rail {
  display: flex; gap: 10px; align-items: flex-start;
  background: var(--card); border: 1px solid var(--line);
  border-inline-start: 4px solid var(--ink-faint);
  border-radius: var(--radius-sm); padding: 10px 14px; font-size: 14px;
}
.rail b { font-weight: 650; }
.rail-ok { border-inline-start-color: var(--ok); }
.rail-ok b { color: var(--ok); }
.rail-warn { border-inline-start-color: var(--warn); }
.rail-warn b { color: var(--warn); }
.rail-bad { border-inline-start-color: var(--bad); }
.rail-bad b { color: var(--bad); }
.rail-live { border-inline-start-color: var(--live); }
.rail-live b { color: var(--live); }

/* LIVE chip — red is reserved for this */
.live-chip {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 11px; font-weight: 800; letter-spacing: 0.1em;
  color: var(--live); text-transform: uppercase;
}
.live-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--live); animation: pulse 1.6s ease infinite; }
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: 0.35; } }
@media (prefers-reduced-motion: reduce) { .live-dot { animation: none; } }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border-radius: var(--radius-sm); padding: 9px 16px;
  font-weight: 600; font-size: 14.5px; border: 1px solid transparent;
  text-decoration: none;
}
.btn:hover { text-decoration: none; }
.btn-solid { background: var(--act); color: #fff; }
.btn-solid:hover { background: var(--act-deep); }
.btn-ghost { background: var(--card); color: var(--ink); border-color: var(--line-strong); }
.btn-ghost:hover { border-color: var(--ink-soft); }
.btn-quiet { background: none; color: var(--act); padding: 9px 10px; }
.btn-danger { background: var(--card); color: var(--bad); border-color: var(--bad); }
.btn-danger:hover { background: var(--bad-wash); }
.btn-big { padding: 13px 22px; font-size: 16px; border-radius: var(--radius); }
.btn-sm { padding: 5px 11px; font-size: 13px; }
.btn[disabled], .btn.disabled { opacity: 0.45; pointer-events: none; }
.btn-hint { font-size: 12.5px; color: var(--ink-faint); }

/* ---------- forms ---------- */
.field { display: grid; gap: 5px; }
.field > label { font-size: 13px; font-weight: 600; color: var(--ink-soft); }
.input, select.input, textarea.input {
  background: var(--card); border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm); padding: 9px 12px; font-size: 15px;
  width: 100%; color: var(--ink);
}
.input:focus { border-color: var(--act); outline: none; box-shadow: 0 0 0 3px var(--act-wash); }
.check { display: flex; gap: 10px; align-items: flex-start; font-size: 14px; }
.check input { margin-top: 3px; width: 16px; height: 16px; accent-color: var(--act); }

/* ---------- chips & filters ---------- */
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  border: 1px solid var(--line-strong); border-radius: 99px;
  background: var(--card); color: var(--ink-soft);
  padding: 5px 13px; font-size: 13px; font-weight: 550;
}
.chip:hover { border-color: var(--ink-soft); text-decoration: none; }
.chip-on { background: var(--ink); border-color: var(--ink); color: var(--paper); }
.chip-row { display: flex; gap: 8px; flex-wrap: wrap; }

/* ---------- badges ---------- */
.team-badge {
  width: 30px; height: 30px; border-radius: 8px; flex: none;
  display: grid; place-items: center;
  font-family: var(--font-display); font-weight: 800; font-size: 12px;
  color: var(--ink); background: var(--tc, var(--paper-deep));
}
.team-badge.lg { width: 44px; height: 44px; font-size: 16px; border-radius: 10px; }
.team-pill {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--tc, var(--paper-deep)); color: var(--ink);
  border-radius: 99px; padding: 3px 11px; font-size: 12.5px; font-weight: 600;
}
.grade-badge {
  min-width: 24px; height: 24px; padding: 0 6px; border-radius: 6px; flex: none;
  display: inline-grid; place-items: center;
  background: var(--gc, var(--grade-none)); color: #fff;
  font-family: var(--font-display); font-weight: 800; font-size: 12px;
}
.grade-badge.hollow { background: none; border: 1.5px dashed var(--ink-faint); color: var(--ink-faint); }
.grade-pick {
  width: 38px; height: 38px; border-radius: 9px; border: 2px solid transparent;
  background: var(--gc); color: #fff;
  font-family: var(--font-display); font-weight: 800; font-size: 15px;
  opacity: 0.42;
}
.grade-pick.on { opacity: 1; border-color: var(--ink); box-shadow: 0 0 0 2px var(--card) inset; }
.grade-pick:hover { opacity: 0.85; }

/* ---------- stat tiles ---------- */
.stat-tile { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; }
.stat-tile .figure-xl { font-size: 34px; }
@media (min-width: 760px) { .stat-tile .figure-xl { font-size: 44px; } }

/* ---------- tables ---------- */
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th {
  text-align: left; font-size: 11px; font-weight: 700; letter-spacing: 0.08em;
  text-transform: uppercase; color: var(--ink-faint);
  padding: 8px 10px; border-bottom: 1px solid var(--line-strong);
}
.table td { padding: 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table .num { text-align: right; font-variant-numeric: tabular-nums; }
.table-scroll { overflow-x: auto; }
.form-strip { display: inline-flex; gap: 3px; }
.form-strip i {
  width: 18px; height: 18px; border-radius: 4px; font-style: normal;
  display: grid; place-items: center; font-size: 10.5px; font-weight: 800; color: #fff;
}
.form-strip .w { background: var(--ok); }
.form-strip .d { background: var(--ink-faint); }
.form-strip .l { background: var(--bad); }

/* ---------- tabs ---------- */
.tab-bar { display: flex; gap: 4px; background: var(--paper-deep); border-radius: var(--radius); padding: 4px; }
.tab-item {
  flex: 1; text-align: center; padding: 8px 12px; border-radius: var(--radius-sm);
  font-weight: 600; font-size: 14px; color: var(--ink-soft); border: 0; background: none;
}
.tab-item:hover { text-decoration: none; color: var(--ink); }
.tab-item.active { background: var(--card); color: var(--ink); box-shadow: var(--shadow); }

/* ---------- stepper ---------- */
.step-track { display: flex; gap: 5px; }
.step-seg { height: 5px; flex: 1; border-radius: 99px; background: var(--line-strong); }
.step-seg.done { background: var(--ok); }
.step-seg.now { background: var(--act); }

/* ---------- code / link objects ---------- */
.code-hero {
  font-family: var(--font-display); font-stretch: 108%; font-weight: 900;
  font-size: clamp(28px, 8.5vw, 42px); letter-spacing: 0.06em; line-height: 1;
  font-variant-numeric: tabular-nums; white-space: nowrap;
}
.link-object {
  border: 2px solid var(--ink); border-radius: var(--radius);
  background: var(--card); padding: 12px 14px;
  font-family: var(--font-mono); font-size: 13.5px; word-break: break-all;
}

/* ---------- floodlit (dark live surfaces ONLY) ---------- */
.floodlit {
  background: var(--night); color: var(--night-ink);
  border-radius: var(--radius);
}
.floodlit .card, .floodlit.card { background: var(--night-card); border-color: var(--night-line); box-shadow: none; }
.floodlit .sub, .floodlit .fine { color: var(--night-soft); }
.floodlit .figure-volt {
  font-family: var(--font-display); font-stretch: 105%; font-weight: 900;
  color: var(--volt); font-variant-numeric: tabular-nums; line-height: 1;
}
.floodlit hr, .floodlit .hairline { border-color: var(--night-line); }
body.floodlit-page { background: var(--night); color: var(--night-ink); }

/* scoring tap zones */
.tap-zone {
  min-height: 148px; width: 100%; border-radius: 14px;
  background: var(--night-card); border: 1px solid var(--night-line);
  color: var(--night-ink); display: flex; align-items: center; gap: 16px;
  padding: 18px 20px; text-align: left;
}
.tap-zone:active { background: #232c20; }
.tap-zone .pts { font-size: 76px; margin-left: auto; }
@media (min-width: 760px) { .tap-zone .pts { font-size: 96px; } }
.serve-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--volt); display: inline-block; }
.game-pip { width: 10px; height: 10px; border-radius: 50%; border: 1.5px solid var(--night-soft); display: inline-block; }
.game-pip.won { background: var(--volt); border-color: var(--volt); }

/* content + action column, stacking on phones */
.split-cta { display: grid; gap: 14px; align-items: center; }
@media (min-width: 600px) { .split-cta { grid-template-columns: 1fr auto; } }

/* ---------- misc ---------- */
.hairline { border: 0; border-top: 1px solid var(--line); }
.expando { border: 1px solid var(--line); border-radius: var(--radius-sm); }
.expando > summary {
  list-style: none; cursor: pointer; padding: 11px 14px;
  display: flex; align-items: center; gap: 10px; font-weight: 600;
}
.expando > summary::-webkit-details-marker { display: none; }
.expando > summary::after { content: "▾"; margin-left: auto; color: var(--ink-faint); }
.expando[open] > summary::after { content: "▴"; }
.expando .expando-body { padding: 4px 14px 14px; display: grid; gap: 12px; }

.tick-ring { display: inline-flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--ink-faint); }
.tick-ring .ring { width: 12px; height: 12px; border-radius: 50%; border: 2px solid var(--ok); }
.tick-ring.stale { color: var(--warn); }
.tick-ring.stale .ring { border-color: var(--warn); }

.empty {
  text-align: center; padding: 40px 20px; display: grid; gap: 10px; justify-items: center;
  color: var(--ink-soft);
}
.empty h2 { color: var(--ink); }

/* prototype control bar — not part of the product */
.protobar {
  position: fixed; right: 12px; bottom: 12px; z-index: 90;
  font-size: 12.5px;
}
.protobar-panel {
  background: var(--ink); color: var(--paper); border-radius: 12px;
  padding: 12px 14px; display: none; gap: 10px; min-width: 240px;
  box-shadow: 0 8px 30px rgba(0,0,0,0.3); margin-bottom: 8px;
}
.protobar.open .protobar-panel { display: grid; }
.protobar-toggle {
  background: var(--ink); color: var(--paper); border: 0; border-radius: 99px;
  padding: 8px 14px; font-weight: 700; font-size: 12px; letter-spacing: 0.06em;
  float: right; box-shadow: 0 4px 14px rgba(0,0,0,0.25);
}
.protobar select {
  width: 100%; background: #2a2e26; color: var(--paper);
  border: 1px solid #464b40; border-radius: 6px; padding: 6px 8px; font-size: 12.5px;
}
.protobar label { font-size: 11px; letter-spacing: 0.08em; text-transform: uppercase; color: #a4a898; }
.protobar a { color: var(--volt); }

/* refusal panel (honest refusals) */
.refusal { max-width: 460px; margin: 60px auto; text-align: center; display: grid; gap: 12px; justify-items: center; }

@media print {
  .sidebar, .topbar, .protobar, .no-print { display: none !important; }
  body { background: #fff; }
  .card { box-shadow: none; }
}
