/* ==========================================================================
   AverinSK — 8 Themes, Telegram Desktop/Mobile Navigation, Chat Patterns,
   Audio-Reactive RGB Video Squares, 60fps GPU Transitions
   ========================================================================== */

:root,
html[data-theme="navy"] {
  --bg: #081020;
  --bg-pattern: radial-gradient(circle at 20% 20%, rgba(79, 140, 255, 0.11), transparent 55%),
                radial-gradient(circle at 80% 80%, rgba(56, 189, 248, 0.08), transparent 50%);
  --surface: #0f1a30;
  --surface-2: #162442;
  --surface-3: #1f3159;
  --border: rgba(130, 165, 235, 0.16);
  --text: #eef4ff;
  --text-muted: #93a7cf;
  --accent: #4f8cff;
  --accent-strong: #3474f0;
  --accent-soft: rgba(79, 140, 255, 0.18);
  --bubble-me: #21498c;
  --bubble-me-text: #f3f7ff;
  --bubble-partner: #15233f;
  --bubble-partner-text: #eef4ff;
  --danger: #ff5b6e;
  --online: #2ee59d;
  --shadow: 0 10px 28px rgba(2, 8, 22, 0.45);
}

html[data-theme="crimson-rose"] {
  --bg: #170810;
  --bg-pattern: radial-gradient(circle at 18% 15%, rgba(255, 77, 121, 0.14), transparent 55%),
                radial-gradient(circle at 85% 80%, rgba(244, 63, 94, 0.09), transparent 50%);
  --surface: #240d19;
  --surface-2: #331324;
  --surface-3: #451b31;
  --border: rgba(255, 133, 163, 0.18);
  --text: #fff0f5;
  --text-muted: #d69bb0;
  --accent: #ff4d79;
  --accent-strong: #e63262;
  --accent-soft: rgba(255, 77, 121, 0.2);
  --bubble-me: #9c1d46;
  --bubble-me-text: #fff5f8;
  --bubble-partner: #2c1120;
  --bubble-partner-text: #fff0f5;
  --danger: #ff6b6b;
  --online: #4ade80;
  --shadow: 0 10px 28px rgba(15, 2, 10, 0.5);
}

html[data-theme="dark"] {
  --bg: #0c0d10;
  --bg-pattern: radial-gradient(circle at 25% 15%, rgba(124, 107, 255, 0.08), transparent 50%);
  --surface: #15171c;
  --surface-2: #1e2128;
  --surface-3: #282c36;
  --border: rgba(255, 255, 255, 0.1);
  --text: #f3f4f6;
  --text-muted: #9ca3af;
  --accent: #7c6bff;
  --accent-strong: #6351f5;
  --accent-soft: rgba(124, 107, 255, 0.18);
  --bubble-me: #4739a8;
  --bubble-me-text: #f9fafb;
  --bubble-partner: #1d2027;
  --bubble-partner-text: #f3f4f6;
  --danger: #f87171;
  --online: #34d399;
  --shadow: 0 10px 28px rgba(0, 0, 0, 0.55);
}

html[data-theme="emerald"] {
  --bg: #061714;
  --bg-pattern: radial-gradient(circle at 20% 20%, rgba(16, 185, 129, 0.12), transparent 55%);
  --surface: #0c231e;
  --surface-2: #13322b;
  --surface-3: #1b443b;
  --border: rgba(52, 211, 153, 0.18);
  --text: #ecfdf5;
  --text-muted: #86c7b4;
  --accent: #10b981;
  --accent-strong: #059669;
  --accent-soft: rgba(16, 185, 129, 0.2);
  --bubble-me: #0d6e52;
  --bubble-me-text: #ecfdf5;
  --bubble-partner: #112c26;
  --bubble-partner-text: #ecfdf5;
  --danger: #fb7185;
  --online: #34d399;
  --shadow: 0 10px 28px rgba(2, 16, 12, 0.5);
}

html[data-theme="violet"] {
  --bg: #110b22;
  --bg-pattern: radial-gradient(circle at 25% 15%, rgba(168, 85, 247, 0.15), transparent 55%),
                radial-gradient(circle at 80% 85%, rgba(236, 72, 153, 0.10), transparent 50%);
  --surface: #191130;
  --surface-2: #241942;
  --surface-3: #302256;
  --border: rgba(192, 132, 252, 0.18);
  --text: #f5f3ff;
  --text-muted: #b8a3e3;
  --accent: #a855f7;
  --accent-strong: #9333ea;
  --accent-soft: rgba(168, 85, 247, 0.2);
  --bubble-me: #6b21a8;
  --bubble-me-text: #faf5ff;
  --bubble-partner: #20163b;
  --bubble-partner-text: #f5f3ff;
  --danger: #fb7185;
  --online: #34d399;
  --shadow: 0 10px 28px rgba(9, 4, 22, 0.55);
}

html[data-theme="amber"] {
  --bg: #18110b;
  --bg-pattern: radial-gradient(circle at 20% 20%, rgba(245, 158, 11, 0.13), transparent 55%);
  --surface: #231911;
  --surface-2: #302217;
  --surface-3: #3f2d1f;
  --border: rgba(251, 191, 36, 0.18);
  --text: #fffbeb;
  --text-muted: #d6b68c;
  --accent: #f59e0b;
  --accent-strong: #d97706;
  --accent-soft: rgba(245, 158, 11, 0.2);
  --bubble-me: #92400e;
  --bubble-me-text: #fffbeb;
  --bubble-partner: #2a1e15;
  --bubble-partner-text: #fffbeb;
  --danger: #f87171;
  --online: #4ade80;
  --shadow: 0 10px 28px rgba(15, 8, 2, 0.55);
}

html[data-theme="light"] {
  --bg: #eef2f9;
  --bg-pattern: radial-gradient(circle at 15% 15%, rgba(59, 110, 246, 0.07), transparent 50%);
  --surface: #ffffff;
  --surface-2: #f4f6fb;
  --surface-3: #e5eaf5;
  --border: rgba(15, 23, 42, 0.1);
  --text: #111827;
  --text-muted: #64748b;
  --accent: #3b6ef6;
  --accent-strong: #2558e3;
  --accent-soft: rgba(59, 110, 246, 0.12);
  --bubble-me: #3b6ef6;
  --bubble-me-text: #ffffff;
  --bubble-partner: #ffffff;
  --bubble-partner-text: #111827;
  --danger: #dc2626;
  --online: #10b981;
  --shadow: 0 10px 28px rgba(15, 23, 42, 0.1);
}

html[data-theme="sakura"] {
  --bg: #fdf2f6;
  --bg-pattern: radial-gradient(circle at 20% 15%, rgba(236, 72, 153, 0.08), transparent 50%);
  --surface: #ffffff;
  --surface-2: #fce7f0;
  --surface-3: #f9d4e3;
  --border: rgba(190, 24, 93, 0.14);
  --text: #3a1224;
  --text-muted: #8b556e;
  --accent: #ec4899;
  --accent-strong: #db2777;
  --accent-soft: rgba(236, 72, 153, 0.14);
  --bubble-me: #db2777;
  --bubble-me-text: #ffffff;
  --bubble-partner: #ffffff;
  --bubble-partner-text: #3a1224;
  --danger: #e11d48;
  --online: #10b981;
  --shadow: 0 10px 28px rgba(131, 24, 67, 0.1);
}

