/* This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this
 * file, You can obtain one at https://mozilla.org/MPL/2.0/.
 *
 * «Марина в огне» v2.0a — messenger UI (telegram-inspired bubbles).
 * (c) 2026 Tim Zinin.
 */

:root {
  /* Telegram-inspired warm-dark messenger palette */
  --bg: #0e1621;
  --panel: #17212b;
  --panel-2: #242f3d;
  --border: #2b3a4a;
  --border-strong: #3a4c60;
  --fg: #ffffff;
  --muted: #a1b5c8;
  --subtle: #6c7d90;
  --accent: #ff6b3d;        /* warmer terracotta for Marina's fire */
  --accent-strong: #ff8052;
  --ok: #65c77e;
  --warn: #ffb547;
  /* Bubbles */
  --incoming-bg: #182533;    /* slightly warmer than panel */
  --incoming-fg: #ffffff;
  --outgoing-bg: #2b5278;    /* telegram blue */
  --outgoing-bg-2: #3a6a94;
  --outgoing-fg: #ffffff;
  --system-bg: rgba(23, 33, 43, 0.55);
  /* Chat area wallpaper */
  --chat-bg: #0e1621;
  /* Per-contact accent seeds */
  --c-lena:   #9b6cff;
  --c-anna:   #57a3ff;
  --c-tim:    #ff6b3d;
  --c-bank:   #65c77e;
  --c-khoz:   #c97a9a;
  --c-pavel:  #8a94a3;
  --c-mama:   #ff5e87;
  --c-denis:  #ffb547;
  --c-scratch:#ffffff;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background:
    radial-gradient(ellipse at top left, rgba(255, 107, 61, 0.08), transparent 55%),
    radial-gradient(ellipse at bottom right, rgba(87, 163, 255, 0.06), transparent 50%),
    var(--bg);
  color: var(--fg);
  font-family: -apple-system, "SF Pro Text", "Inter", "Segoe UI", "Helvetica Neue", sans-serif;
  font-size: 14.5px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -webkit-text-size-adjust: 100%;
  overflow: hidden;
  height: 100vh;
}

#app {
  display: flex;
  flex-direction: column;
  height: 100vh;
  max-width: 960px;
  margin: 0 auto;
  background: var(--panel);
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.03), 0 24px 80px rgba(0, 0, 0, 0.6);
}

/* ========== Messenger layout ========== */

#messenger {
  display: grid;
  grid-template-columns: 240px 1fr;
  flex: 1;
  min-height: 0;
  background: var(--bg);
}

/* Contacts sidebar */

#contacts {
  background: var(--panel);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  min-height: 0;
}

#contacts-header {
  padding: 14px 14px 10px;
  border-bottom: 1px solid var(--border);
}

#contacts-header .brand-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.brand-circle {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  overflow: hidden;
  flex-shrink: 0;
  box-shadow: 0 2px 8px rgba(197, 56, 14, 0.3);
  background: linear-gradient(135deg, #ffb64a 0%, #c5380e 60%, #8f1a05 100%);
  position: relative;
}

.brand-circle svg,
.brand-circle img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.brand-text {
  min-width: 0;
  flex: 1;
}

.brand-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--fg);
  letter-spacing: -0.01em;
  line-height: 1.2;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.brand-subtitle {
  font-size: 11px;
  color: var(--subtle);
  font-style: italic;
  margin-top: 2px;
}

#contacts-status.status-mini {
  margin-top: 6px;
  font-size: 11px;
  color: var(--subtle);
  font-variant-numeric: tabular-nums;
}

/* ========== Folder tabs ========== */

#folder-tabs {
  display: flex;
  gap: 4px;
  padding: 8px 12px 4px;
  border-bottom: 1px solid var(--border);
  overflow-x: auto;
  scrollbar-width: none;
}

#folder-tabs::-webkit-scrollbar { display: none; }

.folder-tab {
  flex-shrink: 0;
  padding: 6px 13px;
  background: transparent;
  color: var(--muted);
  border: 1px solid transparent;
  border-radius: 14px;
  font-family: inherit;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: background 140ms, color 140ms, transform 120ms;
  white-space: nowrap;
}

.folder-tab:hover {
  background: rgba(255, 255, 255, 0.06);
  color: var(--fg);
}

.folder-tab.active {
  background: var(--accent);
  color: #ffffff;
  border-color: var(--accent);
  box-shadow: 0 3px 10px rgba(255, 107, 61, 0.35);
  font-weight: 600;
}

.funnel-group-header {
  padding: 8px 14px 4px;
  font-size: 10px;
  color: var(--subtle);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 600;
}

.funnel-group-count {
  float: right;
  color: var(--muted);
}

.funnel-item {
  padding: 8px 14px;
  color: var(--muted);
  font-size: 12px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.funnel-item .funnel-progress {
  flex: 1;
  height: 4px;
  background: var(--border);
  border-radius: 2px;
  overflow: hidden;
}

.funnel-item .funnel-progress-fill {
  height: 100%;
  background: var(--accent);
}

.folder-empty-state {
  padding: 24px 16px;
  text-align: center;
  color: var(--subtle);
  font-size: 12px;
  font-style: italic;
}

#contacts-list {
  flex: 1;
  overflow-y: auto;
  padding: 6px 0;
}

.contact-item {
  display: flex;
  align-items: center;
  padding: 9px 14px;
  cursor: pointer;
  border-left: 3px solid transparent;
  transition: background 140ms;
  position: relative;
}

.contact-item:hover {
  background: rgba(255, 255, 255, 0.04);
}

.contact-item.active {
  background: linear-gradient(90deg, rgba(255, 107, 61, 0.12) 0%, rgba(255, 107, 61, 0) 80%);
  border-left-color: var(--accent);
}

/* SPRINT 37 — pinned scratch chat (Telegram-style sticky to top) */
.contact-item.pinned {
  position: sticky;
  top: 0;
  z-index: 10;
  background: linear-gradient(180deg, var(--panel) 0%, rgba(23, 33, 43, 0.96) 100%);
  border-bottom: 1px solid rgba(255, 107, 61, 0.18);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.35);
}
.contact-item.pinned .contact-name::after {
  content: ' 📌';
  font-size: 11px;
  opacity: 0.65;
}
.contact-item.pinned.active {
  background: linear-gradient(90deg, rgba(255, 107, 61, 0.16) 0%, rgba(23, 33, 43, 0.96) 80%);
}

.contact-item + .contact-item {
  border-top: 1px solid rgba(255, 255, 255, 0.03);
}

.contact-avatar {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: linear-gradient(135deg, #5a6a80 0%, #3a4a60 100%);
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 15px;
  margin-right: 11px;
  flex-shrink: 0;
  position: relative;
  letter-spacing: -0.01em;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.25);
}

