:root {
  --accent: #6b5cff;
  --accent-2: #8a5cff;
  --accent-soft: color-mix(in srgb, var(--accent) 13%, transparent);
  --bg: #eceef4;
  --panel: #ffffff;
  --panel-2: #f3f4f8;
  --text: #15171c;
  --muted: #6c7385;
  --line: #e4e6ee;
  --bubble-in: #ffffff;
  --danger: #e5484d;
  --ok: #2fb573;
  --shadow: 0 1px 2px rgba(20, 24, 40, 0.08);
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0d0f14;
    --panel: #161922;
    --panel-2: #1d212b;
    --text: #eceef4;
    --muted: #8b93a6;
    --line: #262b37;
    --bubble-in: #1e2330;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.35);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  font: 15px/1.4 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  overscroll-behavior: none;
}
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; -webkit-tap-highlight-color: transparent; }
input, textarea { font: inherit; color: inherit; }
[hidden] { display: none !important; }
.icon { display: inline-flex; line-height: 0; }

/* ───── логотип и аватары ───── */

.logo {
  display: grid; place-items: center; flex: none;
  background: linear-gradient(135deg, #7c6bff, #5a46e8);
  color: #fff; font-weight: 800; letter-spacing: -0.02em;
}
.avatar {
  --s: 40px;
  position: relative; flex: none;
  width: var(--s); height: var(--s); border-radius: 50%;
  display: grid; place-items: center;
  color: #fff; font-weight: 600; font-size: calc(var(--s) * 0.42);
  user-select: none;
}
.avatar { overflow: visible; }
.avatar img { position: absolute; inset: 0; width: 100%; height: 100%; border-radius: 50%; object-fit: cover; }
.avatar.clickable, .clickable { cursor: pointer; }
.avatar.group { background: linear-gradient(135deg, var(--accent), var(--accent-2)); }
.avatar .dot {
  position: absolute; right: -1px; bottom: -1px;
  width: calc(var(--s) * 0.28); height: calc(var(--s) * 0.28); min-width: 9px; min-height: 9px;
  border-radius: 50%; background: var(--ok); border: 2px solid var(--panel);
}

/* ───── экран входа ───── */

.auth {
  min-height: 100dvh; display: grid; place-items: center; padding: 20px;
  background:
    radial-gradient(900px 500px at 15% 10%, color-mix(in srgb, var(--accent) 22%, transparent), transparent 60%),
    radial-gradient(800px 500px at 90% 90%, color-mix(in srgb, var(--accent-2) 18%, transparent), transparent 60%),
    var(--bg);
}
.auth-card {
  width: 100%; max-width: 380px;
  background: var(--panel); border-radius: 24px; padding: 28px 24px 24px;
  box-shadow: 0 20px 60px rgba(30, 30, 80, 0.18);
  display: flex; flex-direction: column; gap: 12px;
}
.brand { text-align: center; margin-bottom: 4px; }
.brand .logo { margin: 0 auto 10px; }
.brand h1 { margin: 0; font-size: 26px; letter-spacing: -0.02em; }
.brand p { margin: 2px 0 0; color: var(--muted); }
.tabs { display: grid; grid-template-columns: 1fr 1fr; background: var(--panel-2); border-radius: 12px; padding: 3px; }
.tabs button { padding: 8px; border-radius: 9px; color: var(--muted); font-weight: 500; }
.tabs button.on { background: var(--panel); color: var(--text); box-shadow: var(--shadow); }
.auth-card input {
  width: 100%; padding: 12px 14px; border-radius: 12px;
  border: 1.5px solid var(--line); background: var(--panel-2); outline: none;
}
.auth-card input:focus { border-color: var(--accent); background: var(--panel); }
.primary {
  padding: 12px 16px; border-radius: 12px; font-weight: 600; color: #fff;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
}
.primary:disabled { opacity: 0.6; cursor: default; }
.form-error { min-height: 18px; color: var(--danger); font-size: 13.5px; text-align: center; }

/* ───── каркас ───── */

.layout { display: grid; grid-template-columns: 340px minmax(0, 1fr); height: 100dvh; }
.sidebar { background: var(--panel); border-right: 1px solid var(--line); display: flex; flex-direction: column; min-height: 0; }
.chat { display: flex; flex-direction: column; min-width: 0; min-height: 0; background: var(--bg); position: relative; }

.side-head {
  display: flex; align-items: center; gap: 10px; padding: 12px 14px;
  padding-top: max(12px, env(safe-area-inset-top));
  border-bottom: 1px solid var(--line);
}
.side-head .title { font-weight: 700; font-size: 19px; letter-spacing: -0.02em; }
.conn { font-size: 12.5px; color: var(--muted); flex: 1; }
.conn.bad::before { content: ''; display: inline-block; width: 8px; height: 8px; margin-right: 6px; border-radius: 50%; background: #f0a020; animation: pulse 1.2s infinite; }
@keyframes pulse { 50% { opacity: 0.3; } }
.icon-btn { width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center; color: var(--muted); flex: none; }
.icon-btn:hover { background: var(--panel-2); color: var(--text); }

.search { display: flex; align-items: center; gap: 8px; margin: 10px 12px 4px; padding: 0 12px; border-radius: 12px; background: var(--panel-2); color: var(--muted); }
.search:focus-within { outline: 2px solid var(--accent); color: var(--text); }
.search input { flex: 1; min-width: 0; padding: 10px 0; border: 0; outline: none; background: none; }
.search input::-webkit-search-cancel-button { cursor: pointer; }
.list-title { padding: 10px 12px 4px; font-size: 12.5px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: 0.04em; }
.list-hint { padding: 14px 12px; color: var(--muted); font-size: 13.5px; }
.chat-list { flex: 1; overflow-y: auto; padding: 6px; }
.chat-row { width: 100%; display: flex; align-items: center; gap: 12px; padding: 9px 10px; border-radius: 14px; text-align: left; }
.chat-row:hover { background: var(--panel-2); }
.chat-row.active { background: var(--accent-soft); }
.chat-row-main { flex: 1; min-width: 0; }
.chat-row-top, .chat-row-bottom { display: flex; align-items: center; gap: 8px; }
.chat-row-title { flex: 1; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat-row time { font-size: 12px; color: var(--muted); flex: none; }
.preview { flex: 1; min-width: 0; color: var(--muted); font-size: 13.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.preview .you { color: var(--text); opacity: 0.7; }
.preview .typing { color: var(--accent); }
.badge {
  flex: none; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 10px;
  background: var(--accent); color: #fff; font-size: 12px; font-weight: 600; display: grid; place-items: center;
}

/* ───── окно чата ───── */

.empty-pane { margin: auto; text-align: center; color: var(--muted); padding: 24px; }
.empty-pane .logo { margin: 0 auto 14px; opacity: 0.9; }

.chat-head {
  display: flex; align-items: center; gap: 12px; padding: 10px 14px; min-height: 60px;
  padding-top: max(10px, env(safe-area-inset-top));
  background: var(--panel); border-bottom: 1px solid var(--line);
}
.chat-head .back { display: none; }
.chat-head-main { display: flex; align-items: center; gap: 12px; flex: 1; min-width: 0; padding: 2px 6px 2px 0; border-radius: 12px; }
.chat-head-main.clickable { cursor: pointer; }
.chat-head-main.clickable:hover { background: var(--panel-2); }
.head-avatar { display: flex; }
.chat-head-text { min-width: 0; }
.chat-title { font-weight: 650; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat-sub { font-size: 12.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat-sub.typing { color: var(--accent); }

.offline-banner { background: #f0a020; color: #1c1300; text-align: center; padding: 5px; font-size: 13px; font-weight: 500; }

.messages { flex: 1; overflow-y: auto; padding: 10px 14px; display: flex; flex-direction: column; overscroll-behavior: contain; }
.messages .more, .messages .none { margin: auto; padding: 10px; color: var(--muted); font-size: 13px; text-align: center; }
.messages .more { margin: 0 auto; }
.day { display: flex; justify-content: center; margin: 12px 0 4px; position: sticky; top: 0; z-index: 1; }
.day span { background: color-mix(in srgb, var(--panel) 88%, transparent); backdrop-filter: blur(6px); color: var(--muted); font-size: 12px; padding: 3px 11px; border-radius: 12px; box-shadow: var(--shadow); }

.row { display: flex; align-items: flex-end; gap: 8px; margin-top: 8px; position: relative; }
.row.grouped { margin-top: 2px; }
.row.mine { justify-content: flex-end; }
.avatar-spacer { width: 32px; flex: none; }

.bubble {
  max-width: min(560px, 80%); padding: 7px 11px 5px; border-radius: 18px;
  background: var(--bubble-in); box-shadow: var(--shadow);
  overflow-wrap: anywhere; min-width: 0;
}
.theirs .bubble { border-bottom-left-radius: 6px; }
.mine .bubble { border-bottom-right-radius: 6px; background: linear-gradient(135deg, var(--accent), var(--accent-2)); color: #fff; }
.row.grouped .bubble { border-radius: 18px; }
.bubble a { color: inherit; text-decoration: underline; text-underline-offset: 2px; }
.author { font-size: 13px; font-weight: 600; margin-bottom: 1px; }
.text { white-space: pre-wrap; }
.text.big { font-size: 34px; line-height: 1.2; }
.text.deleted { font-style: italic; opacity: 0.6; }
.meta { font-size: 11px; opacity: 0.6; text-align: right; margin-top: 1px; user-select: none; }
.bubble img { display: block; max-width: 100%; max-height: 340px; border-radius: 12px; margin: 2px 0 4px; background: var(--panel-2); }
.file-chip { display: flex; align-items: center; gap: 10px; padding: 4px 0; text-decoration: none !important; }
.file-chip .icon { width: 38px; height: 38px; border-radius: 50%; background: rgba(127, 127, 127, 0.2); display: grid; place-items: center; flex: none; }
.file-chip b { display: block; font-weight: 600; word-break: break-all; }
.file-chip small { opacity: 0.7; }

.del { display: none; align-self: center; width: 32px; height: 32px; border-radius: 50%; place-items: center; color: var(--danger); background: var(--panel); box-shadow: var(--shadow); flex: none; order: -1; }
.row.mine.sel .del { display: grid; }
@media (hover: hover) { .row.mine:hover .del { display: grid; } }

.composer {
  display: flex; align-items: flex-end; gap: 6px; padding: 8px 10px;
  padding-bottom: max(8px, env(safe-area-inset-bottom));
  background: var(--panel); border-top: 1px solid var(--line);
}
.composer textarea {
  flex: 1; resize: none; border: 0; outline: none; background: var(--panel-2);
  border-radius: 20px; padding: 10px 14px; max-height: 140px; min-height: 42px; line-height: 1.35;
}
.send { width: 42px; height: 42px; border-radius: 50%; color: #fff; display: grid; place-items: center; flex: none; background: linear-gradient(135deg, var(--accent), var(--accent-2)); }
.send.idle { background: var(--panel-2); color: var(--muted); }
.upload-status { padding: 6px 14px; font-size: 13px; color: var(--muted); background: var(--panel); border-top: 1px solid var(--line); }
.drop-hint { position: absolute; inset: 0; z-index: 5; display: grid; place-items: center; background: color-mix(in srgb, var(--accent) 22%, transparent); backdrop-filter: blur(3px); font-weight: 600; font-size: 18px; border: 3px dashed var(--accent); border-radius: 18px; margin: 8px; pointer-events: none; }

/* ───── монеты и кошелёк ───── */

.coin-chip {
  position: relative; display: inline-flex; align-items: center; gap: 5px; flex: none;
  padding: 4px 10px 4px 6px; border-radius: 999px; font-weight: 650; font-size: 14px;
  background: color-mix(in srgb, #f6b62b 18%, transparent); color: var(--text);
}
.coin-chip:hover { background: color-mix(in srgb, #f6b62b 30%, transparent); }
.coin-chip.bump { animation: bump 0.5s; }
@keyframes bump { 30% { transform: scale(1.18); } }
.coin-pop {
  position: absolute; left: 50%; top: -2px; pointer-events: none; font-weight: 700; color: #d99a12;
  animation: coin-pop 1.2s ease-out forwards;
}
@keyframes coin-pop { from { opacity: 1; transform: translate(-50%, 0); } to { opacity: 0; transform: translate(-50%, -26px); } }

.modal-backdrop {
  position: fixed; inset: 0; z-index: 40; display: grid; place-items: center; padding: 16px;
  background: rgba(8, 10, 16, 0.55); backdrop-filter: blur(3px);
}
.modal {
  width: 100%; max-width: 420px; max-height: min(680px, 100%); display: flex; flex-direction: column;
  background: var(--panel); border-radius: 22px; box-shadow: 0 24px 70px rgba(0, 0, 0, 0.35); overflow: hidden;
}
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 12px 12px 8px 20px; font-size: 17px; }
.modal-body { overflow-y: auto; padding: 4px 20px 20px; }
.modal-body h3 { margin: 18px 0 8px; font-size: 14px; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; }
.muted-note { color: var(--muted); padding: 8px 0; }
.balance { display: flex; align-items: center; gap: 10px; margin: 4px 0 14px; }
.balance span:nth-child(2) { font-size: 40px; font-weight: 750; letter-spacing: -0.02em; line-height: 1; }
.balance small { color: var(--muted); align-self: flex-end; padding-bottom: 5px; }
.stat { margin-bottom: 12px; }
.stat-row { display: flex; justify-content: space-between; font-size: 14px; margin-bottom: 5px; color: var(--muted); }
.stat-row b { color: var(--text); font-weight: 600; }
.bar { height: 7px; border-radius: 4px; background: var(--panel-2); overflow: hidden; }
.bar i { display: block; height: 100%; border-radius: 4px; background: linear-gradient(90deg, #f6b62b, #f08a1c); transition: width 0.4s; }
.rules { font-size: 13px; color: var(--muted); margin: 10px 0 0; }
.top, .history { list-style: none; margin: 0; padding: 0; }
.top li { display: flex; align-items: center; gap: 10px; padding: 6px 8px; border-radius: 10px; }
.top li.me { background: var(--accent-soft); }
.top .rank { width: 18px; text-align: center; color: var(--muted); font-size: 13px; }
.top .name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.history li { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 8px 2px; border-bottom: 1px solid var(--line); }
.history li:last-child { border-bottom: 0; }
.history .kind { display: block; font-size: 14px; }
.history small { color: var(--muted); font-size: 12px; }
.history .plus { color: var(--ok); }
.history .minus { color: var(--danger); }

/* ───── кнопки и формы в окнах ───── */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 10px 16px; border-radius: 12px;
  background: var(--panel-2); font-weight: 600; font-size: 14.5px;
}
.btn:hover { filter: brightness(0.96); }
.btn.primary { color: #fff; background: linear-gradient(135deg, var(--accent), var(--accent-2)); }
.btn.ghost { background: none; color: var(--muted); }
.btn.danger { color: var(--danger); }
.btn:disabled { opacity: 0.55; cursor: default; filter: none; }
.inline-form { display: flex; flex-direction: column; gap: 8px; margin-top: 4px; }
.inline-form label { font-size: 13px; color: var(--muted); margin-top: 6px; }
.inline-form input, .inline-form textarea {
  width: 100%; padding: 11px 13px; border-radius: 12px; border: 1.5px solid var(--line); background: var(--panel-2); outline: none; resize: none;
}
.inline-form input:focus, .inline-form textarea:focus { border-color: var(--accent); background: var(--panel); }
.inline-form .btn { margin-top: 8px; }
.at-input { display: flex; align-items: center; gap: 4px; border: 1.5px solid var(--line); border-radius: 12px; background: var(--panel-2); padding-left: 13px; }
.at-input:focus-within { border-color: var(--accent); background: var(--panel); }
.at-input span { color: var(--muted); }
.at-input input { border: 0; background: none; padding-left: 0; }
.counter { align-self: flex-end; color: var(--muted); }
.row-btns { display: flex; flex-wrap: wrap; gap: 8px; }
.row-btns.center { justify-content: center; margin-top: 10px; }

/* ───── профиль ───── */

.profile-hero { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 4px; padding: 6px 0 14px; }
.profile-hero h2 { margin: 10px 0 0; font-size: 22px; letter-spacing: -0.01em; word-break: break-word; }
.profile-real { color: var(--muted); font-size: 13.5px; }
.profile-sub { color: var(--muted); font-size: 14px; }
.profile-field { padding: 10px 0; border-top: 1px solid var(--line); }
.profile-field small { color: var(--muted); font-size: 12.5px; }
.profile-field p { margin: 2px 0 0; white-space: pre-wrap; word-break: break-word; }
.profile-actions { display: flex; flex-direction: column; gap: 8px; padding-top: 12px; border-top: 1px solid var(--line); }
.avatar-edit { position: relative; display: inline-flex; }
.avatar-edit .cam {
  position: absolute; right: -2px; bottom: -2px; width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center;
  color: #fff; background: var(--accent); border: 3px solid var(--panel);
}

/* ───── игра «кости» ───── */

.bubble.game, .mine .bubble.game { background: var(--panel); color: var(--text); padding: 8px; border: 1px solid var(--line); }
.bubble.game .meta { padding: 0 4px; }
.game-card { display: flex; flex-direction: column; gap: 10px; min-width: min(300px, 70vw); }
.game-head { display: flex; align-items: center; gap: 8px; }
.game-head .bet { margin-left: auto; display: inline-flex; align-items: center; gap: 4px; font-weight: 700; padding: 2px 10px 2px 6px; border-radius: 999px; background: color-mix(in srgb, #f6b62b 20%, transparent); }
.game-players { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 8px; }
.game-players > .vs { color: var(--muted); font-size: 12px; text-transform: uppercase; }
.game-player { display: flex; align-items: center; gap: 8px; min-width: 0; padding: 4px 8px 4px 4px; border-radius: 999px; background: var(--panel-2); }
.game-player.empty { color: var(--muted); padding-left: 12px; font-size: 13px; }
.game-player.winner { background: color-mix(in srgb, var(--ok) 22%, transparent); }
.game-player .pname { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-weight: 600; font-size: 14px; }
.game-rounds { display: flex; flex-direction: column; gap: 4px; }
.game-round { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 8px; padding: 4px 0; border-top: 1px dashed var(--line); }
.game-round .vs { color: var(--muted); font-weight: 700; }
.game-round.tie { opacity: 0.6; }
.dice-row { display: flex; align-items: center; justify-content: center; gap: 4px; }
.die { font-size: 36px; line-height: 1; font-family: "Segoe UI Symbol", "Noto Sans Symbols 2", "Apple Symbols", system-ui, sans-serif; }
.die.pending { opacity: 0.4; font-size: 26px; }
.die.roll { animation: die-roll 0.7s ease-out; }
@keyframes die-roll { 0% { transform: rotate(-200deg) scale(0.4); opacity: 0; } 60% { transform: rotate(20deg) scale(1.15); opacity: 1; } 100% { transform: none; } }
.dice-row .sum { margin-left: 4px; font-size: 18px; min-width: 24px; }
.game-status { text-align: center; font-weight: 600; }
.game-card.cancelled .game-status { color: var(--muted); font-weight: 500; }
.game-actions { display: flex; justify-content: center; gap: 8px; }
.chips { display: flex; gap: 8px; }
.chip { padding: 6px 14px; border-radius: 999px; background: var(--panel-2); font-weight: 600; }
.chip:hover { background: var(--accent-soft); }
.balance-line { display: flex; align-items: center; gap: 8px; font-weight: 650; font-size: 17px; }

/* анимация броска: кубики «катятся» ~1,25 с, потом останавливаются */
.game-icon { font-size: 18px; line-height: 1; }
.deadline { margin-left: 6px; padding: 1px 8px; border-radius: 999px; font-size: 12.5px; font-variant-numeric: tabular-nums; color: var(--muted); background: var(--panel-2); }
.deadline:not(:empty)::before { content: '⏱ '; }
.deadline.warn { color: var(--danger); background: color-mix(in srgb, var(--danger) 14%, transparent); }
.game-card .side { display: flex; justify-content: center; transition: opacity 0.25s; }
.game-card .side.pending { opacity: 0.22; }
.game-card .side.rolling .die { animation: die-shake 0.24s infinite linear; }
.game-card .side.landed .die { animation: die-land 0.42s ease-out; }
.game-card .side.landed .sum { animation: sum-pop 0.35s ease-out; }
@keyframes die-shake {
  0% { transform: translate(0, 0) rotate(0deg); }
  25% { transform: translate(-3px, 2px) rotate(-18deg); }
  50% { transform: translate(2px, -3px) rotate(14deg); }
  75% { transform: translate(3px, 2px) rotate(-10deg); }
  100% { transform: translate(0, 0) rotate(0deg); }
}
@keyframes die-land { 0% { transform: scale(1.35) rotate(-25deg); } 60% { transform: scale(0.92) rotate(6deg); } 100% { transform: none; } }
@keyframes sum-pop { 0% { transform: scale(0.5); opacity: 0; } 70% { transform: scale(1.25); } 100% { transform: none; opacity: 1; } }
.game-card.playing .game-status { color: var(--accent); animation: status-pulse 0.9s infinite; }
@keyframes status-pulse { 50% { opacity: 0.55; } }
.game-card.done .game-status { animation: sum-pop 0.4s ease-out; }
.game-player.winner { animation: winner-glow 1.2s ease-out; }
@keyframes winner-glow { 0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--ok) 70%, transparent); } 100% { box-shadow: 0 0 0 14px transparent; } }
@media (prefers-reduced-motion: reduce) {
  .game-card *, .coin-chip, .coin-pop { animation: none !important; transition: none !important; }
}

/* всплывающее изменение баланса: «+10» зелёным, «−76» красным */
.coin-pop { color: #2fb573; }
.coin-pop.neg { color: var(--danger); }

/* ───── рулетка ───── */

.wheel { position: relative; flex: none; }
.wheel svg { width: 100%; height: 100%; display: block; filter: drop-shadow(0 3px 6px rgba(0, 0, 0, 0.35)); }
.wheel .rotor, .wheel .orbit, .wheel .ball { transform-origin: 0 0; }
.wheel.idle .rotor { animation: wheel-idle 30s linear infinite; }
@keyframes wheel-idle { to { transform: rotate(360deg); } }
.rl-stage { display: flex; gap: 14px; align-items: center; }
.rl-wheel { position: relative; flex: none; }
.rl-result {
  position: absolute; right: -8px; bottom: -6px; min-width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center;
  font-weight: 800; font-size: 18px; color: #fff; border: 3px solid var(--panel); box-shadow: var(--shadow); transition: opacity 0.35s, transform 0.35s;
}
.rl-result.red { background: #c9312f; }
.rl-result.black { background: #181b22; }
.rl-result.green { background: #12915a; }
.rl-result.pending { opacity: 0; transform: scale(0.4); }
.rl-players { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 5px; transition: opacity 0.35s; }
.rl-players.pending { opacity: 0; }
.rl-player { display: flex; align-items: center; gap: 6px; font-size: 14px; }
.rl-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rl-player.me .rl-name { font-weight: 700; }
.rl-player b.plus { color: var(--ok); }
.rl-player b.minus { color: var(--danger); }
.rl-empty { color: var(--muted); font-size: 13px; }

.modal:has(.rl-modal) { max-width: 540px; }
.rl-modal { display: flex; flex-direction: column; gap: 12px; }
.rl-modal small { color: var(--muted); display: block; margin-bottom: 4px; }
.rl-top { display: flex; justify-content: space-between; align-items: center; color: var(--muted); font-size: 14px; }
.rl-top b { color: var(--text); }
.rl-chips { display: flex; gap: 8px; flex-wrap: wrap; }
.rl-chip { width: 46px; height: 46px; border-radius: 50%; font-weight: 750; background: var(--panel-2); border: 3px dashed #d4af37; color: var(--text); }
.rl-chip.on { background: #f6b62b; color: #3a2a00; border-style: solid; }
.rl-board { display: flex; flex-direction: column; gap: 4px; }
.rl-zero .rl-cell { width: 100%; }
.rl-numbers { display: grid; grid-template-columns: repeat(12, 1fr); gap: 3px; }
.rl-row3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 3px; }
.rl-row6 { display: grid; grid-template-columns: repeat(6, 1fr); gap: 3px; }
.rl-cell {
  position: relative; padding: 9px 0; border-radius: 6px; font-weight: 700; font-size: 13px; color: #fff; text-align: center;
  border: 1px solid rgba(255, 255, 255, 0.14); touch-action: manipulation;
}
.rl-cell.red { background: #c9312f; }
.rl-cell.black { background: #181b22; }
.rl-cell.green { background: #12915a; }
.rl-cell.out { background: var(--panel-2); color: var(--text); font-size: 12px; padding: 10px 2px; }
.rl-cell.out.red { background: #c9312f; color: #fff; }
.rl-cell.out.black { background: #181b22; color: #fff; }
.rl-cell:active { transform: scale(0.95); }
.rl-cell.has { outline: 2px solid #f6b62b; outline-offset: -1px; }
.rl-badge {
  position: absolute; top: -7px; right: -4px; min-width: 20px; height: 20px; padding: 0 5px; border-radius: 10px; z-index: 1;
  background: #f6b62b; color: #3a2a00; font-size: 11px; font-weight: 800; display: grid; place-items: center; box-shadow: var(--shadow);
}
.rl-sums { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.rl-list { display: flex; flex-wrap: wrap; gap: 6px; }
.rl-tag { padding: 3px 10px; border-radius: 999px; background: var(--panel-2); font-size: 13px; display: inline-flex; align-items: center; gap: 5px; }

/* меню игр у поля ввода */
.menu.picker { width: 260px; }
.menu-title { padding: 8px 10px 4px; font-size: 12.5px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: 0.04em; }
.pick { display: flex; align-items: center; gap: 12px; }
.pick-icon { font-size: 26px; line-height: 1; }
.pick small { display: block; color: var(--muted); font-size: 12.5px; }

/* перевод монет */
.transfer-card { display: flex; align-items: center; gap: 14px; min-width: min(240px, 68vw); padding: 4px 6px; }
.transfer-icon { width: 52px; height: 52px; border-radius: 50%; display: grid; place-items: center; background: color-mix(in srgb, #f6b62b 22%, transparent); flex: none; }
.transfer-title { font-size: 12.5px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.04em; }
.transfer-amount { font-size: 26px; font-weight: 750; letter-spacing: -0.01em; line-height: 1.1; }
.transfer-amount.in { color: var(--ok); }
.transfer-amount.out { color: var(--danger); }
.transfer-sub { color: var(--muted); font-size: 14px; }
.transfer-note { margin-top: 4px; font-style: italic; word-break: break-word; }
.profile-hero.compact { flex-direction: row; text-align: left; gap: 12px; padding: 0 0 8px; }
.profile-hero.compact small { display: block; color: var(--muted); }

/* ───── меню и тосты ───── */

.menu {
  position: fixed; z-index: 30; width: 268px; background: var(--panel); border: 1px solid var(--line);
  border-radius: 16px; box-shadow: 0 12px 40px rgba(0, 0, 0, 0.22); padding: 6px;
}
.menu-me { width: 100%; display: flex; align-items: center; gap: 10px; padding: 8px 8px 10px; border-bottom: 1px solid var(--line); margin-bottom: 4px; text-align: left; border-radius: 10px 10px 0 0; }
.menu-me:hover { background: var(--panel-2); }
.menu-me b { display: block; }
.menu-me small { color: var(--muted); }
.menu-item { width: 100%; display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 10px; border-radius: 10px; text-align: left; }
.menu-item:hover { background: var(--panel-2); }
.menu-item.danger { color: var(--danger); }
.menu-item .state { color: var(--muted); font-size: 13px; }
.invite-box { margin: 4px; padding: 10px; border-radius: 12px; background: var(--panel-2); font-size: 13px; }
.invite-box code { display: block; margin: 4px 0 8px; font-size: 15px; font-weight: 600; letter-spacing: 0.02em; user-select: all; }
.invite-box button { display: block; color: var(--accent); font-weight: 600; margin-bottom: 2px; }
.invite-box code { word-break: break-all; font-size: 13px; }
.invite-sep { height: 1px; background: var(--line); margin: 10px 0; }
.invite-note { margin-top: 8px; color: var(--muted); font-size: 12.5px; }

.toast {
  position: fixed; left: 50%; bottom: max(24px, env(safe-area-inset-bottom)); transform: translateX(-50%);
  z-index: 50; background: #22252e; color: #fff; padding: 10px 16px; border-radius: 14px; font-size: 14px;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.3); max-width: 90vw; transition: opacity 0.4s;
}
.toast.out { opacity: 0; }

/* ───── телефон ───── */

@media (max-width: 760px) {
  .layout { grid-template-columns: minmax(0, 1fr); }
  .sidebar, .chat { grid-area: 1 / 1; border: 0; }
  .layout[data-view="list"] .chat { display: none; }
  .layout[data-view="chat"] .sidebar { display: none; }
  .chat-head .back { display: grid; margin-left: -6px; }
  .bubble { max-width: 84%; }
  .messages { padding: 8px 10px; }
}
