/* Courtside Live. Tokens follow the Courtside site (docs/style.css). */
:root {
  --bg: #F6F5F1;
  --surface: #FFFFFF;
  --ink: #0B2E59;
  --text: #1F2933;
  --muted: #5B6B7F;
  --line: #E3E1DA;
  --ball: #DBF73D;
  --court: #1D6CB6;
  --live: #D93A3A;
  --rounded: ui-rounded, "SF Pro Rounded", -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0B1626;
    --surface: #12223A;
    --ink: #E8F0FA;
    --text: #D7DEE8;
    --muted: #93A3B8;
    --line: #22344F;
    --court: #7DB7F0;
    --live: #FF6B6B;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  background: var(--bg);
  color: var(--text);
  font: 17px/1.5 -apple-system, BlinkMacSystemFont, "Inter", "Segoe UI", system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--court); }
button { font: inherit; }

/* Header */
header.bar { border-bottom: 1px solid var(--line); padding: 0 max(16px, env(safe-area-inset-left)); }
header.bar .inner { max-width: 1100px; margin: 0 auto; display: flex; align-items: center; gap: 10px; height: 56px; }
header.bar img { width: 28px; height: 28px; border-radius: 7px; }
header.bar .brand { font-weight: 800; font-size: 18px; color: var(--ink); text-decoration: none; letter-spacing: -0.02em; }
header.bar .brand span { font-weight: 600; color: var(--muted); }
.status {
  margin-left: auto;
  display: inline-flex; align-items: center; gap: 7px;
  font: 700 13px/1 var(--rounded); letter-spacing: 0.04em; text-transform: uppercase;
  color: var(--muted);
}
.status::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: currentColor; }
.status[data-status="live"] { color: var(--live); }
.status[data-status="live"]::before { animation: pulse 1.6s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: 0.35; } }
@media (prefers-reduced-motion: reduce) { .status::before { animation: none !important; } }

main { max-width: 1100px; margin: 0 auto; padding: 24px 16px 48px; }

