/* ============================================================ токены */
:root {
  --bg: #f3f4ef;
  --bg-grad: radial-gradient(1200px 500px at 10% -10%, #dcefe3 0%, transparent 60%),
             radial-gradient(900px 400px at 100% 0%, #fbe8d6 0%, transparent 55%);
  --surface: #ffffff;
  --surface-2: #f7f8f4;
  --text: #14201a;
  --muted: #6a756e;
  --line: #e4e7df;
  --brand: #0f7a55;
  --brand-2: #14a172;
  --brand-soft: #e2f4ec;
  --accent: #f07c2b;
  --accent-soft: #fdeadb;
  --gold: #f2b705;
  --gold-soft: #fff6d6;
  --silver: #9aa5b1;
  --bronze: #c9783f;
  --wild: #3b6fd8;
  --wild-soft: #e7eefc;
  --danger: #d23b30;
  --danger-soft: #fde8e6;
  --shadow-sm: 0 1px 2px rgb(16 24 20 / .06);
  --shadow: 0 1px 2px rgb(16 24 20 / .05), 0 8px 24px -12px rgb(16 24 20 / .18);
  --shadow-lg: 0 20px 50px -20px rgb(16 24 20 / .35);
  --r-sm: 10px;
  --r: 16px;
  --r-lg: 24px;
  --font: "Manrope", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --display: "Unbounded", var(--font);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0d1210;
    --bg-grad: radial-gradient(1000px 500px at 0% -10%, #12352a 0%, transparent 60%),
               radial-gradient(800px 400px at 100% 0%, #3a2414 0%, transparent 55%);
    --surface: #151c19;
    --surface-2: #1b2420;
    --text: #e9efeb;
    --muted: #8f9b94;
    --line: #26312c;
    --brand: #2fc28c;
    --brand-2: #4fd8a3;
    --brand-soft: #173a2d;
    --accent: #ff9447;
    --accent-soft: #3d2615;
    --gold-soft: #3a3110;
    --wild: #7aa2ff;
    --wild-soft: #1a2640;
    --danger: #ff6b60;
    --danger-soft: #3d1a17;
    --shadow: 0 1px 2px rgb(0 0 0 / .3), 0 10px 30px -14px rgb(0 0 0 / .6);
    --shadow-lg: 0 24px 60px -24px rgb(0 0 0 / .7);
    color-scheme: dark;
  }
}

/* ============================================================ база */
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; min-height: 100vh; display: flex; flex-direction: column;
  font: 15px/1.55 var(--font); color: var(--text);
  background: var(--bg-grad), var(--bg); background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--brand); text-decoration: none; }
a:hover { color: var(--brand-2); }
h1, h2, h3 { font-family: var(--display); letter-spacing: -.01em; line-height: 1.15; }
h1 { margin: 0 0 .3em; font-size: clamp(1.6rem, 3.2vw, 2.4rem); font-weight: 800; }
h2 { margin: 0 0 .8em; font-size: 1.1rem; font-weight: 700; }
h3 { margin: 1.2em 0 .6em; font-size: .75rem; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .08em; }
main { width: 100%; max-width: 1180px; margin: 0 auto; padding: 24px 16px 48px; flex: 1; }
.muted { color: var(--muted); }
.center { text-align: center; }
.eyebrow { margin: 0 0 6px; font-size: .75rem; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--brand); }
.lead { font-size: 1.05rem; color: var(--muted); max-width: 52ch; margin: 0; }
.count { font-size: .55em; vertical-align: middle; padding: 2px 10px; border-radius: 999px; background: var(--brand-soft); color: var(--brand); }
.back { display: inline-flex; gap: 6px; margin-bottom: 14px; font-weight: 600; font-size: .9rem; color: var(--muted); }
.back:hover { color: var(--text); }
.footer { text-align: center; padding: 24px; font-size: .8rem; color: var(--muted); }

/* ============================================================ шапка */
.topbar {
  position: sticky; top: 0; z-index: 20;
  background: color-mix(in srgb, var(--surface) 78%, transparent);
  backdrop-filter: saturate(180%) blur(14px); -webkit-backdrop-filter: saturate(180%) blur(14px);
  border-bottom: 1px solid var(--line);
}
.topbar-inner { max-width: 1180px; margin: 0 auto; padding: 10px 16px; display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.logo { display: flex; align-items: center; gap: 10px; color: var(--text); font-family: var(--display); font-weight: 500; font-size: 1.05rem; }
.logo b { color: var(--brand); font-weight: 800; }
.logo-mark { display: grid; place-items: center; width: 36px; height: 36px; border-radius: 11px; background: linear-gradient(135deg, var(--brand), var(--brand-2)); box-shadow: var(--shadow); font-size: 1.1rem; }
nav { display: flex; gap: 4px; align-items: center; flex-wrap: wrap; }
nav a, .nav-btn { padding: 7px 14px; border-radius: 999px; color: var(--muted); font-weight: 600; font-size: .92rem; transition: .15s; }
nav a:hover, .nav-btn:hover { color: var(--text); background: var(--surface-2); }
nav a.active { color: var(--brand); background: var(--brand-soft); }
.nav-btn { border: 1px solid var(--line); background: transparent; cursor: pointer; font-family: inherit; }

/* ============================================================ уведомления */
.toasts { display: grid; gap: 8px; margin-bottom: 18px; }
.flash { padding: 12px 16px; border-radius: var(--r-sm); background: var(--brand-soft); color: var(--text); font-weight: 600; border: 1px solid color-mix(in srgb, var(--brand) 25%, transparent); animation: drop .3s ease; }
.flash.error { background: var(--danger-soft); border-color: color-mix(in srgb, var(--danger) 30%, transparent); }
@keyframes drop { from { opacity: 0; transform: translateY(-6px); } }

/* ============================================================ карточки и раскладка */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 20px; margin-bottom: 18px; box-shadow: var(--shadow); }
.card.flush { padding: 0; overflow: hidden; }
.card.narrow { max-width: 620px; }
.card.accent { border-color: color-mix(in srgb, var(--accent) 45%, var(--line)); background: linear-gradient(180deg, var(--accent-soft), var(--surface) 70%); }
.card-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 18px 20px 12px; flex-wrap: wrap; }
.card-head h2 { margin: 0; }
.danger-zone { border-style: dashed; border-color: color-mix(in srgb, var(--danger) 40%, var(--line)); box-shadow: none; background: transparent; }
.danger-zone h2 { color: var(--danger); }
.head-row, .page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 18px; }
.page-head h1 { margin: 0; }
.stack { display: grid; gap: 10px; }