.contact-avatar.online::after {
  content: "";
  position: absolute;
  bottom: 1px;
  right: 1px;
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background: var(--ok);
  border: 2.5px solid var(--panel);
  box-sizing: border-box;
}

/* Per-contact gradient avatars */
.contact-avatar.lena     { background: linear-gradient(135deg, #c6a1ff 0%, #7b52c8 100%); }
.contact-avatar.anna     { background: linear-gradient(135deg, #8ec3ff 0%, #3e7ecc 100%); }
.contact-avatar.tim      { background: linear-gradient(135deg, #ffa97a 0%, #d14a1a 100%); }
.contact-avatar.bank     { background: linear-gradient(135deg, #8adca0 0%, #3a9e56 100%); }
.contact-avatar.khozyaika{ background: linear-gradient(135deg, #e8a6bd 0%, #a8546f 100%); }
.contact-avatar.pavel    { background: linear-gradient(135deg, #b5bfcc 0%, #5f6d80 100%); }
.contact-avatar.mama     { background: linear-gradient(135deg, #ff9ab4 0%, #d13c65 100%); }
.contact-avatar.denis    { background: linear-gradient(135deg, #ffd47a 0%, #d17e0e 100%); }
.contact-avatar.spam     { background: linear-gradient(135deg, #6c7d90 0%, #2b3a4a 100%); color: #a1b5c8; }
.contact-avatar.scratch  { background: linear-gradient(135deg, #ffb64a 0%, #c5380e 60%, #8f1a05 100%); }

.contact-info {
  flex: 1;
  min-width: 0;
}

.contact-name {
  font-size: 14px;
  color: var(--fg);
  font-weight: 600;
  letter-spacing: -0.01em;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.contact-preview {
  font-size: 12.5px;
  color: var(--muted);
  margin-top: 2px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.contact-meta {
  text-align: right;
  font-size: 10px;
  color: var(--subtle);
  margin-left: 6px;
}

.contact-unread {
  display: inline-block;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  border-radius: 10px;
  background: var(--accent);
  color: white;
  font-size: 11px;
  line-height: 20px;
  text-align: center;
  font-weight: 700;
  box-shadow: 0 2px 6px rgba(255, 107, 61, 0.4);
}

/* Chat pane */

#chat {
  display: flex;
  flex-direction: column;
  background: var(--chat-bg);
  min-height: 0;
  position: relative;
}

#chat-header {
  padding: 12px 18px 11px;
  border-bottom: 1px solid var(--border);
  background: var(--panel);
  position: relative;
  z-index: 2;
  box-shadow: 0 1px 0 rgba(0, 0, 0, 0.25);
}

#chat-title {
  font-size: 15px;
  color: var(--fg);
  font-weight: 600;
  letter-spacing: -0.01em;
}

#chat-subtitle {
  font-size: 12px;
  color: var(--muted);
  margin-top: 2px;
}

#chat-thread {
  flex: 1;
  overflow-y: auto;
  padding: 18px 20px 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  scrollbar-width: thin;
  scrollbar-color: var(--border-strong) transparent;
  background-image:
    radial-gradient(circle at 18% 22%, rgba(255, 107, 61, 0.06) 0, transparent 45%),
    radial-gradient(circle at 82% 78%, rgba(87, 163, 255, 0.05) 0, transparent 45%),
    radial-gradient(circle at 50% 50%, rgba(255, 255, 255, 0.015) 0, transparent 60%);
}

#chat-thread::-webkit-scrollbar { width: 6px; }
#chat-thread::-webkit-scrollbar-track { background: transparent; }
#chat-thread::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 3px; }

/* Bubbles */

.bubble {
  max-width: 72%;
  padding: 9px 13px 8px;
  border-radius: 18px;
  font-size: 14px;
  line-height: 1.42;
  word-wrap: break-word;
  white-space: pre-wrap;
  position: relative;
  animation: bubbleIn 220ms ease-out;
  box-shadow: 0 1px 1px rgba(0, 0, 0, 0.12);
  margin-top: 2px;
}

@keyframes bubbleIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

.bubble.incoming {
  background: var(--incoming-bg);
  color: var(--incoming-fg);
  align-self: flex-start;
  border-bottom-left-radius: 6px;
  margin-left: 12px;
}

/* Incoming bubble tail */
.bubble.incoming::before {
  content: "";
  position: absolute;
  left: -7px;
  bottom: 0;
  width: 14px;
  height: 14px;
  background: var(--incoming-bg);
  border-bottom-right-radius: 14px;
  clip-path: polygon(50% 0, 100% 0, 100% 100%, 0 100%);
  box-shadow: -1px 0 1px rgba(0, 0, 0, 0.1);
}

.bubble.outgoing {
  background: linear-gradient(135deg, var(--outgoing-bg) 0%, var(--outgoing-bg-2) 100%);
  color: var(--outgoing-fg);
  align-self: flex-end;
  border-bottom-right-radius: 6px;
  margin-right: 12px;
}

/* Outgoing bubble tail */
.bubble.outgoing::before {
  content: "";
  position: absolute;
  right: -7px;
  bottom: 0;
  width: 14px;
  height: 14px;
  background: var(--outgoing-bg-2);
  border-bottom-left-radius: 14px;
  clip-path: polygon(0 0, 50% 0, 100% 100%, 0 100%);
  box-shadow: 1px 0 1px rgba(0, 0, 0, 0.1);
}

.bubble.system {
  background: var(--system-bg);
  color: var(--muted);
  align-self: center;
  font-size: 11.5px;
  font-style: italic;
  max-width: 84%;
  text-align: center;
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 14px;
  padding: 6px 14px;
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  margin: 8px auto;
}

.bubble.bank {
  background: linear-gradient(180deg, #1a2a1f 0%, #15221a 100%);
  color: var(--fg);
  align-self: center;
  max-width: 88%;
  border: 1px solid rgba(101, 199, 126, 0.25);
  border-left: 3px solid var(--ok);
  border-radius: 12px;
  padding: 11px 16px;
  font-size: 13px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
  margin: 6px auto;
}

.bubble.bank::before,
.bubble.bank::after { display: none !important; }

.bubble.bank .bank-header {
  font-size: 10.5px;
  color: #86d69a;
  font-weight: 700;
  margin-bottom: 5px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.bubble.bank .bank-amount {
  font-size: 16px;
  font-weight: 700;
  color: var(--fg);
  font-variant-numeric: tabular-nums;
}

.bubble.bank .bank-amount.pos { color: var(--ok); }
.bubble.bank .bank-amount.neg { color: var(--accent); }

.bubble-photo {
  /* SPRINT 32 — bigger photos, native aspect ratio preserved */
  margin: 2px 0 6px 0;
  border-radius: 12px;
  overflow: hidden;
  max-width: 100%;
  width: 280px;
  background: var(--panel-2);
}

.bubble-photo img {
  display: block;
  width: 100%;
  height: auto;
  max-height: 420px;
  object-fit: cover;
  filter: brightness(0.96) contrast(1.02);
  transition: filter 160ms, transform 160ms;
}

@media (max-width: 640px) {
  .bubble-photo { width: 100%; max-width: 86vw; }
  .bubble-photo img { max-height: 360px; }
}

.bubble-photo img:hover {
  filter: brightness(1) contrast(1.05);
  transform: scale(1.01);
}

.bubble-photo-err {
  padding: 16px;
  color: var(--subtle);
  font-size: 11px;
  text-align: center;
  font-style: italic;
}

.bubble .time {
  display: inline-block;
  font-size: 10.5px;
  color: rgba(255, 255, 255, 0.55);
  margin-top: 2px;
  margin-left: 6px;
  float: right;
  font-variant-numeric: tabular-nums;
  line-height: 1;
  padding-top: 4px;
}

.bubble.outgoing .time {
  color: rgba(200, 230, 255, 0.75);
}

.bubble.outgoing .time::after {
  content: " ✓✓";
  color: #7cc4ff;
  margin-left: 2px;
  font-size: 10px;
}

.bubble.outgoing .time.unread::after {
  content: " ✓";
  color: rgba(200, 230, 255, 0.5);
}

.bubble.incoming .time {
  color: var(--subtle);
}

.bubble .sender-name {
  display: block;
  font-size: 12px;
  font-weight: 600;
  margin-bottom: 3px;
  letter-spacing: -0.01em;
}

/* Per-contact sender name color (matches avatar accent) */
.bubble.incoming[data-from="lena"]  .sender-name { color: var(--c-lena); }
.bubble.incoming[data-from="anna"]  .sender-name { color: var(--c-anna); }
.bubble.incoming[data-from="tim"]   .sender-name { color: var(--c-tim); }
.bubble.incoming[data-from="khozyaika"] .sender-name { color: var(--c-khoz); }
.bubble.incoming[data-from="pavel"] .sender-name { color: var(--c-pavel); }
.bubble.incoming[data-from="mama"]  .sender-name { color: var(--c-mama); }
.bubble.incoming[data-from="denis"] .sender-name { color: var(--c-denis); }
.bubble.incoming[data-from="spam"]  .sender-name { color: #8c9aaa; font-style: italic; }

/* Typing indicator */

.typing-indicator {
  padding: 6px 18px 0;
  display: flex;
  align-items: center;
  gap: 4px;
  color: var(--muted);
  font-size: 11px;
  font-style: italic;
  min-height: 22px;
}

.typing-indicator .t-dot {
  display: inline-block;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--muted);
  animation: typingBounce 1.4s infinite ease-in-out both;
}

.typing-indicator .t-dot:nth-child(1) { animation-delay: -0.32s; }
.typing-indicator .t-dot:nth-child(2) { animation-delay: -0.16s; }
.typing-indicator .typing-label {
  margin-left: 6px;
}

@keyframes typingBounce {
  0%, 80%, 100% { opacity: 0.3; transform: translateY(0); }
  40%           { opacity: 1;   transform: translateY(-3px); }
}

/* Chat actions (contextual reply chips) */

#chat-actions {
  padding: 8px 18px 14px;
  border-top: 1px solid var(--border);
  background: var(--panel);
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.reply-chip {
  display: block;
  width: 100%;
  text-align: left;
  padding: 9px 13px;
  background: var(--panel-2);
  color: var(--fg);
  border: 1px solid var(--border);
  border-radius: 10px;
  font-family: inherit;
  font-size: 13px;
  cursor: pointer;
  transition: background 120ms, border-color 120ms;
}

.reply-chip:hover:not([disabled]) {
  background: rgba(197, 56, 14, 0.10);
  border-color: var(--accent);
}

.reply-chip[disabled] {
  opacity: 0.45;
  cursor: not-allowed;
}

.reply-chip .cost {
  color: var(--subtle);
  font-size: 11px;
  margin-left: 6px;
}

/* Inline form inside Tim chat */

.lead-form {
  margin: 10px 0;
  padding: 12px;
  background: var(--panel-2);
  border: 1px solid var(--accent);
  border-radius: 10px;
}

.lead-form-header {
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 8px;
  letter-spacing: 0.02em;
}

.lead-field { display: block; margin-bottom: 9px; }
.lead-field span { display: block; font-size: 11px; color: var(--muted); margin-bottom: 3px; }
.lead-field input, .lead-field textarea {
  display: block;
  width: 100%;
  padding: 8px 10px;
  background: var(--bg);
  color: var(--fg);
  border: 1px solid var(--border);
  border-radius: 6px;
  font-family: inherit;
  font-size: 13px;
  resize: vertical;
  -webkit-appearance: none;
}
.lead-field input:focus, .lead-field textarea:focus {
  outline: none;
  border-color: var(--accent);
}
.lead-form-actions { display: flex; gap: 6px; margin-top: 4px; }
.lead-submit, .lead-cancel {
  padding: 8px 14px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--fg);
  font-family: inherit;
  font-size: 12px;
  cursor: pointer;
  border-radius: 6px;
}
.lead-submit { border-color: var(--accent); }
.lead-submit:hover:not([disabled]) { background: rgba(197, 56, 14, 0.12); }
.lead-submit[disabled] { opacity: 0.55; cursor: not-allowed; }
.lead-status { margin-top: 6px; font-size: 11px; color: var(--muted); min-height: 1.2em; }
.lead-status.err { color: var(--accent); }

/* ========== Action dock (global, always visible) ========== */

#action-dock {
  background: linear-gradient(180deg, var(--panel) 0%, #121a24 100%);
  border-top: 1px solid var(--border);
  padding: 12px 18px 14px;
  flex-shrink: 0;
  box-shadow: 0 -4px 14px rgba(0, 0, 0, 0.3);
}

.dock-topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
}

#audio-toggle {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--fg);
  width: 32px;
  height: 32px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 14px;
  flex-shrink: 0;
  transition: background 160ms, border-color 160ms;
}

#audio-toggle:hover {
  background: var(--panel-2);
  border-color: var(--accent);
}

.dock-label {
  font-size: 11px;
  color: var(--muted);
  margin-bottom: 0;
  font-variant-numeric: tabular-nums;
  font-family: "SF Mono", "Menlo", monospace;
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dock-label span {
  color: var(--fg);
}

.dock-label #dock-cash.neg { color: var(--accent); }
.dock-label #dock-cash.low { color: var(--warn); }

.dock-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 8px;
  padding: 6px 2px 2px; /* room for badges that extend top/right */
  overflow: visible;
}

.dock-btn {
  padding: 10px 16px;
  background: rgba(255, 255, 255, 0.05);
  color: var(--fg);
  border: 1px solid rgba(255, 255, 255, 0.09);
  border-radius: 12px;
  font-family: inherit;
  font-size: 12.5px;
  font-weight: 500;
  cursor: pointer;
  transition: background 160ms, border-color 160ms, transform 120ms, box-shadow 160ms;
  position: relative;
  /* overflow: visible so badges can overflow the button corner */
  overflow: visible;
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}

.dock-btn:hover:not([disabled]) {
  background: rgba(255, 107, 61, 0.14);
  border-color: var(--accent);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(255, 107, 61, 0.2);
}

.dock-btn:active:not([disabled]) {
  animation: dockRipple 240ms ease-out;
}

.dock-btn[disabled] {
  opacity: 0.4;
  cursor: not-allowed;
}

.dock-btn .dock-cost {
  color: var(--subtle);
  font-size: 10px;
  margin-left: 4px;
  font-weight: 400;
}

/* Primary action — larger, filled, pronounced */
.dock-btn.primary {
  background: linear-gradient(135deg, var(--accent) 0%, #e14f1f 100%);
  color: #ffffff;
  border-color: transparent;
  padding: 12px 18px;
  font-size: 13.5px;
  font-weight: 700;
  letter-spacing: -0.01em;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.35);
  box-shadow: 0 6px 18px rgba(255, 107, 61, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.22);
}

.dock-btn.primary .dock-label {
  color: #ffffff;
  font-weight: 700;
}

.dock-btn.primary:hover:not([disabled]) {
  background: linear-gradient(135deg, #ff7d52 0%, #ff5a29 100%);
  transform: translateY(-2px);
  box-shadow: 0 8px 22px rgba(255, 107, 61, 0.5), inset 0 1px 0 rgba(255, 255, 255, 0.25);
}

.dock-btn.primary .dock-cost {
  color: #fff1e6;
  font-weight: 600;
  opacity: 0.92;
}

@keyframes dockRipple {
  0%   { transform: scale(1); }
  50%  { transform: scale(0.97); }
  100% { transform: scale(1); }
}

/* End-day pulse alert when hours ≤ 2 */
.dock-btn.pulse {
  animation: dockPulse 1.2s ease-in-out infinite;
  border-color: var(--accent);
  box-shadow: 0 0 0 0 rgba(197, 56, 14, 0.5);
}

@keyframes dockPulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(197, 56, 14, 0.5); }
  50%      { box-shadow: 0 0 0 8px rgba(197, 56, 14, 0); }
}

/* Night transition overlay */
.night-overlay {
  position: fixed;
  inset: 0;
  background: rgba(5, 6, 10, 0.96);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 900;
  opacity: 0;
  transition: opacity 400ms ease-in-out;
}

.night-overlay.active {
  display: flex;
  opacity: 1;
}

.night-content {
  text-align: center;
  color: var(--fg);
}

.night-icon {
  font-size: 48px;
  margin-bottom: 12px;
  animation: nightFloat 2s ease-in-out infinite;
}

.night-text {
  font-size: 15px;
  color: var(--muted);
  letter-spacing: 0.02em;
}

@keyframes nightFloat {
  0%, 100% { transform: translateY(0); }
  50%      { transform: translateY(-6px); }
}

/* ========== Footer ========== */

#footer {
  padding: 8px 16px 10px;
  background: var(--panel);
  border-top: 1px solid var(--border);
  font-size: 10px;
  color: var(--subtle);
  flex-shrink: 0;
  text-align: center;
}

#footer a {
  color: var(--muted);
  text-decoration: none;
  border-bottom: 1px dotted var(--subtle);
}

#footer a:hover { color: var(--fg); border-bottom-color: var(--fg); }

/* ========== Overlays (intro, win, lose) ========== */

.overlay {
  position: fixed;
  inset: 0;
  background: rgba(10, 11, 14, 0.88);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 1000;
  animation: overlayFade 300ms ease-out;
}

@keyframes overlayFade {
  from { opacity: 0; }
  to { opacity: 1; }
}

.overlay-card {
  max-width: 540px;
  width: 100%;
  max-height: 92vh;
  overflow-y: auto;
  background: var(--panel);
  border: 1px solid var(--border-strong);
  border-radius: 16px;
  padding: 28px 28px 24px;
  box-shadow: 0 12px 60px rgba(0, 0, 0, 0.6);
}

.intro-title {
  font-size: 28px;
  font-weight: 700;
  color: var(--fg);
  margin: 0 0 4px 0;
  letter-spacing: -0.01em;
}

.intro-sub {
  font-size: 12px;
  color: var(--subtle);
  margin-bottom: 20px;
  font-family: "SF Mono", "Menlo", monospace;
}

.intro-body p {
  margin: 0 0 12px 0;
  color: var(--fg);
  font-size: 14px;
  line-height: 1.65;
}

.intro-body p.intro-hint {
  color: var(--muted);
  font-size: 13px;
  font-style: italic;
  margin-top: 16px;
}

.overlay-kicker {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.15em;
  color: var(--accent);
  margin-bottom: 14px;
}

.win-card .overlay-kicker { color: var(--ok); }

.overlay-stats {
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 16px;
  font-family: "SF Mono", "Menlo", monospace;
  font-variant-numeric: tabular-nums;
}

.overlay-reason {
  font-size: 14px;
  color: var(--accent);
  margin-bottom: 14px;
  font-weight: 600;
}

.overlay-body p {
  margin: 0 0 10px 0;
  color: var(--fg);
  font-size: 14px;
  line-height: 1.65;
}

.overlay-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 22px;
}

.primary-btn, .secondary-btn {
  display: inline-block;
  padding: 12px 18px;
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  text-align: center;
  text-decoration: none;
  border-radius: 10px;
  cursor: pointer;
  border: 1px solid transparent;
  transition: background 120ms, border-color 120ms;
}

.primary-btn {
  background: var(--accent);
  color: var(--fg);
  border-color: var(--accent);
}

.primary-btn:hover {
  background: rgba(197, 56, 14, 0.85);
}

.secondary-btn {
  background: transparent;
  color: var(--fg);
  border-color: var(--border-strong);
}

.secondary-btn:hover {
  background: var(--panel-2);
  border-color: var(--fg);
}

/* SPRINT 14 — "Turn on computer" CTA on contacts list */
.contacts-lamp-btn {
  display: block;
  width: calc(100% - 24px);
  margin: 14px auto 10px;
  padding: 16px 20px;
  background: linear-gradient(135deg, var(--accent) 0%, #e14f1f 100%);
  color: #fff;
  border: none;
  border-radius: 14px;
  font-family: inherit;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  text-align: center;
  letter-spacing: -0.01em;
  box-shadow: 0 6px 18px rgba(255, 107, 61, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.22);
  animation: lampPulse 2s ease-in-out infinite;
}
.contacts-lamp-btn:hover {
  background: linear-gradient(135deg, #ff7d52 0%, #ff5a29 100%);
  transform: translateY(-1px);
}
@keyframes lampPulse {
  0%, 100% { box-shadow: 0 6px 18px rgba(255, 107, 61, 0.4); }
  50%      { box-shadow: 0 6px 24px rgba(255, 107, 61, 0.65); }
}

/* Desktop: hide mobile-only elements */
#chat-back { display: none; }
#mobile-list-hud { display: none; }

/* SPRINT 13 — AI automation indicator on dock buttons */
.dock-btn.auto-ai {
  background: linear-gradient(135deg, rgba(101, 199, 126, 0.14) 0%, rgba(101, 199, 126, 0.06) 100%) !important;
  border-color: rgba(101, 199, 126, 0.45) !important;
  opacity: 0.88;
  position: relative;
}
.dock-btn.auto-ai .dock-label {
  color: #86d69a !important;
}
.dock-btn.auto-ai .dock-cost {
  color: rgba(134, 214, 154, 0.7) !important;
}
.dock-btn.auto-ai::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: linear-gradient(90deg, transparent 0%, rgba(101, 199, 126, 0.12) 50%, transparent 100%);
  animation: autoAiPulse 2.4s ease-in-out infinite;
  pointer-events: none;
}
@keyframes autoAiPulse {
  0%, 100% { opacity: 0; transform: translateX(-100%); }
  50%      { opacity: 1; transform: translateX(0); }
  99%      { opacity: 0; transform: translateX(100%); }
}

/* SPRINT 12 — Crisis banner (persistent resource warning) */
.crisis-banner {
  display: block;
  padding: 9px 16px;
  text-align: center;
  font-size: 12.5px;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: #ffffff;
  z-index: 20;
  flex-shrink: 0;
}
.crisis-banner.warn {
  background: linear-gradient(90deg, rgba(255,181,71,0.18) 0%, rgba(255,181,71,0.30) 50%, rgba(255,181,71,0.18) 100%);
  border-top: 1px solid rgba(255,181,71,0.5);
  border-bottom: 1px solid rgba(255,181,71,0.5);
  color: #ffd07a;
}
.crisis-banner.crit {
  background: linear-gradient(90deg, rgba(255,69,32,0.25) 0%, rgba(255,69,32,0.45) 50%, rgba(255,69,32,0.25) 100%);
  border-top: 1px solid rgba(255,69,32,0.7);
  border-bottom: 1px solid rgba(255,69,32,0.7);
  color: #ff9873;
  animation: crisisBannerPulse 1.4s ease-in-out infinite;
}
@keyframes crisisBannerPulse {
  0%, 100% { opacity: 1; }
  50%      { opacity: 0.72; }
}

/* SPRINT 23 — Crisis banner placement responsive policy:
   - Desktop (>640px): hide top #crisis-banner, show in-chat #crisis-banner-chat
     (between chat-pinned and chat-thread, so user sees it without looking up)
   - Mobile (≤640px): hide #crisis-banner-chat (saves chat space), use top banner */
/* SPRINT 24 — HUD pill cursor signal that tooltips exist */
.r-pill[title], .r-pill[data-tip] {
  cursor: help;
}

/* SPRINT 32 — Custom tooltip popup (replaces native title — works on touch) */
.hud-tooltip {
  position: fixed;
  z-index: 500;
  max-width: 280px;
  padding: 10px 14px;
  background: rgba(20, 28, 38, 0.97);
  color: #fff;
  border: 1px solid rgba(255, 107, 61, 0.4);
  border-radius: 10px;
  font-size: 12.5px;
  line-height: 1.45;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  pointer-events: none;
  letter-spacing: 0.01em;
}

/* SPRINT 28 — dock collapse button (rotation icon next to audio) */
#dock-collapse {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--fg);
  width: 32px;
  height: 32px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 14px;
  flex-shrink: 0;
  transition: background 160ms, border-color 160ms;
}
#dock-collapse:hover {
  background: var(--panel-2);
  border-color: var(--accent);
}

/* SPRINT 28 — collapsed dock hides buttons + HUD, only topbar visible */
body.dock-collapsed .dock-buttons,
body.dock-collapsed .resource-hud {
  display: none !important;
}
body.dock-collapsed #action-dock {
  max-height: none !important;
  padding-top: 4px;
  padding-bottom: 4px;
}

/* SPRINT 29 — rescue overlay accent */
.rescue-card {
  border-left: 4px solid var(--accent);
}
.rescue-card .overlay-kicker {
  color: var(--accent);
}
.rescue-card .overlay-actions button {
  width: 100%;
}

/* SPRINT 30 — Telegram CTA secondary variant (rescue overlay) */
.rescue-card .tg-cta.secondary-btn {
  border-color: #2b5278;
  color: #7cc4ff;
}
.rescue-card .tg-cta.secondary-btn:hover {
  background: rgba(43, 82, 120, 0.18);
  border-color: #57a3ff;
  color: #fff;
}

/* SPRINT 42 — win overlay confetti burst */
.confetti {
  position: fixed;
  z-index: 1100;
  pointer-events: none;
  border-radius: 2px;
  will-change: transform, top, left, opacity;
  box-shadow: 0 0 6px rgba(0, 0, 0, 0.18);
}

/* SPRINT 28 — beautiful ending hero images */
.ending-hero {
  display: block;
  width: 100%;
  max-height: 280px;
  object-fit: cover;
  border-radius: 12px;
  margin-bottom: 20px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
}

/* SPRINT 27 — rent countdown pill */
.r-pill.r-rent {
  background: rgba(255, 181, 71, 0.10);
  border-color: rgba(255, 181, 71, 0.35);
}
.r-pill.r-rent.warn {
  background: rgba(255, 181, 71, 0.18);
  border-color: rgba(255, 181, 71, 0.55);
  color: #ffd07a;
}
.r-pill.r-rent.crit {
  background: rgba(255, 69, 32, 0.18);
  border-color: rgba(255, 69, 32, 0.6);
  color: #ff9873;
  animation: critPulse 1.8s ease-in-out infinite;
}
/* SPRINT 31 — rent bar inverted color (fill = urgency, not health).
   SPRINT 32 fix: !important to override later generic .r-pill.ok .r-fill rule
   that wins on equal specificity. */
.r-pill.r-rent .r-fill { background: var(--warn) !important; }
.r-pill.r-rent.warn .r-fill { background: var(--warn) !important; }
.r-pill.r-rent.crit .r-fill { background: var(--accent) !important; }

.crisis-banner-chat {
  margin: 6px 18px 4px;
  border-radius: 8px;
  padding: 8px 14px;
  font-size: 12px;
}
@media (min-width: 641px) {
  /* Desktop: top banner hidden, in-chat banner active */
  #crisis-banner { display: none !important; }
}
@media (max-width: 640px) {
  /* Mobile: in-chat banner hidden (top banner stays) */
  #crisis-banner-chat { display: none !important; }
}

/* ========== Mobile ≤640px — navigation stack: list view ↔ chat view ========== */

@media (max-width: 640px) {
  html, body { overflow: hidden; }
  #app {
    max-width: 100%;
    box-shadow: none;
    height: 100dvh;
    display: flex;
    flex-direction: column;
  }

  /* Messenger is the stack container */
  #messenger {
    display: block !important;
    position: relative;
    flex: 1;
    min-height: 0;
    grid-template-columns: none !important;
    grid-template-rows: none !important;
  }

  /* List view — contacts occupy the stack, visible by default */
  #contacts {
    display: flex;
    flex-direction: column;
    position: absolute;
    inset: 0;
    z-index: 1;
    background: var(--panel);
    border-right: none;
    border-bottom: none;
    max-height: none;
    overflow: hidden;
  }

  /* Chat view — slides in from right when contact tapped */
  #chat {
    position: absolute;
    inset: 0;
    z-index: 2;
    background: var(--bg);
    transform: translateX(100%);
    transition: transform 280ms cubic-bezier(0.22, 1, 0.36, 1);
    display: flex;
    flex-direction: column;
  }

  body.chat-open #chat {
    transform: translateX(0);
  }

  /* Back button (visible only on mobile) */
  #chat-back {
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--accent) 0%, #e14f1f 100%);
    border: none;
    border-radius: 10px;
    color: #ffffff;
    font-size: 24px;
    font-weight: 700;
    line-height: 1;
    padding: 0 16px;
    margin-right: 10px;
    cursor: pointer;
    flex-shrink: 0;
    min-width: 44px;
    min-height: 40px;
    box-shadow: 0 3px 10px rgba(255, 107, 61, 0.3);
  }
  #chat-back:active {
    transform: scale(0.95);
  }
  #chat-header {
    display: flex;
    align-items: center;
    padding: 10px 12px 8px;
  }
  #chat-header .chat-header-text {
    flex: 1;
    min-width: 0;
  }
  /* Compact dock — max 45vh so chat thread stays visible */
  #action-dock {
    padding: 0 10px 6px;
    max-height: 44vh;
    overflow-y: auto;
  }
  .resource-hud {
    padding: 6px 4px 4px !important;
  }
  .dock-buttons {
    gap: 4px !important;
  }
  .dock-btn {
    min-height: 36px !important;
    padding: 6px 8px !important;
  }
  .dock-btn.primary {
    min-height: 44px !important;
    padding: 8px 12px !important;
  }

  #contacts-header {
    padding: 8px 12px 6px;
  }

  .brand-circle { width: 34px; height: 34px; }
  .brand-title { font-size: 13px; }
  .brand-subtitle { font-size: 10px; }

  #folder-tabs {
    padding: 4px 10px 4px;
    gap: 3px;
  }

  .folder-tab {
    padding: 4px 9px;
    font-size: 11px;
  }

  #contacts-list {
    flex: 1;
    overflow-y: auto;
    padding: 2px 0;
    max-height: none;
  }

  .contact-item {
    padding: 6px 10px;
  }

  .contact-avatar {
    width: 32px;
    height: 32px;
    font-size: 12px;
    margin-right: 8px;
  }

  .contact-name { font-size: 12.5px; }
  .contact-preview { font-size: 11px; }

  #chat-header {
    padding: 8px 12px 6px;
  }
  #chat-title { font-size: 13px; }
  #chat-subtitle { font-size: 10.5px; }

  #chat-thread {
    flex: 1;
    min-height: 0;
    padding: 10px 12px 4px;
    gap: 2px;
    overflow-y: auto;
  }

  .bubble {
    max-width: 86%;
    font-size: 13px;
    padding: 7px 11px 6px;
  }

  #chat-actions {
    padding: 6px 12px 8px;
  }

  .reply-chip {
    font-size: 12px;
    padding: 7px 10px;
  }

  #action-dock {
    padding: 0 10px 8px;
    flex-shrink: 0;
    max-height: 50vh;
    overflow-y: auto;
    display: none;
  }
  body.chat-open #action-dock {
    display: block;
  }
  /* List view: compact HUD-only bar at bottom replaces action-dock */
  #mobile-list-hud {
    display: none;
    padding: 6px 10px 8px;
    background: var(--panel);
    border-top: 1px solid var(--border);
    flex-shrink: 0;
  }
  body:not(.chat-open) #mobile-list-hud {
    display: block;
  }
  #mobile-list-hud .resource-hud {
    padding: 0;
    margin: 0;
    border: none;
  }

  .resource-hud {
    padding: 8px 6px 6px;
    gap: 4px;
    margin-bottom: 6px;
  }
  .r-pill {
    padding: 3px 7px 3px 5px;
    font-size: 11px;
    gap: 3px;
  }
  .r-pill .r-bar { width: 20px; height: 3px; }
  .r-pill .r-icon { font-size: 11.5px; }
  .r-pill .r-max { font-size: 10px; }

  .dock-hint { font-size: 9.5px; }
  #audio-toggle { width: 28px; height: 28px; font-size: 12px; }

  .dock-buttons {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 5px;
  }

  .dock-btn {
    font-size: 11.5px;
    padding: 8px 10px;
    min-height: 40px;
  }
  .dock-btn.primary {
    grid-column: 1 / -1;
    padding: 10px 14px;
    font-size: 13px;
  }
  .dock-btn .dock-cost {
    font-size: 9.5px;
    display: block;
    margin-left: 0;
    margin-top: 1px;
    opacity: 0.75;
  }
  .dock-btn .dock-badge {
    top: -5px;
    right: -5px;
    min-width: 18px;
    height: 18px;
    font-size: 10px;
    line-height: 18px;
  }

  .bank-balance-card {
    margin: 8px 12px 4px;
    padding: 10px 14px;
  }
  .bb-value { font-size: 22px; }

  .intro-title { font-size: 24px; }
  .overlay-card { padding: 24px 20px 22px; }
  .lead-field input, .lead-field textarea { font-size: 16px; /* avoid iOS zoom */ }
}

