/* ════════════════════════════════════════════════════════════════════
   Asadram — новые экраны v41

   Вехи, «Вместе», витрина именных подарков, совместный холст,
   аудиокомната, расшифровка голосовых.
   ════════════════════════════════════════════════════════════════════ */

/* ════════════════════════════════════════════════════════════════════
   Карточка-веха в ленте

   Не всплывающее уведомление, а сообщение: остаётся в переписке
   навсегда, его можно пролистать назад через год.
   ════════════════════════════════════════════════════════════════════ */
.milestone {
  align-self: center;
  width: min(100%, 340px);
  margin: var(--sp-5) 0;
  padding: var(--sp-5) var(--sp-4) var(--sp-4);
  border-radius: var(--r-xl);
  background: var(--bg-raised);
  box-shadow: inset 0 0 0 1px var(--line);
  text-align: center;
  animation: milestone-in var(--dur-slow) var(--ease-spring);
}
@keyframes milestone-in {
  from { opacity: 0; transform: translateY(10px) scale(.97); }
  to   { opacity: 1; transform: none; }
}

.milestone .glyph {
  font-size: 32px;
  line-height: 1;
  margin-bottom: var(--sp-2);
}
.milestone .title {
  font-size: var(--text-lg);
  font-weight: var(--weight-bold);
  letter-spacing: -.02em;
}
.milestone .subtitle {
  font-size: var(--text-sm);
  color: var(--fg-muted);
  margin-top: 2px;
}

.milestone-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--sp-2);
  margin-top: var(--sp-4);
  padding-top: var(--sp-4);
  border-top: 1px solid var(--line);
}
.milestone-stats .cell .value {
  font-size: var(--text-md);
  font-weight: var(--weight-bold);
  font-variant-numeric: tabular-nums;
}
.milestone-stats .cell .caption {
  font-size: var(--text-xs);
  color: var(--fg-muted);
  margin-top: 1px;
}

.milestone .open-link {
  display: inline-block;
  margin-top: var(--sp-3);
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
  color: var(--accent);
}

/* ════════════════════════════════════════════════════════════════════
   Панель «Вместе»
   ════════════════════════════════════════════════════════════════════ */
.together-hero {
  padding: var(--sp-6) var(--sp-5) var(--sp-5);
  text-align: center;
}
.together-hero .pair {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0;
  margin-bottom: var(--sp-4);
}
.together-hero .pair .avatar {
  box-shadow: 0 0 0 3px var(--bg);
}
.together-hero .pair .avatar:last-child { margin-left: -14px; }

.together-hero .headline {
  font-size: var(--text-3xl);
  font-weight: var(--weight-bold);
  letter-spacing: -.035em;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}
.together-hero .caption {
  font-size: var(--text-sm);
  color: var(--fg-muted);
  margin-top: var(--sp-2);
}

.together-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--sp-2);
  padding: 0 var(--sp-4);
}
.together-card {
  padding: var(--sp-4);
  border-radius: var(--r-md);
  background: var(--bg-sunken);
}
.together-card .label {
  font-size: var(--text-xs);
  color: var(--fg-muted);
  margin-bottom: var(--sp-1);
}
.together-card .value {
  font-size: var(--text-xl);
  font-weight: var(--weight-bold);
  letter-spacing: -.02em;
  font-variant-numeric: tabular-nums;
}
.together-card .hint {
  font-size: var(--text-xs);
  color: var(--fg-faint);
  margin-top: 2px;
}
.together-card.is-wide { grid-column: 1 / -1; }

/* Полоска «кто сколько написал» */
.balance-bar {
  display: flex;
  height: 8px;
  border-radius: var(--r-full);
  overflow: hidden;
  margin-top: var(--sp-3);
  background: var(--bg-input);
}
.balance-bar .mine { background: var(--accent); }
.balance-bar .theirs { background: var(--accent-soft); }
[data-theme="dark"] .balance-bar .theirs { background: var(--line-strong); }

.balance-legend {
  display: flex;
  justify-content: space-between;
  margin-top: var(--sp-2);
  font-size: var(--text-xs);
  color: var(--fg-muted);
}

/* Топ эмодзи и слов */
.token-row {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-2);
  margin-top: var(--sp-3);
}
.token {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-1);
  padding: var(--sp-1) var(--sp-3);
  border-radius: var(--r-full);
  background: var(--bg);
  box-shadow: inset 0 0 0 1px var(--line);
  font-size: var(--text-sm);
}
.token b {
  font-size: var(--text-xs);
  color: var(--fg-muted);
  font-weight: var(--weight-medium);
}
.token .big { font-size: 18px; }

/* Столбики по месяцам в итогах года */
.year-chart {
  display: flex;
  align-items: flex-end;
  gap: 3px;
  height: 96px;
  margin-top: var(--sp-4);
}
.year-chart .bar {
  flex: 1;
  min-height: 3px;
  border-radius: 3px 3px 0 0;
  background: var(--accent);
  opacity: .28;
  transition: opacity var(--dur) var(--ease-out);
}
.year-chart .bar.is-peak { opacity: 1; }

.year-months {
  display: flex;
  gap: 3px;
  margin-top: var(--sp-1);
}
.year-months span {
  flex: 1;
  text-align: center;
  font-size: 9px;
  color: var(--fg-faint);
}

/* ════════════════════════════════════════════════════════════════════
   Именные подарки
   ════════════════════════════════════════════════════════════════════ */
.serial-tag {
  display: inline-block;
  padding: 1px 7px;
  border-radius: var(--r-full);
  background: var(--bg-input);
  font-size: 10px;
  font-weight: var(--weight-bold);
  color: var(--fg-muted);
  font-variant-numeric: tabular-nums;
  letter-spacing: .01em;
}
.serial-tag.is-low {
  background: color-mix(in srgb, var(--gold-500) 16%, transparent);
  color: #A87209;
}
[data-theme="dark"] .serial-tag.is-low { color: var(--gold-500); }

/* Уровень прокачки: точки над подарком */
.tier-dots {
  position: absolute;
  top: 6px;
  left: 6px;
  display: flex;
  gap: 2px;
}
.tier-dots i {
  width: 4px;
  height: 4px;
  border-radius: var(--r-full);
  background: var(--rarity-legendary);
}

