:root {
  /* Pickled Cactus palette, sampled from the club logo */
  --bg: #0a1f10;           /* deep cactus green */
  --surface: #11301a;
  --surface-2: #173d22;
  --line: #24502f;
  --text: #fbf3df;         /* wordmark cream */
  --muted: #a3b89a;
  --optic: #c2e534;        /* banner lime / ball */
  --a: #9fe35f;            /* team A: cactus green */
  --a-deep: #0f3a1a;
  --b: #ff7a45;            /* team B: sneaker red */
  --b-deep: #3d160c;
  --hat: #c87a3c;          /* hat brown */
  --danger: #ff6b5b;
  --display: 'Alfa Slab One', Georgia, serif;   /* matches "PICKLEBALL CLUB" */
  --body: 'Barlow', system-ui, -apple-system, sans-serif;
  --r: 14px;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.4 var(--body);
  min-height: 100dvh;
  padding-bottom: calc(76px + env(safe-area-inset-bottom));
}
body.scoring { overflow: hidden; overscroll-behavior: none; }
html, body { overscroll-behavior-y: none; }
button { font: inherit; color: inherit; cursor: pointer; touch-action: manipulation; -webkit-tap-highlight-color: transparent; }
button:disabled { opacity: .35; cursor: default; }
input {
  font: inherit; color: var(--text); width: 100%;
  background: var(--surface-2); border: 1px solid var(--line); border-radius: 10px;
  padding: 13px 14px;
}
input:focus { outline: 2px solid var(--optic); outline-offset: -1px; }

/* ---------- Shell ---------- */
.top {
  position: sticky; top: 0; z-index: 5;
  display: flex; align-items: center; justify-content: space-between;
  padding: calc(14px + env(safe-area-inset-top)) 18px 12px;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 10px; min-width: 0; }