/* SPRINT 14 — hide irrelevant disabled buttons on mobile */
@media (max-width: 640px) {
  .dock-btn.mobile-hide {
    display: none !important;
  }
  /* SPRINT 17 — hide desktop keyboard shortcut hint on mobile */
  .desktop-hint {
    display: none !important;
  }
}

/* SPRINT 17 — Desktop keyboard shortcut hint */
.desktop-hint {
  color: var(--subtle);
  font-size: 10px;
  cursor: help;
  border-bottom: 1px dotted var(--subtle);
}

@media (max-width: 380px) {
  .dock-buttons .dock-btn { flex: 1 1 auto; min-width: calc(50% - 3px); }
}

/* ========== v2.1 BLOCK C — Resource HUD (now inside action dock, above buttons) ========== */

.resource-hud {
  display: flex;
  flex-wrap: nowrap;
  overflow-x: auto;
  gap: 6px;
  padding: 10px 14px 8px;
  background: transparent;
  scrollbar-width: none;
  z-index: 5;
  position: relative;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  margin-bottom: 8px;
}
.resource-hud::-webkit-scrollbar { display: none; }

.r-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 10px 5px 8px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.07);
  border-radius: 14px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--fg);
  flex-shrink: 0;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.01em;
}

.r-pill .r-icon {
  font-size: 13px;
  line-height: 1;
}

