/* TribeLink — полевой журнал охотника за дропами.
   Один яркий акцент — «штампы» серии дней; остальное спокойное. */

/* Тема: «Светлая», «Тёмная» или «Как в Telegram» (по умолчанию) — выбор в профиле на сервере,
   app.js ставит data-theme на <html>; игры читают те же переменные. */
:root {
  --bg: #EDEFF5;
  --surface: #FFFFFF;
  --surface-2: #F5F6FA;
  --surface-3: #FFFFFF;       /* выбранный сегмент поверх surface-2 */
  --ink: #161829;
  --muted: #6A6F87;
  --line: rgba(22, 24, 41, 0.09);
  --accent: #3550F2;          /* кобальт — действия (заливки) */
  --accent-fg: #3550F2;       /* кобальт для текста и значков */
  --accent-ink: #FFFFFF;
  --accent-soft: rgba(53, 80, 242, 0.10);
  --stamp: #F59E0B;           /* янтарь — серия и награды */
  --stamp-ink: #7A4A00;
  --stamp-soft: rgba(245, 158, 11, 0.14);
  --silver: #A9B0C0;          /* пьедестал: 2-е и 3-е место */
  --silver-soft: rgba(169, 176, 192, 0.20);
  --bronze: #C9813F;
  --bronze-soft: rgba(201, 129, 63, 0.14);
  --bronze-ink: #8A4B17;
  --good: #12936B;
  --bad: #DC3E42;
  --bad-soft: rgba(220, 62, 66, 0.10);
  --switch-off: #DADDE8;
  --shadow: 0 1px 2px rgba(22, 24, 41, 0.06), 0 8px 24px -12px rgba(22, 24, 41, 0.18);
  --display: "Unbounded", "Manrope", system-ui, sans-serif;
  --body: "Manrope", system-ui, -apple-system, "Segoe UI", sans-serif;
  --tabbar-h: 64px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  color-scheme: light;
}

/* Тёмная — OLED: глубокий чёрный фон, карточки чуть светлее; тот же кобальт (заливки) и янтарь.
   Текст не чисто белый, а кобальт для текста светлее — контраст ≥ 4,5:1 на всех поверхностях */
:root[data-theme="dark"] {
  --bg: #000000;
  --surface: #111114;
  --surface-2: #1C1C21;
  --surface-3: #2C2C34;
  --ink: #E6E8F0;
  --muted: #8E93A7;
  --line: rgba(230, 232, 240, 0.10);
  --accent: #3550F2;
  --accent-fg: #8091FF;
  --accent-ink: #FFFFFF;
  --accent-soft: rgba(96, 120, 255, 0.17);
  --stamp: #F59E0B;
  --stamp-ink: #2A1A00;
  --stamp-soft: rgba(245, 158, 11, 0.16);
  --silver: #A3AABB;
  --silver-soft: rgba(163, 170, 187, 0.14);
  --bronze: #D08A50;
  --bronze-soft: rgba(208, 138, 80, 0.16);
  --bronze-ink: #E3A574;
  --good: #34C796;
  --bad: #FF5C61;
  --bad-soft: rgba(255, 92, 97, 0.14);
  --switch-off: #3A3A43;
  --shadow: 0 0 0 1px rgba(255, 255, 255, 0.05);
  color-scheme: dark;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; background: var(--bg); color: var(--ink); }
body {
  font: 500 15px/1.45 var(--body);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  overscroll-behavior-y: none;
}
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; border: 0; background: none; padding: 0; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
a { color: var(--accent-fg); }

.screen {
  max-width: 560px;
  margin: 0 auto;
  padding: 16px 16px calc(var(--tabbar-h) + var(--safe-b) + 28px);
}
.screen.sub { padding-top: 12px; }

/* ---------- Типографика ---------- */
.display { font-family: var(--display); letter-spacing: -0.02em; }
h1, h2, h3 { margin: 0; font-family: var(--display); letter-spacing: -0.02em; }
h1 { font-size: 24px; font-weight: 700; line-height: 1.15; }
h2 { font-size: 17px; font-weight: 700; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.section-head {
  display: flex; align-items: baseline; justify-content: space-between;
  margin: 26px 4px 10px;
}
.section-head h2 { font-size: 16px; }
.section-head .muted { font-size: 13px; }

/* ---------- Шапка основных экранов: заголовок слева, шестерёнка настроек справа ---------- */
.topline { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 18px; }
.topline .hello { font-size: 15px; color: var(--muted); min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 10px; min-height: 44px; margin: 0 0 14px; }
.topbar h1 { margin-left: 4px; min-width: 0; }
.topline-end, .topbar-end { display: flex; align-items: center; gap: 8px; flex: none; }
.gear {
  flex: none; position: relative; width: 40px; height: 40px; border-radius: 50%;
  display: grid; place-items: center; background: var(--surface); color: var(--muted);
  transition: transform 160ms, color 160ms;
}
.gear::before { content: ""; position: absolute; inset: -2px; }  /* зона нажатия 44px */
.gear svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linejoin: round; }
.gear:active { transform: rotate(40deg) scale(0.94); color: var(--ink); }
.hdr-btns { display: flex; align-items: center; gap: 8px; flex: none; }
.hdr-wallet:active { transform: scale(0.94); }
.gear .dot { position: absolute; top: 6px; right: 6px; width: 9px; height: 9px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 2px var(--surface); }
.level-chip {
  font: 700 12px/1 var(--display);
  padding: 8px 11px; border-radius: 999px;
  background: var(--accent-soft); color: var(--accent-fg);
}

/* ---------- Серия: главный визуальный элемент ---------- */
.streak {
  background: var(--surface);
  border-radius: 24px;
  padding: 20px 18px 18px;
  box-shadow: var(--shadow);
}
.streak-top { display: flex; align-items: flex-end; gap: 12px; }
.streak-num {
  font: 800 68px/0.82 var(--display);
  letter-spacing: -0.05em;
  color: var(--ink);
}
.streak-num.zero { color: var(--muted); opacity: 0.5; }
.streak-label { padding-bottom: 4px; }
.streak-label b { display: block; font: 700 15px/1.2 var(--display); }
.streak-label span { font-size: 13px; color: var(--muted); }