.gift-tile { position: relative; }
.gift-tile .serial-tag { margin-top: 2px; }

/* Витрина на профиле — шесть мест, пустые видно */
.showcase {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: var(--sp-2);
  padding: 0 var(--sp-4);
  margin-top: var(--sp-4);
}
@media (max-width: 420px) {
  .showcase { grid-template-columns: repeat(3, 1fr); }
}
.showcase-slot {
  aspect-ratio: 1;
  border-radius: var(--r-md);
  display: grid;
  place-items: center;
  background: var(--bg-sunken);
  position: relative;
  cursor: pointer;
  transition: transform var(--dur-fast) var(--ease-spring);
}
.showcase-slot:active { transform: scale(.94); }
.showcase-slot.is-empty {
  background: transparent;
  box-shadow: inset 0 0 0 1px var(--line);
  color: var(--fg-faint);
}
.showcase-slot img { width: 74%; height: 74%; object-fit: contain; }
.showcase-slot .emoji { font-size: 24px; }

/* Слияние трёх в один */
.merge-strip {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--sp-3);
  padding: var(--sp-5) 0 var(--sp-4);
}
.merge-strip .slot {
  width: 62px;
  height: 62px;
  border-radius: var(--r-md);
  background: var(--bg-sunken);
  display: grid;
  place-items: center;
}
.merge-strip .slot img { width: 68%; height: 68%; object-fit: contain; }
.merge-strip .slot.is-result {
  width: 84px;
  height: 84px;
  box-shadow: inset 0 0 0 2px var(--rarity-legendary);
}
.merge-strip .arrow { color: var(--fg-faint); }

.merge-note {
  text-align: center;
  font-size: var(--text-sm);
  color: var(--fg-muted);
  padding: 0 var(--sp-4) var(--sp-4);
}

/* Вспышка после успешного слияния */
@keyframes merge-flash {
  0%   { transform: scale(1); }
  40%  { transform: scale(1.22); }
  100% { transform: scale(1); }
}
.merge-done { animation: merge-flash 620ms var(--ease-spring); }

/* ════════════════════════════════════════════════════════════════════
   Совместный холст
   ════════════════════════════════════════════════════════════════════ */
.canvas-layer {
  position: fixed;
  inset: 0;
  z-index: var(--z-call);
  display: flex;
  flex-direction: column;
  background: var(--bg);
  opacity: 0;
  visibility: hidden;
  transition: opacity var(--dur) var(--ease-out), visibility 0s linear var(--dur);
}
.canvas-layer.is-open { opacity: 1; visibility: visible; transition-delay: 0s; }

.canvas-head {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  height: calc(var(--head-height) + var(--safe-top));
  padding: var(--safe-top) var(--sp-3) 0;
  flex: none;
  border-bottom: 1px solid var(--line);
}
.canvas-head .title {
  flex: 1;
  font-size: var(--text-md);
  font-weight: var(--weight-medium);
}
.canvas-head .who {
  font-size: var(--text-xs);
  color: var(--fg-muted);
}

.canvas-stage {
  flex: 1;
  min-height: 0;
  position: relative;
  background: var(--bg-sunken);
  touch-action: none;
}
.canvas-stage canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  cursor: crosshair;
}

/* Курсор собеседника — видно, где он рисует прямо сейчас */
.peer-cursor {
  position: absolute;
  width: 12px;
  height: 12px;
  margin: -6px 0 0 -6px;
  border-radius: var(--r-full);
  pointer-events: none;
  box-shadow: 0 0 0 2px var(--bg);
  transition: transform 90ms linear;
}
.peer-cursor::after {
  content: attr(data-name);
  position: absolute;
  left: 14px;
  top: -2px;
  padding: 1px 6px;
  border-radius: var(--r-full);
  background: var(--bg-raised);
  box-shadow: var(--shadow-sm);
  font-size: 10px;
  font-weight: var(--weight-medium);
  color: var(--fg-soft);
  white-space: nowrap;
}

.canvas-tools {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding: var(--sp-3) var(--sp-4) calc(var(--sp-3) + var(--safe-bottom));
  flex: none;
  border-top: 1px solid var(--line);
  overflow-x: auto;
  scrollbar-width: none;
}
.canvas-tools::-webkit-scrollbar { display: none; }

.ink-dot {
  width: 28px;
  height: 28px;
  flex: none;
  border-radius: var(--r-full);
  cursor: pointer;
  transition: transform var(--dur-fast) var(--ease-spring);
}
.ink-dot.is-active { box-shadow: 0 0 0 2px var(--bg), 0 0 0 4px currentColor; }
.ink-dot:active { transform: scale(.88); }

.size-dot {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  flex: none;
  border-radius: var(--r-full);
  cursor: pointer;
}
.size-dot i {
  display: block;
  border-radius: var(--r-full);
  background: var(--fg-soft);
}
.size-dot.is-active { background: var(--bg-active); }

/* ════════════════════════════════════════════════════════════════════
   Аудиокомната
   ════════════════════════════════════════════════════════════════════ */
.room-bar {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding: var(--sp-2) var(--sp-3);
  flex: none;
  background: var(--accent-soft);
  border-bottom: 1px solid var(--line);
  cursor: pointer;
}
.room-bar .pulse {
  width: 8px;
  height: 8px;
  border-radius: var(--r-full);
  background: var(--mint-500);
  animation: room-pulse 1.6s var(--ease-in-out) infinite;
}
@keyframes room-pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50%      { opacity: .4; transform: scale(.7); }
}
.room-bar .label {
  flex: 1;
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
  color: var(--accent);
}

.room-faces { display: flex; }
.room-faces .avatar { box-shadow: 0 0 0 2px var(--bg); }
.room-faces .avatar + .avatar { margin-left: -10px; }

