/* Badminton Scoreboard: bright, glassy UI.
   Frosted white cards over a soft court-coloured gradient. Always light. */

:root {
  color-scheme: light;
  --text: #0f1b33;
  --muted: #5a6784;
  --faint: #8b96ad;
  --line: rgba(15, 27, 51, 0.09);
  --line-strong: rgba(15, 27, 51, 0.16);

  --glass: rgba(255, 255, 255, 0.62);
  --glass-strong: rgba(255, 255, 255, 0.82);
  --glass-soft: rgba(255, 255, 255, 0.45);
  --glass-border: rgba(255, 255, 255, 0.85);
  --blur: saturate(170%) blur(20px);

  --brand: #2f6bff;
  --brand-2: #5b8cff;
  --brand-ink: #1a47c9;
  --court: #19b37a;
  --accent: #ffcc33;
  --side0: #2f6bff;
  --side0-2: #5f8fff;
  --side1: #ec3f7c;
  --side1-2: #ff6f9d;
  --ok: #138a52;
  --warn: #a8660a;

  --radius: 20px;
  --radius-sm: 12px;
  --shadow: 0 1px 0 rgba(255, 255, 255, 0.9) inset, 0 18px 40px -18px rgba(31, 52, 110, 0.28), 0 2px 6px rgba(31, 52, 110, 0.06);
  --shadow-lift: 0 1px 0 rgba(255, 255, 255, 0.9) inset, 0 24px 50px -20px rgba(31, 52, 110, 0.38), 0 4px 10px rgba(31, 52, 110, 0.08);
  --ring: 0 0 0 4px rgba(47, 107, 255, 0.18);
}

