/* ============================================================
   UniTalk — iOS 26 Liquid Glass Design System
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

/* ── Design Tokens ─────────────────────────────────────────── */
:root {
  /* Brand */
  --green:        #07C160;
  --green-d:      #05A050;
  --green-l:      #34D576;
  --green-glow:   rgba(7, 193, 96, 0.35);

  /* Liquid Glass Backgrounds */
  --bg:           #F0F1F6;
  --surface:      rgba(255,255,255,0.55);
  --surface-2:    rgba(255,255,255,0.35);
  --surface-solid: #FFFFFF;
  --topbar-bg:    rgba(255,255,255,0.42);
  --tab-bg:       rgba(255,255,255,0.48);

  /* Glass Properties */
  --glass-blur:       40px;
  --glass-saturate:   200%;
  --glass-border:     rgba(255,255,255,0.45);
  --glass-border-b:   rgba(255,255,255,0.18);
  --glass-specular:   inset 0 1px 0 rgba(255,255,255,0.55), inset 0 -1px 0 rgba(255,255,255,0.1);
  --glass-highlight:  inset 0 1px 1px rgba(255,255,255,0.6);

  /* Text */
  --text:         #0D0D0D;
  --text-2:       #48484A;
  --text-muted:   #8E8E93;

  /* UI */
  --border:       rgba(0,0,0,0.06);
  --divider:      rgba(0,0,0,0.04);
  --red:          #FF3B30;
  --blue:         #007AFF;
  --purple:       #AF52DE;
  --orange:       #FF9500;

  /* Chat bubbles */
  --bubble-out:   linear-gradient(135deg, #0BD46A 0%, #07C160 50%, #05A84E 100%);
  --bubble-out-flat: #07C160;
  --bubble-out-text: #FFFFFF;
  --bubble-in:    rgba(255,255,255,0.65);
  --bubble-in-text: #0D0D0D;

  /* Shadows — Liquid Glass depth */
  --shadow-sm:    0 1px 3px rgba(0,0,0,.05), 0 1px 2px rgba(0,0,0,.03);
  --shadow:       0 4px 24px rgba(0,0,0,.07), 0 1px 6px rgba(0,0,0,.04);
  --shadow-lg:    0 16px 56px rgba(0,0,0,.12), 0 4px 16px rgba(0,0,0,.06);
  --shadow-glass: 0 8px 32px rgba(0,0,0,.08), 0 2px 8px rgba(0,0,0,.04);
  --shadow-glow:  0 0 20px rgba(7,193,96,.15);

  /* Shape — softer, more organic */
  --radius:       18px;
  --radius-sm:    12px;
  --radius-xs:    8px;
  --radius-pill:  100px;

  /* Safe area */
  --safe-top:     env(safe-area-inset-top, 0px);
  --safe-bottom:  env(safe-area-inset-bottom, 0px);
  --safe-bottom-real: max(env(safe-area-inset-bottom, 0px), 16px);
  --topbar-h:     calc(54px + var(--safe-top));
  --tab-h:        calc(72px + var(--safe-bottom-real));

  font-size: 16px;
}

/* ── Dark Mode ─────────────────────────────────────────────── */
@media (prefers-color-scheme: dark) {
  :root {
    --bg:           #000000;
    --surface:      rgba(44,44,46,0.55);
    --surface-2:    rgba(58,58,60,0.40);
    --surface-solid: #1C1C1E;
    --topbar-bg:    rgba(28,28,30,0.50);
    --tab-bg:       rgba(28,28,30,0.55);
    --glass-border:     rgba(255,255,255,0.12);
    --glass-border-b:   rgba(255,255,255,0.06);
    --glass-specular:   inset 0 1px 0 rgba(255,255,255,0.12), inset 0 -1px 0 rgba(255,255,255,0.03);
    --glass-highlight:  inset 0 1px 1px rgba(255,255,255,0.1);
    --text:         #F2F2F7;
    --text-2:       #AEAEB2;
    --text-muted:   #636366;
    --border:       rgba(255,255,255,0.06);
    --divider:      rgba(255,255,255,0.04);
    --bubble-out:   linear-gradient(135deg, #0BD46A 0%, #07C160 50%, #05A84E 100%);
    --bubble-out-flat: #07C160;
    --bubble-out-text: #FFFFFF;
    --bubble-in:    rgba(58,58,60,0.60);
    --bubble-in-text: #F2F2F7;
    --shadow-sm:    0 1px 3px rgba(0,0,0,.3);
    --shadow:       0 4px 24px rgba(0,0,0,.4);
    --shadow-lg:    0 16px 56px rgba(0,0,0,.6);
    --shadow-glass: 0 8px 32px rgba(0,0,0,.35), 0 2px 8px rgba(0,0,0,.2);
  }
}

/* ── Reset ─────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  height: 100%;
  overflow: hidden;
  background: var(--bg);
  font-family: 'Inter', -apple-system, BlinkMacSystemFont,
    'PingFang SC', 'Noto Sans CJK SC', 'Noto Sans KR', 'Noto Sans JP',
    'Helvetica Neue', sans-serif;
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior: none;
}

#app {
  height: 100dvh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  position: relative;
  padding-bottom: env(safe-area-inset-bottom, 0px);
}

/* ── Liquid Glass Mixin (via class) ───────────────────────── */
.glass {
  background: var(--surface);
  backdrop-filter: blur(var(--glass-blur)) saturate(var(--glass-saturate));
  -webkit-backdrop-filter: blur(var(--glass-blur)) saturate(var(--glass-saturate));
  border: 0.5px solid var(--glass-border);
  box-shadow: var(--glass-specular), var(--shadow-glass);
}

/* ── Top Bar ───────────────────────────────────────────────── */
.topbar {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--topbar-bg);
  backdrop-filter: blur(var(--glass-blur)) saturate(var(--glass-saturate));
  -webkit-backdrop-filter: blur(var(--glass-blur)) saturate(var(--glass-saturate));
  display: flex;
  align-items: center;
  padding: var(--safe-top) 12px 0;
  height: var(--topbar-h);
  border-bottom: 0.5px solid var(--glass-border-b);
  box-shadow: var(--glass-specular), 0 4px 16px rgba(0,0,0,.03);
}
.topbar-title {
  flex: 1;
  text-align: center;
  font-size: 17px;
  font-weight: 600;
  letter-spacing: -0.3px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.topbar-btn {
  background: none;
  border: none;
  cursor: pointer;
  padding: 8px;
  min-width: 44px;
  color: var(--green);
  font-size: 14px;
  display: flex;
  align-items: center;
  gap: 4px;
  border-radius: var(--radius-xs);
  transition: background .18s ease, color .18s ease, transform .12s ease;
}
.topbar-btn:active { background: rgba(0,0,0,.06); transform: scale(0.92); }
.topbar-back { justify-content: flex-start; }
.topbar-action { justify-content: flex-end; }

/* ── Tab Bar — Floating Liquid Glass Pill ──────────────────── */
.tabbar {
  position: sticky;
  bottom: 0;
  z-index: 100;
  background: var(--tab-bg);
  backdrop-filter: blur(var(--glass-blur)) saturate(var(--glass-saturate));
  -webkit-backdrop-filter: blur(var(--glass-blur)) saturate(var(--glass-saturate));
  display: flex;
  margin: 0 10px max(calc(var(--safe-bottom) + 6px), 20px);
  border-radius: var(--radius-pill);
  border: 0.5px solid var(--glass-border);
  box-shadow: var(--glass-specular), var(--shadow-lg);
  padding: 0;
  height: 62px;
  overflow: hidden;
  flex-shrink: 0;
}
.tab-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  padding: 6px 0;
  cursor: pointer;
  color: var(--text-muted);
  user-select: none;
  transition: color .25s ease, transform .2s ease;
  position: relative;
  border-radius: var(--radius-pill);
}
.tab-item::before {
  content: '';
  position: absolute;
  inset: 4px 6px;
  border-radius: var(--radius-pill);
  background: transparent;
  transition: background .3s cubic-bezier(.4,0,.2,1), box-shadow .3s ease;
  z-index: -1;
}
.tab-item.active {
  color: var(--green);
}
.tab-item.active::before {
  background: rgba(7,193,96,.1);
  box-shadow: 0 0 12px rgba(7,193,96,.08);
}
.tab-item svg { width: 24px; height: 24px; fill: currentColor; transition: transform .3s cubic-bezier(.34,1.56,.64,1); }
.tab-item.active svg { transform: scale(1.12); }
.tab-label { font-size: 10px; font-weight: 500; }
.tab-badge {
  position: absolute;
  top: 4px;
  right: calc(50% - 22px);
  background: var(--red);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  min-width: 17px;
  height: 17px;
  border-radius: 9px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 4px;
  border: 1.5px solid rgba(255,255,255,.3);
  box-shadow: 0 2px 8px rgba(255,59,48,.3);
}
.tab-icon { position: relative; }

/* ── Page Shell ────────────────────────────────────────────── */
.page {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  background: var(--bg);
}
.page::-webkit-scrollbar { display: none; }

/* ── List Items ────────────────────────────────────────────── */
.list-item {
  display: flex;
  align-items: center;
  padding: 12px 16px;
  background: var(--surface);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  cursor: pointer;
  gap: 12px;
  transition: background .15s ease, transform .12s ease;
  position: relative;
}
.list-item:active { background: var(--surface-2); transform: scale(0.985); }
.list-item + .list-item::before {
  content: '';
  position: absolute;
  top: 0;
  left: 72px;
  right: 0;
  height: .5px;
  background: var(--divider);
}

/* ── Avatar ────────────────────────────────────────────────── */
.avatar {
  width: 50px;
  height: 50px;
  border-radius: 14px;
  object-fit: cover;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 19px;
  font-weight: 600;
  color: #fff;
  letter-spacing: -0.5px;
  box-shadow: 0 2px 8px rgba(0,0,0,.1);
}
.avatar-sm { width: 38px; height: 38px; font-size: 14px; border-radius: 11px; }
.avatar-lg { width: 70px; height: 70px; font-size: 26px; border-radius: 20px; box-shadow: 0 4px 20px rgba(0,0,0,.12); }

/* Online dot */
.avatar-wrap { position: relative; display: inline-block; }
.online-dot {
  position: absolute;
  bottom: 1px;
  right: 1px;
  width: 10px;
  height: 10px;
  background: var(--green);
  border-radius: 50%;
  border: 2px solid var(--surface-solid);
  box-shadow: 0 0 6px rgba(7,193,96,.4);
}

/* ── Search Bar ────────────────────────────────────────────── */
.search-wrap {
  padding: 8px 16px;
  background: transparent;
}
.search-input {
  width: 100%;
  padding: 10px 16px 10px 38px;
  background: var(--surface);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  border: 0.5px solid var(--glass-border);
  border-radius: var(--radius-pill);
  font-size: 15px;
  font-family: inherit;
  color: var(--text);
  outline: none;
  box-shadow: var(--glass-specular), var(--shadow-sm);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='%238E8E93'%3E%3Cpath d='M21 21l-4.35-4.35M17 11A6 6 0 1 1 5 11a6 6 0 0 1 12 0z' stroke='%238E8E93' stroke-width='2' stroke-linecap='round' fill='none'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: 14px center;
  transition: box-shadow .25s ease, border-color .25s ease;
}
.search-input:focus {
  box-shadow: 0 0 0 3px var(--green-glow), var(--glass-specular), var(--shadow-sm);
  border-color: rgba(7,193,96,.3);
}
.search-input::placeholder { color: var(--text-muted); }

/* ── Section Header ────────────────────────────────────────── */
.section-header {
  padding: 20px 16px 6px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.6px;
  background: transparent;
}

/* ── Settings / Card Group — Glass Cards ──────────────────── */
.card-group {
  background: var(--surface);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  border-radius: var(--radius);
  margin: 0 16px 12px;
  overflow: hidden;
  border: 0.5px solid var(--glass-border);
  box-shadow: var(--glass-specular), var(--shadow);
}
.card-group + .card-group { margin-top: 0; }
.settings-item {
  display: flex;
  align-items: center;
  padding: 13px 16px;
  gap: 14px;
  cursor: pointer;
  transition: background .15s ease, transform .12s ease;
  position: relative;
}
.settings-item:active { background: var(--surface-2); transform: scale(0.985); }
.settings-item + .settings-item::before {
  content: '';
  position: absolute;
  top: 0;
  left: 56px;
  right: 16px;
  height: .5px;
  background: var(--divider);
}
.settings-icon {
  width: 32px;
  height: 32px;
  border-radius: 9px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 17px;
  flex-shrink: 0;
  box-shadow: 0 2px 6px rgba(0,0,0,.12);
}
.settings-label { flex: 1; font-size: 16px; font-weight: 400; }
.settings-value { font-size: 14px; color: var(--text-muted); }
.settings-chevron { color: var(--text-muted); font-size: 18px; line-height: 1; margin-left: 4px; }

/* ── Chat List Page ────────────────────────────────────────── */
.chat-meta { flex: 1; min-width: 0; }
.chat-name-row { display: flex; justify-content: space-between; align-items: center; margin-bottom: 3px; }
.chat-name { font-size: 16px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; flex: 1; min-width: 0; }
.chat-time { font-size: 12px; color: var(--text-muted); white-space: nowrap; margin-left: 6px; }
.chat-preview-row { display: flex; justify-content: space-between; align-items: center; }
.chat-preview { font-size: 13px; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; flex: 1; min-width: 0; }
.badge {
  background: var(--red);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  min-width: 18px;
  height: 18px;
  border-radius: 9px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 5px;
  flex-shrink: 0;
  margin-left: 6px;
  box-shadow: 0 2px 6px rgba(255,59,48,.25);
}

/* ── Chat Window ───────────────────────────────────────────── */
.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px 0 8px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  background: var(--bg);
  -webkit-overflow-scrolling: touch;
}
.chat-messages::-webkit-scrollbar { display: none; }