.room-panel { padding: var(--sp-5) var(--sp-4) var(--sp-4); }
.room-people {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(84px, 1fr));
  gap: var(--sp-4);
  margin-bottom: var(--sp-5);
}
.room-person { text-align: center; }
.room-person .avatar { margin: 0 auto var(--sp-2); transition: box-shadow 120ms linear; }
.room-person.is-speaking .avatar { box-shadow: 0 0 0 3px var(--mint-500); }
.room-person .name {
  font-size: var(--text-xs);
  color: var(--fg-soft);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.room-person .muted-mark { color: var(--fg-faint); }

.room-actions { display: flex; gap: var(--sp-2); }
.room-actions .btn { flex: 1; }

/* ════════════════════════════════════════════════════════════════════
   Расшифровка голосового
   ════════════════════════════════════════════════════════════════════ */
.transcript-toggle {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-top: var(--sp-2);
  font-size: var(--text-xs);
  font-weight: var(--weight-medium);
  opacity: .8;
  cursor: pointer;
}
.transcript-toggle:hover { opacity: 1; }

.transcript-text {
  margin-top: var(--sp-2);
  padding-top: var(--sp-2);
  border-top: 1px solid color-mix(in srgb, currentColor 16%, transparent);
  font-size: var(--text-sm);
  line-height: var(--leading-normal);
  opacity: .92;
}

.rec-transcript {
  flex: 1;
  min-width: 0;
  font-size: var(--text-sm);
  color: var(--fg-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ════════════════════════════════════════════════════════════════════
   Настроение чата

   Фон реагирует на переписку: активная — теплее и заметнее,
   затихшая — почти прозрачная. Меняется одна переменная.
   ════════════════════════════════════════════════════════════════════ */
.chat-canvas[data-mood="hot"]    { --pattern-ink: color-mix(in srgb, var(--ember-500) 11%, transparent); }
.chat-canvas[data-mood="warm"]   { --pattern-ink: color-mix(in srgb, var(--accent) 9%, transparent); }
.chat-canvas[data-mood="calm"]   { --pattern-ink: color-mix(in srgb, var(--accent) 5%, transparent); }
.chat-canvas[data-mood="quiet"]  { --pattern-ink: color-mix(in srgb, var(--fg) 4%, transparent); }
.chat-canvas[data-mood="frozen"] { --pattern-ink: color-mix(in srgb, var(--fg) 2.5%, transparent); }

.chat-canvas .wallpaper { transition: color var(--dur-slow) var(--ease-out); }

/* Скорость дрейфа тоже зависит от настроения */
.chat-canvas[data-mood="hot"]    .wallpaper .layer-1 { animation-duration: 34s; }
.chat-canvas[data-mood="warm"]   .wallpaper .layer-1 { animation-duration: 48s; }
.chat-canvas[data-mood="quiet"]  .wallpaper .layer-1 { animation-duration: 96s; }
.chat-canvas[data-mood="frozen"] .wallpaper .layer-1 { animation-duration: 140s; }

.mood-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: var(--text-xs);
  color: var(--fg-muted);
}

/* ════════════════════════════════════════════════════════════════════
   Заставка входа
   ════════════════════════════════════════════════════════════════════ */
.boot {
  position: fixed;
  inset: 0;
  z-index: 900;
  display: grid;
  place-items: center;
  padding: var(--sp-6);
  background: var(--bg);
  transition: opacity var(--dur-slow) var(--ease-out);
}
.boot.is-gone { opacity: 0; pointer-events: none; }

.boot-inner {
  width: min(360px, 100%);
  text-align: center;
}

/* Пока идут проверки — видно полосу; после — логотип и кнопку */
.boot-check { transition: opacity var(--dur) var(--ease-out); }
.boot.is-checked .boot-check { opacity: 0; height: 0; overflow: hidden; }

.boot-mark {
  width: 84px;
  height: 84px;
  margin: 0 auto var(--sp-4);
  display: grid;
  place-items: center;
  border-radius: 28px;
  background: var(--accent);
  color: #fff;
  font-size: 2.4rem;
  font-weight: var(--weight-bold);
  opacity: 0;
  transform: scale(.86);
  transition: opacity var(--dur-slow) var(--ease-out),
              transform var(--dur-slow) var(--ease-spring);
}
.boot-hello {
  opacity: 0;
  transform: translateY(8px);
  transition: opacity var(--dur-slow) var(--ease-out) 60ms,
              transform var(--dur-slow) var(--ease-out) 60ms;
}
.boot.is-ready .boot-mark { opacity: 1; transform: none; }
.boot.is-ready .boot-hello { opacity: 1; transform: none; }

.boot-title {
  font-size: var(--text-2xl);
  font-weight: var(--weight-bold);
  letter-spacing: -.03em;
}
.boot-sub {
  color: var(--fg-muted);
  font-size: var(--text-sm);
  margin: var(--sp-2) 0 var(--sp-6);
}

.boot-track {
  height: 4px;
  border-radius: var(--r-full);
  background: var(--bg-input);
  overflow: hidden;
  margin-bottom: var(--sp-3);
}
.boot-fill {
  height: 100%;
  width: 0;
  border-radius: var(--r-full);
  background: var(--accent);
}
.boot-row {
  display: flex;
  justify-content: space-between;
  font-size: var(--text-xs);
  color: var(--fg-muted);
}
.boot-row .tnum { font-variant-numeric: tabular-nums; }

/* Всплывающий факт */
.boot-fact {
  position: fixed;
  left: 50%;
  bottom: calc(var(--safe-bottom) + var(--sp-5));
  z-index: 910;
  width: min(400px, calc(100vw - var(--sp-8)));
  padding: var(--sp-4);
  border-radius: var(--r-lg);
  background: var(--bg-raised);
  box-shadow: var(--shadow-pop);
  transform: translate(-50%, 20px);
  opacity: 0;
  visibility: hidden;
  transition: opacity var(--dur-slow) var(--ease-out),
              transform var(--dur-slow) var(--ease-spring),
              visibility 0s linear var(--dur-slow);
  text-align: left;
}
.boot-fact.is-open {
  opacity: 1;
  visibility: visible;
  transform: translate(-50%, 0);
  transition-delay: 0s;
}
.boot-fact .fact-head {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  font-size: var(--text-xs);
  font-weight: var(--weight-bold);
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: .06em;
  margin-bottom: var(--sp-2);
}
.boot-fact .fact-text {
  font-size: var(--text-sm);
  line-height: var(--leading-loose);
  color: var(--fg-soft);
}
.boot-fact .fact-close {
  margin-left: auto;
  color: var(--fg-faint);
  cursor: pointer;
}

/* ── Версия в правом верхнем углу ────────────────────────────────── */
.version-tag {
  position: fixed;
  top: calc(var(--safe-top) + var(--sp-3));
  right: var(--sp-4);
  z-index: 950;
  padding: 3px var(--sp-3);
  border-radius: var(--r-full);
  background: var(--bg-input);
  color: var(--fg-muted);
  font-size: 11px;
  font-weight: var(--weight-medium);
  font-variant-numeric: tabular-nums;
  pointer-events: none;
  user-select: none;
}

/* ── Мелкие пояснения под полями входа ───────────────────────────── */

/* Настроение у ника — крошечное, как знак ®, чтобы не спорило с именем */
.mood-tag {
  flex: none;
  font-size: 10px;
  line-height: 1;
  vertical-align: super;
  opacity: .75;
}

/* ════════════════════════════════════════════════════════════════════
   Статус действия под ником
   ════════════════════════════════════════════════════════════════════ */
.act-line { display: inline-flex; align-items: center; gap: 6px; }

/* Столбики — запись голосового */
.act-wave { display: inline-flex; align-items: center; gap: 2px; height: 12px; }
.act-wave i {
  width: 2px;
  border-radius: 2px;
  background: currentColor;
  animation: act-bar 900ms var(--ease-in-out) infinite;
}
.act-wave i:nth-child(1) { height: 5px;  animation-delay: 0ms; }
.act-wave i:nth-child(2) { height: 11px; animation-delay: 120ms; }
.act-wave i:nth-child(3) { height: 8px;  animation-delay: 240ms; }
.act-wave i:nth-child(4) { height: 12px; animation-delay: 360ms; }
@keyframes act-bar {
  0%, 100% { transform: scaleY(.45); opacity: .6; }
  50%      { transform: scaleY(1); opacity: 1; }
}

/* Кружок — запись видео */
.act-rec {
  width: 8px;
  height: 8px;
  border-radius: var(--r-full);
  background: currentColor;
  animation: act-blink 1.1s var(--ease-in-out) infinite;
}
@keyframes act-blink {
  0%, 100% { opacity: 1; transform: scale(1); }
  50%      { opacity: .35; transform: scale(.75); }
}

/* ════════════════════════════════════════════════════════════════════
   Свайпы

   Вправо — ответить на чужое, влево — на своё. Значок проявляется
   по мере оттягивания, чтобы жест был понятен с первого раза.
   ════════════════════════════════════════════════════════════════════ */
.msg { position: relative; touch-action: pan-y; }
.msg .swipe-mark {
  position: absolute;
  top: 50%;
  width: 30px;
  height: 30px;
  margin-top: -15px;
  display: grid;
  place-items: center;
  border-radius: var(--r-full);
  background: var(--bg-input);
  color: var(--accent);
  opacity: 0;
  pointer-events: none;
}
.msg:not(.is-mine) .swipe-mark { left: -38px; }
.msg.is-mine .swipe-mark { right: -38px; }
.msg .bubble { transition: transform var(--dur-fast) var(--ease-out); }
.msg.is-swiping .bubble { transition: none; }

/* Выход из чата свайпом от края */
.main.is-dragging { transition: none; }

/* ════════════════════════════════════════════════════════════════════
   Закреплённые: столбик сегментов, как в привычных мессенджерах
   ════════════════════════════════════════════════════════════════════ */
.pin-rail {
  display: flex;
  flex-direction: column;
  gap: 2px;
  width: 3px;
  align-self: stretch;
  flex: none;
  padding: 3px 0;
}
.pin-rail i {
  flex: 1;
  min-height: 3px;
  border-radius: 3px;
  background: var(--accent);
  opacity: .28;
  transition: opacity var(--dur-fast) var(--ease-out);
}
.pin-rail i.is-active { opacity: 1; }

.pinned-bar .cap { display: flex; align-items: center; gap: 6px; }
.pinned-bar .cap .count {
  font-size: 10px;
  font-weight: var(--weight-medium);
  color: var(--fg-faint);
  font-variant-numeric: tabular-nums;
}
.pinned-bar .body { overflow: hidden; }
.pinned-bar .txt { transition: opacity var(--dur-fast) var(--ease-out); }
.pinned-bar.is-turning .txt { opacity: 0; }

/* ════════════════════════════════════════════════════════════════════
   Ползунок навигации

   Капсула едет между тремя кнопками и не выходит за их границы,
   а панели уезжают с той же скоростью — получается один жест.
   ════════════════════════════════════════════════════════════════════ */
.bottom-nav { position: relative; }
.nav-pill {
  position: absolute;
  top: 6px;
  bottom: calc(6px + var(--safe-bottom));
  left: 0;
  width: 33.3333%;
  border-radius: var(--r-lg);
  background: color-mix(in srgb, var(--accent) 14%, transparent);
  transition: transform var(--dur-slow) var(--ease-spring);
  pointer-events: none;
  z-index: 0;
}
.nav-item { position: relative; z-index: 1; }

/* Панели едут лентой, а не проявляются */
.panes.is-sliding .pane {
  transition: transform var(--dur-slow) var(--ease-spring),
              opacity var(--dur) var(--ease-out);
}
.pane[data-slot="0"] { --slot: 0; }
.pane[data-slot="1"] { --slot: 1; }
.pane[data-slot="2"] { --slot: 2; }

/* ── Цвет профиля ────────────────────────────────────────────────── */
.color-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: var(--sp-3);
  padding: var(--sp-4);
  background: var(--bg-sunken);
  border-radius: var(--r-md);
}
.color-dot {
  aspect-ratio: 1;
  border-radius: var(--r-full);
  cursor: pointer;
  position: relative;
  box-shadow: inset 0 0 0 1px var(--line-strong);
  transition: transform var(--dur-fast) var(--ease-spring);
}
.color-dot:active { transform: scale(.88); }
/* Выбранный обводится синим кольцом */
.color-dot.is-active {
  box-shadow: 0 0 0 2px var(--bg), 0 0 0 4px var(--royal-500);
}

/* ── Мой QR ──────────────────────────────────────────────────────── */
.qr-box {
  display: grid;
  place-items: center;
  padding: var(--sp-5);
  border-radius: var(--r-lg);
  background: #fff;
  margin: 0 auto var(--sp-4);
  width: fit-content;
}
.qr-box canvas, .qr-box svg { display: block; }
.qr-name {
  text-align: center;
  font-weight: var(--weight-bold);
  color: var(--accent);
  margin-bottom: var(--sp-4);
}

/* ── Стикеры ─────────────────────────────────────────────────────── */
.sticker-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(84px, 1fr));
  gap: var(--sp-2);
}
.sticker-cell {
  aspect-ratio: 1;
  border-radius: var(--r-md);
  background: var(--bg-sunken);
  display: grid;
  place-items: center;
  position: relative;
  cursor: pointer;
}
.sticker-cell img { width: 78%; height: 78%; object-fit: contain; }
.sticker-cell .kill {
  position: absolute;
  top: 4px; right: 4px;
  width: 20px; height: 20px;
  display: grid; place-items: center;
  border-radius: var(--r-full);
  background: var(--bg-raised);
  box-shadow: var(--shadow-sm);
  color: var(--rose-500);
}
.sticker-add {
  aspect-ratio: 1;
  border-radius: var(--r-md);
  box-shadow: inset 0 0 0 1px var(--line-strong);
  display: grid;
  place-items: center;
  color: var(--accent);
  cursor: pointer;
}

