/* ============================================================
   Профиль, история, рейтинг, повтор партии.
   Подключается после style.css и пользуется только его токенами.
   ============================================================ */

/* Нижняя панель на 5 пунктов (на этих страницах есть «Рейтинг») */
.tabbar:has(> a:nth-child(5)) { grid-template-columns: repeat(5, 1fr); }
.tabbar:has(> a:nth-child(5)) a { font-size: 10.5px; padding-left: 2px; padding-right: 2px; }
@media (max-width: 359px) { .tabbar:has(> a:nth-child(5)) a { font-size: 10px; } }

/* Общие мелочи */
.state-msg { margin-top: 14px; }
.state-msg[hidden] { display: none; }
.muted { color: var(--muted); }
.link { color: var(--accent); font-weight: 700; text-decoration: underline; text-underline-offset: 3px; }
.pill {
    display: inline-flex; align-items: center; gap: 4px; white-space: nowrap;
    font-size: 12px; font-weight: 800; line-height: 1; padding: 6px 10px; border-radius: 999px;
    background: var(--surface-2); color: var(--muted); border: 1px solid var(--line);
}
.pill.win { background: rgba(31, 157, 107, .12); color: #137451; border-color: rgba(31, 157, 107, .3); }
.pill.loss { background: rgba(217, 58, 63, .09); color: #b02a2f; border-color: rgba(217, 58, 63, .28); }
.pill.draw { background: var(--note-bg); color: var(--note); border-color: var(--note-line); }
.delta { font-weight: 800; font-variant-numeric: tabular-nums; white-space: nowrap; }
.delta.up { color: #137451; }
.delta.down { color: #b02a2f; }
.delta.zero { color: var(--muted); }

/* Подвкладки «Профиль · Мои партии · Рейтинг» */
.subtabs { display: flex; gap: 8px; flex-wrap: wrap; margin: 4px 0 6px; }
.subtabs .chip { text-decoration: none; }

/* ---------- Профиль ---------- */
.me-head { display: flex; align-items: center; gap: 14px; margin-top: 14px; }
.me-head .avatar-lg {
    width: 56px; height: 56px; border-radius: 50%; flex: 0 0 auto; display: grid; place-items: center;
    background: linear-gradient(135deg, var(--felt-2), var(--felt)); color: #fff;
    font-family: var(--font-head); font-weight: 600; font-size: 22px;
}
.me-head h1 { margin: 0; overflow-wrap: anywhere; }
.me-head .muted { font-size: 14px; }

.stats { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin-top: 14px; }
@media (min-width: 600px) { .stats { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.stat { background: var(--surface-2); border-radius: var(--r-sm); padding: 12px 14px; min-width: 0; }
.stat b { display: block; font-family: var(--font-head); font-weight: 600; font-size: 22px; line-height: 1.2; font-variant-numeric: tabular-nums; }
.stat span { color: var(--muted); font-size: 13px; }
.stat.hero { background: linear-gradient(135deg, var(--felt-2), var(--felt)); color: #fff; }
.stat.hero span { color: #fff; opacity: .9; }

.level { margin-top: 16px; }
.level-row { display: flex; justify-content: space-between; gap: 12px; font-size: 14px; font-weight: 700; }
.level-row span { color: var(--muted); font-weight: 600; font-variant-numeric: tabular-nums; }
.xp { height: 10px; border-radius: 999px; background: var(--line); overflow: hidden; margin-top: 6px; }
.xp i { display: block; height: 100%; width: 0; background: var(--accent); border-radius: inherit; transition: width .4s ease; }
.wl { display: flex; flex-wrap: wrap; gap: 6px 14px; margin-top: 12px; font-size: 14px; color: var(--muted); }
.wl b { color: var(--text); font-variant-numeric: tabular-nums; }

/* История партий */
.hist { list-style: none; display: grid; gap: 8px; margin-top: 14px; }
.hist-row {
    display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4px 12px; align-items: center;
    padding: 12px 14px; border-radius: var(--r-sm); border: 1px solid var(--line); background: var(--surface);
    transition: border-color .15s ease;
}
a.hist-row:hover { border-color: var(--accent-line); }
.hist-main { min-width: 0; }
.hist-main b { display: block; font-size: 15px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hist-meta { color: var(--muted); font-size: 13px; }
.hist-side { display: grid; justify-items: end; gap: 6px; }
.hist-go { grid-column: 1 / -1; font-size: 13px; font-weight: 700; color: var(--accent); }
.hist-day { color: var(--muted); font-size: 12px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; margin: 10px 0 0; list-style: none; }
.hist-day:first-child { margin-top: 0; }

.empty-box { margin-top: 14px; padding: 18px; border-radius: var(--r-sm); border: 1px dashed var(--line-strong); color: var(--muted); font-size: 14px; display: grid; gap: 12px; justify-items: start; }

.blocked { list-style: none; display: grid; gap: 8px; margin-top: 12px; }
.blocked li { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 8px 8px 8px 14px; border-radius: var(--r-sm); background: var(--surface-2); }
.blocked li span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 700; }

/* ---------- Лобби: мой рейтинг и баннер блокировки ---------- */
.me-strip { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 12px; }
.me-chip {
    display: inline-flex; align-items: center; gap: 10px; min-height: 44px; padding: 4px 14px 4px 4px;
    border-radius: 999px; background: var(--surface); border: 1px solid var(--line-strong); font-size: 14px; font-weight: 700;
}
.me-chip:hover { border-color: var(--accent); }
.me-chip .lvl {
    width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center;
    background: linear-gradient(135deg, var(--felt-2), var(--felt)); color: #fff; font-family: var(--font-head); font-size: 13px;
}
.me-chip small { display: block; color: var(--muted); font-weight: 600; font-size: 12px; line-height: 1.2; }
.me-links { display: flex; gap: 8px; flex-wrap: wrap; }
.ban-box { margin-top: 12px; padding: 16px; border-radius: var(--r); background: rgba(217, 58, 63, .06); border: 1px solid rgba(217, 58, 63, .28); }
.ban-box h2 { font-family: var(--font-body); font-size: 17px; font-weight: 800; margin: 0 0 6px; color: #b02a2f; }
.ban-box p { font-size: 14px; color: var(--text); }
.ban-box p + p { margin-top: 6px; color: var(--muted); }
.ban-box[hidden], .me-strip[hidden], .chips[hidden] { display: none; }

/* ---------- Рейтинг ---------- */
.lb { list-style: none; display: grid; gap: 6px; margin-top: 14px; }
.lb-row {
    display: grid; grid-template-columns: 40px minmax(0, 1fr) auto; gap: 10px; align-items: center;
    padding: 10px 14px 10px 10px; border-radius: var(--r-sm); background: var(--surface); border: 1px solid var(--line);
}
.lb-place { font-family: var(--font-head); font-weight: 600; font-size: 15px; text-align: center; color: var(--muted); font-variant-numeric: tabular-nums; }
.lb-row:nth-child(-n+3) .lb-place { color: var(--accent); }
.lb-name { min-width: 0; }
.lb-name b { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 15px; }
.lb-name span { color: var(--muted); font-size: 13px; }
.lb-rating { font-family: var(--font-head); font-weight: 600; font-size: 17px; font-variant-numeric: tabular-nums; text-align: right; }
.lb-rating small { display: block; font-family: var(--font-body); font-weight: 600; font-size: 12px; color: var(--muted); }
.lb-row.you { border-color: var(--accent); background: var(--accent-soft); box-shadow: inset 3px 0 0 var(--accent); }
.lb-you { margin-top: 14px; }
.lb-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; flex-wrap: wrap; }

/* ---------- Повтор партии ---------- */
.replay-body { background: var(--bg); }
.game.replay { height: auto; min-height: 100vh; min-height: 100dvh; grid-template-rows: auto auto auto auto auto; padding-bottom: env(safe-area-inset-bottom); user-select: text; -webkit-user-select: text; }
.replay .game-title { min-width: 0; }
.replay .game-title b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.replay .share-btn { width: auto; padding: 0 14px; border-radius: 999px; font-size: 14px; font-weight: 700; white-space: nowrap; }

.rp-sum { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; padding: 0 12px 10px; }
.rp-sum .pill { font-size: 13px; padding: 7px 12px; max-width: 100%; }
.rp-sum .pill .nm { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 140px; }
.rp-result { text-align: center; font-weight: 800; font-size: 15px; padding: 0 12px 10px; }

.replay .felt { min-height: 0; grid-template-rows: auto auto auto; gap: 10px; padding: 12px 10px; }
.rp-seats { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; }
.rp-seat { min-width: 0; flex: 1 1 140px; max-width: 100%; display: grid; gap: 6px; justify-items: center; padding: 6px 6px 8px; border-radius: 16px; background: rgba(0, 0, 0, .14); transition: box-shadow .2s ease; }
.rp-seat.actor { box-shadow: 0 0 0 2px var(--warm), 0 0 0 6px rgba(255, 226, 160, .22); }
.rp-seat.out { opacity: .6; }
.rp-seat .opp { background: none; padding: 0; }
.rp-seat .opp-name { max-width: 150px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rp-seat.me { flex-basis: 100%; }
.rp-hand { --n: 6; --w: var(--opp-w); display: flex; justify-content: center; width: 100%; min-height: calc(var(--w) * 1.42); }
.rp-seat.me .rp-hand { --w: var(--tbl-w); }
.rp-hand .pcard { --w: inherit; width: var(--w); height: calc(var(--w) * 1.42); margin-left: min(calc(var(--w) * -.45), calc((100% - var(--w) * var(--n)) / (var(--n) - 1))); box-shadow: 0 2px 6px rgba(0, 0, 0, .18); }
.rp-hand .pcard:first-child { margin-left: 0; }
.rp-hand .pcard.is-trump { box-shadow: inset 0 0 0 2px #e0a92e, 0 2px 6px rgba(0, 0, 0, .18); }
.rp-hand .empty-hand { font-size: 12px; font-weight: 700; opacity: .8; align-self: center; }
.replay .center { min-height: calc(var(--tbl-w) * 1.42 + 34px); }
.replay .pcard.hot { outline: 3px solid var(--warm); outline-offset: 1px; }
.replay .status { margin-top: 0; }

.rp-controls { padding: 12px 14px 16px; display: grid; gap: 10px; max-width: 640px; width: 100%; margin: 0 auto; }
.rp-scrub { display: flex; align-items: center; gap: 10px; font-size: 13px; font-weight: 700; color: var(--muted); font-variant-numeric: tabular-nums; }
.rp-scrub input { flex: 1; min-width: 0; accent-color: var(--accent); height: 32px; }
.rp-scrub output { white-space: nowrap; min-width: 64px; text-align: right; }
.rp-btns { display: flex; justify-content: center; align-items: center; gap: 8px; flex-wrap: wrap; }
.rp-btns .btn { min-width: 48px; padding: 0 14px; }
.rp-btns #playBtn { min-width: 132px; }
.rp-speed { display: flex; gap: 4px; }
.rp-btns .ico { width: 20px; height: 20px; fill: currentColor; stroke: currentColor; stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.game.replay { grid-template-rows: none; grid-template-columns: minmax(0, 1fr); align-content: start; }
.replay .felt { grid-template-rows: none; }
.rp-speed .chip { min-height: 44px; padding: 0 12px; }
.rp-hint { text-align: center; color: var(--muted); font-size: 12px; }
@media (hover: none) { .rp-hint { display: none; } }
.rp-toast { position: fixed; left: 50%; bottom: calc(18px + env(safe-area-inset-bottom)); transform: translateX(-50%); z-index: 90; background: var(--text); color: #fff; padding: 10px 16px; border-radius: 999px; font-size: 14px; font-weight: 700; box-shadow: var(--shadow); max-width: calc(100% - 32px); text-align: center; }
.rp-toast[hidden] { display: none; }
.rp-error { max-width: 520px; margin: 24px auto; padding: 0 16px; }
.rp-error[hidden], .rp-view[hidden] { display: none; }
.rp-view { display: contents; }

@media (min-width: 1024px) {
    .replay .felt { padding: 18px 24px; }
    .rp-seat { flex: 0 1 260px; }
    .rp-seat.me { flex-basis: 100%; }
}

/* Колонки сетки панелей не растягиваются длинным содержимым (имена в чёрном списке) */
.panel-grid { grid-template-columns: minmax(0, 1fr); }
@media (min-width: 860px) { .panel-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.blocked, .hist, .lb { grid-template-columns: minmax(0, 1fr); }
.blocked li .btn { flex: 0 0 auto; }

/* Честный онлайн в лобби */
.online-now { margin: 14px 0 0; font-size: 14px; color: var(--muted); display: flex; align-items: center; gap: 8px; }
.online-now::before { content: ''; width: 8px; height: 8px; border-radius: 50%; background: var(--green); box-shadow: 0 0 0 3px rgba(31, 157, 107, .18); }

/* ============================================================
   v3: задания дня, лиги, друзья (lobby, profile, league, friends)
   ============================================================ */

/* Значок лиги: щит + знак. Цвета свои у каждой лиги */
.tier-badge { width: 28px; height: 32px; display: block; flex: 0 0 auto; }
.tier-badge.sm { width: 22px; height: 25px; }
.tier-badge.lg { width: 72px; height: 81px; filter: drop-shadow(0 6px 12px rgba(20, 40, 30, .18)); }
.tier-badge .tb-shield { fill: var(--tb-a); }
.tier-badge .tb-inner { fill: var(--tb-b); }
.tier-badge .tb-mark { fill: none; stroke: var(--tb-ink); stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; }
.tier-badge .tb-fillmark { fill: var(--tb-ink); }
.tier-badge .tb-cut { fill: none; stroke: var(--tb-b); stroke-width: 1.4; stroke-linejoin: round; }
.tier-0 { --tb-a: #9a5a32; --tb-b: #c7865a; --tb-ink: #fff4ea; --tb-soft: rgba(176, 108, 62, .12); }
.tier-1 { --tb-a: #6f7d8a; --tb-b: #a3b0bb; --tb-ink: #ffffff; --tb-soft: rgba(111, 125, 138, .13); }
.tier-2 { --tb-a: #b07a0c; --tb-b: #dcaa3c; --tb-ink: #fffaf0; --tb-soft: rgba(220, 170, 60, .16); }
.tier-3 { --tb-a: #0a7d6a; --tb-b: #34b897; --tb-ink: #effff9; --tb-soft: rgba(52, 184, 151, .14); }
.tier-4 { --tb-a: #3260c4; --tb-b: #7aa5ef; --tb-ink: #f2f7ff; --tb-soft: rgba(90, 140, 230, .14); }

/* Хаб в лобби: плитки + задания дня. На телефоне — компактно */
.hub { display: grid; gap: 10px; margin-bottom: 14px; padding: 0; }
.hub[hidden] { display: none; }
.hub-tiles { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.hub-tile {
    position: relative; display: flex; align-items: center; gap: 8px; min-height: 56px; min-width: 0;
    padding: 8px 10px; border-radius: var(--r-sm); background: var(--surface); border: 1px solid var(--line);
    box-shadow: var(--shadow-sm); transition: border-color .15s ease;
}
.hub-tile:hover { border-color: var(--accent-line); }
.hub-tile-text { min-width: 0; display: grid; line-height: 1.2; }
.hub-tile-text b { font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hub-tile-text small { font-size: 12px; color: var(--muted); font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hub-ico { width: 28px; height: 32px; flex: 0 0 auto; display: grid; place-items: center; color: var(--accent); }
.hub-ico svg:not(.tier-badge) { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.chest-ico { color: #9a5a32; }
.hub-badge {
    position: absolute; top: -6px; right: -4px; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 999px;
    background: var(--red); color: #fff; font-size: 11px; font-weight: 800; line-height: 20px; text-align: center;
    box-shadow: 0 0 0 2px var(--bg);
}
.hub-badge.dot { min-width: 10px; width: 10px; height: 10px; padding: 0; top: 6px; right: 6px; background: var(--accent); }
.hub-badge[hidden] { display: none; }
@media (max-width: 400px) {
    .hub-tile { flex-direction: column; align-items: flex-start; gap: 4px; padding: 8px; }
    .hub-ico { height: 26px; width: 24px; }
    .hub-ico .tier-badge { width: 22px; height: 25px; }
}

.hub-quests { margin-top: 0; padding: 14px 16px; }
.hub-head { display: flex; justify-content: space-between; align-items: baseline; gap: 4px 12px; flex-wrap: wrap; }
.hub-head h2 { margin: 0; font-size: 16px; }
.hub-reset { font-size: 13px; font-variant-numeric: tabular-nums; }
.hub-quests > p { margin-top: 4px; }
.quests { list-style: none; display: grid; grid-template-columns: minmax(0, 1fr); gap: 10px; margin-top: 10px; }
.quest { display: grid; grid-template-columns: 22px minmax(0, 1fr); gap: 10px; align-items: start; }
.q-check {
    width: 22px; height: 22px; border-radius: 50%; border: 2px solid var(--line-strong); margin-top: 1px;
    display: grid; place-items: center; background: var(--surface);
}
.q-check svg { width: 14px; height: 14px; fill: none; stroke: #fff; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }
.quest.done .q-check, .quest-all .q-check { background: var(--green); border-color: var(--green); }
.q-body { display: grid; gap: 5px; min-width: 0; }
.q-text { font-size: 14px; font-weight: 700; line-height: 1.3; overflow-wrap: anywhere; }
.quest.done .q-text { color: var(--muted); }
.q-bar { display: block; height: 6px; border-radius: 999px; background: var(--line); overflow: hidden; }
.q-bar i { display: block; height: 100%; width: 0; border-radius: inherit; background: var(--accent); transition: width .4s ease; }
.quest.done .q-bar i { background: var(--green); }
.q-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 6px; font-size: 12px; color: var(--muted); font-weight: 600; }
.q-count { margin-right: auto; font-variant-numeric: tabular-nums; }
.reward-chip {
    display: inline-flex; align-items: center; gap: 4px; white-space: nowrap; font-size: 12px; font-weight: 800; line-height: 1;
    padding: 4px 8px; border-radius: 999px; background: var(--accent-soft); color: var(--accent); border: 1px solid var(--accent-line);
}
.reward-chip.chest { background: rgba(176, 108, 62, .1); color: #8a4f2a; border-color: rgba(176, 108, 62, .3); }
.reward-chip.chest::before { content: ''; width: 10px; height: 8px; border-radius: 2px 2px 1px 1px; background: currentColor; opacity: .75; }
.quest.done .reward-chip { opacity: .6; }
.quest-skel { font-size: 14px; }
.quest-all { display: flex; gap: 10px; align-items: center; font-size: 14px; font-weight: 700; color: var(--text); }
.quest-all .q-check { flex: 0 0 auto; margin: 0; }

@media (min-width: 760px) {
    .hub { grid-template-columns: minmax(0, 1.7fr) minmax(0, 1fr); align-items: start; }
    .hub-quests { grid-column: 1; grid-row: 1; }
    .hub-tiles { grid-column: 2; grid-row: 1; grid-template-columns: minmax(0, 1fr); }
    .hub-tile { min-height: 60px; padding: 10px 14px; }
    .hub-tile-text b { font-size: 14px; }
    .hub-tile-text small { font-size: 13px; }
}

/* Тост (приглашение друга, запросы) — над нижней панелью */
.hub-toast {
    position: fixed; left: 50%; bottom: calc(84px + env(safe-area-inset-bottom)); transform: translateX(-50%); z-index: 95;
    width: max-content; max-width: min(460px, calc(100% - 32px)); padding: 12px 16px; border-radius: var(--r);
    background: var(--text); color: #fff; font-size: 14px; font-weight: 600; line-height: 1.4; box-shadow: var(--shadow);
}
.hub-toast a { color: #9fe3c4; font-weight: 800; text-decoration: underline; text-underline-offset: 3px; white-space: nowrap; }
.hub-toast[hidden] { display: none; }
@media (min-width: 960px) { .hub-toast { bottom: 24px; } }

/* Профиль: ссылки на лигу, друзей, коллекцию */
.hub-links { display: grid; grid-template-columns: minmax(0, 1fr); gap: 8px; margin-top: 14px; }
@media (min-width: 600px) { .hub-links { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.hub-link {
    display: flex; align-items: center; gap: 12px; min-height: 60px; padding: 10px 14px; min-width: 0;
    border-radius: var(--r-sm); background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow-sm);
}
.hub-link:hover { border-color: var(--accent-line); }
.hub-link > span:last-child { min-width: 0; display: grid; line-height: 1.25; }
.hub-link b { font-size: 15px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hub-link small { color: var(--muted); font-size: 13px; font-weight: 600; }

/* ---------- Лига ---------- */
.lg-hero { display: flex; align-items: center; gap: 16px; margin-top: 14px; padding: 16px; border-radius: var(--r); background: var(--tb-soft, var(--surface-2)); }
.lg-hero h1 { margin: 2px 0 4px; overflow-wrap: anywhere; }
.lg-hero .muted { font-size: 14px; }
.lg-hero-text { min-width: 0; }
.lg-badge { flex: 0 0 auto; }
@media (max-width: 400px) { .tier-badge.lg { width: 56px; height: 63px; } .lg-hero { gap: 12px; padding: 14px; } }
.lg-ladder { list-style: none; display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 4px; margin-top: 10px; }
.lg-ladder li { display: grid; justify-items: center; gap: 4px; padding: 8px 2px; border-radius: var(--r-sm); font-size: 11px; font-weight: 700; color: var(--muted); text-align: center; min-width: 0; }
.lg-ladder li span { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lg-ladder li:not(.cur):not(.past) .tier-badge { opacity: .45; }
.lg-ladder li.cur { background: var(--surface); color: var(--text); box-shadow: inset 0 0 0 1.5px var(--accent-line); }
.lg-last { border-color: var(--accent-line); background: linear-gradient(180deg, var(--accent-soft), var(--surface) 70%); }
.lg-last[hidden] { display: none; }
.lg-last > p { color: var(--text); font-size: 15px; margin-top: 6px; }
.lg-last .form-row { margin-top: 12px; }
.lg-count { font-size: 13px; }
.lg-group { gap: 4px; }
.lg-group .lb-row .lb-place { color: var(--muted); }
.lg-row.up { box-shadow: inset 3px 0 0 var(--green); }
.lg-row.up .lb-place { color: #137451; }
.lg-row.down { box-shadow: inset 3px 0 0 var(--red); }
.lg-row.down .lb-place { color: #b02a2f; }
.lg-group .lb-row.you { border-color: var(--accent); background: var(--accent-soft); }
.lg-group .lb-row.you.up { box-shadow: inset 3px 0 0 var(--green), 0 0 0 1px var(--accent); }
.lg-group .lb-row.you.down { box-shadow: inset 3px 0 0 var(--red), 0 0 0 1px var(--accent); }
.lg-zone { list-style: none; display: flex; align-items: center; gap: 8px; margin: 6px 0 2px; font-size: 12px; font-weight: 800; }
.lg-zone::after { content: ''; flex: 1; height: 0; border-top: 2px dashed currentColor; opacity: .45; }
.lg-zone span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.lg-zone.up { color: #137451; margin-top: 0; }
.lg-zone.down { color: #b02a2f; }
.lg-zone.mid { color: var(--muted); font-weight: 700; }
.lg-rules { list-style: none; display: grid; gap: 8px; margin-top: 10px; font-size: 14px; color: #33413a; }
.lg-rules li { padding-left: 14px; position: relative; }
.lg-rules li::before { content: ''; position: absolute; left: 0; top: .6em; width: 6px; height: 6px; border-radius: 50%; background: var(--accent); }
.lg-sub { font-size: 15px; margin: 16px 0 6px; font-family: var(--font-body); font-weight: 800; }
.lg-rewards { list-style: none; display: flex; flex-wrap: wrap; gap: 8px; }
.lg-rewards li { display: inline-flex; align-items: center; gap: 8px; padding: 6px 10px 6px 12px; border-radius: 999px; background: var(--surface-2); font-size: 13px; font-weight: 700; }

/* ---------- Друзья ---------- */
.fr-code { display: flex; align-items: baseline; gap: 10px; margin-top: 14px; flex-wrap: wrap; }
.fr-code .muted { font-size: 14px; }
.fr-code b { font-family: var(--font-head); font-weight: 600; font-size: 20px; letter-spacing: .06em; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.fr-link-field { margin-top: 12px; }
.fr-link-row, .fr-add-row { display: flex; gap: 8px; align-items: center; }
.fr-link-row input { flex: 1; min-width: 0; font-size: 14px; color: var(--muted); }
.fr-add-row { margin-top: 12px; }
.fr-add-row .field { flex: 1; min-width: 0; }
.fr-invite .form-row { margin-top: 10px; min-height: 0; }
.fr-hint { color: var(--muted); font-size: 14px; margin-top: 6px; }
.fr-hint[hidden] { display: none; }
.fr-list { list-style: none; display: grid; grid-template-columns: minmax(0, 1fr); gap: 8px; margin-top: 12px; }
.fr-row {
    display: grid; grid-template-columns: 40px minmax(0, 1fr); gap: 8px 12px; align-items: center;
    padding: 10px 12px; border-radius: var(--r-sm); border: 1px solid var(--line); background: var(--surface);
}
.fr-row.req { grid-template-columns: minmax(0, 1fr) auto; }
.fr-ava {
    position: relative; width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center;
    background: var(--surface-2); color: var(--muted); font-family: var(--font-head); font-weight: 600; font-size: 15px;
}
.fr-row.online .fr-ava { background: linear-gradient(135deg, var(--felt-2), var(--felt)); color: #fff; }
.fr-dot { position: absolute; right: -1px; bottom: -1px; width: 12px; height: 12px; border-radius: 50%; background: var(--line-strong); box-shadow: 0 0 0 2px var(--surface); }
.fr-row.online .fr-dot { background: var(--green); }
.fr-main { min-width: 0; display: grid; line-height: 1.3; }
.fr-main b, b.fr-main { font-size: 15px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fr-meta { font-size: 13px; color: var(--muted); }
.fr-table { font-size: 13px; font-weight: 700; color: var(--accent); }
.fr-acts { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: 6px; }
.fr-row.req .fr-acts { grid-column: auto; }
.fr-acts .btn { padding: 0 14px; }
.fr-acts .fr-remove { margin-left: auto; color: var(--muted); border-color: transparent; background: none; }
.fr-acts .fr-remove:hover { color: #b02a2f; border-color: rgba(217, 58, 63, .28); }
@media (min-width: 640px) {
    .fr-row { grid-template-columns: 40px minmax(0, 1fr) auto; }
    .fr-acts { grid-column: auto; justify-content: flex-end; }
    .fr-acts .fr-remove { margin-left: 0; }
}
@media (max-width: 400px) { .fr-row.req { grid-template-columns: minmax(0, 1fr); } }
.fr-row.req .pill { justify-self: start; }

/* Подпись плитки хаба — в две строки, а не «сыграйт…» */
.hub-tile-text small { white-space: normal; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }

/* ---------- v3.1: серия дней и достижения ---------- */
/* Плиток в хабе четыре: на телефоне — сетка 2×2, иконка слева */
.hub-tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); }
@media (max-width: 400px) {
    .hub-tile { flex-direction: row; align-items: center; gap: 8px; padding: 8px 10px; min-height: 52px; }
}
.ach-ico { color: #b07a12; }
@media (min-width: 760px) {
    .hub-tiles { grid-template-columns: minmax(0, 1fr); grid-row: 1 / span 2; }
    .hub-daily { grid-column: 1; grid-row: 1; }
    .hub-quests { grid-row: 2; }
}

.hub-daily { margin-top: 0; padding: 14px 16px; }
.ds-more { font-weight: 700; text-decoration: underline; text-underline-offset: 3px; }
.ds-more:hover { color: var(--accent); }
.ds-body { margin-top: 8px; display: grid; gap: 10px; }
.ds-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.ds-streak { display: grid; gap: 2px; min-width: 0; line-height: 1.25; }
.ds-title { font-family: var(--font-head); font-weight: 600; font-size: 18px; }
.ds-streak .muted { font-size: 13px; font-weight: 600; }
.ds-next { margin: 0; padding: 8px 12px; border-radius: var(--r-sm); background: var(--accent-soft); color: var(--text); font-size: 14px; font-weight: 600; line-height: 1.35; }
.ds-next.ok { background: rgba(31, 157, 107, .1); }
.ds-next b { color: #137451; }

.ds-track { list-style: none; display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; }
.dt-day { display: grid; justify-items: center; gap: 4px; min-width: 0; }
.dt-ico {
    position: relative; width: 100%; max-width: 44px; aspect-ratio: 1; border-radius: 12px; display: grid; place-items: center;
    background: var(--surface-2); border: 1.5px solid var(--line); color: var(--muted);
}
.dt-xp { font-size: 12px; font-weight: 800; font-variant-numeric: tabular-nums; letter-spacing: -.02em; }
.dt-chest { display: grid; place-items: center; color: #9a5a32; }
.dt-chest.gold { color: #b07a12; }
.dt-chest svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
.dt-label { font-size: 11px; font-weight: 700; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.dt-check { position: absolute; right: -4px; top: -4px; width: 16px; height: 16px; border-radius: 50%; background: var(--green); display: grid; place-items: center; box-shadow: 0 0 0 2px var(--surface); }
.dt-check svg { width: 10px; height: 10px; fill: none; stroke: #fff; stroke-width: 2.6; stroke-linecap: round; stroke-linejoin: round; }
.dt-day.done .dt-ico { background: rgba(31, 157, 107, .1); border-color: rgba(31, 157, 107, .35); color: #137451; }
.dt-day.today .dt-ico { background: var(--surface); border-color: var(--accent); color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.dt-day.today .dt-label { color: var(--accent); }
.dt-day.next .dt-ico { border-style: dashed; border-color: var(--line-strong); }
.dt-day.locked .dt-ico { opacity: .7; }
.dt-day.locked .dt-chest, .dt-day.next .dt-chest { color: inherit; }
.dt-day.locked:last-child .dt-chest, .dt-day.next:last-child .dt-chest { color: #b07a12; }

.ds-freeze { margin: 0; font-size: 13px; color: var(--muted); line-height: 1.35; }
.ds-freeze b { color: #2d6ea8; font-weight: 800; }

.ds-heat { display: grid; gap: 6px; }
.hs-strip { display: grid; grid-template-columns: repeat(28, minmax(0, 1fr)); gap: 2px; max-width: 420px; }
.hs-cell { display: block; aspect-ratio: 1; min-width: 0; border-radius: 3px; background: var(--line); }
.hs-cell.hs-played { background: var(--accent-2); }
.hs-cell.hs-frozen { background: #8fc1ea; }
.hs-cell.hs-now { box-shadow: 0 0 0 1.5px var(--text); }
.hs-legend { display: flex; flex-wrap: wrap; gap: 4px 12px; font-size: 12px; color: var(--muted); font-weight: 600; }
.hs-legend > span { display: inline-flex; align-items: center; gap: 5px; }
.hs-legend .hs-cell { width: 10px; height: 10px; }
.hs-range { margin-left: auto; }

/* ---------- Страница достижений ---------- */
.ach-hero { margin-top: 10px; padding: 18px; border-radius: var(--r); background: linear-gradient(180deg, var(--accent-soft), var(--surface) 80%); border: 1px solid var(--accent-line); }
.ach-hero h1 { margin: 2px 0 6px; }
.ach-count { font-size: 15px; font-weight: 700; color: var(--text); }
.ach-count b { font-family: var(--font-head); font-weight: 600; font-size: 22px; color: var(--accent); }
.ach-total { display: block; height: 8px; border-radius: 999px; background: var(--line); overflow: hidden; margin-top: 10px; }
.ach-total i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--accent), var(--accent-2)); border-radius: inherit; transition: width .5s ease; }
.ach-hero p { margin: 10px 0 0; font-size: 14px; color: var(--muted); }
.ach-jump { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 14px; }
.ach-jump .chip { text-decoration: none; }
.ach-new { margin-top: 14px; }
.ach-new[hidden] { display: none; }

.ach-group { margin-top: 22px; padding: 0; scroll-margin-top: 80px; }
.ach-jump .chip .muted { margin-left: 5px; font-variant-numeric: tabular-nums; }
.ach-group-head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.ach-group-head h2 { margin: 0; font-size: 18px; }
.ach-group-head .muted { font-size: 13px; font-weight: 700; font-variant-numeric: tabular-nums; }
.ach-list { list-style: none; display: grid; grid-template-columns: minmax(0, 1fr); gap: 8px; margin-top: 10px; }
@media (min-width: 640px) { .ach-list { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.ach {
    position: relative; display: grid; grid-template-columns: 48px minmax(0, 1fr); gap: 12px; align-items: start;
    padding: 12px 14px; border-radius: var(--r-sm); background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow-sm);
}
.ach-badge {
    position: relative; width: 48px; height: 48px; border-radius: 50%; display: grid; place-items: center; font-size: 24px; line-height: 1;
    background: var(--surface-2); border: 2px solid var(--line);
}
.ach-badge .e { filter: grayscale(1); opacity: .55; }
.ach.done .ach-badge { background: radial-gradient(circle at 35% 30%, #fff7dc, #f6e2a6); border-color: #e3c36a; }
.ach.done .ach-badge .e { filter: none; opacity: 1; }
.ach.done .ach-badge .dt-check { right: -3px; top: auto; bottom: -3px; width: 18px; height: 18px; }
.ach-body { display: grid; gap: 4px; min-width: 0; }
.ach-name { font-weight: 800; font-size: 15px; line-height: 1.25; overflow-wrap: anywhere; }
.ach-text { font-size: 13px; color: var(--muted); line-height: 1.35; overflow-wrap: anywhere; }
.ach-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 6px; margin-top: 2px; font-size: 12px; color: var(--muted); font-weight: 700; }
.ach-meta .q-count { font-variant-numeric: tabular-nums; }
.ach .q-bar { margin-top: 4px; }
.ach-date { color: #137451; }
.ach.done .reward-chip { opacity: .65; }
.ach.just { border-color: #e3c36a; box-shadow: 0 0 0 2px rgba(227, 195, 106, .45), var(--shadow-sm); }
.ach-just { position: absolute; top: -9px; right: 12px; padding: 2px 8px; border-radius: 999px; background: var(--note-bg); border: 1px solid var(--note-line); color: var(--note); font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: .04em; }
.ach-skel { color: var(--muted); font-size: 14px; }

/* Профиль: достижения и серия */
.pa-grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: 12px; margin-top: 10px; }
@media (min-width: 600px) { .pa-grid { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); } }
.pa-box { padding: 12px 14px; border-radius: var(--r-sm); background: var(--surface-2); min-width: 0; }
.pa-box h3 { margin: 0 0 6px; font-size: 14px; font-family: var(--font-body); font-weight: 800; color: var(--muted); }
.pa-big { font-family: var(--font-head); font-weight: 600; font-size: 22px; }
.pa-big small { font-family: var(--font-body); font-size: 13px; color: var(--muted); font-weight: 700; margin-left: 4px; }
.pa-last { list-style: none; display: grid; gap: 6px; margin-top: 8px; }
.pa-last li { display: flex; align-items: center; gap: 8px; font-size: 14px; font-weight: 700; min-width: 0; }
.pa-last li .e { flex: 0 0 auto; width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; background: #fbecc0; font-size: 15px; }
.pa-last li .nm { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.pa-last li .muted { margin-left: auto; font-size: 12px; white-space: nowrap; }
.pa-box .ach-total { margin-top: 8px; }
.pa-sub { font-size: 13px; color: var(--muted); margin-top: 4px; }

.ach-new { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: var(--r-sm); background: var(--note-bg); border: 1px solid var(--note-line); color: var(--text); font-size: 14px; line-height: 1.35; }
.ach-new > span:last-child { display: grid; min-width: 0; }
.ach-new .muted { overflow-wrap: anywhere; }
.ach-new-ico { flex: 0 0 auto; width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; font-size: 22px; background: radial-gradient(circle at 35% 30%, #fff, #f6e2a6); }
.fx-ach-pop { animation: achPop .55s cubic-bezier(.2, 1.5, .4, 1) both; }
.fx-ach-pop .ach-badge, .fx-ach-pop.ach-new .ach-new-ico { animation: achGlow 1.4s ease-out .3s both; }
@keyframes achPop { from { transform: scale(.92); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes achGlow { 0% { box-shadow: 0 0 0 0 rgba(227, 195, 106, .7); } 100% { box-shadow: 0 0 0 14px rgba(227, 195, 106, 0); } }
@media (prefers-reduced-motion: reduce) { .fx-ach-pop, .fx-ach-pop .ach-badge, .fx-ach-pop.ach-new .ach-new-ico { animation: none; } }
.pa-box { display: block; color: inherit; } a.pa-box:hover { box-shadow: inset 0 0 0 1px var(--accent-line); }
#achSummary { margin-top: 14px; }

/* ---------- v4: быстрая игра в лобби ---------- */
.quick { display: grid; gap: 10px; margin: 14px 0; padding: 0; }
.quick[hidden], .tn-tile[hidden] { display: none; }
.quick-btn {
    width: 100%; min-height: 64px; justify-content: flex-start; gap: 14px; padding: 10px 18px;
    border-radius: var(--r); font-size: 18px; box-shadow: var(--shadow-sm); text-align: left;
}
.quick-ico { flex: 0 0 auto; width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; background: rgba(255, 255, 255, .18); }
.quick-ico svg { width: 22px; height: 22px; fill: currentColor; }
.quick-text { display: grid; min-width: 0; line-height: 1.2; }
.quick-text b { font-family: var(--font-head); font-weight: 600; font-size: 18px; }
.quick-text small { font-size: 13px; font-weight: 600; opacity: .9; white-space: normal; }
.quick-opts { display: flex; flex-wrap: wrap; gap: 6px 14px; }
.quick-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.quick .chip { min-height: 36px; padding: 0 12px; font-size: 13px; }
.quick .field-error { margin: 0; }
@media (min-width: 760px) {
    .quick { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); align-items: center; }
    .quick-btn, .quick .field-error { grid-column: 1; }
    .quick-opts { grid-column: 1; }
    .tn-tile { grid-column: 2; grid-row: 1 / span 2; align-self: stretch; }
}

/* Плитка турнира — ведёт на tournaments.html */
.tn-tile {
    display: flex; align-items: center; gap: 12px; min-height: 60px; min-width: 0; padding: 10px 14px;
    border-radius: var(--r-sm); background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow-sm);
    transition: border-color .15s ease;
}
.tn-tile:hover { border-color: var(--accent-line); }
.tn-tile.live { border-color: var(--accent); background: var(--accent-soft); }
.tn-tile-ico { flex: 0 0 auto; width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; font-size: 19px; background: var(--note-bg); }
.tn-tile-text { min-width: 0; flex: 1 1 auto; display: grid; line-height: 1.25; }
.tn-tile-text b { font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tn-tile-text small { font-size: 12px; color: var(--muted); font-weight: 600; overflow-wrap: anywhere; }
.tn-tile-go { flex: 0 0 auto; font-size: 13px; font-weight: 800; color: var(--accent); white-space: nowrap; }
.tn-tile.live .tn-tile-go { padding: 8px 14px; border-radius: 999px; background: var(--accent); color: var(--accent-ink); }
.create-sub { font-size: 14px; margin-top: 2px; }

/* ---------- v4: турниры ---------- */
.tn-hero { margin-top: 14px; padding: 18px 16px; border-radius: var(--r); background: var(--surface-2); border: 1px solid var(--line); display: grid; gap: 8px; }
.tn-hero.live { background: var(--accent-soft); border-color: var(--accent-line); }
.tn-hero h1 { margin: 0; overflow-wrap: anywhere; }
.tn-meta { font-size: 14px; color: var(--muted); font-weight: 600; }
.tn-count { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.tn-count[hidden], .tn-you[hidden], .tn-play[hidden] { display: none; }
.tn-count-label { font-size: 14px; color: var(--muted); font-weight: 700; }
.tn-count-val { font-family: var(--font-head); font-weight: 600; font-size: 26px; font-variant-numeric: tabular-nums; color: var(--text); }
.tn-you { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 10px; padding: 8px 12px; border-radius: var(--r-sm); background: var(--surface); font-size: 14px; }
.tn-you span { color: var(--muted); font-weight: 600; }
.tn-cta { margin-top: 4px; }
.tn-cta:empty, .tn-cta:has(> .tn-play[hidden]) { display: none; }
.tn-play { min-height: 56px; font-size: 17px; padding: 0 28px; }
@media (max-width: 479px) { .tn-play { width: 100%; } }
.tn-prizes { list-style: none; display: flex; flex-wrap: wrap; gap: 6px 14px; margin-top: 4px; }
.tn-prizes li { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 700; }
.tn-prize-place { color: var(--muted); }
.tn-rules { margin-bottom: 12px; }
.tn-fire { font-size: 14px; }
.tn-row.fire .lb-rating { color: #b4541c; }
.tn-gap { text-align: center; color: var(--muted); list-style: none; line-height: 1; }
.tn-skel { margin-top: 10px; font-size: 14px; }
.tn-tz { font-size: 13px; margin-top: 2px; }
.tn-sched { list-style: none; display: grid; gap: 6px; margin-top: 10px; }
.tn-sched-row { display: grid; grid-template-columns: minmax(0, auto) minmax(0, 1fr) auto; gap: 4px 12px; align-items: center; padding: 10px 12px; border-radius: var(--r-sm); background: var(--surface-2); }
.tn-sched-row.live { background: var(--accent-soft); box-shadow: inset 3px 0 0 var(--accent); }
.tn-when { font-weight: 800; font-size: 14px; font-variant-numeric: tabular-nums; }
.tn-sched-name { display: grid; min-width: 0; line-height: 1.25; }
.tn-sched-name b { font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tn-sched-name small { font-size: 12px; color: var(--muted); font-weight: 600; }
@media (max-width: 479px) { .tn-sched-row { grid-template-columns: minmax(0, 1fr) auto; } .tn-when { grid-column: 1 / -1; } }
.tn-past { list-style: none; display: grid; gap: 10px; margin-top: 10px; }
.tn-past-row { padding: 12px 14px; border-radius: var(--r-sm); background: var(--surface-2); display: grid; gap: 8px; min-width: 0; }
.tn-past-head { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 2px 10px; font-size: 14px; }
.tn-past-head .muted { font-size: 13px; }
.tn-top { list-style: none; display: grid; gap: 4px; }
.tn-top li { display: flex; align-items: center; gap: 8px; font-size: 14px; min-width: 0; }
.tn-top li b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.tn-top li .muted { margin-left: auto; white-space: nowrap; font-size: 13px; }
.tn-top li.you b { color: var(--accent); }
#tnStandPanel[hidden], #tnPastPanel[hidden], .state-msg[hidden] { display: none; }

/* Название турнира с временем — переносится, а не «сегодня 21:…» */
.tn-tile-text b { white-space: normal; overflow: visible; text-overflow: clip; }

/* ===== v5: код восстановления, время и лимиты, поддержка (knowledge/protocol-v5.md) ===== */
.panel h3 { font-family: var(--font-body); font-size: 16px; margin: 0 0 4px; }
.rec-code-row { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-top: 14px; }
.rec-code {
    flex: 1 1 260px; min-width: 0; padding: 10px 12px; border-radius: var(--r-sm);
    background: var(--surface-2); border: 1px solid var(--line);
    font: 600 15px/1.4 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; letter-spacing: .02em;
    overflow-wrap: anywhere; user-select: none; color: var(--muted);
}
.rec-code.shown, #restoreCurCode { user-select: all; color: var(--text); }
.rec-btns { display: flex; gap: 8px; flex-wrap: wrap; }
.rec-warn { margin-top: 12px; padding: 10px 12px; border-radius: var(--r-sm); background: var(--note-bg); border: 1px solid var(--note-line); color: var(--text); font-size: 14px; line-height: 1.4; }
.rec-restore { margin-top: 20px; padding-top: 16px; border-top: 1px solid var(--line); }
.rec-restore > p { font-size: 14px; }
.rec-input-row { margin-top: 10px; flex-wrap: nowrap; }
.rec-input-row input {
    flex: 1 1 auto; min-width: 0; min-height: 44px; padding: 0 12px; border-radius: var(--r-sm);
    border: 1px solid var(--line-strong); background: var(--surface); font: 600 15px ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; color: var(--text);
}
.rec-input-row input:focus, .field textarea:focus, .ticket-reply textarea:focus { border-color: var(--accent); outline: none; }
.rec-confirm { margin-top: 16px; padding: 16px; border-radius: var(--r); border: 1px solid var(--accent-line); background: var(--accent-soft); }
.rec-confirm .rec-warn { background: var(--surface); }
.rec-q { font-size: 16px; font-weight: 700; color: var(--text); overflow-wrap: anywhere; }

.lim-blocked { margin-top: 12px; padding: 12px 14px; border-radius: var(--r-sm); background: var(--accent-soft); border: 1px solid var(--accent-line); color: var(--text); font-size: 14px; }
.lim-today { margin-top: 16px; }
.lim-today b { font-family: var(--font-head); font-size: 32px; font-weight: 600; margin-right: 8px; }
.lim-today span { color: var(--muted); font-size: 14px; }
.lim-week { --lim-h: 96px; display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 8px; margin-top: 12px; padding: 12px; border-radius: var(--r-sm); background: var(--surface-2); }
.lim-week > p { grid-column: 1 / -1; margin: 0; font-size: 14px; }
.lim-day { display: grid; justify-items: center; gap: 4px; min-width: 0; }
.lim-bar-wrap { position: relative; display: flex; align-items: flex-end; justify-content: center; width: 100%; height: var(--lim-h); }
.lim-bar-wrap i { display: block; width: min(28px, 70%); border-radius: 6px 6px 2px 2px; background: var(--felt-2); opacity: .55; }
.lim-day.today .lim-bar-wrap i { opacity: 1; background: var(--accent); }
.lim-day.over .lim-bar-wrap i { background: var(--note); }
.lim-line { position: absolute; left: -4px; right: -4px; border-top: 2px dashed var(--note-line); }
.lim-day b { font-size: 13px; font-weight: 800; }
.lim-day small { color: var(--muted); font-size: 12px; }
.lim-day.today small { color: var(--accent); font-weight: 800; }
.lim-h3 { margin-top: 22px !important; }
.lim-chips { margin-top: 8px; }
.lim-chips .chip[disabled], .lim-pause .chip[disabled] { opacity: .6; cursor: default; }
.lim-hint { font-size: 13px; margin-top: 6px; }
.lim-pending { margin-top: 10px; font-size: 14px; font-weight: 600; color: var(--text); }
.lim-pause { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-top: 10px; }

.field textarea {
    width: 100%; min-height: 110px; padding: 10px 12px; border-radius: var(--r-sm); border: 1px solid var(--line-strong);
    background: var(--surface); color: var(--text); font: inherit; font-size: 15px; resize: vertical;
}
#supCount.short { color: var(--red); font-weight: 700; }
#supGameLabel { overflow-wrap: anywhere; }
.tickets { list-style: none; display: grid; gap: 10px; margin-top: 10px; padding: 0; }
.tickets > li.muted { font-size: 14px; }
.ticket { padding: 12px 14px; border-radius: var(--r-sm); background: var(--surface-2); border: 1px solid var(--line); display: grid; gap: 8px; min-width: 0; }
.ticket.answered { border-color: var(--accent-line); box-shadow: inset 3px 0 0 var(--accent); }
.ticket.closed { opacity: .85; }
.ticket-top { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; font-size: 14px; }
.ticket-top .muted { margin-left: auto; font-size: 13px; }
.ticket-text, .ticket-thread p { margin: 0; font-size: 14px; white-space: pre-wrap; overflow-wrap: anywhere; color: var(--text); }
.ticket-game { font-size: 14px; justify-self: start; }
.ticket-thread { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.ticket-thread li { padding: 8px 10px; border-radius: var(--r-sm); background: var(--surface); }
.ticket-thread li.by-admin { border: 1px solid var(--accent-line); }
.ticket-thread .muted { font-size: 12px; }
.ticket-reply { display: flex; gap: 8px; align-items: flex-end; }
.ticket-reply textarea {
    flex: 1 1 auto; min-width: 0; min-height: 44px; padding: 8px 10px; border-radius: var(--r-sm); border: 1px solid var(--line-strong);
    background: var(--surface); color: var(--text); font: inherit; font-size: 14px; resize: vertical;
}
@media (max-width: 479px) { .ticket-reply { flex-direction: column; align-items: stretch; } .rec-input-row { flex-wrap: wrap; } .rec-input-row .btn { flex: 1 1 100%; } }

/* Лобби: спокойная плашка лимита / паузы */
.limit-bar { margin-top: 12px; padding: 14px 16px; border-radius: var(--r); background: var(--accent-soft); border: 1px solid var(--accent-line); color: var(--text); }
.limit-bar[hidden] { display: none; }
.limit-bar p { margin: 0; font-size: 15px; font-weight: 600; line-height: 1.4; }
.limit-bar .limit-sub { margin-top: 4px; font-size: 13px; font-weight: 400; color: var(--muted); }
.limit-bar a { color: var(--accent); text-decoration: underline; font-weight: 700; }
.limit-hint { font-size: 13px; margin-top: 8px; }
.limit-hint[hidden] { display: none; }
.lim-pause[hidden], #supGameRow[hidden], .rec-confirm[hidden], .saved[hidden], .tickets [hidden] { display: none; }

/* ---------- Фишки тринки в лобби (виртуальные, не деньги) ---------- */
.chips-bal { display: flex; align-items: center; flex-wrap: wrap; gap: 6px 12px; margin: 0 0 12px; padding: 10px 14px; border-radius: var(--r); background: var(--surface); border: 1px solid var(--line); font-size: 14px; }
.chips-bal[hidden] { display: none; }
.chips-bal > span:nth-child(2) { flex: 1 1 200px; min-width: 0; }
.chips-bal small { display: block; color: var(--muted); font-weight: 600; font-size: 12px; line-height: 1.3; }
.chips-bal .chips-more { color: var(--accent); font-weight: 700; font-size: 13px; text-decoration: underline; text-underline-offset: 3px; }
.chips-ico { position: relative; width: 26px; height: 24px; flex: none; }
.chips-ico i { position: absolute; left: 0; width: 26px; height: 11px; border-radius: 50%; background: #fff; box-shadow: inset 0 0 0 3px var(--accent-2), 0 1px 0 rgba(0, 0, 0, .25); }
.chips-ico i:first-child { top: 12px; } .chips-ico i:last-child { top: 5px; }

/* ---------- Повтор тринки: банк вместо колоды ---------- */
.rp-tk .deck-zone { display: none; }
.rp-tk .center { display: flex; justify-content: center; }
.rp-pot { display: inline-flex; align-items: center; gap: 8px; padding: 8px 18px 8px 12px; border-radius: 999px; background: rgba(0, 0, 0, .22); color: #fff; }
.rp-pot b { font-family: var(--font-head); font-weight: 600; font-size: 24px; }
.rp-pot small { font-size: 12px; font-weight: 700; opacity: .9; }
.rp-chips { position: relative; width: 28px; height: 30px; }
.rp-chips i { position: absolute; left: 0; width: 28px; height: 11px; border-radius: 50%; background: #fff; box-shadow: inset 0 0 0 3px var(--accent-2), 0 1px 0 rgba(0, 0, 0, .3); }
.rp-chips i:nth-child(1) { top: 18px; } .rp-chips i:nth-child(2) { top: 11px; } .rp-chips i:nth-child(3) { top: 4px; }
.rp-tk .rp-seat.out .rp-hand { opacity: .45; }
.rp-tk .pcard.is-trump { box-shadow: inset 0 0 0 2px #e0a92e; }

/* ===== v7: тренировка с ботами, парный 2×2, варианты дурака (knowledge/protocol-v7.md) ===== */
.chip[hidden], .practice[hidden], .field[hidden], .check[hidden], .check-hint[hidden] { display: none; }
.quick .qsel {
    min-height: 36px; padding: 0 28px 0 12px; font: inherit; font-size: 13px; font-weight: 700; color: var(--muted); cursor: pointer;
    appearance: none; -webkit-appearance: none;
    background: var(--surface) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M1 1l4 4 4-4' fill='none' stroke='%235c6a63' stroke-width='1.6'/%3E%3C/svg%3E") no-repeat right 11px center;
}
.quick .qsel.active { background-color: var(--accent); color: var(--accent-ink); }
.practice {
    display: grid; gap: 10px; margin: 0 0 14px; padding: 16px; border-radius: var(--r);
    background: var(--surface); border: 1px solid var(--accent-line); box-shadow: var(--shadow-sm);
}
.practice-head { display: flex; align-items: center; gap: 12px; }
.practice-ico { flex: none; width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center; font-size: 24px; background: var(--accent-soft); }
.practice-text { min-width: 0; }
.practice-text h2 { font-family: var(--font-head); font-weight: 600; font-size: 18px; margin: 0; }
.practice-text p { color: var(--muted); font-size: 13px; font-weight: 600; margin: 2px 0 0; }
.practice-opts { display: grid; gap: 8px; }
.popt { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.popt-l { flex: 0 0 96px; font-size: 13px; font-weight: 700; color: var(--muted); }
.practice .chip { min-height: 36px; padding: 0 12px; font-size: 13px; }
.practice .chip[data-pseats] { min-width: 40px; justify-content: center; }
.practice-note { margin: 0; font-size: 13px; color: var(--muted); }
.practice-btn { justify-self: start; min-height: 48px; padding: 0 24px; }
.practice .field-error { margin: 0; }
@media (max-width: 479px) {
    .popt-l { flex-basis: 100%; }
    .practice-btn { justify-self: stretch; }
}
@media (min-width: 900px) {
    .practice { grid-template-columns: minmax(0, 1fr) minmax(0, 1.4fr); align-items: start; column-gap: 24px; }
    .practice-head, .practice-note, .practice-btn, .practice .field-error { grid-column: 1; }
    .practice-opts { grid-column: 2; grid-row: 1 / span 4; }
}
.pairs-tag { color: var(--accent); }
.check-hint { font-size: 13px; margin: 4px 0 0 30px; }
.hist-tag { display: inline-block; padding: 0 6px; border-radius: 6px; background: var(--accent-soft); color: var(--accent); font-weight: 700; }
.rp-seat.partner .opp-name small { color: #fff; font-weight: 800; }
.rp-seat.partner:not(.actor) { box-shadow: inset 0 0 0 2px rgba(255, 255, 255, .7); }
.pill.team0, .pill.team1 { position: relative; }
.pill.team0 { box-shadow: inset 3px 0 0 var(--accent); }
.pill.team1 { box-shadow: inset 3px 0 0 #d98a2b; }