:root {
  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
  --pattern-opacity: 0.16;
}

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: "Plus Jakarta Sans", "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  font-size: 15px;
  line-height: 1.48;
  letter-spacing: -0.01em;
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}

.mono-code {
  font-family: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-variant-numeric: tabular-nums;
}

.hidden {
  display: none !important;
}

button, input, textarea, select {
  font: inherit;
  color: inherit;
}

/* Vector SVG Icons (2px stroke, rounded) */
.ui-svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex-shrink: 0;
  transition: transform 0.18s var(--ease-out), color 0.18s ease, stroke 0.18s ease;
}

/* Auth & Lock Screens */
.auth-screen {
  height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: var(--bg);
  background-image: var(--bg-pattern);
}

.auth-card {
  width: 100%;
  max-width: 400px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 24px;
  padding: 28px 24px;
  box-shadow: var(--shadow);
  animation: modal-in 0.22s var(--ease-out);
}

.auth-brand { text-align: center; margin-bottom: 22px; }
.auth-logo {
  width: 96px;
  height: 96px;
  margin: 0 auto 10px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.auth-logo-transparent { background: transparent; box-shadow: none; }
.brand-logo-img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
  filter: drop-shadow(0 8px 18px rgba(0, 0, 0, 0.35));
}
.auth-brand h1, .auth-brand h2 { margin: 0 0 6px; font-size: 22px; }
.auth-brand p { margin: 0; color: var(--text-muted); font-size: 13px; }
.auth-form { display: flex; flex-direction: column; gap: 14px; }

.info-pill {
  background: var(--accent-soft);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 10px 12px;
  font-size: 13px;
  text-align: center;
}

.code-input, .pin-input {
  text-align: center;
  font-size: 22px;
  font-weight: 700;
  letter-spacing: 0.28em;
}

.verify-actions-row { display: grid; grid-template-columns: 1fr auto; gap: 8px; }
.auth-server-wrap { margin-top: 16px; text-align: center; }
.link-btn { background: transparent; border: none; color: var(--text-muted); font-size: 12px; cursor: pointer; padding: 4px 8px; }
.link-btn:hover { color: var(--accent); }
.auth-server-box {
  margin-top: 10px; padding: 10px; border-radius: 14px;
  background: var(--surface-2); border: 1px solid var(--border);
  display: flex; flex-direction: column; gap: 8px;
}
.auth-server-box input {
  width: 100%; background: var(--surface); border: 1px solid var(--border);
  border-radius: 10px; padding: 8px 10px; font-size: 13px;
}
.presets-row { display: flex; gap: 6px; justify-content: center; flex-wrap: wrap; }

/* Fields & Buttons */
.field { display: flex; flex-direction: column; gap: 6px; font-size: 13px; }
.field > span { color: var(--text-muted); font-weight: 500; }
.field input,
.field textarea,
.field select,
#s-status-text,
#music-search,
#story-caption,
#s-secret-key,
#s-pin-input,
#settings-custom-origin,
.checklist-add-card input,
.checklist-add-card select {
  width: 100%;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 10px 12px;
  outline: none;
  transition: border-color 0.16s ease;
}
.field input:focus,
.field textarea:focus,
.field select:focus,
#s-status-text:focus,
#music-search:focus,
#story-caption:focus,
#s-secret-key:focus,
.checklist-add-card input:focus { border-color: var(--accent); }

.form-error {
  background: rgba(255, 91, 110, 0.14);
  border: 1px solid rgba(255, 91, 110, 0.4);
  color: var(--danger);
  border-radius: 10px;
  padding: 9px 12px;
  font-size: 13px;
}

.btn {
  border: none;
  border-radius: 12px;
  padding: 10px 16px;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: transform 0.12s var(--ease-out), opacity 0.16s ease, background-color 0.16s ease;
}
.btn:active, .icon-btn:active, .composer-icon-btn:active, .send-btn:active, .room-side-item:active, .nav-tab:active, .d-tab:active {
  transform: scale(0.96);
}
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-strong); }
.btn-secondary { background: var(--surface-3); color: var(--text); }
.btn-ghost { background: transparent; border: 1px solid var(--border); color: var(--text); }
.btn-danger { background: rgba(255, 91, 110, 0.16); color: var(--danger); border: 1px solid rgba(255, 91, 110, 0.3); }
.btn-sm { padding: 7px 12px; font-size: 13px; border-radius: 10px; }
.btn-xs { padding: 5px 9px; font-size: 12px; border-radius: 8px; }
.btn-full { width: 100%; }
.mt-sm { margin-top: 10px; }

/* ==========================================================================
   Telegram Two-Column Desktop & Slide-In Mobile Architecture
   ========================================================================== */
.app-shell {
  height: 100dvh;
  max-width: 1240px;
  margin: 0 auto;
  display: flex;
  flex-direction: row;
  background: var(--bg);
  background-image: var(--bg-pattern);
  border-left: 1px solid var(--border);
  border-right: 1px solid var(--border);
  position: relative;
  overflow: hidden;
}

.left-column {
  width: 320px;
  flex-shrink: 0;
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  min-height: 0;
  z-index: 2;
}

.right-workspace {
  flex: 1;
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  position: relative;
  background: var(--bg);
}

.bottom-nav {
  display: none;
}

/* Mobile Telegram slide-in behavior */
@media (max-width: 859px) {
  .app-shell {
    flex-direction: column;
    border-left: none;
    border-right: none;
  }

  .desktop-section-tabs {
    display: none !important;
  }

  .left-column {
    width: 100%;
    flex: 1;
    border-right: none;
  }

  .right-workspace {
    position: fixed;
    inset: 0;
    z-index: 25;
    transform: translateX(100%);
    transition: transform 0.22s var(--ease-out);
    will-change: transform;
  }

  .app-shell.mobile-pane-open .right-workspace {
    transform: translateX(0);
  }

  .app-shell.mobile-pane-open .bottom-nav {
    display: none;
  }

  .bottom-nav {
    flex-shrink: 0;
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    background: var(--surface);
    border-top: 1px solid var(--border);
    padding-bottom: env(safe-area-inset-bottom);
    z-index: 15;
  }
}

.mobile-back-btn {
  display: none;
  background: transparent;
  border: none;
  color: var(--accent);
  width: 34px;
  height: 34px;
  border-radius: 50%;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
}

@media (max-width: 859px) {
  .mobile-back-btn { display: inline-flex; }
}

/* Sidebar Top & Compact Desktop Section Switcher */
.sidebar-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: calc(10px + env(safe-area-inset-top)) 12px 10px;
  border-bottom: 1px solid var(--border);
}

.brand-chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 4px 10px 4px 6px;
  border-radius: 999px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  font-size: 13px;
  font-weight: 800;
}

.brand-chip-img {
  width: 22px;
  height: 22px;
  object-fit: contain;
  display: block;
}