/* ── Стикеры ─────────────────────────────────────────────────────── */
.sticker-strip {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--sp-1);
  margin-bottom: var(--sp-2);
}
.sticker-pick {
  aspect-ratio: 1;
  border-radius: var(--r-sm);
  display: grid;
  place-items: center;
  transition: background var(--dur-fast) var(--ease-out),
              transform var(--dur-fast) var(--ease-spring);
}
.sticker-pick:hover { background: var(--bg-hover); transform: scale(1.06); }
.sticker-pick img { width: 84%; height: 84%; object-fit: contain; }
.sticker-empty {
  grid-column: 1 / -1;
  padding: var(--sp-3);
  font-size: var(--text-xs);
  color: var(--fg-faint);
  text-align: center;
}

/* Стикер в переписке — без пузыря, крупный, как в родных мессенджерах */
.bubble.is-sticker {
  background: transparent !important;
  box-shadow: none;
  padding: 0;
}
.sticker-art {
  width: 148px;
  height: 148px;
  object-fit: contain;
}
.bubble.is-sticker .bubble-meta {
  color: var(--fg-muted) !important;
  float: none;
  display: flex;
  justify-content: flex-end;
  margin: 2px 0 0;
}

/* ── Ровные отступы: строки центрируются по вертикали ────────────── */
.setting-row, .info-line, .list-row, .menu-item {
  align-items: center;
}
.setting-row .body, .info-line .body { display: flex; flex-direction: column; justify-content: center; }

