/* Tabelomat. Идея: таблица и есть сайт. Главный знак — жирная черта раздела после 6-го места
   и пунктир зоны вылета. Всё остальное спокойное. */
:root {
  --paper: #F2F4F6;
  --sheet: #FFFFFF;
  --ink: #13213A;
  --ink-2: #4A5870;
  --rule: #D6DDE6;
  --up: #12805A;        /* плей-офф 1–6 */
  --up-bg: #E3F2EB;
  --down: #C2333F;      /* вылет 11–14 */
  --down-bg: #FBE7E8;
  --act: #2350C8;       /* всё, что нажимается */
  --act-bg: #E6ECFB;
  --mark: #FFD24A;      /* изменённая пользователем строка */
  --radius-s: 6px;
  --radius-m: 12px;
  --shadow: 0 1px 0 rgba(19,33,58,.06), 0 6px 18px -10px rgba(19,33,58,.25);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #0E1626; --sheet: #16203A; --ink: #E8EDF5; --ink-2: #A3B0C6; --rule: #2A3756;
    --up: #3CC58E; --up-bg: #12352C; --down: #FF7680; --down-bg: #3A1D27;
    --act: #8DA9FF; --act-bg: #1F2D55; --mark: #8A6D12; color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --paper: #0E1626; --sheet: #16203A; --ink: #E8EDF5; --ink-2: #A3B0C6; --rule: #2A3756;
  --up: #3CC58E; --up-bg: #12352C; --down: #FF7680; --down-bg: #3A1D27;
  --act: #8DA9FF; --act-bg: #1F2D55; --mark: #8A6D12; color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--paper); color: var(--ink);
  font: 400 16px/1.55 "Golos Text", system-ui, sans-serif;
  font-variant-numeric: tabular-nums;
}
a { color: var(--act); text-underline-offset: 2px; }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 3px solid var(--act); outline-offset: 2px; border-radius: 4px; }
.wrap { max-width: 1180px; margin: 0 auto; padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); }

