/* EH : Events Hub — тёмная тема в стиле Edits : Helper. Цвета темы Telegram намеренно не используются. */
:root {
  --bg: #000;
  --surface: #0b0b0b;
  --surface-2: #0d0d0d;
  --tile: #141414;

  --line: #1a1a1a;
  --line-row: #1c1c1c;
  --line-strip: #1f1f1f;
  --line-btn: #262626;
  --line-chip: #2a2a2a;
  --line-strong: #333;

  --text: #fff;
  --text-2: #bfbfbf;
  --muted: #8f8f8f;
  --faint: #8a8a8a;
  --index: #5a5a5a;

  --green: #4ade80;
  --green-text: #6ff59c;
  --green-glow: 0 0 10px rgba(74, 222, 128, .6);
  --red: #ff3b30;
  --red-text: #ff5a50;

  --f-display: "Unbounded", system-ui, sans-serif;
  --f-body: "Golos Text", system-ui, sans-serif;
  --f-mono: "JetBrains Mono", ui-monospace, monospace;

  --pad: 16px;
  --gap: 20px;
  --tabbar-h: 64px;
}

* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }
html, body { background: var(--bg); color: var(--text); }
body {
  font: 400 15px/1.4 var(--f-body);
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}
button, input, textarea { font: inherit; color: inherit; background: none; border: 0; outline: 0; }
button { cursor: pointer; }
button:focus-visible, input:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.ic {
  width: 22px; height: 22px; flex: none;
  fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round;
}

/* ---------- каркас ---------- */
.app { max-width: 480px; margin: 0 auto; min-height: 100vh; }
.screen {
  display: flex; flex-direction: column; gap: var(--gap);
  /* Снизу место под панель переключателей */
  padding: 12px var(--pad) calc(var(--tabbar-h) + 40px + env(safe-area-inset-bottom));
}
/* Уходящий экран на время анимации перехода: остаётся на месте поверх, пока уезжает (см. showScreen) */
.screen.is-leaving {
  position: fixed; left: 0; right: 0; z-index: 5; width: 100%; max-width: 480px; margin: 0 auto;
  background: var(--bg); pointer-events: none;
}

.block { display: flex; flex-direction: column; gap: 12px; }

/* ---------- шапки ---------- */
.topbar { display: flex; align-items: center; justify-content: space-between; height: 44px; }
.topbar--back { justify-content: flex-start; gap: 12px; }
.brand { display: flex; align-items: center; gap: 10px; }
.brand__mark {
  width: 32px; height: 32px; border-radius: 10px;
  display: grid; place-items: center; background: #fff; color: #000;
}
.brand__mark .ic { width: 18px; height: 18px; stroke-width: 2.4; }
.brand__name { font: 600 16px var(--f-display); letter-spacing: -.01em; }
.brand__name i { font-style: normal; color: var(--index); }

.icon-btn {
  width: 44px; height: 44px; border-radius: 14px; flex: none;
  border: 1px solid var(--line-btn);
  display: grid; place-items: center;
}
.icon-btn:active { background: var(--surface); border-color: var(--line-strong); }

.kicker { font: 500 12px var(--f-mono); letter-spacing: .2em; text-transform: uppercase; color: var(--muted); }

.section-title {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  min-height: 24px; font: 500 15px var(--f-display);
}
.section-title > span:first-child { white-space: nowrap; }

