:root {
    --bg: #0e1116;
    --bg-soft: #161b23;
    --card: #171d26;
    --line: #252d3a;
    --text: #e6ebf2;
    --muted: #8b97a8;
    --accent: #f0a500;
    --accent-soft: rgba(240, 165, 0, .14);
    --win: #4ac97e;
    --lose: #e0555a;
    --radius: 14px;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    background:
        radial-gradient(1100px 500px at 15% -10%, #1d2635 0%, transparent 60%),
        var(--bg);
    color: var(--text);
    font: 15px/1.5 "Segoe UI", system-ui, -apple-system, Arial, sans-serif;
    min-height: 100vh;
}

.wrap {
    max-width: 960px;
    margin: 0 auto;
    padding: 28px 18px 60px;
}

body.admin .wrap { max-width: 1180px; }

/* ------------------------------------------------------------ шапка ---- */
.top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 24px;
}

.brand {
    display: flex;
    align-items: center;
    gap: 12px;
    color: inherit;
    text-decoration: none;
}

.brand-mark {
    display: grid;
    place-items: center;
    width: 44px;
    height: 44px;
    border-radius: 12px;
    background: var(--accent);
    color: #16181d;
    font-weight: 800;
    letter-spacing: .5px;
}

.brand strong { display: block; font-size: 18px; }
.brand small { color: var(--muted); }

.top-nav { display: flex; gap: 8px; }

.top-nav a {
    padding: 8px 14px;
    border: 1px solid var(--line);
    border-radius: 10px;
    color: var(--muted);
    text-decoration: none;
    transition: .15s;
}

.top-nav a:hover { color: var(--text); border-color: var(--accent); }

/* ------------------------------------------------------------- блоки ---- */
.card {
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 22px;
    margin-bottom: 18px;
}

.card h1 { margin: 8px 0 6px; font-size: 26px; }
.card h2 { margin: 0 0 14px; font-size: 18px; }
.empty { text-align: center; color: var(--muted); }
.muted { color: var(--muted); }
.hint { color: var(--muted); font-size: 13px; margin: 10px 0 0; }

.round-head {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 16px;
    flex-wrap: wrap;
}

.counter { text-align: right; }
.counter strong { display: block; font-size: 30px; color: var(--accent); }
.counter small { color: var(--muted); }

.badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 999px;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: .4px;
    border: 1px solid var(--line);
    color: var(--muted);
}

.badge-open { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); }
.badge-closed { color: #9fb0c6; }
.badge-draft { color: var(--muted); }

.flashes { margin-bottom: 16px; }

.flash {
    padding: 12px 16px;
    border-radius: 10px;
    border: 1px solid var(--line);
    background: var(--bg-soft);
    margin-bottom: 8px;
}

.flash-success { border-color: rgba(74, 201, 126, .5); color: var(--win); }
.flash-error { border-color: rgba(224, 85, 90, .5); color: var(--lose); }

.your-pick {
    margin: 16px 0;
    padding: 12px 16px;
    border-radius: 10px;
    background: var(--accent-soft);
    border: 1px solid rgba(240, 165, 0, .35);
}

.tag {
    display: inline-block;
    margin-left: 6px;
    padding: 2px 8px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 600;
}

.tag-win { background: rgba(74, 201, 126, .18); color: var(--win); }
.tag-lose { background: rgba(224, 85, 90, .18); color: var(--lose); }

/* -------------------------------------------------------------- формы ---- */
.field { display: block; margin-bottom: 14px; }
.field > span, .field-label {
    display: block;
    margin-bottom: 6px;
    font-size: 13px;
    color: var(--muted);
}

input[type="text"],
input[type="password"],
select,
textarea {
    width: 100%;
    padding: 11px 13px;
    background: var(--bg-soft);
    border: 1px solid var(--line);
    border-radius: 10px;
    color: var(--text);
    font: inherit;
    resize: vertical;
}

input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--accent);
}

.check { display: flex; align-items: center; gap: 8px; margin-bottom: 14px; }
.row-form { display: flex; align-items: flex-end; gap: 12px; margin-top: 18px; flex-wrap: wrap; }
.row-form .field { flex: 1 1 220px; margin-bottom: 0; }
.inline { display: inline-block; }

.btn {
    display: inline-block;
    padding: 11px 18px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: var(--bg-soft);
    color: var(--text);
    font: inherit;
    text-decoration: none;
    cursor: pointer;
    transition: .15s;
}

