/* ============================================================
   Vanilla — "Aurora" design system
   Dark glass + glow. Accent: electric violet → cyan, pink shimmer.
   Motion is rich but cheap (transform/opacity only, GPU-friendly).
   ============================================================ */
:root {
  --accent: #7a5cff;
  --accent-strong: #6646f5;
  --accent-2: #38d6f5;
  --accent-3: #ff5ca8;
  --accent-gradient: linear-gradient(135deg, #7a5cff 0%, #5b7dff 48%, #38d6f5 100%);
  --glow: rgba(122, 92, 255, 0.42);
  --glow-soft: rgba(122, 92, 255, 0.18);
  --cyan-glow: rgba(56, 214, 245, 0.3);
  --radius: 16px;
  --radius-sm: 11px;
  --ease-spring: cubic-bezier(0.34, 1.45, 0.64, 1);
  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
  --shadow: 0 18px 50px rgba(0, 0, 0, 0.45);
  --shadow-glow: 0 8px 28px var(--glow-soft);
  --font: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --sidebar-w: 340px;
}

[data-theme='dark'] {
  --bg: #0b0c12;
  --bg-elevated: rgba(23, 25, 36, 0.72);
  --bg-solid: #14161f;
  --bg-hover: rgba(255, 255, 255, 0.07);
  --bg-input: rgba(255, 255, 255, 0.055);
  --border: rgba(255, 255, 255, 0.09);
  --border-strong: rgba(255, 255, 255, 0.16);
  --text: #eceef4;
  --text-dim: #9aa1b3;
  --bubble-in: rgba(255, 255, 255, 0.075);
  --bubble-out: transparent;
  --bubble-out-text: #ffffff;
  --danger: #ff5c73;
  --success: #38d996;
  --warning: #ffc857;
  --glass-blur: 14px;
  color-scheme: dark;
}

[data-theme='light'] {
  --bg: #eef0f7;
  --bg-elevated: rgba(255, 255, 255, 0.78);
  --bg-solid: #ffffff;
  --bg-hover: rgba(15, 18, 40, 0.06);
  --bg-input: rgba(15, 18, 40, 0.045);
  --border: rgba(15, 18, 40, 0.12);
  --border-strong: rgba(15, 18, 40, 0.2);
  --text: #171a26;
  --text-dim: #5d6478;
  --bubble-in: #ffffff;
  --bubble-out: transparent;
  --bubble-out-text: #ffffff;
  --danger: #e23b54;
  --success: #12a872;
  --warning: #d99400;
  --glass-blur: 14px;
  color-scheme: light;
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  font-size: 15px;
  line-height: 1.45;
  overscroll-behavior: none;
  position: relative;
}

/* The cinematic background lives in .bg-fx (see Aurora 2.0 section below). */

button { font-family: inherit; }
input, textarea, select {
  font-family: inherit;
  font-size: 15px;
  color: var(--text);
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  width: 100%;
  transition: border-color 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
}
textarea { resize: none; }
input:focus, textarea:focus, button:focus-visible {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--glow-soft);
}
.muted { color: var(--text-dim); }
.small { font-size: 12.5px; }
.spacer { flex: 1; }
[hidden] { display: none !important; }

/* Slim themed scrollbars */
* { scrollbar-width: thin; scrollbar-color: var(--border-strong) transparent; }
*::-webkit-scrollbar { width: 8px; height: 8px; }
*::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 999px; }
*::-webkit-scrollbar-thumb:hover { background: var(--accent); }
*::-webkit-scrollbar-track { background: transparent; }

/* ------------------------------------------------ icons */
.svg-icon { flex: none; display: inline-block; vertical-align: middle; }
.icon-btn .svg-icon { width: 20px; height: 20px; }

/* ------------------------------------------------ buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  color: var(--text);
  padding: 10px 16px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 14.5px;
  font-weight: 600;
  backdrop-filter: blur(var(--glass-blur));
  -webkit-backdrop-filter: blur(var(--glass-blur));
  transition: transform 0.16s var(--ease-spring), box-shadow 0.2s ease,
    background 0.18s ease, border-color 0.18s ease;
}
.btn:hover { background: var(--bg-hover); transform: translateY(-1px); }
.btn:active { transform: scale(0.97); }
.btn.primary {
  background: var(--accent-gradient);
  border: none;
  color: #fff;
  box-shadow: 0 6px 22px var(--glow-soft);
  position: relative;
  overflow: hidden;
}
.btn.primary::after {
  content: '';
  position: absolute; inset: 0;
  background: linear-gradient(105deg, transparent 30%, rgba(255,255,255,0.28) 50%, transparent 70%);
  transform: translateX(-120%);
  transition: transform 0.6s ease;
}
.btn.primary:hover { box-shadow: 0 10px 30px var(--glow); transform: translateY(-1px); }
.btn.primary:hover::after { transform: translateX(120%); }
.btn.ghost { background: transparent; backdrop-filter: none; }
.btn.ghost:hover { background: var(--bg-hover); }
.btn.danger { background: linear-gradient(135deg, #ff5c73, #e23b54); border: none; color: #fff; }
.btn.small { padding: 6px 12px; font-size: 13px; }
.icon-btn {
  background: transparent;
  border: none;
  color: var(--text-dim);
  width: 42px;
  height: 42px;
  border-radius: 50%;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background 0.16s ease, color 0.16s ease, transform 0.16s var(--ease-spring), box-shadow 0.2s ease;
}
.icon-btn:hover {
  background: var(--bg-hover);
  color: var(--text);
  transform: translateY(-1px);
  box-shadow: 0 4px 16px rgba(0,0,0,0.25);
}
.icon-btn:active { transform: scale(0.92); }
.icon-btn.send { color: #fff; background: var(--accent-gradient); box-shadow: 0 5px 18px var(--glow-soft); }
.icon-btn.send:hover { box-shadow: 0 7px 24px var(--glow); color: #fff; }

/* ------------------------------------------------ auth */
.auth-view {
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: 24px;
  padding-top: calc(24px + var(--safe-top));
}
.auth-card {
  width: min(440px, 100%);
  background: var(--bg-elevated);
  backdrop-filter: blur(26px) saturate(1.4);
  -webkit-backdrop-filter: blur(26px) saturate(1.4);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  padding: 30px;
  box-shadow: var(--shadow), inset 0 1px 0 rgba(255,255,255,0.08);
  animation: rise-in 0.5s var(--ease-out) both;
}
@keyframes rise-in {
  from { opacity: 0; transform: translateY(22px) scale(0.97); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
.brand { text-align: center; margin-bottom: 20px; }
.brand h1 {
  font-size: 26px;
  margin: 12px 0 4px;
  background: var(--accent-gradient);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  letter-spacing: 0.4px;
}
.brand-logo {
  border-radius: 14px;
  filter: drop-shadow(0 6px 18px var(--glow));
  animation: logo-float 4.5s ease-in-out infinite;
}
@keyframes logo-float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-5px); }
}
.auth-tabs {
  display: flex; gap: 4px; margin-bottom: 20px;
  background: var(--bg-input); padding: 4px; border-radius: var(--radius-sm);
  border: 1px solid var(--border);
}
.auth-tab {
  flex: 1; padding: 9px; border: none; border-radius: 8px;
  background: transparent; color: var(--text-dim); cursor: pointer; font-size: 14px;
  font-weight: 600;
  transition: color 0.18s ease, background 0.2s ease, box-shadow 0.2s ease;
}
.auth-tab.active {
  background: var(--bg-solid);
  color: var(--text);
  box-shadow: 0 2px 10px rgba(0,0,0,0.28), 0 0 0 1px var(--border);
}
[data-theme='dark'] .auth-tab.active { background: rgba(255,255,255,0.1); }
.auth-form label { display: block; margin-bottom: 14px; font-size: 13.5px; color: var(--text-dim); animation: fade-in 0.3s ease both; }
.auth-form input { margin-top: 6px; }
.auth-form .btn { width: 100%; margin-top: 6px; }
.hint { display: block; font-weight: 400; font-size: 12px; opacity: 0.8; }
.legal-note { font-size: 12px; color: var(--text-dim); background: var(--bg-input); padding: 10px; border-radius: var(--radius-sm); border: 1px solid var(--border); }
@keyframes fade-in { from { opacity: 0; transform: translateY(6px); } }