.brand img { width: 40px; height: 44px; object-fit: contain; flex: none; filter: drop-shadow(0 2px 0 rgba(0,0,0,.4)); }
.brand-text { display: flex; flex-direction: column; line-height: 1; }
.brand-text strong { font: 400 24px/1 var(--display); letter-spacing: .06em; }
.brand-text small { font: 400 10px var(--display); color: var(--optic); letter-spacing: .06em; text-transform: uppercase; margin-top: 3px; }
.ball {
  width: 18px; height: 18px; border-radius: 50%; background: var(--optic);
  background-image: radial-gradient(circle at 30% 35%, #0b0f14 1.6px, transparent 2px), radial-gradient(circle at 68% 30%, #0b0f14 1.6px, transparent 2px),
    radial-gradient(circle at 50% 70%, #0b0f14 1.6px, transparent 2px);
}
.live-count { font: 400 13px var(--display); letter-spacing: .03em; text-transform: uppercase; color: var(--optic); }

main { max-width: 720px; margin: 0 auto; padding: 8px 16px 24px; }

.tabs {
  position: fixed; inset: auto 0 0 0; z-index: 5;
  display: grid; grid-template-columns: repeat(4, 1fr);
  background: var(--surface); border-top: 1px solid var(--line);
  padding-bottom: env(safe-area-inset-bottom);
}
.tabs button {
  background: none; border: 0; padding: 8px 0 10px; min-height: 60px;
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  font: 400 11px var(--display); letter-spacing: .03em; text-transform: uppercase; color: var(--muted);
  border-top: 2px solid transparent;
}
.tabs button.on { color: var(--optic); border-top-color: var(--optic); }

/* ---------- Blocks ---------- */
.block { margin-top: 22px; }
.block-head { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 10px; }
h2 { font: 400 20px/1.15 var(--display); letter-spacing: .05em; text-transform: uppercase; margin: 0; }
h3 { font: 400 18px/1 var(--display); letter-spacing: .03em; text-transform: uppercase; margin: 0; }
.count { color: var(--muted); font-size: 14px; }
.empty { color: var(--muted); background: var(--surface); border: 1px dashed var(--line); border-radius: var(--r); padding: 16px; margin: 0 0 12px; }
.note { color: var(--muted); font-size: 14px; margin: 8px 0 14px; }
.lbl { display: flex; gap: 8px; align-items: baseline; color: var(--muted); font-size: 13px; text-transform: uppercase; letter-spacing: .03em; margin: 16px 0 8px; }
.lbl small { color: var(--text); text-transform: none; letter-spacing: 0; font-size: 14px; }

.btn {
  border: 1px solid var(--line); background: var(--surface-2); border-radius: 12px;
  padding: 13px 16px; min-height: 48px; font: 400 15px var(--display); letter-spacing: .03em; text-transform: uppercase;
}
.btn.primary { background: var(--optic); color: #0a1f10; border-color: var(--optic); }
.btn.ghost { background: transparent; }
.btn.danger { background: transparent; color: var(--danger); border-color: color-mix(in srgb, var(--danger) 40%, transparent); }
.btn.wide { width: 100%; margin-top: 12px; }
.btn.sm { padding: 8px 12px; font-size: 14px; }

.seg { display: flex; background: var(--surface-2); border: 1px solid var(--line); border-radius: 12px; padding: 4px; gap: 4px; margin-top: 10px; }
.seg button { flex: 1; min-height: 44px; border: 0; background: none; border-radius: 9px; padding: 10px 6px; font-weight: 600; color: var(--muted); }
.seg button.on { background: var(--text); color: var(--bg); }

.stepper { display: flex; align-items: center; gap: 18px; }
.stepper .btn { width: 56px; font-size: 22px; padding: 8px 0; }
.stepper b { font: 400 34px var(--display); min-width: 30px; text-align: center; }

/* ---------- Courts ---------- */
.courts { display: grid; gap: 12px; }
@media (min-width: 640px) { .courts { grid-template-columns: 1fr 1fr; } }
.court { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 16px; }
.court.live { border-color: color-mix(in srgb, var(--optic) 50%, var(--line)); }
.court header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.tag { font: 400 12px var(--display); letter-spacing: .03em; text-transform: uppercase; padding: 4px 8px; border-radius: 6px; background: var(--surface-2); color: var(--text); }
.tag.live { background: var(--optic); color: #0a1f10; }
.tag.dim { color: var(--muted); }
.court .btn.wide { margin-top: 0; }
.vs { display: grid; gap: 6px; }
.vs em { font: 400 13px var(--display); color: var(--muted); letter-spacing: .03em; text-transform: uppercase; font-style: normal; text-align: center; }
.side { display: flex; justify-content: space-between; align-items: center; padding: 10px 12px; border-radius: 10px; font-weight: 600; }
.side.t0 { background: var(--a-deep); border-left: 3px solid var(--a); }
.side.t1 { background: var(--b-deep); border-left: 3px solid var(--b); }
.side b { font: 400 30px/1 var(--display); }
.court-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.court-actions .btn { flex: 1; white-space: nowrap; }
.court-actions .btn.primary { flex: 1 1 100%; }

/* ---------- Stacks & queue ---------- */
.stacks, .preview { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.stacks li { display: flex; align-items: center; gap: 12px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 12px 10px 12px 12px; }
.num { font: 400 22px/1 var(--display); color: var(--optic); min-width: 22px; }
.pair { flex: 1; display: flex; flex-direction: column; gap: 2px; font-weight: 600; }
.pair em { font-style: normal; color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .03em; }
.t0 { color: var(--a); }
.t1 { color: var(--b); }
.mode { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .03em; }
.x { background: none; border: 0; color: var(--muted); font-size: 26px; line-height: 1; width: 44px; height: 44px; margin: -8px -6px -8px 0; flex: none; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { display: inline-flex; align-items: center; gap: 8px; background: var(--surface); border: 1px solid var(--line); border-radius: 999px; padding: 7px 10px 7px 8px; font-weight: 600; }
.chip b { font: 400 12px var(--display); color: var(--muted); }
i[class^='g-'] { font-style: normal; font: 400 11px var(--display); padding: 2px 5px; border-radius: 5px; letter-spacing: .03em; }
.g-M { background: #1d3550; color: #8cc4ff; }
.g-F { background: #4a1d3c; color: #ff9ad5; }

/* ---------- Players ---------- */
.add { display: grid; gap: 0; }
.row-actions { display: flex; gap: 8px; margin-bottom: 10px; }
.roster { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.roster li { display: flex; align-items: center; gap: 12px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 8px 12px 8px 8px; opacity: .6; }
.roster li.here { opacity: 1; }
.check { width: 40px; height: 40px; flex: none; border-radius: 10px; border: 2px solid var(--line); background: transparent; position: relative; }
.check[aria-pressed='true'] { background: var(--optic); border-color: var(--optic); }
.check[aria-pressed='true']::after { content: ''; position: absolute; left: 13px; top: 6px; width: 9px; height: 17px; border: solid #0a1f10; border-width: 0 3px 3px 0; transform: rotate(45deg); }
.who { flex: 1; text-align: left; background: none; border: 0; padding: 4px 0; display: flex; flex-direction: column; }
.who span { color: var(--muted); font-size: 14px; }
.status { font: 400 12px var(--display); letter-spacing: .03em; text-transform: uppercase; color: var(--optic); }

/* ---------- Board ---------- */
.board { width: 100%; border-collapse: collapse; background: var(--surface); border-radius: var(--r); overflow: hidden; }
.board th, .board td { padding: 11px 12px; text-align: left; border-bottom: 1px solid var(--line); }
.board th { font: 400 12px var(--display); letter-spacing: .03em; text-transform: uppercase; color: var(--muted); }
.board td:first-child { color: var(--optic); font: 400 18px var(--display); width: 40px; }
.board tr:last-child td { border-bottom: 0; }
.history { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.history li { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 12px; display: grid; gap: 4px; }
.history li div { display: flex; justify-content: space-between; color: var(--muted); }
.history li div.won { color: var(--text); font-weight: 600; }
.history li b { font: 400 20px var(--display); }
.history small { color: var(--muted); }

/* ---------- Modal ---------- */
.modal { position: fixed; inset: 0; z-index: 40; background: rgba(0, 0, 0, .66); display: flex; align-items: flex-end; justify-content: center; }
.modal[hidden] { display: none; }
.modal-body {
  width: 100%; max-width: 560px; max-height: 92dvh; overflow: auto;
  background: var(--surface); border: 1px solid var(--line); border-radius: 20px 20px 0 0;
  padding: 22px 18px calc(18px + env(safe-area-inset-bottom));
}
@media (min-width: 640px) { .modal { align-items: center; } .modal-body { border-radius: 20px; } }
.modal-body h2 { font-size: 24px; margin-bottom: 14px; }
.modal-body form { display: grid; }
.modal-actions { display: flex; gap: 8px; margin-top: 18px; flex-wrap: wrap; }
.modal-actions .btn { flex: 1; }

.modes { display: grid; gap: 8px; grid-template-columns: 1fr 1fr; }
.mode-opt { text-align: left; background: var(--surface-2); border: 2px solid var(--line); border-radius: 14px; padding: 14px; display: flex; flex-direction: column; gap: 4px; }
.mode-opt strong { font: 400 19px/1.1 var(--display); text-transform: uppercase; letter-spacing: .04em; }
.mode-opt span { color: var(--muted); font-size: 13px; line-height: 1.3; }
.mode-opt.on { border-color: var(--optic); }
.mode-opt.on strong { color: var(--optic); }

.preview li { display: flex; gap: 12px; align-items: center; background: var(--surface-2); border-radius: 12px; padding: 10px; }
.pteams { flex: 1; display: grid; gap: 4px; }
.pteams em { font-style: normal; font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .03em; text-align: center; }
.pteam { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.pchip { display: flex; justify-content: space-between; align-items: center; gap: 6px; background: var(--bg); border: 2px solid transparent; border-radius: 10px; padding: 9px 10px; font-weight: 600; text-align: left; }
.pteam.t0 .pchip { border-left-color: var(--a); }
.pteam.t1 .pchip { border-left-color: var(--b); }
.pchip.sel { border-color: var(--optic); background: color-mix(in srgb, var(--optic) 14%, var(--bg)); }

.targets { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.target { background: var(--surface-2); border: 2px solid var(--line); border-radius: 16px; padding: 18px 0 14px; display: flex; flex-direction: column; align-items: center; gap: 2px; }
.target b { font: 400 56px/1 var(--display); }
.target small { font: 400 11px var(--display); letter-spacing: .03em; text-transform: uppercase; color: var(--optic); }
.target.on { border-color: var(--optic); background: color-mix(in srgb, var(--optic) 12%, var(--surface-2)); }
.serve-pick { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.serve-pick button { background: var(--surface-2); border: 2px solid var(--line); border-radius: 12px; padding: 12px; font-weight: 600; }
.serve-pick button.t0.on { border-color: var(--a); background: var(--a-deep); }
.serve-pick button.t1.on { border-color: var(--b); background: var(--b-deep); }

/* ---------- Scoreboard ---------- */
.score { -webkit-touch-callout: none; touch-action: manipulation; position: fixed; inset: 0; z-index: 30; background: #000; display: flex; flex-direction: column; user-select: none; -webkit-user-select: none; }
.score[hidden] { display: none; }
.sb-top {
  display: grid; grid-template-columns: auto 1fr; grid-template-areas: 'back tools' 'call call'; align-items: center; gap: 6px 8px;
  padding: calc(8px + env(safe-area-inset-top)) 10px 8px; background: var(--bg);
}
.sb-btn { white-space: nowrap; background: var(--surface-2); border: 1px solid var(--line); border-radius: 10px; padding: 0 12px; min-height: 44px; font: 400 13px var(--display); letter-spacing: .03em; text-transform: uppercase; }
.sb-top > .sb-btn { justify-self: start; grid-area: back; }
.sb-tools { grid-area: tools; justify-self: end; display: flex; gap: 6px; }
.sb-call { grid-area: call; text-align: center; white-space: nowrap; }
.sb-call small { display: block; color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .03em; }
.sb-call strong { font: 400 30px/1 var(--display); color: var(--optic); letter-spacing: .03em; }

.sb-halves { flex: 1; display: flex; flex-direction: column; gap: 3px; min-height: 0; }
.half {
  flex: 1; min-height: 0; border: 0; position: relative; overflow: hidden;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 0;
  transition: filter .12s;
}
.half.t0 { background: var(--a-deep); color: var(--a); }
.half.t1 { background: var(--b-deep); color: var(--b); }
.half.serving.t0 { background: linear-gradient(180deg, #185224, var(--a-deep)); box-shadow: inset 0 0 0 4px var(--a); }
.half.serving.t1 { background: linear-gradient(180deg, #4a1d12, var(--b-deep)); box-shadow: inset 0 0 0 4px var(--b); }
.h-names { font: 400 clamp(18px, 4.5vmin, 30px)/1.1 var(--display); letter-spacing: .03em; text-transform: uppercase; color: var(--text); text-align: center; padding: 0 16px; }
.h-score { font: 400 min(22vh, 40vw)/0.95 var(--display); font-variant-numeric: tabular-nums; }
.h-serve { font: 400 clamp(13px, 2.6vmin, 18px) var(--display); letter-spacing: .03em; text-transform: uppercase; color: var(--muted); display: flex; align-items: center; gap: 8px; }
.serving .h-serve { color: var(--optic); }
.h-serve i { width: 14px; height: 14px; border-radius: 50%; background: var(--optic); box-shadow: 0 0 12px var(--optic); }

@media (orientation: landscape) {
  .sb-halves { flex-direction: row; }
  .sb-controls { display: grid; grid-template-columns: 1.2fr 1fr; align-items: stretch; }
  .sb-controls .ctl-point { grid-row: span 2; }
  .sb-top { grid-template-columns: auto 1fr auto; grid-template-areas: 'back call tools'; }
  .h-score { font-size: min(34vh, 17vw); }
}


.sb-toast {
  position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%);
  pointer-events: none; background: var(--optic); color: #0a1f10;
  font: 400 28px var(--display); letter-spacing: .03em; text-transform: uppercase;
  padding: 10px 22px; border-radius: 999px;
  animation: pop .7s ease-out forwards;
}
@keyframes pop {
  0% { opacity: 0; transform: translate(-50%, -50%) scale(.8); }
  15% { opacity: 1; transform: translate(-50%, -50%) scale(1); }
  75% { opacity: 1; }
  100% { opacity: 0; }
}

.sb-won { position: absolute; inset: 0; background: rgba(0, 0, 0, .78); display: flex; align-items: center; justify-content: center; padding: 20px; }
.won-card { margin-top: 60px; width: 100%; max-width: 460px; background: var(--surface); border-radius: 20px; padding: 24px; text-align: center; border-top: 6px solid var(--optic); }
.sb-won.t0 .won-card { margin-top: 60px; border-top-color: var(--a); }
.sb-won.t1 .won-card { margin-top: 60px; border-top-color: var(--b); }
.won-card small { color: var(--muted); text-transform: uppercase; letter-spacing: .03em; font-size: 12px; }
.won-card h2 { font-size: 26px; margin: 4px 0 4px; }
.won-card img { width: 96px; height: auto; display: block; margin: -70px auto 4px; filter: drop-shadow(0 6px 10px rgba(0,0,0,.5)); }
.won-score { font: 400 64px/1 var(--display); margin: 8px 0 0; }

@media (prefers-reduced-motion: reduce) {
  .sb-toast { animation: none; }
  .half { transition: none; }
}

/* ---------- Pickled Cactus touches ---------- */
.tabs svg { width: 24px; height: 24px; }
.top { gap: 12px; }
.hero { text-align: center; padding: 18px 8px 4px; }
.hero img { width: min(78%, 320px); height: auto; filter: drop-shadow(0 8px 18px rgba(0,0,0,.45)); }
.hero p { color: var(--muted); margin: 10px auto 0; max-width: 30ch; }
.hero .btn { margin-top: 16px; }
.wordmark { display: block; width: min(100%, 360px); height: auto; margin: 26px auto 6px; opacity: .9; }
@media (max-width: 360px) {
  .sb-call strong { font-size: 24px; }
  .sb-btn { padding: 0 9px; font-size: 12px; }
}

/* ---------- Sessions & backup ---------- */
.scope-title { margin: -4px 0 10px; color: var(--optic); font-weight: 600; }
.sessions { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.sessions button { width: 100%; text-align: left; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 12px 14px; display: flex; flex-direction: column; gap: 3px; min-height: 56px; }
.sessions button.on { border-color: var(--optic); }
.sessions strong { font-weight: 600; }
.sessions span { color: var(--muted); font-size: 14px; }
.session-card { width: 100%; text-align: left; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 14px; display: flex; flex-direction: column; gap: 3px; }
.session-card small { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .06em; }
.session-card strong { font: 400 18px/1.2 var(--display); letter-spacing: .03em; }
.session-card span { color: var(--muted); }
.session-card em { font-style: normal; color: var(--optic); font-size: 14px; font-weight: 600; margin-top: 4px; }
.file-btn { display: inline-flex; align-items: center; justify-content: center; cursor: pointer; }
.row-actions .btn { flex: 1; }
input[type='date'], input[type='time'] { min-height: 50px; -webkit-appearance: none; appearance: none; color-scheme: dark; }

/* ---------- Scoring controls ---------- */
.h-fix { position: absolute; left: 10px; right: 10px; top: 50%; transform: translateY(-50%); display: flex; justify-content: space-between; pointer-events: none; }
.h-fix button { pointer-events: auto; }
.h-fix button { width: 44px; height: 44px; border-radius: 10px; border: 1px solid rgba(251,243,223,.18); background: rgba(0,0,0,.25); color: var(--text); font: 400 20px/1 var(--display); opacity: .75; }
.sb-controls { display: grid; gap: 8px; padding: 10px 10px calc(10px + env(safe-area-inset-bottom)); background: var(--bg); }
.ctl-point { border: 0; border-radius: 16px; min-height: 76px; font: 400 30px/1 var(--display); letter-spacing: .04em; text-transform: uppercase; color: #0a1f10; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; }
.ctl-point small { font: 600 14px var(--body); letter-spacing: 0; text-transform: none; opacity: .8; }
.ctl-point.t0 { background: var(--a); }
.ctl-point.t1 { background: var(--b); }
.ctl-point:active, .ctl-sideout:active, .ctl-server button:active { transform: scale(.98); }
.ctl-row { display: grid; grid-template-columns: 1.7fr 1fr; gap: 8px; }
.ctl-server { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; background: var(--surface-2); border: 1px solid var(--line); border-radius: 14px; padding: 4px; }
.ctl-server button { border: 0; border-radius: 10px; background: none; min-height: 52px; white-space: nowrap; font: 400 13px var(--display); letter-spacing: .03em; text-transform: uppercase; color: var(--muted); }
.ctl-server button.on { background: var(--text); color: var(--bg); }
.ctl-sideout { border: 2px solid var(--optic); background: transparent; color: var(--optic); border-radius: 14px; min-height: 60px; white-space: nowrap; font: 400 17px var(--display); letter-spacing: .04em; text-transform: uppercase; }
.ctl-manual { background: none; border: 0; color: var(--muted); font-size: 14px; text-decoration: underline; text-underline-offset: 3px; min-height: 36px; }

/* ---------- Manual score ---------- */
.manual { display: grid; gap: 10px; }
.manual-row { background: var(--surface-2); border-radius: 14px; padding: 12px; display: grid; gap: 10px; border-left: 4px solid; }
.manual-row.t0 { border-left-color: var(--a); }
.manual-row.t1 { border-left-color: var(--b); }
.manual-names { font-weight: 600; color: var(--text); }
.manual-step { display: grid; grid-template-columns: 64px 1fr 64px; gap: 8px; }
.manual-step .btn { font-size: 26px; padding: 0; min-height: 64px; }
.manual-step input { text-align: center; font: 400 40px var(--display); padding: 6px; min-height: 64px; -moz-appearance: textfield; }
.manual-step input::-webkit-outer-spin-button, .manual-step input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }

/* ---------- Sync, lock screen, notices ---------- */
.top-right { display: flex; align-items: center; gap: 8px; }
.sync { border: 1px solid var(--line); background: var(--surface); border-radius: 999px; padding: 6px 10px; font-size: 12px; font-weight: 600; color: var(--muted); white-space: nowrap; }
.sync::before { content: ''; display: inline-block; width: 7px; height: 7px; border-radius: 50%; margin-right: 6px; vertical-align: 1px; background: var(--muted); }
.sync[data-state="live"] { color: var(--text); }
.sync[data-state="live"]::before { background: var(--optic); box-shadow: 0 0 8px var(--optic); }
.sync[data-state="saving"]::before { background: var(--optic); opacity: .5; }
.sync[data-state="offline"]::before, .sync[data-state="error"]::before { background: var(--b); }
.sync:empty { display: none; }
.toast { position: fixed; left: 12px; right: 12px; bottom: calc(86px + env(safe-area-inset-bottom)); z-index: 40; background: var(--text); color: var(--bg); font-weight: 600; border-radius: 12px; padding: 12px 14px; box-shadow: 0 10px 30px rgba(0,0,0,.4); max-width: 520px; margin: 0 auto; }
.gate { position: fixed; inset: 0; z-index: 60; display: grid; place-items: center; padding: 24px; background: var(--bg); }
.gate-card { width: min(100%, 380px); text-align: center; }
.gate-card img { width: 96px; height: auto; margin: 0 auto 8px; display: block; }
.gate-card h2 { font: 400 26px var(--display); margin: 6px 0 8px; }
.gate-card p { color: var(--muted); margin: 0 0 16px; }
.gate-card a { color: var(--optic); }
.gate-card .err { color: var(--danger); margin: 10px 0 0; }

/* ---------- Mode switch + tournament ---------- */
.mode-switch { margin-top: 14px; }
.mode-switch .seg { margin-top: 0; }
.live-link { margin: 8px 2px 0; }
.live-link a { color: var(--optic); }
select { font: inherit; color: var(--text); background: var(--surface-2); border: 1px solid var(--line); border-radius: 10px; padding: 12px; width: 100%; min-width: 0; }
.pair-pick { display: grid; grid-template-columns: 1fr auto 1fr; gap: 8px; align-items: center; margin-top: 12px; }
.pair-pick span { color: var(--muted); font-weight: 600; }
.champion { text-align: center; background: var(--surface); border: 1px solid color-mix(in srgb, var(--optic) 50%, var(--line)); border-radius: var(--r); padding: 20px 16px; }
.champion img { width: 88px; height: auto; display: block; margin: 0 auto 6px; }
.champion small { font: 400 12px var(--display); color: var(--optic); text-transform: uppercase; letter-spacing: .05em; }
.champion h2 { font: 400 26px var(--display); margin: 6px 0 14px; }
.champion .row-actions { justify-content: center; }
.bracket li { border-color: color-mix(in srgb, var(--optic) 35%, var(--line)); }

.gate[hidden], .toast[hidden], .sync[hidden] { display: none; }

.gate-card input + input { margin-top: 10px; }
.admin-link { border: 1px solid var(--line); background: var(--surface); border-radius: 999px; padding: 6px 12px; font-size: 12px; font-weight: 600; color: var(--muted); text-decoration: none; }
.admin-link:hover { color: var(--text); }

/* ---------- Partners ---------- */
.check-row { display: flex; align-items: center; gap: 12px; margin-top: 16px; padding: 12px 14px; background: var(--surface-2); border: 1px solid var(--line); border-radius: 12px; font-weight: 600; cursor: pointer; }
.check-row input { width: 22px; height: 22px; margin: 0; accent-color: var(--optic); flex: none; }
.partner-fields { margin-top: 10px; padding: 4px 14px 2px; border-left: 3px solid var(--optic); }
.partner-fields .lbl:first-child { margin-top: 6px; }
.partner-fields .note { margin: 6px 0 0; }
.modal-body select { margin-top: 2px; }