/* One match */
.match { display: grid; gap: 28px; grid-template-columns: minmax(0, 1fr); }
@media (min-width: 820px) {
  .match { grid-template-columns: minmax(280px, 420px) minmax(0, 1fr); align-items: start; }
}
.court-wrap { width: 100%; max-width: 420px; margin: 0 auto; }
svg.court { display: block; width: 100%; height: auto; max-height: 72vh; border-radius: 18px; box-shadow: 0 14px 40px rgba(11, 46, 89, 0.22); }
svg.court .points { font: 700 44px var(--rounded); fill: #fff; font-variant-numeric: tabular-nums; }
svg.court .board { font: 700 11px var(--rounded); fill: #fff; font-variant-numeric: tabular-nums; }
svg.court .board-name { font-size: 7.5px; font-weight: 800; letter-spacing: 0.06em; fill-opacity: 0.75; }
svg.court .server-number { font: 800 8.5px var(--rounded); fill: rgba(0, 0, 0, 0.8); }
svg.court .notice { font: 800 8px var(--rounded); letter-spacing: 0.05em; font-variant-numeric: tabular-nums; }
svg.court .result-title { font: 800 19px var(--rounded); fill: #fff; }
svg.court .result-summary { font: 700 12px var(--rounded); fill: var(--ball); font-variant-numeric: tabular-nums; }

.details h1 { margin: 0; font-size: clamp(24px, 4vw, 34px); line-height: 1.15; color: var(--ink); letter-spacing: -0.02em; overflow-wrap: anywhere; }
.details .meta { margin: 6px 0 22px; color: var(--muted); font-size: 15px; }
.details .meta a { color: inherit; }

table.scores { width: 100%; border-collapse: separate; border-spacing: 0; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; overflow: hidden; font-family: var(--rounded); font-variant-numeric: tabular-nums; }
table.scores td { padding: 14px 10px; border-top: 1px solid var(--line); font-size: 22px; font-weight: 700; text-align: center; width: 2.4em; }
table.scores tr:first-child td { border-top: 0; }
table.scores td.name { text-align: left; width: auto; font-size: 19px; color: var(--ink); padding-left: 14px; }
table.scores td.name > span:not(.serve):not(.tick) { overflow-wrap: anywhere; }
table.scores td.set { color: var(--muted); }
table.scores td.set.won { color: var(--ink); }
table.scores td.set.current { color: #0B2E59; background: var(--ball); }
table.scores td.pts { background: var(--ink); color: var(--bg); min-width: 2.6em; }
table.scores sup { font-size: 0.55em; margin-left: 1px; }
table.scores tr.winner td.name { font-weight: 800; }
.serve { display: inline-grid; place-items: center; width: 14px; height: 14px; margin-right: 10px; border-radius: 50%; vertical-align: -1px; font-size: 9px; font-weight: 800; color: rgba(0,0,0,0.8); }
.serve.on { background: var(--ball); box-shadow: 0 1px 2px rgba(0,0,0,0.3); }
.tick { margin-left: 8px; color: #2E9E5B; }

.follow { margin-top: 22px; display: flex; flex-wrap: wrap; align-items: center; gap: 10px 16px; color: var(--muted); font-size: 15px; }
.code { font: 800 22px/1 var(--rounded); letter-spacing: 0.12em; color: var(--ink); font-variant-numeric: tabular-nums; }
.actions { display: flex; gap: 10px; margin-top: 22px; flex-wrap: wrap; }
.button {
  appearance: none; border: 1px solid var(--line); background: var(--surface); color: var(--ink);
  padding: 10px 16px; border-radius: 999px; font-weight: 600; font-size: 15px; cursor: pointer;
  -webkit-tap-highlight-color: transparent; touch-action: manipulation; user-select: none;
}
@media (hover: hover) { .button:hover { border-color: var(--muted); } }
.button:active { transform: scale(0.97); }
.button.primary { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.updated { margin-top: 18px; font-size: 13px; color: var(--muted); }

.notice-card { max-width: 520px; margin: 12vh auto 0; text-align: center; }
.notice-card h1 { color: var(--ink); font-size: 26px; margin: 0 0 8px; }
.notice-card p { color: var(--muted); margin: 0 0 22px; }

/* Code box (home) */
.home { max-width: 520px; margin: 8vh auto 0; text-align: center; }
.home img { width: 96px; height: 96px; border-radius: 22px; filter: drop-shadow(0 10px 22px rgba(11, 46, 89, 0.25)); }
.home h1 { color: var(--ink); font-size: clamp(28px, 6vw, 38px); margin: 18px 0 6px; letter-spacing: -0.02em; }
.home p { color: var(--muted); margin: 0 0 26px; }
.code-form { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }
.code-form input {
  width: 9.5ch; padding: 12px 14px; border-radius: 14px; border: 1px solid var(--line); background: var(--surface); color: var(--ink);
  font: 800 28px/1 var(--rounded); letter-spacing: 0.14em; text-align: center; font-variant-numeric: tabular-nums;
}
.code-form input:focus { outline: 3px solid var(--ball); outline-offset: 1px; border-color: var(--ink); }
.code-form .button { font-size: 17px; padding: 12px 22px; }
.form-error { min-height: 1.5em; margin-top: 12px; color: var(--live); font-size: 15px; }

/* Tournament board */
.board-head { display: flex; flex-wrap: wrap; align-items: end; justify-content: space-between; gap: 12px 24px; margin-bottom: 22px; }
.board-head h1 { margin: 0; color: var(--ink); font-size: clamp(26px, 4vw, 44px); letter-spacing: -0.02em; overflow-wrap: anywhere; }
.board-head .join { text-align: right; color: var(--muted); font-size: 14px; }
.board-head .join .code { display: block; font-size: clamp(26px, 3.4vw, 44px); margin-top: 2px; }
@media (max-width: 600px) { .board-head .join { text-align: left; } }
.board-head .closed { color: var(--muted); font-size: 15px; }
.cards { display: grid; gap: 16px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 320px), 1fr)); }
.card { display: block; text-decoration: none; color: inherit; background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 14px 16px 12px; }
@media (hover: hover) { .card:hover { border-color: var(--muted); } }
.card .top { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-bottom: 8px; font-size: 13px; color: var(--muted); font-weight: 600; }
.card .top .court-label { color: var(--ink); font-weight: 800; letter-spacing: 0.02em; }
.card .tag { font: 700 11px/1 var(--rounded); text-transform: uppercase; letter-spacing: 0.06em; padding: 4px 7px; border-radius: 6px; background: var(--bg); }
.card .tag.final { background: var(--ink); color: var(--bg); }
.card table.scores { border: 0; border-radius: 0; background: transparent; }
.card table.scores td { padding: 7px 6px; font-size: 19px; }
.card table.scores td.name { font-size: 16px; padding-left: 0; }
.card table.scores td.pts { border-radius: 6px; }
.card .net { margin-top: 6px; min-height: 1.4em; font: 800 12px var(--rounded); letter-spacing: 0.05em; color: var(--muted); }
.empty { color: var(--muted); text-align: center; padding: 48px 0; }
@media (min-width: 1600px) { .cards { grid-template-columns: repeat(auto-fill, minmax(420px, 1fr)); } }

.report { margin-top: 40px; font-size: 13px; color: var(--muted); }
.report a { color: inherit; }