.r-pill .r-val {
  color: var(--fg);
}

.r-pill .r-max {
  color: var(--subtle);
  font-size: 11px;
  font-weight: 500;
}

.r-pill .r-bar {
  width: 28px;
  height: 4px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 2px;
  overflow: hidden;
  margin-left: 3px;
}

.r-pill .r-fill {
  height: 100%;
  background: var(--ok);
  transition: width 200ms ease;
}

.r-pill.ok   .r-fill { background: var(--ok); }
.r-pill.warn .r-fill { background: var(--warn); }
.r-pill.crit .r-fill { background: var(--accent); }
.r-pill.ok   { border-color: rgba(101, 199, 126, 0.25); }
.r-pill.warn { border-color: rgba(255, 181, 71, 0.3); }
.r-pill.crit {
  border-color: rgba(255, 107, 61, 0.45);
  background: rgba(255, 107, 61, 0.08);
  animation: critPulse 1.8s ease-in-out infinite;
}

@keyframes critPulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(255, 107, 61, 0.3); }
  50%      { box-shadow: 0 0 0 4px rgba(255, 107, 61, 0); }
}

.r-pill.r-cash.crit .r-val { color: var(--accent); }
.r-pill.r-cash.warn .r-val { color: var(--warn); }
.r-pill.r-cash.ok   .r-val { color: var(--ok); }