/* ============================================================ формы */
form { margin: 0; }
form.inline { display: inline; }
label { display: flex; flex-direction: column; gap: 6px; margin-bottom: 12px; font-size: .82rem; font-weight: 600; color: var(--muted); }
.row label { margin-bottom: 0; }
input, select, textarea {
  font: inherit; font-size: .95rem; padding: 10px 12px; border-radius: var(--r-sm);
  border: 1px solid var(--line); background: var(--surface-2); color: var(--text); width: 100%;
  transition: border-color .15s, box-shadow .15s;
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 4px color-mix(in srgb, var(--brand) 18%, transparent); background: var(--surface); }
input.num { width: 90px; }
.row { display: flex; gap: 10px; align-items: flex-end; margin-bottom: 12px; }
.row.wrap { flex-wrap: wrap; }
.row input:not(.num), .row select { width: auto; min-width: 170px; }

button, .button {
  font: inherit; font-weight: 700; font-size: .92rem; padding: 10px 18px; border-radius: 999px;
  border: 1px solid var(--line); background: var(--surface); color: var(--text); cursor: pointer;
  display: inline-flex; align-items: center; gap: 6px; transition: transform .1s, box-shadow .15s, background .15s;
  box-shadow: var(--shadow-sm);
}
button:hover, .button:hover { border-color: var(--brand); color: var(--brand); }
button:active { transform: translateY(1px); }
button.primary, .button.primary { background: linear-gradient(135deg, var(--brand), var(--brand-2)); color: #fff; border-color: transparent; box-shadow: 0 6px 18px -8px var(--brand); }
button.primary:hover, .button.primary:hover { color: #fff; filter: brightness(1.06); box-shadow: 0 10px 24px -10px var(--brand); }
button.danger { color: var(--danger); border-color: color-mix(in srgb, var(--danger) 40%, var(--line)); background: transparent; box-shadow: none; }
button.danger:hover { background: var(--danger-soft); }
button.link { border: 0; background: none; padding: 2px 6px; box-shadow: none; color: var(--muted); font-weight: 600; font-size: .82rem; border-radius: 6px; }
button.link:hover { background: var(--surface-2); color: var(--brand); }
button.link.danger:hover { color: var(--danger); background: var(--danger-soft); }

/* ============================================================ чипы и статусы */
.legend, .tags { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.chip, .tag { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 999px; font-size: .75rem; font-weight: 700; background: var(--surface-2); color: var(--muted); border: 1px solid var(--line); white-space: nowrap; }
.chip.final { background: var(--gold-soft); color: #8a6500; border-color: transparent; }
.chip.final::before, .chip.wildcard::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--gold); }
.chip.wildcard { background: var(--wild-soft); color: var(--wild); border-color: transparent; }
.chip.wildcard::before { background: var(--wild); }
.chip.ban { background: var(--danger-soft); color: var(--danger); border-color: transparent; margin-left: 6px; }
@media (prefers-color-scheme: dark) { .chip.final { color: var(--gold); } }
.status { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 999px; font-size: .75rem; font-weight: 700; background: var(--surface-2); color: var(--muted); border: 1px solid var(--line); white-space: nowrap; }
.status i { width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.status.in_progress { color: var(--accent); background: var(--accent-soft); border-color: transparent; }
.status.in_progress i { animation: pulse 1.4s infinite; }
.status.finished { color: var(--brand); background: var(--brand-soft); border-color: transparent; }
@keyframes pulse { 50% { opacity: .3; } }

/* ============================================================ аватарки */
.avatar { --h: 150; flex: none; display: inline-grid; place-items: center; width: 32px; height: 32px; border-radius: 50%;
  font-family: var(--display); font-weight: 700; font-size: .85rem; color: #fff;
  background: linear-gradient(135deg, hsl(var(--h) 55% 48%), hsl(calc(var(--h) + 40) 60% 40%)); }
.avatar.lg { width: 64px; height: 64px; font-size: 1.5rem; }
.avatar.xl { width: 84px; height: 84px; font-size: 2rem; box-shadow: var(--shadow-lg); }

/* ============================================================ главная */
.hero { display: grid; grid-template-columns: 1.4fr 1fr; gap: 24px; align-items: center; margin: 8px 0 28px; }
.hero-side { display: grid; gap: 8px; }
.mini-event { display: grid; grid-template-columns: auto 1fr auto; gap: 12px; align-items: center; padding: 10px 14px; border-radius: var(--r); background: var(--surface); border: 1px solid var(--line); color: var(--text); box-shadow: var(--shadow); transition: transform .15s; }
.mini-event:hover { transform: translateY(-2px); color: var(--text); }
.mini-event .info { display: grid; min-width: 0; }
.mini-event .info b { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mini-event small { color: var(--muted); }
.date { display: grid; place-items: center; width: 48px; height: 48px; border-radius: 12px; background: var(--brand-soft); color: var(--brand); font-size: .68rem; font-weight: 700; text-transform: uppercase; line-height: 1; }
.date b { font-family: var(--display); font-size: 1.2rem; }

.podium { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; align-items: end; margin-bottom: 22px; }
.podium-card { position: relative; display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 22px 14px 18px;
  border-radius: var(--r-lg); background: var(--surface); border: 1px solid var(--line); color: var(--text); box-shadow: var(--shadow); text-align: center; transition: transform .2s; }
.podium-card:hover { transform: translateY(-4px); color: var(--text); }
.podium-card.place-1 { padding-top: 34px; padding-bottom: 28px; background: linear-gradient(180deg, var(--gold-soft), var(--surface) 75%); border-color: color-mix(in srgb, var(--gold) 45%, var(--line)); box-shadow: var(--shadow-lg); }
.medal { position: absolute; top: -14px; font-size: 1.8rem; filter: drop-shadow(0 4px 6px rgb(0 0 0 / .15)); }
.pname { font-size: 1.02rem; }
.ptotal { font-family: var(--display); font-weight: 800; font-size: 1.9rem; line-height: 1; }
.ptotal small { display: block; font-family: var(--font); font-size: .7rem; font-weight: 600; color: var(--muted); margin-top: 4px; }
.place-1 .ptotal { font-size: 2.4rem; }
.pmeta { font-size: .78rem; color: var(--muted); }

/* ============================================================ таблицы */
.table-wrap { overflow-x: auto; }
table { border-collapse: collapse; width: 100%; }
th, td { padding: 11px 14px; text-align: left; border-bottom: 1px solid var(--line); white-space: nowrap; }
th { font-size: .72rem; color: var(--muted); font-weight: 700; text-transform: uppercase; letter-spacing: .06em; background: var(--surface-2); }
tbody tr:last-child td { border-bottom: 0; }
tbody tr { transition: background .12s; }
tbody tr:hover td { background: var(--surface-2); }
th.r, td.r { text-align: right; }
th.c, td.c { text-align: center; width: 1%; }
.card > .table-wrap { margin: 0 -20px; }
.card > .table-wrap:last-child { margin-bottom: -20px; }
.card.flush > .table-wrap { margin: 0; }
td.total, .total { font-family: var(--display); font-weight: 700; }

.standings td { padding-top: 9px; padding-bottom: 9px; }
.standings .who { display: inline-flex; align-items: center; gap: 10px; color: var(--text); font-weight: 700; }
.standings .who:hover span { color: var(--brand); }
.rank { display: inline-grid; place-items: center; min-width: 28px; height: 28px; padding: 0 6px; border-radius: 9px; font-family: var(--display); font-weight: 700; font-size: .8rem; background: var(--surface-2); color: var(--muted); }
tr.final .rank { background: var(--gold); color: #3d2d00; }
tr.wildcard .rank { background: var(--wild-soft); color: var(--wild); }
tr.final td:first-child { box-shadow: inset 4px 0 var(--gold); }
tr.wildcard td:first-child { box-shadow: inset 4px 0 var(--wild); }
tr.divider td { padding: 0; height: 6px; background: var(--surface-2); border: 0; }
.total-cell { min-width: 120px; }
.total-cell .total { font-size: 1.05rem; }
.bar { display: block; height: 4px; margin-top: 4px; border-radius: 4px; background: var(--surface-2); overflow: hidden; }
.bar i { display: block; height: 100%; border-radius: 4px; background: linear-gradient(90deg, var(--brand), var(--brand-2)); }

tr.gold td { background: var(--gold-soft); }
tr.silver td { background: color-mix(in srgb, var(--silver) 14%, transparent); }
tr.bronze td { background: color-mix(in srgb, var(--bronze) 14%, transparent); }

/* ============================================================ турниры */
.event-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px; }
.event { display: flex; flex-direction: column; gap: 10px; padding: 18px; border-radius: var(--r); background: var(--surface); border: 1px solid var(--line); color: var(--text); box-shadow: var(--shadow); transition: transform .15s, border-color .15s; position: relative; overflow: hidden; }
.event::before { content: ""; position: absolute; inset: 0 0 auto; height: 4px; background: linear-gradient(90deg, var(--brand), var(--brand-2)); }
.event.pair::before { background: linear-gradient(90deg, var(--accent), #f5b041); }
.event.qualification::before { background: linear-gradient(90deg, var(--wild), #8bb0ff); }
.event:hover { transform: translateY(-3px); border-color: color-mix(in srgb, var(--brand) 40%, var(--line)); color: var(--text); }
.event-top { display: flex; justify-content: space-between; align-items: flex-start; }
.event h3 { margin: 0; font-size: 1.05rem; text-transform: none; letter-spacing: -.01em; color: var(--text); }
.event-foot { margin-top: auto; padding-top: 10px; border-top: 1px solid var(--line); font-size: .9rem; }

.t-hero { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; flex-wrap: wrap; padding: 26px; margin-bottom: 18px;
  border-radius: var(--r-lg); color: #fff; box-shadow: var(--shadow-lg); position: relative; overflow: hidden;
  background: radial-gradient(500px 200px at 90% 0%, rgb(255 255 255 / .18), transparent 70%), linear-gradient(135deg, #0b5e42, #14a172); }
.t-hero.pair { background: radial-gradient(500px 200px at 90% 0%, rgb(255 255 255 / .2), transparent 70%), linear-gradient(135deg, #c4561a, #f39a3d); }
.t-hero.qualification { background: radial-gradient(500px 200px at 90% 0%, rgb(255 255 255 / .2), transparent 70%), linear-gradient(135deg, #2c4fa8, #5b8cf0); }
.t-hero::after { content: "🎯"; position: absolute; right: -10px; bottom: -40px; font-size: 160px; opacity: .1; pointer-events: none; }
.t-hero .eyebrow { color: rgb(255 255 255 / .8); }
.t-hero h1 { color: #fff; }
.t-hero .tag, .t-hero .status { background: rgb(255 255 255 / .16); color: #fff; border-color: rgb(255 255 255 / .22); }
.linked { display: grid; gap: 4px; padding: 12px 16px; border-radius: var(--r); background: rgb(255 255 255 / .14); border: 1px solid rgb(255 255 255 / .25); color: #fff; position: relative; z-index: 1; }
.linked:hover { color: #fff; background: rgb(255 255 255 / .22); }
.linked small { opacity: .8; font-weight: 600; }
.linked .status { justify-self: start; }

ol.entries { columns: 2 260px; column-gap: 24px; margin: 0 0 16px; padding-left: 1.6em; }
ol.entries li { padding: 6px 0; border-bottom: 1px dashed var(--line); break-inside: avoid; font-weight: 600; }
ol.entries li::marker { color: var(--muted); font-weight: 700; font-size: .85em; }
.checks { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 6px; margin-bottom: 14px; }
label.check { flex-direction: row; align-items: center; gap: 10px; margin: 0; padding: 9px 12px; border-radius: var(--r-sm); border: 1px solid var(--line); background: var(--surface-2); color: var(--text); font-size: .9rem; cursor: pointer; transition: .12s; }
label.check:hover { border-color: var(--brand); }
label.check:has(input:checked) { border-color: var(--brand); background: var(--brand-soft); }
label.check input { width: 18px; height: 18px; accent-color: var(--brand); flex: none; }
label.check.disabled { opacity: .55; cursor: not-allowed; }
ul.plain { list-style: none; padding: 0; margin: 0 0 14px; }
ul.plain li { padding: 8px 0; border-bottom: 1px solid var(--line); }
ul.plain li:last-child { border-bottom: 0; }

/* ============================================================ игроки */
.player-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 10px; }
.player-card { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: var(--r); background: var(--surface); border: 1px solid var(--line); color: var(--text); box-shadow: var(--shadow-sm); transition: .15s; }
.player-card:hover { transform: translateY(-2px); box-shadow: var(--shadow); color: var(--text); }
.player-card.final { border-left: 4px solid var(--gold); }
.player-card.wildcard { border-left: 4px solid var(--wild); }
.pc-name { display: grid; flex: 1; min-width: 0; }
.pc-name b { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pc-name small { color: var(--muted); font-size: .78rem; }
.pc-total { font-family: var(--display); font-weight: 700; font-size: 1.1rem; }

.profile { display: flex; align-items: center; gap: 20px; margin-bottom: 20px; }
.profile h1 { margin: 0; }
.stats { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 10px; margin-bottom: 20px; }
.stats div { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 14px 16px; box-shadow: var(--shadow-sm); }
.stats div.accent { background: linear-gradient(135deg, var(--brand), var(--brand-2)); color: #fff; border-color: transparent; }
.stats div.accent span { color: rgb(255 255 255 / .85); }
.stats b { display: block; font-family: var(--display); font-size: 1.6rem; line-height: 1.1; }
.stats span { color: var(--muted); font-size: .78rem; font-weight: 600; }

/* ============================================================ сетка */
.bracket { display: flex; gap: 28px; overflow-x: auto; padding: 4px 2px 12px; scroll-snap-type: x proximity; }
.round { min-width: 220px; display: flex; flex-direction: column; scroll-snap-align: start; }
.round h3 { margin-top: 0; text-align: center; padding: 6px 0; border-radius: 999px; background: var(--surface-2); }
.round-matches { display: flex; flex-direction: column; justify-content: space-around; flex: 1; gap: 14px; }
.round:not(:last-child) .round-matches .match::after { content: ""; position: absolute; right: -15px; top: 50%; width: 14px; border-top: 2px solid var(--line); }
.rr-matches { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 10px; }
.match { position: relative; display: block; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm); transition: .15s; }
.match:hover { border-color: var(--brand); box-shadow: var(--shadow); color: var(--text); transform: translateY(-1px); }
.match.ready { border-color: color-mix(in srgb, var(--accent) 60%, var(--line)); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 14%, transparent); }
.match.bye { opacity: .55; box-shadow: none; }
.match .side { display: flex; align-items: center; gap: 8px; padding: 8px 12px; font-weight: 600; font-size: .9rem; }
.match .side + .side { border-top: 1px solid var(--line); }
.match .side.empty .name { color: var(--muted); font-weight: 500; font-style: italic; }
.match .side.win { color: var(--brand); }
.match .side.win .score { background: var(--brand); color: #fff; }
.match .seed { width: 16px; font-size: .7rem; color: var(--muted); text-align: right; flex: none; }
.match .name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.match .score { min-width: 24px; height: 24px; display: grid; place-items: center; border-radius: 7px; background: var(--surface-2); font-family: var(--display); font-weight: 700; font-size: .8rem; }
.match .meta { display: flex; justify-content: space-between; font-size: .7rem; color: var(--muted); padding: 5px 12px; border-top: 1px dashed var(--line); background: var(--surface-2); border-radius: 0 0 12px 12px; }
.match .meta b { color: var(--accent); }
.third { margin-top: 24px; }

/* ============================================================ матч */
.match-page { margin-inline: auto; }
.scoreboard { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 14px; text-align: center; margin: 22px 0 6px; padding: 22px 14px; border-radius: var(--r); background: var(--surface-2); }
.scoreboard .team { font-weight: 800; font-size: 1.05rem; }
.scoreboard .team.win { color: var(--brand); }
.scoreboard .team.win::before { content: "🏆 "; }
.scoreboard .big { display: flex; gap: 8px; align-items: center; font-family: var(--display); font-weight: 800; font-size: 3rem; line-height: 1; }
.scoreboard .big span { min-width: 64px; padding: 10px 6px; border-radius: 14px; background: var(--surface); box-shadow: var(--shadow); }
.scoreboard .big i { font-style: normal; color: var(--muted); font-size: 2rem; }
.games { margin: 16px 0; border: 1px solid var(--line); border-radius: var(--r-sm); overflow: hidden; }
.games td.win { font-weight: 800; color: var(--brand); }
.game-form { border-top: 1px solid var(--line); padding-top: 14px; margin: 16px 0; }
.game-form h3 { margin-top: 0; }

/* ============================================================ прочее */
.empty-state { text-align: center; padding: 60px 20px; border-radius: var(--r-lg); border: 2px dashed var(--line); }
.empty-state span { font-size: 3rem; }
.auth { max-width: 400px; margin: 40px auto; text-align: center; padding: 32px; }
.auth-icon { font-size: 2.4rem; }
.prose { max-width: 820px; }
.rules { white-space: pre-wrap; font-size: 1rem; line-height: 1.75; }

/* ============================================================ мобильные */
@media (max-width: 760px) {
  .hero { grid-template-columns: 1fr; }
  .podium { gap: 8px; }
  .podium-card { padding: 18px 8px 14px; }
  .podium-card .avatar.lg { width: 46px; height: 46px; font-size: 1.1rem; }
  .ptotal, .place-1 .ptotal { font-size: 1.4rem; }
  .pname { font-size: .85rem; }
  .pmeta { display: none; }
  .row { flex-wrap: wrap; }
  .row input:not(.num), .row select { min-width: 0; width: 100%; }
  .t-hero { padding: 20px; }
  .scoreboard .big { font-size: 2.2rem; }
  .scoreboard .big span { min-width: 48px; }
  nav a, .nav-btn { padding: 6px 10px; font-size: .85rem; }
}

/* ============================================================ уточнения */
.hero { grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); }
.hero > *, main > * { min-width: 0; }
.podium { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.podium-card .pname { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.medal { font-size: 2.2rem; }
/* цифры счёта — в Manrope: у Unbounded ноль похож на «О» */
.match .score, .scoreboard .big, .ptotal, .total, .pc-total, .stats b, .rank {
  font-family: var(--font); font-weight: 800; font-variant-numeric: tabular-nums; }
.ptotal { letter-spacing: -.02em; }
/* проход без игры — компактной строкой */
.match.bye .side + .side, .match.bye .meta { display: none; }
.match.bye .side { padding: 6px 12px; font-size: .82rem; }
.match.bye .side::after { content: "проход"; font-size: .7rem; color: var(--muted); }
@media (max-width: 760px) {
  .hero { grid-template-columns: minmax(0, 1fr); }
  h1 { overflow-wrap: anywhere; }
}
@media (max-width: 600px) {
  /* на телефоне в рейтинге оставляем главное: место, игрок, победы, очки за места, итого */
  .standings th:nth-child(3), .standings td:nth-child(3),
  .standings th:nth-child(6), .standings td:nth-child(6),
  .standings th:nth-child(7), .standings td:nth-child(7) { display: none; }
  .standings th, .standings td { padding-left: 8px; padding-right: 8px; }
  .total-cell { min-width: 80px; }
}

/* ============================================================ живой счёт */
.live { margin: 18px 0; padding: 16px; border-radius: var(--r); border: 1px solid var(--line); background: var(--surface-2); }
.live-head { display: flex; align-items: center; gap: 8px; font-weight: 800; font-size: .85rem; text-transform: uppercase; letter-spacing: .06em; color: var(--accent); margin-bottom: 12px; }
.live-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--accent); animation: pulse 1.4s infinite; }
.lanes { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.lane { padding: 14px; border-radius: var(--r); background: var(--surface); border: 2px solid transparent; box-shadow: var(--shadow-sm); text-align: center; transition: border-color .2s, box-shadow .2s; }
.lane.turn { border-color: var(--accent); box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 15%, transparent); }
.lane-name { font-weight: 800; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lane-name small { font-size: .65rem; font-weight: 700; padding: 1px 6px; border-radius: 999px; background: var(--brand-soft); color: var(--brand); vertical-align: middle; }
.lane-total { font-weight: 800; font-size: 3.2rem; line-height: 1.1; font-variant-numeric: tabular-nums; }
.lane-progress { height: 5px; border-radius: 5px; background: var(--surface-2); overflow: hidden; margin: 4px 0 12px; }
.lane-progress i { display: block; height: 100%; background: linear-gradient(90deg, var(--brand), var(--brand-2)); transition: width .3s; }
.bags { display: flex; justify-content: center; gap: 6px; }
.bag { width: 38px; height: 38px; display: grid; place-items: center; border-radius: 10px; font-weight: 800; font-size: .85rem;
  border: 2px dashed var(--line); color: var(--muted); }
.bag.next { border-style: solid; border-color: var(--accent); color: var(--accent); animation: pulse 1.4s infinite; }
.bag.b3 { border: 0; background: var(--brand); color: #fff; }
.bag.b1 { border: 0; background: var(--gold); color: #3d2d00; }
.bag.b0 { border: 0; background: var(--surface-2); color: var(--muted); }
.lane-round { margin-top: 8px; font-size: .78rem; color: var(--muted); font-weight: 600; }
.turn-label { text-align: center; margin: 16px 0 10px; }
.throw-pad { display: grid; grid-template-columns: 1.3fr 1fr 1fr .9fr; gap: 8px; }
.throw-pad form { display: contents; }
.pad { flex-direction: column; justify-content: center; gap: 0; height: 84px; border-radius: var(--r); font-size: 1.8rem; font-weight: 800; padding: 6px; }
.pad small { font-size: .7rem; font-weight: 700; opacity: .85; }
.pad.p3 { background: linear-gradient(135deg, var(--brand), var(--brand-2)); color: #fff; border-color: transparent; box-shadow: 0 8px 20px -10px var(--brand); }
.pad.p1 { background: var(--gold); color: #3d2d00; border-color: transparent; }
.pad.p3:hover, .pad.p1:hover { filter: brightness(1.06); color: inherit; }
.pad.p3:hover { color: #fff; }
.pad.undo { color: var(--muted); }
.pad:disabled { opacity: .4; cursor: not-allowed; }
.hint { font-size: .78rem; margin: 10px 0 14px; }
kbd { font: inherit; font-size: .75rem; font-weight: 700; padding: 1px 6px; border-radius: 5px; border: 1px solid var(--line); background: var(--surface); }
.rounds { margin-top: 6px; background: var(--surface); border-radius: var(--r-sm); overflow: hidden; }
.bag-line { display: inline-flex; gap: 3px; vertical-align: middle; }
.bag-line i { font-style: normal; width: 18px; height: 18px; display: inline-grid; place-items: center; border-radius: 5px; font-size: .68rem; font-weight: 800; background: var(--surface-2); color: var(--muted); }
.bag-line i.b3 { background: var(--brand); color: #fff; }
.bag-line i.b1 { background: var(--gold); color: #3d2d00; }
.games-list { display: grid; gap: 6px; margin-bottom: 16px; }
.game-row { border: 1px solid var(--line); border-radius: var(--r-sm); background: var(--surface); }
.game-row summary { display: grid; grid-template-columns: auto auto 1fr; gap: 14px; align-items: center; padding: 10px 14px; cursor: pointer; list-style: none; }
.game-row summary::-webkit-details-marker { display: none; }
.game-row summary::after { content: "▾"; justify-self: end; color: var(--muted); grid-column: 3; grid-row: 1; }
.game-row[data-empty] summary::after { content: ""; }
.game-row .gnum { font-weight: 700; color: var(--muted); font-size: .85rem; }
.game-row .gscore { font-weight: 800; font-size: 1.05rem; font-variant-numeric: tabular-nums; }
.game-row .gscore .win { color: var(--brand); }
.game-row .muted { grid-column: 3; grid-row: 1; padding-right: 20px; justify-self: end; }
.game-row > :not(summary) { padding: 0 14px 12px; margin: 0; }
.manual { margin: 12px 0; }
.manual summary { cursor: pointer; font-weight: 700; color: var(--muted); font-size: .9rem; padding: 6px 0; }
.settings-row { margin-top: 14px; }
@media (max-width: 600px) {
  .lane-total { font-size: 2.4rem; }
  .bag { width: 30px; height: 30px; font-size: .75rem; border-radius: 8px; }
  .throw-pad { grid-template-columns: 1fr 1fr 1fr; }
  .pad.undo { grid-column: 1 / -1; height: 48px; flex-direction: row; gap: 8px; font-size: 1.1rem; }
  .pad { height: 76px; }
}
@media (max-width: 600px) {
  .rounds th, .rounds td { padding: 8px 6px; }
  .rounds .bag-line i { width: 15px; height: 15px; font-size: .6rem; }
  .live { padding: 12px; margin-left: -8px; margin-right: -8px; }
}

.starter-pick { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 8px; margin: 16px 0 4px; font-weight: 700; }
.starter-pick span { color: var(--muted); font-size: .9rem; }
.starter-pick form { display: contents; }
.starter-pick button.selected { background: var(--accent); border-color: var(--accent); color: #fff; }
.starter-pick button.selected::before { content: "🎯"; }

/* ряды мешков: у каждого мешка свои кнопки */
.bag-rows { display: grid; gap: 5px; margin-top: 4px; }
.bag-row { display: grid; grid-template-columns: 18px repeat(3, 1fr); gap: 5px; align-items: center; }
.bag-row form { display: contents; }
.bag-n { font-size: .72rem; font-weight: 800; color: var(--muted); }
.bb { height: 40px; padding: 0; justify-content: center; border-radius: 10px; font-size: .95rem; font-weight: 800; box-shadow: none; }
.bag-row.future { opacity: .35; }
.bag-row.future .bb { cursor: default; }
.bag-row.next .bag-n { color: var(--accent); }
.bag-row.next .bb { border: 2px solid var(--accent); }
.bag-row.next .bb.b3 { background: var(--brand); color: #fff; border-color: var(--brand); }
.bag-row.next .bb.b1 { background: var(--gold); color: #3d2d00; border-color: var(--gold); }
.bag-row.thrown .bb { background: var(--surface-2); color: var(--muted); }
.bag-row.thrown .bb.on { opacity: 1; cursor: default; }
.bag-row.thrown .bb.on.b3 { background: var(--brand); color: #fff; }
.bag-row.thrown .bb.on.b1 { background: var(--gold); color: #3d2d00; }
.bag-row.thrown .bb.on.b0 { background: var(--text); color: var(--surface); }
.bb:disabled { opacity: 1; }
.bag-row.future .bb:disabled { opacity: 1; }
.throw-pad.closing { grid-template-columns: 3fr 1fr; }
.close-round { font-size: 1.3rem; }
.close-round:disabled { filter: grayscale(1); opacity: .35; }
@media (max-width: 600px) {
  .lanes { gap: 6px; }
  .lane { padding: 10px 8px; }
  .bb { height: 44px; font-size: .9rem; border-radius: 8px; }
  .bag-row { gap: 4px; grid-template-columns: 14px repeat(3, 1fr); }
  .throw-pad.closing { grid-template-columns: 3fr 1fr; }
  .throw-pad.closing .pad.undo { grid-column: auto; height: 76px; flex-direction: column; font-size: 1.4rem; }
}

/* ============================================================ статистика */
.stats-filter { width: auto; min-width: 220px; }
.leader-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 14px; margin-bottom: 18px; }
.leader-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 16px 18px; box-shadow: var(--shadow); }
.leader-card header { display: flex; align-items: center; gap: 12px; margin-bottom: 10px; }
.leader-card h2 { margin: 0; font-size: 1rem; }
.leader-card small { color: var(--muted); font-size: .78rem; }
.lc-emoji { display: grid; place-items: center; width: 42px; height: 42px; border-radius: 12px; background: var(--brand-soft); font-size: 1.3rem; flex: none; }
.leader-card ol { list-style: none; margin: 0; padding: 0; counter-reset: lc; }
.leader-card li { display: flex; align-items: center; gap: 10px; padding: 7px 0; border-top: 1px solid var(--line); counter-increment: lc; }
.leader-card li::before { content: counter(lc); width: 18px; color: var(--muted); font-weight: 800; font-size: .8rem; }
.leader-card li.muted::before { content: none; }
.leader-card .who { display: inline-flex; align-items: center; gap: 8px; flex: 1; color: var(--text); font-weight: 700; min-width: 0; }
.leader-card .who span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.leader-card .avatar { width: 26px; height: 26px; font-size: .72rem; }
.leader-card li b { font-weight: 800; font-variant-numeric: tabular-nums; font-size: 1.05rem; }
.leader-card li.first b { color: var(--brand); font-size: 1.25rem; }
.leader-card li.first::before { content: "👑"; }
table.sortable .who { display: inline-flex; align-items: center; gap: 8px; color: var(--text); font-weight: 700; }
table.sortable .avatar { width: 26px; height: 26px; font-size: .72rem; }
table.sortable th[data-dir="desc"]::after { content: " ↓"; }
table.sortable th[data-dir="asc"]::after { content: " ↑"; }

/* ============================================================ следующий матч */
.next-box { display: grid; gap: 12px; margin: 18px 0; padding: 16px; border-radius: var(--r); background: var(--brand-soft); border: 1px solid color-mix(in srgb, var(--brand) 30%, transparent); animation: drop .3s ease; }
.next-result { display: flex; align-items: center; gap: 12px; }
.next-result b { display: block; font-size: 1.05rem; }
.next-result small { color: var(--muted); font-weight: 600; }
.next-check { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 50%; background: var(--brand); color: #fff; font-weight: 800; font-size: 1.2rem; flex: none; }
.next-btn { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 2px 12px; padding: 14px 20px; border-radius: var(--r); font-size: 1.1rem; text-align: left; }
.next-btn small { grid-column: 1; font-size: .8rem; font-weight: 600; opacity: .85; }
.next-btn span { grid-column: 2; grid-row: 1 / span 2; font-size: 1.6rem; }

/* ============================================================ лист бара */
.card-head-inline { display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px 14px; margin-bottom: 12px; }
.card-head-inline h2 { margin: 0; }
.card-head-inline .muted { font-size: .82rem; }
.bar-sheet td { padding-top: 6px; padding-bottom: 6px; vertical-align: middle; }
.bar-sheet td.who { font-weight: 700; }
.stepper { display: inline-flex; align-items: center; border: 1px solid var(--line); border-radius: 999px; background: var(--surface-2); overflow: hidden; }
.stepper button { width: 36px; height: 36px; padding: 0; justify-content: center; border: 0; border-radius: 0; background: transparent; box-shadow: none; font-size: 1.2rem; color: var(--muted); }
.stepper button[data-step="1"] { color: var(--brand); font-weight: 800; }
.stepper button:hover { background: var(--brand-soft); color: var(--brand); }
.stepper input { width: 46px; padding: 6px 0; border: 0; border-radius: 0; background: transparent; text-align: center; font-weight: 800; -moz-appearance: textfield; }
.stepper input::-webkit-outer-spin-button, .stepper input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.stepper input:focus { box-shadow: none; }
.bar-sheet input.extra { width: 64px; text-align: center; padding: 7px 4px; }
.bar-sheet input.note { min-width: 140px; padding: 7px 10px; }
.bar-sheet select { min-width: 170px; padding: 7px 10px; }
.bar-pts { font-size: 1.1rem; font-variant-numeric: tabular-nums; }
.bar-sheet .new-row td { background: var(--surface-2); }
.bar-save { position: sticky; bottom: 12px; display: flex; justify-content: flex-end; align-items: center; gap: 12px; margin-top: 12px; }
.bar-save [data-dirty] { color: var(--accent); font-weight: 700; }

/* ============================================================ фото игроков */
img.avatar { object-fit: cover; background: var(--surface-2); }
.profile-form { display: grid; grid-template-columns: 180px 1fr; gap: 20px; align-items: start; }
.photo-pick { position: relative; display: block; width: 180px; aspect-ratio: 3 / 4; border-radius: var(--r); overflow: hidden; cursor: pointer;
  border: 2px dashed var(--line); background: var(--surface-2); margin: 0; }
.photo-pick:hover { border-color: var(--brand); }
.photo-pick img { width: 100%; height: 100%; object-fit: cover; display: block; }
.photo-pick input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.photo-empty { display: grid; place-content: center; height: 100%; text-align: center; font-weight: 800; color: var(--muted); font-size: 1rem; }
.photo-empty small { font-weight: 600; font-size: .75rem; }
.profile-form label.check { flex-direction: row; align-items: center; gap: 8px; color: var(--text); }
.profile-form label.check input { width: auto; }
.nick { margin: 0 0 4px; font-weight: 800; color: var(--accent); letter-spacing: .08em; text-transform: uppercase; }
.intro-form { display: flex; align-items: center; justify-content: center; gap: 10px; margin: 14px 0 0; }
@media (max-width: 600px) { .profile-form { grid-template-columns: 1fr; } .photo-pick { width: 100%; max-width: 240px; } }
.intro-form.t-intro { justify-content: flex-start; margin: 0 0 16px; }

/* ============================================================ цвет мешков */
.bag-dot { display: inline-block; width: 12px; height: 12px; border-radius: 4px; margin-right: 6px; vertical-align: -1px; box-shadow: inset 0 0 0 1px rgb(0 0 0 / .15); }
.bag-dot.red { background: #e0393e; }
.bag-dot.blue { background: #2f6fe0; }
.colors-pick { margin-top: 8px; font-size: .9rem; }
.colors-pick button { padding: 6px 12px; font-size: .85rem; }
.colors-pick button.selected { background: var(--text); border-color: var(--text); color: var(--surface); }
.colors-pick button.selected::before { content: none; }
.gnum .bag-dot { width: 9px; height: 9px; margin: 0 0 0 4px; }

/* ============================================================ конкурс прогнозов */
.contest-status { font-weight: 700; }
.contest-status.open { color: var(--brand); }
.contest-win { display: flex; align-items: center; gap: 14px; padding: 14px 18px; margin-bottom: 14px; border-radius: var(--r);
  background: linear-gradient(90deg, var(--gold-soft), transparent); border: 1px solid color-mix(in srgb, var(--gold) 50%, var(--line)); }
.contest-win small { display: block; color: var(--muted); font-weight: 700; }
.contest-win b { font-size: 1.3rem; }
.cw-icon { font-size: 2rem; }
.predictions td.hit { color: var(--brand); font-weight: 800; }
p.small { font-size: .82rem; }
code { font-size: .85em; padding: 1px 6px; border-radius: 6px; background: var(--surface-2); border: 1px solid var(--line); }