/* Реакции в контекстном меню — одной строкой, без переносов */
.menu .react-row {
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  gap: 2px;
  padding: var(--sp-1) var(--sp-1) var(--sp-2);
}
.menu .react-row button {
  aspect-ratio: 1;
  font-size: 20px;
  border-radius: var(--r-xs);
  display: grid;
  place-items: center;
  transition: background var(--dur-fast) var(--ease-out),
              transform var(--dur-fast) var(--ease-spring);
}
.menu .react-row button:hover { background: var(--bg-hover); transform: scale(1.15); }

/* Точка текущего цвета профиля в строке настроек */
.color-chip {
  width: 20px;
  height: 20px;
  border-radius: var(--r-full);
  flex: none;
  box-shadow: inset 0 0 0 1px var(--line-strong);
}

/* ── Подарок в ленте: собственная рамка, без пузыря вокруг ───────── */
.bubble.is-gift {
  background: transparent !important;
  box-shadow: none;
  padding: 0;
  overflow: visible;
}
.bubble.is-gift .gift-card {
  border-radius: var(--r-lg);
  background: var(--bg-raised);
  box-shadow: inset 0 0 0 1px var(--line), var(--shadow-md);
  padding: var(--sp-5) var(--sp-5) var(--sp-4);
}
.bubble.is-gift .bubble-meta {
  float: none;
  display: flex;
  justify-content: flex-end;
  margin: var(--sp-1) var(--sp-2) 0 0;
  color: var(--fg-muted) !important;
}
.bubble.is-gift .reactions { padding: 0 var(--sp-2); }

/* Свечение по редкости — тонкой обводкой, а не заливкой */
.bubble.is-gift .gift-card[data-rarity="rare"] { box-shadow: inset 0 0 0 1.5px var(--rarity-rare), var(--shadow-md); }
.bubble.is-gift .gift-card[data-rarity="epic"] { box-shadow: inset 0 0 0 1.5px var(--rarity-epic), var(--shadow-md); }
.bubble.is-gift .gift-card[data-rarity="legendary"] { box-shadow: inset 0 0 0 2px var(--rarity-legendary), var(--shadow-md); }

/* ── Эмодзи одним набором по всему приложению ────────────────────── */
.emoji-grid button,
.react-row button,
.reaction,
.mood-tag,
.gift-card .art-emoji,
.gift-tile .emoji,
.gift-detail .hero-emoji,
.milestone .glyph,
.token .big,
.msg.is-emoji-only .bubble {
  font-family: var(--font-emoji);
  font-variant-emoji: emoji;
}

/* ════════════════════════════════════════════════════════════════════
   Шапка чата на узком экране

   Кнопок стало больше, чем помещается: имя сжималось в несколько
   символов. На телефоне оставляем звонок и меню, остальное уезжает
   в меню — имя важнее иконок.
   ════════════════════════════════════════════════════════════════════ */
.chat-head-info { min-width: 0; }
.chat-head-text { flex: 1; min-width: 0; }
.chat-head-name {
  min-width: 0;
  gap: var(--sp-1);
}
.chat-head-name > span:first-child {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
}

@media (max-width: 560px) {
  /* Видео и поиск прячем в меню — там они никуда не денутся */
  .chat-head .icon-btn[data-secondary] { display: none; }
  .chat-head { padding-inline: var(--sp-1); }
  .chat-head .icon-btn { width: 36px; height: 36px; }
  .chat-head-info { padding-inline: var(--sp-1); }
}

/* Метка версии не должна лезть на шапку чата */
.version-tag {
  top: calc(var(--safe-top) + 2px);
  right: var(--sp-2);
  opacity: .55;
}
@media (max-width: 900px) {
  /* На телефоне внутри приложения версия только мешает —
     она нужна на входе, а не поверх переписки */
  .app .version-tag,
  body:has(.app) .version-tag { display: none; }
}