.mono-meta {
  font: 500 11px/1.5 var(--f-mono); color: var(--faint);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

/* ---------- поле ссылки ---------- */
.link-input {
  display: flex; align-items: center; gap: 12px;
  height: 60px; padding: 0 8px 0 16px; border-radius: 16px;
  background: var(--surface); border: 1px solid var(--line-row);
  transition: border-color .15s;
}
.link-input:focus-within { border-color: var(--line-strong); }
.link-input.is-error { border-color: rgba(255, 59, 48, .55); }
/* 16px — меньше iOS при фокусе приближает страницу и сдвигает её вбок */
.link-input input { flex: 1; min-width: 0; height: 100%; font-size: 16px; outline: none; }

.link-input input::placeholder { color: #6f6f6f; }
.round-btn {
  width: 44px; height: 44px; flex: none; border-radius: 50%;
  border: 1px solid var(--line-strong); display: grid; place-items: center;
  transition: opacity .15s, transform .12s;
}
.round-btn .ic { width: 20px; height: 20px; }
.round-btn--solid { background: #fff; color: #000; border-color: #fff; }
.round-btn--solid .ic { stroke-width: 2.4; }
.round-btn:active { transform: scale(.94); }
.round-btn:disabled { opacity: .4; cursor: default; }
.round-btn.is-busy .ic { animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.hint { font: 500 11px var(--f-mono); color: #7a7a7a; padding: 0 4px; letter-spacing: .02em; }
.hint.is-error { color: var(--red-text); }

/* ---------- строки ---------- */
.row {
  display: flex; align-items: center; gap: 14px;
  min-height: 72px; padding: 12px 14px; border-radius: 16px;
  background: var(--surface); border: 1px solid var(--line-row);
  text-align: left; width: 100%;
  transition: background .15s, border-color .15s;
}
.row:active { background: var(--surface-2); border-color: var(--line-strong); }
.row__body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.row-title { font: 500 15px/1.3 var(--f-body); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
/* Длинное название кнопки на узком экране переносится, а не обрезается */
#appeal-btn .row-title { white-space: normal; }
/* Пояснение под заголовком строки — в несколько строк, в отличие от однострочного .mono-meta */
.row-note { font-size: 12px; line-height: 1.45; color: var(--faint); margin-top: 2px; }
.thumb {
  width: 44px; height: 56px; flex: none; border-radius: 10px;
  background: linear-gradient(160deg, #1a1a1a, #0f0f0f); border: 1px solid var(--line-strip);
  display: grid; place-items: center; color: var(--index);
}
.thumb svg { width: 16px; height: 16px; fill: currentColor; }

.pill {
  height: 26px; padding: 0 10px; flex: none; display: inline-flex; align-items: center;
  border-radius: 999px; font: 500 11px var(--f-mono); letter-spacing: .08em; text-transform: uppercase;
}
.pill--muted { border: 1px solid var(--line-strong); color: var(--muted); }

/* ---------- пустой список ---------- */
.empty {
  padding: 32px 16px; text-align: center; color: var(--faint);
  border: 1px dashed var(--line-btn); border-radius: 16px; font-size: 14px;
}

/* ---------- заголовок экрана ---------- */
.v-head { display: flex; flex-direction: column; gap: 10px; }
.v-title {
  font: 700 28px/1.06 var(--f-display); letter-spacing: -.02em; overflow-wrap: anywhere;
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden;
}

.status-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; min-width: 0; }
.status-row .mono-meta { white-space: normal; }
.chip-mono {
  display: inline-flex; align-items: center; gap: 6px; flex: none;
  height: 26px; padding: 0 10px; border-radius: 999px; border: 1px solid var(--line-chip);
  font: 500 11px var(--f-mono); color: var(--text-2);
}
.live-dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--green); box-shadow: var(--green-glow);
  animation: pulse 2.4s ease-in-out infinite;
}
.live-dot.is-off { background: #5a5a5a; box-shadow: none; animation: none; }

@keyframes pulse { 50% { opacity: .35; } }

.big { font: 500 24px/1.2 var(--f-mono); letter-spacing: -.02em; }

.sub { font: 500 11px/1.5 var(--f-mono); color: var(--faint); }

/* ---------- панели и кнопки ---------- */
.panel {
  background: var(--surface); border: 1px solid var(--line-row); border-radius: 16px;
  padding: 16px; display: flex; flex-direction: column; gap: 14px;
}

.btn-primary {
  height: 56px; width: 100%; border-radius: 16px; background: #fff; color: #000;
  display: flex; align-items: center; justify-content: center; gap: 8px;
  font: 600 15px var(--f-body); transition: transform .12s, opacity .15s;
}
.btn-primary .ic { width: 20px; height: 20px; stroke-width: 2.4; }
.btn-primary:active { transform: scale(.98); }
.btn-primary:disabled { opacity: .4; cursor: default; }
.btn-primary.is-busy { opacity: .6; cursor: progress; }

/* ---------- профиль ---------- */
.profile { display: flex; align-items: center; gap: 16px; }
.profile__who { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 6px; }
/* Запас вокруг имени внутри обрезки по строкам — чтобы свечение галочки не срезалось сверху, снизу и справа */
.profile .v-title { font-size: 24px; -webkit-line-clamp: 2; padding: 8px 10px 8px 0; margin: -8px -10px -8px 0; }
.profile .v-title.is-placeholder { color: var(--index); }

/* Галочка рядом с именем: восьмиконечная розетка с чёрной галкой и свечением своего цвета.
   Зелёная (team) — команда разработчиков и партнёры, белая (verified) — подтверждённый пользователь */
.badge { width: .82em; height: .82em; margin-left: .22em; vertical-align: -.08em; flex: none; }
.badge__seal { stroke-width: 1.6; stroke-linejoin: round; }
.badge__check { fill: none; stroke: #000; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }
.badge--team { filter: drop-shadow(0 0 6px rgba(74, 222, 128, .7)); }
.badge--team .badge__seal { fill: var(--green-text); stroke: var(--green-text); }
.badge--verified { filter: drop-shadow(0 0 5px rgba(255, 255, 255, .45)); }
.badge--verified .badge__seal { fill: #fff; stroke: #fff; }
.avatar {
  width: 72px; height: 72px; flex: none; border-radius: 50%; overflow: hidden;
  border: 1px solid var(--line-strong); display: grid; place-items: center; color: var(--muted);
}
.avatar .ic { width: 30px; height: 30px; }
.avatar img { width: 100%; height: 100%; object-fit: cover; display: block; }

/* ---------- карточка поверх экрана ---------- */
/* Затемнённый фон с размытием и карточка снизу; .is-open включает появление (см. openNameSheet в app.js) */
.sheet {
  position: fixed; inset: 0; z-index: 30;
  display: flex; align-items: flex-end; justify-content: center;
  padding: var(--pad) var(--pad) calc(var(--pad) + env(safe-area-inset-bottom));
  background: rgba(0, 0, 0, .6); -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
  opacity: 0; transition: opacity .25s;
}
.sheet.is-open { opacity: 1; }
.sheet__card {
  position: relative; width: 100%; max-width: calc(480px - 2 * var(--pad));
  display: flex; flex-direction: column; gap: 14px;
  padding: 24px 20px 20px; border-radius: 24px;
  background: var(--surface); border: 1px solid var(--line-chip);
  box-shadow: 0 -10px 40px rgba(0, 0, 0, .6);
  transform: translateY(24px) scale(.98); transition: transform .35s cubic-bezier(.22, 1, .36, 1);
}
.sheet.is-open .sheet__card { transform: none; }
.sheet__close {
  position: absolute; top: 12px; right: 12px; width: 36px; height: 36px; border-radius: 12px;
  display: grid; place-items: center; color: var(--muted);
}
.sheet__close .ic { width: 20px; height: 20px; }
.sheet__icon {
  width: 52px; height: 52px; border-radius: 16px; display: grid; place-items: center;
  background: #fff; color: #000;
}
.sheet__icon .ic { width: 26px; height: 26px; stroke-width: 2.2; }
.sheet__title { font: 700 22px/1.15 var(--f-display); letter-spacing: -.02em; }
.sheet__text { color: var(--text-2); font-size: 14px; line-height: 1.5; }
.sheet .link-input { background: #000; }
/* Высокая карточка (правка события) листается внутри, если не помещается на экран */
.sheet__card--tall { max-height: calc(100vh - 2 * var(--pad) - env(safe-area-inset-bottom)); overflow-y: auto; }
.sheet__actions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.btn-ghost--danger { color: var(--red-text); border-color: rgba(255, 59, 48, .4); }

/* Поле формы с подписью сверху */
.field { display: flex; flex-direction: column; gap: 6px; }
.field__label { font: 500 11px var(--f-mono); letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.field__input {
  width: 100%; min-height: 48px; padding: 12px 14px; border-radius: 14px;
  background: #000; border: 1px solid var(--line-row); font-size: 16px; transition: border-color .15s;
}
.field__input:focus { border-color: var(--line-strong); }
.field__input--area { resize: vertical; min-height: 96px; line-height: 1.45; }


/* ---------- карточки событий ---------- */
.event-card {
  width: 100%; text-align: left;
  padding: 16px; border-radius: 18px; background: var(--surface); border: 1px solid var(--line-row);
  display: flex; flex-direction: column; gap: 10px;
  transition: background .15s, border-color .15s, transform .12s;
}
.event-card:active { background: var(--surface-2); border-color: var(--line-strong); transform: scale(.99); }
.event-card__foot { display: flex; align-items: center; gap: 10px; }
/* Призовой фонд — справа внизу карточки, сумма зелёным акцентом приложения */
.prize { margin-left: auto; display: flex; flex-direction: column; align-items: flex-end; gap: 1px; text-align: right; min-width: 0; }
.prize__label { font: 500 10px var(--f-mono); letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.prize__value {
  font: 700 15px var(--f-display); color: var(--green-text); text-shadow: 0 0 10px rgba(74, 222, 128, .35);
  max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.prize-panel { flex-direction: row; align-items: center; justify-content: space-between; gap: 12px; }
.prize-panel__value {
  font: 700 22px var(--f-display); color: var(--green-text); text-shadow: 0 0 12px rgba(74, 222, 128, .4);
  text-align: right; overflow-wrap: anywhere;
}
.event-card__when {
  display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap;
  font: 500 12px var(--f-mono); color: var(--text-2);
}
.event-card__title { font: 700 19px/1.2 var(--f-display); letter-spacing: -.01em; overflow-wrap: anywhere; }
/* Описание — как его написал владелец, с переносами строк; длинное обрезается до шести строк */
.event-card__text {
  color: var(--text-2); font-size: 14px; line-height: 1.5; white-space: pre-line; overflow-wrap: anywhere;
  display: -webkit-box; -webkit-line-clamp: 6; -webkit-box-orient: vertical; overflow: hidden;
}
#archive .event-card { opacity: .75; }
/* Обложка — на всю ширину карточки сверху, без внутренних отступов */
.event-card.has-cover { overflow: hidden; }
.event-card__cover {
  display: block; width: calc(100% + 32px); margin: -16px -16px 2px; aspect-ratio: 16 / 9; object-fit: cover;
  background: var(--tile); border-bottom: 1px solid var(--line-row);
}

/* Тип события: турнир — белой плашкой, обычное событие — контуром */
.pill--kind { height: 22px; padding: 0 9px; font-size: 10px; border: 1px solid var(--line-strong); color: var(--muted); }
.pill--kind.is-tournament { background: #fff; border-color: #fff; color: #000; font-weight: 600; }

/* ---------- экран события ---------- */
.event-cover {
  display: block; width: 100%; aspect-ratio: 16 / 9; object-fit: cover; border-radius: 20px;
  background: var(--tile); border: 1px solid var(--line-row);
}
.event-pane { display: flex; flex-direction: column; gap: var(--gap); }

/* Переключатель «Событие / Объявления»: белую капсулу рисует .seg__pill (см. movePill в app.js) */
.seg {
  position: relative; display: flex; width: 100%; padding: 3px;
  background: #000; border: 1px solid var(--line-chip); border-radius: 12px;
}
.seg button {
  position: relative; z-index: 1; flex: 1; height: 38px; border-radius: 9px;
  font: 500 12px var(--f-mono); color: var(--muted); transition: color .25s .12s;
}
.seg button[aria-selected="true"] { color: #000; font-weight: 600; }
.seg__count { opacity: .7; }
/* Есть непрочитанные объявления — зелёная точка у вкладки */
.seg button.has-unread::after {
  content: ""; display: inline-block; width: 7px; height: 7px; margin-left: 6px; vertical-align: 1px;
  border-radius: 50%; background: var(--green); box-shadow: var(--green-glow);
}
/* Метка на карточке события: сколько новых объявлений */
.news-chip {
  display: inline-flex; align-items: center; gap: 6px; height: 22px; padding: 0 9px; border-radius: 999px;
  border: 1px solid rgba(74, 222, 128, .45); color: var(--green-text); font: 500 10px var(--f-mono);
  letter-spacing: .02em; white-space: nowrap;
}
.news-chip::before {
  content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--green); box-shadow: var(--green-glow);
}
.seg__pill {
  position: absolute; top: 3px; bottom: 3px; left: 3px; width: calc((100% - 6px) / var(--n, 2));
  border-radius: 9px; background: #fff; overflow: hidden; pointer-events: none;
  box-shadow: 0 0 18px rgba(255, 255, 255, .22);
}
.seg__pill::after {
  content: ""; position: absolute; inset: 0; transform: translateX(-120%);
  background: linear-gradient(100deg, transparent 20%, rgba(0, 0, 0, .12) 50%, transparent 80%);
}
.seg__pill.is-moving::after { animation: pill-shine .6s ease-out; }

/* Объявления */
.news-card {
  padding: 16px; border-radius: 18px; background: var(--surface); border: 1px solid var(--line-row);
  display: flex; flex-direction: column; gap: 8px;
}
.news-card__head { display: flex; align-items: center; justify-content: space-between; gap: 10px; min-height: 20px; }
.news-card__time { font: 500 11px var(--f-mono); color: var(--muted); }
.news-card__remove {
  width: 30px; height: 30px; margin: -6px -6px -6px 0; border-radius: 10px;
  display: grid; place-items: center; color: var(--index);
}
.news-card__remove .ic { width: 16px; height: 16px; }
.news-card__remove:active { background: var(--surface-2); color: var(--red-text); }
.news-card__title { font: 700 17px/1.25 var(--f-display); letter-spacing: -.01em; overflow-wrap: anywhere; }
.news-card__text { color: var(--text-2); font-size: 14px; line-height: 1.55; white-space: pre-line; overflow-wrap: anywhere; }

/* Обложка в карточке правки: превью и кнопки */
.cover-edit { display: flex; flex-direction: column; gap: 8px; }
.cover-edit__preview {
  position: relative; aspect-ratio: 16 / 9; border-radius: 14px; overflow: hidden;
  background: #000; border: 1px dashed var(--line-btn); display: grid; place-items: center;
}
.cover-edit__preview img { width: 100%; height: 100%; object-fit: cover; display: block; }
.cover-edit__preview.is-busy { opacity: .5; }
.cover-edit__empty { font: 500 11px var(--f-mono); color: var(--index); }
.cover-edit__actions { display: grid; grid-template-columns: repeat(auto-fit, minmax(0, 1fr)); gap: 8px; }
.cover-edit__pick { cursor: pointer; }

.event-title { font-size: 26px; }
.event-title-row { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.event-title-row .icon-btn { margin-top: -4px; }
.event-description {
  color: var(--text-2); font-size: 15px; line-height: 1.55; white-space: pre-line; overflow-wrap: anywhere;
}
.reg-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.reg-head .big { font-size: 20px; }
.reg-note { margin-top: -4px; font: 500 11px/1.5 var(--f-mono); color: var(--muted); text-align: center; }
/* Описание под названием: заметно, но тише заголовка */
.v-head .event-description { margin-top: -2px; }
/* Уже записан — кнопка отмены спокойная, контуром */
#event-reg-btn.is-registered { background: transparent; color: #fff; border: 1px solid var(--line-strong); }
#event-reg-btn:disabled { opacity: .55; }
.champion {
  display: flex; align-items: center; gap: 14px; padding: 16px; border-radius: 18px;
  background: var(--surface); border: 1px solid rgba(74, 222, 128, .35);
  box-shadow: 0 0 24px rgba(74, 222, 128, .12) inset;
}
.champion > .ic { width: 40px; height: 40px; padding: 9px; border-radius: 12px; box-sizing: border-box; background: var(--green-text); color: #000; stroke-width: 2.2; }
.champion__text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.champion__name { font: 700 18px var(--f-display); display: flex; align-items: center; }

/* ---------- турнирная сетка ---------- */
/* Сетка — отдельное окно, которое двигается во все стороны: пальцем на телефоне, перетаскиванием мышью
   на компьютере (см. enableDragPan в app.js). Внутри — холст фиксированного размера (renderBracket в
   app.js считает его в пикселях и расставляет раунды и матчи абсолютно, поэтому пара всегда ровно
   напротив своих матчей прошлого раунда), линии-соединения рисует SVG поверх того же холста */
.bracket-view { position: relative; }
.bracket {
  overflow: auto; max-height: 64vh;
  padding: 14px; border-radius: 18px; background: #050505; border: 1px solid var(--line-row);
  scrollbar-width: none; overscroll-behavior: contain; cursor: grab;
}
.bracket::-webkit-scrollbar { display: none; }
.bracket.is-dragging { cursor: grabbing; user-select: none; }
.bracket.is-dragging * { pointer-events: none; }
/* Подсказка в углу, пока сетка не помещается целиком */
.pan-hint {
  position: absolute; right: 10px; bottom: 10px; z-index: 1; pointer-events: none;
  display: inline-flex; align-items: center; gap: 6px; padding: 5px 9px; border-radius: 999px;
  background: rgba(0, 0, 0, .75); border: 1px solid var(--line-chip);
  font: 500 10px var(--f-mono); letter-spacing: .04em; color: var(--text-2);
  -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); transition: opacity .3s;
}
.pan-hint .ic { width: 13px; height: 13px; }
.pan-hint.is-gone { opacity: 0; }
.bracket__canvas { position: relative; }
.bracket__lines { position: absolute; top: 0; left: 0; overflow: visible; pointer-events: none; }
.bracket__line { fill: none; stroke: rgba(255, 255, 255, .22); stroke-width: 1.5; stroke-linejoin: round; }
/* Путь победителя — белым, чтобы его можно было проследить через всю сетку */
.bracket__line.is-lit { stroke: rgba(255, 255, 255, .85); }
.bracket__title {
  position: absolute; top: 0;
  font: 500 11px var(--f-mono); letter-spacing: .12em; text-transform: uppercase; color: var(--muted);
}
.match {
  position: absolute; z-index: 1; box-sizing: border-box;
  border-radius: 12px; background: var(--surface); border: 1px solid var(--line-row); overflow: hidden;
}
.match__side {
  display: flex; align-items: center; height: 34px; padding: 6px 10px;
  font: 500 13px var(--f-body); white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.match__side + .match__side { border-top: 1px solid var(--line); }
.match__side.is-winner { background: #fff; color: #000; font-weight: 600; }
/* На белой плашке победителя: зелёная — темнее, белая — чёрная с белой галкой; без свечения */
.match__side.is-winner .badge { filter: none; }
.match__side.is-winner .badge--team .badge__seal { fill: #16a34a; stroke: #16a34a; }
.match__side.is-winner .badge--verified .badge__seal { fill: #000; stroke: #000; }
.match__side.is-winner .badge--verified .badge__check { stroke: #fff; }
.match__side.is-loser { color: var(--index); text-decoration: line-through; }
.match__side.is-tbd, .match__side.is-bye { font: 500 11px var(--f-mono); color: var(--index); }
/* Своё имя в сетке — зелёная точка перед ним */
.match__side.is-me::before {
  content: ""; width: 6px; height: 6px; border-radius: 50%; margin-right: 7px; flex: none;
  background: var(--green); box-shadow: var(--green-glow);
}

/* ---------- кнопки над событиями ---------- */
.tiles-nav { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.tile-btn {
  min-height: 84px; padding: 14px; border-radius: 16px;
  display: flex; flex-direction: column; align-items: flex-start; justify-content: space-between; gap: 12px;
  background: var(--surface); border: 1px solid var(--line-row); text-align: left;
  font: 500 14px/1.25 var(--f-body);
  transition: background .15s, border-color .15s, transform .12s;
}
.tile-btn .ic {
  width: 36px; height: 36px; padding: 8px; border-radius: 11px; box-sizing: border-box;
  background: #fff; color: #000; stroke-width: 2.2;
}
.tile-btn:active { background: var(--surface-2); border-color: var(--line-strong); transform: scale(.98); }

/* ---------- таблица лидеров ---------- */
.place {
  width: 26px; flex: none; text-align: center;
  font: 600 15px var(--f-mono); color: var(--muted);
}
/* Первые три места выделяются: первое — белым со свечением, второе и третье — светлее остальных */
.place-1 .place { color: #fff; text-shadow: 0 0 10px rgba(255, 255, 255, .6); font-size: 17px; }
.place-2 .place, .place-3 .place { color: var(--text-2); }
.user-row.is-me .place { color: #000; text-shadow: none; }
.wins { flex: none; font: 500 12px var(--f-mono); color: var(--text-2); white-space: nowrap; }
.user-row.is-me .wins { color: #000; }
.leader-row { gap: 12px; }
.my-place {
  padding: 12px 14px; border-radius: 14px; border: 1px dashed var(--line-btn);
  font: 500 12px/1.4 var(--f-mono); color: var(--text-2);
}

/* ---------- пользователи ---------- */
.list { display: flex; flex-direction: column; gap: 8px; }
.ic--muted { color: var(--muted); }
/* Своё оформление поля поиска у браузеров (крестик, лупа) не нужно */
.link-input input[type="search"] { -webkit-appearance: none; appearance: none; }
.link-input input[type="search"]::-webkit-search-decoration { -webkit-appearance: none; }
/* Крестик очистки поиска: вместо синего системного — белый, в тон приложению */
.link-input input[type="search"]::-webkit-search-cancel-button {
  -webkit-appearance: none; appearance: none;
  width: 18px; height: 18px; margin-left: 8px; cursor: pointer; opacity: .75;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23fff' stroke-width='2.4' stroke-linecap='round'%3E%3Cpath d='M6 6l12 12M18 6L6 18'/%3E%3C/svg%3E") center / contain no-repeat;
}
.link-input input[type="search"]::-webkit-search-cancel-button:hover { opacity: 1; }
.user-row { min-height: 64px; cursor: default; }
.user-row:active { background: var(--surface); border-color: var(--line-row); }
/* Обрезается только текст имени (.name), а не вся строка — иначе срезается свечение галочки */
.user-row .row-title { display: flex; align-items: center; min-width: 0; overflow: visible; }
.user-row .row-title .name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-meta { display: flex; align-items: center; gap: 0; }
.tt-ic {
  width: 12px; height: 12px; flex: none; margin-right: 4px;
  fill: none; stroke: currentColor; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round;
}
/* Аватарка-заглушка: первая буква имени */
.initial {
  width: 40px; height: 40px; flex: none; border-radius: 50%; overflow: hidden;
  display: grid; place-items: center; background: var(--tile); border: 1px solid var(--line-strip);
  font: 600 15px var(--f-display); color: var(--text-2);
}
.initial img { width: 100%; height: 100%; object-fit: cover; display: block; }
/* Своя строка — светлая плашка целиком, приглушённая, чтобы не слепила на чёрном; по ней изредка пробегает блик */
.user-row.is-me, .user-row.is-me:active {
  position: relative; overflow: hidden;
  background: #dcdcdc; border-color: #dcdcdc; color: #000;
}
.user-row.is-me::after {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background: linear-gradient(100deg, transparent 30%, rgba(255, 255, 255, .7) 50%, transparent 70%);
  transform: translateX(-120%); animation: me-shine 5s ease-in-out 1s infinite;
}
@keyframes me-shine { 0% { transform: translateX(-120%); } 30%, 100% { transform: translateX(120%); } }
.user-row.is-me .mono-meta { color: #4a4a4a; }
.user-row.is-me .initial { background: #c8c8c8; border-color: #bdbdbd; color: #000; }
/* На белом светлая розетка теряется — темнее и без свечения */
.user-row.is-me .badge { filter: none; }
.user-row.is-me .badge--team .badge__seal { fill: #16a34a; stroke: #16a34a; }
.user-row.is-me .badge--verified .badge__seal { fill: #000; stroke: #000; }
.user-row.is-me .badge--verified .badge__check { stroke: #fff; }
.btn-ghost {
  height: 52px; border-radius: 16px; border: 1px solid var(--line-strong);
  display: flex; align-items: center; justify-content: center; gap: 8px;
  font: 600 15px var(--f-body); transition: transform .12s, background .15s;
}
.btn-ghost:active { transform: scale(.98); background: var(--surface-2); }
.btn-ghost:disabled { opacity: .5; cursor: progress; }

/* ---------- информация ---------- */
.thumb--icon { width: 44px; height: 44px; color: #fff; }

/* Правила: разделы карточками, номера пунктов — моноширинным, подпункты с отступом */
/* Справа место под полосу навигации, чтобы она не закрывала текст */
.rules { display: flex; flex-direction: column; gap: 12px; padding-right: 22px; }
/* Полоса навигации: длинная капсула вдоль правого края, номера разделов сверху вниз (buildRulesNav в app.js).
   Внутри колонки приложения и на широком экране; по ней можно вести пальцем — страница при этом не прокручивается */
.rules-nav {
  position: fixed; z-index: 6;
  right: max(6px, calc((100vw - 480px) / 2 + 6px));
  top: 104px; bottom: calc(var(--tabbar-h) + 28px + env(safe-area-inset-bottom));
  width: 26px; padding: 6px 0; border-radius: 999px;
  display: flex; flex-direction: column; align-items: center; justify-content: space-evenly;
  background: rgba(11, 11, 11, .78); border: 1px solid var(--line-chip);
  -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
  touch-action: none; user-select: none; cursor: pointer;
  transition: width .2s, background .2s;
}
.rules-nav.is-active { width: 32px; background: rgba(20, 20, 20, .92); }
.rules-nav__item {
  position: relative; z-index: 1; width: 20px; height: 20px; border-radius: 50%; display: grid; place-items: center;
  font: 600 10px var(--f-mono); color: var(--muted); pointer-events: none;
  transition: color .25s .1s;
}
.rules-nav__item.is-current { color: #000; }
/* Белый кружок под текущим номером: двигает его movePillY в app.js, как капсулу нижней панели */
.rules-nav__pill {
  position: absolute; top: 0; left: 50%; width: 22px; height: 22px; margin-left: -11px;
  border-radius: 50%; background: #fff; overflow: hidden; pointer-events: none;
  box-shadow: 0 0 12px rgba(255, 255, 255, .35); opacity: 0; transition: opacity .2s;
}
.rules-nav__pill.is-shown { opacity: 1; }
/* Блик, пробегающий по кружку во время перехода */
.rules-nav__pill::after {
  content: ""; position: absolute; inset: 0; transform: translateY(-120%);
  background: linear-gradient(190deg, transparent 20%, rgba(0, 0, 0, .14) 50%, transparent 80%);
}
.rules-nav__pill.is-moving::after { animation: pill-shine-y .6s ease-out; }
@keyframes pill-shine-y { to { transform: translateY(120%); } }
/* Название раздела рядом с полосой, пока её нажимают или ведут по ней пальцем */
.rules-nav__bubble {
  position: absolute; right: calc(100% + 10px); transform: translateY(-50%) translateX(6px);
  padding: 7px 12px; border-radius: 12px; background: #fff; color: #000;
  font: 600 13px var(--f-body); white-space: nowrap; pointer-events: none;
  opacity: 0; transition: opacity .2s, transform .2s; box-shadow: 0 6px 20px rgba(0, 0, 0, .5);
}
.rules-nav__bubble.is-shown { opacity: 1; transform: translateY(-50%); }
.rules__section { scroll-margin-top: 16px; }
.rules__section {
  padding: 16px; border-radius: 18px; background: var(--surface); border: 1px solid var(--line-row);
  display: flex; flex-direction: column; gap: 12px;
}
.rules__title { font: 700 17px/1.25 var(--f-display); letter-spacing: -.01em; }
.rules__list, .rules__sub { list-style: none; display: flex; flex-direction: column; gap: 10px; }
.rules__list > li { color: var(--text-2); font-size: 14px; line-height: 1.55; }
.rules__list b { font: 600 12px var(--f-mono); color: #fff; margin-right: 4px; }
.rules__sub { margin-top: 8px; padding-left: 14px; border-left: 1px solid var(--line-strong); gap: 8px; }
ul.rules__sub > li { position: relative; padding-left: 12px; }
ul.rules__sub > li::before { content: "—"; position: absolute; left: 0; color: var(--index); }
.thumb--icon .ic { width: 20px; height: 20px; fill: none; }
.ic--chevron { width: 18px; height: 18px; color: var(--index); }

/* ---------- нижние переключатели ---------- */
/* Капсула внизу экрана; белую «каплю» под выбранным разделом двигает liquidMove в app.js */
.tabbar {
  position: fixed; z-index: 10; left: 50%; transform: translateX(-50%);
  bottom: calc(12px + env(safe-area-inset-bottom));
  width: calc(100% - 2 * var(--pad)); max-width: calc(480px - 2 * var(--pad));
  height: var(--tabbar-h); padding: 4px; border-radius: 999px;
  display: grid; grid-template-columns: repeat(3, minmax(0, 1fr));
  background: rgba(11, 11, 11, .82); border: 1px solid var(--line-chip);
  -webkit-backdrop-filter: blur(18px); backdrop-filter: blur(18px);
  box-shadow: 0 10px 30px rgba(0, 0, 0, .6);
}
.tabbar button {
  position: relative; z-index: 1; min-width: 0; border-radius: 999px;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  font: 500 10px var(--f-mono); letter-spacing: .04em; color: var(--muted);
  transition: color .25s .1s;
}
.tabbar button span { max-width: 100%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tabbar .ic { width: 20px; height: 20px; }
.tabbar button[aria-selected="true"] { color: #000; font-weight: 600; }
.tabbar button[aria-selected="true"] .ic { stroke-width: 2.3; }
.tabbar__pill {
  position: absolute; top: 4px; bottom: 4px; left: 4px; width: calc((100% - 8px) / 3);
  border-radius: 999px; overflow: hidden; pointer-events: none;
  background: #fff; box-shadow: 0 0 18px rgba(255, 255, 255, .22);
}
/* Блик, пробегающий по капсуле во время перехода */
.tabbar__pill::after {
  content: ""; position: absolute; inset: 0; transform: translateX(-120%);
  background: linear-gradient(100deg, transparent 20%, rgba(0, 0, 0, .12) 50%, transparent 80%);
}
.tabbar__pill.is-moving::after { animation: pill-shine .6s ease-out; }
@keyframes pill-shine { to { transform: translateX(120%); } }

/* ---------- тост ---------- */
.toast {
  position: fixed; left: 50%; bottom: calc(var(--tabbar-h) + 24px + env(safe-area-inset-bottom));
  transform: translate(-50%, 12px); max-width: calc(100% - 32px);
  padding: 10px 16px; border-radius: 12px; background: #fff; color: #000; font: 500 13px var(--f-body);
  opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s; z-index: 20;
}
.toast.is-shown { opacity: 1; transform: translate(-50%, 0); }
/* Уведомление, которое можно нажать (новое объявление) — с зелёной точкой и стрелкой */
.toast.is-action.is-shown { pointer-events: auto; cursor: pointer; }
.toast.is-action { display: flex; align-items: center; gap: 8px; }
.toast.is-action::before {
  content: ""; width: 8px; height: 8px; flex: none; border-radius: 50%; background: #16a34a;
}
.toast.is-action::after { content: "›"; font-size: 18px; line-height: 1; margin-left: 2px; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