.msg-row {
  display: flex;
  align-items: flex-end;
  padding: 3px 14px;
  gap: 8px;
  animation: msgIn .22s cubic-bezier(.2,.8,.4,1);
}
.msg-row.out { flex-direction: row-reverse; }
@keyframes msgIn {
  from { opacity: 0; transform: translateY(10px) scale(.96); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

.bubble {
  max-width: min(72vw, 340px);
  padding: 10px 14px;
  border-radius: 22px;
  font-size: 15px;
  line-height: 1.45;
  word-break: break-word;
  position: relative;
}
.msg-row.in .bubble {
  background: var(--bubble-in);
  color: var(--bubble-in-text);
  border-radius: 4px 22px 22px 22px;
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  border: 0.5px solid var(--glass-border);
  box-shadow: var(--glass-highlight), var(--shadow-sm);
}
.msg-row.out .bubble {
  background: var(--bubble-out);
  color: var(--bubble-out-text);
  border-radius: 22px 4px 22px 22px;
  box-shadow: 0 2px 12px rgba(7,193,96,.2), inset 0 1px 0 rgba(255,255,255,.2);
}

.bubble-image {
  max-width: 220px;
  max-height: 280px;
  border-radius: 16px;
  display: block;
  cursor: zoom-in;
  object-fit: cover;
}
.bubble-voice { display: flex; align-items: center; gap: 8px; min-width: 90px; }
.voice-play-btn {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: rgba(255,255,255,.22);
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 14px;
}
.voice-dur { font-size: 13px; opacity: .8; }

.msg-time-sep {
  text-align: center;
  font-size: 12px;
  color: var(--text-muted);
  padding: 8px 0;
  font-weight: 500;
}

/* ── Input Toolbar — Glass ────────────────────────────────── */
.input-toolbar {
  background: var(--surface);
  backdrop-filter: blur(var(--glass-blur)) saturate(var(--glass-saturate));
  -webkit-backdrop-filter: blur(var(--glass-blur)) saturate(var(--glass-saturate));
  border-top: 0.5px solid var(--glass-border-b);
  padding: 8px 10px;
  padding-bottom: max(8px, var(--safe-bottom));
  display: flex;
  align-items: flex-end;
  gap: 6px;
  box-shadow: var(--glass-specular);
}
.input-toolbar-btn {
  background: none;
  border: none;
  cursor: pointer;
  padding: 7px;
  color: var(--text-muted);
  font-size: 22px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 38px;
  height: 38px;
  transition: color .18s ease, background .18s ease, transform .12s ease;
}
.input-toolbar-btn:active { background: var(--surface-2); color: var(--green); transform: scale(0.9); }
#chat-input {
  flex: 1;
  min-height: 38px;
  max-height: 130px;
  padding: 9px 14px;
  background: var(--surface-2);
  border: 0.5px solid var(--glass-border);
  border-radius: 20px;
  font-size: 15px;
  font-family: inherit;
  color: var(--text);
  resize: none;
  outline: none;
  line-height: 1.4;
  overflow-y: auto;
  transition: border-color .25s ease, box-shadow .25s ease;
  box-shadow: var(--glass-highlight);
}
#chat-input:focus {
  border-color: rgba(7,193,96,.35);
  box-shadow: 0 0 0 2px var(--green-glow), var(--glass-highlight);
}
#chat-input::placeholder { color: var(--text-muted); }
.send-btn {
  background: var(--green);
  color: #fff;
  border: none;
  border-radius: 50%;
  width: 38px;
  height: 38px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  box-shadow: 0 2px 12px var(--green-glow), inset 0 1px 0 rgba(255,255,255,.2);
  transition: background .18s ease, transform .15s cubic-bezier(.34,1.56,.64,1), box-shadow .18s ease;
}
.send-btn:active { background: var(--green-d); transform: scale(.85); }