.btn:hover { border-color: var(--accent); }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #16181d; font-weight: 600; }
.btn-primary:hover { filter: brightness(1.08); }
.btn-big { width: 100%; padding: 14px; font-size: 16px; }
.btn-small { padding: 8px 12px; font-size: 13px; }
.btn-tiny { padding: 4px 9px; font-size: 13px; line-height: 1; }
.btn-ghost { background: transparent; }
.btn-danger { color: var(--lose); }
.btn-danger:hover { border-color: var(--lose); }

.actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; }

/* -------------------------------------------------------------- карты ---- */
.maps {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 12px;
    margin: 6px 0 18px;
}

.map input { position: absolute; opacity: 0; pointer-events: none; }

.map-inner {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: var(--bg-soft);
    cursor: pointer;
    transition: .15s;
}

.map-inner:hover { border-color: rgba(240, 165, 0, .6); transform: translateY(-1px); }

.map input:checked + .map-inner {
    border-color: var(--accent);
    background: var(--accent-soft);
    box-shadow: 0 0 0 1px var(--accent) inset;
}

.map-badge {
    display: grid;
    place-items: center;
    width: 38px;
    height: 38px;
    flex: none;
    border-radius: 10px;
    background: linear-gradient(140deg, #2b3646, #1b2331);
    color: var(--accent);
    font-weight: 700;
}

.map-name { font-weight: 600; }

.pool { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 16px; }
.chip input { position: absolute; opacity: 0; pointer-events: none; }

.chip span {
    display: inline-block;
    padding: 7px 12px;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: var(--bg-soft);
    cursor: pointer;
    font-size: 14px;
    transition: .15s;
}

.chip input:checked + span { border-color: var(--accent); background: var(--accent-soft); color: var(--accent); }

/* ---------------------------------------------------------- результаты ---- */
.results { margin-top: 22px; }
.bar-row { margin-bottom: 14px; }

.bar-label {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 6px;
    font-size: 14px;
}

.bar-value { color: var(--muted); }

.bar-track {
    height: 12px;
    border-radius: 999px;
    background: var(--bg-soft);
    border: 1px solid var(--line);
    overflow: hidden;
}

.bar-fill {
    height: 100%;
    background: linear-gradient(90deg, #f0a500, #ffcb52);
    border-radius: 999px;
}

.bar-row.is-mine .bar-label span:first-child::after {
    content: " · твой пик";
    color: var(--accent);
    font-size: 12px;
}

.bar-row.is-correct .bar-fill { background: linear-gradient(90deg, #33a35f, #6fe09b); }
.bar-row.is-correct .bar-label span:first-child { color: var(--win); font-weight: 600; }

.correct-note {
    margin-top: 16px;
    padding: 12px 16px;
    border-radius: 10px;
    background: rgba(74, 201, 126, .12);
    border: 1px solid rgba(74, 201, 126, .4);
}

/* -------------------------------------------------------------- админка ---- */
.admin-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
}

.admin-bar h1 { font-size: 22px; margin: 0; }

.admin-grid {
    display: grid;
    grid-template-columns: minmax(280px, 360px) 1fr;
    gap: 18px;
    align-items: start;
}

.login-card { max-width: 420px; margin: 40px auto; }

.round-list { list-style: none; margin: 0; padding: 0; }
.round-list li { margin-bottom: 8px; }

.round-list a {
    display: block;
    padding: 12px 14px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: var(--bg-soft);
    color: inherit;
    text-decoration: none;
    transition: .15s;
}

.round-list a:hover { border-color: var(--accent); }
.round-list li.active a { border-color: var(--accent); background: var(--accent-soft); }
.round-list strong { display: block; margin: 6px 0 2px; }
.round-list small { color: var(--muted); }

.table { width: 100%; border-collapse: collapse; }

.table th, .table td {
    padding: 9px 10px;
    border-bottom: 1px solid var(--line);
    text-align: left;
    font-size: 14px;
}

.table th { color: var(--muted); font-weight: 500; }
.table tr:last-child td { border-bottom: none; }

.bottom {
    margin-top: 30px;
    text-align: center;
    color: var(--muted);
    font-size: 13px;
}

@media (max-width: 860px) {
    .admin-grid { grid-template-columns: 1fr; }
}