.r-pill.r-locked {
  background: rgba(255, 107, 61, 0.15);
  border-color: var(--accent);
  color: var(--accent-strong);
  animation: critPulse 2s ease-in-out infinite;
}

/* ===== Dock button badges ===== */

.dock-btn {
  position: relative; /* for badge absolute */
}

.dock-btn .dock-label {
  font-weight: 500;
}

.dock-btn .dock-badge {
  position: absolute;
  top: -8px;
  right: -8px;
  min-width: 22px;
  height: 22px;
  padding: 0 7px;
  border-radius: 11px;
  background: #ff4520;
  color: #ffffff;
  font-size: 12px;
  font-weight: 800;
  line-height: 22px;
  text-align: center;
  box-shadow: 0 3px 10px rgba(255, 69, 32, 0.55), 0 0 0 2px var(--panel);
  pointer-events: none;
  z-index: 3;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.01em;
}

.dock-btn .dock-badge.hot {
  animation: badgePulseHot 1.4s ease-in-out infinite;
}

.dock-btn .dock-badge.pulse {
  animation: badgePulseCrit 1s ease-in-out infinite;
  background: #ff4520;
}

@keyframes badgePulseHot {
  0%, 100% { transform: scale(1); box-shadow: 0 0 0 0 rgba(255, 107, 61, 0.5); }
  50%      { transform: scale(1.08); box-shadow: 0 0 0 6px rgba(255, 107, 61, 0); }
}