/* ════════════════════════════════════════════════════════════════════
   Экран звонка
   ════════════════════════════════════════════════════════════════════ */
.call-layer {
  position: fixed;
  inset: 0;
  z-index: var(--z-call);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--sp-6);
  padding: calc(var(--safe-top) + var(--sp-6)) var(--sp-5)
           calc(var(--safe-bottom) + var(--sp-8));
  background: var(--bg);
  opacity: 0;
  transition: opacity var(--dur) var(--ease-out);
}
.call-layer.is-open { opacity: 1; }

.call-remote {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  background: var(--bg-sunken);
}

.call-local {
  position: absolute;
  top: calc(var(--safe-top) + var(--sp-4));
  right: var(--sp-4);
  width: 108px;
  aspect-ratio: 3 / 4;
  object-fit: cover;
  border-radius: var(--r-md);
  background: var(--bg-sunken);
  box-shadow: var(--shadow-lg);
  z-index: 2;
  transform: scaleX(-1);   /* зеркалим себя — так привычнее */
}

.call-who {
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--sp-3);
  text-align: center;
}
.call-who.is-corner {
  position: absolute;
  top: calc(var(--safe-top) + var(--sp-4));
  left: var(--sp-4);
  align-items: flex-start;
  text-align: left;
  padding: var(--sp-2) var(--sp-4);
  border-radius: var(--r-full);
  background: rgba(0, 0, 0, .38);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  gap: 0;
}
.call-who.is-corner .call-name,
.call-who.is-corner .call-hint { color: #fff; }

.call-name {
  font-size: var(--text-xl);
  font-weight: var(--weight-bold);
  letter-spacing: -.02em;
}
.call-hint {
  font-size: var(--text-sm);
  color: var(--fg-muted);
  font-variant-numeric: tabular-nums;
}

.call-actions {
  position: relative;
  z-index: 2;
  display: flex;
  gap: var(--sp-4);
  margin-top: auto;
}

.call-btn {
  width: 62px;
  height: 62px;
  display: grid;
  place-items: center;
  border-radius: var(--r-full);
  color: #fff;
  transition: transform var(--dur-fast) var(--ease-spring),
              background var(--dur-fast) var(--ease-out);
}
.call-btn:active { transform: scale(.9); }
.call-btn.is-plain {
  background: var(--bg-input);
  color: var(--fg);
}
.call-btn.is-plain.is-off {
  background: var(--fg);
  color: var(--bg);
}
.call-btn.is-accept { background: var(--mint-500); }
.call-btn.is-decline {
  background: var(--rose-500);
  transform: rotate(133deg);
}
.call-btn.is-decline:active { transform: rotate(133deg) scale(.9); }

/* Входящий — кнопка приёма мягко пульсирует */
.call-btn.is-accept { animation: call-pulse 1.7s var(--ease-in-out) infinite; }
@keyframes call-pulse {
  0%, 100% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--mint-500) 55%, transparent); }
  70%      { box-shadow: 0 0 0 16px transparent; }
}

/* ── Видеосообщение: кружок, как в привычных мессенджерах ────────── */
.round-video {
  width: 200px;
  height: 200px;
  border-radius: var(--r-full);
  object-fit: cover;
  background: var(--bg-sunken);
  cursor: pointer;
}
.bubble.is-round {
  background: transparent !important;
  box-shadow: none;
  padding: 0;
}
.bubble.is-round .bubble-meta {
  float: none;
  display: flex;
  justify-content: flex-end;
  margin: var(--sp-1) var(--sp-2) 0 0;
  color: var(--fg-muted) !important;
}

.round-rec {
  position: fixed;
  inset: 0;
  z-index: var(--z-call);
  display: grid;
  place-items: center;
  background: var(--bg-overlay);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}
.round-rec video {
  width: min(74vw, 300px);
  aspect-ratio: 1;
  border-radius: var(--r-full);
  object-fit: cover;
  transform: scaleX(-1);
  box-shadow: 0 0 0 4px var(--accent), var(--shadow-pop);
}
.round-rec .timer {
  margin-top: var(--sp-4);
  color: #fff;
  font-variant-numeric: tabular-nums;
  font-weight: var(--weight-medium);
}
.round-rec .actions { display: flex; gap: var(--sp-4); margin-top: var(--sp-5); }

/* ════════════════════════════════════════════════════════════════════
   Панель эмодзи и стикеров
   ════════════════════════════════════════════════════════════════════ */
.emoji-panel {
  display: flex;
  flex-direction: column;
  width: min(380px, calc(100vw - var(--sp-5)));
  max-height: min(420px, 62dvh);
  padding: 0;
  overflow: hidden;
}

.emoji-tabs {
  display: flex;
  flex: none;
  border-bottom: 1px solid var(--line);
}
.emoji-tab {
  flex: 1;
  padding: var(--sp-3) 0;
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
  color: var(--fg-muted);
  position: relative;
  transition: color var(--dur-fast) var(--ease-out);
}
.emoji-tab.is-active { color: var(--accent); }
.emoji-tab.is-active::after {
  content: "";
  position: absolute;
  left: 22%; right: 22%; bottom: -1px;
  height: 2px;
  border-radius: 2px 2px 0 0;
  background: var(--accent);
}

.emoji-search {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  flex: none;
  margin: var(--sp-3) var(--sp-3) var(--sp-2);
  padding: 0 var(--sp-3);
  height: 36px;
  border-radius: var(--r-full);
  background: var(--bg-input);
  color: var(--fg-muted);
}
.emoji-search input {
  flex: 1;
  min-width: 0;
  font-size: var(--text-sm);
  background: none;
  color: var(--fg);
}
.emoji-search input::-webkit-search-cancel-button { display: none; }

.emoji-body {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 0 var(--sp-3) var(--sp-3);
}

.emoji-none, .sticker-empty {
  padding: var(--sp-6) var(--sp-3);
  text-align: center;
  font-size: var(--text-sm);
  color: var(--fg-faint);
}

/* Кнопка сохранения чужого стикера себе */
.sticker-pick { position: relative; }
.sticker-save {
  position: absolute;
  top: 2px; right: 2px;
  width: 20px; height: 20px;
  display: grid; place-items: center;
  border-radius: var(--r-full);
  background: var(--accent);
  color: #fff;
  font-size: 14px;
  font-weight: var(--weight-bold);
  line-height: 1;
  box-shadow: var(--shadow-sm);
}