.stamps {
  display: grid; grid-template-columns: repeat(7, 1fr);
  gap: 8px; margin-top: 18px;
}
.stamp {
  aspect-ratio: 1; border-radius: 50%;
  display: grid; place-items: center;
  font: 600 11px/1 var(--display);
  color: var(--muted);
  border: 1.5px dashed var(--line);
  position: relative;
}
.stamp.on {
  border: 2px solid var(--stamp);
  background: var(--stamp-soft);
  color: var(--stamp-ink);
  transform: rotate(var(--r, -8deg));
}
:root[data-theme="dark"] .stamp.on { color: var(--stamp); }
.stamp.on::after {
  content: ""; position: absolute; inset: 3px; border-radius: 50%;
  border: 1px solid var(--stamp); opacity: 0.55;
}
.stamp.today:not(.on) { border: 2px solid var(--accent-fg); color: var(--accent-fg); border-style: solid; }
/* день, который закрыла заморозка: холодный, без наклона — серия не выросла, но и не сгорела */
.stamp.frozen { border: 1.5px dashed var(--accent-fg); background: var(--accent-soft); color: var(--accent-fg); font-size: 14px; }

/* заморозка серии — чип в углу блока серии */
.freeze {
  margin-left: auto; align-self: flex-start; position: relative;
  display: inline-flex; align-items: center; gap: 5px;
  padding: 7px 11px; border-radius: 999px;
  font: 700 12px/1 var(--display);
  background: var(--accent-soft); color: var(--accent-fg);
}
.freeze::before { content: ""; position: absolute; inset: -7px -4px; }  /* зона нажатия 44px */
.freeze .ico { font-size: 13px; }
.freeze.used { background: var(--surface-2); color: var(--muted); }
.freeze-note { margin-top: 12px; font-size: 13px; font-weight: 600; color: var(--accent-fg); }
.stamp.pop { animation: stamp-in 420ms cubic-bezier(.2, 1.6, .4, 1); }
@keyframes stamp-in {
  0% { transform: scale(1.8) rotate(-30deg); opacity: 0; }
  100% { transform: scale(1) rotate(var(--r, -8deg)); opacity: 1; }
}

.xp { margin-top: 16px; }
.xp-bar { height: 6px; border-radius: 6px; background: var(--surface-2); overflow: hidden; }
.xp-bar i { display: block; height: 100%; background: var(--accent); border-radius: 6px; transition: width 500ms ease; }
.xp-text { margin-top: 7px; font-size: 12px; color: var(--muted); }

/* ---------- Анонс-билет ---------- */
.ticket {
  display: flex; gap: 12px; align-items: flex-start;
  margin-top: 14px; padding: 14px 16px;
  background: var(--surface); border-radius: 16px;
  border-left: 4px solid var(--stamp);
  text-align: left; width: 100%;
}
.ticket .ico { font-size: 20px; line-height: 1.2; }
.ticket .label { font-size: 12px; color: var(--muted); margin-bottom: 2px; }
.ticket .txt {
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
  font-weight: 600;
}

