:root {
  --bg: #131f33;
  --panel: #1a2941;
  --panel2: #22344f;
  --panel3: #18253a;
  --text: #edf2f9;
  --muted: #a6b5c9;
  --line: #32445f;
  --accent: #38bdf8;
  --accent2: #0ea5e9;
  --green: #22c55e;
  --red: #ef4444;
  --yellow: #f59e0b;
  --gold: #fbbf24;
  --silver: #cbd5e1;
  --bronze: #d97706;
  --radius: 14px;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: radial-gradient(1200px 600px at 20% -10%, #25425f 0%, var(--bg) 58%);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}
button, input, select, textarea { font-family: inherit; }
button { cursor: pointer; }
.hidden { display: none !important; }

.topbar {
  display: flex; align-items: center; gap: 16px; flex-wrap: wrap;
  padding: 10px 20px; min-height: 66px;
  background: rgba(22, 34, 54, .92);
  border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 30;
  backdrop-filter: blur(10px);
}
.brand { display: flex; align-items: center; gap: 11px; min-width: 220px; }
.logo {
  width: 38px; height: 38px; border-radius: 11px;
  display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, #6A005F, #8E3E86);
  color: #fff; font-weight: 900; font-size: 13px; letter-spacing: .5px;
}
.event-name { font-size: 19px; font-weight: 800; line-height: 1.2; }
.meta { font-size: 12px; color: var(--muted); margin-top: 3px; }
.top-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.top-actions button {
  background: var(--panel2); color: var(--text);
  border: 1px solid var(--line); border-radius: 9px;
  padding: 8px 12px; font-size: 12.5px; font-weight: 600;
}
.top-actions button:hover { border-color: #3b82f6; color: #fff; }
.top-actions button:disabled { opacity: .4; cursor: not-allowed; }
.event-select, .event-filter {
  background: var(--panel2); color: var(--text); border: 1px solid var(--line);
  border-radius: 9px; padding: 8px 10px; font-size: 12.5px; font-weight: 600;
  max-width: 190px; flex: 0 0 auto;
}
.event-filter { margin-left: 2px; }
.event-select:disabled, .event-filter:disabled { opacity: .5; }
.role-badge { font-size: 11px; font-weight: 700; padding: 3px 8px; border-radius: 999px; border: 1px solid var(--line); color: var(--muted); white-space: nowrap; flex: 0 0 auto; }
.role-badge:empty { display: none; }
.role-badge.super { color: var(--gold); border-color: var(--gold); }
.role-badge.operator { color: var(--accent); border-color: var(--accent); }
body.role-operator .super-only { display: none !important; }
.conn { margin-left: auto; display: flex; align-items: center; gap: 7px; font-size: 12px; color: var(--muted); white-space: nowrap; }
.conn .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--yellow); }
.conn.ok .dot { background: var(--green); box-shadow: 0 0 8px var(--green); }
.conn.bad .dot { background: var(--red); }
.clock { font-variant-numeric: tabular-nums; color: #d3dce8; }
.theme-toggle { display: flex; align-items: center; gap: 2px; margin-left: 4px; background: var(--panel2); border: 1px solid var(--line); border-radius: 999px; padding: 3px; color: var(--muted); flex: 0 0 auto; }
.theme-toggle span { width: 30px; height: 30px; display: flex; align-items: center; justify-content: center; border-radius: 999px; transition: background .15s, color .15s; }
.theme-toggle svg { display: block; }
.theme-toggle:hover { border-color: #3b82f6; }
html:not([data-theme="light"]) .theme-toggle .moon { background: var(--accent); color: #06121f; }

.layout { display: flex; gap: 16px; padding: 16px 20px; height: calc(100vh - 66px); }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); display: flex; flex-direction: column; min-height: 0; box-shadow: 0 10px 30px rgba(0,0,0,.16); }
.left { flex: 3; min-width: 0; }
.right { flex: 2; min-width: 0; }
.multi-head-hint { font-size: 11.5px; color: var(--muted); font-weight: 500; }
.multi-match-columns { display: flex; gap: 12px; padding: 12px; flex: 1; min-height: 0; overflow: hidden; }
.multi-cat-column { flex: 1 1 0; min-width: 0; display: flex; flex-direction: column; min-height: 0; background: var(--panel2); border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.multi-cat-head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; padding: 8px 10px; border-bottom: 1px solid var(--line); flex: 0 0 auto; }
.multi-cat-head h3 { margin: 0; font-size: 15px; }
.multi-cat-head span { font-size: 10.5px; color: var(--muted); }
.multi-cat-scroll { flex: 1; overflow: auto; padding: 8px 10px; min-height: 0; }
.multi-cat-scroll .match-grid { grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 7px; }
.multi-round-block { margin-bottom: 10px; }
.multi-round-block h4 { margin: 0 0 5px; font-size: 11px; color: var(--muted); font-weight: 700; letter-spacing: .3px; }
.multi-cat-scroll .match { padding: 6px 8px; border-radius: 8px; }
.multi-cat-scroll .match-top { margin-bottom: 2px; min-height: 14px; }
.multi-cat-scroll .badge { font-size: 9px; padding: 1px 5px; }
.multi-cat-scroll .court { font-size: 9px; }
.multi-cat-scroll .team { font-size: 11.5px; padding: 2px 0; gap: 5px; }
.multi-cat-scroll .team .score { font-size: 15px; }
.multi-cat-scroll .team .pair { font-size: 9px; }
.multi-cat-scroll .games { font-size: 9px; margin-top: 3px; min-height: 11px; }
.multi-cat-scroll .rubber-tag { font-size: 8.5px; padding: 0 4px; }
.multi-rank-list { flex: 1; overflow: auto; padding: 12px 15px; min-height: 0; }
.multi-rank-list .group-title { margin: 12px 0 5px; font-size: 12px; }
.multi-rank-list .group-title:first-child { margin-top: 0; }
.multi-rank-list .standings-table { font-size: 12px; }
.multi-rank-list .standings-table th, .multi-rank-list .standings-table td { padding: 6px 4px; }
.multi-rank-block { margin-bottom: 14px; }
.multi-rank-title { margin: 0 0 6px; font-size: 13px; font-weight: 700; color: var(--text); }
.multi-rank-bracket .bracket-board { padding-bottom: 4px; }
body[data-mode="display"] .multi-cat-scroll .team { font-size: 11.5px; }
body[data-mode="display"] .multi-cat-scroll .team .score { font-size: 15px; }
body[data-mode="display"] .multi-cat-scroll .team .pair { font-size: 9px; }
body[data-mode="display"] .multi-rank-list .standings-table { font-size: 12.5px; }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 15px; border-bottom: 1px solid var(--line); }
.panel-head h2 { margin: 0; font-size: 15px; letter-spacing: .4px; }
.panel-head select { background: var(--panel2); color: var(--text); border: 1px solid var(--line); border-radius: 8px; padding: 7px 9px; font-size: 12px; }
.match-list, .standings, .bracket { overflow: auto; padding: 12px 15px; flex: 1; min-height: 0; }
.empty { color: var(--muted); font-size: 13px; padding: 26px 8px; text-align: center; line-height: 1.8; }

.round-block { margin-bottom: 18px; }
.round-block h3 { margin: 0 0 9px; font-size: 12.5px; color: var(--muted); font-weight: 700; letter-spacing: .5px; }
.match-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.match { position: relative; background: var(--panel2); border: 1px solid var(--line); border-radius: 11px; padding: 10px 12px; transition: border-color .15s, transform .15s, background .15s; }
.match:hover { border-color: #3b82f6; }
body[data-mode="admin"] .match:not(.bye) { cursor: pointer; }
body[data-mode="admin"] .match:not(.bye):hover { transform: translateY(-1px); }
.match.live { border-color: var(--accent); box-shadow: 0 0 0 2px rgba(56,189,248,.10); }
.match.done { opacity: .88; }
.match.winner-a .team.a, .match.winner-b .team.b { color: var(--green); }
.match-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 5px; min-height: 17px; }
.badge { font-size: 10px; font-weight: 700; border-radius: 999px; padding: 2px 7px; background: #2a3c58; color: var(--muted); }
.badge.live { color: #06121f; background: var(--accent); }
.badge.done { color: #052e16; background: #86efac; }
.badge.bye { color: #78350f; background: #fde68a; }
.court { font-size: 10.5px; color: var(--muted); }
.team { display: flex; align-items: center; gap: 8px; padding: 4px 0; font-size: 14px; font-weight: 600; min-width: 0; }
.team .name-wrap { display: flex; flex-direction: column; min-width: 0; flex: 1; gap: 1px; }
.team .name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.team .pair { font-size: 10.5px; color: var(--muted); font-weight: 500; line-height: 1.25; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
body[data-mode="display"] .team .pair { font-size: 12px; }
.team .score { margin-left: auto; font-size: 19px; font-weight: 800; font-variant-numeric: tabular-nums; color: #d3dce8; }
.team.winner .score { color: var(--green); }
.dot { width: 8px; height: 8px; border-radius: 50%; flex: 0 0 auto; }
.games { margin-top: 5px; font-size: 10.5px; color: var(--muted); min-height: 14px; font-variant-numeric: tabular-nums; }
.current-game { display: inline-block; background: rgba(56,189,248,.16); color: var(--accent); border-radius: 5px; padding: 1px 5px; font-weight: 700; margin-right: 4px; }
.rubber-tag { display: inline-block; border: 1px solid var(--line); border-radius: 999px; padding: 1px 6px; margin-right: 6px; font-size: 10px; color: var(--muted); }
body[data-mode="display"] .games { font-size: 12.5px; }
.lock-mark { position: absolute; right: 9px; bottom: 7px; font-size: 10px; color: var(--yellow); }

table.standings-table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.standings-table th { color: var(--muted); font-weight: 600; text-align: right; padding: 7px 5px; border-bottom: 1px solid var(--line); position: sticky; top: 0; background: var(--panel); }
.standings-table th:nth-child(1), .standings-table th:nth-child(2) { text-align: left; }
.standings-table td { padding: 7px 5px; border-bottom: 1px solid rgba(50,68,95,.55); text-align: right; font-variant-numeric: tabular-nums; }
.standings-table td:nth-child(1), .standings-table td:nth-child(2) { text-align: left; }
.standings-table tr.top1 td { background: rgba(251,191,36,.20); }
.standings-table tr.top2 td { background: rgba(203,213,225,.16); }
.standings-table tr.top3 td { background: rgba(217,119,6,.20); }
.standings-table tr.top1 .rank-num { color: var(--gold); font-weight: 800; }
.standings-table tr.top2 .rank-num { color: var(--silver); font-weight: 800; }
.standings-table tr.top3 .rank-num { color: var(--bronze); font-weight: 800; }
.rank-num { display: inline-flex; width: 20px; justify-content: flex-start; color: var(--muted); }
.rank-up { color: var(--green); font-size: 10px; margin-left: 3px; }
.rank-down { color: var(--red); font-size: 10px; margin-left: 3px; }
.group-title { margin: 14px 0 6px; font-size: 13px; font-weight: 700; color: #d3dce8; }
.group-title:first-child { margin-top: 0; }

.bracket-board { display: flex; gap: 12px; overflow: auto; padding-bottom: 6px; }
.bracket-col { min-width: 155px; display: flex; flex-direction: column; gap: 8px; }
.bracket-col h4 { margin: 0 0 2px; font-size: 11px; color: var(--muted); font-weight: 700; text-align: center; }
.bracket-item { background: var(--panel2); border: 1px solid var(--line); border-radius: 8px; padding: 7px 8px; font-size: 11.5px; line-height: 1.55; }
.bracket-item .win { color: var(--green); font-weight: 700; }
.bracket-item .dim { color: var(--muted); }
.final-rank { margin-top: 16px; }
.final-rank h3 { margin: 0 0 8px; font-size: 13px; }
.rank-list { list-style: none; margin: 0; padding: 0; }
.rank-list li { display: flex; align-items: center; gap: 8px; padding: 5px 0; border-bottom: 1px solid rgba(50,68,95,.55); font-size: 12.5px; }
.rank-list .place { width: 26px; color: var(--muted); font-weight: 700; }
.rank-list .note { margin-left: auto; color: var(--muted); font-size: 10.5px; }
.logs-content { max-height: 62vh; overflow: auto; }
.logs-table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.logs-table th { position: sticky; top: 0; background: var(--panel); color: var(--muted); text-align: left; padding: 7px 8px; border-bottom: 1px solid var(--line); }
.logs-table td { padding: 7px 8px; border-bottom: 1px solid rgba(50,68,95,.55); vertical-align: top; line-height: 1.55; }
.logs-table .t { white-space: nowrap; color: var(--muted); font-variant-numeric: tabular-nums; }
.logs-table .a { white-space: nowrap; font-weight: 700; }
.logs-table .d { color: #d3dce8; word-break: break-word; }

.overlay { position: fixed; inset: 0; z-index: 100; background: rgba(8,14,25,.62); backdrop-filter: blur(4px); display: flex; align-items: center; justify-content: center; padding: 18px; }
.overlay-card { width: 100%; max-width: 540px; max-height: 90vh; overflow: auto; background: var(--panel); border: 1px solid var(--line); border-radius: 16px; padding: 20px 22px; box-shadow: 0 24px 80px rgba(0,0,0,.55); }
.overlay-card.wide { max-width: 860px; }
.overlay-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.overlay-head h2 { margin: 0; font-size: 18px; }
.icon-btn { background: transparent; color: var(--muted); border: 0; font-size: 22px; line-height: 1; padding: 2px 6px; }
.icon-btn:hover { color: #fff; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 11px; }
label.field { display: flex; flex-direction: column; gap: 5px; font-size: 12px; color: var(--muted); }
label.field.full { grid-column: 1 / -1; }
label.field input, label.field select, label.field textarea {
  width: 100%; background: var(--panel2); border: 1px solid var(--line); border-radius: 8px;
  color: var(--text); padding: 9px 10px; font-size: 13px; outline: none;
}
label.field input:focus, label.field select:focus, label.field textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(56,189,248,.12); }
label.field textarea { resize: vertical; line-height: 1.55; }
.row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-top: 11px; }
.row button, .overlay-actions button, .score-actions button {
  background: var(--panel2); color: var(--text); border: 1px solid var(--line);
  border-radius: 8px; padding: 8px 12px; font-size: 12.5px; font-weight: 600;
}
.row button:hover, .overlay-actions button:hover, .score-actions button:hover { border-color: #3b82f6; }
button.primary { background: linear-gradient(135deg, var(--accent), #6366f1); color: #06121f; border: 0; }
button.primary:hover { filter: brightness(1.08); }
button.danger { color: #fecaca; border-color: #7f1d1d; }
.overlay-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 16px; }
.preview { margin-top: 10px; font-size: 12px; color: var(--muted); line-height: 1.7; white-space: pre-wrap; background: rgba(30,43,63,.65); border: 1px solid var(--line); border-radius: 8px; padding: 9px 11px; min-height: 18px; }
.form-error { color: #fca5a5; font-size: 12.5px; margin-top: 10px; white-space: pre-wrap; }
.login-card { max-width: 420px; text-align: center; }
.login-card h2 { margin: 0 0 6px; }
.login-card p { color: var(--muted); font-size: 12.5px; margin: 0 0 16px; }
.login-card input { width: 100%; margin-bottom: 14px; background: var(--panel2); border: 1px solid var(--line); border-radius: 9px; color: var(--text); padding: 14px 16px; font-size: 16px; text-align: center; outline: none; }
.login-card input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(56,189,248,.12); }
.login-card input::placeholder { color: var(--muted); }
.login-card button { width: 100%; padding: 13px 16px; font-size: 15px; }
.password-card { max-width: 420px; }
.password-card .field { margin-bottom: 10px; }
.password-hint { font-size: 12px; color: var(--muted); line-height: 1.6; margin: 2px 0 0; }

.score-meta { display: flex; gap: 12px; flex-wrap: wrap; color: var(--muted); font-size: 12px; margin-bottom: 12px; }
.rubber-picker { display: flex; flex-wrap: wrap; gap: 6px; margin: -2px 0 10px; }
.rubber-picker.hidden { display: none; }
.rubber-btn { background: var(--panel2); border: 1px solid var(--line); color: var(--muted); border-radius: 999px; padding: 4px 10px; font-size: 11.5px; font-weight: 600; cursor: pointer; }
.rubber-btn:hover { border-color: #3b82f6; color: var(--text); }
.rubber-btn.active { border-color: var(--accent); color: var(--accent); background: rgba(56,189,248,.12); }
.rubber-btn.done { color: var(--green); }
.rubber-btn.live { color: var(--accent); }
.schedule-meta { display: flex; flex-wrap: wrap; gap: 12px; color: var(--muted); font-size: 12.5px; margin-bottom: 14px; }
.schedule-list { display: flex; flex-direction: column; gap: 10px; }
.schedule-item { background: var(--panel2); border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; }
.schedule-item.current { border-color: var(--accent); box-shadow: 0 0 0 2px rgba(56,189,248,.12); }
.sch-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 5px; }
.sch-index { font-size: 12px; font-weight: 700; color: var(--muted); }
.sch-team { display: flex; align-items: center; gap: 8px; padding: 4px 0; font-size: 14px; font-weight: 600; min-width: 0; }
.sch-team .sch-name { color: var(--muted); font-size: 11.5px; flex: 0 0 auto; }
.sch-team .sch-pair { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sch-team .sch-score { margin-left: auto; font-size: 18px; font-weight: 800; font-variant-numeric: tabular-nums; color: #d3dce8; }
.sch-team.win { color: var(--green); }
.sch-team.win .sch-score { color: var(--green); }
.sch-games { margin-top: 4px; font-size: 11.5px; color: var(--muted); }
.sch-games .dim { color: var(--muted); }
body[data-mode="display"] .match:not(.bye) { cursor: pointer; }
body[data-mode="display"] .match:not(.bye):hover { transform: translateY(-1px); }
body[data-mode="display"] .sch-team { font-size: 16px; }
body[data-mode="display"] .sch-team .sch-name { font-size: 12px; }
body[data-mode="display"] .sch-team .sch-score { font-size: 21px; }
body[data-mode="display"] .sch-games { font-size: 12.5px; }
.court-edit { display: flex; align-items: center; gap: 8px; margin: -4px 0 12px; font-size: 12.5px; color: var(--muted); }
.court-edit input { width: 100px; background: var(--panel2); border: 1px solid var(--line); border-radius: 8px; color: var(--text); padding: 7px 9px; font-size: 13px; text-align: center; outline: none; }
.court-edit input:focus { border-color: var(--accent); }
.court-edit button { background: var(--panel2); color: var(--text); border: 1px solid var(--line); border-radius: 8px; padding: 7px 10px; font-size: 12px; font-weight: 600; }
.court-edit button:hover { border-color: #3b82f6; }
.game-row { display: grid; grid-template-columns: 38px 1fr 18px 1fr 30px; gap: 8px; align-items: center; margin-bottom: 8px; }
.game-row .no { color: var(--muted); font-size: 12px; }
.game-row input { width: 100%; background: var(--panel2); border: 1px solid var(--line); border-radius: 8px; color: var(--text); padding: 9px 10px; font-size: 15px; text-align: center; outline: none; }
.game-row input:focus { border-color: var(--accent); }
.game-row .sep { text-align: center; color: var(--muted); }
.game-row .del { background: transparent; border: 0; color: var(--muted); font-size: 16px; }
.game-row .del:hover { color: var(--red); }
.score-actions { margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--line); }
.score-team-title { display: flex; justify-content: space-between; gap: 12px; font-size: 13px; font-weight: 700; margin: 4px 0 10px; }
.score-team-title span:last-child { color: var(--muted); font-weight: 500; }

.toast { position: fixed; left: 50%; bottom: 26px; transform: translateX(-50%) translateY(10px); background: #1b2a41; border: 1px solid var(--line); color: var(--text); border-radius: 10px; padding: 10px 16px; font-size: 13px; box-shadow: 0 12px 40px rgba(0,0,0,.45); opacity: 0; pointer-events: none; transition: .18s; z-index: 300; max-width: calc(100vw - 32px); }
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast.err { border-color: #7f1d1d; color: #fecaca; }

.awards-overlay { position: fixed; inset: 0; z-index: 200; background: radial-gradient(900px 500px at 50% 0%, #2a4a72 0%, #0c1423 70%); display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 30px; }
.awards-overlay.hidden { display: none; }
.awards-title { font-size: 30px; font-weight: 900; letter-spacing: 2px; margin-bottom: 36px; color: #f8fafc; }
.awards-podium { display: flex; align-items: flex-end; gap: 18px; margin-bottom: 34px; }
.podium-place { width: 190px; text-align: center; border-radius: 14px 14px 0 0; padding: 16px 10px 12px; background: linear-gradient(180deg, #2a3c58, #18253a); border: 1px solid var(--line); border-bottom: 0; }
.podium-place.first { height: 220px; border-color: #fbbf24; box-shadow: 0 0 40px rgba(251,191,36,.16); }
.podium-place.second { height: 180px; border-color: #d3dce8; }
.podium-place.third { height: 150px; border-color: #d97706; }
.podium-place .place-no { font-size: 13px; color: var(--muted); font-weight: 700; }
.podium-place.first .place-no { color: var(--gold); }
.podium-place .place-name { margin-top: 10px; font-size: 19px; font-weight: 900; line-height: 1.35; }
.podium-place.first .place-name { font-size: 24px; color: var(--gold); }
.podium-place .place-sub { margin-top: 6px; font-size: 11px; color: var(--muted); }
.awards-list { width: min(760px, 92vw); max-height: 34vh; overflow: auto; border-top: 1px solid rgba(166,181,201,.25); padding-top: 12px; }
.awards-list .rowline { display: flex; gap: 12px; padding: 7px 4px; font-size: 15px; border-bottom: 1px solid rgba(50,68,95,.6); }
.awards-list .rowline .r { width: 36px; color: var(--muted); font-weight: 700; }
.awards-list .rowline .n { font-weight: 700; }
.awards-list .rowline .note { margin-left: auto; color: var(--muted); font-size: 12px; }

body[data-mode="display"] .event-name { font-size: 24px; }
body[data-mode="display"] .team { font-size: 16px; }
body[data-mode="display"] .team .score { font-size: 23px; }
body[data-mode="display"] .standings-table { font-size: 14px; }
body[data-mode="display"] .match-grid { gap: 12px; }
body[data-mode="display"] .topbar { min-height: 72px; }

@media (max-width: 900px) {
  .layout { flex-direction: column; height: auto; }
  .left, .right { flex: none; }
  .match-grid { grid-template-columns: 1fr; }
  .right { min-height: 300px; }
  .form-grid { grid-template-columns: 1fr; }
  .top-actions { width: 100%; overflow-x: auto; flex-wrap: nowrap; padding-bottom: 2px; }
  .conn { margin-left: 0; }
  .event-select, .event-filter { max-width: 100%; }
  .multi-match-columns { flex-direction: column; padding: 10px; }
  .multi-cat-column { max-height: 60vh; }
  .multi-cat-scroll .match-grid { grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); }
  .awards-podium { gap: 8px; }
  .podium-place { width: 110px; }
  .podium-place .place-name { font-size: 15px; }
  .podium-place.first .place-name { font-size: 18px; }
  .awards-title { font-size: 22px; margin-bottom: 22px; }
}

html[data-theme="light"] {
  --bg: #f3f6fb;
  --panel: #ffffff;
  --panel2: #eef3f9;
  --panel3: #e4ecf6;
  --text: #1e293b;
  --muted: #64748b;
  --line: #cbd5e1;
  --accent: #0284c7;
  --accent2: #0369a1;
  --green: #15803d;
  --red: #dc2626;
  --yellow: #b45309;
  --gold: #b45309;
  --silver: #64748b;
  --bronze: #92400e;
}
html[data-theme="light"] body {
  background: radial-gradient(1200px 600px at 20% -10%, #dbeafe 0%, var(--bg) 58%);
}
html[data-theme="light"] .topbar { background: rgba(255,255,255,.92); }
html[data-theme="light"] .panel { box-shadow: 0 10px 30px rgba(15,23,42,.08); }
html[data-theme="light"] .badge { background: #e2e8f0; color: var(--muted); }
html[data-theme="light"] .badge.live { color: #082f49; background: #7dd3fc; }
html[data-theme="light"] .badge.done { color: #14532d; background: #bbf7d0; }
html[data-theme="light"] .badge.bye { color: #78350f; background: #fde68a; }
html[data-theme="light"] .standings-table tr.top1 td { background: #fde68a; }
html[data-theme="light"] .standings-table tr.top2 td { background: #e2e8f0; }
html[data-theme="light"] .standings-table tr.top3 td { background: #fed7aa; }
html[data-theme="light"] .clock,
html[data-theme="light"] .team .score,
html[data-theme="light"] .group-title,
html[data-theme="light"] .logs-table .d,
html[data-theme="light"] .sch-team .sch-score { color: #334155; }
html[data-theme="light"] .standings-table td,
html[data-theme="light"] .rank-list li,
html[data-theme="light"] .logs-table td,
html[data-theme="light"] .awards-list .rowline { border-bottom-color: rgba(148,163,184,.45); }
html[data-theme="light"] .match.live { box-shadow: 0 0 0 2px rgba(2,132,199,.12); }
html[data-theme="light"] .current-game { background: rgba(2,132,199,.12); color: var(--accent); }
html[data-theme="light"] .overlay { background: rgba(15,23,42,.32); }
html[data-theme="light"] .overlay-card { box-shadow: 0 24px 80px rgba(15,23,42,.25); }
html[data-theme="light"] .preview { background: #f8fafc; }
html[data-theme="light"] .toast { background: #ffffff; box-shadow: 0 12px 40px rgba(15,23,42,.2); }
html[data-theme="light"] .icon-btn:hover,
html[data-theme="light"] .top-actions button:hover { color: #0f172a; }
html[data-theme="light"] button.primary { color: #ffffff; }
html[data-theme="light"] .awards-overlay { background: radial-gradient(900px 500px at 50% 0%, #dbeafe 0%, #eef2f7 70%); }
html[data-theme="light"] .podium-place { background: linear-gradient(180deg, #ffffff, #e4ecf6); }
html[data-theme="light"] .awards-title { color: #0f172a; }
html[data-theme="light"] .awards-list { border-top-color: rgba(148,163,184,.4); }
html[data-theme="light"] .theme-toggle .sun { background: var(--accent); color: #ffffff; }
html[data-theme="light"] .theme-toggle .moon { background: transparent; color: var(--muted); }