/* Шапка */
.top { background: var(--ink); color: #fff; }
:root[data-theme="dark"] .top, :root:not([data-theme="light"]) .top { }
.top__row { display: flex; align-items: center; gap: 16px; min-height: 56px; }
.logo { display: flex; align-items: center; gap: 10px; color: #fff; text-decoration: none; font: 700 20px/1 "Unbounded", sans-serif; letter-spacing: -.02em; }
.logo svg { flex: none; }
.nav { display: flex; gap: 4px; margin-left: auto; }
.nav a { color: #C9D3E6; text-decoration: none; padding: 10px 12px; border-radius: var(--radius-s); font-weight: 500; min-height: 44px; display: inline-flex; align-items: center; }
.nav a:hover, .nav a[aria-current="page"] { color: #fff; background: rgba(255,255,255,.1); }
.abc { display: inline-flex; border: 1px solid rgba(255,255,255,.3); border-radius: var(--radius-s); overflow: hidden; }
.abc a, .abc span { padding: 0 10px; min-height: 36px; min-width: 44px; display: inline-flex; align-items: center; justify-content: center; font-size: 14px; color: #C9D3E6; text-decoration: none; }
.abc span { background: #fff; color: var(--ink); font-weight: 600; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .top { background: #070C17; } }
:root[data-theme="dark"] .top { background: #070C17; }
@media (max-width: 760px) {
  .top__row { flex-wrap: wrap; gap: 0 12px; padding-top: 6px; }
  .abc { margin-left: auto; }
  .nav { order: 3; width: 100%; margin: 0 -12px; justify-content: space-between; }
  .nav a { padding: 10px 12px; font-size: 15px; }
}

.demo { background: var(--mark); color: #1d1600; font-size: 14px; padding: 8px 0; }
.demo .wrap { display: flex; gap: 8px; align-items: baseline; }

/* Заголовки и текст */
h1, h2, h3 { line-height: 1.2; margin: 0; }
h1 { font: 600 clamp(26px, 5.2vw, 40px)/1.12 "Unbounded", sans-serif; letter-spacing: -.025em; max-width: 22ch; }
h2 { font: 600 22px/1.25 "Unbounded", sans-serif; letter-spacing: -.015em; margin: 40px 0 12px; }
h3 { font-size: 18px; font-weight: 700; margin: 24px 0 8px; }
.lead { font-size: 18px; color: var(--ink-2); max-width: 62ch; margin: 12px 0 0; }
.page-head { padding: 28px 0 8px; }
.meta { font-size: 14px; color: var(--ink-2); margin-top: 12px; }
.prose { max-width: 68ch; }
.prose p, .prose ul, .prose ol { margin: 0 0 14px; }
.prose li { margin-bottom: 6px; }
.crumbs { font-size: 14px; color: var(--ink-2); padding-top: 16px; }
.crumbs a { color: var(--ink-2); }

/* Калькулятор: таблица слева, кола справа */
.calc { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); gap: 24px; align-items: start; padding: 20px 0 8px; }
@media (max-width: 960px) { .calc { grid-template-columns: minmax(0, 1fr); gap: 20px; } }
.panel { background: var(--sheet); border-radius: var(--radius-m); box-shadow: var(--shadow); }
.panel__head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 16px 10px; flex-wrap: wrap; }
.panel__title { font-weight: 700; font-size: 17px; }
.sticky { position: sticky; top: 12px; }
@media (max-width: 960px) { .sticky { position: static; } }

/* Таблица */
.tbl { width: 100%; border-collapse: collapse; font-size: 15px; }
.tbl th { font-size: 12px; font-weight: 600; color: var(--ink-2); text-align: right; padding: 6px 8px; border-bottom: 1px solid var(--rule); white-space: nowrap; }
.tbl th.l, .tbl td.l { text-align: left; }
.tbl td { padding: 0 8px; height: 44px; text-align: right; border-bottom: 1px solid var(--rule); white-space: nowrap; }
.tbl td.club { width: 100%; max-width: 0; overflow: hidden; text-overflow: ellipsis; font-weight: 500; }
.tbl td.club a { color: inherit; text-decoration: none; }
.tbl td.club a:hover { text-decoration: underline; }
.tbl td.pos { width: 40px; text-align: center; font-weight: 700; padding: 0 0 0 6px; }
.tbl .pos b { display: inline-flex; width: 26px; height: 26px; align-items: center; justify-content: center; border-radius: 50%; font-size: 13px; }
.tbl tr.z-up .pos b { background: var(--up-bg); color: var(--up); }
.tbl tr.z-down .pos b { background: var(--down-bg); color: var(--down); }
.tbl td.pts { font-weight: 700; font-size: 16px; }
.tbl tr.moved td { background: color-mix(in srgb, var(--mark) 22%, transparent); }
/* Знак сайта: черта раздела после 6-го и пунктир вылета */
.tbl tr.cut-6 td { border-bottom: 4px solid var(--ink); }
.tbl tr.cut-10 td { border-bottom: 2px dashed var(--down); }
.tbl tbody tr:last-child td { border-bottom: 0; }
.pct { display: inline-block; min-width: 46px; }
.pct.lo { color: var(--ink-2); }
.bar { display: block; height: 3px; border-radius: 2px; background: currentColor; opacity: .55; margin-top: 2px; }
.c-hide { }
@media (max-width: 560px) {
  .tbl .c-hide { display: none; }
  .tbl td, .tbl th { padding-left: 5px; padding-right: 5px; }
}
.legend { display: flex; flex-wrap: wrap; gap: 6px 18px; padding: 12px 16px 14px; font-size: 13px; color: var(--ink-2); }
.legend i { display: inline-block; width: 22px; vertical-align: middle; margin-right: 6px; }
.legend .l6 { border-top: 4px solid var(--ink); }
.legend .l10 { border-top: 2px dashed var(--down); }

/* Переключатель столбца шансов */
.seg { display: inline-flex; background: var(--paper); border-radius: 999px; padding: 3px; }
.seg button { border: 0; background: transparent; color: var(--ink-2); font: 600 14px/1 inherit; font-family: inherit; padding: 0 12px; min-height: 36px; border-radius: 999px; cursor: pointer; }
.seg button[aria-pressed="true"] { background: var(--sheet); color: var(--ink); box-shadow: 0 1px 3px rgba(19,33,58,.2); }

/* Кола и матчи */
.rounds { display: flex; gap: 6px; overflow-x: auto; padding: 0 16px 12px; scrollbar-width: thin; }
.rounds button { flex: none; border: 1px solid var(--rule); background: var(--sheet); color: var(--ink); font: 600 14px/1 inherit; font-family: inherit; min-width: 44px; min-height: 40px; border-radius: var(--radius-s); cursor: pointer; position: relative; }
.rounds button[aria-pressed="true"] { background: var(--ink); color: var(--sheet); border-color: var(--ink); }
.rounds button.has::after { content: ""; position: absolute; top: 5px; right: 5px; width: 6px; height: 6px; border-radius: 50%; background: var(--act); }
.match { display: grid; grid-template-columns: minmax(0,1fr) auto minmax(0,1fr); align-items: center; gap: 10px; padding: 10px 16px; border-top: 1px solid var(--rule); }
.match .h { text-align: right; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 500; }
.match .a { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 500; }
.score { display: flex; align-items: center; gap: 4px; }
.score input { width: 44px; height: 44px; text-align: center; font: 700 18px/1 inherit; font-family: inherit; color: var(--ink); background: var(--paper); border: 1px solid var(--rule); border-radius: var(--radius-s); -moz-appearance: textfield; }
.score input::-webkit-outer-spin-button, .score input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.score input:focus { border-color: var(--act); background: var(--sheet); }
.score input.set { background: var(--act-bg); border-color: var(--act); }
.score span { color: var(--ink-2); }
.quick { grid-column: 1 / -1; display: flex; justify-content: center; gap: 6px; }
.quick button { border: 1px solid var(--rule); background: transparent; color: var(--ink-2); font: 600 13px/1 inherit; font-family: inherit; min-width: 56px; min-height: 36px; border-radius: 999px; cursor: pointer; }
.quick button:hover { border-color: var(--act); color: var(--act); }
.quick button[aria-pressed="true"] { background: var(--act); border-color: var(--act); color: #fff; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; padding: 14px 16px 16px; border-top: 1px solid var(--rule); }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 0 18px; border-radius: 999px; font: 600 15px/1 inherit; font-family: inherit; cursor: pointer; text-decoration: none; border: 1px solid var(--act); background: var(--act); color: #fff; }
.btn--ghost { background: transparent; color: var(--act); }
.btn[disabled] { opacity: .45; cursor: default; }
.status { font-size: 13px; color: var(--ink-2); min-height: 20px; padding: 0 16px 12px; }
.status[data-busy="1"]::before { content: ""; display: inline-block; width: 10px; height: 10px; border: 2px solid var(--act); border-right-color: transparent; border-radius: 50%; margin-right: 6px; vertical-align: -1px; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .status[data-busy="1"]::before { animation: none; } }

/* Карточки разделов и клубов */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; padding: 0; margin: 0; list-style: none; }
.grid a { display: block; background: var(--sheet); border-radius: var(--radius-s); padding: 14px 16px; text-decoration: none; color: var(--ink); border: 1px solid var(--rule); min-height: 44px; }
.grid a:hover { border-color: var(--act); }
.grid small { display: block; color: var(--ink-2); font-size: 13px; margin-top: 2px; }

/* Цифры клуба */
.facts { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: 1px; background: var(--rule); border-radius: var(--radius-m); overflow: hidden; margin: 20px 0 0; }
.facts div { background: var(--sheet); padding: 14px 16px; }
.facts b { display: block; font: 600 28px/1.1 "Unbounded", sans-serif; letter-spacing: -.02em; }
.facts span { font-size: 13px; color: var(--ink-2); }
@media (max-width: 560px) { .facts { grid-template-columns: repeat(2, minmax(0,1fr)); } .facts b { font-size: 24px; } }

.list { background: var(--sheet); border-radius: var(--radius-m); box-shadow: var(--shadow); overflow: hidden; }
.list .row { display: grid; grid-template-columns: 64px minmax(0,1fr) auto; gap: 10px; align-items: center; padding: 10px 16px; border-top: 1px solid var(--rule); min-height: 44px; }
.list .row:first-child { border-top: 0; }
.list .rn { font-size: 13px; color: var(--ink-2); }
.list .res { font-weight: 700; }
.list .res.w { color: var(--up); } .list .res.l { color: var(--down); }
.round-h { padding: 12px 16px 6px; font-weight: 700; background: var(--paper); border-top: 1px solid var(--rule); }

/* Подвал */
.foot { margin-top: 56px; border-top: 1px solid var(--rule); padding: 28px 0 40px; font-size: 14px; color: var(--ink-2); }
.foot__cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 16px 24px; }
.foot ul { list-style: none; margin: 8px 0 0; padding: 0; }
.foot li a { display: inline-block; padding: 6px 0; color: var(--ink-2); }
.foot b { color: var(--ink); display: inline-block; padding: 6px 0; }
.foot b a { color: var(--ink); }
.foot p { margin: 20px 0 0; max-width: 70ch; }
.note { background: var(--sheet); border-left: 4px solid var(--act); padding: 12px 16px; border-radius: 0 var(--radius-s) var(--radius-s) 0; max-width: 68ch; }
/* Столбцы шансов: на телефоне один выбранный, на ПК все три */
@media (max-width: 560px) {
  .tbl .k { display: none; }
  .tbl[data-k="top6"] .k-top6, .tbl[data-k="title"] .k-title, .tbl[data-k="rel"] .k-rel { display: table-cell; }
}
@media (min-width: 561px) { .seg { display: none; } }

/* баннер согласия (только при TABELOMAT_GA) */
.consent { position: fixed; left: 0; right: 0; bottom: 0; z-index: 50; background: var(--sheet); border-top: 1px solid var(--rule); box-shadow: 0 -6px 18px -10px rgba(19,33,58,.35); padding: 14px 0 calc(14px + env(safe-area-inset-bottom)); }
.consent[hidden] { display: none; }
.consent__row { display: flex; align-items: center; gap: 16px; }
.consent__row p { margin: 0; flex: 1; font-size: 14px; line-height: 1.45; color: var(--ink-2); }
.consent__btns { display: flex; gap: 8px; flex-shrink: 0; }
@media (max-width: 640px) { .consent__row { flex-direction: column; align-items: stretch; gap: 10px; } .consent__btns .btn { flex: 1; } }