/* ------------------------------------------------ layout */
.main-view {
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  height: 100dvh;
  padding-top: var(--safe-top);
}
.sidebar {
  border-right: 1px solid var(--border);
  background: var(--bg-elevated);
  backdrop-filter: blur(var(--glass-blur)) saturate(1.3);
  -webkit-backdrop-filter: blur(var(--glass-blur)) saturate(1.3);
  display: flex;
  flex-direction: column;
  min-width: 0;
}
.sidebar-header {
  display: flex; align-items: center; gap: 8px;
  padding: 10px 12px;
}
.sidebar-header h2 {
  flex: 1; font-size: 18px; margin: 0;
  background: linear-gradient(90deg, var(--text), var(--accent-2));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.search-box { padding: 0 12px 10px; position: relative; }
.search-box input { padding-left: 38px; }
.search-box::before {
  content: '';
  position: absolute; left: 24px; top: 50%; transform: translateY(-58%);
  width: 16px; height: 16px;
  background: currentColor;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round'%3E%3Ccircle cx='11' cy='11' r='8'/%3E%3Cline x1='21' y1='21' x2='16.65' y2='16.65'/%3E%3C/svg%3E") center/contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round'%3E%3Ccircle cx='11' cy='11' r='8'/%3E%3Cline x1='21' y1='21' x2='16.65' y2='16.65'/%3E%3C/svg%3E") center/contain no-repeat;
  color: var(--text-dim);
  pointer-events: none;
}
.conversation-list { overflow-y: auto; flex: 1; padding: 4px 8px 12px; }
.conv-item {
  display: flex; gap: 12px; align-items: center;
  width: 100%; text-align: left; padding: 10px 12px;
  background: transparent; border: 1px solid transparent; border-radius: var(--radius-sm);
  cursor: pointer; color: var(--text);
  margin-bottom: 3px;
  transition: background 0.16s ease, transform 0.16s var(--ease-spring), box-shadow 0.2s ease;
  animation: fade-in 0.28s ease both;
}
.conv-item:hover { background: var(--bg-hover); transform: translateX(3px); }
.conv-item.active {
  background: var(--glow-soft);
  border-color: var(--border-strong);
  box-shadow: inset 3px 0 0 var(--accent), 0 4px 18px rgba(0,0,0,0.22);
}
.conv-item .conv-body { flex: 1; min-width: 0; }
.conv-item .conv-top { display: flex; justify-content: space-between; gap: 8px; }
.conv-item .conv-name { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.conv-item .conv-last { color: var(--text-dim); font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: inline-flex; align-items: center; gap: 5px; }
.conv-item .conv-last .svg-icon { width: 14px; height: 14px; color: var(--accent-2); }
.conv-item .conv-time { color: var(--text-dim); font-size: 11.5px; white-space: nowrap; }
.badge {
  background: var(--accent-gradient); color: #fff; border-radius: 999px;
  min-width: 20px; height: 20px; padding: 0 6px;
  display: inline-flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 700;
  box-shadow: 0 3px 12px var(--glow-soft);
  animation: badge-pop 0.3s var(--ease-spring);
}
@keyframes badge-pop { from { transform: scale(0.4); } }

/* ------------------------------------------------ avatars + presence */
.avatar {
  width: 44px; height: 44px; border-radius: 50%; object-fit: cover;
  background: var(--bg-input); border: 1px solid var(--border-strong);
  flex: none;
}
.avatar.large { width: 104px; height: 104px; }
.avatar.placeholder {
  display: inline-flex; align-items: center; justify-content: center;
  font-weight: 700; color: #fff;
  background: var(--accent-gradient);
  border: none;
}
.avatar-wrap { position: relative; flex: none; line-height: 0; }
.avatar-wrap .status-dot {
  position: absolute; right: 0; bottom: 0;
  width: 13px; height: 13px; border-radius: 50%;
  border: 2.5px solid var(--bg-solid);
  background: var(--text-dim);
}
.avatar-wrap .status-dot.online { background: var(--success); box-shadow: 0 0 8px rgba(56,217,150,0.7); }
.avatar-wrap .status-dot.away { background: var(--warning); }
.avatar-wrap .status-dot.dnd { background: var(--danger); }

/* ------------------------------------------------ chat */
.chat-panel { display: flex; flex-direction: column; min-width: 0; background: transparent; }
.chat-placeholder { margin: auto; text-align: center; padding: 32px; animation: fade-in 0.4s ease both; }
.chat-placeholder img { filter: drop-shadow(0 10px 30px var(--glow)); opacity: 0.85; }
.chat-open { display: flex; flex-direction: column; height: 100%; min-height: 0; }
.chat-header {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 14px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-elevated);
  backdrop-filter: blur(var(--glass-blur)) saturate(1.3);
  -webkit-backdrop-filter: blur(var(--glass-blur)) saturate(1.3);
  padding-top: max(8px, var(--safe-top));
  z-index: 4;
}
.peer-meta { flex: 1; min-width: 0; cursor: pointer; }
.peer-meta strong { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.presence { display: block; }
.presence.online { color: var(--success); }
.chat-actions { display: flex; gap: 2px; }

.messages-scroll { flex: 1; overflow-y: auto; padding: 18px 16px 8px; display: flex; flex-direction: column; }
.messages { display: flex; flex-direction: column; gap: 2px; }

.date-sep { text-align: center; margin: 14px 0; }
.date-sep span {
  background: var(--bg-elevated); border: 1px solid var(--border);
  backdrop-filter: blur(var(--glass-blur));
  -webkit-backdrop-filter: blur(var(--glass-blur));
  color: var(--text-dim); font-size: 12px; padding: 4px 12px; border-radius: 999px;
}
.msg-row { display: flex; margin-bottom: 2px; }
.msg-row.out { justify-content: flex-end; }
.msg-row .sender-label { font-size: 12px; color: var(--text-dim); margin: 6px 12px 2px; }
.bubble {
  max-width: min(680px, 78%);
  background: var(--bubble-in);
  border: 1px solid var(--border);
  padding: 9px 13px;
  border-radius: 18px;
  position: relative;
  word-wrap: break-word;
  overflow-wrap: anywhere;
  box-shadow: 0 2px 10px rgba(0,0,0,0.18);
  animation: msg-in 0.24s var(--ease-spring) both;
}
@keyframes msg-in {
  from { opacity: 0; transform: translateY(10px) scale(0.96); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
.msg-row.out .bubble {
  background: linear-gradient(135deg, rgba(122,92,255,0.92), rgba(67,120,255,0.92) 55%, rgba(56,214,245,0.85));
  color: var(--bubble-out-text);
  border: none;
  border-bottom-right-radius: 6px;
  box-shadow: 0 4px 18px var(--glow-soft);
}
.msg-row.in .bubble { border-bottom-left-radius: 6px; }
.bubble.grouped-first { margin-top: 10px; }
.bubble .meta {
  display: flex; gap: 6px; align-items: center; justify-content: flex-end;
  font-size: 11px; opacity: 0.75; margin-top: 3px;
}
.bubble .ticks { display: inline-flex; align-items: center; }
.bubble .ticks .svg-icon { width: 14px; height: 14px; }
.bubble.deleted { font-style: italic; opacity: 0.7; }
.bubble.edited-tag { font-size: 10.5px; opacity: 0.7; }

.quoted {
  border-left: 3px solid var(--accent);
  background: rgba(127,127,127,0.14);
  padding: 6px 10px; border-radius: 8px; margin-bottom: 6px; font-size: 13px;
}
.msg-row.out .quoted { background: rgba(255,255,255,0.18); }
.quoted .q-author { font-weight: 700; font-size: 12px; }
.quoted .q-body { opacity: 0.85; max-height: 40px; overflow: hidden; }

.reactions { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 5px; }
.reaction-chip {
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  border-radius: 999px; padding: 2px 9px; font-size: 13px; cursor: pointer;
  transition: transform 0.14s var(--ease-spring), border-color 0.15s ease;
}
.reaction-chip:hover { transform: scale(1.08); }
.reaction-chip.mine { border-color: var(--accent); box-shadow: 0 0 10px var(--glow-soft); }

.msg-image { max-width: 320px; max-height: 320px; border-radius: 12px; display: block; cursor: pointer; transition: transform 0.2s ease; }
.msg-image:hover { transform: scale(1.015); }
.msg-file {
  display: flex; align-items: center; gap: 10px; text-decoration: none; color: inherit;
  background: rgba(127,127,127,0.14); padding: 10px 12px; border-radius: 10px;
  transition: background 0.15s ease;
}
.msg-file:hover { background: rgba(127,127,127,0.22); }
.msg-file .svg-icon { color: var(--accent-2); }
audio.msg-voice { width: 240px; max-width: 60vw; height: 38px; }
.voice-wrap { display: flex; align-items: center; gap: 8px; min-width: 220px; }
.voice-speed {
  border: 1px solid var(--border); background: transparent; color: inherit;
  border-radius: 999px; padding: 3px 8px; font-size: 12px; cursor: pointer;
}

.unread-divider { display: flex; align-items: center; gap: 10px; margin: 12px 0; color: var(--accent-2); font-size: 12.5px; font-weight: 600; }
.unread-divider::before, .unread-divider::after { content: ''; flex: 1; height: 1px; background: linear-gradient(90deg, transparent, var(--border-strong), transparent); }
.scroll-latest {
  position: absolute; right: 22px; bottom: 130px;
  width: 44px; height: 44px; border-radius: 50%;
  border: 1px solid var(--border-strong);
  background: var(--bg-elevated); color: var(--text);
  backdrop-filter: blur(var(--glass-blur));
  -webkit-backdrop-filter: blur(var(--glass-blur));
  cursor: pointer; box-shadow: var(--shadow); z-index: 5;
  display: inline-flex; align-items: center; justify-content: center;
  transition: transform 0.18s var(--ease-spring), box-shadow 0.2s ease;
  animation: rise-in 0.25s ease both;
}
.scroll-latest:hover { transform: translateY(-2px); box-shadow: 0 10px 26px var(--glow-soft); }
.typing-indicator { padding: 4px 18px 6px; min-height: 20px; display: flex; align-items: center; gap: 6px; }
.typing-dots { display: inline-flex; gap: 4px; align-items: center; }
.typing-dots i {
  width: 6px; height: 6px; border-radius: 50%; background: var(--accent-2);
  animation: typing-bounce 1.1s ease-in-out infinite;
}
.typing-dots i:nth-child(2) { animation-delay: 0.15s; }
.typing-dots i:nth-child(3) { animation-delay: 0.3s; }
@keyframes typing-bounce {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.45; }
  30% { transform: translateY(-5px); opacity: 1; }
}

/* ------------------------------------------------ context menu */
.context-menu {
  position: fixed; z-index: 60;
  background: var(--bg-solid); border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm); box-shadow: var(--shadow);
  min-width: 190px; padding: 6px;
  animation: pop-in 0.16s var(--ease-spring) both;
}
@keyframes pop-in { from { opacity: 0; transform: scale(0.92) translateY(4px); } }
.context-menu button {
  display: flex; width: 100%; gap: 10px; text-align: left; align-items: center;
  background: none; border: none; color: var(--text);
  padding: 9px 10px; border-radius: 8px; cursor: pointer; font-size: 14px;
}
.context-menu button .svg-icon { color: var(--text-dim); width: 17px; height: 17px; }
.context-menu button:hover { background: var(--bg-hover); }
.context-menu button.danger { color: var(--danger); }
.context-menu button.danger .svg-icon { color: var(--danger); }

/* ------------------------------------------------ composer */
.composer {
  border-top: 1px solid var(--border);
  background: var(--bg-elevated);
  backdrop-filter: blur(var(--glass-blur)) saturate(1.3);
  -webkit-backdrop-filter: blur(var(--glass-blur)) saturate(1.3);
  padding: 8px 12px calc(8px + var(--safe-bottom)); position: relative;
}
.composer-row { display: flex; align-items: flex-end; gap: 4px; }
.composer-row textarea { flex: 1; max-height: 140px; min-height: 44px; padding: 11px 14px; border-radius: 22px; }
.reply-preview {
  display: flex; align-items: center; gap: 8px;
  border-left: 3px solid var(--accent);
  background: var(--bg-input); padding: 8px 12px; margin-bottom: 8px; border-radius: 8px;
  animation: rise-in 0.2s ease both;
}
.reply-preview > div { flex: 1; min-width: 0; }
.reply-preview span { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.emoji-picker {
  position: absolute; bottom: calc(100% - 4px); left: 12px;
  width: min(340px, calc(100vw - 24px)); height: 280px;
  background: var(--bg-solid); border: 1px solid var(--border-strong);
  border-radius: var(--radius); box-shadow: var(--shadow);
  overflow-y: auto; padding: 10px; z-index: 20;
  animation: pop-in 0.18s var(--ease-spring) both;
  display: grid; grid-template-columns: repeat(8, 1fr); gap: 2px;
}
.emoji-picker .emoji-cat { grid-column: 1 / -1; color: var(--text-dim); font-size: 12px; font-weight: 700; margin: 8px 2px 2px; }
.emoji-picker button {
  background: none; border: none; font-size: 22px; padding: 4px; cursor: pointer;
  border-radius: 8px; line-height: 1.2; transition: background 0.14s ease, transform 0.14s var(--ease-spring);
}
.emoji-picker button:hover { background: var(--bg-hover); transform: scale(1.15); }

.recording-bar, .upload-preview {
  display: flex; align-items: center; gap: 12px;
  background: var(--bg-input); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 10px 12px; margin-bottom: 8px;
  animation: rise-in 0.2s ease both;
}
.rec-dot { width: 12px; height: 12px; border-radius: 50%; background: var(--danger); box-shadow: 0 0 10px var(--danger); animation: pulse 1s infinite; }
@keyframes pulse { 50% { opacity: 0.3; transform: scale(0.8); } }
.upload-preview progress { flex: 1; }
#upload-preview-content { display: flex; align-items: center; gap: 8px; }
#upload-preview-content img { width: 44px; height: 44px; object-fit: cover; border-radius: 8px; }

/* ------------------------------------------------ drawer & modal */
.backdrop {
  position: fixed; inset: 0;
  background: rgba(5, 6, 10, 0.55);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  z-index: 40;
  animation: fade-to 0.2s ease both;
}
@keyframes fade-to { from { opacity: 0; } }
.drawer {
  position: fixed; top: 0; left: 0; bottom: 0; width: min(360px, 88vw);
  background: var(--bg-solid); border-right: 1px solid var(--border-strong);
  z-index: 41; display: flex; flex-direction: column;
  animation: slide-in 0.24s var(--ease-out);
  box-shadow: var(--shadow);
}
@keyframes slide-in { from { transform: translateX(-16px); opacity: 0.4; } }
.drawer header, .modal header {
  display: flex; align-items: center; padding: 12px 16px;
  border-bottom: 1px solid var(--border);
}
.drawer header h3, .modal header h3 { flex: 1; margin: 0; }
#drawer-body { overflow-y: auto; padding: 12px 16px; }
.user-row {
  display: flex; align-items: center; gap: 12px; padding: 10px; width: 100%;
  background: none; border: 1px solid transparent; border-radius: var(--radius-sm);
  color: var(--text); text-align: left; cursor: pointer;
  transition: background 0.15s ease, transform 0.15s ease;
}
.user-row:hover { background: var(--bg-hover); transform: translateX(2px); }
.user-row .meta { flex: 1; min-width: 0; }
.user-row .meta small { display: block; color: var(--text-dim); }

.modal {
  position: fixed; z-index: 42;
  top: 50%; left: 50%; transform: translate(-50%, -50%);
  width: min(520px, 94vw); max-height: 86dvh; overflow-y: auto;
  background: var(--bg-solid); border: 1px solid var(--border-strong);
  border-radius: var(--radius); box-shadow: var(--shadow);
  animation: modal-in 0.26s var(--ease-spring) both;
}
@keyframes modal-in {
  from { opacity: 0; transform: translate(-50%, -46%) scale(0.95); }
  to { opacity: 1; transform: translate(-50%, -50%) scale(1); }
}
#modal-body { padding: 18px; }
#modal-body label { display: block; margin-bottom: 14px; font-size: 13.5px; color: var(--text-dim); }
#modal-body input, #modal-body select, #modal-body textarea { margin-top: 6px; }
.setting-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--border); }
.setting-row label { margin: 0; color: var(--text); font-size: 14.5px; }
.switch { position: relative; width: 46px; height: 26px; flex: none; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch .track {
  position: absolute; inset: 0; background: var(--bg-input); border: 1px solid var(--border);
  border-radius: 999px; transition: background 0.2s ease, box-shadow 0.2s ease;
}
.switch .track::after {
  content: ''; position: absolute; top: 2px; left: 2px; width: 20px; height: 20px;
  border-radius: 50%; background: var(--text-dim); transition: transform 0.22s var(--ease-spring), background 0.2s ease;
}
.switch input:checked + .track { background: var(--accent-gradient); border-color: transparent; box-shadow: 0 0 12px var(--glow-soft); }
.switch input:checked + .track::after { transform: translateX(20px); background: #fff; }

/* ------------------------------------------------ profile card (Discord-style) */
.profile-card { padding: 0 !important; overflow: hidden; }
.profile-banner { height: 124px; position: relative; }
.profile-banner.g1 { background: linear-gradient(120deg, #7a5cff, #38d6f5); }
.profile-banner.g2 { background: linear-gradient(120deg, #ff5ca8, #7a5cff); }
.profile-banner.g3 { background: linear-gradient(120deg, #38d6f5, #38d996); }
.profile-banner.g4 { background: linear-gradient(120deg, #ffc857, #ff5c73); }
.profile-banner.g5 { background: linear-gradient(120deg, #5b7dff, #ff5ca8); }
.profile-banner.g6 { background: linear-gradient(120deg, #12a8a0, #7a5cff); }
.profile-banner::after {
  content: ''; position: absolute; inset: 0;
  background: radial-gradient(circle at 20% 20%, rgba(255,255,255,0.25), transparent 55%);
}
.profile-head { padding: 0 20px 18px; }
.profile-avatar-box { margin-top: -44px; margin-bottom: 10px; display: inline-block; position: relative; }
.profile-avatar-box .avatar { width: 88px; height: 88px; border: 5px solid var(--bg-solid); }
.profile-avatar-box .status-dot {
  position: absolute; right: 4px; bottom: 8px;
  width: 20px; height: 20px; border-radius: 50%;
  border: 4px solid var(--bg-solid);
  background: var(--text-dim);
}
.profile-avatar-box .status-dot.online { background: var(--success); box-shadow: 0 0 10px rgba(56,217,150,0.7); }
.profile-avatar-box .status-dot.away { background: var(--warning); }
.profile-name { font-size: 20px; font-weight: 800; margin: 0; display: flex; align-items: center; gap: 8px; }
.profile-username { color: var(--text-dim); font-size: 13.5px; margin: 2px 0 12px; }
.profile-section-label {
  font-size: 11px; font-weight: 800; letter-spacing: 0.6px; text-transform: uppercase;
  color: var(--accent-2); margin: 14px 0 4px;
}
.profile-bio { font-size: 14px; white-space: pre-wrap; }
.profile-pill {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--bg-input); border: 1px solid var(--border);
  border-radius: 999px; padding: 4px 11px; font-size: 12.5px; color: var(--text-dim);
}
.profile-pill .svg-icon { width: 14px; height: 14px; }

/* ------------------------------------------------ calls */
.call-overlay {
  position: fixed; inset: 0; z-index: 70;
  background: rgba(7, 8, 13, 0.9);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  display: grid; place-items: center;
  padding: calc(20px + var(--safe-top)) 20px calc(20px + var(--safe-bottom));
  animation: fade-to 0.25s ease both;
}
.call-card { text-align: center; width: min(480px, 100%); position: relative; animation: rise-in 0.3s var(--ease-out) both; }
.call-card h2 { margin: 16px 0 4px; }
.call-card .avatar.large {
  border: 3px solid var(--accent);
  box-shadow: 0 0 0 0 var(--glow), 0 0 40px var(--glow-soft);
}
.call-overlay.ringing .call-card .avatar.large { animation: ring-pulse 1.8s ease-out infinite; }
@keyframes ring-pulse {
  0% { box-shadow: 0 0 0 0 rgba(122,92,255,0.55), 0 0 40px var(--glow-soft); }
  70% { box-shadow: 0 0 0 26px rgba(122,92,255,0), 0 0 40px var(--glow-soft); }
  100% { box-shadow: 0 0 0 0 rgba(122,92,255,0), 0 0 40px var(--glow-soft); }
}
.call-timer { font-variant-numeric: tabular-nums; font-size: 17px; margin: 6px 0; }
.remote-video {
  width: 100%; max-height: 62dvh; object-fit: cover;
  border-radius: var(--radius); background: #000;
  border: 1px solid var(--border-strong);
}
.local-video {
  position: absolute; right: 12px; top: 12px;
  width: 110px; max-width: 26vw; border-radius: 12px;
  background: #000; border: 1px solid var(--border-strong); z-index: 2;
  box-shadow: var(--shadow);
}
.call-controls { display: flex; justify-content: center; gap: 18px; margin-top: 26px; flex-wrap: wrap; }
.call-btn {
  position: relative;
  width: 62px; height: 62px; border-radius: 50%;
  border: 1px solid var(--border-strong);
  background: rgba(255,255,255,0.08);
  color: var(--text); cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
  backdrop-filter: blur(10px);
  transition: background 0.2s ease, box-shadow 0.2s ease;
}
.call-btn .svg-icon { width: 24px; height: 24px; }
.call-btn:hover { box-shadow: 0 10px 26px rgba(0,0,0,0.4); }
.call-btn.off { background: rgba(255,255,255,0.14); color: var(--danger); }
.call-btn.hangup { background: linear-gradient(135deg, #ff5c73, #e23b54); border: none; color: #fff; box-shadow: 0 8px 24px rgba(255,92,115,0.4); }
.call-btn.answer { background: linear-gradient(135deg, #38d996, #12a872); border: none; color: #fff; box-shadow: 0 8px 24px rgba(56,217,150,0.4); }
/* Pulsing halo on a pseudo-element so the button itself never moves. */
.call-btn.answer::after {
  content: ''; position: absolute; inset: 0; border-radius: 50%;
  border: 2px solid rgba(56,217,150,0.6);
  animation: answer-ring 1.5s ease-out infinite;
  pointer-events: none;
}
@keyframes answer-ring {
  from { opacity: 0.9; transform: scale(1); }
  to { opacity: 0; transform: scale(1.55); }
}

/* ------------------------------------------------ misc */
.empty-state { text-align: center; padding: 30px 20px; color: var(--text-dim); }
.toast-host {
  position: fixed; bottom: calc(20px + var(--safe-bottom)); left: 50%; transform: translateX(-50%);
  display: flex; flex-direction: column; gap: 8px; z-index: 90; align-items: center;
}
.toast {
  background: var(--bg-solid); border: 1px solid var(--border-strong);
  padding: 11px 18px; border-radius: 999px; box-shadow: var(--shadow);
  animation: toast-in 0.26s var(--ease-spring); max-width: 88vw;
}
.toast.success { border-color: rgba(56,217,150,0.5); box-shadow: 0 8px 26px rgba(56,217,150,0.18); }
.toast.error { border-color: rgba(255,92,115,0.55); box-shadow: 0 8px 26px rgba(255,92,115,0.2); }
@keyframes toast-in { from { opacity: 0; transform: translateY(14px) scale(0.95); } }
.offline-banner {
  position: fixed; top: var(--safe-top); left: 0; right: 0;
  background: linear-gradient(90deg, #ff5c73, #e23b54); color: #fff; text-align: center;
  padding: 6px; font-size: 13px; z-index: 80; font-weight: 600;
}
.loading-dots::after { content: '…'; }
.lightbox {
  position: fixed; inset: 0; z-index: 75; background: rgba(0,0,0,0.92);
  display: grid; place-items: center; padding: 24px;
  animation: fade-to 0.2s ease both;
}
.lightbox img { max-width: 100%; max-height: 92dvh; border-radius: 8px; animation: pop-in 0.22s var(--ease-spring); }

/* ------------------------------------------------ responsive */
.mobile-only { display: none; }
@media (max-width: 820px) {
  .main-view { grid-template-columns: 1fr; }
  .sidebar { width: 100%; border-right: none; }
  .chat-panel { position: fixed; inset: 0; z-index: 30; background: var(--bg); }
  .chat-panel:not(.open) { display: none; }
  .mobile-only { display: inline-flex; }
  .bubble { max-width: 86%; }
  .emoji-picker { position: fixed; bottom: calc(70px + var(--safe-bottom)); left: 8px; right: 8px; width: auto; }
  .scroll-latest { bottom: calc(120px + var(--safe-bottom)); }
}
@media (orientation: landscape) and (max-height: 500px) {
  .call-card .avatar.large { width: 64px; height: 64px; }
  .call-controls { margin-top: 12px; }
}

/* High-contrast accessibility mode */
[data-high-contrast='true'] {
  --border: currentColor;
  --border-strong: currentColor;
  --bg-hover: rgba(127,127,127,0.35);
}
[data-high-contrast='true'] .bubble { border: 1px solid currentColor; }
[data-high-contrast='true'] body::before, [data-high-contrast='true'] body::after { display: none; }

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

/* ---------- Recovery phrase modal ---------- */
.recovery-phrase-box {
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px;
  margin: 10px 0;
  word-break: break-all;
}
.recovery-phrase-box code {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 1.05rem;
  letter-spacing: 0.5px;
  user-select: all;
  color: var(--accent-2);
}
.recovery-actions { margin-bottom: 10px; }
.recovery-confirm {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.92rem;
  margin-bottom: 12px;
}
.recovery-confirm input { width: auto; }
#btn-recovery-done:disabled { opacity: 0.55; cursor: not-allowed; }

/* ============================================================
   AURORA 2.0 — cinematic premium layer
   ============================================================ */
@property --angle { syntax: '<angle>'; initial-value: 0deg; inherits: false; }

/* ---------- Animated background stage ---------- */
.bg-fx {
  position: fixed; inset: 0; z-index: -1; overflow: hidden;
  pointer-events: none;
}
.blob {
  position: absolute;
  border-radius: 50%;
  filter: blur(85px);
  will-change: transform;
  opacity: 0.55;
}
[data-theme='light'] .blob { opacity: 0.32; }
.blob-1 {
  width: 46vw; height: 46vw; max-width: 720px; max-height: 720px;
  top: -16vw; left: -12vw;
  background: radial-gradient(circle at 35% 35%, #7a5cff, transparent 68%);
  animation: blob-a 26s ease-in-out infinite alternate;
}
.blob-2 {
  width: 42vw; height: 42vw; max-width: 640px; max-height: 640px;
  bottom: -18vw; right: -10vw;
  background: radial-gradient(circle at 60% 40%, #38d6f5, transparent 68%);
  animation: blob-b 32s ease-in-out infinite alternate;
}
.blob-3 {
  width: 34vw; height: 34vw; max-width: 520px; max-height: 520px;
  top: 38%; left: 55%;
  background: radial-gradient(circle at 50% 50%, #ff5ca8, transparent 70%);
  opacity: 0.32;
  animation: blob-c 38s ease-in-out infinite alternate;
}
[data-theme='light'] .blob-3 { opacity: 0.2; }
.blob-4 {
  width: 26vw; height: 26vw; max-width: 420px; max-height: 420px;
  bottom: 12%; left: 8%;
  background: radial-gradient(circle at 50% 50%, #5b7dff, transparent 70%);
  opacity: 0.4;
  animation: blob-a 30s ease-in-out infinite alternate-reverse;
}
@keyframes blob-a {
  from { transform: translate(0, 0) scale(1); }
  to { transform: translate(9vw, 7vh) scale(1.18); }
}
@keyframes blob-b {
  from { transform: translate(0, 0) scale(1.05); }
  to { transform: translate(-8vw, -6vh) scale(0.92); }
}
@keyframes blob-c {
  0% { transform: translate(0, 0) scale(1); }
  50% { transform: translate(-10vw, 8vh) scale(1.25); }
  100% { transform: translate(6vw, -6vh) scale(0.95); }
}
.bg-grid {
  position: absolute; inset: 0;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.045) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.045) 1px, transparent 1px);
  background-size: 56px 56px;
  mask-image: radial-gradient(ellipse 90% 75% at 50% 40%, black 20%, transparent 75%);
  -webkit-mask-image: radial-gradient(ellipse 90% 75% at 50% 40%, black 20%, transparent 75%);
}
[data-theme='light'] .bg-grid {
  background-image:
    linear-gradient(rgba(20, 22, 45, 0.05) 1px, transparent 1px),
    linear-gradient(90deg, rgba(20, 22, 45, 0.05) 1px, transparent 1px);
}
.bg-grain {
  position: absolute; inset: 0; opacity: 0.055;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  mix-blend-mode: overlay;
}
.bg-vignette {
  position: absolute; inset: 0;
  background: radial-gradient(ellipse at center, transparent 55%, rgba(0, 0, 0, 0.45) 100%);
}
[data-theme='light'] .bg-vignette {
  background: radial-gradient(ellipse at center, transparent 65%, rgba(30, 35, 60, 0.12) 100%);
}

/* ---------- Auth card: masked rotating glow ring (no interior bleed) ---------- */
.auth-card {
  position: relative;
  width: min(448px, 100%);
  padding: 34px 32px 30px;
  border: 1px solid var(--border-strong);
  background: linear-gradient(165deg, rgba(28, 30, 46, 0.94) 0%, rgba(13, 14, 23, 0.96) 100%);
  backdrop-filter: blur(22px) saturate(1.5);
  -webkit-backdrop-filter: blur(22px) saturate(1.5);
  box-shadow:
    0 34px 90px rgba(0, 0, 0, 0.62),
    0 0 70px rgba(122, 92, 255, 0.16),
    inset 0 1px 0 rgba(255, 255, 255, 0.09);
  animation: rise-in 0.6s var(--ease-out) both;
  overflow: hidden;
}
[data-theme='light'] .auth-card {
  background: linear-gradient(165deg, rgba(255, 255, 255, 0.96) 0%, rgba(238, 241, 250, 0.95) 100%);
  box-shadow: 0 34px 90px rgba(40, 45, 90, 0.24), inset 0 1px 0 rgba(255, 255, 255, 0.95);
}
/* The animated ring is a masked pseudo-element: only the ~1.6px edge is visible. */
.auth-card::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  padding: 1.6px;
  background: conic-gradient(from var(--angle),
    transparent 0%, rgba(122, 92, 255, 0.95) 12%, rgba(56, 214, 245, 0.95) 28%,
    transparent 46%, transparent 58%, rgba(255, 92, 168, 0.9) 78%,
    rgba(122, 92, 255, 0.95) 92%, transparent 100%);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  mask-composite: exclude;
  animation: border-rotate 8s linear infinite;
  pointer-events: none;
}
/* Top sheen for a premium glass edge */
.auth-card::after {
  content: '';
  position: absolute; inset: 0;
  border-radius: inherit;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.08), transparent 22%);
  pointer-events: none;
}
.auth-card > * { position: relative; z-index: 1; }
@keyframes border-rotate { to { --angle: 360deg; } }

/* ---------- Brand: orbiting logo ring + shimmer wordmark ---------- */
.brand { margin-bottom: 24px; }
.brand-logo-box {
  position: relative;
  display: inline-grid;
  place-items: center;
  width: 76px; height: 76px;
  margin-bottom: 14px;
}
.brand-logo-ring {
  position: absolute; inset: 0;
  border-radius: 24px;
  background: conic-gradient(from var(--angle), var(--accent), var(--accent-2), var(--accent-3), var(--accent));
  animation: border-rotate 5s linear infinite;
  filter: blur(1px);
  opacity: 0.85;
}
.brand-logo-ring::after {
  content: '';
  position: absolute; inset: 2.5px;
  border-radius: 22px;
  background: rgba(13, 14, 22, 0.92);
}
.brand-logo {
  position: relative;
  width: 46px; height: 46px;
  border-radius: 14px;
  animation: logo-float 4.5s ease-in-out infinite;
  filter: drop-shadow(0 6px 18px var(--glow));
}
.brand h1 {
  font-size: 30px;
  font-weight: 800;
  letter-spacing: 0.5px;
  margin: 4px 0 6px;
  background: linear-gradient(100deg, #a78bff 0%, #ffffff 28%, #67e8f9 52%, #ffffff 74%, #a78bff 100%);
  background-size: 220% auto;
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  animation: text-shine 6s linear infinite;
}
@keyframes text-shine { to { background-position: 220% center; } }
.brand .tagline { font-size: 13.5px; letter-spacing: 0.4px; }

/* ---------- Tabs ---------- */
.auth-tabs {
  position: relative;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.04);
  padding: 5px;
  border-radius: 13px;
  margin-bottom: 22px;
}
.auth-tab {
  border-radius: 9px;
  font-weight: 700;
  font-size: 13.5px;
  letter-spacing: 0.2px;
  transition: color 0.2s ease, background 0.25s ease, box-shadow 0.25s ease, transform 0.2s var(--ease-spring);
}
.auth-tab:hover { color: var(--text); transform: translateY(-1px); }
.auth-tab.active {
  background: linear-gradient(135deg, rgba(122, 92, 255, 0.22), rgba(56, 214, 245, 0.16));
  color: #fff;
  box-shadow: inset 0 0 0 1px var(--border-strong), 0 6px 18px rgba(122, 92, 255, 0.25);
}
[data-theme='light'] .auth-tab.active { color: #1b1e30; }

/* ---------- Icon fields ---------- */
.auth-form .field {
  display: block;
  margin-bottom: 16px;
  animation: fade-in 0.5s var(--ease-out) both;
}
.auth-form .field:nth-child(1) { animation-delay: 0.06s; }
.auth-form .field:nth-child(2) { animation-delay: 0.12s; }
.auth-form .field:nth-child(3) { animation-delay: 0.18s; }
.auth-form .field:nth-child(4) { animation-delay: 0.24s; }
.field-label {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  font-size: 12.5px; font-weight: 700; letter-spacing: 0.4px;
  color: var(--text-dim);
  margin-bottom: 8px;
}
.field-label .hint { font-weight: 500; letter-spacing: 0; }
.field-control { position: relative; }
.field-icon {
  position: absolute; left: 14px; top: 50%; transform: translateY(-50%);
  color: var(--text-dim); display: inline-flex;
  transition: color 0.2s ease; pointer-events: none; z-index: 1;
}
.field-control input {
  margin-top: 0 !important;
  height: 47px;
  padding-left: 44px;
  border-radius: 13px;
  background: rgba(255, 255, 255, 0.05);
  transition: border-color 0.2s ease, box-shadow 0.25s ease, background 0.2s ease;
}
[data-theme='light'] .field-control input { background: rgba(20, 25, 50, 0.04); }
.field-control input::placeholder { color: var(--text-dim); opacity: 0.7; }
.field-control:focus-within .field-icon { color: var(--accent-2); }
.auth-form .btn { margin-top: 8px; }
.reset-note {
  background: rgba(255, 255, 255, 0.045);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 11px 13px;
  margin: 0 0 16px;
  line-height: 1.5;
  animation: fade-in 0.45s var(--ease-out) both;
}

/* ---------- Flowing gradient primary buttons ---------- */
.btn.primary {
  position: relative;
  height: 47px;
  font-weight: 800;
  letter-spacing: 0.4px;
  border: none;
  color: #fff;
  background: linear-gradient(110deg, #7a5cff 0%, #5b7dff 32%, #38d6f5 58%, #7a5cff 100%);
  background-size: 220% 220%;
  animation: gradient-pan 7s ease infinite;
  overflow: hidden;
}
@keyframes gradient-pan {
  0%, 100% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
}
.btn-glow {
  box-shadow: 0 12px 32px rgba(122, 92, 255, 0.38), inset 0 1px 0 rgba(255, 255, 255, 0.18);
}
.btn-glow:hover {
  box-shadow: 0 16px 44px rgba(56, 214, 245, 0.42), inset 0 1px 0 rgba(255, 255, 255, 0.22);
}
.btn-label { position: relative; z-index: 1; }

/* Sidebar + chat header inherit the deeper glass over the animated stage */
.sidebar, .chat-header, .composer {
  background-color: rgba(17, 18, 28, 0.62);
}
[data-theme='light'] .sidebar,
[data-theme='light'] .chat-header,
[data-theme='light'] .composer {
  background-color: rgba(255, 255, 255, 0.66);
}

@media (prefers-reduced-motion: reduce) {
  .blob, .auth-card, .brand-logo-ring, .brand h1, .btn.primary { animation: none !important; }
  /* Static, cheaper ambient layer: no moving blobs, no grain, lighter blur. */
  .blob { filter: blur(70px); }
  .bg-grain { display: none; }
  .auth-card, .sidebar, .chat-header, .composer, .modal, .drawer {
    backdrop-filter: blur(10px) saturate(1.2) !important;
    -webkit-backdrop-filter: blur(10px) saturate(1.2) !important;
  }
  .auth-card::before { animation: none !important; }
}

/* ============================================================
   Aurora 2.1 — tabbed settings, per-chat sound popover,
   rich profiles, premium sliders and micro-interactions.
   ============================================================ */

/* ------------------------------------------------ settings shell */
.modal:has(.settings-shell) { width: min(840px, 95vw); }
.settings-shell { display: flex; min-height: 480px; max-height: 72dvh; }
.settings-rail {
  display: flex; flex-direction: column; gap: 4px; width: 196px; flex: none;
  padding: 10px 8px; border-right: 1px solid var(--border); overflow-y: auto;
}
.settings-tab {
  display: flex; align-items: center; gap: 10px; width: 100%;
  padding: 10px 12px; border-radius: 11px; background: none;
  border: 1px solid transparent; color: var(--text-dim);
  cursor: pointer; text-align: left; font-size: 14px;
  transition: background 0.16s ease, color 0.16s ease, transform 0.16s var(--ease-spring), box-shadow 0.16s ease;
}
.settings-tab .svg-icon { width: 17px; height: 17px; }
.settings-tab:hover { background: var(--bg-hover); color: var(--text); transform: translateX(3px); }
.settings-tab.active {
  background: var(--glow-soft); color: var(--text);
  border-color: var(--border); box-shadow: inset 3px 0 0 var(--accent);
}
.settings-panels { flex: 1; overflow-y: auto; padding: 4px 20px 20px; min-width: 0; }
.settings-panel { animation: panel-in 0.26s var(--ease-out) both; }
@keyframes panel-in { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
.settings-panel h4 { margin: 16px 0 8px; font-size: 15px; }
.settings-panel h4:first-child { margin-top: 10px; }
.settings-panel .setting-row { margin-bottom: 0; }
.setting-label { color: var(--text); font-size: 14.5px; }
.setting-row select { width: auto; min-width: 170px; }

/* ------------------------------------------------ premium range sliders */
.slider-row { flex-wrap: wrap; row-gap: 8px; }
.slider-wrap { display: flex; align-items: center; gap: 10px; flex: 1; min-width: 220px; max-width: 280px; }
.volume-slider {
  -webkit-appearance: none; appearance: none; flex: 1; height: 6px; padding: 0;
  border: none; border-radius: 999px; cursor: pointer;
  background: linear-gradient(90deg, var(--accent) var(--pct, 50%), var(--bg-input) var(--pct, 50%));
  transition: filter 0.15s ease;
}
.volume-slider:hover { filter: brightness(1.12); }
.volume-slider::-webkit-slider-thumb {
  -webkit-appearance: none; width: 17px; height: 17px; border-radius: 50%;
  background: #fff; border: 2px solid var(--accent);
  box-shadow: 0 2px 9px rgba(0, 0, 0, 0.4);
  transition: transform 0.16s var(--ease-spring);
}
.volume-slider::-webkit-slider-thumb:hover { transform: scale(1.18); }
.volume-slider::-moz-range-thumb {
  width: 15px; height: 15px; border-radius: 50%; background: #fff;
  border: 2px solid var(--accent); box-shadow: 0 2px 9px rgba(0, 0, 0, 0.4);
}
.slider-value, .vol-pct {
  min-width: 42px; text-align: right; font-variant-numeric: tabular-nums;
  font-size: 12.5px; color: var(--text-dim);
}
.icon-test { padding: 6px 9px; }

/* ------------------------------------------------ accent swatches */
.accent-controls { display: flex; align-items: center; gap: 12px; }
.accent-swatches { display: flex; gap: 8px; }
.accent-swatch {
  width: 27px; height: 27px; padding: 0; border-radius: 50%;
  border: 2px solid transparent; cursor: pointer;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.35);
  transition: transform 0.16s var(--ease-spring), box-shadow 0.16s ease;
}
.accent-swatch:hover { transform: scale(1.14); }
.accent-swatch.selected { border-color: #fff; box-shadow: 0 0 0 2px var(--accent), 0 2px 10px rgba(0, 0, 0, 0.45); }
.accent-picker { width: 46px; height: 34px; padding: 3px; cursor: pointer; }

/* ------------------------------------------------ sound/notif helpers */
.sound-tests { display: flex; flex-wrap: wrap; gap: 8px; }
.btn-row { display: flex; gap: 10px; flex-wrap: wrap; margin: 10px 0; }
.quiet-row { display: flex; gap: 10px; }
.quiet-row input { flex: 1; margin-top: 0; }

/* ------------------------------------------------ per-chat sound popover */
.mini-popover {
  position: fixed; z-index: 60; width: min(330px, calc(100vw - 24px));
  background: var(--bg-solid); border: 1px solid var(--border-strong);
  border-radius: var(--radius); box-shadow: var(--shadow); padding: 14px;
  animation: pop-in 0.2s var(--ease-spring) both;
}
.popover-head { font-weight: 700; margin-bottom: 6px; font-size: 14.5px; }
.popover-row {
  display: flex; align-items: center; justify-content: space-between;
  gap: 10px; padding: 9px 0; border-bottom: 1px solid var(--border);
}
.popover-volume-row { flex-wrap: wrap; border-bottom: none; }
.popover-label { display: inline-flex; align-items: center; gap: 8px; font-size: 14px; color: var(--text); }
.popover-label .svg-icon { width: 16px; height: 16px; color: var(--text-dim); }
.popover-select-row select { width: auto; min-width: 0; padding: 7px 9px; }
.volume-control { display: flex; align-items: center; gap: 8px; width: 100%; }
.popover-hint { margin: 8px 0 0; line-height: 1.4; }
#btn-chat-mute.active-muted { color: var(--accent-3); }
#btn-chat-mute.active-muted .svg-icon { filter: drop-shadow(0 0 6px rgba(255, 92, 168, 0.6)); }

/* ------------------------------------------------ rich profile */
.profile-card.rich .profile-banner { height: 142px; overflow: hidden; }
.banner-sheen {
  position: absolute; inset: 0;
  background: linear-gradient(115deg, rgba(255, 255, 255, 0.24), rgba(255, 255, 255, 0) 42%);
  animation: sheen-move 7s ease-in-out infinite alternate;
}
@keyframes sheen-move { from { transform: translateX(-32%); } to { transform: translateX(32%); } }
.profile-avatar-box.zoomable { cursor: zoom-in; transition: transform 0.2s var(--ease-spring); }
.profile-avatar-box.zoomable:hover { transform: scale(1.05); }
.profile-joined { margin-top: 10px; }
.profile-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 18px; }
.profile-action { flex: 1 1 auto; min-width: 96px; }

/* ------------------------------------------------ satisfying micro-motion */
.icon-btn { transition: transform 0.15s var(--ease-spring), background 0.15s ease, box-shadow 0.15s ease, color 0.15s ease; }
.icon-btn:active { transform: scale(0.86); }
.icon-btn:hover { background: var(--bg-hover); }
.conv-item { transition: transform 0.15s var(--ease-spring), background 0.15s ease, box-shadow 0.15s ease; }
.conv-item:hover { transform: translateX(3px); }
.msg-row.msg-enter.out .bubble { animation: msg-in-right 0.32s var(--ease-spring) both; }
.msg-row.msg-enter.in .bubble { animation: msg-in-left 0.3s var(--ease-out) both; }
@keyframes msg-in-right {
  from { opacity: 0; transform: translateX(26px) scale(0.94); }
  to { opacity: 1; transform: none; }
}
@keyframes msg-in-left {
  from { opacity: 0; transform: translateX(-18px) scale(0.96); }
  to { opacity: 1; transform: none; }
}
.call-btn { transition: transform 0.15s var(--ease-spring), box-shadow 0.2s ease, background 0.2s ease; }
.call-btn:active { transform: scale(0.9); }
.accent-picker, input[type='time'], input[type='color'] { transition: box-shadow 0.15s ease, border-color 0.15s ease; }

/* ------------------------------------------------ high-contrast coverage */
[data-high-contrast='true'] .mini-popover,
[data-high-contrast='true'] .settings-tab.active,
[data-high-contrast='true'] .accent-swatch.selected { border-color: currentColor; }
[data-high-contrast='true'] .volume-slider { background: var(--bg-input); }

/* ------------------------------------------------ responsive */
@media (max-width: 820px) {
  .settings-shell { flex-direction: column; min-height: 0; max-height: 80dvh; }
  .settings-rail {
    flex-direction: row; width: 100%; overflow-x: auto;
    border-right: none; border-bottom: 1px solid var(--border); padding: 6px;
  }
  .settings-tab { white-space: nowrap; width: auto; }
  .settings-tab:hover { transform: none; }
  .settings-tab.active { box-shadow: inset 0 -3px 0 var(--accent); }
  .settings-panels { padding: 2px 12px 14px; }
  .modal:has(.settings-shell) { width: 96vw; }
  .profile-actions .profile-action { min-width: calc(50% - 8px); }
  .mini-popover { width: calc(100vw - 24px); }
  .slider-wrap { max-width: none; }
}