/* ── Typing Indicator ──────────────────────────────────────── */
.typing-indicator { display: flex; gap: 4px; align-items: center; padding: 8px 22px; min-height: 28px; }
.typing-dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--text-muted);
  animation: dot-bounce 1.3s ease-in-out infinite;
}
.typing-dot:nth-child(2) { animation-delay: .15s; }
.typing-dot:nth-child(3) { animation-delay: .3s; }
@keyframes dot-bounce {
  0%, 80%, 100% { transform: translateY(0); opacity: .4; }
  40% { transform: translateY(-5px); opacity: 1; }
}

/* ── Voice Overlay ─────────────────────────────────────────── */
.voice-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.45);
  backdrop-filter: blur(30px) saturate(200%);
  -webkit-backdrop-filter: blur(30px) saturate(200%);
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  z-index: 999; gap: 20px;
}
.voice-pulse {
  width: 96px; height: 96px; border-radius: 50%;
  background: var(--green);
  display: flex; align-items: center; justify-content: center;
  font-size: 38px;
  box-shadow: 0 0 0 0 var(--green-glow), 0 4px 20px rgba(7,193,96,.3);
  animation: pulse 1.2s ease-in-out infinite;
}
@keyframes pulse {
  0%   { box-shadow: 0 0 0 0 var(--green-glow), 0 4px 20px rgba(7,193,96,.3); }
  70%  { box-shadow: 0 0 0 24px rgba(7,193,96,0), 0 4px 20px rgba(7,193,96,.3); }
  100% { box-shadow: 0 0 0 0 rgba(7,193,96,0), 0 4px 20px rgba(7,193,96,.3); }
}
.voice-overlay p { color: rgba(255,255,255,.85); font-size: 15px; font-weight: 500; }

