:root {
  --bg: #0f1218;
  --panel: #171b24;
  --panel-2: #1f2430;
  --line: #2a3140;
  --text: #e8ecf3;
  --muted: #8b94a7;
  --accent: #ffd400;
  --green: #2ecc71;
  --red: #ff4d4f;
  --blue: #3b82f6;
  --radius: 10px;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); font: 14px/1.45 Inter, system-ui, -apple-system, Segoe UI, Roboto, sans-serif; }
a { color: var(--accent); text-decoration: none; }
h1, h2, h3 { margin: 0 0 12px; font-weight: 700; letter-spacing: -.01em; }
h1 { font-size: 22px; } h2 { font-size: 16px; } h3 { font-size: 13px; text-transform: uppercase; letter-spacing: .1em; color: var(--muted); }
.wrap { max-width: 1400px; margin: 0 auto; padding: 20px; }
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 14px 20px; background: var(--panel); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 10; }
.topbar .brand { font-weight: 800; letter-spacing: .12em; text-transform: uppercase; font-size: 13px; color: var(--accent); }
.topbar .brand span { color: var(--muted); font-weight: 500; letter-spacing: 0; text-transform: none; margin-left: 10px; }
.row { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; }
.grid { display: grid; gap: 16px; }
.grid-2 { grid-template-columns: repeat(auto-fit, minmax(380px, 1fr)); }
.grid-3 { grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; }
.panel.sub { background: var(--panel-2); }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.mono { font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: 12px; }

button, .btn { cursor: pointer; border: 1px solid var(--line); background: var(--panel-2); color: var(--text); padding: 8px 14px; border-radius: 8px; font: inherit; font-weight: 600; transition: background .12s, transform .05s; white-space: nowrap; }
button:hover { background: #2a3040; }
button:active { transform: translateY(1px); }
button:disabled { opacity: .5; cursor: not-allowed; }
.btn-primary { background: var(--accent); color: #111; border-color: var(--accent); }
.btn-primary:hover { background: #ffe14d; }
.btn-green { background: var(--green); color: #052; border-color: var(--green); }
.btn-green:hover { background: #48d986; }
.btn-red { background: var(--red); color: #fff; border-color: var(--red); }
.btn-red:hover { background: #ff6b6d; }
.btn-blue { background: var(--blue); color: #fff; border-color: var(--blue); }
.btn-ghost { background: transparent; }
.btn-sm { padding: 5px 10px; font-size: 12px; border-radius: 6px; }
.btn-lg { padding: 14px 22px; font-size: 18px; }
.btn-xl { padding: 18px 26px; font-size: 26px; font-weight: 800; }

input, select, textarea { background: #0c0f15; color: var(--text); border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; font: inherit; width: 100%; }
input[type=color] { padding: 2px; height: 36px; width: 48px; }
input[type=checkbox] { width: auto; }
textarea { min-height: 90px; resize: vertical; }
label { display: block; font-size: 12px; color: var(--muted); margin-bottom: 4px; font-weight: 600; }
.field { margin-bottom: 10px; }
.field.inline { display: flex; align-items: center; gap: 8px; }
.field.inline label { margin: 0; }

.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 16px; }
.tabs button { background: transparent; border: 0; border-bottom: 2px solid transparent; border-radius: 0; padding: 10px 16px; color: var(--muted); }
.tabs button.active { color: var(--text); border-bottom-color: var(--accent); }
.tab { display: none; } .tab.active { display: block; }

table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 8px 8px; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { font-size: 11px; text-transform: uppercase; letter-spacing: .1em; color: var(--muted); }
tr:hover td { background: rgba(255,255,255,.02); }

.match-card { display: flex; flex-direction: column; gap: 10px; }
.match-card .teams { font-size: 18px; font-weight: 800; }
.match-card .score { font-size: 28px; font-weight: 800; font-variant-numeric: tabular-nums; }
.badge { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 11px; font-weight: 700; background: var(--panel-2); color: var(--muted); border: 1px solid var(--line); }
.badge.live { background: var(--red); color: #fff; border-color: var(--red); }
.linkbox { display: flex; gap: 6px; align-items: center; }
.linkbox input { font-family: ui-monospace, monospace; font-size: 12px; }

.big-score { display: flex; align-items: center; justify-content: center; gap: 24px; font-size: 64px; font-weight: 800; font-variant-numeric: tabular-nums; }
.big-score .t { font-size: 20px; font-weight: 700; text-transform: uppercase; text-align: center; min-width: 140px; }
.big-score .t .n { font-size: 56px; display: block; line-height: 1; }
.clock-display { font-size: 48px; font-weight: 800; font-variant-numeric: tabular-nums; text-align: center; }
.clock-display.running { color: var(--green); }
.period-btns button.active { background: var(--accent); color: #111; border-color: var(--accent); }

.roster { display: flex; flex-direction: column; gap: 6px; }
.roster-item { display: grid; grid-template-columns: 40px 1fr auto; gap: 10px; align-items: center; background: var(--panel-2); padding: 8px 10px; border-radius: 8px; border: 1px solid var(--line); }
.roster-item .num { font-weight: 800; font-size: 16px; text-align: center; color: var(--accent); }
.roster-item .name { font-weight: 600; }
.roster-item .pos { color: var(--muted); font-size: 12px; margin-left: 6px; }
.roster-item.bench { opacity: .6; }
.avatar { width: 32px; height: 32px; border-radius: 50%; object-fit: cover; object-position: top; background: #2a3040; vertical-align: middle; }
.toast { position: fixed; bottom: 20px; right: 20px; background: #222a38; color: #fff; padding: 10px 16px; border-radius: 8px; border: 1px solid var(--line); opacity: 0; transform: translateY(10px); transition: all .2s; z-index: 100; }
.toast.show { opacity: 1; transform: none; }
.toast.err { background: var(--red); }
.preview { background: #333; background-image: linear-gradient(45deg, #2a2a2a 25%, transparent 25%), linear-gradient(-45deg, #2a2a2a 25%, transparent 25%), linear-gradient(45deg, transparent 75%, #2a2a2a 75%), linear-gradient(-45deg, transparent 75%, #2a2a2a 75%); background-size: 24px 24px; background-position: 0 0, 0 12px, 12px -12px, -12px 0; border-radius: 8px; overflow: hidden; aspect-ratio: 16/9; position: relative; }
.preview iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.login { max-width: 380px; margin: 12vh auto; }
.kbd { font-family: ui-monospace, monospace; background: var(--panel-2); border: 1px solid var(--line); padding: 1px 6px; border-radius: 4px; font-size: 12px; }
.modal-bg { position: fixed; inset: 0; background: rgba(0,0,0,.6); display: none; align-items: center; justify-content: center; z-index: 50; }
.modal-bg.show { display: flex; }
.modal { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; width: 460px; max-width: 95vw; }
@media (max-width: 700px) {
  .big-score { font-size: 40px; gap: 12px; }
  .big-score .t .n { font-size: 40px; }
  .wrap { padding: 12px; }
}