/* ════════════════════════════════════════════════════════════════════
   Голосовая комната
   ════════════════════════════════════════════════════════════════════ */

/* Плашка видна на любом экране, пока идёт разговор */
.room-pill {
  position: fixed;
  left: 50%;
  top: calc(var(--safe-top) + var(--sp-3));
  z-index: var(--z-toast);
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  padding: var(--sp-2) var(--sp-2) var(--sp-2) var(--sp-4);
  border-radius: var(--r-full);
  background: var(--bg-raised);
  box-shadow: var(--shadow-lg), inset 0 0 0 1px var(--line);
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
  animation: msg-in var(--dur-slow) var(--ease-spring);
  max-width: calc(100vw - var(--sp-6));
}
.room-pill .pulse {
  width: 8px; height: 8px;
  border-radius: var(--r-full);
  background: var(--mint-500);
  flex: none;
  animation: room-pulse 1.6s var(--ease-in-out) infinite;
}
.room-pill .count {
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  border-radius: var(--r-full);
  background: var(--bg-input);
  color: var(--fg-muted);
  font-size: var(--text-xs);
  line-height: 20px;
  text-align: center;
}
.room-pill .pill-open {
  padding: 4px var(--sp-3);
  border-radius: var(--r-full);
  background: var(--accent-soft);
  color: var(--accent);
  font-size: var(--text-xs);
  font-weight: var(--weight-bold);
}
.room-pill .pill-leave {
  width: 28px; height: 28px;
  display: grid; place-items: center;
  border-radius: var(--r-full);
  background: var(--rose-500);
  color: #fff;
  flex: none;
}

/* Приглашение в комнату прямо в ленте */
.room-invite {
  align-self: center;
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  width: min(100%, 340px);
  margin: var(--sp-4) 0;
  padding: var(--sp-3) var(--sp-3) var(--sp-3) var(--sp-4);
  border-radius: var(--r-lg);
  background: var(--bg-raised);
  box-shadow: inset 0 0 0 1px var(--line);
  animation: msg-in var(--dur) var(--ease-out);
}
.room-invite .glyph { font-size: 24px; flex: none; }
.room-invite .body { flex: 1; min-width: 0; }
.room-invite .title { font-weight: var(--weight-bold); font-size: var(--text-sm); }
.room-invite .sub {
  font-size: var(--text-xs);
  color: var(--fg-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ════════════════════════════════════════════════════════════════════
   Потянуть вниз — обновить
   ════════════════════════════════════════════════════════════════════ */
.pull-mark {
  position: absolute;
  top: -34px;
  left: 50%;
  margin-left: -16px;
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  border-radius: var(--r-full);
  background: var(--bg-raised);
  box-shadow: var(--shadow-md);
  color: var(--fg-muted);
  opacity: 0;
  pointer-events: none;
  z-index: 3;
  transition: opacity var(--dur-fast) var(--ease-out),
              transform var(--dur) var(--ease-out),
              color var(--dur-fast) var(--ease-out);
}
.pull-mark.is-ready {
  color: var(--accent);
  transform: translateY(44px) rotate(180deg);
}
.pull-mark.is-spinning {
  opacity: 1;
  transform: translateY(44px);
  animation: spin .7s linear infinite;
}

/* Список чатов должен уметь показывать значок над собой */
#paneChats { position: absolute; }

/* ════════════════════════════════════════════════════════════════════
   Огоньки
   ════════════════════════════════════════════════════════════════════ */

/* Серый огонёк: сегодня ответил не каждый */
.streak-badge.is-cold {
  background: color-mix(in srgb, var(--fg) 8%, transparent);
  color: var(--fg-faint);
}
.streak-badge.is-cold .flame {
  animation: none;
  filter: grayscale(1);
  opacity: .7;
}

/* Карточка начала серии */
.streak-card {
  align-self: center;
  width: min(100%, 340px);
  margin: var(--sp-5) 0;
  padding: var(--sp-5) var(--sp-4) var(--sp-4);
  border-radius: var(--r-xl);
  background: var(--bg-raised);
  box-shadow: inset 0 0 0 1px var(--line);
  text-align: center;
  animation: milestone-in var(--dur-slow) var(--ease-spring);
}
.streak-card .flame {
  font-size: 34px;
  line-height: 1;
  animation: breathe 2.6s var(--ease-in-out) infinite;
}
.streak-card .title {
  margin-top: var(--sp-2);
  font-size: var(--text-lg);
  font-weight: var(--weight-bold);
  color: var(--ember-600);
}
[data-theme="dark"] .streak-card .title { color: var(--ember-400); }
.streak-card .rules {
  margin-top: var(--sp-3);
  padding-top: var(--sp-3);
  border-top: 1px solid var(--line);
  font-size: var(--text-xs);
  line-height: var(--leading-loose);
  color: var(--fg-muted);
  text-align: left;
}
.streak-card .rules p + p { margin-top: var(--sp-2); }

/* Предложение вернуть потухший огонёк */
.streak-restore {
  position: absolute;
  left: 50%;
  top: var(--sp-4);
  z-index: 5;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding: var(--sp-2) var(--sp-2) var(--sp-2) var(--sp-4);
  border-radius: var(--r-full);
  background: var(--bg-raised);
  box-shadow: var(--shadow-lg), inset 0 0 0 1px var(--line);
  max-width: calc(100% - var(--sp-6));
  animation: msg-in var(--dur-slow) var(--ease-spring);
}
.streak-restore > span { font-size: 20px; filter: grayscale(1); opacity: .6; }
.streak-restore .title { font-size: var(--text-sm); font-weight: var(--weight-bold); }
.streak-restore .sub { font-size: var(--text-xs); color: var(--fg-muted); }

/* ════════════════════════════════════════════════════════════════════
   Истории
   ════════════════════════════════════════════════════════════════════ */
.story-strip {
  display: flex;
  gap: var(--sp-3);
  padding: var(--sp-3) var(--sp-4);
  overflow-x: auto;
  scrollbar-width: none;
  border-bottom: 1px solid var(--line);
  flex: none;
}
.story-strip::-webkit-scrollbar { display: none; }

.story-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  width: 60px;
  flex: none;
  cursor: pointer;
}

/* Кольцо вокруг аватара: цветное — есть непросмотренные */
.story-ring {
  position: relative;
  padding: 2.5px;
  border-radius: var(--r-full);
  display: grid;
  place-items: center;
  transition: transform var(--dur-fast) var(--ease-spring);
}
.story-item:active .story-ring { transform: scale(.92); }
.story-ring .avatar { box-shadow: 0 0 0 2.5px var(--bg); }

/* Зелёное кольцо — есть непросмотренные истории.
   Серое — всё видел. Так понятнее с одного взгляда. */
.story-ring.is-fresh {
  background: var(--mint-500);
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--mint-500) 40%, transparent);
}
.story-ring.is-seen  { background: var(--line-strong); }
.story-ring.is-mine  { background: var(--accent); }
.story-ring.is-empty { background: transparent; }

