/* Светлая минималистичная тема, mobile-first. */

:root {
    --bg:        #ffffff;
    --surface:   #ffffff;
    --text:      #1a1a1a;
    --muted:     #6b7280;
    --border:    #e5e7eb;
    --accent:    #2563eb;
    --accent-d:  #1d4ed8;
    --green:     #16a34a;
    --red:       #dc2626;
    --amber:     #d97706;
    --radius:    12px;
    --gap:       16px;
    --maxw:      720px;
    --font:      -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    padding: 0;
    background: #f7f8fa;
    color: var(--text);
    font-family: var(--font);
    font-size: 16px;
    line-height: 1.45;
    -webkit-text-size-adjust: 100%;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

/* --- Шапка --- */
.topbar {
    position: sticky;
    top: 0;
    z-index: 10;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
}
.topbar-inner {
    max-width: var(--maxw);
    margin: 0 auto;
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 9px 12px;
    flex-wrap: wrap;
}
.brand { font-weight: 700; font-size: 16px; color: var(--text); white-space: nowrap; }
.brand:hover { text-decoration: none; }
.nav { display: flex; gap: 2px; }
.nav-link {
    padding: 5px 7px;
    border-radius: 8px;
    color: var(--muted);
    font-size: 14px;
    white-space: nowrap;
}
.nav-link:hover { background: #f3f4f6; text-decoration: none; }
.nav-link.is-active { color: var(--accent); background: #eff6ff; }
.nav-chat { display: inline-flex; align-items: center; gap: 5px; }
.nav-badge {
    display: inline-flex; align-items: center; justify-content: center;
    min-width: 18px; height: 18px; padding: 0 5px;
    background: var(--red); color: #fff;
    font-size: 11px; font-weight: 700; line-height: 1;
    border-radius: 999px;
}
.topbar-user { margin-left: auto; display: flex; align-items: center; gap: 6px; }
.user-name { font-size: 14px; color: var(--muted); }
.user-points {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 14px;
    font-weight: 700;
    padding: 3px 10px;
    border-radius: 999px;
    background: #eff6ff;
    color: var(--accent);
    white-space: nowrap;
}
.user-points .up-icon { font-size: 13px; line-height: 1; }
.user-points:hover { text-decoration: none; filter: brightness(0.97); }
.user-name-link { display: none; font-size: 14px; color: var(--muted); }
.user-name-link:hover { color: var(--accent); text-decoration: none; }
@media (min-width: 600px) { .user-name-link { display: inline; } }
.user-points.up-plus  { background: #ecfdf5; color: var(--green); }
.user-points.up-minus { background: #fef2f2; color: var(--red); }
.rank-cup { font-size: 13px; font-weight: 700; padding: 2px 8px; border-radius: 999px; color: #fff; white-space: nowrap; }
.rank-cup-1 { background: #eab308; }
.rank-cup-2 { background: #9ca3af; }
.rank-cup-3 { background: #b45309; }
.nav-logout { color: var(--red); }

/* --- Контейнер --- */
.container {
    max-width: var(--maxw);
    margin: 0 auto;
    padding: 20px 16px 60px;
}
.page-h1 { font-size: 22px; margin: 4px 0 16px; }
.next-day-note { margin: -10px 0 16px; font-size: 14px; font-weight: 600; }

/* --- Алёрты --- */
.alert {
    padding: 12px 14px;
    border-radius: var(--radius);
    margin-bottom: 16px;
    font-size: 15px;
}
.alert-ok    { background: #ecfdf5; color: #065f46; border: 1px solid #a7f3d0; }
.alert-error { background: #fef2f2; color: #991b1b; border: 1px solid #fecaca; }

/* --- Карточка матча (главная) --- */
.match-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px;
    margin-bottom: 16px;
}
.match-top {
    display: flex;
    justify-content: space-between;
    font-size: 13px;
    color: var(--muted);
    margin-bottom: 12px;
}
.match-stage { font-weight: 600; }
.match-teams {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
}
.team { display: flex; flex-direction: column; align-items: center; gap: 4px; text-align: center; }
.team-name { font-weight: 600; font-size: 15px; }
.flag { font-size: 30px; line-height: 1; }
.flag-img {
    height: 1em;
    width: 1.34em;           /* единое соотношение 4:3 для всех флагов */
    object-fit: cover;       /* заполняет рамку без искажения пропорций */
    vertical-align: -0.18em;
    border-radius: 2px;
    box-shadow: 0 0 0 1px rgba(0, 0, 0, .12);
    display: inline-block;
    flex: none;              /* не сжимается во flex-контейнерах */
}
.flag-na { opacity: .5; }
.match-score { font-size: 22px; font-weight: 700; white-space: nowrap; }
.match-score .vs { color: var(--muted); font-weight: 400; }

.closed-note { text-align: center; margin: 12px 0 0; }

/* --- Кликабельная голова карточки матча раскрывает инфо о командах --- */
.match-head { cursor: pointer; display: block; list-style: none; }
.match-head::-webkit-details-marker { display: none; }
.mc-caret {
    margin-left: 6px;
    display: inline-block;
    color: var(--muted);
    transition: transform .15s;
}
.match-info[open] .mc-caret { transform: rotate(180deg); }
.match-info .match-detail {
    border-top: 1px solid var(--border);
    margin-top: 12px;
    padding: 12px 0 0;
}

/* --- Своя ставка в карточке матча (выделенный блок) --- */
.my-bet {
    margin-top: 12px;
    padding: 12px 14px;
    background: #eff6ff;
    border: 1px solid #bfdbfe;
    border-radius: 10px;
}
.mb-label { display: block; font-size: 12px; color: var(--accent); font-weight: 700; text-transform: uppercase; letter-spacing: .03em; }
.my-bet .bet-markets { margin-top: 8px; align-items: center; }
.my-bet .market-chip { background: #fff; border-color: #bfdbfe; }
.bet-potential { display: flex; gap: 8px; margin-top: 10px; flex-wrap: wrap; }
.pot { font-size: 13px; font-weight: 700; padding: 3px 10px; border-radius: 999px; }
.pot-win { background: #ecfdf5; color: var(--green); }
.pot-lose { background: #fef2f2; color: var(--red); }

/* Всплывающая отметка результата AJAX-ставки. */
.bet-flash {
    margin: 10px 0 0;
    padding: 8px 12px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
}
.bet-flash-ok  { background: #ecfdf5; color: #065f46; border: 1px solid #a7f3d0; }
.bet-flash-err { background: #fef2f2; color: #991b1b; border: 1px solid #fecaca; }

/* --- Форма ставки --- */
.bet-toggle {
    margin-top: 12px;
    background: #f7f8fa;
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 12px 14px;
}
.bet-toggle > summary {
    cursor: pointer;
    font-weight: 600;
    color: var(--accent);
    list-style: none;
    padding: 4px 0;
}
.bet-toggle > summary::-webkit-details-marker { display: none; }
.bet-toggle > summary::before { content: "▸ "; }
.bet-toggle[open] > summary::before { content: "▾ "; }

.bet-form { margin-top: 12px; }
.markets {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}
.market { display: flex; flex-direction: column; gap: 4px; }
.market-label { font-size: 12px; color: var(--muted); font-weight: 600; }
.mk-pts { font-weight: 700; }
.mk-pts .pp { color: var(--green); }
.mk-pts .pm { color: var(--red); }
.market select, .market input {
    padding: 9px 10px;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 15px;
    font-family: inherit;
    background: #fff;
    width: 100%;
}
.score-inputs { display: flex; align-items: center; gap: 6px; }
.score-inputs input { width: 100%; text-align: center; }
.score-inputs .colon { font-weight: 700; }

.bet-controls {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    margin-top: 12px;
}
.market-mult { flex-direction: row; align-items: center; gap: 6px; }
.market-mult select { width: auto; }
.mult-fixed { font-weight: 700; font-size: 16px; }
.checkbox { display: flex; align-items: center; gap: 6px; font-size: 14px; cursor: pointer; }
.checkbox input { width: auto; }
.hint { font-size: 12px; color: var(--muted); margin: 8px 0 0; }

/* --- Кнопки --- */
.btn {
    display: inline-block;
    padding: 9px 16px;
    border: 1px solid transparent;
    border-radius: 8px;
    font-size: 15px;
    font-family: inherit;
    cursor: pointer;
    background: #f3f4f6;
    color: var(--text);
}
.btn:hover { text-decoration: none; filter: brightness(0.97); }
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-d); }
.btn-ghost { background: #fff; border-color: var(--border); color: var(--muted); }
.btn-block { width: 100%; }
.btn-sm { padding: 6px 10px; font-size: 13px; }
.btn-del { background: #fff; border-color: #fecaca; color: var(--red); }
.btn-del:hover { background: #fef2f2; }
.bet-delete { margin-top: 10px; }

/* --- Список ставок --- */
.bets-title { font-size: 14px; color: var(--muted); margin: 16px 0 8px; text-transform: uppercase; letter-spacing: .03em; }
.bets-list { display: flex; flex-direction: column; gap: 8px; }
.bet-row {
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 10px 12px;
    background: #fafafa;
}
.bet-row.is-mine { background: #eff6ff; border-color: #bfdbfe; }
.bet-head { display: flex; justify-content: space-between; align-items: center; }
.bet-user { font-weight: 600; font-size: 14px; }
.bet-meta { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--muted); }
.mult-badge { background: var(--amber); color: #fff; border-radius: 6px; padding: 1px 6px; font-weight: 700; font-size: 12px; }
.bet-markets { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.market-chip { background: #fff; border: 1px solid var(--border); border-radius: 999px; padding: 3px 10px; font-size: 13px; }
.market-chip .mk-res { font-weight: 700; margin-left: 5px; }
.market-chip .mk-res.pp { color: var(--green); }
.market-chip .mk-res.pm { color: var(--red); }
.bet-hidden { margin-top: 6px; font-size: 13px; color: var(--muted); font-style: italic; }
.pts { font-weight: 700; }
.pts-plus { color: var(--green); }
.pts-minus { color: var(--red); }

/* --- Лента активности --- */
.feed { margin-top: 28px; }
.feed-list { display: flex; flex-direction: column; gap: 2px; }
.feed-item {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 10px 12px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 8px;
}
.feed-icon { font-size: 18px; line-height: 1.3; flex: none; }
.feed-body { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.feed-text { font-size: 14px; line-height: 1.45; }
.feed-detail { font-weight: 600; }
.feed-detail .flag { font-size: 14px; margin: 0 3px 0 1px; vertical-align: -1px; }
.feed-time { font-size: 12px; color: var(--muted); }

/* --- Инструкция по ставкам --- */
.rules {
    margin-top: 28px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
}
.rules > summary {
    cursor: pointer;
    padding: 14px 16px;
    font-weight: 700;
    list-style: none;
}
.rules > summary::-webkit-details-marker { display: none; }
.rules-body { padding: 0 16px 16px; }
.rules-body p { font-size: 14px; }
.rules-table { width: 100%; border-collapse: collapse; margin: 12px 0; }
.rules-table th, .rules-table td { padding: 8px 10px; border-bottom: 1px solid var(--border); font-size: 13px; text-align: left; }
.rules-table th { color: var(--muted); text-transform: uppercase; font-size: 11px; letter-spacing: .03em; }
.rules-table .col-num { text-align: center; font-weight: 700; white-space: nowrap; }
.rules-body h4 { margin: 14px 0 8px; font-size: 14px; }
.rules-examples { margin: 0; padding-left: 18px; }
.rules-examples li { font-size: 14px; margin-bottom: 8px; }
.rules .pp { color: var(--green); }
.rules .pm { color: var(--red); }

/* --- Блок «ещё матчи» --- */
.show-more-matches { margin-top: 4px; }
.more-matches { display: none; margin-top: 16px; }
.more-matches.is-open { display: block; }
.all-matches-link { display: block; width: 100%; box-sizing: border-box; margin-top: 10px; text-align: center; }

/* --- Общий блок ставок внизу главной --- */
.all-bets { margin-top: 28px; padding-top: 8px; border-top: 2px solid var(--border); }
.all-bets-note { font-size: 13px; margin: 0 0 16px; }
.all-bets-match { margin-bottom: 20px; }
.ab-match-title { font-size: 15px; margin: 0 0 8px; display: flex; align-items: center; gap: 8px; }
.ab-match-title .flag { font-size: 20px; }
.ab-time { margin-left: auto; font-size: 13px; color: var(--muted); font-weight: 400; }

.muted { color: var(--muted); }
.empty-state { text-align: center; padding: 40px 16px; color: var(--muted); }
.link { color: var(--accent); }

/* --- Вкладки --- */
.tabs { display: flex; gap: 4px; margin-bottom: 16px; background: #eef0f3; padding: 4px; border-radius: 10px; }
.tab { flex: 1; text-align: center; padding: 8px; border-radius: 8px; color: var(--muted); font-weight: 600; }
.tab:hover { text-decoration: none; }
.tab.is-active { background: #fff; color: var(--text); box-shadow: 0 1px 2px rgba(0,0,0,.06); }

/* --- Матчи: группировка по дням, строка на матч --- */
.day-title { font-size: 15px; color: var(--muted); margin: 20px 0 8px; font-weight: 700; }
.day-title:first-of-type { margin-top: 4px; }
.day-matches {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
}
.day-matches .match-acc { border-bottom: 1px solid var(--border); }
.day-matches .match-acc:last-child { border-bottom: none; }

.match-row {
    display: grid;
    grid-template-columns: 44px 1fr auto 1fr;
    align-items: center;
    gap: 8px;
    padding: 11px 12px;
}
.match-row.has-result { grid-template-columns: 44px 1fr auto 1fr auto; }
.mr-time { font-size: 13px; color: var(--muted); }
.mr-team { display: flex; align-items: center; gap: 6px; font-weight: 600; font-size: 14px; min-width: 0; }
.mr-team .flag { font-size: 18px; flex: none; }
.mr-home { justify-content: flex-end; text-align: right; }
.mr-away { justify-content: flex-start; text-align: left; }
.mr-score { font-weight: 700; white-space: nowrap; min-width: 36px; text-align: center; }
.mr-score .vs { color: var(--muted); font-weight: 400; }
.mr-result { font-size: 13px; font-weight: 700; white-space: nowrap; grid-column: 1 / -1; text-align: right; }

/* --- Аккордеон (детали матча) --- */
.match-acc {
    background: var(--surface);
}
.match-summary { cursor: pointer; padding: 12px 14px; list-style: none; }
.match-summary::-webkit-details-marker { display: none; }
.match-summary-main { display: flex; justify-content: space-between; font-size: 12px; color: var(--muted); margin-bottom: 8px; }
.match-summary-teams {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    gap: 8px;
    font-weight: 600;
}
.ms-team { display: flex; align-items: center; gap: 6px; }
.ms-team .flag { font-size: 22px; }
.ms-team-away { justify-content: flex-end; }
.ms-score { font-weight: 700; white-space: nowrap; }
.ms-score .vs { color: var(--muted); }
.ms-result { margin-top: 10px; font-size: 13px; display: flex; align-items: center; gap: 8px; justify-content: center; }
.res-win { color: var(--green); }
.res-lose { color: var(--red); }
.res-none { color: var(--muted); }

.match-detail { border-top: 1px solid var(--border); padding: 14px; display: grid; gap: 16px; }
.team-detail-head { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.team-detail-name { font-weight: 700; }
.rank-badge { margin-left: auto; font-size: 12px; background: #eff6ff; color: var(--accent); border-radius: 6px; padding: 2px 8px; }
.players { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.player { display: grid; grid-template-columns: 36px 1fr auto; gap: 8px; align-items: center; font-size: 14px; padding: 6px 0; border-bottom: 1px solid #f1f2f4; }
.player-pos { font-size: 11px; color: var(--muted); font-weight: 700; }
.player-name { font-weight: 600; }
.player-club { grid-column: 2; font-size: 12px; color: var(--muted); }
.player-value { font-size: 13px; color: var(--amber); font-weight: 600; white-space: nowrap; }

/* --- Таблицы --- */
.table-wrap { overflow-x: auto; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 10px 12px; text-align: left; border-bottom: 1px solid var(--border); }
th { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .03em; }
tr:last-child td { border-bottom: none; }
.col-num { text-align: center; }
.col-total { font-size: 17px; }
.standings .is-me { background: #eff6ff; }

/* Уплотнение турнирной таблицы на телефоне */
@media (max-width: 600px) {
    .standings th, .standings td { padding: 7px 5px; font-size: 13px; }
    .standings th { font-size: 11px; }
    .standings .col-pos { padding-left: 8px; }
    .standings .col-total { font-size: 15px; }
    .standings .col-name { font-size: 13px; line-height: 1.2; }
    .standings .medal { width: 20px; height: 20px; font-size: 11px; }
}
.medal { display: inline-flex; width: 24px; height: 24px; align-items: center; justify-content: center; border-radius: 50%; font-weight: 700; color: #fff; font-size: 13px; }
.medal-1 { background: #eab308; }
.medal-2 { background: #9ca3af; }
.medal-3 { background: #b45309; }

/* --- Аналитика --- */
.an-day { margin-bottom: 28px; }
.an-match { margin-bottom: 18px; }
.an-match-head {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 700;
    font-size: 15px;
    margin-bottom: 8px;
    padding: 8px 10px;
    background: #f3f4f6;
    border-radius: 8px;
}
.an-match-head .flag { font-size: 20px; }
.an-match-name { min-width: 0; }
.an-match-name.an-right { text-align: right; margin-left: auto; }
.an-match-score { font-weight: 700; white-space: nowrap; padding: 0 4px; }
.an-empty { margin: 0 0 8px; padding-left: 10px; }
.an-table td, .an-table th { font-size: 14px; vertical-align: middle; }
.an-table .an-user { font-weight: 600; white-space: nowrap; }
.an-table .bet-markets { margin: 0; }
.an-table .is-me { background: #eff6ff; }
.an-day-total-title { font-size: 14px; color: var(--muted); text-transform: uppercase; letter-spacing: .03em; margin: 14px 0 8px; }
.an-day-total td { font-weight: 600; }

/* --- Админка --- */
.admin-block { margin-bottom: 28px; }
.admin-block h2 { font-size: 18px; margin: 0 0 12px; }
.admin-table td, .admin-table th { font-size: 14px; }
.inline-form { display: inline-flex; align-items: center; gap: 4px; margin: 0; }
.mini-input { width: 48px; padding: 5px; text-align: center; border: 1px solid var(--border); border-radius: 6px; }
.nowrap { white-space: nowrap; }
.mono { font-family: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace; }
.row-settled { background: #fafafa; }
.mt-extra { display: none; }
.show-all-matches { margin-top: 12px; }
.badge { font-size: 12px; padding: 2px 8px; border-radius: 6px; }
.badge-done { background: #ecfdf5; color: #065f46; }
.badge-wait { background: #fffbeb; color: #92400e; }
.form-inline-wrap { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 16px; align-items: center; }
.form-inline-wrap input[type=text] { padding: 8px 10px; border: 1px solid var(--border); border-radius: 8px; font-size: 14px; font-family: inherit; }

/* --- Журнал --- */
.log-table td { font-size: 13px; }
.log-page { color: var(--muted); max-width: 200px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.log-act { font-size: 12px; padding: 1px 7px; border-radius: 6px; background: #f3f4f6; white-space: nowrap; }
.log-act-login_ok { background: #ecfdf5; color: #065f46; }
.log-act-login_fail { background: #fef2f2; color: #991b1b; }
.log-act-logout { background: #fffbeb; color: #92400e; }
.log-fail td { background: #fef2f2; }

/* --- Логин --- */
.login-page { display: flex; min-height: 100vh; align-items: center; justify-content: center; padding: 20px; }
.login-card { background: #fff; border: 1px solid var(--border); border-radius: 16px; padding: 28px; width: 100%; max-width: 360px; }
.login-title { font-size: 22px; margin: 0 0 4px; text-align: center; }
.login-sub { color: var(--muted); text-align: center; margin: 0 0 20px; font-size: 14px; }
.form { display: flex; flex-direction: column; gap: 14px; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field span { font-size: 13px; color: var(--muted); font-weight: 600; }
.field input { padding: 10px 12px; border: 1px solid var(--border); border-radius: 8px; font-size: 16px; font-family: inherit; }

/* --- Профиль / любимые команды --- */
.profile-points {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 18px;
    margin-bottom: 20px;
    padding: 12px 14px;
    background: #eff6ff;
    border: 1px solid #bfdbfe;
    border-radius: var(--radius);
}
.profile-points b { font-size: 22px; color: var(--accent); }
.section-h2 { font-size: 16px; margin: 20px 0 10px; }

/* --- Блок Telegram в профиле --- */
.tg-block {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px;
    margin: 18px 0 24px;
}
.tg-block .section-h2 { margin-top: 0; }
.tg-block p { margin: 0 0 10px; }
.tg-block p:last-child { margin-bottom: 0; }

/* --- Прогноз на призёров --- */
.podium-block {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 14px 16px;
    margin-bottom: 8px;
}
.podium-block .section-h2 { margin-top: 0; }
.podium-form { display: flex; flex-direction: column; gap: 10px; }
.podium-slot { display: flex; align-items: center; gap: 10px; }
.podium-label { width: 92px; font-weight: 700; font-size: 14px; flex: none; }
.podium-slot select {
    flex: 1;
    padding: 9px 10px;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 15px;
    font-family: inherit;
    background: #fff;
}
.podium-form .btn { align-self: flex-start; margin-top: 4px; }
.podium-readonly { display: flex; flex-direction: column; gap: 8px; }
.podium-team { display: flex; align-items: center; gap: 6px; font-weight: 600; }
.podium-team .flag { font-size: 20px; }
.fav-hint { font-size: 14px; }
.team-list { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.team-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    border-bottom: 1px solid var(--border);
}
.team-row:last-child { border-bottom: none; }
.team-row .flag { font-size: 22px; }
.tr-name { flex: 1; font-weight: 600; font-size: 15px; min-width: 0; }
.tr-rank { font-size: 12px; color: var(--muted); white-space: nowrap; }
.tr-added { font-size: 12px; color: var(--accent); white-space: nowrap; }
.fav-btn {
    border: none;
    background: none;
    cursor: pointer;
    font-size: 22px;
    line-height: 1;
    color: #d1d5db;
    padding: 4px;
    transition: transform .1s, color .15s;
}
.fav-btn:hover { transform: scale(1.15); }
.fav-btn.is-fav { color: #e0245e; }
.fav-btn:disabled { opacity: .5; cursor: default; }

/* --- Чат (стиль Telegram) --- */
/* Полноэкранный чат (без общей шапки/футера). dvh — корректная высота на телефоне с клавиатурой/адрес-баром. */
.chat-body { margin: 0; height: 100vh; height: 100dvh; overflow: hidden; background: #f0f2f5; }
.chat {
    display: flex;
    flex-direction: column;
    height: 100vh;
    height: 100dvh;
    max-width: 760px;
    margin: 0 auto;
    background: var(--surface);
    border-left: 1px solid var(--border);
    border-right: 1px solid var(--border);
    overflow: hidden;
}
.chat-top {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 10px 14px;
    padding-top: calc(10px + env(safe-area-inset-top));
    font-weight: 700;
    border-bottom: 1px solid var(--border);
    background: var(--surface);
}
.chat-back {
    text-decoration: none;
    color: var(--accent);
    font-size: 26px;
    line-height: 1;
    padding: 0 6px 2px 0;
    flex: none;
}
.chat-top-title { font-size: 16px; }
.chat-log {
    flex: 1;
    overflow-y: auto;
    padding: 14px 12px;
    background: #f0f2f5;
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.chat-loading { text-align: center; color: var(--muted); margin: auto; }

.day-sep { text-align: center; margin: 8px 0; }
.day-sep span { background: rgba(0,0,0,.08); color: #444; font-size: 12px; padding: 3px 12px; border-radius: 999px; }

/* Полоса «Непрочитанные сообщения». */
.unread-sep {
    display: flex; align-items: center; gap: 10px;
    margin: 10px 2px; color: var(--accent);
}
.unread-sep::before, .unread-sep::after {
    content: ''; flex: 1; height: 1px; background: var(--accent); opacity: .35;
}
.unread-sep span { font-size: 12px; font-weight: 600; white-space: nowrap; }

/* Системная строка активности (ставка/любимые/призёры) — по центру, бледным. */
.sys-msg {
    align-self: center;
    max-width: 90%;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: rgba(0,0,0,.05);
    color: #555;
    font-size: 12.5px;
    line-height: 1.3;
    padding: 5px 12px;
    border-radius: 999px;
    margin: 2px 0;
}
.sys-icon { flex: none; }
.sys-text { min-width: 0; }
.sys-text b { color: #333; }
.sys-note { color: var(--muted); }
.sys-text .flag-img { vertical-align: -2px; margin: 0 1px; }
.sys-time { flex: none; color: var(--muted); font-size: 11px; }

.msg { display: flex; align-items: flex-end; gap: 8px; max-width: 85%; }
.msg-mine { align-self: flex-end; flex-direction: row-reverse; }
.msg-avatar {
    width: 32px; height: 32px; border-radius: 50%; flex: none;
    color: #fff; font-size: 12px; font-weight: 700;
    display: flex; align-items: center; justify-content: center;
}
.msg-wrap { display: flex; flex-direction: column; min-width: 0; }
.msg-name { font-size: 12px; font-weight: 700; margin: 0 0 2px 2px; }
.msg-bubble {
    position: relative;
    background: #fff;
    border-radius: 14px 14px 14px 4px;
    padding: 7px 11px 5px;
    box-shadow: 0 1px 1px rgba(0,0,0,.07);
    font-size: 15px;
    line-height: 1.35;
    word-break: break-word;
}
.msg-mine .msg-bubble { background: #d9fdd3; border-radius: 14px 14px 4px 14px; }
.msg-text { white-space: pre-wrap; }
.msg-link { color: var(--accent); text-decoration: underline; word-break: break-all; }
.msg-mine .msg-link { color: #0a7d33; }
.msg-time { font-size: 10px; color: var(--muted); margin-left: 8px; float: right; position: relative; top: 5px; }
.msg-del, .msg-reply-btn, .msg-react-btn {
    border: none; background: none; cursor: pointer; color: var(--muted);
    font-size: 12px; padding: 0 0 0 6px; opacity: .45;
}
.msg-del:hover { opacity: 1; color: var(--red); }
.msg-reply-btn:hover { opacity: 1; color: var(--accent); }
.msg-react-btn {
    display: inline-flex; align-items: center; justify-content: center;
    width: 18px; height: 18px; padding: 0; margin-left: 6px;
    border: 1px solid var(--border); border-radius: 50%;
    font-size: 13px; line-height: 1; color: var(--muted);
    opacity: .4; transition: opacity .15s;
}
.msg-react-btn:hover { opacity: 1; border-color: var(--accent); color: var(--accent); }

/* Глаз «кто видел» + попап со списком */
.msg-seen-btn {
    border: none; background: none; cursor: pointer;
    font-size: 12px; padding: 0 0 0 6px; opacity: .5; line-height: 1;
}
.msg-seen-btn:hover { opacity: 1; }
.msg-seen-btn[hidden] { display: none; }
.msg-seen-pop {
    position: absolute; bottom: 100%; right: 0; z-index: 25; margin-bottom: 4px;
    max-width: 240px; white-space: normal; text-align: left;
    background: #1f2937; color: #fff; font-size: 12px; line-height: 1.35;
    padding: 5px 9px; border-radius: 8px; box-shadow: 0 4px 14px rgba(0,0,0,.2);
}
.msg-seen-pop[hidden] { display: none; }

/* Цитата ответа внутри пузыря */
.msg-reply {
    display: block;
    border-left: 3px solid var(--accent);
    background: rgba(37,99,235,.07);
    border-radius: 4px;
    padding: 3px 8px;
    margin-bottom: 5px;
    font-size: 13px;
    cursor: pointer;
    max-width: 260px;
    overflow: hidden;
}
.msg-reply-name { display: block; font-weight: 700; color: var(--accent); font-size: 12px; }
.msg-reply-text { color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: block; }
.msg-flash .msg-bubble { animation: flashbubble 1s; }
@keyframes flashbubble { 0%,100% { box-shadow: 0 1px 1px rgba(0,0,0,.07); } 30% { box-shadow: 0 0 0 3px var(--accent); } }

/* Плашка «ответ на …» над полем ввода */
.chat-reply-bar {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    border-top: 1px solid var(--border);
    background: #f7f8fa;
    font-size: 13px;
}
.chat-reply-bar[hidden] { display: none; }
.crb-text { flex: 1; min-width: 0; border-left: 3px solid var(--accent); padding-left: 8px; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.crb-name { font-weight: 700; color: var(--accent); }
.crb-body { color: var(--muted); }
.crb-cancel { border: none; background: none; cursor: pointer; color: var(--muted); font-size: 14px; }
.crb-cancel:hover { color: var(--red); }

.msg-reactions { display: flex; flex-wrap: wrap; gap: 4px; margin: 3px 0 0 2px; position: relative; }
.react-chip {
    border: 1px solid var(--border); background: #fff; border-radius: 999px;
    padding: 1px 8px; font-size: 13px; cursor: pointer; line-height: 1.5;
}
.react-chip.is-mine { background: #eff6ff; border-color: #bfdbfe; }
.react-picker {
    position: absolute; bottom: 26px; left: 0; z-index: 20;
    display: flex; gap: 2px; padding: 5px 7px;
    background: #fff; border: 1px solid var(--border); border-radius: 999px;
    box-shadow: 0 4px 14px rgba(0,0,0,.15);
}
.react-picker button { border: none; background: none; cursor: pointer; font-size: 20px; padding: 2px 4px; border-radius: 8px; line-height: 1; }
.react-picker button:hover { background: #f3f4f6; transform: scale(1.15); }
.react-picker button.is-active { background: #dbeafe; }

.chat-bar {
    position: relative;
    display: flex;
    align-items: flex-end;
    gap: 8px;
    padding: 8px 10px;
    padding-bottom: calc(8px + env(safe-area-inset-bottom));
    border-top: 1px solid var(--border);
    background: var(--surface);
}
.chat-emoji-btn, .chat-send {
    border: none; background: none; cursor: pointer; font-size: 22px;
    flex: none; padding: 6px; line-height: 1;
}
.chat-send {
    color: var(--accent); font-weight: 700;
    display: inline-flex; align-items: center; justify-content: center;
    width: 40px; height: 40px; padding: 0;
    background: #eef0f3; border-radius: 50%;
    transition: background .15s;
}
.chat-send:hover { background: #e2e5ea; }
.chat-send:active { background: #d6dae1; }
.chat-input {
    flex: 1;
    resize: none;
    border: 1px solid var(--border);
    border-radius: 18px;
    padding: 9px 14px;
    font-size: 16px;
    font-family: inherit;
    line-height: 1.3;
    max-height: 120px;
    overflow-y: auto;
}
.emoji-panel {
    position: absolute;
    bottom: 56px;
    left: 8px;
    right: 8px;
    max-height: 180px;
    overflow-y: auto;
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 12px;
    box-shadow: 0 6px 20px rgba(0,0,0,.15);
    padding: 8px;
    display: grid;
    grid-template-columns: repeat(8, 1fr);
    gap: 2px;
    z-index: 30;
}
.emoji-panel[hidden] { display: none; }
.emoji-item { border: none; background: none; cursor: pointer; font-size: 22px; padding: 4px; border-radius: 8px; }
.emoji-item:hover { background: #f3f4f6; }

/* --- Подвал --- */
.footer { text-align: center; color: var(--muted); font-size: 13px; padding: 24px 16px; display: flex; flex-direction: column; gap: 6px; align-items: center; }
.footer-link { font-weight: 600; }

/* --- Памятка --- */
.help-page p, .help-page li { font-size: 15px; line-height: 1.5; }
.help-page ul, .help-page ol { padding-left: 22px; }
.help-page li { margin-bottom: 6px; }
.help-page .pp { color: var(--green); font-weight: 600; }
.help-page .pm { color: var(--red); font-weight: 600; }
.help-tip {
    background: #fffbeb;
    border: 1px solid #fde68a;
    border-radius: var(--radius);
    padding: 12px 16px;
    margin: 14px 0;
}
.help-tip ul { margin: 8px 0 0; }
.help-final { margin-top: 20px; padding: 14px; background: #ecfdf5; border-radius: var(--radius); text-align: center; }

/* --- ПК: шире, матчи в 2 колонки --- */
@media (min-width: 760px) {
    .match-detail { grid-template-columns: 1fr 1fr; }
}

/* --- Прогноз на призёров от игроков (главная) --- */
.podium-all { margin-top: 32px; }
.podium-all-note { margin: -4px 0 16px; }
.podium-all-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 12px;
}
.podium-all-card {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 14px 16px;
    background: var(--surface);
}
.podium-all-name {
    font-weight: 700;
    margin-bottom: 10px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--border);
}
.podium-all-row {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 3px 0;
    font-size: 14px;
}
.podium-all-medal { flex: none; }
.podium-all-team { font-weight: 500; }