/* ---------- Списки ---------- */
.group {
  background: var(--surface);
  border-radius: 18px;
  overflow: hidden;
}
.row {
  display: flex; align-items: center; gap: 12px;
  padding: 13px 16px; min-height: 56px; width: 100%;
  text-align: left; position: relative;
}
.row + .row::before {
  content: ""; position: absolute; top: 0; left: 56px; right: 0;
  height: 1px; background: var(--line);
}
.row.plain + .row.plain::before { left: 16px; }
.row .main { flex: 1; min-width: 0; }
.row .title { font-weight: 600; overflow: hidden; text-overflow: ellipsis; }
.row .sub { font-size: 13px; color: var(--muted); margin-top: 1px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row .end { font-size: 13px; color: var(--muted); white-space: nowrap; }
.row .chev { width: 8px; height: 8px; border-right: 2px solid var(--muted); border-top: 2px solid var(--muted); transform: rotate(45deg); opacity: 0.5; }
.row.done .title { text-decoration: line-through; color: var(--muted); }
.row.skipped .title { color: var(--muted); }
.row.skipped .end { font-style: italic; }
.row.add { color: var(--accent-fg); font-weight: 600; }
.row.add .plus { width: 28px; height: 28px; display: grid; place-items: center; font-size: 22px; font-weight: 500; }

.check {
  flex: none; width: 28px; height: 28px; border-radius: 50%; position: relative;
  border: 2px solid var(--muted); opacity: 0.85;
  display: grid; place-items: center;
  transition: background 160ms, border-color 160ms, transform 160ms;
}
.check::before { content: ""; position: absolute; inset: -8px; }  /* зона нажатия 44px */
.check svg { width: 14px; height: 14px; stroke: var(--accent-ink); stroke-width: 3; fill: none; opacity: 0; }
.check.on { background: var(--accent); border-color: var(--accent); opacity: 1; }
.check.on svg { opacity: 1; }
.check:active { transform: scale(0.88); }

.avatar {
  flex: none; width: 42px; height: 42px; border-radius: 13px;
  display: grid; place-items: center; font-size: 22px;
  background: var(--surface-2);
}
.avatar.lg { width: 64px; height: 64px; border-radius: 20px; font-size: 34px; }

/* ---------- Пустые состояния ---------- */
.empty {
  background: var(--surface); border-radius: 18px;
  padding: 22px 18px; text-align: left;
}
.empty h3 { font-size: 16px; margin-bottom: 6px; }
.empty p { margin: 0 0 16px; color: var(--muted); }
.empty .btns { display: flex; gap: 8px; flex-wrap: wrap; }

/* ---------- Кнопки ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 48px; padding: 0 18px; border-radius: 14px;
  font-weight: 700; font-size: 15px;
  background: var(--surface-2); color: var(--ink);
  transition: transform 120ms, opacity 120ms;
}
.btn:active { transform: scale(0.97); }
.btn[disabled] { opacity: 0.5; pointer-events: none; }
[aria-busy="true"] { opacity: 0.6; pointer-events: none; }  /* идёт запрос — повторный тап не проходит */
.btn.primary { background: var(--accent); color: var(--accent-ink); }
.btn.soft { background: var(--accent-soft); color: var(--accent-fg); }
.btn.danger { background: var(--bad-soft); color: var(--bad); }
.btn.block { width: 100%; }
.btn.sm { min-height: 44px; padding: 0 14px; font-size: 14px; border-radius: 12px; }
.btn-row { display: flex; gap: 8px; }
.btn-row > * { flex: 1; }
.stack { display: grid; gap: 8px; }

.fab {
  position: fixed; right: 18px;
  bottom: calc(var(--tabbar-h) + var(--safe-b) + 16px);
  height: 52px; padding: 0 20px; border-radius: 18px;
  background: var(--accent); color: var(--accent-ink);
  font-weight: 700; box-shadow: var(--shadow);
  display: flex; align-items: center; gap: 6px; z-index: 5;
}
.fab span { font-size: 22px; line-height: 1; font-weight: 500; }

/* ---------- Сегменты и чипсы ---------- */
.seg {
  display: flex; padding: 3px; border-radius: 13px; background: var(--surface-2);
  margin-bottom: 14px;
}
:root[data-theme="dark"] .seg { background: var(--surface); }
:root[data-theme="dark"] .sheet .seg { background: var(--surface-2); }
.sheet .row .seg, :root[data-theme="dark"] .sheet .row .seg { background: var(--bg); }  /* строка листа — уже surface-2 */
.seg button {
  flex: 1; padding: 8px 10px; border-radius: 10px; min-height: 44px;
  font-weight: 600; font-size: 14px; color: var(--muted);
}
.seg button.on { background: var(--surface-3); color: var(--ink); box-shadow: 0 1px 3px rgba(0,0,0,.08); }
/* сегменты по ширине подписи («Как в Telegram» длиннее «Светлой») */
.seg.fit button { flex: 1 1 auto; padding: 8px 6px; white-space: nowrap; }

.chips { display: flex; gap: 6px; overflow-x: auto; margin: -5px -16px 9px; padding: 5px 16px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip {
  flex: none; padding: 8px 13px; border-radius: 999px; position: relative;
  font-size: 13px; font-weight: 600;
  background: var(--surface); color: var(--muted);
}
.chip::before { content: ""; position: absolute; inset: -5px 0; }  /* зона нажатия ~45px, контейнер даёт отступ 5px */
.chip.on { background: var(--ink); color: var(--bg); }

/* ---------- Поиск по ленте ---------- */
.search { position: relative; margin-bottom: 12px; }
.search svg {
  position: absolute; left: 14px; top: 50%; width: 18px; height: 18px; transform: translateY(-50%);
  fill: none; stroke: var(--muted); stroke-width: 2; stroke-linecap: round; pointer-events: none;
}
.search .input { padding-left: 42px; padding-right: 46px; background: var(--surface); }
.search .input::-webkit-search-cancel-button { -webkit-appearance: none; display: none; }
.search-clear {
  position: absolute; right: 2px; top: 50%; transform: translateY(-50%);
  width: 44px; height: 44px; font-size: 22px; line-height: 1; color: var(--muted);
}

/* ---------- Карточки ленты ---------- */
.cards { display: grid; gap: 10px; }
.card {
  background: var(--surface); border-radius: 20px;
  padding: 16px; text-align: left; width: 100%;
  display: block;
}
.card.pinned { box-shadow: inset 0 0 0 2px var(--stamp); }
.card-head { display: flex; gap: 12px; align-items: center; }
.card-head .main { flex: 1; min-width: 0; }
.card-head .title { font: 700 16px/1.2 var(--display); letter-spacing: -0.01em; }
.card-head .sub { font-size: 13px; color: var(--muted); margin-top: 3px; }
.card p { margin: 10px 0 12px; color: var(--muted); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.card-meta { display: flex; gap: 14px; font-size: 13px; color: var(--muted); align-items: center; }
.card-meta b { color: var(--ink); font-weight: 700; }
.badge {
  display: inline-block; font-size: 11px; font-weight: 700;
  padding: 3px 8px; border-radius: 999px; vertical-align: 2px; margin-left: 6px;
  background: var(--stamp-soft); color: var(--stamp-ink);
}
:root[data-theme="dark"] .badge:not(.blue, .red, .green) { color: var(--stamp); }   /* цветные бейджи — своим цветом */
.badge.blue { background: var(--accent-soft); color: var(--accent-fg); }
.badge.red { background: var(--bad-soft); color: var(--bad); }
.badge.green { background: rgba(18,147,107,.12); color: var(--good); }

/* ---------- Детальный экран ---------- */
.hero { display: flex; gap: 14px; align-items: center; margin: 4px 0 18px; }
.hero h1 { font-size: 22px; }
.hero .main { flex: 1; min-width: 0; }
.hero .sub { color: var(--muted); font-size: 14px; margin-top: 4px; }
.text-block { background: var(--surface); border-radius: 18px; padding: 16px; white-space: pre-wrap; }
.votes { display: flex; gap: 8px; margin-top: 10px; }
.vote {
  flex: 1; min-height: 44px; border-radius: 13px; background: var(--surface);
  font-weight: 600; font-size: 14px; display: flex; align-items: center; justify-content: center; gap: 6px;
}
.vote.on.works { background: rgba(18,147,107,.14); color: var(--good); }
.vote.on.scam { background: var(--bad-soft); color: var(--bad); }

.money { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.money .field { margin: 0; }
.roi {
  grid-column: 1 / -1; display: flex; justify-content: space-between; align-items: baseline;
  background: var(--surface); border-radius: 14px; padding: 12px 14px;
}
.roi b { font: 700 18px var(--display); }
.roi .pos { color: var(--good); }
.roi .neg { color: var(--bad); }

.note { padding: 12px 16px; position: relative; }
.note + .note { border-top: 1px solid var(--line); }
.note .date { font-size: 12px; color: var(--muted); margin-bottom: 3px; display: flex; justify-content: space-between; }
.note .date button { color: var(--muted); font-size: 12px; padding: 14px 10px; margin: -14px -10px; }
.note .body { white-space: pre-wrap; word-break: break-word; }

/* ---------- Формы ---------- */
.field { display: block; margin-bottom: 12px; }
.field > span { display: block; font-size: 13px; font-weight: 600; color: var(--muted); margin: 0 4px 6px; }
.input {
  width: 100%; min-height: 48px; padding: 12px 14px;
  border-radius: 13px; border: 1.5px solid transparent;
  background: var(--surface-2); outline: none;
}
.input:focus { border-color: var(--accent); }
.input.bad { border-color: var(--bad); }
textarea.input { min-height: 96px; resize: vertical; line-height: 1.45; }
.inline-form { display: flex; gap: 8px; padding: 12px; }
.inline-form .input { min-height: 44px; }
.inline-form textarea.input { min-height: 44px; height: 44px; }
.emoji-pick { display: flex; gap: 6px; flex-wrap: wrap; }
.emoji-pick button {
  width: 44px; height: 44px; border-radius: 12px; font-size: 21px;
  background: var(--surface-2);
}
.emoji-pick button.on { box-shadow: inset 0 0 0 2px var(--accent); background: var(--accent-soft); }
.switch-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.switch {
  flex: none; width: 50px; height: 30px; border-radius: 30px; background: var(--switch-off);
  position: relative; transition: background 160ms;
}
.switch::after {
  content: ""; position: absolute; top: 3px; left: 3px; width: 24px; height: 24px; border-radius: 50%;
  background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.25); transition: transform 160ms;
}
.switch::before { content: ""; position: absolute; inset: -7px -3px; }  /* зона нажатия 44px */
.switch.on { background: var(--accent); }
.switch.on::after { transform: translateX(20px); }
.copy-box {
  display: flex; align-items: center; gap: 8px; padding: 10px 12px 10px 14px;
  background: var(--surface-2); border-radius: 13px; margin-bottom: 12px;
}
.copy-box code { flex: 1; font: 600 13px/1.35 var(--body); word-break: break-all; }

/* оплата: TON Connect + ручной перевод */
.pay-hint { margin: 10px 4px 0; }
.pay-wait {
  display: flex; align-items: center; gap: 10px; margin-top: 12px; padding: 12px 14px;
  border-radius: 13px; background: var(--accent-soft); color: var(--accent-fg); font-weight: 600; font-size: 14px;
}
.spinner {
  flex: none; width: 18px; height: 18px; border-radius: 50%;
  border: 2.5px solid currentColor; border-right-color: transparent; animation: spin 800ms linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.pay-manual { margin: 14px 0 10px; }
.pay-manual summary {
  display: flex; align-items: center; justify-content: space-between; min-height: 44px; padding: 0 4px;
  color: var(--accent-fg); font-weight: 600; cursor: pointer; list-style: none;
}
.pay-manual summary::-webkit-details-marker { display: none; }
.pay-manual summary::after {
  content: ""; width: 7px; height: 7px; margin-right: 4px;
  border-right: 2px solid currentColor; border-bottom: 2px solid currentColor; transform: rotate(45deg);
  transition: transform 160ms;
}
.pay-manual[open] summary::after { transform: rotate(-135deg); }
.pay-manual .pay-hint { margin: 2px 4px 12px; }

/* ---------- Нижний лист ---------- */
.sheet-backdrop {
  position: fixed; inset: 0; background: rgba(8, 9, 20, 0.45);
  opacity: 0; pointer-events: none; transition: opacity 200ms; z-index: 20;
}
.sheet-backdrop.open { opacity: 1; pointer-events: auto; }
.sheet {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 21;
  max-width: 560px; margin: 0 auto;
  max-height: 90vh; overflow-y: auto;
  background: var(--surface); border-radius: 24px 24px 0 0;
  padding: 10px 16px calc(20px + var(--safe-b));
  transform: translateY(105%); transition: transform 260ms cubic-bezier(.2, .9, .3, 1);
}
:root[data-theme="dark"] .sheet .input { background: var(--surface-2); }
.sheet:not(.open) { visibility: hidden; transition: transform 260ms cubic-bezier(.2, .9, .3, 1), visibility 0s 260ms; }
.sheet.open { transform: translateY(0); visibility: visible; }
.sheet .handle { width: 38px; height: 5px; border-radius: 5px; background: var(--line); margin: 0 auto 14px; }
.sheet h2 { font-size: 19px; margin-bottom: 16px; }
.sheet p.lead { color: var(--muted); margin: -6px 0 16px; }
.sheet .group, .sheet .row { background: var(--surface-2); }
.sheet .chip { background: var(--surface-2); }
.sheet .chip.on { background: var(--ink); color: var(--bg); }
.copy-box .btn { background: var(--surface); }

/* ---------- Тост ---------- */
.toast {
  position: fixed; left: 50%; z-index: 40;
  bottom: calc(var(--tabbar-h) + var(--safe-b) + 18px);
  transform: translate(-50%, 20px); opacity: 0;
  background: var(--ink); color: var(--bg);
  padding: 11px 16px; border-radius: 14px; font-weight: 600; font-size: 14px;
  max-width: calc(100% - 32px); width: max-content;
  transition: opacity 180ms, transform 180ms; pointer-events: none;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.gold { background: var(--stamp); color: var(--stamp-ink); }
body.hide-tabs .toast { z-index: 60; bottom: calc(var(--safe-b) + 24px); }   /* во время игры — поверх неё */

/* ---------- Таббар ---------- */
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 10;
  height: calc(var(--tabbar-h) + var(--safe-b)); padding-bottom: var(--safe-b);
  display: flex; justify-content: center;
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
  border-top: 1px solid var(--line);
}
.tabbar button {
  flex: 1; max-width: 112px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  font-size: 11px; font-weight: 600; color: var(--muted);
}
.tabbar svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.tabbar button.on { color: var(--accent-fg); }
.tabbar button.on svg { stroke-width: 2.3; }
body.hide-tabs .tabbar { display: none; }

/* ---------- Профиль ---------- */
.stat-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.stat { background: var(--surface); border-radius: 16px; padding: 14px; }
.stat b { display: block; font: 700 24px/1.1 var(--display); letter-spacing: -0.02em; }
.stat span { font-size: 13px; color: var(--muted); }
.profile-head { display: flex; align-items: center; gap: 14px; margin-bottom: 18px; }
.profile-head .main { flex: 1; min-width: 0; }
.profile-head h1 { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.profile-head .hdr-btns { align-self: flex-start; }
.group.invite { padding: 14px; }
.invite p { margin: 0 2px 12px; color: var(--muted); font-size: 14px; }

/* Аватар человека: фото из Telegram поверх круга с первой буквой (фото не загрузилось — видна буква) */
.ava {
  --s: 40px;
  flex: none; position: relative; width: var(--s); height: var(--s); border-radius: 50%; overflow: hidden;
  display: grid; place-items: center; background: var(--accent-soft); color: var(--accent-fg);
  font: 700 calc(var(--s) * 0.42)/1 var(--display);
}
.ava img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; background: var(--surface-2); }

/* ---------- Лист настроек (шестерёнка) ---------- */
.sheet .settings .row { min-height: 54px; }
.row.col { flex-direction: column; align-items: stretch; gap: 10px; }
.row.col .seg, .row .seg { margin: 0; }
.seg.lang { width: 124px; flex: none; }
.ico-tile {
  flex: none; width: 36px; height: 36px; border-radius: 11px; display: grid; place-items: center;
  background: var(--accent-soft); color: var(--accent-fg);
}
.ico-tile svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
.sheet .links { margin-top: 12px; }
.sheet .links .row + .row::before { left: 64px; }
.sheet-title { display: flex; align-items: center; gap: 4px; margin-bottom: 16px; }
.sheet-title h2 { margin: 0; }
.sheet-back { flex: none; width: 44px; height: 44px; margin: -10px 0 -10px -12px; display: grid; place-items: center; }
.sheet-back::before {
  content: ""; width: 10px; height: 10px; margin-left: 4px;
  border-left: 2.5px solid var(--ink); border-bottom: 2.5px solid var(--ink); transform: rotate(45deg);
}
.support-left { margin: -4px 4px 14px; }
.quote {
  margin: -6px 0 14px; padding: 10px 12px; border-left: 3px solid var(--line); border-radius: 4px;
  color: var(--muted); font-size: 14px; white-space: pre-wrap; word-break: break-word; max-height: 132px; overflow-y: auto;
}

/* ---------- Админ: «Сообщения» ---------- */
.msgs { display: grid; gap: 10px; }
.msg { background: var(--surface); border-radius: 18px; padding: 14px 14px 12px; }
.msg.unread { box-shadow: inset 3px 0 0 var(--accent); }
.msg-head { display: flex; gap: 12px; align-items: center; }
.msg-head .main { flex: 1; min-width: 0; }
.msg-head .title { font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.msg-head .title .muted { font-weight: 600; }
.msg-head .sub { font-size: 12px; color: var(--muted); margin-top: 1px; }
.msg-id { position: relative; font: inherit; color: var(--muted); text-decoration: underline dotted; text-underline-offset: 2px; }
.msg-id::before { content: ""; position: absolute; inset: -14px -6px; }  /* зона нажатия 44px */
.msg-text { margin: 10px 2px 0; white-space: pre-wrap; word-break: break-word; }
.msg-reply { margin-top: 10px; padding: 10px 12px; border-radius: 12px; background: var(--surface-2); font-size: 14px; }
.msg-reply .label { font-size: 12px; color: var(--muted); margin-bottom: 2px; }
.msg-reply .bad { color: var(--bad); font-weight: 700; }
.msg-reply .body { white-space: pre-wrap; word-break: break-word; }
.msg-actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 12px; }

/* ---------- Игра ---------- */
.game-hero {
  background: var(--surface); border-radius: 24px; padding: 20px 18px; overflow: hidden; position: relative;
}
.game-hero h1 { font-size: 26px; }
.game-hero p { color: var(--muted); margin: 10px 0 18px; }
.game-hero .best { display: flex; gap: 18px; margin-bottom: 18px; clear: both; }
.game-hero .best b { display: block; font: 800 30px/1 var(--display); }
.game-hero .best span { font-size: 12px; color: var(--muted); }
/* картинка игры обтекается текстом правил */
.game-hero canvas.deco { float: right; width: 110px; height: 150px; margin: -6px -6px 8px 12px; pointer-events: none; }
.game-hero .daily-xp { margin: -4px 0 14px; }
.daily-xp {
  margin: 0 0 14px; padding: 11px 14px; border-radius: 14px;
  font-size: 13px; font-weight: 600; background: var(--stamp-soft); color: var(--stamp-ink);
}
:root[data-theme="dark"] .daily-xp { color: var(--stamp); }
.daily-xp.done { background: var(--surface); color: var(--muted); }
.games { display: grid; gap: 10px; }
.game-card {
  display: flex; align-items: center; gap: 14px; width: 100%; padding: 14px 16px 14px 14px;
  background: var(--surface); border-radius: 20px; text-align: left;
  transition: transform 120ms;
}
.game-card:active { transform: scale(0.985); }
.game-icon { flex: none; width: 56px; height: 56px; border-radius: 16px; background: var(--surface-2); }
.game-card .main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.game-card .title { font: 700 16px/1.2 var(--display); letter-spacing: -0.01em; }
.game-card .sub { font-size: 13px; color: var(--muted); }
.game-card .rec { font-size: 13px; font-weight: 700; color: var(--accent-fg); margin-top: 2px; }
.game-card .chev { flex: none; width: 8px; height: 8px; border-right: 2px solid var(--muted); border-top: 2px solid var(--muted); transform: rotate(45deg); opacity: 0.5; }
.lb-rank { width: 28px; text-align: center; font: 700 14px var(--display); color: var(--muted); }
.lb-rank.top { color: var(--stamp); }
.row.me { background: var(--accent-soft); }
.sheet .row.me, .wk-list .row.me { background: var(--accent-soft); }

/* Лидеры недели: топ-3 — пьедестал, места 4–10 — список, внизу — до сброса и моё место */
.weekly { background: var(--surface); border-radius: 22px; padding: 18px 10px 10px; }
.podium { display: grid; grid-template-columns: 1fr 1.18fr 1fr; align-items: end; gap: 6px; }
.pod { display: flex; flex-direction: column; align-items: center; min-width: 0; text-align: center; }
.pod .ava { margin-bottom: 9px; box-shadow: 0 0 0 2.5px var(--surface), 0 0 0 5px var(--medal); }
.pod-name { max-width: 100%; padding: 0 2px; font-size: 13px; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pod.me .pod-name { color: var(--accent-fg); }
.pod-score { font: 800 15px/1.2 var(--display); letter-spacing: -0.02em; margin: 2px 0 8px; }
.pod-step {
  width: 100%; display: grid; place-items: center; border-radius: 12px 12px 4px 4px;
  background: var(--medal-soft); border-top: 3px solid var(--medal);
}
.pod-step b { font: 800 18px/1 var(--display); color: var(--medal-ink); }
.pod.p1 { --medal: var(--stamp); --medal-soft: var(--stamp-soft); --medal-ink: var(--stamp-ink); }
:root[data-theme="dark"] .pod.p1 { --medal-ink: var(--stamp); }
.pod.p2 { --medal: var(--silver); --medal-soft: var(--silver-soft); --medal-ink: var(--muted); }
.pod.p3 { --medal: var(--bronze); --medal-soft: var(--bronze-soft); --medal-ink: var(--bronze-ink); }
.pod.p1 .pod-step { height: 66px; }
.pod.p2 .pod-step { height: 48px; }
.pod.p3 .pod-step { height: 36px; }
.pod.vacant .pod-step { opacity: 0.4; }
.wk-list { margin-top: 10px; border-radius: 16px; overflow: hidden; background: var(--surface-2); }
.wk-list .row { min-height: 52px; padding: 8px 12px; gap: 10px; }
.wk-list .row + .row::before { left: 12px; }
.wk-list .title { white-space: nowrap; }
.wk-list .you { color: var(--accent-fg); font-weight: 700; }
.wk-list .row .lb-score { font: 700 14px var(--display); color: var(--ink); }
.wk-foot {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 4px 12px;
  padding: 12px 6px 4px; font-size: 13px; color: var(--muted);
}
.wk-reset { display: inline-flex; align-items: center; gap: 5px; }
.wk-reset svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }
.wk-me { font-weight: 700; color: var(--ink); }
.wk-me.muted { font-weight: 600; color: var(--muted); }
.weekly.empty-wk { padding: 16px 16px 10px; }
.weekly.empty-wk p { margin: 0; color: var(--muted); }
.weekly.empty-wk .wk-foot { padding: 10px 0 2px; }

.game-layer {
  position: fixed; inset: 0; z-index: 50; display: none;
  background: var(--bg); touch-action: none; user-select: none;
}
.game-layer.open { display: block; }
.game-layer > canvas { position: absolute; inset: 0; width: 100%; height: 100%; }
.game-hud {
  /* под вырезом экрана и, в полноэкранном режиме Telegram, под его кнопками сверху */
  position: absolute; top: calc(max(env(safe-area-inset-top, 0px), var(--tg-safe-area-inset-top, 0px)) + var(--tg-content-safe-area-inset-top, 0px) + 12px);
  left: calc(env(safe-area-inset-left, 0px) + 16px); right: calc(env(safe-area-inset-right, 0px) + 16px);
  display: flex; align-items: center; gap: 10px; pointer-events: none;
}
/* HUD поверх неба любого времени суток: белый текст на полупрозрачных «стеклянных» плашках */
.game-score {
  font: 800 30px/1 var(--display); letter-spacing: -0.03em; color: #fff;
  text-shadow: 0 2px 0 rgba(10, 12, 30, 0.35), 0 0 14px rgba(10, 12, 30, 0.35);
}
.game-lives {
  flex: 1; font-size: 19px; letter-spacing: 2px; color: #ff5d62;
  text-shadow: 0 0 2px #fff, 0 1px 0 rgba(10, 12, 30, 0.4);
}
.game-lives.hit { animation: lives-hit 420ms ease-out; }
@keyframes lives-hit { 0% { transform: scale(1.35); } 40% { transform: translateX(-4px); } 70% { transform: translateX(3px); } 100% { transform: none; } }
.game-btn {
  pointer-events: auto; width: 44px; height: 44px; border-radius: 50%; flex: none; display: grid; place-items: center;
  background: rgba(12, 14, 32, 0.38); color: #fff; border: 1px solid rgba(255, 255, 255, 0.22);
  -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px);
}
.game-btn svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.game-btn .off { display: none; }
.game-btn.off .on { display: none; }
.game-btn.off .off { display: inline; }
.game-btn:active { transform: scale(0.92); }
.game-layer.ended .game-btn { visibility: hidden; }

/* Стена: кнопка справа внизу, меню — строкой слева от неё. Пустое место вокруг касания не ловит — они идут в игру */
.game-wall {
  position: absolute; z-index: 2; pointer-events: none; display: flex; flex-direction: row-reverse; align-items: flex-end; gap: 6px;
  right: calc(max(env(safe-area-inset-right, 0px), var(--tg-safe-area-inset-right, 0px)) + 12px);
  bottom: calc(max(env(safe-area-inset-bottom, 0px), var(--tg-safe-area-inset-bottom, 0px)) + 12px);
}
.gw-btn {
  position: relative; pointer-events: auto; flex: none; width: 52px; height: 52px; border-radius: 16px; display: grid; place-items: center;
  background: rgba(12, 14, 32, 0.42); color: #fff; border: 1px solid rgba(255, 255, 255, 0.22);
  -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px);
}
.gw-btn canvas { width: 44px; height: 44px; }
.gw-btn b {
  position: absolute; top: -8px; left: -10px; min-width: 24px; padding: 2px 6px; border-radius: 11px; text-align: center;
  background: var(--stamp); color: #241600; font: 800 11px/1.3 var(--display); box-shadow: 0 1px 4px rgba(0, 0, 0, 0.3);
}
.gw-btn[aria-expanded="true"] { background: var(--accent); border-color: transparent; }
.gw-menu { display: none; gap: 4px; pointer-events: auto; }
.game-wall.open .gw-menu { display: flex; animation: ap-in 160ms ease-out; }
.gw-item {
  width: 64px; min-height: 66px; padding: 6px 2px 5px; border-radius: 14px; display: flex; flex-direction: column; align-items: center; gap: 3px;
  background: var(--surface); color: var(--ink); box-shadow: 0 4px 14px rgba(0, 0, 0, 0.28); font: 700 10px/1.15 var(--body);
}
.gw-item svg { width: 18px; height: 18px; fill: none; stroke: var(--accent-fg); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.gw-item em { display: flex; align-items: center; gap: 3px; font: 800 11px/1 var(--display); font-style: normal; color: var(--ink); }
.gw-item em.short { color: var(--bad); }
.gw-item em.note { font: 700 10px/1 var(--body); color: var(--muted); }
.gw-item.dim { opacity: 0.62; }
.gw-coin { width: 9px; height: 9px; border-radius: 50%; background: var(--stamp); box-shadow: inset 0 0 0 1.5px rgba(120, 70, 0, 0.45); }
.gw-pips { display: flex; gap: 2px; }
.gw-pips u { width: 9px; height: 3px; border-radius: 2px; background: var(--line); }
.gw-pips u.on { background: var(--accent); }
.gw-btn:active, .gw-item:active { transform: scale(0.94); }
.game-layer.ended .game-wall { visibility: hidden; }

/* Панели поверх игры: выбор улучшения и пауза */
.game-panel {
  position: absolute; inset: 0; z-index: 3; display: none; align-items: center; justify-content: center;
  padding: calc(max(env(safe-area-inset-top, 0px), var(--tg-safe-area-inset-top, 0px)) + var(--tg-content-safe-area-inset-top, 0px) + 16px) 16px
    calc(max(env(safe-area-inset-bottom, 0px), var(--tg-safe-area-inset-bottom, 0px)) + 16px);
  overflow-y: auto;
  background: rgba(8, 10, 26, 0.55); -webkit-backdrop-filter: blur(3px); backdrop-filter: blur(3px);
}
.game-panel.open { display: flex; animation: ap-in 220ms ease-out; }
@keyframes ap-in { from { opacity: 0; } to { opacity: 1; } }
.ap-box { width: 100%; max-width: 400px; text-align: center; color: #fff; }
.ap-box h2 { font: 800 24px/1.15 var(--display); margin: 2px 0 6px; letter-spacing: -0.02em; }
.ap-box p { margin: 0 0 16px; color: rgba(255, 255, 255, 0.75); font-size: 14px; }
.ap-kicker { font: 700 12px var(--display); color: var(--stamp); text-transform: uppercase; letter-spacing: 0.06em; }
.ap-cards { display: grid; gap: 10px; }
.ap-card {
  display: grid; grid-template-columns: 56px 1fr; grid-template-rows: auto auto auto; column-gap: 14px; align-items: center;
  text-align: left; padding: 12px 14px; border-radius: 18px; min-height: 84px;
  background: var(--surface); color: var(--ink); box-shadow: 0 6px 24px rgba(0, 0, 0, 0.25);
  animation: ap-card 320ms cubic-bezier(.2, 1.4, .4, 1) both;
}
.ap-card:nth-child(2) { animation-delay: 70ms; }
.ap-card:nth-child(3) { animation-delay: 140ms; }
@keyframes ap-card { from { transform: translateY(18px) scale(0.96); opacity: 0; } to { transform: none; opacity: 1; } }
.ap-card:active { transform: scale(0.97); }
.ap-card canvas { grid-row: 1 / 4; width: 56px; height: 56px; }
.ap-name, .ap-desc, .ap-pips { grid-column: 2; }
.ap-name { font: 700 16px/1.2 var(--display); letter-spacing: -0.01em; }
.ap-desc { font-size: 13px; color: var(--muted); margin-top: 2px; }
.ap-pips { display: flex; gap: 4px; margin-top: 6px; color: var(--bad); font-size: 13px; letter-spacing: 1px; }
.ap-pips i { width: 16px; height: 5px; border-radius: 3px; background: var(--line); }
.ap-pips i.on { background: var(--accent); }
.ap-pips i.new { background: var(--stamp); }
.ap-pause .btn { margin-top: 10px; }
.ap-toggles { display: grid; gap: 8px; margin: 14px 0 6px; }
.ap-toggle {
  display: flex; align-items: center; justify-content: space-between; min-height: 48px; padding: 0 16px;
  border-radius: 14px; background: rgba(255, 255, 255, 0.1); color: #fff; font-weight: 700; font-size: 15px;
}
.ap-toggle i { width: 42px; height: 24px; border-radius: 12px; background: rgba(255, 255, 255, 0.25); position: relative; transition: background 160ms; }
.ap-toggle i::after { content: ""; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: #fff; transition: transform 160ms; }
.ap-toggle.on i { background: var(--accent); }
.ap-toggle.on i::after { transform: translateX(18px); }
.go-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 14px 0 4px; }
.go-stats div { background: var(--surface-2); border-radius: 14px; padding: 10px 4px; }
.go-stats b { display: block; font: 800 18px/1.1 var(--display); letter-spacing: -0.02em; }
.go-stats span { font-size: 11px; color: var(--muted); }
.game-over .rec .bad { color: var(--bad); }
@media (prefers-reduced-motion: reduce) {
  .game-panel.open, .ap-card, .game-lives.hit, .game-wall.open .gw-menu { animation: none; }
}
.game-over {
  z-index: 4;
  position: absolute; left: 16px; right: 16px; top: 50%; transform: translateY(-50%);
  max-width: 380px; margin: 0 auto;
  background: var(--surface); border-radius: 24px; padding: 24px 20px; text-align: center;
  box-shadow: var(--shadow); display: none;
}
.game-over.open { display: block; }
.game-over .big { font: 800 56px/1 var(--display); letter-spacing: -0.04em; margin: 8px 0 6px; }
.game-over .rec { color: var(--stamp); font-weight: 700; min-height: 22px; }
.game-over .btn-row { margin-top: 16px; }

/* ---------- Онбординг ---------- */
body.onboarding .tabbar { display: none; }
body.onboarding .screen { padding-bottom: 0; }
.welcome h1 { font-size: 26px; }
.welcome .lead { color: var(--muted); margin: 8px 0 18px; }
.ob-top { display: flex; align-items: center; justify-content: space-between; min-height: 44px; margin: -4px 0 10px; }
.ob-card .card-head { align-items: flex-start; }
.ob-tasks { font-size: 13px; color: var(--muted); margin-top: -4px; }
.ob-add {
  flex: none; width: 44px; height: 44px; border-radius: 14px;
  display: grid; place-items: center; font-size: 24px; font-weight: 500; line-height: 1;
  background: var(--accent); color: var(--accent-ink);
  transition: background 160ms, color 160ms, transform 160ms;
}
.ob-add:active { transform: scale(0.9); }
.ob-add svg { width: 18px; height: 18px; stroke: currentColor; stroke-width: 3; fill: none; }
.ob-add.on { background: var(--accent-soft); color: var(--accent-fg); }
.ob-footer {
  position: sticky; bottom: 0; z-index: 2; margin: 0 -16px;
  padding: 18px 16px calc(14px + var(--safe-b));
  background: linear-gradient(to bottom, transparent, var(--bg) 40%);
}
.ob-bell {
  width: 64px; height: 64px; border-radius: 20px; margin: 10px 0 18px;
  display: grid; place-items: center; background: var(--stamp-soft); color: var(--stamp-ink);
}
:root[data-theme="dark"] .ob-bell { color: var(--stamp); }
.ob-bell svg { width: 32px; height: 32px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linejoin: round; stroke-linecap: round; }
.bot-demo {
  max-width: 340px; padding: 12px 14px; font-size: 14px;
  background: var(--surface); border-radius: 18px 18px 18px 6px; box-shadow: var(--shadow);
}
.bot-demo .kb { display: flex; gap: 4px; margin-top: 10px; }
.bot-demo .kb span {
  flex: 1; min-width: 0; padding: 8px 4px; border-radius: 8px; text-align: center;
  font-size: 12px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  background: var(--surface-2);
}
.ob-note { margin: 16px 4px 0; }
.ob-note + .ob-note { margin-top: 8px; font-size: 13px; }
.welcome .ob-footer { margin-top: 18px; }

.loading { padding: 40px 0; text-align: center; color: var(--muted); }
.spacer { height: 12px; }
.hidden { display: none !important; }

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

/* ---------- Кошелёк ---------- */
.wallet-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.wallet-card { background: var(--surface); border-radius: 18px; padding: 14px 16px; display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.wallet-card span { font-size: 13px; color: var(--muted); }
.wallet-card b { font: 700 24px/1.15 var(--display); overflow: hidden; text-overflow: ellipsis; }
.wallet-card.ton b { color: var(--accent-fg); }
.wallet-card small { font-size: 12px; color: var(--muted); }
.wallet-note { margin: 10px 4px 12px; }
.op .avatar { font-size: 18px; }
.op-amt { font-weight: 700; font-variant-numeric: tabular-nums; }
.op-amt.plus { color: var(--good); }
.op-amt.minus { color: var(--ink); }

/* ---------- Задания на подписки ---------- */
.quest-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 4px 4px 12px; }
.quest-head p { margin: 0; }
.quest-head .btn { flex: none; }
.quest-gate { margin: 0 0 12px; }
.quest { background: var(--surface); border-radius: 18px; padding: 14px 16px; margin-bottom: 10px; }
.quest-top { display: flex; align-items: center; gap: 8px; margin-bottom: 4px; min-width: 0; }
.quest-top .badge { margin-left: 0; flex: none; }
.quest-title { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.quest-count { flex: none; font: 700 15px/1 var(--display); color: var(--accent-fg); font-variant-numeric: tabular-nums; }
.quest-btns { display: flex; gap: 8px; margin-top: 12px; }
.quest-btns .btn { flex: 1 1 0; min-width: 0; padding-left: 8px; padding-right: 8px; }
#questHowTo { margin-bottom: 14px; }
.quest-btns .btn[disabled] { opacity: .45; pointer-events: none; }

/* Админ: «Статистика» — плитки, столбики новых по дням, таблицы, генератор ссылок с меткой */
.stats-grid { margin-top: 12px; }
.stats-grid .wallet-card b { font-size: 22px; }
.bars { display: flex; align-items: flex-end; gap: 3px; height: 132px; padding: 22px 10px 10px; }
.bar { flex: 1 1 0; min-width: 0; height: 100%; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; }
.bar i { display: block; width: 100%; max-width: 22px; background: var(--accent); border-radius: 4px 4px 1px 1px; }
.bar em { font: 600 10px/1 var(--body); font-style: normal; color: var(--muted); margin-bottom: 3px; font-variant-numeric: tabular-nums; }
.bars-axis { display: flex; justify-content: space-between; margin: 6px 6px 0; }
.table-wrap { overflow-x: auto; }
.stats-table { width: 100%; border-collapse: collapse; font-size: 13px; font-variant-numeric: tabular-nums; }
.stats-table th, .stats-table td { padding: 9px 10px; text-align: right; white-space: nowrap; }
.stats-table th:first-child, .stats-table td:first-child { text-align: left; }
.stats-table th { font-weight: 600; color: var(--muted); font-size: 12px; }
.stats-table tbody tr { border-top: 1px solid var(--line); }
.stats-table td.src { max-width: 150px; overflow: hidden; text-overflow: ellipsis; font-weight: 600; }
.src-gen { padding: 14px; }
.src-gen .chips { margin: -5px 0 10px; padding: 5px 0; }
/* Кошелёк TON Connect в листе пополнения: какой подключён и «Другой кошелёк» */
.tc-line { display: flex; align-items: center; justify-content: center; gap: 10px; min-height: 20px; margin: 8px 4px 0; }
.tc-line code { font: 600 12px/1 var(--body); }
.link-btn { background: none; border: 0; padding: 10px 4px; margin: -10px 0; color: var(--accent-fg); font: inherit; font-weight: 600; cursor: pointer; }
#tcBox { margin-top: 8px; }
#tcBox .group { margin: 0; }