.story-plus {
  position: absolute;
  right: -2px;
  bottom: -2px;
  width: 18px;
  height: 18px;
  display: grid;
  place-items: center;
  border-radius: var(--r-full);
  background: var(--accent);
  color: #fff;
  font-size: 13px;
  font-weight: var(--weight-bold);
  line-height: 1;
  box-shadow: 0 0 0 2px var(--bg);
}

.story-name {
  font-size: 10px;
  color: var(--fg-muted);
  max-width: 60px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ── Просмотр во весь экран ──────────────────────────────────────── */
.story-view {
  position: fixed;
  inset: 0;
  z-index: var(--z-call);
  background: #05060c;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity var(--dur) var(--ease-out);
}
.story-view.is-open { opacity: 1; }

.story-bars {
  position: absolute;
  top: calc(var(--safe-top) + var(--sp-2));
  left: var(--sp-3);
  right: var(--sp-3);
  z-index: 3;
  display: flex;
  gap: 3px;
}
.story-bar {
  flex: 1;
  height: 2.5px;
  border-radius: 3px;
  background: rgba(255, 255, 255, .28);
  overflow: hidden;
}
.story-bar i {
  display: block;
  width: 0;
  height: 100%;
  border-radius: 3px;
  background: #fff;
}

.story-head {
  position: absolute;
  top: calc(var(--safe-top) + var(--sp-5));
  left: var(--sp-3);
  right: var(--sp-3);
  z-index: 3;
  display: flex;
  align-items: center;
  gap: var(--sp-2);
}
.story-head .who { flex: 1; min-width: 0; }
.story-head .name {
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
  color: #fff;
}
.story-head .when { font-size: var(--text-xs); color: rgba(255, 255, 255, .6); }
.story-head .icon-btn { color: #fff; }

.story-picture {
  max-width: 100%;
  max-height: 100dvh;
  object-fit: contain;
}

.story-caption {
  position: absolute;
  left: var(--sp-5);
  right: var(--sp-5);
  bottom: calc(var(--safe-bottom) + var(--sp-6));
  z-index: 3;
  padding: var(--sp-3) var(--sp-4);
  border-radius: var(--r-md);
  background: rgba(0, 0, 0, .45);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  color: #fff;
  font-size: var(--text-sm);
  text-align: center;
}

/* Нажатие слева — назад, справа — вперёд */
.story-tap {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 34%;
  z-index: 2;
  cursor: pointer;
}
.story-tap.is-back { left: 0; }
.story-tap.is-next { right: 0; width: 66%; }

/* ── Соглашение и политика ───────────────────────────────────────── */
.legal {
  max-width: 640px;
  margin: 0 auto;
  padding: calc(var(--safe-top) + var(--sp-8)) var(--sp-5)
           calc(var(--safe-bottom) + var(--sp-10));
  line-height: var(--leading-loose);
  color: var(--fg-soft);
}
.legal-back {
  display: inline-block;
  margin-bottom: var(--sp-6);
  font-size: var(--text-sm);
  color: var(--fg-muted);
}
.legal h1 {
  font-size: var(--text-2xl);
  font-weight: var(--weight-bold);
  letter-spacing: -.025em;
  color: var(--fg);
}
.legal-date {
  font-size: var(--text-xs);
  color: var(--fg-faint);
  margin-top: var(--sp-1);
}
.legal h2 {
  margin-top: var(--sp-6);
  margin-bottom: var(--sp-2);
  font-size: var(--text-md);
  font-weight: var(--weight-bold);
  color: var(--fg);
}
.legal p { margin-bottom: var(--sp-3); font-size: var(--text-sm); }
.legal ul { margin: 0 0 var(--sp-3) var(--sp-5); font-size: var(--text-sm); }
.legal li { list-style: disc; margin-bottom: var(--sp-1); }
.legal b { color: var(--fg); font-weight: var(--weight-medium); }

/* ── Покупка Grams и Premium ─────────────────────────────────────── */
.pay-balance {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding: var(--sp-3) var(--sp-4);
  margin-bottom: var(--sp-3);
  border-radius: var(--r-md);
  background: var(--bg-sunken);
  font-size: var(--text-sm);
  color: var(--fg-muted);
}
.pay-balance b { font-size: var(--text-lg); color: var(--fg); }

.pay-list { display: flex; flex-direction: column; }

.pay-row {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding: var(--sp-3) var(--sp-2);
  border-bottom: 1px solid var(--line);
  cursor: pointer;
  transition: background var(--dur-fast) var(--ease-out);
}
.pay-row:last-child { border-bottom: none; }
.pay-row:hover { background: var(--bg-hover); }
.pay-row.is-busy { opacity: .5; pointer-events: none; }

.pay-icon { font-size: 22px; flex: none; width: 30px; text-align: center; }
.pay-body { flex: 1; min-width: 0; }
.pay-name { font-size: var(--text-base); font-weight: var(--weight-medium); }
.pay-bonus { font-size: var(--text-xs); color: var(--mint-600); }
[data-theme="dark"] .pay-bonus { color: var(--mint-500); }
.pay-price {
  flex: none;
  font-size: var(--text-sm);
  color: var(--accent);
  font-variant-numeric: tabular-nums;
}

/* Название подарка в магазине — чтобы не гадать, что это */
.gift-tile .gift-name {
  font-size: 10px;
  color: var(--fg-muted);
  text-align: center;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