* { box-sizing: border-box; }
html, body { margin: 0; }
html { background: #eef3ff; }
body {
  font-family: Inter, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color: var(--text);
  line-height: 1.5;
  min-height: 100vh;
  background:
    radial-gradient(1200px 600px at 10% -10%, #dfe9ff 0%, transparent 60%),
    radial-gradient(900px 600px at 100% 0%, #e2f8ef 0%, transparent 55%),
    linear-gradient(180deg, #f4f7ff 0%, #eef3fb 45%, #f3f7f4 100%);
  -webkit-font-smoothing: antialiased;
}
[hidden] { display: none !important; }
::selection { background: rgba(47, 107, 255, 0.2); }

/* soft coloured light behind the glass */
.backdrop { position: fixed; inset: 0; z-index: -1; overflow: hidden; pointer-events: none; }
.blob { position: absolute; border-radius: 50%; filter: blur(80px); opacity: 0.75; }
.b1 { width: 560px; height: 560px; left: -120px; top: 60px; background: #9fbcff; }
.b2 { width: 500px; height: 500px; right: -100px; top: 300px; background: #8fe3c0; }
.b3 { width: 420px; height: 420px; left: 38%; bottom: -170px; background: #ffdf8a; opacity: 0.6; }

h1, h2, h3 { letter-spacing: -0.015em; }
h2 { font-size: 1.12rem; font-weight: 700; margin: 0 0 18px; display: flex; align-items: center; gap: 10px; }
h3 { font-size: 1rem; font-weight: 700; margin: 0 0 8px; }
.num {
  display: inline-grid; place-items: center; width: 26px; height: 26px; border-radius: 9px; flex: none;
  font-size: 0.8rem; font-weight: 800; color: #fff;
  background: linear-gradient(135deg, var(--brand), var(--brand-2));
  box-shadow: 0 4px 10px -3px rgba(47, 107, 255, 0.6);
}
.mt { margin-top: 30px; }
.muted { color: var(--muted); }
.small { font-size: 0.85rem; }
.center { text-align: center; }
.mono { font-variant-numeric: tabular-nums; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 0.85rem; }
a, .link { color: var(--brand-ink); cursor: pointer; text-decoration: none; font-weight: 600; border-bottom: 1px solid rgba(26, 71, 201, 0.25); }
a:hover, .link:hover { border-bottom-color: currentColor; }

/* ---------- glass surfaces ---------- */
.card, .topbar, .option {
  background: var(--glass);
  -webkit-backdrop-filter: var(--blur);
  backdrop-filter: var(--blur);
  border: 1px solid var(--glass-border);
  box-shadow: var(--shadow);
}

/* ---------- top bar ---------- */
.topbar {
  position: sticky; top: 12px; z-index: 50;
  max-width: 1400px; margin: 12px auto 0; width: calc(100% - 24px);
  display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
  padding: 10px 14px 10px 12px; border-radius: 18px;
  background: rgba(255, 255, 255, 0.7);
}
.brand { display: flex; align-items: center; gap: 12px; }
.logo {
  width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; flex: none;
  background: linear-gradient(140deg, #2f6bff 0%, #4f86ff 55%, #19b37a 130%);
  box-shadow: 0 6px 16px -6px rgba(47, 107, 255, 0.7), inset 0 1px 0 rgba(255, 255, 255, 0.45);
}
.brand-text { display: flex; flex-direction: column; font-weight: 800; font-size: 1.02rem; letter-spacing: -0.02em; line-height: 1.15; }
.brand-text small { font-weight: 500; font-size: 0.74rem; color: var(--muted); letter-spacing: 0; }

.steps { display: flex; gap: 4px; padding: 4px; border-radius: 14px; background: rgba(15, 27, 51, 0.05); }
.step { display: flex; align-items: center; gap: 8px; padding: 6px 12px 6px 6px; border-radius: 10px; font-size: 0.82rem; font-weight: 600; color: var(--muted); transition: background 0.2s, color 0.2s; }
.step b { display: grid; place-items: center; width: 22px; height: 22px; border-radius: 7px; font-size: 0.72rem; background: rgba(15, 27, 51, 0.08); color: var(--muted); }
.step.active { background: #fff; color: var(--text); box-shadow: 0 4px 12px -4px rgba(31, 52, 110, 0.25); }
.step.active b { background: linear-gradient(135deg, var(--brand), var(--brand-2)); color: #fff; }
.step.done b { background: rgba(25, 179, 122, 0.16); color: var(--ok); }

/* ---------- layout ---------- */
.screen { max-width: 980px; margin: 26px auto; padding: 0 16px; }
#screen-score { max-width: 1400px; }
.card { border-radius: var(--radius); padding: 26px; margin-bottom: 20px; }

/* ---------- hero ---------- */
.hero { text-align: center; padding: 26px 10px 30px; }
.hero h1 { font-size: clamp(1.8rem, 4.2vw, 2.9rem); line-height: 1.08; margin: 0 auto 14px; max-width: 760px; font-weight: 800; letter-spacing: -0.035em; }
.hero .hl {
  background: linear-gradient(100deg, var(--brand) 10%, #19b37a 90%);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.hero p { color: var(--muted); font-size: 1.06rem; max-width: 620px; margin: 0 auto 20px; }
.chips { list-style: none; display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin: 0; padding: 0; }
.chips li {
  padding: 7px 14px; border-radius: 999px; font-size: 0.85rem; font-weight: 600; color: #26334f;
  background: var(--glass-strong); border: 1px solid var(--glass-border);
  box-shadow: 0 6px 16px -10px rgba(31, 52, 110, 0.35);
  -webkit-backdrop-filter: var(--blur); backdrop-filter: var(--blur);
}

/* ---------- dropzone ---------- */
.dropzone {
  display: block; position: relative; border-radius: 16px; padding: 30px 20px; text-align: center; cursor: pointer;
  background: linear-gradient(var(--glass-strong), var(--glass-strong)) padding-box,
    repeating-linear-gradient(135deg, rgba(47, 107, 255, 0.45) 0 10px, rgba(47, 107, 255, 0.12) 10px 20px) border-box;
  border: 2px dashed transparent;
  transition: transform 0.15s, box-shadow 0.2s, background 0.2s;
}
.dropzone:hover, .dropzone.drag { transform: translateY(-1px); box-shadow: 0 16px 36px -18px rgba(47, 107, 255, 0.55); }
.dropzone.drag { background: linear-gradient(rgba(234, 241, 255, 0.95), rgba(234, 241, 255, 0.95)) padding-box, linear-gradient(135deg, var(--brand), var(--court)) border-box; }
.dz-icon {
  display: inline-grid; place-items: center; width: 54px; height: 54px; border-radius: 16px; margin-bottom: 10px; color: #fff;
  background: linear-gradient(135deg, var(--brand), var(--brand-2));
  box-shadow: 0 10px 22px -10px rgba(47, 107, 255, 0.8);
}
.dz-icon.ok { background: linear-gradient(135deg, #19b37a, #3fd39a); box-shadow: 0 10px 22px -10px rgba(25, 179, 122, 0.8); }
.dropzone strong { display: block; font-size: 1.08rem; margin-bottom: 4px; }
.dropzone span:not(.dz-icon) { color: var(--muted); font-size: 0.9rem; }

.notice { margin-top: 14px; padding: 14px 16px; border-radius: 14px; background: rgba(47, 107, 255, 0.08); border: 1px solid rgba(47, 107, 255, 0.2); }
.notice.ok { background: rgba(25, 179, 122, 0.1); border-color: rgba(25, 179, 122, 0.3); color: #0c5c39; }
.notice.warn { background: rgba(255, 179, 0, 0.12); border-color: rgba(214, 140, 0, 0.32); color: #6b4300; }
.notice .btn { margin: 10px 8px 0 0; }
.or { display: flex; align-items: center; gap: 12px; margin: 20px 0 12px; color: var(--faint); font-size: 0.8rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em; }
.or::before, .or::after { content: ''; flex: 1; height: 1px; background: linear-gradient(90deg, transparent, var(--line-strong), transparent); }
.yt-row { display: flex; gap: 8px; }
.yt-row input { flex: 1; min-width: 0; }

/* ---------- form controls ---------- */
.field { display: flex; flex-direction: column; gap: 7px; margin-bottom: 18px; min-width: 0; }
.field.inline span:last-child { color: var(--muted); }
.label { font-size: 0.74rem; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: 0.07em; }
input[type="text"], input[type="url"], input:not([type]), input[type="number"], select, textarea {
  font: inherit; color: inherit; width: 100%; padding: 10px 13px; border-radius: 12px;
  background: rgba(255, 255, 255, 0.75); border: 1px solid var(--line-strong);
  box-shadow: inset 0 1px 2px rgba(15, 27, 51, 0.04);
  transition: border-color 0.15s, box-shadow 0.15s, background 0.15s;
}
input::placeholder, textarea::placeholder { color: #9aa4ba; }
input:hover, select:hover, textarea:hover { border-color: rgba(47, 107, 255, 0.35); }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--brand); box-shadow: var(--ring); background: #fff; }
select {
  appearance: none; -webkit-appearance: none; padding-right: 34px; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5 6 6.5l5-5' fill='none' stroke='%235a6784' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 13px center;
}
input.narrow { width: 84px; display: inline-block; }
input[type="range"] { width: 100%; accent-color: var(--brand); }
input[type="checkbox"] { width: 18px; height: 18px; accent-color: var(--brand); margin: 0; flex: none; }
textarea { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 0.84rem; resize: vertical; line-height: 1.55; }
.check { display: flex; gap: 10px; align-items: center; margin-bottom: 14px; font-size: 0.93rem; cursor: pointer; }
.check.small { font-size: 0.85rem; color: var(--muted); margin: 6px 0 0; }

/* segmented pills */
.seg { display: inline-flex; flex-wrap: wrap; gap: 6px; padding: 4px; border-radius: 14px; background: rgba(15, 27, 51, 0.045); border: 1px solid var(--line); align-self: flex-start; }
.seg label { position: relative; }
.seg input { position: absolute; opacity: 0; pointer-events: none; }
.seg span {
  display: inline-block; padding: 7px 15px; border-radius: 10px; cursor: pointer; user-select: none;
  font-weight: 600; font-size: 0.92rem; color: #34425f; transition: background 0.15s, color 0.15s, box-shadow 0.15s;
}
.seg span:hover { background: rgba(255, 255, 255, 0.7); }
.seg input:checked + span {
  background: #fff; color: var(--brand-ink);
  box-shadow: 0 6px 14px -8px rgba(31, 52, 110, 0.5), 0 0 0 1px rgba(47, 107, 255, 0.25);
}
.seg input:focus-visible + span { box-shadow: var(--ring); }

/* teams */
.teams { display: grid; grid-template-columns: 1fr auto 1fr; gap: 14px; align-items: start; }
.team {
  border: 1px solid var(--glass-border); border-radius: 16px; padding: 14px; margin: 0; display: grid; gap: 9px; min-width: 0;
  background: var(--glass-soft); position: relative; overflow: hidden;
}
.team::before { content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 4px; }
.team[data-side="0"]::before { background: linear-gradient(var(--side0), var(--side0-2)); }
.team[data-side="1"]::before { background: linear-gradient(var(--side1), var(--side1-2)); }
.team legend { font-weight: 800; padding: 0 6px; font-size: 0.82rem; text-transform: uppercase; letter-spacing: 0.06em; float: left; margin-bottom: 2px; }
.team legend + * { clear: both; }
.team[data-side="0"] legend { color: var(--side0); }
.team[data-side="1"] legend { color: var(--side1); }
.vs {
  align-self: center; display: grid; place-items: center; width: 40px; height: 40px; border-radius: 50%;
  font-weight: 800; font-size: 0.8rem; color: var(--muted); background: var(--glass-strong); border: 1px solid var(--glass-border);
  box-shadow: 0 6px 14px -8px rgba(31, 52, 110, 0.4);
}

.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 18px; }
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0 18px; }
.advanced { margin: 4px 0 8px; padding: 12px 16px; border-radius: 14px; background: var(--glass-soft); border: 1px solid var(--line); }
.advanced summary { cursor: pointer; font-weight: 700; color: var(--brand-ink); }
.advanced[open] summary { margin-bottom: 10px; }

/* scoreboard preview: a little "court" behind the board */
.preview-still {
  border-radius: 16px; overflow: hidden; margin: 8px 0 20px; position: relative;
  background:
    linear-gradient(180deg, rgba(0, 0, 0, 0.25), rgba(0, 0, 0, 0) 60%),
    radial-gradient(120% 140% at 70% 120%, #1fa16a 0%, #13784e 40%, #0e3d33 75%, #0c1f3a 100%);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.25), 0 18px 34px -20px rgba(10, 40, 30, 0.7);
}
.preview-still::after { content: 'Preview'; position: absolute; right: 12px; bottom: 10px; font-size: 0.7rem; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: rgba(255, 255, 255, 0.7); }
.preview-still canvas { display: block; width: 100%; height: auto; }

.actions { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; margin-top: 10px; }

/* ---------- buttons ---------- */
.btn {
  font: inherit; font-weight: 650; font-size: 0.94rem; color: var(--text); cursor: pointer;
  padding: 10px 18px; border-radius: 12px;
  background: rgba(255, 255, 255, 0.82); border: 1px solid var(--line-strong);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.9) inset, 0 4px 12px -6px rgba(31, 52, 110, 0.25);
  transition: transform 0.12s, box-shadow 0.2s, background 0.2s, filter 0.2s;
}
.btn:hover { transform: translateY(-1px); background: #fff; box-shadow: 0 1px 0 rgba(255, 255, 255, 0.9) inset, 0 10px 20px -10px rgba(31, 52, 110, 0.4); }
.btn:active { transform: translateY(0); }
.btn:focus-visible { outline: none; box-shadow: var(--ring); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }
.btn.primary {
  color: #fff; border-color: transparent;
  background: linear-gradient(135deg, #2f6bff 0%, #4d82ff 60%, #6a9bff 100%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.35), 0 12px 26px -12px rgba(47, 107, 255, 0.9);
}
.btn.primary:hover { filter: brightness(1.05); box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.35), 0 16px 30px -12px rgba(47, 107, 255, 1); }
.btn.big { padding: 13px 26px; font-size: 1.02rem; border-radius: 14px; }
.btn.small { padding: 6px 11px; font-size: 0.84rem; border-radius: 10px; }
.btn.ghost { background: transparent; box-shadow: none; border-color: transparent; color: var(--muted); }
.btn.ghost:hover { background: rgba(255, 255, 255, 0.7); color: var(--text); }
.btn.icon { padding: 9px 12px; min-width: 54px; }

/* ---------- scoring screen ---------- */
.score-layout { display: grid; grid-template-columns: minmax(0, 1fr) 350px; gap: 20px; align-items: start; }
.player-col { min-width: 0; }
.stage {
  position: relative; background: #0b1020; border-radius: 20px; overflow: hidden; width: 100%; max-height: 72vh; margin: 0 auto;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.8), 0 30px 60px -28px rgba(15, 27, 51, 0.6);
}
.stage video, .stage canvas { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; }
.stage canvas { pointer-events: none; }
#yt-wrap { position: absolute; inset: 0; }
#yt-wrap iframe { width: 100%; height: 100%; border: 0; display: block; }
#yt-catcher { position: absolute; inset: 0; cursor: pointer; }
.flash {
  position: absolute; left: 50%; bottom: 18px; transform: translateX(-50%) translateY(6px); padding: 9px 18px; border-radius: 999px;
  background: rgba(255, 255, 255, 0.82); color: var(--text); font-weight: 700; font-size: 0.95rem; white-space: nowrap;
  -webkit-backdrop-filter: var(--blur); backdrop-filter: var(--blur);
  box-shadow: 0 10px 30px -10px rgba(0, 0, 0, 0.5);
  opacity: 0; transition: opacity 0.25s, transform 0.25s; pointer-events: none;
}
.flash.show { opacity: 1; transform: translateX(-50%) translateY(0); }

.transport {
  display: flex; align-items: center; gap: 8px; margin: 14px 0; padding: 8px; border-radius: 16px;
  background: var(--glass); border: 1px solid var(--glass-border); box-shadow: var(--shadow);
  -webkit-backdrop-filter: var(--blur); backdrop-filter: var(--blur);
}
.transport .btn { box-shadow: none; }
.transport input[type="range"] { flex: 1; margin: 0 6px; }
.transport select { width: auto; padding: 8px 30px 8px 12px; background-position: right 10px center; }
#time { color: var(--muted); }

.point-buttons { display: grid; grid-template-columns: 1fr auto; grid-template-rows: auto auto; gap: 10px 12px; margin: 6px 0 10px; }
.btn.point {
  display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 14px; padding: 14px 18px;
  color: #fff; border: none; min-width: 0; text-align: left; border-radius: 16px; position: relative; overflow: hidden;
}
.btn.point::after { /* glass sheen */
  content: ''; position: absolute; inset: 0 0 50% 0; background: linear-gradient(180deg, rgba(255, 255, 255, 0.28), rgba(255, 255, 255, 0)); pointer-events: none;
}
.btn.point.side0 { background: linear-gradient(135deg, var(--side0), var(--side0-2)); box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.35), 0 14px 28px -14px rgba(47, 107, 255, 0.95); }
.btn.point.side1 { background: linear-gradient(135deg, var(--side1), var(--side1-2)); box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.35), 0 14px 28px -14px rgba(236, 63, 124, 0.95); }
.btn.point:hover { filter: brightness(1.05); }
#point-far { grid-column: 1; grid-row: 1; }
#point-near { grid-column: 1; grid-row: 2; }
.btn.undo { grid-column: 2; grid-row: 1 / span 2; align-self: stretch; border-radius: 16px; padding: 0 22px; }
.btn.point .who { font-size: 1.3rem; font-weight: 800; letter-spacing: -0.01em; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.btn.point .key {
  font-size: 1.25rem; font-weight: 800; width: 38px; height: 38px; display: grid; place-items: center; border-radius: 11px;
  background: rgba(255, 255, 255, 0.24); box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.35);
}
.btn.point .sub { font-size: 0.78rem; opacity: 0.9; font-weight: 600; text-align: right; text-transform: uppercase; letter-spacing: 0.05em; }
.btn.point.hit { filter: brightness(1.25); transform: scale(0.99); }

.side-col { position: sticky; top: 92px; padding: 18px; max-height: calc(100vh - 110px); display: flex; flex-direction: column; }
.side-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-bottom: 12px; }
.side-head h3 { margin: 0; display: flex; align-items: center; gap: 8px; }
.pill { display: inline-block; padding: 1px 9px; border-radius: 999px; font-size: 0.78rem; font-weight: 700; color: var(--brand-ink); background: rgba(47, 107, 255, 0.1); }
.summary { font-size: 0.9rem; margin-bottom: 12px; padding: 10px 12px; border-radius: 14px; background: var(--glass-soft); border: 1px solid var(--line); }
.summary.big { font-size: 1rem; margin-bottom: 22px; padding: 14px 16px; }
.summary table { border-collapse: collapse; width: 100%; }
.summary td { padding: 5px 6px; text-align: center; font-variant-numeric: tabular-nums; }
.summary tr + tr td { border-top: 1px solid var(--line); }
.summary td:first-child { text-align: left; font-weight: 700; }
.summary td.win { font-weight: 800; color: var(--brand-ink); }
.summary .status { margin-top: 6px; font-weight: 700; color: var(--warn); font-size: 0.85rem; }

.rally-list { list-style: none; margin: 0; padding: 0; overflow-y: auto; flex: 1; min-height: 120px; }
.rally-list li {
  display: grid; grid-template-columns: 30px 52px 1fr auto; gap: 6px; align-items: center;
  padding: 7px 8px; margin-bottom: 3px; border-radius: 10px; font-size: 0.88rem; cursor: pointer; transition: background 0.15s;
}
.rally-list li:hover { background: rgba(255, 255, 255, 0.75); }
.rally-list li.current { background: linear-gradient(90deg, rgba(255, 204, 51, 0.32), rgba(255, 204, 51, 0.1)); box-shadow: inset 3px 0 0 #f2b600; }
.rally-list li.ignored { opacity: 0.45; }
.rally-list .n { color: var(--faint); font-size: 0.76rem; font-weight: 600; }
.rally-list .mono { color: var(--muted); }
.rally-list .who0 { color: var(--side0); font-weight: 700; }
.rally-list .who1 { color: var(--side1); font-weight: 700; }
.rally-list .sc { font-weight: 800; font-variant-numeric: tabular-nums; }
.rally-list .game-end { font-size: 0.68rem; font-weight: 800; color: #8a5a00; background: rgba(255, 204, 51, 0.35); padding: 1px 6px; border-radius: 6px; margin-left: 6px; }
.rally-list button { border: none; background: none; color: var(--faint); cursor: pointer; font-size: 0.9rem; padding: 3px 7px; border-radius: 8px; }
.rally-list button:hover { background: rgba(236, 63, 124, 0.1); color: var(--side1); }
.side-foot { display: flex; justify-content: space-between; gap: 8px; margin-top: 12px; flex-wrap: wrap; }
.keys { margin-top: 10px; font-size: 0.85rem; }
.keys summary { cursor: pointer; color: var(--muted); font-weight: 600; }
.keys ul { padding-left: 18px; margin: 8px 0 0; color: var(--muted); }
.keys li { margin-bottom: 3px; }
kbd {
  font-family: ui-monospace, monospace; font-size: 0.76rem; font-weight: 600; color: var(--text);
  border: 1px solid var(--line-strong); border-bottom-width: 2px; border-radius: 6px; padding: 0 5px; background: #fff;
}

/* ---------- export screen ---------- */
.export-options { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.option { border-radius: 18px; padding: 20px; background: var(--glass-soft); }
.option h3, h3.mt { font-size: 1.05rem; display: flex; align-items: center; gap: 10px; }
.opt-icon {
  display: inline-grid; place-items: center; width: 32px; height: 32px; border-radius: 10px; font-size: 0.95rem; flex: none;
  background: linear-gradient(135deg, rgba(47, 107, 255, 0.16), rgba(91, 140, 255, 0.08)); box-shadow: inset 0 0 0 1px rgba(47, 107, 255, 0.18);
}
.opt-icon.green { background: linear-gradient(135deg, rgba(25, 179, 122, 0.2), rgba(25, 179, 122, 0.06)); box-shadow: inset 0 0 0 1px rgba(25, 179, 122, 0.25); }
.opt-icon.red { color: #e02424; font-size: 0.8rem; background: linear-gradient(135deg, rgba(224, 36, 36, 0.15), rgba(224, 36, 36, 0.05)); box-shadow: inset 0 0 0 1px rgba(224, 36, 36, 0.2); }
.option .field { margin-top: 12px; }
.progress { margin-top: 16px; }
.progress .bar { height: 12px; border-radius: 999px; overflow: hidden; background: rgba(15, 27, 51, 0.07); box-shadow: inset 0 1px 2px rgba(15, 27, 51, 0.08); }
#progress-fill {
  height: 100%; width: 0; border-radius: 999px; transition: width 0.3s;
  background: linear-gradient(90deg, var(--brand), #19b37a);
  box-shadow: 0 0 12px rgba(47, 107, 255, 0.45);
}
.progress-row { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-top: 8px; font-size: 0.88rem; color: var(--muted); }
#yt-text { min-height: 190px; }

.foot { text-align: center; padding: 10px 16px 36px; color: var(--faint); }

@media (max-width: 900px) {
  .score-layout { grid-template-columns: 1fr; }
  .side-col { position: static; max-height: none; }
  .rally-list { max-height: 320px; }
  .export-options { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
  .topbar { top: 8px; margin-top: 8px; width: calc(100% - 16px); padding: 8px; }
  .brand-text small { display: none; }
  .steps { width: 100%; justify-content: space-between; }
  .step { padding: 5px 8px 5px 5px; font-size: 0.76rem; }
  .hero { padding: 14px 4px 22px; }
  .teams { grid-template-columns: 1fr; }
  .vs { justify-self: center; }
  .grid2, .grid3 { grid-template-columns: 1fr; }
  .screen { padding: 0 12px; margin-top: 18px; }
  .card { padding: 18px; border-radius: 18px; }
  .transport { flex-wrap: wrap; gap: 6px; }
  .transport input[type="range"] { order: -1; flex-basis: 100%; margin: 6px 4px 4px; }
  .transport .btn.icon { min-width: 0; padding: 8px 10px; }
  #time { flex: 1; text-align: center; font-size: 0.8rem; }
  .transport select { padding: 7px 26px 7px 10px; }
  .btn.point .who { font-size: 1.08rem; }
  .btn.point .sub { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}