@keyframes badgePulseCrit {
  0%, 100% { transform: scale(1); }
  50%      { transform: scale(1.12); }
}

/* ===== New folder tab «💤 прочее» already uses existing .folder-tab ===== */

/* ===== 13 new spam avatar gradients ===== */
.contact-avatar.olya     { background: linear-gradient(135deg, #f5a5c0 0%, #b04d75 100%); }
.contact-avatar.kirill   { background: linear-gradient(135deg, #8b9dc7 0%, #455876 100%); }
.contact-avatar.krypta   { background: linear-gradient(135deg, #ffd166 0%, #f17300 100%); color: #2a1a00; }
.contact-avatar.artur    { background: linear-gradient(135deg, #7c8996 0%, #3a4651 100%); }
.contact-avatar.vera     { background: linear-gradient(135deg, #d4b5e8 0%, #6a4b82 100%); }
.contact-avatar.sosed    { background: linear-gradient(135deg, #94a3b5 0%, #3e4a58 100%); }
.contact-avatar.lyuda    { background: linear-gradient(135deg, #a5b8c9 0%, #4e5d6d 100%); }
.contact-avatar.ozon     { background: linear-gradient(135deg, #4a6fa5 0%, #1c3a66 100%); }
.contact-avatar.taxi     { background: linear-gradient(135deg, #ffe066 0%, #d19e00 100%); color: #2a1f00; }
.contact-avatar.student  { background: linear-gradient(135deg, #7fb5d5 0%, #3a6989 100%); }
.contact-avatar.katya    { background: linear-gradient(135deg, #a5c4a5 0%, #4a7a4a 100%); }
.contact-avatar.teshcha  { background: linear-gradient(135deg, #8d7a9e 0%, #4a3a5c 100%); }
.contact-avatar.marathon { background: linear-gradient(135deg, #ffb5c5 0%, #c45a8a 100%); }

/* Per-contact sender-name color in spam bubbles */
.bubble.incoming[data-from="olya"]     .sender-name { color: #f5a5c0; }
.bubble.incoming[data-from="kirill"]   .sender-name { color: #8b9dc7; }
.bubble.incoming[data-from="krypta"]   .sender-name { color: #ffd166; }
.bubble.incoming[data-from="artur"]    .sender-name { color: #a5b5c5; }
.bubble.incoming[data-from="vera"]     .sender-name { color: #d4b5e8; }
.bubble.incoming[data-from="sosed"]    .sender-name { color: #94a3b5; }
.bubble.incoming[data-from="lyuda"]    .sender-name { color: #a5b8c9; font-style: italic; }
.bubble.incoming[data-from="ozon"]     .sender-name { color: #6a85b5; font-style: italic; }
.bubble.incoming[data-from="taxi"]     .sender-name { color: #ffd166; font-style: italic; }
.bubble.incoming[data-from="student"]  .sender-name { color: #7fb5d5; font-style: italic; }
.bubble.incoming[data-from="katya"]    .sender-name { color: #a5c4a5; font-style: italic; }
.bubble.incoming[data-from="teshcha"]  .sender-name { color: #8d7a9e; font-style: italic; }
.bubble.incoming[data-from="marathon"] .sender-name { color: #ffb5c5; font-style: italic; }

/* ===== BLOCK D — Bank pinned balance card ===== */

#chat-pinned {
  padding: 0;
  margin: 0;
}

.bank-balance-card {
  margin: 12px 18px 6px;
  padding: 14px 18px;
  background: linear-gradient(135deg, #15221a 0%, #1a2a1f 100%);
  border: 1px solid rgba(101, 199, 126, 0.3);
  border-left: 4px solid var(--ok);
  border-radius: 12px;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.3);
}

.bb-label {
  font-size: 10.5px;
  color: #86d69a;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-bottom: 4px;
}

.bb-value {
  font-size: 28px;
  font-weight: 800;
  color: var(--fg);
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
}

.bb-value.neg { color: var(--accent); }

.bb-delta {
  font-size: 12px;
  color: var(--muted);
  margin-top: 2px;
  font-variant-numeric: tabular-nums;
}
.bb-delta.neg { color: var(--accent); }
.bb-delta.pos { color: var(--ok); }

/* ===== BLOCK J — Funnel particles ===== */

.particle {
  position: fixed;
  z-index: 200;
  font-size: 15px;
  line-height: 1;
  pointer-events: none;
  font-weight: 700;
  will-change: transform;
  transition: transform 650ms cubic-bezier(0.28, 1.1, 0.35, 1), opacity 400ms;
}
.particle.blue   { color: #7cc4ff; text-shadow: 0 0 6px rgba(124, 196, 255, 0.5); }
.particle.red    { color: #ff6b3d; text-shadow: 0 0 6px rgba(255, 107, 61, 0.5); }
.particle.money  { color: #65c77e; text-shadow: 0 0 8px rgba(101, 199, 126, 0.6); font-size: 17px; }
.particle.progress  { color: #ffd166; text-shadow: 0 0 6px rgba(255, 209, 102, 0.5); }

/* Dock hint label (replaces old .dock-label one-liner) */
.dock-hint {
  font-size: 10.5px;
  color: var(--subtle);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  flex: 1;
  font-weight: 600;
}

/* SPRINT 01 — Love bonus card in win overlay */
.love-bonus {
  margin: 18px 0 6px;
  padding: 16px 20px;
  background: linear-gradient(135deg, rgba(255, 105, 180, 0.08) 0%, rgba(255, 65, 108, 0.05) 100%);
  border: 1px solid rgba(255, 105, 180, 0.25);
  border-left: 4px solid #ff6b95;
  border-radius: 12px;
}
.love-bonus .love-kicker {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.15em;
  color: #ff6b95;
  margin-bottom: 10px;
}
.love-bonus p {
  margin: 0 0 3px 0;
  font-size: 14px;
  line-height: 1.55;
  color: var(--fg);
}
.love-bonus p.para-gap { margin-top: 6px; }
.love-bonus .love-quiet {
  color: var(--muted);
  font-style: italic;
  font-size: 13px;
  margin-top: 10px;
}

/* Mobile: smaller HUD pills */
@media (max-width: 640px) {
  .resource-hud { padding: 7px 10px; gap: 5px; }
  .r-pill { padding: 4px 8px 4px 6px; font-size: 11.5px; }
  .r-pill .r-bar { width: 22px; }
  .r-pill .r-icon { font-size: 12px; }
  .bank-balance-card { margin: 10px 14px 4px; padding: 12px 14px; }
  .bb-value { font-size: 24px; }
  .love-bonus { margin: 14px 0 4px; padding: 14px 16px; }
}

/* SPRINT 51 — viral share mechanic */
.viral-share-block {
  margin: 16px 0;
  padding: 14px 16px;
  background: rgba(255, 90, 30, 0.08);
  border: 1px solid rgba(255, 90, 30, 0.25);
  border-radius: 8px;
}
.viral-tim-message {
  font-size: 14px;
  color: #d4d4d4;
  margin-bottom: 10px;
  font-style: italic;
}
.viral-card-inline {
  background: rgba(0, 0, 0, 0.35);
  color: #e8e8e8;
  font-family: ui-monospace, 'SF Mono', Menlo, monospace;
  font-size: 13px;
  line-height: 1.5;
  padding: 12px;
  border-radius: 6px;
  margin: 0 0 10px;
  white-space: pre-wrap;
  word-break: break-word;
  overflow-wrap: anywhere;
}
.viral-share-btn {
  background: #ff5a1e;
  color: white;
  border: none;
  padding: 10px 18px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
}
.viral-share-btn:hover { background: #ff7a3e; }

.viral-modal {
  position: fixed; inset: 0; z-index: 10000;
  display: flex; align-items: center; justify-content: center;
}
.viral-modal-backdrop {
  position: absolute; inset: 0;
  background: rgba(0, 0, 0, 0.72);
  backdrop-filter: blur(4px);
}
.viral-modal-card {
  position: relative;
  background: #1a1a1a;
  border: 1px solid #333;
  border-radius: 12px;
  padding: 24px;
  max-width: 520px;
  width: calc(100% - 32px);
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}
.viral-modal-close {
  position: absolute; top: 12px; right: 12px;
  background: none; border: none;
  color: #999; font-size: 20px;
  cursor: pointer; padding: 4px 8px;
}
.viral-modal-close:hover { color: white; }
.viral-modal-title {
  margin: 0 0 16px;
  font-size: 18px;
  color: white;
}
.viral-card-preview {
  background: #0a0a0a;
  color: #e8e8e8;
  font-family: ui-monospace, monospace;
  font-size: 13px;
  line-height: 1.5;
  padding: 14px;
  border-radius: 6px;
  margin: 0 0 16px;
  white-space: pre-wrap;
  word-break: break-word;
  overflow-wrap: anywhere;
  max-height: 35vh;
  overflow-y: auto;
}
.viral-share-buttons {
  display: flex; flex-wrap: wrap; gap: 8px;
}
.viral-platform-btn {
  background: #2a2a2a;
  color: white;
  border: 1px solid #444;
  padding: 8px 14px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 13px;
  flex: 1 1 auto;
  min-width: 100px;
}
.viral-platform-btn:hover { background: #3a3a3a; border-color: #666; }

.viral-toast {
  position: fixed; bottom: 40px; left: 50%; transform: translateX(-50%);
  background: rgba(0, 0, 0, 0.9);
  color: white;
  padding: 12px 20px;
  border-radius: 6px;
  font-size: 14px;
  z-index: 10001;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.4);
  opacity: 1;
  transition: opacity 400ms ease;
}
.viral-toast.fade-out { opacity: 0; }

/* Language overlay (SPRINT 49) */
.lang-card {
  max-width: 420px;
  text-align: center;
}
.lang-overlay-title {
  font-size: 16px;
  color: #c0c0c0;
  margin: 0 0 20px;
  font-weight: normal;
  line-height: 1.5;
}
.lang-overlay-buttons {
  display: flex; flex-direction: column; gap: 10px;
}
.lang-btn {
  background: #2a2a2a;
  color: white;
  border: 1px solid #444;
  padding: 14px 20px;
  border-radius: 8px;
  font-size: 16px;
  cursor: pointer;
}
.lang-btn:hover { background: #3a3a3a; border-color: #ff5a1e; }