/* ── Image Viewer ──────────────────────────────────────────── */
.img-viewer {
  position: fixed; inset: 0; background: rgba(0,0,0,.92);
  backdrop-filter: blur(16px);
  z-index: 9000; display: flex;
  align-items: center; justify-content: center;
  animation: fadeIn .25s ease;
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.img-viewer img { max-width: 100%; max-height: 100dvh; object-fit: contain; }
.img-viewer-close {
  position: absolute;
  top: max(20px, calc(var(--safe-top) + 10px));
  right: 20px;
  color: rgba(255,255,255,.9);
  font-size: 30px; cursor: pointer;
  width: 44px; height: 44px;
  display: flex; align-items: center; justify-content: center;
  background: rgba(255,255,255,.12);
  backdrop-filter: blur(12px);
  border-radius: 50%;
  border: 0.5px solid rgba(255,255,255,.15);
  transition: background .18s ease;
}
.img-viewer-close:active { background: rgba(255,255,255,.2); }

/* ── Toast — Glass ────────────────────────────────────────── */
.toast {
  position: fixed;
  bottom: max(calc(var(--tab-h) + 20px), 100px);
  left: 50%;
  transform: translateX(-50%);
  background: rgba(30,30,30,.7);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  color: #fff;
  padding: 10px 22px;
  border-radius: var(--radius-pill);
  font-size: 14px;
  font-weight: 500;
  z-index: 9999;
  pointer-events: none;
  white-space: nowrap;
  animation: toastIn .25s cubic-bezier(.2,.8,.4,1);
  box-shadow: var(--shadow-glass);
  border: 0.5px solid rgba(255,255,255,.1);
}
@keyframes toastIn {
  from { opacity: 0; transform: translateX(-50%) translateY(14px) scale(.92); }
  to   { opacity: 1; transform: translateX(-50%) translateY(0) scale(1); }
}

/* ── Auth Screen — Liquid Glass ───────────────────────────── */
.auth-screen {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 100dvh;
  padding: 48px 24px max(32px, var(--safe-bottom));
  position: relative;
  background: var(--bg);
  gap: 0;
  overflow: hidden;
}
.auth-screen::before {
  content: '';
  position: absolute;
  top: -30%;
  left: -20%;
  width: 140%;
  height: 70%;
  background: radial-gradient(ellipse at center, rgba(7,193,96,.2) 0%, rgba(7,193,96,.05) 50%, transparent 70%);
  animation: authOrb 8s ease-in-out infinite;
  pointer-events: none;
}
.auth-screen::after {
  content: '';
  position: absolute;
  bottom: -20%;
  right: -30%;
  width: 80%;
  height: 60%;
  background: radial-gradient(ellipse at center, rgba(0,122,255,.12) 0%, transparent 60%);
  animation: authOrb2 10s ease-in-out infinite;
  pointer-events: none;
}
@keyframes authOrb {
  0%, 100% { transform: translate(0, 0) scale(1); }
  50%      { transform: translate(5%, 8%) scale(1.1); }
}
@keyframes authOrb2 {
  0%, 100% { transform: translate(0, 0) scale(1); }
  50%      { transform: translate(-8%, -5%) scale(1.15); }
}
.auth-logo-wrap {
  width: 96px; height: 96px; border-radius: 28px;
  background: var(--green);
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 8px 40px var(--green-glow), 0 2px 8px rgba(0,0,0,.1), inset 0 1px 0 rgba(255,255,255,.25);
  margin-bottom: 20px;
  animation: authPop .5s cubic-bezier(.2,1.6,.4,1);
  position: relative;
  z-index: 1;
}
.auth-logo-wrap img, .auth-logo-wrap span { width: 56px; height: 56px; font-size: 52px; }
@keyframes authPop {
  from { transform: scale(.5) translateY(20px); opacity: 0; }
  to   { transform: scale(1) translateY(0); opacity: 1; }
}
.auth-title {
  font-size: 30px; font-weight: 700;
  letter-spacing: -1px; margin-bottom: 8px;
  animation: authFade .4s .1s both;
  position: relative; z-index: 1;
}
.auth-tagline {
  font-size: 13px; color: var(--text-muted);
  text-align: center; margin-bottom: 36px;
  animation: authFade .4s .15s both;
  position: relative; z-index: 1;
}
@keyframes authFade {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}
.auth-form {
  width: 100%; max-width: 380px;
  display: flex; flex-direction: column; gap: 10px;
  animation: authFade .4s .2s both;
  position: relative; z-index: 1;
  /* Glass card wrapper */
  background: var(--surface);
  backdrop-filter: blur(30px) saturate(200%);
  -webkit-backdrop-filter: blur(30px) saturate(200%);
  border: 0.5px solid var(--glass-border);
  border-radius: var(--radius);
  padding: 24px 20px;
  box-shadow: var(--glass-specular), var(--shadow-lg);
}
.auth-field { position: relative; }
.auth-input {
  width: 100%; padding: 14px 16px;
  border-radius: var(--radius-sm);
  border: 0.5px solid var(--glass-border-b);
  background: rgba(255,255,255,.25);
  color: var(--text);
  font-size: 16px; font-family: inherit;
  outline: none;
  transition: border-color .25s ease, box-shadow .25s ease, background .25s ease;
  box-shadow: var(--glass-highlight);
}
@media (prefers-color-scheme: dark) {
  .auth-input { background: rgba(255,255,255,.08); }
}
.auth-input::placeholder { color: var(--text-muted); }
.auth-input:focus {
  border-color: rgba(7,193,96,.4);
  box-shadow: 0 0 0 3px var(--green-glow), var(--glass-highlight);
  background: rgba(255,255,255,.35);
}
@media (prefers-color-scheme: dark) {
  .auth-input:focus { background: rgba(255,255,255,.12); }
}
.auth-btn {
  margin-top: 6px; padding: 15px;
  border-radius: var(--radius-sm);
  border: none;
  background: linear-gradient(135deg, #0BD46A, #07C160, #05A84E);
  color: #fff;
  font-size: 17px; font-weight: 600; font-family: inherit;
  cursor: pointer;
  box-shadow: 0 4px 20px var(--green-glow), inset 0 1px 0 rgba(255,255,255,.2);
  transition: transform .15s cubic-bezier(.34,1.56,.64,1), box-shadow .2s ease;
}
.auth-btn:hover { box-shadow: 0 6px 28px var(--green-glow), inset 0 1px 0 rgba(255,255,255,.25); }
.auth-btn:active { transform: scale(.97); box-shadow: 0 2px 12px var(--green-glow); }
.auth-btn:disabled { opacity: .6; cursor: not-allowed; transform: none; }
.auth-error {
  color: var(--red); font-size: 13px;
  text-align: center; min-height: 16px;
  font-weight: 500; animation: authFade .2s;
}
.auth-toggle {
  margin-top: 16px; font-size: 14px;
  color: var(--text-muted); text-align: center;
  cursor: pointer; position: relative; z-index: 1;
  animation: authFade .4s .25s both;
}
.auth-toggle span { color: var(--green); font-weight: 500; }
.auth-notice {
  margin-top: 24px; font-size: 12px;
  color: var(--text-muted); opacity: .7;
  text-align: center; position: relative; z-index: 1;
}

/* ── Moments (朋友圈) ───────────────────────────────────────── */
.page-moments { display:flex; flex-direction:column; height:100%; }
.moments-topbar { position:sticky; top:0; z-index:10; }
.moments-feed { flex:1; overflow-y:auto; padding-bottom:80px; }
.moments-loading { justify-content:center; padding:20px; }
.moments-empty { display:flex; flex-direction:column; align-items:center; justify-content:center;
  padding:60px 20px; color:var(--text-muted); }

/* Moment card — Glass */
.moment-card {
  padding:16px; margin:8px 12px; border-radius:var(--radius);
  background:var(--surface);
  backdrop-filter:blur(20px) saturate(180%);
  -webkit-backdrop-filter:blur(20px) saturate(180%);
  border:0.5px solid var(--glass-border);
  box-shadow:var(--glass-specular), var(--shadow-sm);
}
.moment-header { display:flex; align-items:flex-start; gap:10px; margin-bottom:10px; }
.moment-avatar { width:42px!important; height:42px!important; border-radius:10px!important; flex-shrink:0; }
.moment-meta { flex:1; min-width:0; }
.moment-name { font-weight:600; font-size:15px; color:var(--blue); }
.moment-time { font-size:12px; color:var(--text-muted); margin-top:2px; }
.moment-delete-btn { margin-left:auto; color:var(--text-muted); font-size:16px; }
.moment-text { font-size:15px; line-height:1.6; color:var(--text); margin-bottom:10px;
  white-space:pre-wrap; word-break:break-word; }

/* Image grid */
.moment-images { display:grid; gap:4px; margin-bottom:10px; border-radius:10px; overflow:hidden; }
.moment-images.count-1 { grid-template-columns:1fr; max-width:240px; }
.moment-images.count-2 { grid-template-columns:1fr 1fr; }
.moment-images.count-3 { grid-template-columns:1fr 1fr 1fr; }
.moment-images.count-4 { grid-template-columns:1fr 1fr; }
.moment-images.count-5,
.moment-images.count-6,
.moment-images.count-7,
.moment-images.count-8,
.moment-images.count-9 { grid-template-columns:1fr 1fr 1fr; }
.moment-img { width:100%; aspect-ratio:1; object-fit:cover; cursor:zoom-in; transition:opacity .2s ease, transform .15s ease; }
.moment-img:hover { opacity:.9; }
.moment-img:active { transform:scale(0.97); }

/* Actions */
.moment-actions { display:flex; gap:16px; margin-bottom:8px; }
.moment-like-btn, .moment-comment-btn { background:none; border:none; font-size:14px;
  color:var(--text-muted); cursor:pointer; padding:4px 0; transition:color .2s ease, transform .12s ease; }
.moment-like-btn.liked { color:#FF3B5C; }
.moment-like-btn:hover, .moment-comment-btn:hover { color:var(--text); }
.moment-like-btn:active, .moment-comment-btn:active { transform:scale(0.9); }

/* Comments */
.moment-comments { margin-top:4px; }
.moment-comment-item { font-size:13px; line-height:1.5; padding:2px 0;
  display:flex; gap:4px; align-items:baseline; }
.comment-author { color:var(--blue); font-weight:500; flex-shrink:0; }
.comment-text { color:var(--text); word-break:break-word; flex:1; }
.comment-del-btn { color:var(--text-muted); font-size:11px; flex-shrink:0; }
.moment-comment-input-row { display:flex; gap:8px; margin-top:8px; }
.moment-comment-input {
  flex:1; background:var(--surface-2); border:0.5px solid var(--glass-border-b);
  border-radius:var(--radius-xs); padding:6px 10px; font-size:14px; color:var(--text);
  outline:none; transition:border-color .2s ease;
}
.moment-comment-input:focus { border-color:rgba(7,193,96,.3); }
.moment-comment-send {
  background:var(--blue); color:#fff; border:none;
  border-radius:var(--radius-xs); padding:6px 12px; font-size:14px; cursor:pointer;
  box-shadow:0 2px 8px rgba(0,122,255,.2);
}

/* ── Compose Modal — Glass Sheet ─────────────────────────── */
.compose-modal {
  position: fixed; inset: 0; z-index: 9500;
  background: rgba(0,0,0,.35);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  display: flex; align-items: flex-end;
}
.compose-sheet {
  background: var(--surface);
  backdrop-filter: blur(var(--glass-blur)) saturate(var(--glass-saturate));
  -webkit-backdrop-filter: blur(var(--glass-blur)) saturate(var(--glass-saturate));
  border-radius: 24px 24px 0 0;
  width: 100%; max-height: 92vh;
  display: flex; flex-direction: column;
  overflow: hidden; padding-bottom: 0;
  border-top: 0.5px solid var(--glass-border);
  box-shadow: var(--glass-specular), 0 -8px 40px rgba(0,0,0,.2);
  transform: translateY(100%);
  transition: transform .3s cubic-bezier(.4,0,.2,1);
}
.compose-sheet-open { transform: translateY(0) !important; }
.compose-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 16px 12px;
  border-bottom: 0.5px solid var(--divider);
  position: sticky; top: 0; z-index: 1;
}
.compose-title { font-size: 16px; font-weight: 600; color: var(--text); }
.compose-cancel-btn {
  background: none; border: none; font-size: 15px;
  color: var(--text-muted); cursor: pointer; padding: 4px 0; min-width: 44px;
}
.compose-publish-btn {
  background: linear-gradient(135deg, #0BD46A, #07C160);
  border: none; border-radius: var(--radius-pill);
  padding: 6px 16px; font-size: 14px; font-weight: 600;
  color: #fff; cursor: pointer; min-width: 60px;
  box-shadow: 0 2px 10px var(--green-glow), inset 0 1px 0 rgba(255,255,255,.2);
  transition: opacity .15s ease, transform .12s ease;
}
.compose-publish-btn:disabled { opacity: .35; cursor: default; }
.compose-publish-btn:not(:disabled):active { transform: scale(.95); }
.compose-user-row {
  display: flex; gap: 12px;
  padding: 14px 16px 4px; align-items: flex-start;
  flex: 1; overflow-y: auto;
}
.compose-user-avatar { width: 42px !important; height: 42px !important; border-radius: 12px !important; flex-shrink: 0; }
.compose-body { flex: 1; min-width: 0; }
.compose-textarea {
  width: 100%; min-height: 100px;
  background: transparent; border: none; outline: none;
  padding: 2px 0 10px; font-size: 16px; line-height: 1.6;
  color: var(--text); resize: none; overflow: hidden;
  font-family: inherit;
}
.compose-textarea::placeholder { color: var(--text-muted); }
.compose-images { display: grid; grid-template-columns: repeat(3, 1fr); gap: 5px; padding: 4px 0 10px; }
.compose-thumb {
  position: relative; aspect-ratio: 1;
  border-radius: var(--radius-xs); overflow: hidden; background: var(--surface-2);
}
.compose-thumb img { width:100%; height:100%; object-fit:cover; display:block; }
.compose-thumb-loading { display: flex; align-items: center; justify-content: center; }
.compose-thumb-spinner {
  width: 22px; height: 22px; border-radius: 50%;
  border: 2.5px solid var(--glass-border);
  border-top-color: var(--green);
  animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.compose-thumb-rm {
  position: absolute; top: 4px; right: 4px;
  background: rgba(0,0,0,.5); color: #fff;
  backdrop-filter: blur(8px);
  border: none; border-radius: 50%;
  width: 22px; height: 22px; font-size: 12px;
  cursor: pointer; display: flex; align-items: center; justify-content: center;
}
.compose-toolbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 16px;
  padding-bottom: max(env(safe-area-inset-bottom, 0px) + 10px, 14px);
  border-top: 0.5px solid var(--divider);
  flex-shrink: 0;
}
.compose-char-count { font-size: 13px; color: var(--text-muted); font-weight: 500; transition: color .2s; }
.compose-photo-btn {
  position: relative; background: none; border: none; padding: 8px;
  color: var(--text); cursor: pointer; border-radius: var(--radius-xs);
  display: flex; align-items: center; justify-content: center;
  transition: color .15s ease, background .15s ease;
}
.compose-photo-btn:hover, .compose-photo-btn-active { color: var(--green); background: var(--surface-2); }
.compose-photo-count {
  position: absolute; top: 0; right: 0;
  background: var(--green); color: #fff;
  font-size: 9px; font-weight: 700; border-radius: 10px;
  padding: 1px 4px; line-height: 1.4;
}

/* Lightbox */
.lightbox-overlay {
  position:fixed; inset:0; z-index:2000;
  background:rgba(0,0,0,.88);
  backdrop-filter:blur(16px);
  display:flex; align-items:center; justify-content:center;
}
.lightbox-img { max-width:94vw; max-height:88vh; object-fit:contain; border-radius:6px; }
.lightbox-btn {
  position:absolute; top:50%; transform:translateY(-50%);
  background:rgba(255,255,255,.12); backdrop-filter:blur(10px);
  color:#fff; border:0.5px solid rgba(255,255,255,.15);
  border-radius:50%; width:44px; height:44px; font-size:24px; cursor:pointer;
}
.lightbox-btn:first-of-type { left:16px; }
.lightbox-btn:last-of-type { right:16px; }
.lightbox-close {
  position:absolute; top:16px; right:16px;
  background:rgba(255,255,255,.12); backdrop-filter:blur(10px);
  color:#fff; border:0.5px solid rgba(255,255,255,.15);
  border-radius:50%; width:36px; height:36px; font-size:18px; cursor:pointer;
}

/* ── Profile Page — Glass ─────────────────────────────────── */
.profile-hero {
  padding: 24px 16px 20px;
  display: flex; align-items: center; gap: 16px;
  background: var(--surface);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  border: 0.5px solid var(--glass-border);
  margin: 8px 16px;
  border-radius: var(--radius);
  box-shadow: var(--glass-specular), var(--shadow);
}
.profile-info { flex: 1; min-width: 0; }
.profile-name { font-size: 20px; font-weight: 700; letter-spacing: -0.4px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.profile-username { font-size: 13px; color: var(--text-muted); margin-top: 3px; }
.profile-enc-badge {
  display: inline-flex; align-items: center; gap: 4px; margin-top: 6px;
  padding: 3px 10px;
  background: rgba(7,193,96,.1);
  backdrop-filter: blur(8px);
  border: 0.5px solid rgba(7,193,96,.15);
  border-radius: var(--radius-pill);
  font-size: 11px; font-weight: 600; color: var(--green);
  letter-spacing: 0.2px;
}
.profile-arrow { color: var(--text-muted); font-size: 20px; }

/* ── Avatar Upload ─────────────────────────────────────────── */
.avatar-upload-wrap { position: relative; cursor: pointer; flex-shrink: 0; }
.avatar-upload-wrap:active .avatar { opacity: .75; transform: scale(0.95); }
.avatar-camera-badge {
  position: absolute; bottom: 0; right: 0;
  width: 28px; height: 28px; border-radius: 50%;
  background: var(--green);
  border: 2px solid var(--surface-solid);
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; line-height: 1;
  box-shadow: 0 2px 8px rgba(0,0,0,.2), inset 0 1px 0 rgba(255,255,255,.2);
  pointer-events: none;
}

/* ── Discover Page — Glass Cards ──────────────────────────── */
.discover-group {
  background: var(--surface);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  border-radius: var(--radius);
  margin: 0 16px 12px;
  overflow: hidden;
  border: 0.5px solid var(--glass-border);
  box-shadow: var(--glass-specular), var(--shadow);
}
.discover-item {
  display: flex; align-items: center; gap: 14px;
  padding: 14px 16px; cursor: pointer;
  transition: background .15s ease, transform .12s ease;
  position: relative;
}
.discover-item:active { background: var(--surface-2); transform: scale(0.985); }
.discover-item + .discover-item::before {
  content: ''; position: absolute; top: 0; left: 62px; right: 16px;
  height: .5px; background: var(--divider);
}
.discover-icon {
  width: 38px; height: 38px; border-radius: 11px;
  display: flex; align-items: center; justify-content: center;
  font-size: 20px; flex-shrink: 0;
  box-shadow: 0 2px 6px rgba(0,0,0,.1);
}
.discover-label { flex: 1; font-size: 16px; font-weight: 400; }
.discover-chevron { color: var(--text-muted); font-size: 16px; }

/* ── Language Picker — Glass Sheet ─────────────────────────── */
.lang-picker {
  position: fixed; inset: 0; z-index: 500;
  display: flex; align-items: flex-end;
}
.lang-picker-backdrop {
  position: absolute; inset: 0;
  background: rgba(0,0,0,.35);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}
.lang-picker-sheet {
  position: relative; width: 100%;
  background: var(--surface);
  backdrop-filter: blur(var(--glass-blur)) saturate(var(--glass-saturate));
  -webkit-backdrop-filter: blur(var(--glass-blur)) saturate(var(--glass-saturate));
  border-radius: 24px 24px 0 0;
  padding-bottom: max(16px, var(--safe-bottom));
  border-top: 0.5px solid var(--glass-border);
  box-shadow: var(--glass-specular), var(--shadow-lg);
  animation: slideUp .3s cubic-bezier(.2,.9,.4,1);
}
@keyframes slideUp {
  from { transform: translateY(100%); }
  to   { transform: translateY(0); }
}
.lang-picker-handle {
  width: 36px; height: 4px;
  background: var(--glass-border);
  border-radius: 2px; margin: 10px auto 16px;
}
.lang-picker-title { padding: 0 20px 12px; font-size: 17px; font-weight: 600; }
.lang-option {
  display: flex; align-items: center; gap: 14px;
  padding: 14px 20px; cursor: pointer;
  transition: background .15s ease;
  border-radius: var(--radius-sm);
  margin: 0 8px;
}
.lang-option:active { background: var(--surface-2); }
.lang-option.selected { color: var(--green); }
.lang-flag { font-size: 24px; }
.lang-name { flex: 1; font-size: 16px; font-weight: 400; }
.lang-check { color: var(--green); font-size: 18px; }

/* ── Empty State ───────────────────────────────────────────── */
.empty-state {
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  padding: 80px 32px; gap: 10px; text-align: center;
}
.empty-icon { font-size: 52px; margin-bottom: 4px; opacity: .5; }
.empty-title { font-size: 17px; font-weight: 600; }
.empty-hint { font-size: 14px; color: var(--text-muted); }

/* ── Skeleton ──────────────────────────────────────────────── */
.skeleton {
  background: linear-gradient(90deg,
    var(--surface-2) 25%, var(--glass-border) 50%, var(--surface-2) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: 8px;
}
@keyframes shimmer {
  from { background-position: 200% 0; }
  to   { background-position: -200% 0; }
}

/* ── Btn pill — Glass ─────────────────────────────────────── */
.btn-pill {
  padding: 7px 16px;
  border-radius: var(--radius-pill);
  border: none;
  font-size: 14px; font-family: inherit; font-weight: 600;
  cursor: pointer;
  transition: background .15s ease, transform .12s cubic-bezier(.34,1.56,.64,1);
  flex-shrink: 0;
}
.btn-pill:active { transform: scale(.93); }
.btn-green {
  background: linear-gradient(135deg, #0BD46A, #07C160);
  color: #fff;
  box-shadow: 0 2px 10px var(--green-glow), inset 0 1px 0 rgba(255,255,255,.2);
}
.btn-outline {
  background: var(--surface);
  backdrop-filter: blur(12px);
  color: var(--text);
  border: 0.5px solid var(--glass-border);
  box-shadow: var(--glass-highlight);
}

.flex-1   { flex: 1; min-width: 0; }
.hidden   { display: none !important; }
.text-muted { color: var(--text-muted); }
.text-green { color: var(--green); }

/* ── Bubble Timestamp ──────────────────────────────────────── */
.bubble-ts {
  font-size: 10px; color: var(--text-muted);
  margin: 1px 14px 4px;
  display: flex; align-items: center; gap: 3px;
  user-select: none;
}
.bubble-ts-out { justify-content: flex-end; }
.msg-row.in  .bubble-ts { justify-content: flex-start; padding-left: 48px; }
.msg-row.out .bubble-ts { justify-content: flex-end; }

/* ── Message Status ────────────────────────────────────────── */
.msg-status { font-size: 11px; font-weight: 600; line-height: 1; transition: color .3s; }
.msg-status-sent      { color: var(--text-muted); }
.msg-status-delivered { color: var(--green); }
.msg-status-read      { color: #34B7F1; }

/* ── Tab Badge (contacts red dot) ──────────────────────────── */
.tab-badge-sm {
  position: absolute; top: 4px; right: calc(50% - 18px);
  width: 7px; height: 7px;
  background: var(--red);
  border-radius: 50%;
  border: 1.5px solid rgba(255,255,255,.3);
  box-shadow: 0 0 6px rgba(255,59,48,.3);
}

/* ══════════════════════════════════════════════════════════════
   Call UI — Liquid Glass
   ══════════════════════════════════════════════════════════════ */

/* Overlay root */
#pp-call-overlay { position: fixed; inset: 0; z-index: 8000; }

/* ── Base screen ──────────────────────────────────────────── */
.call-screen {
  position: relative; width: 100%; height: 100%;
  display: flex; flex-direction: column;
  overflow: hidden; color: #fff; user-select: none;
}
.call-screen.call-minimized {
  height: auto; bottom: 0; top: auto;
  border-radius: 20px 20px 0 0;
  position: fixed; width: 100%;
}

/* ── Calling / Incoming backgrounds ──────────────────────── */
.call-incoming,
.call-calling {
  background: linear-gradient(160deg, #0d0f1a 0%, #0a2a1f 55%, #07C160 150%);
}
.call-bg-blur {
  position: absolute; inset: 0;
  background: radial-gradient(ellipse 70% 50% at 50% 30%, rgba(7,193,96,.25), transparent);
  pointer-events: none;
}

.call-content {
  position: relative;
  display: flex; flex-direction: column; align-items: center;
  flex: 1;
  padding-top: max(80px, calc(var(--safe-top) + 60px));
  gap: 8px;
}

/* ── Avatar ───────────────────────────────────────────────── */
.call-avatar-wrap { display: flex; align-items: center; justify-content: center; }
.avatar-call {
  width: 100px; height: 100px; border-radius: 50%;
  font-size: 40px; font-weight: 700;
  box-shadow: 0 0 0 8px rgba(255,255,255,.12), 0 0 50px rgba(7,193,96,.35);
  animation: callAvatarPulse 2s ease-in-out infinite;
}
.avatar-call-lg {
  width: 130px; height: 130px; border-radius: 50%;
  font-size: 52px; font-weight: 700;
  box-shadow: 0 0 0 10px rgba(255,255,255,.08);
}
@keyframes callAvatarPulse {
  0%, 100% { box-shadow: 0 0 0 8px rgba(255,255,255,.12), 0 0 50px rgba(7,193,96,.35); }
  50%       { box-shadow: 0 0 0 18px rgba(255,255,255,.05), 0 0 70px rgba(7,193,96,.5); }
}

.call-name     { font-size: 26px; font-weight: 700; letter-spacing: -.5px; margin-top: 16px; text-shadow: 0 1px 6px rgba(0,0,0,.4); }
.call-subtitle { font-size: 14px; opacity: .75; margin-top: 4px; }
.call-pulse    { animation: subtitlePulse 1.4s ease-in-out infinite; }
@keyframes subtitlePulse {
  0%,100% { opacity: .5; } 50% { opacity: 1; }
}

/* ── Incoming buttons ─────────────────────────────────────── */
.call-actions-incoming {
  position: absolute;
  bottom: max(60px, calc(var(--safe-bottom) + 40px));
  left: 0; right: 0;
  display: flex; justify-content: center; gap: 28px;
}
.call-action-btn {
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  border: none; background: none; cursor: pointer;
  color: #fff; font-size: 13px; font-weight: 500; font-family: inherit;
}
.call-action-btn > svg,
.call-action-btn > span:first-child {
  width: 64px; height: 64px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
}
.call-reject  > svg { background: var(--red);  box-shadow: 0 4px 24px rgba(255,59,48,.45), inset 0 1px 0 rgba(255,255,255,.15); }
.call-accept  > svg { background: var(--green); box-shadow: 0 4px 24px rgba(7,193,96,.45), inset 0 1px 0 rgba(255,255,255,.15); }
.call-accept-voice > svg { background: rgba(99,99,102,.6); backdrop-filter: blur(12px); }
.call-action-btn:active > svg { transform: scale(.88); }

/* ── Active call — video ──────────────────────────────────── */
.call-active { background: #000; }

/* Remote video grid */
.call-remote-grid { flex: 1; display: grid; background: #1a1a1a; overflow: hidden; }
.call-remote-grid[data-count="0"] { background: #000; }
.call-remote-grid[data-count="1"] { grid-template-columns: 1fr; }
.call-remote-grid[data-count="2"] { grid-template-columns: 1fr 1fr; }
.call-remote-grid[data-count="3"],
.call-remote-grid[data-count="4"] { grid-template-columns: 1fr 1fr; grid-template-rows: 1fr 1fr; }
.call-remote-grid[data-count="5"],
.call-remote-grid[data-count="6"] { grid-template-columns: 1fr 1fr 1fr; }

.call-remote-slot { position: relative; overflow: hidden; background: #222; }
.call-remote-video { width:100%; height:100%; object-fit:cover; display:block; }

/* Local PiP — Glass */
.call-pip-wrap {
  position: absolute;
  right: 14px; bottom: calc(var(--safe-bottom) + 130px);
  width: 100px; height: 140px;
  border-radius: 16px; overflow: hidden;
  box-shadow: 0 4px 24px rgba(0,0,0,.5);
  z-index: 10;
  border: 1px solid rgba(255,255,255,.18);
}
.call-pip-video { width:100%; height:100%; object-fit:cover; display:block; }
.call-pip-switch {
  position: absolute; bottom: 4px; right: 4px;
  background: rgba(0,0,0,.45); backdrop-filter: blur(8px);
  border: none; border-radius: 50%;
  width: 26px; height: 26px; font-size: 13px;
  color: #fff; cursor: pointer; display: flex; align-items: center; justify-content: center;
}

/* Voice-only mode */
.call-voice-only .call-remote-grid { background: linear-gradient(160deg, #0d0f1a, #0a2a1f); }
.call-voice-avatar {
  display: flex; align-items: center; justify-content: center;
  width: 100%; height: 100%;
}

/* ── Topbar (in-call) — Glass ─────────────────────────────── */
.call-topbar {
  position: absolute;
  top: 0; left: 0; right: 0;
  padding: max(16px, calc(var(--safe-top) + 8px)) 12px 12px;
  display: flex; align-items: center; gap: 10px;
  background: linear-gradient(to bottom, rgba(0,0,0,.5), transparent);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  z-index: 5;
}
.call-topbar-back {
  background: rgba(255,255,255,.1); backdrop-filter: blur(8px);
  border: 0.5px solid rgba(255,255,255,.12);
  color: rgba(255,255,255,.85);
  font-size: 22px; cursor: pointer; width: 36px; height: 36px;
  display: flex; align-items: center; justify-content:center;
  border-radius: 50%; transform: rotate(-90deg);
  transition: background .15s ease;
}
.call-topbar-back:active { background: rgba(255,255,255,.2); }
.call-topbar-name  { font-size: 16px; font-weight: 600; }
.call-topbar-timer { font-size: 13px; opacity: .7; }

/* ── Controls bar — Liquid Glass ──────────────────────────── */
.call-controls {
  position: absolute;
  bottom: 0; left: 0; right: 0;
  padding: 16px 24px max(28px, calc(var(--safe-bottom) + 16px));
  display: flex; justify-content: space-around; align-items: center;
  background: rgba(0,0,0,.25);
  backdrop-filter: blur(30px) saturate(180%);
  -webkit-backdrop-filter: blur(30px) saturate(180%);
  border-top: 0.5px solid rgba(255,255,255,.08);
  z-index: 5;
}
.call-ctrl-btn {
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  background: none; border: none; cursor: pointer; color: #fff; font-family: inherit;
  transition: transform .15s cubic-bezier(.34,1.56,.64,1);
}
.call-ctrl-btn:active { transform: scale(.85); }
.ctrl-icon {
  width: 56px; height: 56px; border-radius: 50%;
  background: rgba(255,255,255,.15);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 0.5px solid rgba(255,255,255,.12);
  display: flex; align-items: center; justify-content: center;
  font-size: 22px;
  transition: background .18s ease, box-shadow .18s ease;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.15);
}
.call-ctrl-btn.ctrl-active .ctrl-icon {
  background: rgba(255,255,255,.3);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.2), 0 0 12px rgba(255,255,255,.1);
}
.ctrl-label { font-size: 11px; font-weight: 500; opacity: .85; }
.call-ctrl-end .ctrl-icon {
  background: var(--red);
  border-color: transparent;
  box-shadow: 0 3px 16px rgba(255,59,48,.4), inset 0 1px 0 rgba(255,255,255,.15);
}

/* ── Chat topbar call buttons ─────────────────────────────── */
.topbar-call-btns {
  display: flex; align-items: center; gap: 2px; flex-shrink: 0;
}

/* ── Glass shimmer animation ──────────────────────────────── */
@keyframes glassShimmer {
  0%   { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}

/* ── Devices Page ─────────────────────────────────────────── */
.device-item {
  gap: 12px !important;
}
.device-icon-wrap {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  background: var(--surface-2);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  flex-shrink: 0;
}
.device-current-icon {
  background: rgba(7,193,96,.12);
  color: var(--green);
}
.device-info {
  flex: 1;
  min-width: 0;
}
.device-name {
  font-size: 15px;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.device-detail {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.device-online {
  font-size: 12px;
  color: var(--green);
  font-weight: 500;
  margin-top: 2px;
}
.device-revoke-btn {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-muted);
  padding: 8px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background .18s ease, color .18s ease;
}
.device-revoke-btn:active {
  background: rgba(255,59,48,.1);
  color: var(--red);
}
.devices-loading {
  text-align: center;
  padding: 40px 16px;
  color: var(--text-muted);
  font-size: 14px;
}

/* ── Modal Overlay ─────────────────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.45);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 800;
  animation: fadeIn .2s ease;
}
.modal-card {
  background: var(--surface-solid);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  animation: modalPop .25s cubic-bezier(.2,1.2,.4,1);
}
@keyframes modalPop {
  from { transform: scale(.9) translateY(20px); opacity: 0; }
  to   { transform: scale(1) translateY(0); opacity: 1; }
}
.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  border-bottom: 0.5px solid var(--divider);
}

/* ── Group Chat Bubbles ──────────────────────────────────── */
.group-bubble-wrap {
  display: flex;
  flex-direction: column;
  gap: 2px;
  max-width: min(72vw, 340px);
}
.group-sender-name {
  font-size: 12px;
  font-weight: 600;
  color: var(--blue);
  padding-left: 4px;
  letter-spacing: -0.1px;
}

/* ── Member Checkbox ─────────────────────────────────────── */
.member-checkbox {
  flex-shrink: 0;
  width: 22px;
  height: 22px;
  margin-right: 4px;
}

/* ── Role Badges ──────────────────────────────────────────── */
.role-badge {
  display: inline-block;
  font-size: 10px;
  font-weight: 600;
  padding: 1px 6px;
  border-radius: var(--radius-pill);
  vertical-align: middle;
  margin-left: 4px;
}
.role-owner {
  background: rgba(255,149,0,.15);
  color: var(--orange);
}
.role-admin {
  background: rgba(0,122,255,.12);
  color: var(--blue);
}

/* ── Danger Action Rows ───────────────────────────────────── */
.danger-action {
  justify-content: center;
  color: var(--red);
  cursor: pointer;
  font-weight: 500;
  padding: 14px 16px;
  background: var(--surface);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  border-radius: var(--radius-sm);
  margin: 8px 16px;
  transition: background .15s ease;
}
.danger-action:active {
  background: rgba(255,59,48,.1);
}

/* ── Page Scroll Container ────────────────────────────────── */
.page-scroll {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  background: var(--bg);
}
.page-scroll::-webkit-scrollbar { display: none; }

/* ── Group Info Header ────────────────────────────────────── */
.group-info-header {
  background: var(--surface);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  margin: 12px 16px;
  border-radius: var(--radius);
  border: 0.5px solid var(--glass-border);
  box-shadow: var(--glass-specular), var(--shadow);
}

/* ── Settings Section ─────────────────────────────────────── */
.settings-section {
  margin-bottom: 8px;
}

/* ── 5-tab badge positioning fix ──────────────────────────── */
.tab-badge-sm {
  width: 8px;
  min-width: 8px;
  height: 8px;
  padding: 0;
  right: calc(50% - 16px);
  top: 6px;
}

/* ── Mute Toggle Switch ───────────────────────────────────── */
.mute-toggle {
  width: 50px;
  height: 30px;
  border-radius: 15px;
  background: var(--surface-2);
  border: 0.5px solid var(--glass-border);
  position: relative;
  cursor: pointer;
  transition: background .25s ease, border-color .25s ease;
  flex-shrink: 0;
}
.mute-toggle-on {
  background: var(--green);
  border-color: var(--green);
}
.mute-toggle-knob {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: #fff;
  position: absolute;
  top: 2px;
  left: 2px;
  box-shadow: 0 2px 6px rgba(0,0,0,.15);
  transition: transform .25s cubic-bezier(.34,1.56,.64,1);
}
.mute-toggle-on .mute-toggle-knob {
  transform: translateX(20px);
}

/* ── Mute indicator in chat list ──────────────────────────── */
.chat-muted-icon {
  color: var(--text-muted);
  flex-shrink: 0;
  margin-left: 4px;
  opacity: .6;
}