.sidebar-top-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.ping-menu-wrap { position: relative; }
.cozy-ping-menu {
  position: absolute;
  top: 44px;
  right: 0;
  width: 190px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 6px;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  gap: 2px;
  z-index: 40;
  animation: modal-in 0.18s var(--ease-out);
}
.cozy-ping-menu button {
  background: transparent;
  border: none;
  text-align: left;
  padding: 8px 10px;
  border-radius: 10px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
}
.cozy-ping-menu button:hover { background: var(--surface-3); }

.cozy-ping-toast {
  position: absolute;
  top: 14px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 45;
  background: var(--surface-3);
  border: 1px solid var(--accent);
  color: var(--text);
  padding: 8px 16px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 700;
  box-shadow: var(--shadow);
  animation: modal-in 0.2s var(--ease-out);
}

.desktop-section-tabs {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 4px;
  padding: 8px 10px;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
}

.d-tab {
  background: transparent;
  border: 1px solid transparent;
  border-radius: 12px;
  padding: 7px 4px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  transition: background-color 0.16s ease, color 0.16s ease, border-color 0.16s ease;
}

.d-tab:hover { background: var(--surface-2); }
.d-tab.active {
  background: var(--accent-soft);
  color: var(--accent);
  border-color: var(--border);
}
.d-tab.active .ui-svg {
  transform: translateY(-1px);
  fill: rgba(79, 140, 255, 0.16);
}

.nav-tab {
  position: relative;
  background: transparent;
  border: none;
  padding: 8px 4px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
}
.nav-tab.active { color: var(--accent); }
.nav-tab.active .ui-svg { fill: rgba(79, 140, 255, 0.16); transform: translateY(-1px); }

.nav-badge {
  position: absolute;
  top: 4px;
  right: calc(50% - 22px);
  background: var(--accent);
  color: #fff;
  border-radius: 999px;
  padding: 1px 6px;
  font-size: 10px;
  font-weight: 700;
}

.icon-btn {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 7px 9px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  cursor: pointer;
  font-size: 14px;
}
.icon-btn:hover { background: var(--surface-3); }
.icon-btn.quiet-on {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent);
}

.mini-avatar {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 11px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}
.mini-avatar img { width: 100%; height: 100%; object-fit: cover; }

.date-reminder-banner,
.e2ee-banner {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 7px 12px;
  background: var(--accent-soft);
  border-bottom: 1px solid var(--border);
  font-size: 12px;
  font-weight: 600;
}

/* Stories Strip */
.stories-strip {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  overflow-x: auto;
  scrollbar-width: none;
}
.stories-strip::-webkit-scrollbar { display: none; }
.stories-list { display: flex; align-items: center; gap: 10px; }
.story-chip {
  background: transparent;
  border: none;
  padding: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  cursor: pointer;
  flex-shrink: 0;
  max-width: 70px;
}
.story-chip span {
  font-size: 11px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 66px;
}
.story-circle {
  width: 46px;
  height: 46px;
  border-radius: 50%;
  border: 2px solid var(--border);
  padding: 2px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  background: var(--surface-2);
}
.story-circle.unseen { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-soft); }
.story-circle img,
.story-circle .story-thumb-txt {
  width: 100%; height: 100%; border-radius: 50%; object-fit: cover;
  display: flex; align-items: center; justify-content: center; font-size: 13px; font-weight: 700;
}
.story-add-circle { border-style: dashed; border-color: var(--accent); color: var(--accent); font-size: 20px; font-weight: 600; }

/* Rooms List */
.rooms-list-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px 6px;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  font-weight: 700;
}

