/* Стиль по мотивам Apple Human Interface Guidelines:
   SF Pro, системные цвета iOS, сгруппированные списки, стекло, мягкие тени. */

:root {
  color-scheme: light dark;
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "SF Pro Display", "Helvetica Neue", "Segoe UI", Roboto, sans-serif;
  --font-display: -apple-system-headline, -apple-system, BlinkMacSystemFont, "SF Pro Display", "Helvetica Neue", sans-serif;
  --font-round: ui-rounded, "SF Pro Rounded", -apple-system, BlinkMacSystemFont, sans-serif;

  --bg: #f2f2f7;             /* systemGroupedBackground */
  --bg-elev: #ffffff;        /* secondarySystemGroupedBackground */
  --bg-fill: rgba(120, 120, 128, .12);  /* tertiarySystemFill */
  --bg-fill-2: rgba(120, 120, 128, .2);
  --label: #000000;
  --label-2: rgba(60, 60, 67, .6);
  --label-3: rgba(60, 60, 67, .3);
  --sep: rgba(60, 60, 67, .18);
  --blue: #007aff;
  --blue-tint: rgba(0, 122, 255, .1);
  --green: #34c759;
  --green-ink: #248a3d;
  --green-tint: rgba(52, 199, 89, .14);
  --red: #ff3b30;
  --orange: #ff9500;
  --orange-tint: rgba(255, 149, 0, .14);
  --gold: #ffd60a;
  --glass: rgba(242, 242, 247, .72);
  --shadow-card: 0 1px 2px rgba(0, 0, 0, .04), 0 4px 16px rgba(0, 0, 0, .05);
  --shadow-float: 0 10px 40px rgba(0, 0, 0, .16), 0 2px 8px rgba(0, 0, 0, .06);
  --r-sm: 10px;
  --r: 14px;
  --r-lg: 22px;
  --ease: cubic-bezier(.32, .72, 0, 1);
  --tab-on: var(--bg-elev);     /* выбранный сегмент */
  --card: var(--bg-elev);       /* карточка матча в сетке */
}

/* Тёмная тема: по системной настройке, если пользователь не выбрал светлую,
   или принудительно, если выбрал тёмную (атрибут data-theme на <html>). */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #000000;
    --bg-elev: #1c1c1e;
    --bg-fill: rgba(118, 118, 128, .24);
    --bg-fill-2: rgba(118, 118, 128, .36);
    --label: #ffffff;
    --label-2: rgba(235, 235, 245, .6);
    --label-3: rgba(235, 235, 245, .3);
    --sep: rgba(84, 84, 88, .6);
    --blue: #0a84ff;
    --blue-tint: rgba(10, 132, 255, .18);
    --green: #30d158;
    --green-ink: #30d158;
    --green-tint: rgba(48, 209, 88, .18);
    --red: #ff453a;
    --orange: #ff9f0a;
    --orange-tint: rgba(255, 159, 10, .18);
    --glass: rgba(22, 22, 24, .72);
    --shadow-card: 0 0 0 1px rgba(255, 255, 255, .04);
    --shadow-float: 0 12px 48px rgba(0, 0, 0, .6);
    --tab-on: #636366;
    --card: #2c2c2e;
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #000000;
  --bg-elev: #1c1c1e;
  --bg-fill: rgba(118, 118, 128, .24);
  --bg-fill-2: rgba(118, 118, 128, .36);
  --label: #ffffff;
  --label-2: rgba(235, 235, 245, .6);
  --label-3: rgba(235, 235, 245, .3);
  --sep: rgba(84, 84, 88, .6);
  --blue: #0a84ff;
  --blue-tint: rgba(10, 132, 255, .18);
  --green: #30d158;
  --green-ink: #30d158;
  --green-tint: rgba(48, 209, 88, .18);
  --red: #ff453a;
  --orange: #ff9f0a;
  --orange-tint: rgba(255, 159, 10, .18);
  --glass: rgba(22, 22, 24, .72);
  --shadow-card: 0 0 0 1px rgba(255, 255, 255, .04);
  --shadow-float: 0 12px 48px rgba(0, 0, 0, .6);
  --tab-on: #636366;
  --card: #2c2c2e;
}
:root[data-theme="light"] { color-scheme: light; }

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font: 17px/1.35 var(--font);
  letter-spacing: -.01em;
  color: var(--label);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  min-height: 100vh;
}
button, input, textarea { font: inherit; color: inherit; letter-spacing: inherit; }
a { color: var(--blue); text-decoration: none; }
code { font: 14px ui-monospace, "SF Mono", Menlo, monospace; background: var(--bg-fill); padding: 1px 6px; border-radius: 6px; }
h1 { font: 700 34px/1.12 var(--font-display); letter-spacing: -.022em; margin: 8px 0 6px; }
h2 { font: 600 22px/1.2 var(--font-display); letter-spacing: -.018em; margin: 0 0 12px; }
hr { border: 0; border-top: .5px solid var(--sep); margin: 20px 0; }

