:root {
    --bg: #080b12;
    --panel: #101723;
    --panel2: #0c121d;
    --line: #26364c;
    --text: #eef3fb;
    --muted: #98a7ba;
    --red: #ff304f;
    --blue: #2aa8ff;
    --gold: #ffbf3c;
    --green: #37d48b;
}
* { box-sizing: border-box; }
body {
    margin: 0;
    font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    background:
        radial-gradient(circle at 10% 0%, rgba(255,48,79,.16), transparent 35%),
        radial-gradient(circle at 90% 0%, rgba(42,168,255,.16), transparent 35%),
        var(--bg);
    color: var(--text);
}
a { color: #8bcfff; text-decoration: none; }
a:hover { text-decoration: underline; }
.page { width: min(1220px, calc(100% - 32px)); margin: 0 auto; padding: 30px 0 50px; }
.page.narrow { width: min(560px, calc(100% - 32px)); padding-top: 70px; }
.hero, .topbar {
    display: flex; justify-content: space-between; gap: 20px; align-items: center;
    margin-bottom: 24px; padding: 24px 26px; border: 1px solid var(--line);
    border-radius: 18px; background: linear-gradient(100deg, rgba(255,48,79,.10), rgba(16,23,35,.95) 43%, rgba(42,168,255,.10));
}
.hero h1, .topbar h1 { margin: 2px 0 6px; font-size: clamp(30px, 5vw, 52px); }
.hero p, .topbar p { margin: 0; color: var(--muted); }
.eyebrow { text-transform: uppercase; letter-spacing: .16em; color: var(--gold); font-size: 12px; font-weight: 800; }
.card { background: rgba(16,23,35,.94); border: 1px solid var(--line); border-radius: 18px; padding: 22px; margin-bottom: 22px; box-shadow: 0 18px 50px rgba(0,0,0,.22); }
.card h1, .card h2 { margin-top: 0; }
.muted, .note { color: var(--muted); }
.note { font-size: 13px; margin-bottom: 0; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; min-width: 650px; }
th, td { padding: 12px 11px; border-bottom: 1px solid #1e2b3c; text-align: center; }
th:nth-child(2), td:nth-child(2) { text-align: left; }
th { color: #aab8ca; text-transform: uppercase; font-size: 12px; letter-spacing: .06em; }
.points { font-size: 22px; font-weight: 900; color: var(--gold); }
.match-list { display: grid; gap: 10px; }
.match-card {
    display: grid;
    grid-template-columns: 56px minmax(100px,1fr) 52px minmax(100px,1fr) minmax(230px,1.3fr);
    gap: 10px; align-items: center; padding: 12px; border-radius: 12px;
    background: var(--panel2); border: 1px solid #1f2c3d;
}
.match-number { color: var(--muted); font-weight: 800; }
.player { padding: 10px 12px; border-radius: 9px; font-weight: 800; text-align: center; }
.p1 { background: linear-gradient(90deg, rgba(255,48,79,.24), rgba(255,48,79,.06)); border: 1px solid rgba(255,48,79,.38); }
.p2 { background: linear-gradient(90deg, rgba(42,168,255,.06), rgba(42,168,255,.24)); border: 1px solid rgba(42,168,255,.38); }
.player.winner { outline: 2px solid var(--gold); color: #fff8dd; }
.vs { text-align: center; font-weight: 1000; color: var(--gold); font-style: italic; }
.result-text { color: var(--muted); font-size: 14px; }
.finished .result-text { color: var(--green); font-weight: 700; }
.admin-link, .button-link, button {
    display: inline-block; border: 0; border-radius: 10px; padding: 10px 15px;
    background: linear-gradient(135deg, #167fd4, #22a6f4); color: white; font-weight: 800; cursor: pointer;
}
.button-link:hover, .admin-link:hover { text-decoration: none; filter: brightness(1.08); }
.button-link.secondary { background: #26354a; }
.button-link.danger { background: #9c2940; }
.form-stack { display: grid; gap: 14px; }
label { display: grid; gap: 6px; color: #b7c3d1; font-size: 13px; font-weight: 700; }
input, select {
    width: 100%; padding: 10px 11px; border-radius: 9px; border: 1px solid #32435a;
    background: #0a111c; color: var(--text); outline: none;
}
input:focus, select:focus { border-color: var(--blue); }
.alert { padding: 12px 14px; border-radius: 10px; margin: 0 0 18px; }
.alert.success { background: rgba(55,212,139,.14); border: 1px solid rgba(55,212,139,.42); }
.alert.error { background: rgba(255,48,79,.14); border: 1px solid rgba(255,48,79,.42); }
.top-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.admin-match-list { display: grid; gap: 10px; }
.admin-match-row {
    display: grid;
    grid-template-columns: 54px minmax(220px,1.4fr) minmax(130px,.8fr) minmax(200px,1fr) minmax(140px,.8fr) auto minmax(180px,1fr);
    gap: 10px; align-items: end; padding: 12px; border-radius: 12px; background: #0b121d; border: 1px solid #1e2c3e;
}
.match-id { font-weight: 900; color: var(--gold); align-self: center; }
.match-name { display: flex; justify-content: center; align-items: center; gap: 10px; font-weight: 900; align-self: center; }
.match-name b { color: var(--gold); }
.saved-result { color: var(--muted); font-size: 13px; align-self: center; }
.saved-result.done { color: var(--green); font-weight: 700; }
@media (max-width: 980px) {
    .admin-match-row { grid-template-columns: 44px 1fr 1fr; }
    .admin-match-row .match-name { grid-column: 2 / -1; justify-content: flex-start; }
    .saved-result { grid-column: 1 / -1; }
}
@media (max-width: 760px) {
    .hero, .topbar { align-items: flex-start; flex-direction: column; }
    .match-card { grid-template-columns: 44px 1fr 40px 1fr; }
    .result-text { grid-column: 2 / -1; }
    .admin-match-row { grid-template-columns: 1fr; }
    .admin-match-row .match-name, .saved-result { grid-column: auto; }
}