.rooms-sidebar-list {
  flex: 1;
  overflow-y: auto;
  padding: 6px 8px 14px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.room-side-item {
  width: 100%;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 14px;
  padding: 10px;
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  text-align: left;
  transition: background-color 0.16s ease, border-color 0.16s ease, transform 0.12s var(--ease-out);
}
.room-side-item:hover { background: var(--surface-2); }
.room-side-item.active { background: var(--surface-2); border-color: var(--accent); }
.room-side-icon {
  width: 40px; height: 40px; border-radius: 14px;
  display: flex; align-items: center; justify-content: center; font-size: 19px; flex-shrink: 0;
}
.room-side-meta { min-width: 0; flex: 1; }
.room-side-name { font-weight: 700; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.room-side-sub { font-size: 12px; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.room-unread-pill { background: var(--accent); color: #fff; font-size: 11px; font-weight: 700; border-radius: 999px; padding: 2px 7px; flex-shrink: 0; }

/* Right Workspace Topbar & Tabs */
.tab-panel {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  animation: tab-in 0.2s var(--ease-out);
}

@keyframes tab-in {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}

.topbar {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  padding: calc(8px + env(safe-area-inset-top)) 12px 8px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  z-index: 10;
}

.partner-header-btn {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 10px;
  background: transparent;
  border: none;
  padding: 4px 6px;
  border-radius: 14px;
  cursor: pointer;
  text-align: left;
}
.partner-header-btn:hover { background: var(--surface-2); }

.avatar-ring { position: relative; width: 42px; height: 42px; flex-shrink: 0; border-radius: 50%; padding: 2px; border: 2px solid transparent; }
.avatar-ring.has-story { border-color: var(--accent); }
.avatar-img, .avatar-fallback { width: 100%; height: 100%; border-radius: 50%; object-fit: cover; }
.avatar-fallback { background: var(--accent-soft); color: var(--accent); display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 16px; }
.online-dot { position: absolute; right: 1px; bottom: 1px; width: 10px; height: 10px; border-radius: 50%; background: var(--text-muted); border: 2px solid var(--surface); }
.online-dot.online { background: var(--online); }

.partner-meta { min-width: 0; flex: 1; }
.partner-name-row { display: flex; align-items: center; gap: 5px; }
.partner-name { font-weight: 700; font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.partner-quiet-badge { font-size: 12px; }
.partner-subline { font-size: 12px; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.partner-subline.activity-active { color: var(--accent); font-weight: 600; }

.topbar-actions { display: flex; align-items: center; gap: 6px; flex-shrink: 0; }
.active-room-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px;
  border-radius: 999px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  font-size: 12px;
  max-width: 170px;
}
.active-room-badge strong { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.room-color-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
@media (max-width: 520px) { .active-room-badge { display: none; } }

/* Mini-Player + Queue + Timeline Reactions */
.music-mini-player {
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 8px 12px;
  background: var(--surface-2);
  border-bottom: 1px solid var(--border);
}

.mini-player-main-row { display: flex; align-items: center; gap: 8px; }
.mini-play-btn { width: 32px; height: 32px; border-radius: 50%; border: none; background: var(--accent); color: #fff; cursor: pointer; flex-shrink: 0; }
.mini-track-info { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.mini-together-badge { font-size: 11px; font-weight: 700; color: var(--accent); }
.mini-track-title { font-size: 12px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mini-seek-wrap { position: relative; width: 100%; display: flex; align-items: center; }
.mini-timeline-markers { position: absolute; inset: 0; pointer-events: none; }
.mini-tl-pin {
  position: absolute;
  top: -10px;
  transform: translateX(-50%);
  font-size: 12px;
  line-height: 1;
}
.mini-track-seek, .song-seek { width: 100%; accent-color: var(--accent); cursor: pointer; position: relative; z-index: 1; }
.mini-track-time, .song-time { font-size: 11px; color: var(--text-muted); flex-shrink: 0; }
.mini-close-btn { background: transparent; border: none; color: var(--text-muted); cursor: pointer; padding: 4px; }

.mini-timeline-react-bar {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
}
.mini-react-hint { color: var(--text-muted); font-size: 11px; }
.mini-tl-react {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 2px 8px;
  font-size: 13px;
  cursor: pointer;
}
.mini-queue-drawer {
  display: flex;
  flex-direction: column;
  gap: 4px;
  max-height: 150px;
  overflow-y: auto;
  border-top: 1px solid var(--border);
  padding-top: 6px;
}
.queue-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 5px 8px;
  border-radius: 10px;
  background: var(--surface);
  font-size: 12px;
}
.queue-row.current { border: 1px solid var(--accent); }

/* Pinned Banner */
.pinned-banner {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 7px 12px;
  background: var(--surface-2);
  border-bottom: 1px solid var(--border);
}
.pinned-banner-content {
  flex: 1; min-width: 0; background: transparent; border: none; text-align: left;
  display: flex; align-items: center; gap: 8px; cursor: pointer; padding: 0;
}
.pinned-tag { color: var(--accent); font-weight: 700; font-size: 12px; flex-shrink: 0; }
.pinned-preview-text { font-size: 13px; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pinned-all-btn { background: var(--surface-3); border: none; border-radius: 8px; padding: 4px 9px; font-size: 12px; cursor: pointer; }

/* Chat Feed + Lightweight Telegram Background Pattern Layer */
.chat-feed-wrap {
  position: relative;
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  background-image: var(--bg-pattern);
}

.chat-pattern-layer {
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: var(--pattern-opacity, 0.16);
  background-repeat: repeat;
  z-index: 0;
}

.chat-pattern-layer.is-custom-bg {
  background-repeat: no-repeat;
  background-size: cover;
  background-position: center;
}

.chat-feed {
  position: relative;
  z-index: 1;
  flex: 1;
  overflow-y: auto;
  overscroll-behavior-y: contain;
  overflow-anchor: auto;
  padding: 14px 12px 18px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.load-older-btn {
  align-self: center;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 6px 14px;
  font-size: 12px;
  color: var(--text-muted);
  cursor: pointer;
}

.messages-container { display: flex; flex-direction: column; gap: 8px; }
.date-divider {
  align-self: center;
  margin: 8px 0;
  padding: 4px 12px;
  border-radius: 999px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 12px;
}

.msg-row {
  display: flex;
  flex-direction: column;
  max-width: 84%;
  position: relative;
  contain: layout style;
  animation: msg-pop 0.18s var(--ease-out);
}
@keyframes msg-pop {
  from { opacity: 0; transform: translateY(6px) scale(0.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
@media (min-width: 720px) { .msg-row { max-width: 68%; } }
.msg-row.me { align-self: flex-end; align-items: flex-end; }
.msg-row.partner { align-self: flex-start; align-items: flex-start; }

.msg-row.flash-highlight .msg-bubble { box-shadow: 0 0 0 2px var(--accent), 0 0 18px var(--accent-soft); }

.msg-bubble {
  border-radius: 18px;
  padding: 9px 12px;
  position: relative;
  word-break: break-word;
  border: 1px solid var(--border);
}
.msg-row.me .msg-bubble { background: var(--bubble-me); color: var(--bubble-me-text); border-bottom-right-radius: 6px; }
.msg-row.partner .msg-bubble { background: var(--bubble-partner); color: var(--bubble-partner-text); border-bottom-left-radius: 6px; }
.msg-bubble.circle-bubble { background: transparent !important; border: none !important; box-shadow: none !important; padding: 0 !important; }

.msg-reply-quote {
  border-left: 3px solid var(--accent);
  background: rgba(0, 0, 0, 0.16);
  border-radius: 8px;
  padding: 4px 8px;
  margin-bottom: 6px;
  font-size: 12px;
  cursor: pointer;
}
.msg-reply-quote strong { display: block; font-size: 11px; color: var(--accent); }
.msg-text { white-space: pre-wrap; font-size: 15px; }
.msg-text.encrypted-locked { opacity: 0.78; font-style: italic; font-size: 13px; }

/* Spoiler messages */
.spoiler-wrap { position: relative; border-radius: 12px; overflow: hidden; cursor: pointer; }
.spoiler-content { transition: filter 0.24s ease; }
.spoiler-wrap.masked .spoiler-content { filter: blur(11px); user-select: none; pointer-events: none; }
.spoiler-cover {
  position: absolute; inset: 0; background: rgba(12, 18, 34, 0.45);
  display: flex; align-items: center; justify-content: center; text-align: center;
  padding: 8px; font-size: 12px; font-weight: 700; color: #fff;
}
.spoiler-wrap:not(.masked) .spoiler-cover { display: none; }

.msg-photo { display: block; max-width: min(320px, 70vw); max-height: 360px; border-radius: 12px; cursor: zoom-in; object-fit: cover; }
.msg-video { display: block; max-width: min(340px, 72vw); max-height: 360px; border-radius: 12px; background: #000; }

/* ==========================================================================
   Video Messages: Rounded Square 1:1 with Audio-Reactive RGB Glow (+ Circle/Square modes)
   ========================================================================== */
.vmsg-outer {
  position: relative;
  width: 232px;
  height: 232px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  --rgb-level: 0;
  --rgb-angle: 0deg;
}

.vmsg-rgb-aura {
  position: absolute;
  inset: 2px;
  border-radius: 30px;
  background: conic-gradient(
    from var(--rgb-angle),
    rgba(79, 140, 255, 0.85),
    rgba(255, 77, 121, 0.85),
    rgba(168, 85, 247, 0.85),
    rgba(46, 229, 157, 0.85),
    rgba(79, 140, 255, 0.85)
  );
  opacity: calc(0.14 + var(--rgb-level) * 0.72);
  transform: scale(calc(0.985 + var(--rgb-level) * 0.032));
  transition: opacity 0.14s ease, transform 0.14s ease;
  pointer-events: none;
  z-index: 1;
}

.vmsg-outer.style-circle .vmsg-rgb-aura {
  display: none;
}
.vmsg-outer.style-square .vmsg-rgb-aura {
  display: none;
}

.vmsg-progress-svg {
  position: absolute;
  inset: 0;
  width: 232px;
  height: 232px;
  pointer-events: none;
  z-index: 4;
}

.vmsg-outer:not(.style-circle) .vmsg-progress-svg {
  display: none;
}

.circle-progress-bg { fill: none; stroke: rgba(255, 255, 255, 0.16); stroke-width: 4; }
.circle-progress-fg { fill: none; stroke: var(--accent); stroke-width: 4; stroke-linecap: round; transition: stroke-dashoffset 0.1s linear; }

.vmsg-wrap {
  position: relative;
  width: 222px;
  height: 222px;
  aspect-ratio: 1 / 1;
  flex-shrink: 0;
  border-radius: 26px;
  overflow: hidden;
  isolation: isolate;
  transform: translateZ(0);
  background: var(--surface-2);
  box-shadow: var(--shadow);
  cursor: pointer;
  z-index: 2;
}

.vmsg-outer.style-circle .vmsg-wrap {
  border-radius: 50%;
  -webkit-clip-path: circle(50% at 50% 50%);
  clip-path: circle(50% at 50% 50%);
}

.vmsg-video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
  object-position: center;
  border-radius: inherit;
  pointer-events: none;
  background: transparent;
}

.vmsg-progress-bar {
  position: absolute;
  left: 14px;
  right: 14px;
  top: 10px;
  height: 3px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.22);
  overflow: hidden;
  z-index: 4;
  pointer-events: none;
}
.vmsg-progress-fill {
  height: 100%;
  width: 0%;
  background: #fff;
  transition: width 0.12s linear;
}
.vmsg-outer.style-circle .vmsg-progress-bar { display: none; }

.circle-play-pill {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  width: 46px;
  height: 46px;
  border-radius: 50%;
  background: rgba(8, 16, 32, 0.62);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  pointer-events: none;
  transition: opacity 0.18s ease;
}
.vmsg-wrap.playing .circle-play-pill { opacity: 0; }

.circle-buffer-spinner {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 34px;
  height: 34px;
  margin: -17px 0 0 -17px;
  border-radius: 50%;
  border: 3px solid rgba(255, 255, 255, 0.25);
  border-top-color: #fff;
  pointer-events: none;
  animation: circle-spin 0.75s linear infinite;
  z-index: 4;
}
@keyframes circle-spin { to { transform: rotate(360deg); } }

.circle-mute-btn {
  position: absolute;
  right: 12px;
  bottom: 12px;
  z-index: 5;
  width: 30px;
  height: 30px;
  background: rgba(8, 16, 32, 0.68);
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  cursor: pointer;
}

.circle-duration-pill {
  position: absolute;
  left: 12px;
  bottom: 12px;
  z-index: 5;
  background: rgba(8, 16, 32, 0.65);
  color: #fff;
  border-radius: 999px;
  padding: 2px 8px;
  font-size: 11px;
  pointer-events: none;
}

/* Voice Player Bubble */
.voice-player { display: flex; align-items: center; gap: 10px; min-width: 210px; max-width: 290px; }
.voice-play-btn { width: 36px; height: 36px; border-radius: 50%; border: none; background: var(--accent); color: #fff; cursor: pointer; flex-shrink: 0; display: flex; align-items: center; justify-content: center; }
.voice-track { flex: 1; display: flex; flex-direction: column; gap: 4px; }
.voice-track input[type="range"] { width: 100%; accent-color: var(--accent); }
.voice-meta { display: flex; justify-content: space-between; font-size: 11px; opacity: 0.8; }

/* Music Card Message */
.music-msg-card { display: flex; align-items: center; gap: 10px; min-width: 220px; }
.music-msg-play { width: 38px; height: 38px; border-radius: 12px; border: none; background: var(--accent); color: #fff; cursor: pointer; flex-shrink: 0; }
.music-msg-meta { min-width: 0; flex: 1; }
.music-msg-title { font-weight: 600; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.music-msg-sub { font-size: 11px; opacity: 0.78; }
.msg-file-link { display: inline-flex; align-items: center; gap: 8px; color: inherit; text-decoration: none; padding: 4px 2px; font-weight: 500; }
.msg-meta-row { display: flex; align-items: center; justify-content: flex-end; gap: 6px; margin-top: 4px; font-size: 11px; opacity: 0.75; }
.msg-reactions-row { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 4px; }
.reaction-pill {
  background: var(--surface-2); border: 1px solid var(--border); border-radius: 999px;
  padding: 2px 8px; font-size: 12px; cursor: pointer; display: inline-flex; align-items: center; gap: 4px;
}
.reaction-pill.active { border-color: var(--accent); background: var(--accent-soft); }
.msg-toolbar { display: flex; align-items: center; gap: 3px; margin-top: 3px; opacity: 0.78; }
.msg-toolbar button { background: var(--surface-2); border: 1px solid var(--border); border-radius: 8px; padding: 2px 6px; font-size: 12px; cursor: pointer; }
.msg-toolbar button:hover { opacity: 1; border-color: var(--accent); }

/* Built-in Recorder Panel */
.recording-panel {
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  background: var(--surface-2);
  border-top: 1px solid var(--border);
  animation: modal-in 0.18s var(--ease-out);
}
.circle-preview-outer { position: relative; width: 184px; height: 184px; display: flex; align-items: center; justify-content: center; }
.circle-rec-ring-svg { position: absolute; inset: 0; width: 184px; height: 184px; pointer-events: none; z-index: 3; }
.circle-rec-ring-bg { fill: none; stroke: rgba(255, 255, 255, 0.16); stroke-width: 4; }
.circle-rec-ring-fg { fill: none; stroke: var(--danger); stroke-width: 4; stroke-linecap: round; stroke-dasharray: 680; stroke-dashoffset: 680; transition: stroke-dashoffset 0.25s linear; }
.circle-preview-wrap {
  position: relative; width: 172px; height: 172px; aspect-ratio: 1 / 1;
  border-radius: 26px; overflow: hidden; background: var(--surface-3); z-index: 2;
}
.circle-live-video { width: 100%; height: 100%; object-fit: cover; border-radius: 26px; display: block; }
.circle-live-video.mirror { transform: scaleX(-1); }
.circle-switch-cam-btn {
  position: absolute; right: 6px; bottom: 6px; z-index: 5; width: 34px; height: 34px; border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.28); background: rgba(8, 16, 32, 0.72); color: #fff;
  font-size: 15px; cursor: pointer; display: flex; align-items: center; justify-content: center;
}
.recording-controls-row { width: 100%; display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
.voice-wave-canvas { flex: 1; min-width: 110px; max-width: 240px; height: 32px; border-radius: 8px; background: var(--surface); }
.recording-info { display: flex; align-items: center; gap: 8px; font-weight: 600; font-size: 14px; }
.rec-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--danger); animation: pulse 1s infinite; }
@keyframes pulse { 0%, 100% { opacity: 1; transform: scale(1); } 50% { opacity: 0.4; transform: scale(0.8); } }
.recording-actions { display: flex; gap: 6px; margin-left: auto; }

/* Upload Progress & Reply Bar */
.upload-progress-bar { flex-shrink: 0; padding: 6px 14px; background: var(--surface-2); border-top: 1px solid var(--border); font-size: 12px; }
.progress-track { margin-top: 4px; height: 4px; background: var(--surface-3); border-radius: 999px; overflow: hidden; }
.progress-fill { height: 100%; width: 0%; background: var(--accent); transition: width 0.15s ease; }

.reply-bar { flex-shrink: 0; display: flex; align-items: center; gap: 10px; padding: 7px 14px; background: var(--surface); border-top: 1px solid var(--border); }
.reply-bar-line { width: 3px; height: 28px; border-radius: 2px; background: var(--accent); }
.reply-bar-body { flex: 1; min-width: 0; }
.reply-bar-sender { font-size: 12px; font-weight: 700; color: var(--accent); }
.reply-bar-text { font-size: 12px; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* Composer */
.composer {
  flex-shrink: 0;
  display: flex;
  align-items: flex-end;
  gap: 6px;
  padding: 8px 10px calc(8px + env(safe-area-inset-bottom));
  background: var(--surface);
  border-top: 1px solid var(--border);
  position: relative;
  z-index: 5;
}
.attach-menu-wrap { position: relative; }
.attach-menu {
  position: absolute; bottom: 52px; left: 0; width: 230px; background: var(--surface-2);
  border: 1px solid var(--border); border-radius: 16px; padding: 6px; box-shadow: var(--shadow);
  display: flex; flex-direction: column; gap: 2px; z-index: 30;
  animation: modal-in 0.18s var(--ease-out);
}
.attach-menu button { background: transparent; border: none; text-align: left; padding: 9px 10px; border-radius: 10px; cursor: pointer; font-size: 14px; }
.attach-menu button:hover { background: var(--surface-3); }

.composer-icon-btn {
  width: 38px; height: 38px; border-radius: 50%; border: 1px solid var(--border);
  background: var(--surface-2); cursor: pointer; font-size: 17px;
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.spoiler-toggle.active { border-color: var(--accent); background: var(--accent-soft); box-shadow: 0 0 0 2px var(--accent-soft); }
.msg-input {
  flex: 1; min-height: 38px; max-height: 120px; resize: none; border: 1px solid var(--border);
  border-radius: 20px; background: var(--surface-2); padding: 8px 14px; outline: none; overflow-y: auto;
}
.msg-input:focus { border-color: var(--accent); }
.composer-media-btns { display: flex; gap: 6px; }
.send-btn {
  width: 38px; height: 38px; border-radius: 50%; border: none; background: var(--accent); color: #fff;
  display: flex; align-items: center; justify-content: center; cursor: pointer; flex-shrink: 0;
}
.icon-btn-sm { background: transparent; border: none; color: var(--text-muted); cursor: pointer; padding: 4px 8px; font-size: 16px; }

/* Panels for Checklist, Dates, Music */
.panel-scroll { flex: 1; overflow-y: auto; padding: 16px 14px 24px; display: flex; flex-direction: column; gap: 14px; }
.section-hero { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.section-hero h2 { margin: 0 0 4px; font-size: 19px; }
.section-hero p { margin: 0; font-size: 13px; color: var(--text-muted); }

.checklist-add-card { background: var(--surface); border: 1px solid var(--border); border-radius: 16px; padding: 12px; display: flex; flex-direction: column; gap: 8px; }
.checklist-add-row { display: flex; gap: 8px; flex-wrap: wrap; }
.checklist-add-row input { flex: 2; min-width: 180px; }
.checklist-add-row select { flex: 1; min-width: 120px; }
.chip-filter-row { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 2px; }
.chip-filter { background: var(--surface); border: 1px solid var(--border); border-radius: 999px; padding: 6px 12px; font-size: 13px; cursor: pointer; flex-shrink: 0; }
.chip-filter.active { background: var(--accent); border-color: var(--accent); color: #fff; }
.cards-stack { display: flex; flex-direction: column; gap: 8px; }

.checklist-item { background: var(--surface); border: 1px solid var(--border); border-radius: 14px; padding: 11px 12px; display: flex; align-items: flex-start; gap: 10px; }
.checklist-item.done { opacity: 0.66; }
.checklist-item.done .cl-item-title { text-decoration: line-through; }
.cl-checkbox { width: 22px; height: 22px; margin-top: 2px; accent-color: var(--accent); cursor: pointer; flex-shrink: 0; }
.cl-body { flex: 1; min-width: 0; }
.cl-item-title { font-weight: 600; font-size: 14px; }
.cl-item-note { font-size: 13px; color: var(--text-muted); margin-top: 2px; }
.cl-item-meta { font-size: 11px; color: var(--text-muted); margin-top: 4px; display: flex; gap: 8px; flex-wrap: wrap; }
.cl-cat-badge { background: var(--accent-soft); color: var(--accent); padding: 1px 7px; border-radius: 999px; font-weight: 600; }

.dates-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(270px, 1fr)); gap: 12px; }
.date-card { background: var(--surface); border: 1px solid var(--border); border-radius: 18px; padding: 16px; display: flex; flex-direction: column; gap: 10px; contain: layout style; }
.date-card-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; }
.date-card-title-row { display: flex; align-items: center; gap: 8px; font-size: 16px; font-weight: 700; }
.date-card-actions { display: flex; gap: 4px; }
.date-counter-big { font-size: 23px; font-weight: 800; color: var(--accent); }
.date-counter-sub { font-size: 12px; color: var(--text-muted); }
.date-desc { font-size: 13px; margin: 0; }

/* Modals */
.modal { position: fixed; inset: 0; z-index: 60; display: flex; align-items: center; justify-content: center; padding: 14px; }
.modal-backdrop { position: absolute; inset: 0; background: rgba(4, 8, 18, 0.74); }
.modal-card {
  position: relative; width: 100%; max-width: 440px; max-height: 90dvh; overflow-y: auto;
  background: var(--surface); border: 1px solid var(--border); border-radius: 22px; padding: 20px;
  box-shadow: var(--shadow); z-index: 1; animation: modal-in 0.2s var(--ease-out);
}
.modal-card-lg { max-width: 580px; }
@keyframes modal-in {
  from { opacity: 0; transform: scale(0.96) translateY(6px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}
.modal-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.modal-header h2 { margin: 0; font-size: 18px; }
.modal-close { position: absolute; top: 14px; right: 14px; background: var(--surface-2); border: 1px solid var(--border); width: 32px; height: 32px; border-radius: 50%; cursor: pointer; }
.modal-close-inline { background: var(--surface-2); border: 1px solid var(--border); width: 32px; height: 32px; border-radius: 50%; cursor: pointer; }

.emoji-pick-row, .color-pick-row { display: flex; gap: 8px; flex-wrap: wrap; }
.emoji-pick { width: 36px; height: 36px; border-radius: 10px; background: var(--surface-2); border: 1px solid var(--border); cursor: pointer; font-size: 18px; }
.emoji-pick.active { border-color: var(--accent); background: var(--accent-soft); }
.color-pick { width: 30px; height: 30px; border-radius: 50%; border: 3px solid transparent; cursor: pointer; }
.color-pick.active { border-color: #fff; transform: scale(1.1); }

/* Profile Modal */
.profile-hero { text-align: center; margin-bottom: 16px; }
.profile-avatar-lg-wrap { width: 96px; height: 96px; margin: 0 auto 10px; border-radius: 50%; overflow: hidden; border: 3px solid var(--accent); }
.profile-avatar-lg, .profile-avatar-lg-fallback { width: 100%; height: 100%; object-fit: cover; }
.profile-avatar-lg-fallback { background: var(--accent-soft); color: var(--accent); display: flex; align-items: center; justify-content: center; font-size: 36px; font-weight: 700; }
.profile-hero h2 { margin: 0 0 4px; }
.profile-presence { font-size: 13px; color: var(--text-muted); }
.profile-section { margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--border); }
.section-label { font-size: 12px; text-transform: uppercase; letter-spacing: 0.05em; color: var(--text-muted); font-weight: 700; margin-bottom: 8px; }
.profile-bio { margin: 0; white-space: pre-wrap; }
.status-pill { background: var(--surface-2); border: 1px solid var(--border); border-radius: 14px; padding: 10px 12px; }
.status-song-card { background: var(--surface-2); border: 1px solid var(--border); border-radius: 16px; padding: 12px; }
.song-card-top { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.song-disc { width: 44px; height: 44px; border-radius: 50%; background: var(--accent-soft); display: flex; align-items: center; justify-content: center; font-size: 20px; flex-shrink: 0; }
.song-disc.spinning { animation: spin 4s linear infinite; }
@keyframes spin { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }
.song-card-meta { min-width: 0; }
.song-card-title { font-weight: 700; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.song-card-sub { font-size: 12px; color: var(--accent); }
.song-card-controls { display: flex; align-items: center; gap: 8px; }
.autoplay-hint { margin-top: 8px; font-size: 12px; color: var(--accent); }

/* Settings, 8 Themes & Chat Patterns */
.settings-body { display: flex; flex-direction: column; gap: 16px; }
.settings-group { background: var(--surface-2); border: 1px solid var(--border); border-radius: 16px; padding: 14px; display: flex; flex-direction: column; gap: 10px; }
.my-avatar-row { display: flex; align-items: center; gap: 12px; }
.profile-avatar-md-wrap { width: 60px; height: 60px; border-radius: 50%; overflow: hidden; border: 2px solid var(--accent); flex-shrink: 0; }
.profile-avatar-md, .profile-avatar-md-fallback { width: 100%; height: 100%; object-fit: cover; }
.profile-avatar-md-fallback { background: var(--accent-soft); color: var(--accent); display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 22px; }
.username-badge { font-size: 13px; color: var(--text-muted); margin-bottom: 6px; }
.segmented { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; background: var(--surface); padding: 4px; border-radius: 12px; border: 1px solid var(--border); }
.seg-btn { background: transparent; border: none; border-radius: 9px; padding: 8px; cursor: pointer; font-weight: 600; font-size: 13px; color: var(--text-muted); }
.seg-btn.active { background: var(--accent); color: #fff; }
.song-picker-player { margin-top: 8px; padding: 10px; border-radius: 12px; background: var(--surface); border: 1px solid var(--border); display: flex; flex-direction: column; gap: 8px; }
.song-start-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
.field-inline { display: flex; align-items: center; gap: 6px; font-size: 13px; }
.field-inline input { width: 78px; background: var(--surface-2); border: 1px solid var(--border); border-radius: 8px; padding: 5px 8px; }
.save-feedback { text-align: center; color: var(--online); font-size: 13px; font-weight: 600; }

.theme-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }
.theme-chip {
  background: var(--surface); border: 1px solid var(--border); border-radius: 12px;
  padding: 9px 10px; display: flex; align-items: center; gap: 8px; cursor: pointer; font-size: 13px; font-weight: 600;
}
.theme-chip.active { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-soft); }
.theme-swatch { width: 18px; height: 18px; border-radius: 50%; border: 1px solid rgba(255, 255, 255, 0.25); flex-shrink: 0; }
.swatch-navy { background: linear-gradient(135deg, #0b1324, #4f8cff); }
.swatch-crimson { background: linear-gradient(135deg, #240d19, #ff4d79); }
.swatch-dark { background: linear-gradient(135deg, #0e0f12, #7c6bff); }
.swatch-emerald { background: linear-gradient(135deg, #061714, #10b981); }
.swatch-violet { background: linear-gradient(135deg, #110b22, #a855f7); }
.swatch-amber { background: linear-gradient(135deg, #18110b, #f59e0b); }
.swatch-light { background: linear-gradient(135deg, #ffffff, #3b6ef6); }
.swatch-sakura { background: linear-gradient(135deg, #fdf2f6, #ec4899); }

.pattern-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.pattern-chip {
  background: var(--surface); border: 1px solid var(--border); border-radius: 10px;
  padding: 8px 6px; font-size: 12px; font-weight: 600; cursor: pointer; text-align: center;
}
.pattern-chip.active { border-color: var(--accent); background: var(--accent-soft); }

.hint-text { margin: 0; font-size: 12px; color: var(--text-muted); }
.crypto-env-badge { font-size: 12px; padding: 6px 10px; border-radius: 8px; background: var(--surface); border: 1px solid var(--border); color: var(--accent); }
.key-row { display: flex; gap: 6px; flex-wrap: wrap; }
.key-row input { flex: 1; min-width: 140px; }

/* Music & Important Lists */
.modal-subbar { margin-bottom: 4px; }
.important-list { display: flex; flex-direction: column; gap: 8px; max-height: 60dvh; overflow-y: auto; }
.music-item {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 10px 12px; border-radius: 14px; background: var(--surface); border: 1px solid var(--border); flex-wrap: wrap;
}
.music-item-main { min-width: 160px; flex: 1; }
.music-item-title { font-weight: 600; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.music-item-sub { font-size: 12px; color: var(--text-muted); }
.music-item-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.important-item { padding: 10px 12px; border-radius: 14px; background: var(--surface-2); border: 1px solid var(--border); cursor: pointer; }
.important-item-head { display: flex; justify-content: space-between; font-size: 12px; color: var(--text-muted); margin-bottom: 4px; }

/* Telegram-style Stories */
.story-create-body { display: flex; flex-direction: column; gap: 12px; }
.checkbox-row { display: flex; align-items: center; gap: 8px; font-size: 13px; cursor: pointer; }
.story-bg-picker { display: flex; gap: 10px; }
.bg-dot { width: 34px; height: 34px; border-radius: 50%; border: 2px solid transparent; cursor: pointer; }
.bg-dot.active { border-color: #fff; transform: scale(1.1); }
.bg-sunset { background: linear-gradient(135deg, #ff512f, #dd2476); }
.bg-ocean { background: linear-gradient(135deg, #2193b0, #6dd5ed); }
.bg-rose { background: linear-gradient(135deg, #8e2de2, #ff4d79); }
.bg-midnight { background: linear-gradient(135deg, #0f2027, #2c5364); }

.story-viewer-card {
  position: relative; width: 100%; max-width: 430px; height: min(90dvh, 760px);
  background: #0b0d12; border-radius: 22px; overflow: hidden; display: flex; flex-direction: column;
  z-index: 1; border: 1px solid rgba(255, 255, 255, 0.14); touch-action: none; transition: transform 0.16s ease;
}
.story-progress-bars { display: flex; gap: 4px; padding: 10px 12px 4px; }
.story-pbar { flex: 1; height: 3px; border-radius: 999px; background: rgba(255, 255, 255, 0.25); overflow: hidden; }
.story-pbar-fill { height: 100%; width: 0%; background: #fff; }
.story-viewer-head { display: flex; align-items: center; justify-content: space-between; padding: 6px 14px; color: #fff; gap: 8px; }
.story-author-info { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.sv-time { font-size: 12px; opacity: 0.72; }
.sv-vis-badge { font-size: 11px; background: rgba(255, 255, 255, 0.16); padding: 2px 7px; border-radius: 999px; }
.sv-stage { position: relative; flex: 1; display: flex; align-items: center; justify-content: center; overflow: hidden; user-select: none; }
.sv-media { width: 100%; height: 100%; object-fit: contain; pointer-events: none; }
.sv-text-card { width: 100%; height: 100%; display: flex; align-items: center; justify-content: center; padding: 28px; text-align: center; font-size: 22px; font-weight: 700; color: #fff; white-space: pre-wrap; }
.sv-pause-pill { position: absolute; top: 14px; left: 50%; transform: translateX(-50%); background: rgba(0, 0, 0, 0.65); color: #fff; padding: 4px 12px; border-radius: 999px; font-size: 12px; }
.sv-caption { padding: 8px 14px; color: #fff; background: rgba(0, 0, 0, 0.55); font-size: 14px; }
.sv-footer { padding: 10px 12px; background: rgba(0, 0, 0, 0.75); display: flex; flex-direction: column; gap: 8px; }
.sv-reactions-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.sv-reactions { display: flex; gap: 6px; }
.react-tap { background: rgba(255, 255, 255, 0.14); border: none; border-radius: 999px; padding: 5px 9px; cursor: pointer; font-size: 16px; }
.sv-react-summary { color: #fff; font-size: 13px; }
.sv-reply-form { display: flex; gap: 6px; }
.sv-reply-form input {
  flex: 1; background: rgba(255, 255, 255, 0.14); border: 1px solid rgba(255, 255, 255, 0.24);
  border-radius: 999px; padding: 7px 12px; color: #fff; outline: none; font-size: 13px;
}
.sv-reply-form input::placeholder { color: rgba(255, 255, 255, 0.68); }

/* Lightbox */
.lightbox-wrap { position: relative; z-index: 1; max-width: 94vw; max-height: 90dvh; }
.lightbox-wrap img { max-width: 94vw; max-height: 88dvh; border-radius: 14px; display: block; }
.lightbox-close { position: absolute; top: -12px; right: -12px; width: 34px; height: 34px; border-radius: 50%; border: none; background: var(--surface); color: var(--text); cursor: pointer; box-shadow: var(--shadow); }

/* Emoji Picker & Lightweight Animations */
.emoji-picker-overlay { position: fixed; inset: 0; z-index: 70; display: flex; align-items: flex-end; justify-content: center; padding: 12px; }
@media (min-width: 720px) { .emoji-picker-overlay { align-items: center; } }
.emoji-picker-backdrop { position: absolute; inset: 0; background: rgba(4, 8, 18, 0.55); }
.emoji-picker-card {
  position: relative; z-index: 1; width: 100%; max-width: 420px; max-height: 68dvh;
  background: var(--surface); border: 1px solid var(--border); border-radius: 22px; padding: 12px;
  display: flex; flex-direction: column; gap: 8px; box-shadow: var(--shadow); animation: modal-in 0.18s var(--ease-out);
}
.emoji-picker-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.emoji-picker-title { font-weight: 700; font-size: 14px; }
.emoji-picker-controls { display: flex; align-items: center; gap: 6px; }
.emoji-search-input { width: 100%; background: var(--surface-2); border: 1px solid var(--border); border-radius: 10px; padding: 7px 10px; font-size: 13px; outline: none; }
.emoji-tabs { display: flex; gap: 5px; overflow-x: auto; scrollbar-width: none; padding-bottom: 2px; }
.emoji-tabs::-webkit-scrollbar { display: none; }
.emoji-tab-btn { flex-shrink: 0; background: var(--surface-2); border: 1px solid var(--border); border-radius: 999px; padding: 4px 10px; font-size: 12px; font-weight: 600; cursor: pointer; }
.emoji-tab-btn.active { background: var(--accent); border-color: var(--accent); color: #fff; }
.emoji-grid { flex: 1; overflow-y: auto; display: grid; grid-template-columns: repeat(auto-fill, minmax(42px, 1fr)); gap: 4px; padding: 4px 2px; }
.emoji-cell { height: 42px; border: none; border-radius: 10px; background: transparent; font-size: 24px; display: flex; align-items: center; justify-content: center; cursor: pointer; }
.emoji-cell:hover { background: var(--surface-2); }
.msg-text-emoji-xl { font-size: 38px; line-height: 1.2; }
.emo-inline { display: inline-block; will-change: transform; }

.anim-beat { animation: emo-beat 1.15s ease-in-out infinite; }
.anim-pop { animation: emo-pop 1.35s ease-in-out infinite; }
.anim-float { animation: emo-float 2.2s ease-in-out infinite; }
.anim-spin-slow { animation: emo-spin 6s linear infinite; }
.anim-flicker { animation: emo-flicker 0.9s ease-in-out infinite; }
.anim-twinkle { animation: emo-twinkle 1.6s ease-in-out infinite; }
.anim-flash { animation: emo-flash 1.4s ease-in-out infinite; }
.anim-bounce { animation: emo-bounce 1.2s ease-in-out infinite; }
.anim-shake { animation: emo-shake 1.3s ease-in-out infinite; }
.anim-wobble { animation: emo-wobble 1.6s ease-in-out infinite; }
.anim-sway { animation: emo-sway 2s ease-in-out infinite; }

@keyframes emo-beat { 0%, 100% { transform: scale(1); } 25% { transform: scale(1.18); } 45% { transform: scale(0.96); } 65% { transform: scale(1.12); } }
@keyframes emo-pop { 0%, 100% { transform: scale(1) translateY(0); } 50% { transform: scale(1.18) translateY(-2px); } }
@keyframes emo-float { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-4px); } }
@keyframes emo-spin { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }
@keyframes emo-flicker { 0%, 100% { transform: scale(1) rotate(-2deg); opacity: 1; } 50% { transform: scale(1.14) rotate(3deg); opacity: 0.88; } }
@keyframes emo-twinkle { 0%, 100% { transform: scale(1); opacity: 1; } 50% { transform: scale(1.22); opacity: 0.72; } }
@keyframes emo-flash { 0%, 100% { transform: scale(1); opacity: 1; } 45% { transform: scale(1.16); opacity: 0.65; } }
@keyframes emo-bounce { 0%, 100% { transform: translateY(0) scale(1); } 40% { transform: translateY(-5px) scale(1.08); } }
@keyframes emo-shake { 0%, 100% { transform: rotate(0deg); } 25% { transform: rotate(-8deg); } 75% { transform: rotate(8deg); } }
@keyframes emo-wobble { 0%, 100% { transform: rotate(0deg) scale(1); } 33% { transform: rotate(-6deg) scale(1.06); } 66% { transform: rotate(6deg) scale(1.06); } }
@keyframes emo-sway { 0%, 100% { transform: rotate(-5deg); } 50% { transform: rotate(5deg); } }

@media (prefers-reduced-motion: reduce) {
  .emo-inline, .auth-card, .modal-card, .msg-row, .tab-panel, .right-workspace {
    animation: none !important;
    transition: none !important;
  }
}