.muted { color: var(--label-2); }
.small { font-size: 13px; letter-spacing: -.005em; }
.center { text-align: center; }
.loading { padding: 30vh 20px; text-align: center; color: var(--label-2); }

/* ---------- панель навигации: стекло */
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: calc(10px + env(safe-area-inset-top)) max(20px, env(safe-area-inset-right)) 10px max(20px, env(safe-area-inset-left));
  background: var(--glass);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  backdrop-filter: saturate(180%) blur(20px);
  border-bottom: .5px solid var(--sep);
}
.brand { display: flex; align-items: center; gap: 9px; color: var(--label); font-weight: 600; font-size: 17px; }
.brand img { width: 28px; height: 28px; border-radius: 7px; box-shadow: 0 1px 3px rgba(0,0,0,.15); }
.topbar-right { display: flex; align-items: center; gap: 8px; min-width: 0; }

.sync { display: inline-flex; align-items: center; gap: 7px; font-size: 13px; color: var(--label-2); white-space: nowrap; }
.sync i { width: 7px; height: 7px; border-radius: 50%; background: var(--green); flex: none; }
.sync.busy i { background: var(--blue); animation: pulse 1s infinite ease-in-out; }
.sync.warn i { background: var(--orange); }
@keyframes pulse { 50% { opacity: .3; } }

/* ---------- страница */
.page { padding: 12px max(20px, env(safe-area-inset-right)) calc(56px + env(safe-area-inset-bottom)) max(20px, env(safe-area-inset-left)); margin: 0 auto; animation: rise .5s var(--ease) both; }
.page.narrow { max-width: 680px; }
.page.wide { max-width: none; }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } }

.back { display: inline-block; margin: 6px 0 2px; color: var(--blue); font-size: 17px; }
.linkish { background: none; border: 0; padding: 0; color: var(--blue); cursor: pointer; font: inherit; }
.row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }

/* ---------- кнопки */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 36px; padding: 7px 16px;
  border: 0; border-radius: 980px;
  background: var(--bg-fill); color: var(--blue);
  font-weight: 500; font-size: 15px; cursor: pointer;
  transition: transform .2s var(--ease), background-color .2s, opacity .2s;
  user-select: none; -webkit-user-select: none;
}
.btn:hover { background: var(--bg-fill-2); }
.btn:active { transform: scale(.97); opacity: .8; }
.btn:disabled { opacity: .35; pointer-events: none; }
.btn.primary { background: var(--blue); color: #fff; }
.btn.primary:hover { filter: brightness(1.08); }
.btn.ghost { background: transparent; }
.btn.ghost:hover { background: var(--bg-fill); }
.btn.danger { color: var(--red); }
.btn.big { min-height: 50px; padding: 12px 22px; font-size: 17px; font-weight: 600; border-radius: var(--r); }
.btn.wide { width: 100%; }
.btn.small-btn { min-height: 32px; padding: 5px 12px; font-size: 14px; }
.btn:focus-visible, .pr.pick:focus-visible, .chip:focus-visible, .tab:focus-visible { outline: 3px solid color-mix(in srgb, var(--blue) 50%, transparent); outline-offset: 2px; }

/* ---------- главная */
.hero { padding: 18px 0 8px; }
.hero h1 { font-size: 40px; }
.hero p { font-size: 19px; max-width: 34em; margin: 4px 0 22px; }
.sec-title { margin: 34px 4px 8px; font-size: 13px; font-weight: 400; text-transform: uppercase; letter-spacing: .02em; color: var(--label-2); }
.tlist { background: var(--bg-elev); border-radius: var(--r); overflow: hidden; box-shadow: var(--shadow-card); }
.tcard { display: block; padding: 13px 40px 13px 16px; color: var(--label); position: relative; transition: background-color .15s; }
.tcard + .tcard::before { content: ""; position: absolute; left: 16px; right: 0; top: 0; border-top: .5px solid var(--sep); }
.tcard::after { content: ""; position: absolute; right: 18px; top: 50%; width: 8px; height: 8px; border: solid var(--label-3); border-width: 2px 2px 0 0; transform: translateY(-50%) rotate(45deg); }
.tcard:hover { background: var(--bg-fill); }
.tcard-name { font-weight: 500; }

/* ---------- заметки */
.note { padding: 12px 14px; border-radius: var(--r-sm); background: var(--bg-fill); font-size: 15px; margin: 10px 0; }
.note.warn { background: var(--orange-tint); }
.note.err { background: color-mix(in srgb, var(--red) 14%, transparent); color: var(--red); }
.warnings { margin: 14px 0; }
.warnings .note { margin: 6px 0; }

/* ---------- формы */
.field { display: block; margin: 18px 0; }
.field > span { display: block; font-size: 13px; text-transform: uppercase; letter-spacing: .02em; color: var(--label-2); margin: 0 4px 6px; }
.field p { margin: 0 4px 10px; }
.field input, textarea, .search, .link {
  width: 100%; padding: 12px 14px;
  background: var(--bg-elev); border: 0; border-radius: var(--r-sm);
  box-shadow: var(--shadow-card); outline: none;
  transition: box-shadow .2s;
}
.field input:focus, textarea:focus, .search:focus { box-shadow: 0 0 0 3px color-mix(in srgb, var(--blue) 35%, transparent); }
textarea { resize: vertical; min-height: 200px; font: 14px/1.45 ui-monospace, "SF Mono", Menlo, monospace; }
.copybox { min-height: 240px; }
.link { font-size: 15px; }

/* ---------- предпросмотр импорта */
.found { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin: 18px 0; }
.found > div { background: var(--bg-elev); border-radius: var(--r); padding: 18px; box-shadow: var(--shadow-card); font-size: 15px; color: var(--label-2); }
.found b { display: block; font: 700 28px/1.1 var(--font-round); color: var(--label); letter-spacing: -.02em; }
.teams { background: var(--bg-elev); border-radius: var(--r); overflow: hidden; box-shadow: var(--shadow-card); margin: 16px 0 24px; }
.team { position: relative; }
.team + .team::before { content: ""; position: absolute; left: 16px; right: 0; top: 0; border-top: .5px solid var(--sep); }
.team summary { list-style: none; display: flex; justify-content: space-between; gap: 12px; padding: 12px 16px; cursor: pointer; }
.team summary::-webkit-details-marker { display: none; }
.team summary .muted { white-space: nowrap; font-variant-numeric: tabular-nums; }
.team.empty summary .muted { color: var(--orange); }
.team ol { margin: 0; padding: 0 16px 12px 40px; color: var(--label-2); font-size: 15px; }
.team ol li { padding: 2px 0; }

.panel { background: var(--bg-elev); border-radius: var(--r); padding: 18px; box-shadow: var(--shadow-card); margin: 16px 0; }
.panel h2 { font-size: 17px; }
.radio, .check { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 10px; padding: 10px 0; cursor: pointer; }
.radio .muted, .check .muted { flex-basis: 100%; padding-left: 30px; }
.radio input, .check input { width: 20px; height: 20px; accent-color: var(--blue); margin: 0; transform: translateY(3px); }

.unit-pick { margin: 4px 0 18px; }
.unit-pick > span.muted { display: block; margin: 0 4px 6px; text-transform: uppercase; letter-spacing: .02em; }
.unit-pick .tabs { margin: 0 0 8px; }
.unit-pick p { margin: 0 4px; }

/* ---------- шапка турнира */
.thead { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-end; gap: 12px 20px; padding: 8px 0 16px; }
.thead h1 { margin: 4px 0; }
.meta { color: var(--label-2); font-size: 15px; font-variant-numeric: tabular-nums; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; }

.champion {
  position: relative; overflow: hidden;
  margin: 0 0 18px; padding: 18px 20px; border-radius: var(--r-lg);
  background: linear-gradient(135deg, #ffe066 0%, #ffcc00 45%, #ff9f0a 100%);
  color: #3a2800; font-size: 19px; box-shadow: 0 8px 30px rgba(255, 170, 0, .3);
  animation: shine-in .8s var(--ease) both;
}
.champion b { font-weight: 700; }
.champion span { opacity: .7; font-size: 15px; margin-left: 6px; }
.champion::after { content: ""; position: absolute; inset: 0; background: linear-gradient(110deg, transparent 30%, rgba(255,255,255,.55) 50%, transparent 70%); transform: translateX(-100%); animation: sweep 2.4s 0.4s var(--ease); }
@keyframes shine-in { from { opacity: 0; transform: scale(.96); } }
@keyframes sweep { to { transform: translateX(100%); } }

.result-card { background: var(--bg-elev); border-radius: var(--r-lg); padding: 16px 18px; margin: 0 0 18px; box-shadow: var(--shadow-card); }
.rc-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 10px; }
.rc-head h2 { margin: 0; font-size: 17px; }
.rc-text { margin: 0; padding: 12px 14px; border-radius: var(--r-sm); background: var(--bg-fill); font: 16px/1.6 var(--font); white-space: pre-wrap; overflow-wrap: anywhere; user-select: all; -webkit-user-select: all; }
.result-card .muted { margin: 8px 2px 0; }

/* Сегментированный переключатель */
.tabs {
  display: inline-flex; gap: 2px; padding: 2px; margin: 0 0 18px;
  background: var(--bg-fill); border-radius: 9px;
}
.tab {
  border: 0; background: transparent; cursor: pointer;
  padding: 6px 18px; border-radius: 7px; font-size: 14px; font-weight: 500;
  transition: background-color .25s var(--ease), box-shadow .25s var(--ease);
  display: inline-flex; align-items: center; gap: 6px;
}
.tab.on { background: var(--tab-on); box-shadow: 0 3px 8px rgba(0,0,0,.12), 0 1px 1px rgba(0,0,0,.04); font-weight: 600; }
.tab { white-space: nowrap; }
.count { font: 600 12px/1 var(--font-round); background: var(--red); color: #fff; padding: 3px 7px; border-radius: 10px; }
.hint { margin: 0; }
.board-tools { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin: -6px 2px 12px; }
.board-tools .btn { flex: none; }

/* ---------- режим «на весь экран» */
body.stage-mode { overflow: hidden; }
.stage { position: fixed; inset: 0; z-index: 30; display: flex; flex-direction: column; background: var(--bg); }
.stage-bar {
  display: flex; align-items: center; gap: 16px; padding: 10px 20px;
  background: var(--glass); border-bottom: .5px solid var(--sep);
  -webkit-backdrop-filter: saturate(180%) blur(20px); backdrop-filter: saturate(180%) blur(20px);
}
.stage-name { font-size: 20px; letter-spacing: -.01em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.stage-name span { color: var(--label-2); }
.stage-info { flex: 1; display: flex; justify-content: center; font-size: 15px; }
.stage-info .chip-live { font-size: 13px; padding: 5px 12px; border-radius: 14px; }
.stage-champ { font-weight: 700; font-size: 17px; }
.stage-bar .tabs { margin: 0; }
.stage-fit { position: relative; flex: 1; overflow: hidden; margin: 14px 18px 18px; }
.stage-board { position: absolute; left: 0; top: 0; transform-origin: 0 0; }
.stage-sec { position: absolute; }
.stage-sec-title { height: 34px; font-size: 15px; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; color: var(--label-2); }
.stage .board { position: absolute; }
.stage .mc { border-radius: 10px; }
.stage .mc-h { padding-top: 3px; }
.stage .pr { font-size: 13px; }

/* ---------- сетка на компьютере */
.bsec { margin: 0 0 28px; }
.bsec-title { font-size: 13px; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; color: var(--label-2); margin: 0 2px 8px; }
.board-scroll {
  overflow: auto; background: var(--bg-elev); border-radius: var(--r-lg); box-shadow: var(--shadow-card);
  padding: 16px 20px 20px; -webkit-overflow-scrolling: touch; overscroll-behavior-x: contain;
}
.board { position: relative; }
.col-title { position: absolute; top: 0; font-size: 12px; font-weight: 600; color: var(--label-2); letter-spacing: .01em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lines { position: absolute; inset: 0; pointer-events: none; overflow: visible; }
.lines path { fill: none; stroke: var(--sep); stroke-width: 1.5; stroke-linejoin: round; }

.mc {
  position: absolute; display: flex; flex-direction: column;
  background: var(--card); border-radius: 12px; cursor: pointer;
  box-shadow: 0 0 0 .5px var(--sep), 0 1px 3px rgba(0,0,0,.05);
  transition: box-shadow .25s var(--ease), transform .25s var(--ease);
  overflow: hidden;
}
.mc:hover { box-shadow: 0 0 0 .5px var(--sep), var(--shadow-float); transform: translateY(-1px); z-index: 2; }
.mc.ready { box-shadow: 0 0 0 1.5px var(--blue), 0 4px 14px color-mix(in srgb, var(--blue) 22%, transparent); }
.mc.skipped, .mc.pending { opacity: .72; }
.mc-h { display: flex; justify-content: space-between; padding: 5px 10px 1px; font-size: 11px; font-weight: 600; color: var(--label-3); font-variant-numeric: tabular-nums; }
.mc-sub { min-width: 0; margin-left: 10px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 500; }
.mc.ready .mc-h span:last-child { color: var(--blue); font-weight: 500; }
.mc.done .mc-h span:last-child { color: var(--green); }
.pr {
  flex: 1; display: flex; align-items: center; gap: 8px; min-width: 0;
  padding: 0 10px; font-size: 13px; font-weight: 500; text-align: left;
  border: 0; background: transparent; margin: 0 3px; border-radius: 7px;
}
.pr + .pr { margin-bottom: 3px; }
.pr .nm { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pr .tm { flex: none; max-width: 30%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 11px; font-weight: 400; color: var(--label-2); }
.pr.tbd { color: var(--label-3); font-weight: 400; font-style: normal; }
.pr.win { background: var(--green-tint); font-weight: 650; }
.pr.win .nm::before { content: "✓ "; color: var(--green-ink); }
.pr.lose { color: var(--label-3); }
.pr.lose .tm { color: var(--label-3); }
.pr.pick { cursor: pointer; transition: background-color .15s, color .15s; }
.pr.pick:hover { background: var(--blue); color: #fff; }
.pr.pick:hover .tm { color: rgba(255,255,255,.8); }
.pr.pick:active { transform: scale(.98); }

/* ---------- большие карточки матчей (телефон, «К игре», диалог) */
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(330px, 1fr)); gap: 16px; align-items: start; }
.bc {
  background: var(--bg-elev); border-radius: var(--r-lg); padding: 16px; box-shadow: var(--shadow-card);
  animation: rise .4s var(--ease) both;
}
.cards .bc:nth-child(2) { animation-delay: .03s; }
.cards .bc:nth-child(3) { animation-delay: .06s; }
.cards .bc:nth-child(4) { animation-delay: .09s; }
.cards .bc:nth-child(n+5) { animation-delay: .12s; }
.bc.ready { box-shadow: 0 0 0 1.5px var(--blue), var(--shadow-card); }
.bc header { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 10px; margin-bottom: 12px; }
.bc .num { font: 700 20px/1.2 var(--font-round); letter-spacing: -.01em; }
.bc .rt { color: var(--label-2); font-size: 14px; flex: 1; min-width: 0; }
.badge { font-size: 12px; font-weight: 600; padding: 3px 9px; border-radius: 20px; background: var(--bg-fill); color: var(--label-2); }
.badge.ready { background: var(--blue-tint); color: var(--blue); }
.badge.done { background: var(--green-tint); color: var(--green-ink); }

.side {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 12px 12px 14px; border-radius: var(--r); background: var(--bg-fill);
  transition: background-color .3s var(--ease);
}
.side .who { flex: 1; min-width: 0; }
.side .nm { font-size: 17px; font-weight: 600; overflow-wrap: anywhere; }
.side .tm { font-size: 13px; color: var(--label-2); margin-top: 1px; }
.side.tbd .nm { color: var(--label-3); font-weight: 400; }
.side.win { background: var(--green-tint); }
.side.lose { opacity: .55; }
.vs { text-align: center; font-size: 11px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--label-3); padding: 5px 0; }
.win-btn {
  min-height: 48px; min-width: 132px; padding: 10px 18px; border-radius: 12px;
  background: var(--blue); color: #fff; font-weight: 600; font-size: 16px;
  box-shadow: 0 2px 8px color-mix(in srgb, var(--blue) 30%, transparent);
}
.win-btn:hover { background: var(--blue); filter: brightness(1.08); }
.tag-win { color: var(--green-ink); font-weight: 600; font-size: 15px; white-space: nowrap; }
.tag-out { color: var(--red); font-weight: 600; font-size: 13px; white-space: nowrap; }
.bc footer { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; margin-top: 12px; }
.bc footer .muted { flex: 1 1 200px; }

.empty-state { padding: 60px 20px; text-align: center; color: var(--label-2); font-size: 17px; background: var(--bg-elev); border-radius: var(--r-lg); box-shadow: var(--shadow-card); }

/* Лента раундов на телефоне */
.chips {
  display: flex; gap: 8px; overflow-x: auto; margin: 0 -20px 16px; padding: 2px 20px 6px;
  scrollbar-width: none; scroll-snap-type: x proximity; -webkit-overflow-scrolling: touch;
}
.chips::-webkit-scrollbar { display: none; }
.chip {
  flex: none; display: inline-flex; align-items: center; gap: 6px; scroll-snap-align: center;
  min-height: 38px; padding: 8px 14px; border: 0; border-radius: 20px; cursor: pointer;
  background: var(--bg-elev); box-shadow: var(--shadow-card); font-size: 15px; font-weight: 500;
  transition: background-color .2s, color .2s, transform .2s var(--ease);
}
.chip:active { transform: scale(.96); }
.chip.on { background: var(--label); color: var(--bg); }
.dot { width: 7px; height: 7px; border-radius: 50%; flex: none; }
.dot.ready { background: var(--blue); }
.dot.done { background: var(--green); }
.chip.on .dot.ready { background: #64d2ff; }

/* ---------- идёт игра */
.mc.live, .mc.live:hover {
  background: color-mix(in srgb, var(--orange) 22%, var(--card));
  box-shadow: 0 0 0 2px var(--orange), 0 4px 16px color-mix(in srgb, var(--orange) 35%, transparent);
}
.mc.live .pr .tm { color: color-mix(in srgb, var(--label) 60%, transparent); }
.mc-num { display: inline-flex; align-items: center; gap: 6px; min-width: 0; }
.chip-live {
  border: 0; cursor: pointer; font: 700 10px/1 var(--font); letter-spacing: .02em; white-space: nowrap;
  padding: 3px 7px; border-radius: 10px; background: var(--orange-tint); color: var(--orange);
  transition: background-color .15s, color .15s, transform .15s var(--ease);
}
button.chip-live:hover { background: var(--orange); color: #fff; }
button.chip-live:active { transform: scale(.94); }
.chip-live.on { background: var(--orange); color: #fff; animation: live-blink 1.6s ease-in-out infinite; }
.dlg-body > .bc .live-banner { margin: 0 0 12px; border-radius: 10px; }
.bc.live { background: color-mix(in srgb, var(--orange) 14%, var(--bg-elev)); }
.live-banner {
  margin: -16px -16px 12px; padding: 7px 16px; border-radius: var(--r-lg) var(--r-lg) 0 0;
  background: var(--orange); color: #fff; font-size: 13px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase;
}
.mc.live::after { content: ""; position: absolute; inset: 0; border-radius: inherit; pointer-events: none; animation: live-pulse 1.8s ease-in-out infinite; }
.bc.live { box-shadow: 0 0 0 2px var(--orange), 0 6px 20px color-mix(in srgb, var(--orange) 25%, transparent); }
.badge.live { background: var(--orange-tint); color: var(--orange); animation: live-blink 1.6s ease-in-out infinite; }
.live-btn { width: 100%; min-height: 44px; margin: 0 0 12px; font-weight: 600; background: var(--orange-tint); color: var(--orange); }
.live-btn:hover { background: color-mix(in srgb, var(--orange) 24%, transparent); }
.live-btn.on { background: var(--bg-fill); color: var(--label-2); }
.count.live { background: var(--orange); }
.dot.live { background: var(--orange); animation: live-blink 1.6s ease-in-out infinite; }
.play-title { display: flex; align-items: center; gap: 8px; font-size: 15px; font-weight: 600; color: var(--label-2); margin: 6px 2px 12px; }
.play-title + .cards { margin-bottom: 26px; }
@keyframes live-pulse { 50% { box-shadow: 0 0 0 5px color-mix(in srgb, var(--orange) 22%, transparent); } }
@keyframes live-blink { 50% { opacity: .55; } }

.note.viewer { background: var(--blue-tint); margin: 0 0 16px; }
.field-label { margin: 0 0 2px; font-weight: 600; }
.dlg-body .link { margin: 8px 0 0; }

/* ---------- участники */
.people { max-width: 980px; }
.quality { padding: 14px 16px; }
.quality summary { cursor: pointer; font-size: 15px; }
.quality ul { margin: 6px 0 0; padding-left: 22px; font-size: 15px; font-variant-numeric: tabular-nums; }
.search { margin: 0; -webkit-appearance: none; appearance: none; }
.people-tools { display: flex; gap: 10px; align-items: center; margin: 0 0 14px; }
.people-tools .search { flex: 1; }
.people-tools .btn { min-height: 44px; white-space: nowrap; }
.pname { display: flex; align-items: flex-start; gap: 6px; }
.edit-btn { flex: none; border: 0; background: transparent; color: var(--blue); font-size: 15px; line-height: 1; padding: 2px 6px; border-radius: 6px; cursor: pointer; opacity: .7; }
.edit-btn:hover { opacity: 1; background: var(--blue-tint); }
.ptable { width: 100%; border-collapse: separate; border-spacing: 0; background: var(--bg-elev); border-radius: var(--r); overflow: hidden; box-shadow: var(--shadow-card); font-size: 15px; }
.ptable th { text-align: left; font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .03em; color: var(--label-2); padding: 12px 12px 8px; border-bottom: .5px solid var(--sep); }
.ptable td { padding: 11px 12px; border-bottom: .5px solid var(--sep); vertical-align: top; font-variant-numeric: tabular-nums; }
.ptable tr:last-child td { border-bottom: 0; }
.ptable tr.row-eliminated td { color: var(--label-2); }
.st { display: inline-block; font-size: 12px; font-weight: 600; padding: 3px 8px; border-radius: 6px; white-space: nowrap; }
.st.on { background: var(--blue-tint); color: var(--blue); }
.st.out { background: var(--bg-fill); color: var(--label-2); letter-spacing: .04em; }
.st.champ { background: var(--gold); color: #3a2800; }
.ptable tr.row-champion td { font-weight: 600; }
.show-m { display: none; }

/* ---------- диалог: лист iOS */
dialog {
  border: 0; padding: 0; margin: auto; width: min(480px, calc(100vw - 32px)); max-height: calc(100vh - 48px);
  background: var(--bg); color: var(--label); border-radius: var(--r-lg); box-shadow: var(--shadow-float);
  overflow: auto;
}
dialog[open] { animation: pop .35s var(--ease); }
dialog::backdrop { background: rgba(0, 0, 0, .32); -webkit-backdrop-filter: blur(2px); backdrop-filter: blur(2px); animation: fade .3s; }
@keyframes pop { from { opacity: 0; transform: scale(.94); } }
@keyframes fade { from { opacity: 0; } }
.dlg-body { padding: 22px 20px 20px; }
.dlg-body > .bc { box-shadow: none; padding: 0; background: transparent; animation: none; }
.dlg-body > .bc .side { background: var(--bg-elev); }
.dlg-body > .bc .side.win { background: var(--green-tint); }
.dlg-body .field input { background: var(--bg-elev); }
.dlg-actions { display: flex; flex-direction: column; gap: 10px; margin-top: 20px; }
.dlg-actions .btn:not(.primary):not(.ghost) { background: var(--bg-elev); }

/* ---------- всплывающее уведомление */
#toast {
  position: fixed; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom)); z-index: 50;
  display: flex; align-items: center; gap: 14px; max-width: calc(100vw - 32px);
  padding: 12px 12px 12px 18px; border-radius: 16px;
  background: rgba(30, 30, 32, .86); color: #fff; font-size: 15px;
  -webkit-backdrop-filter: blur(20px) saturate(180%); backdrop-filter: blur(20px) saturate(180%);
  box-shadow: var(--shadow-float);
  transform: translate(-50%, 140%); opacity: 0; pointer-events: none;
  transition: transform .45s var(--ease), opacity .3s;
}
#toast.show { transform: translate(-50%, 0); opacity: 1; pointer-events: auto; }
.toast-btn { border: 0; background: rgba(255,255,255,.16); color: #64d2ff; font-weight: 600; padding: 7px 12px; border-radius: 10px; cursor: pointer; white-space: nowrap; }

/* ---------- телефон */
@media (max-width: 760px) {
  body { font-size: 17px; }
  h1 { font-size: 30px; }
  .hero h1 { font-size: 34px; }
  .hero .btn { flex: 1 1 100%; }
  .topbar { padding-left: 16px; padding-right: 16px; }
  .sync span { display: none; }
  .sync.warn span { display: inline; max-width: 46vw; overflow: hidden; text-overflow: ellipsis; }
  .page { padding-left: 16px; padding-right: 16px; }
  .chips { margin: 0 -16px 14px; padding-left: 16px; padding-right: 16px; }
  .thead { padding-bottom: 12px; }
  .actions { width: 100%; }
  .actions .btn { flex: 1; padding: 7px 8px; }
  .tabs { display: flex; width: 100%; }
  .tab { flex: 1; justify-content: center; padding: 7px 6px; }
  .cards { grid-template-columns: 1fr; gap: 12px; }
  .bc { padding: 14px; }
  .live-banner { margin: -14px -14px 12px; padding: 7px 14px; }
  .win-btn { min-width: 0; min-height: 52px; padding: 10px 14px; font-size: 15px; }
  .side .nm { font-size: 16px; }
  .hide-m { display: none; }
  .show-m { display: block; }
  .ptable { font-size: 14px; }
  .ptable th, .ptable td { padding-left: 8px; padding-right: 8px; }
  .found b { font-size: 24px; }

  /* Диалог выезжает снизу, как лист iOS */
  dialog {
    width: 100vw; max-width: 100vw; margin: auto 0 0; max-height: 92vh;
    border-radius: var(--r-lg) var(--r-lg) 0 0;
    padding-bottom: env(safe-area-inset-bottom);
  }
  dialog[open] { animation: sheet .45s var(--ease); }
  .dlg-body { padding-top: 26px; position: relative; }
  .dlg-body::before { content: ""; position: absolute; top: 8px; left: 50%; width: 36px; height: 5px; margin-left: -18px; border-radius: 3px; background: var(--label-3); }
}
@keyframes sheet { from { transform: translateY(100%); } }

.still .page, .still .bc { animation: none; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* Переключатель темы */
.theme-btn { min-height: 32px; padding: 5px 12px; font-size: 14px; gap: 6px; color: var(--label-2); }
.theme-btn b { font-weight: 500; }
@media (max-width: 760px) { .theme-btn b { display: none; } }

/* ---------- публичные страницы (лендинг, статьи, вход) */
.site-nav { gap: 6px; }
.site-nav > a:not(.btn) { color: var(--label-2); font-size: 15px; padding: 6px 10px; border-radius: 8px; }
.site-nav > a:not(.btn):hover { color: var(--label); background: var(--bg-fill); }
.site-page { padding-top: 28px; }
.site-hero { text-align: center; padding: 40px 0 28px; }
.site-hero h1 { font-size: 52px; letter-spacing: -.03em; margin: 0 auto 14px; max-width: 13em; }
.site-hero .lead { font-size: 21px; color: var(--label-2); max-width: 32em; margin: 0 auto 26px; line-height: 1.45; }
.cta-row { justify-content: center; flex-direction: column; gap: 10px; margin: 8px 0 12px; }
.cta-row .muted { max-width: 34em; text-align: center; }
.prose .cta-row { align-items: flex-start; }
.prose .cta-row .muted { text-align: left; }
.feature-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 14px; margin: 28px 0 40px; }
.feature { background: var(--bg-elev); border-radius: var(--r-lg); padding: 20px; box-shadow: var(--shadow-card); }
.feature-icon { font-size: 28px; margin-bottom: 8px; }
.feature h3 { margin: 0 0 6px; font-size: 17px; }
.feature p { margin: 0; color: var(--label-2); font-size: 15px; line-height: 1.45; }
.steps { margin: 0 0 40px; }
.steps ol { padding-left: 22px; font-size: 17px; line-height: 1.6; }
.faq { margin: 0 0 40px; }
.faq details { margin: 0 0 10px; padding: 14px 18px; }
.faq summary { cursor: pointer; font-weight: 600; }
.faq details p { margin: 10px 0 0; color: var(--label-2); line-height: 1.5; }
.donate-band { text-align: center; padding: 28px; margin-bottom: 40px; }
.prose { font-size: 17px; line-height: 1.6; }
.prose h2 { margin: 28px 0 8px; }
.prose p, .prose ul { color: var(--label); }
.login-box { max-width: 420px; margin: 20px auto; padding: 28px; text-align: center; }
.login-box h1 { margin-top: 0; }
.login-yandex b { display: inline-grid; place-items: center; width: 24px; height: 24px; border-radius: 50%; background: #fc3f1d; color: #fff; font-size: 14px; }
.login-google b { display: inline-grid; place-items: center; width: 24px; height: 24px; border-radius: 50%; background: #fff; color: #4285f4; font-size: 14px; box-shadow: 0 0 0 1px var(--sep); }
.site-footer { border-top: .5px solid var(--sep); padding: 26px 20px 40px; text-align: center; }
.foot-links { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px 18px; margin-bottom: 10px; font-size: 14px; }
.foot-links a { color: var(--label-2); }
.foot-links a:hover { color: var(--blue); }
.user-chip { display: inline-flex; align-items: center; gap: 8px; font-size: 14px; color: var(--label-2); }
.user-chip img { width: 26px; height: 26px; border-radius: 50%; }
@media (max-width: 760px) {
  .site-hero h1 { font-size: 34px; }
  .site-hero .lead { font-size: 17px; }
  .site-nav .btn.primary { display: none; }
}

.account-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 6px 0 4px; }
.donate-line { margin: 20px 0 0; }
.result-card .donate-line { margin: 10px 2px 0; }
.page.narrow.site-page { max-width: 1000px; }
.site-page .prose, .site-page .steps, .site-page .faq, .site-page .donate-band { max-width: 720px; margin-left: auto; margin-right: auto; }
.site-page .feature-grid { grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }

.support-link { white-space: nowrap; }
.site-nav > a.support-link:not(.btn) { color: var(--blue); }
