/* ============================================================
   hlorchat v3.0 «liquid night» — iOS 26 liquid glass × red night
   hloridat.uk · @zxclinux
   ============================================================ */

/* ---------- THEMES ---------- */
:root, [data-theme="rednight"] {
  --bg: #0a0a0e;
  --glass: rgba(26, 26, 34, .66);
  --glass-2: rgba(38, 38, 48, .55);
  --glass-3: rgba(48, 48, 60, .5);
  --stroke: rgba(255, 255, 255, .09);
  --stroke-2: rgba(255, 255, 255, .16);
  --text: #f4f4f8;
  --muted: #8f8f9d;
  --accent: #ff3b42;
  --accent-soft: rgba(255, 59, 66, .14);
  --accent-grad: linear-gradient(150deg, #ff6a5e, #e01f2a);
  --bubble-me: linear-gradient(150deg, #ff5a50, #d81e28);
  --bubble-them: rgba(42, 42, 52, .78);
  --green: #30d158;
  --yellow: #ffd60a;
  --danger: #ff453a;
  --glow: rgba(255, 59, 66, .38);
  --shadow: 0 18px 50px rgba(0, 0, 0, .5);
  --blur: blur(26px) saturate(170%);
}
[data-theme="amoled"] {
  --bg: #000000;
  --glass: rgba(14, 14, 17, .72);
  --glass-2: rgba(24, 24, 29, .6);
  --glass-3: rgba(34, 34, 40, .5);
  --stroke: rgba(255, 255, 255, .08);
  --stroke-2: rgba(255, 255, 255, .14);
  --text: #f2f2f6;
  --muted: #86858f;
  --accent: #ff2430;
  --accent-soft: rgba(255, 36, 48, .13);
  --accent-grad: linear-gradient(150deg, #ff5546, #d10f1f);
  --bubble-me: linear-gradient(150deg, #ff4a3e, #c60f1d);
  --bubble-them: rgba(30, 30, 35, .85);
  --green: #32d74b;
  --glow: rgba(255, 36, 48, .4);
}
[data-theme="gnome"] {
  --bg: #141419;
  --glass: rgba(34, 34, 42, .66);
  --glass-2: rgba(46, 46, 56, .55);
  --glass-3: rgba(58, 58, 70, .5);
  --stroke: rgba(255, 255, 255, .1);
  --stroke-2: rgba(255, 255, 255, .17);
  --text: #f2f1f5;
  --muted: #9c9aa8;
  --accent: #ff5259;
  --accent-soft: rgba(255, 82, 89, .14);
  --accent-grad: linear-gradient(150deg, #ff7a72, #e5303c);
  --bubble-me: linear-gradient(150deg, #ff6a61, #d92b36);
  --bubble-them: rgba(56, 56, 68, .8);
  --green: #33d17a;
  --glow: rgba(255, 82, 89, .35);
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html, body { height: 100%; overflow: hidden; }
body {
  font-family: 'Inter', -apple-system, 'SF Pro Text', 'Segoe UI Variable', 'Segoe UI', Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14.5px;
  -webkit-font-smoothing: antialiased;
  transition: background .4s ease;
}
.hidden { display: none !important; }
.muted { color: var(--muted); }
.red-txt { color: var(--accent); }
.mono { font-family: 'JetBrains Mono', monospace; }

/* ---------- AURORA BACKGROUND ---------- */
.aurora { position: fixed; inset: 0; overflow: hidden; pointer-events: none; z-index: 0; }
.aurora i { position: absolute; border-radius: 50%; filter: blur(90px); opacity: .5; }
.aurora .a1 {
  width: 55vw; height: 55vw; top: -22vw; right: -14vw;
  background: radial-gradient(circle, rgba(255, 59, 66, .22), transparent 65%);
  animation: aurFloat1 26s ease-in-out infinite alternate;
}
.aurora .a2 {
  width: 44vw; height: 44vw; bottom: -20vw; left: -12vw;
  background: radial-gradient(circle, rgba(122, 40, 222, .13), transparent 65%);
  animation: aurFloat2 32s ease-in-out infinite alternate;
}
.aurora .a3 {
  width: 30vw; height: 30vw; top: 40%; left: 34%;
  background: radial-gradient(circle, rgba(255, 59, 66, .08), transparent 60%);
  animation: aurFloat1 38s ease-in-out infinite alternate-reverse;
}
@keyframes aurFloat1 { to { transform: translate(-6vw, 5vh) scale(1.12); } }
@keyframes aurFloat2 { to { transform: translate(7vw, -6vh) scale(1.08); } }

/* ---------- GLASS BASE ---------- */
.glass {
  background: var(--glass);
  backdrop-filter: var(--blur);
  -webkit-backdrop-filter: var(--blur);
  border: 1px solid var(--stroke);
}

/* ---------- BOOT ---------- */
.boot {
  position: fixed; inset: 0; z-index: 1000; background: var(--bg);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 34px;
}
.boot-logo {
  font-family: 'JetBrains Mono', monospace;
  color: var(--accent); font-size: 15px; line-height: 1.25;
  text-shadow: 0 0 26px var(--glow);
  animation: flicker 2.6s linear infinite, bootLogoIn .7s cubic-bezier(.2, 1.2, .4, 1) both;
}
@keyframes bootLogoIn { from { opacity: 0; transform: scale(.92); letter-spacing: 6px; } }
@keyframes flicker { 0%,100% { opacity: 1; } 92% { opacity: 1; } 93% { opacity: .55; } 94% { opacity: 1; } 96% { opacity: .7; } 97% { opacity: 1; } }
.boot-box { width: 460px; max-width: 88vw; display: flex; flex-direction: column; gap: 12px; animation: fadeUp .5s ease .15s both; }
.boot-lines { font-family: 'JetBrains Mono', monospace; font-size: 12.5px; color: var(--muted); min-height: 96px; }
.boot-lines .ok { color: var(--green); }
.boot-lines div { animation: slideIn .25s ease both; }
.boot-bar { height: 5px; border-radius: 4px; overflow: hidden; background: var(--glass-2); border: 1px solid var(--stroke); }
#bootBar { height: 100%; width: 0%; background: var(--accent-grad); box-shadow: 0 0 14px var(--glow); transition: width .18s linear; }
.boot-pct { font-family: 'JetBrains Mono', monospace; font-size: 11px; color: var(--muted); text-align: right; }
.boot.done { animation: bootOut .45s ease forwards; }
@keyframes bootOut { to { opacity: 0; visibility: hidden; transform: scale(1.04); } }

/* ---------- KEYFRAMES ---------- */
@keyframes slideIn { from { opacity: 0; transform: translateY(-6px); } }
@keyframes fadeUp { from { opacity: 0; transform: translateY(14px); } }
@keyframes msgIn { from { opacity: 0; transform: translateY(10px) scale(.96); } }
@keyframes popIn { from { opacity: 0; transform: scale(.8); } }
@keyframes fadeIn { from { opacity: 0; } }
@keyframes pulse { 50% { opacity: .4; } }
@keyframes springIn { from { opacity: 0; transform: scale(.9) translateY(16px); } }

/* ---------- AUTH ---------- */
.auth {
  position: fixed; inset: 0; z-index: 900;
  display: flex; align-items: center; justify-content: center;
  animation: fadeIn .4s both;
}
.auth-card {
  position: relative; overflow: hidden;
  width: 400px; max-width: 92vw;
  background: var(--glass);
  backdrop-filter: var(--blur); -webkit-backdrop-filter: var(--blur);
  border: 1px solid var(--stroke-2);
  border-radius: 28px; padding: 34px 34px 26px;
  box-shadow: var(--shadow), 0 0 80px rgba(255, 59, 66, .07);
  animation: springIn .55s cubic-bezier(.2, 1.15, .35, 1) both;
}
.auth-card::before {
  content: ''; position: absolute; top: -55%; left: -15%;
  width: 130%; height: 110%;
  background: radial-gradient(closest-side, rgba(255, 59, 66, .13), transparent 70%);
  pointer-events: none; animation: authGlow 5s ease-in-out infinite alternate;
}
@keyframes authGlow { to { transform: translateX(6%) scale(1.08); opacity: .7; } }
.auth-card > * { position: relative; }
.auth-logo { font-family: 'JetBrains Mono', monospace; color: var(--accent); font-size: 13px; line-height: 1.4; text-align: center; margin-bottom: 8px; text-shadow: 0 0 18px var(--glow); }
.auth-sub { color: var(--muted); font-size: 12.5px; text-align: center; margin-bottom: 22px; }
.fld-label { display: block; font-size: 12px; font-weight: 600; color: var(--muted); margin: 14px 0 7px; letter-spacing: .3px; }
.auth input, .set-card input[type="text"], .set-card input[type="password"], .set-card textarea, .set-card select {
  width: 100%;
  background: var(--glass-2); border: 1px solid var(--stroke); border-radius: 14px;
  color: var(--text); font-family: inherit; font-size: 14.5px;
  padding: 12px 15px; outline: none; resize: none;
  transition: border-color .2s, box-shadow .2s, background .2s;
}
.auth input:focus, .set-card input:focus, .set-card textarea:focus, .set-card select:focus {
  border-color: var(--accent); box-shadow: 0 0 0 3.5px var(--accent-soft); background: var(--glass-3);
}
.auth input::placeholder, .set-card input::placeholder, .set-card textarea::placeholder { color: #5b5a68; }
.auth-hint { min-height: 17px; font-size: 12px; margin-top: 9px; }
.auth-hint.err { color: var(--danger); }
.auth-hint.okk { color: var(--green); }
.auth-btns { display: flex; gap: 10px; margin-top: 16px; }
.btn-wide { flex: 1; padding: 12px 0; font-size: 14.5px; justify-content: center; }
.auth-foot { margin-top: 22px; text-align: center; font-family: 'JetBrains Mono', monospace; font-size: 11px; color: #5b5a68; letter-spacing: .4px; }

/* ---------- LAYOUT ---------- */
.app { position: relative; z-index: 1; display: flex; height: 100vh; padding: 14px; gap: 14px; animation: appIn .5s cubic-bezier(.2, .9, .3, 1) both; }
@keyframes appIn { from { opacity: 0; transform: translateY(14px) scale(.99); } }

/* ---------- SIDEBAR ---------- */
.sidebar {
  width: 330px; min-width: 330px;
  border-radius: 26px;
  display: flex; flex-direction: column;
  padding: 14px 12px 12px;
  box-shadow: var(--shadow);
}
.me-card {
  display: flex; align-items: center; gap: 12px;
  background: var(--glass-2); border: 1px solid var(--stroke);
  border-radius: 18px; padding: 10px 12px; cursor: pointer;
  transition: all .2s cubic-bezier(.2, .8, .3, 1);
}
.me-card:hover { background: var(--glass-3); border-color: var(--stroke-2); transform: translateY(-1px); }
.me-card:active { transform: scale(.98); }
.me-ava-wrap { position: relative; width: 42px; height: 42px; flex-shrink: 0; }
.me-ava-wrap .avatar, .me-ava-wrap img { width: 42px; height: 42px; font-size: 17px; }
.me-ava-wrap .dot { position: absolute; right: -1px; bottom: -1px; width: 12px; height: 12px; border: 2.5px solid #1a1a22; }
.me-info { flex: 1; min-width: 0; }
.me-name { font-weight: 700; font-size: 15px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.me-sub { display: flex; align-items: center; gap: 6px; font-size: 11.5px; color: var(--muted); margin-top: 2px; }
.me-sub .dot { width: 7px; height: 7px; }
.me-chev { width: 16px; height: 16px; color: var(--muted); flex-shrink: 0; }

/* segmented control */
.seg {
  display: flex; gap: 4px; margin: 14px 0 12px;
  background: var(--glass-2); border: 1px solid var(--stroke);
  border-radius: 16px; padding: 4px;
}
.seg-btn {
  flex: 1; position: relative;
  display: flex; align-items: center; justify-content: center; gap: 6px;
  font-family: inherit; font-size: 12px; font-weight: 600; color: var(--muted);
  background: transparent; border: none; border-radius: 12px;
  padding: 8px 2px; cursor: pointer;
  transition: all .25s cubic-bezier(.2, .8, .3, 1);
}
.seg-btn svg { width: 15px; height: 15px; }
.seg-btn:hover { color: var(--text); }
.seg-btn.active {
  color: #fff; background: var(--accent-grad);
  box-shadow: 0 4px 16px var(--glow), inset 0 1px 0 rgba(255, 255, 255, .22);
}
.badge {
  position: absolute; top: -4px; right: -2px;
  min-width: 17px; height: 17px; line-height: 17px; padding: 0 4px;
  background: var(--danger); color: #fff; text-align: center;
  border-radius: 9px; font-size: 10px; font-weight: 800;
  border: 2px solid #16161e;
  animation: popIn .3s cubic-bezier(.2, 1.4, .4, 1) both;
}
.seg-btn.active .badge { border-color: transparent; box-shadow: 0 0 0 2px rgba(255,255,255,.15); }

.panel { flex: 1; display: flex; flex-direction: column; min-height: 0; animation: fadeUp .3s ease both; }
.item-list { list-style: none; overflow-y: auto; flex: 1; padding: 2px; }

/* search */
.search-wrap {
  display: flex; align-items: center; gap: 8px;
  background: var(--glass-2); border: 1px solid var(--stroke);
  border-radius: 13px; padding: 8px 12px; margin-bottom: 10px;
  transition: border-color .2s, box-shadow .2s;
}
.search-wrap:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.search-wrap svg { width: 14px; height: 14px; color: var(--muted); flex-shrink: 0; }
.search-wrap input { flex: 1; min-width: 0; background: none; border: none; outline: none; color: var(--text); font-family: inherit; font-size: 13.5px; }
.search-wrap input::placeholder { color: #5b5a68; }

/* chat / friend items */
.chat-item, .friend-item {
  position: relative;
  display: flex; align-items: center; gap: 12px;
  padding: 9px 10px; border-radius: 16px; cursor: pointer;
  border: 1px solid transparent; margin-bottom: 2px;
  transition: background .18s, border-color .18s;
  animation: slideIn .28s ease both;
}
.chat-item:hover, .friend-item:hover { background: var(--glass-2); }
.chat-item.active, .friend-item.active { background: var(--accent-soft); border-color: rgba(255, 59, 66, .35); }
.avatar {
  width: 46px; height: 46px; border-radius: 50%;
  background: linear-gradient(135deg, #d92630, #4a0e13);
  color: #fff; font-weight: 700; font-size: 18px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0; object-fit: cover; user-select: none;
}
.ava-wrap { position: relative; width: 46px; height: 46px; flex-shrink: 0; }
.ava-wrap .dot {
  position: absolute; right: 0; bottom: 0;
  width: 13px; height: 13px; border: 3px solid #191921; box-shadow: none;
}
.ci-body { flex: 1; min-width: 0; }
.ci-name { font-size: 14.5px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ci-preview { font-size: 12.5px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; margin-top: 2px; }
.ci-preview.typing { color: var(--accent); font-style: italic; }
.ci-side { display: flex; flex-direction: column; align-items: flex-end; gap: 5px; flex-shrink: 0; }
.ci-time { font-size: 10.5px; color: #5b5a68; }
.ci-unread {
  min-width: 19px; height: 19px; line-height: 19px; padding: 0 5px;
  background: var(--accent-grad); color: #fff; text-align: center;
  border-radius: 10px; font-size: 10.5px; font-weight: 800;
  box-shadow: 0 3px 10px var(--glow);
  animation: popIn .25s cubic-bezier(.2, 1.4, .4, 1) both;
}
.ci-sub { font-size: 11px; color: var(--muted); margin-top: 2px; }

.add-box { margin-bottom: 10px; padding: 0 2px; }
.input-row { display: flex; gap: 8px; }
.input-row input {
  flex: 1; min-width: 0;
  background: var(--glass-2); border: 1px solid var(--stroke); border-radius: 14px;
  color: var(--text); font-family: inherit; font-size: 13.5px;
  padding: 10px 14px; outline: none; transition: border-color .2s, box-shadow .2s;
}
.input-row input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.input-row input::placeholder { color: #5b5a68; }
.hint { font-size: 11.5px; margin-top: 7px; min-height: 15px; padding: 0 4px; }
.hint.err { color: var(--danger); }
.hint.okk { color: var(--green); }
.panel-empty { color: #5b5a68; font-size: 13px; padding: 30px 10px; text-align: center; line-height: 1.8; }
.panel-empty small { font-size: 11.5px; opacity: .8; }

.sidebar-foot { border-top: 1px solid var(--stroke); padding: 10px 6px 0; margin-top: 8px; }
.status-row { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--muted); font-family: 'JetBrains Mono', monospace; }
.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; flex-shrink: 0; }
.dot-green { background: var(--green); box-shadow: 0 0 8px rgba(48, 209, 88, .7); animation: pulse 2.2s ease infinite; }
.dot-yellow { background: var(--yellow); box-shadow: 0 0 8px rgba(255, 214, 10, .6); animation: pulse 1.4s ease infinite; }
.dot-red { background: var(--danger); box-shadow: 0 0 8px rgba(255, 69, 58, .7); animation: pulse 1s ease infinite; }
.dot-grey { background: #54525e; }
.foot-tag { font-size: 10px; color: #4c4b58; margin-top: 7px; letter-spacing: .8px; font-family: 'JetBrains Mono', monospace; }

/* ---------- BUTTONS ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  font-family: inherit; font-size: 13.5px; font-weight: 600;
  background: var(--glass-2); color: var(--text);
  border: 1px solid var(--stroke); border-radius: 999px;
  padding: 9px 18px; cursor: pointer;
  transition: all .2s cubic-bezier(.2, .8, .3, 1);
  user-select: none;
}
.btn:hover { background: var(--glass-3); border-color: var(--stroke-2); transform: translateY(-1px); }
.btn:active { transform: scale(.96); }
.btn svg { width: 16px; height: 16px; }
.btn-primary {
  background: var(--accent-grad); border-color: rgba(255, 120, 110, .5); color: #fff;
  box-shadow: 0 6px 20px var(--glow), inset 0 1px 0 rgba(255, 255, 255, .25);
}
.btn-primary:hover { filter: brightness(1.1); box-shadow: 0 8px 26px var(--glow), inset 0 1px 0 rgba(255, 255, 255, .25); }
.btn-glass { background: var(--glass-2); }
.btn-danger-ghost { background: transparent; border-color: rgba(255, 69, 58, .4); color: var(--danger); }
.btn-danger-ghost:hover { background: rgba(255, 69, 58, .12); border-color: var(--danger); }
.btn-round { border-radius: 50%; width: 42px; height: 42px; padding: 0; flex-shrink: 0; }
.btn-round svg { width: 17px; height: 17px; }
.btn-sq { padding: 9px 13px; }

/* round icon buttons (chat header, composer) */
.rbtn {
  width: 38px; height: 38px; border-radius: 50%; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  background: var(--glass-2); border: 1px solid var(--stroke); color: var(--text);
  cursor: pointer; transition: all .2s cubic-bezier(.2, .8, .3, 1);
}
.rbtn svg { width: 17px; height: 17px; }
.rbtn:hover { background: var(--glass-3); border-color: var(--stroke-2); transform: scale(1.07); }
.rbtn:active { transform: scale(.93); }
.rbtn.danger { background: var(--accent-grad); border-color: rgba(255, 120, 110, .5); color: #fff; box-shadow: 0 4px 16px var(--glow); }
.rbtn.ghost { background: transparent; border-color: transparent; color: var(--muted); }
.rbtn.ghost:hover { background: var(--glass-2); color: var(--text); }

/* ---------- MAIN / VIEWS ---------- */
.main { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.view { animation: viewIn .35s cubic-bezier(.2, .9, .3, 1) both; }
@keyframes viewIn { from { opacity: 0; transform: translateX(18px); } }

.empty-state { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 18px; color: var(--muted); }
.empty-art {
  font-family: 'JetBrains Mono', monospace;
  color: var(--accent); opacity: .75; line-height: 1.4; text-align: left;
  filter: drop-shadow(0 0 22px var(--glow));
  animation: emptyFloat 4.5s ease-in-out infinite;
}
@keyframes emptyFloat { 50% { transform: translateY(-7px); } }
.empty-sub { font-size: 12.5px; letter-spacing: .5px; font-family: 'JetBrains Mono', monospace; }

/* ---------- CHAT ---------- */
.chat { flex: 1; display: flex; flex-direction: column; min-height: 0; }
.chat-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 14px; margin-bottom: 10px;
  border-radius: 22px;
  box-shadow: 0 8px 30px rgba(0, 0, 0, .25);
}
.chat-peer { display: flex; align-items: center; gap: 12px; cursor: pointer; min-width: 0; }
.head-ava { display: inline-flex; align-items: center; }
.head-ava .avatar, .head-ava img { width: 38px !important; height: 38px !important; font-size: 15px; }
.cp-info { min-width: 0; }
#chatPeerName { font-weight: 700; font-size: 15.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cp-status { font-size: 12px; color: var(--muted); margin-top: 1px; transition: color .2s; }
.cp-status.online { color: var(--green); }
.cp-status.typing { color: var(--accent); font-style: italic; }
.chat-actions { display: flex; gap: 8px; }

/* video / facetime */
.video-wrap {
  position: relative; margin-bottom: 10px;
  background: #050507; border: 1px solid var(--stroke);
  border-radius: 24px; overflow: hidden;
  animation: fadeIn .3s both;
  box-shadow: var(--shadow);
}
#remoteVideo { width: 100%; max-height: 46vh; display: block; object-fit: contain; background: #050507; }
#localVideo {
  position: absolute; right: 16px; top: 16px; width: 180px; border-radius: 16px;
  border: 1px solid var(--stroke-2); box-shadow: 0 12px 34px rgba(0, 0, 0, .6);
  animation: popIn .35s cubic-bezier(.2, 1.4, .4, 1) both;
}
.call-duration {
  position: absolute; top: 16px; left: 16px;
  background: rgba(10, 10, 14, .6); backdrop-filter: blur(12px);
  border: 1px solid var(--stroke); border-radius: 999px;
  color: #fff; font-size: 12.5px; font-weight: 600; font-variant-numeric: tabular-nums;
  padding: 6px 13px;
}
.ft-controls {
  position: absolute; bottom: 16px; left: 50%; transform: translateX(-50%);
  display: flex; gap: 12px;
  background: rgba(14, 14, 20, .55); backdrop-filter: blur(20px) saturate(160%);
  border: 1px solid var(--stroke-2); border-radius: 999px; padding: 10px 12px;
  box-shadow: 0 14px 40px rgba(0, 0, 0, .5);
}
.ft-btn {
  width: 50px; height: 50px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  background: rgba(255, 255, 255, .12); border: none; color: #fff;
  cursor: pointer; transition: all .2s cubic-bezier(.2, .8, .3, 1);
}
.ft-btn svg { width: 21px; height: 21px; }
.ft-btn:hover { background: rgba(255, 255, 255, .22); transform: scale(1.08); }
.ft-btn:active { transform: scale(.92); }
.ft-btn.off { background: #fff; color: #111; }
.ft-btn.end { background: var(--danger); box-shadow: 0 6px 20px rgba(255, 69, 58, .5); }
.ft-btn.end:hover { background: #ff6961; }
.share-badge {
  position: absolute; top: 16px; left: 50%; transform: translateX(-50%);
  background: rgba(255, 59, 66, .2); backdrop-filter: blur(12px);
  border: 1px solid var(--accent); color: #ffb3b6;
  font-size: 12px; font-weight: 600; padding: 6px 14px; border-radius: 999px;
}
.video-wrap.audio-only #remoteVideo { max-height: 260px; }

/* аудиозвонок: сцена с аватаром и эквалайзером */
.audio-stage {
  position: absolute; inset: 0; z-index: 1;
  display: none;
  flex-direction: column; align-items: center; justify-content: center; gap: 14px;
  background:
    radial-gradient(300px 200px at 50% 30%, rgba(255, 59, 66, .14), transparent),
    #07070b;
}
.video-wrap.audio-only .audio-stage { display: flex; }
.as-ava {
  width: 110px; height: 110px; border-radius: 50%; overflow: hidden;
  background: linear-gradient(135deg, #d92630, #4a0e13);
  color: #fff; font-size: 44px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  border: 2.5px solid rgba(255, 59, 66, .5);
  box-shadow: 0 0 50px var(--glow);
  animation: avatarBounce 2.2s ease infinite;
}
.as-ava img { width: 100%; height: 100%; object-fit: cover; }
.as-name { font-size: 19px; font-weight: 700; color: #fff; }
.as-eq { display: flex; align-items: flex-end; gap: 5px; height: 26px; }
.as-eq i {
  width: 4px; border-radius: 3px; background: var(--accent);
  box-shadow: 0 0 10px var(--glow);
  animation: eqBounce 1s ease-in-out infinite;
}
.as-eq i:nth-child(1) { height: 30%; animation-delay: 0s; }
.as-eq i:nth-child(2) { height: 70%; animation-delay: .15s; }
.as-eq i:nth-child(3) { height: 100%; animation-delay: .3s; }
.as-eq i:nth-child(4) { height: 60%; animation-delay: .45s; }
.as-eq i:nth-child(5) { height: 35%; animation-delay: .6s; }
@keyframes eqBounce { 50% { transform: scaleY(.35); } }

/* ---------- MESSAGES (iMessage × glass) ---------- */
.messages { flex: 1; overflow-y: auto; padding: 6px 10px 12px; display: flex; flex-direction: column; }
.mrow { display: flex; margin-top: 10px; animation: msgIn .3s cubic-bezier(.2, .9, .3, 1) both; }
.mrow.grp { margin-top: 2px; }
.mrow.me { justify-content: flex-end; }
.mrow.them { justify-content: flex-start; }
.m-ava {
  width: 30px; height: 30px; border-radius: 50%; flex-shrink: 0;
  font-size: 12.5px; margin-right: 8px; align-self: flex-end;
  cursor: pointer; transition: transform .15s ease;
}
.m-ava:hover { transform: scale(1.1); }
.mrow.grp .m-ava { visibility: hidden; height: 0; width: 30px; }
.m-stack { max-width: 68%; display: flex; flex-direction: column; }
.mrow.me .m-stack { align-items: flex-end; }
.m-bubble {
  position: relative;
  padding: 9px 14px 7px;
  border-radius: 21px;
  font-size: 14px; line-height: 1.42;
  white-space: pre-wrap; word-wrap: break-word; overflow-wrap: anywhere;
  box-shadow: 0 3px 14px rgba(0, 0, 0, .22);
}
.mrow.me .m-bubble {
  background: var(--bubble-me); color: #fff;
  border-bottom-right-radius: 6px;
}
.mrow.them .m-bubble {
  background: var(--bubble-them); color: var(--text);
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  border: 1px solid var(--stroke);
  border-bottom-left-radius: 6px;
}
.mrow.me.grp .m-bubble { border-bottom-right-radius: 21px; border-top-right-radius: 8px; }
.mrow.them.grp .m-bubble { border-bottom-left-radius: 21px; border-top-left-radius: 8px; }
.m-meta {
  display: inline-flex; align-items: center; gap: 4px;
  float: right; margin: 7px -4px -2px 10px;
  font-size: 10px; opacity: .62; font-weight: 500;
  user-select: none; white-space: nowrap;
}
.m-meta .m-state { font-size: 10.5px; }
.sysmsg {
  align-self: center; font-size: 11.5px; color: var(--muted);
  background: var(--glass-2); backdrop-filter: blur(12px);
  border: 1px solid var(--stroke);
  padding: 5px 16px; border-radius: 999px; margin: 12px auto 4px;
  animation: msgIn .3s both;
}

/* file message */
.file-msg { display: flex; align-items: center; gap: 11px; min-width: 220px; padding: 3px 0; }
.file-ico {
  width: 40px; height: 40px; border-radius: 12px; flex-shrink: 0;
  background: rgba(255, 255, 255, .14);
  display: flex; align-items: center; justify-content: center;
}
.file-ico svg { width: 19px; height: 19px; }
.mrow.them .file-ico { background: var(--accent-soft); color: var(--accent); }
.file-info { flex: 1; min-width: 0; }
.file-name { font-size: 13px; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-size { font-size: 11px; opacity: .72; margin-top: 1px; }
.prog { height: 4.5px; background: rgba(0, 0, 0, .3); border-radius: 3px; margin-top: 7px; overflow: hidden; }
.mrow.them .prog { background: rgba(255, 255, 255, .12); }
.prog > div { height: 100%; width: 0%; background: currentColor; border-radius: 3px; transition: width .15s linear; }
.file-dl { display: inline-block; margin-top: 7px; font-size: 12px; font-weight: 600; color: inherit; text-decoration: underline; text-underline-offset: 2px; cursor: pointer; opacity: .92; }
.file-dl:hover { opacity: 1; }
.file-expired { font-size: 11px; opacity: .65; margin-top: 5px; }

/* ---------- COMPOSER ---------- */
.composer { padding: 2px 2px 0; }
.composer-pill {
  display: flex; align-items: flex-end; gap: 8px;
  border-radius: 26px; padding: 7px 8px;
  transition: border-color .2s, box-shadow .2s;
}
.composer-pill:focus-within { border-color: rgba(255, 59, 66, .45); box-shadow: 0 0 0 3.5px var(--accent-soft), 0 10px 34px rgba(0, 0, 0, .3); }
#msgInput {
  flex: 1; resize: none; max-height: 130px;
  background: transparent; border: none; outline: none;
  color: var(--text); font-family: inherit; font-size: 14.5px;
  padding: 9px 4px; line-height: 1.4;
}
#msgInput::placeholder { color: #5b5a68; }
.send-btn {
  width: 38px; height: 38px; border-radius: 50%; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  background: var(--accent-grad); border: none; color: #fff;
  cursor: pointer; box-shadow: 0 5px 16px var(--glow), inset 0 1px 0 rgba(255, 255, 255, .25);
  transition: all .2s cubic-bezier(.2, .8, .3, 1);
}
.send-btn svg { width: 17px; height: 17px; }
.send-btn:hover { transform: scale(1.09); filter: brightness(1.1); }
.send-btn:active { transform: scale(.9); }
.hidden-input { display: none; }

/* ---------- SETTINGS ---------- */
.settings { flex: 1; display: flex; flex-direction: column; min-height: 0; }
.settings-scroll { flex: 1; overflow-y: auto; padding: 6px 8px 20px; display: flex; flex-direction: column; gap: 20px; }
.set-group { max-width: 720px; width: 100%; margin: 0 auto; animation: fadeUp .4s ease both; }
.set-group:nth-child(2) { animation-delay: .05s; }
.set-group:nth-child(3) { animation-delay: .1s; }
.set-group:nth-child(4) { animation-delay: .15s; }
.set-group:nth-child(5) { animation-delay: .2s; }
.set-label {
  font-size: 11.5px; font-weight: 700; text-transform: uppercase; letter-spacing: 1px;
  color: var(--muted); margin: 0 6px 8px;
}
.set-card {
  background: var(--glass); backdrop-filter: var(--blur); -webkit-backdrop-filter: var(--blur);
  border: 1px solid var(--stroke); border-radius: 22px;
  padding: 18px 20px;
  box-shadow: 0 10px 34px rgba(0, 0, 0, .25);
}
.set-line { display: flex; align-items: center; justify-content: space-between; font-size: 14px; font-weight: 500; padding: 4px 0 8px; }
.theme-row { display: flex; gap: 12px; flex-wrap: wrap; }
.theme-card {
  flex: 1; min-width: 140px; cursor: pointer;
  background: var(--glass-2); border: 1px solid var(--stroke); border-radius: 16px;
  padding: 12px; text-align: center;
  font-family: inherit; font-size: 12.5px; font-weight: 600; color: var(--text);
  display: flex; flex-direction: column; align-items: center; gap: 7px;
  transition: all .22s cubic-bezier(.2, .8, .3, 1);
}
.theme-card small { color: var(--muted); font-size: 10.5px; font-weight: 500; }
.theme-card:hover { transform: translateY(-3px); border-color: var(--stroke-2); }
.theme-card.active { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft), 0 10px 26px rgba(255, 59, 66, .18); }
.sw { width: 100%; height: 40px; border-radius: 10px; border: 1px solid rgba(255, 255, 255, .1); }
.sw-rednight { background: linear-gradient(120deg, #0a0a0e 52%, #ff3b42); }
.sw-amoled { background: linear-gradient(120deg, #000 52%, #ff2430); }
.sw-gnome { background: linear-gradient(120deg, #22222a 52%, #ff5259); }
.set-card select {
  appearance: none; -webkit-appearance: none;
  background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%238f8f9d' stroke-width='2' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 15px center;
  padding-right: 38px !important; cursor: pointer; margin-bottom: 4px;
}
.set-card select option { background: #1a1a22; color: var(--text); }
.about-line { font-size: 13px; padding: 3.5px 0; }
#profSaveBtn { margin-top: 14px; }

/* iOS switch */
.switch { position: relative; display: inline-block; width: 48px; height: 29px; flex-shrink: 0; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch .sl {
  position: absolute; inset: 0; border-radius: 999px;
  background: rgba(255, 255, 255, .16);
  transition: background .25s; cursor: pointer;
}
.switch .sl::before {
  content: ''; position: absolute; top: 2.5px; left: 3px;
  width: 24px; height: 24px; border-radius: 50%;
  background: #fff; box-shadow: 0 3px 8px rgba(0, 0, 0, .35);
  transition: transform .25s cubic-bezier(.2, .8, .3, 1.2);
}
.switch input:checked + .sl { background: var(--green); }
.switch input:checked + .sl::before { transform: translateX(18px); }

/* profile settings */
.prof-banner-prev {
  width: 100%; height: 96px; border-radius: 16px;
  border: 1px solid var(--stroke);
  background:
    radial-gradient(180px 100px at 75% 25%, rgba(255, 59, 66, .3), transparent),
    linear-gradient(135deg, #d92630, #2a0b0e 75%);
  background-size: cover; background-position: center;
  margin-bottom: 10px;
}
.prof-banner-prev.has { border-color: rgba(255, 59, 66, .5); }
.prof-btns-row { display: flex; gap: 8px; margin-bottom: 6px; }
.prof-row { display: flex; align-items: center; gap: 16px; margin: 12px 0 4px; }
.prof-ava-wrap { width: 84px; height: 84px; position: relative; flex-shrink: 0; }
.prof-ava-wrap .prof-ava { width: 84px; height: 84px; font-size: 34px; border-radius: 50%; object-fit: cover; }
.prof-btns { display: flex; flex-direction: column; gap: 8px; }

/* ---------- MODALS ---------- */
.modal {
  position: fixed; inset: 0; z-index: 200;
  background: rgba(4, 3, 7, .55); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  display: flex; align-items: center; justify-content: center;
  animation: fadeIn .2s both;
}
.modal-card {
  border-radius: 26px; padding: 32px 38px; text-align: center;
  box-shadow: var(--shadow), 0 0 70px rgba(255, 59, 66, .12);
  animation: springIn .4s cubic-bezier(.2, 1.3, .4, 1) both;
}
.req-ava {
  width: 76px; height: 76px; border-radius: 50%; margin: 0 auto 16px;
  background: linear-gradient(135deg, #d92630, #4a0e13);
  color: #fff; font-size: 30px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  border: 2px solid rgba(255, 59, 66, .5); box-shadow: 0 0 30px var(--glow);
  overflow: hidden;
}
.req-ava img { width: 100%; height: 100%; object-fit: cover; }
.modal-peer { color: var(--text); font-size: 21px; font-weight: 700; margin-bottom: 4px; }
.modal-type { color: var(--muted); font-size: 13px; margin-bottom: 24px; }
.modal-actions { display: flex; gap: 10px; justify-content: center; }
.modal-actions .btn { padding: 11px 24px; }

/* ---------- INCOMING CALL (iOS) ---------- */
.call-modal { background: rgba(3, 2, 6, .72); z-index: 400; }
.ios-call { text-align: center; animation: springIn .4s cubic-bezier(.2, 1.3, .4, 1) both; padding: 20px; }
.call-avatar-wrap { position: relative; width: 150px; height: 150px; margin: 0 auto 26px; }
.call-avatar {
  position: absolute; inset: 12px; border-radius: 50%; overflow: hidden;
  background: linear-gradient(135deg, #d92630, #4a0e13);
  color: #fff; font-size: 52px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  border: 2.5px solid rgba(255, 59, 66, .6);
  box-shadow: 0 0 44px var(--glow);
  animation: avatarBounce 1.7s ease infinite;
}
.call-avatar img { width: 100%; height: 100%; object-fit: cover; }
@keyframes avatarBounce { 50% { transform: scale(1.045); } }
.call-ring { position: absolute; inset: 0; border-radius: 50%; border: 2px solid var(--accent); opacity: 0; animation: ringPulse 1.8s ease-out infinite; }
.call-ring.r2 { animation-delay: .9s; }
@keyframes ringPulse { 0% { transform: scale(.82); opacity: .9; } 100% { transform: scale(1.5); opacity: 0; } }
.call-name { color: #fff; font-size: 30px; font-weight: 700; letter-spacing: .3px; margin-bottom: 6px; }
.call-status { color: var(--muted); font-size: 14px; margin-bottom: 46px; animation: pulse 1.5s ease infinite; }
.ios-call-actions { display: flex; gap: 70px; justify-content: center; }
.ica { display: flex; flex-direction: column; align-items: center; gap: 10px; }
.ica span { font-size: 12.5px; color: var(--muted); font-weight: 500; }
.big-btn {
  width: 74px; height: 74px; border-radius: 50%; border: none;
  display: flex; align-items: center; justify-content: center;
  color: #fff; cursor: pointer;
  transition: transform .18s cubic-bezier(.2, .8, .3, 1), filter .18s;
}
.big-btn svg { width: 30px; height: 30px; }
.big-btn:hover { transform: scale(1.09); filter: brightness(1.12); }
.big-btn:active { transform: scale(.92); }
.big-btn.accept { background: var(--green); box-shadow: 0 8px 30px rgba(48, 209, 88, .45); }
.big-btn.decline { background: var(--danger); box-shadow: 0 8px 30px rgba(255, 69, 58, .45); }
.big-btn.decline svg { transform: rotate(0deg); }

/* ---------- PROFILE CARD (Discord × Telegram) ---------- */
.pcard {
  position: relative; width: 360px; max-width: 94vw;
  background: var(--glass); backdrop-filter: var(--blur); -webkit-backdrop-filter: var(--blur);
  border: 1px solid var(--stroke-2);
  border-radius: 26px; overflow: hidden;
  box-shadow: var(--shadow), 0 0 60px rgba(255, 59, 66, .1);
  animation: springIn .35s cubic-bezier(.2, 1.3, .4, 1) both;
}
.pcard-banner {
  position: relative; height: 124px;
  background:
    radial-gradient(160px 90px at 80% 20%, rgba(255, 59, 66, .4), transparent),
    linear-gradient(135deg, #d92630, #2a0b0e 72%);
}
.pcard-banner::after { content: ''; position: absolute; inset: 0; box-shadow: inset 0 -50px 44px -34px rgba(0, 0, 0, .65); }
#pfBanner { position: absolute; inset: 0; }
#pfBanner img { width: 100%; height: 100%; object-fit: cover; display: block; }
.pcard-close {
  position: absolute; top: 12px; right: 12px; z-index: 2;
  width: 32px; height: 32px; border-radius: 50%;
  background: rgba(0, 0, 0, .4); backdrop-filter: blur(8px);
  border: none; color: rgba(255, 255, 255, .85);
  cursor: pointer; transition: all .16s;
  display: flex; align-items: center; justify-content: center;
}
.pcard-close svg { width: 14px; height: 14px; }
.pcard-close:hover { background: rgba(0, 0, 0, .65); transform: scale(1.08); }
.pcard-ava-wrap {
  position: relative; width: 96px; height: 96px; margin: -48px auto 0;
}
#pfAva {
  width: 96px; height: 96px; border-radius: 50%; overflow: hidden;
  border: 5px solid #1c1c26;
  background: linear-gradient(135deg, #d92630, #4a0e13);
}
#pfAva .avatar { width: 100%; height: 100%; font-size: 40px; border-radius: 50%; }
#pfAva img { width: 100%; height: 100%; object-fit: cover; display: block; }
.pf-dot {
  position: absolute; right: 2px; bottom: 4px; z-index: 2;
  width: 20px; height: 20px; border: 4px solid #1c1c26; box-shadow: none;
}
.pcard-body { padding: 12px 22px 22px; text-align: center; }
.pcard-name { font-size: 22px; font-weight: 800; margin-top: 8px; }
.pcard-user { color: var(--muted); font-size: 13px; font-family: 'JetBrains Mono', monospace; margin-top: 2px; }
.pcard-statusline { color: var(--muted); font-size: 12.5px; margin-top: 9px; }
.pcard-statusline.online { color: var(--green); }
.pcard-bio {
  margin-top: 14px; text-align: left;
  background: var(--glass-2); border: 1px solid var(--stroke);
  border-radius: 14px; padding: 11px 14px;
  font-size: 13px; line-height: 1.5; color: var(--text);
  white-space: pre-wrap; word-wrap: break-word;
}
.pcard-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; margin-top: 18px; }
.pcard-actions .btn { width: 100%; padding: 10px 14px; }
#pfMsg { grid-column: 1 / -1; }
#pfEdit, #pfDel { grid-column: 1 / -1; }

/* ---------- TOASTS (iOS banner style) ---------- */
.toasts {
  position: fixed; top: 16px; left: 50%; transform: translateX(-50%);
  z-index: 500; display: flex; flex-direction: column; align-items: center; gap: 8px;
  pointer-events: none;
}
.toast {
  background: var(--glass); backdrop-filter: var(--blur); -webkit-backdrop-filter: var(--blur);
  border: 1px solid var(--stroke-2);
  border-radius: 999px; padding: 11px 20px; font-size: 13px; font-weight: 500;
  box-shadow: var(--shadow);
  animation: toastIn .38s cubic-bezier(.2, 1.2, .4, 1) both;
  max-width: 80vw;
}
.toast.err { border-color: rgba(255, 69, 58, .5); color: #ffc9c7; }
@keyframes toastIn { from { opacity: 0; transform: translateY(-24px) scale(.92); } }
.toast.out { animation: toastOut .3s ease forwards; }
@keyframes toastOut { to { opacity: 0; transform: translateY(-18px) scale(.94); } }

/* ---------- CROP MODAL ---------- */
.crop-modal { z-index: 420; }
.crop-card {
  width: min(660px, 94vw);
  border-radius: 24px; padding: 20px 22px;
  box-shadow: var(--shadow);
  animation: springIn .3s cubic-bezier(.2, 1.3, .4, 1) both;
}
.crop-title { color: var(--muted); font-size: 12.5px; font-weight: 600; margin-bottom: 12px; }
.crop-frame {
  position: relative; overflow: hidden;
  background: repeating-conic-gradient(#141318 0% 25%, #1b1c20 0% 50%) 0 0 / 22px 22px;
  border-radius: 14px; border: 1px solid var(--stroke);
  cursor: grab; touch-action: none; user-select: none;
}
.crop-frame:active { cursor: grabbing; }
.crop-frame.dragging { box-shadow: inset 0 0 0 2px var(--accent); }
#cropImg { position: absolute; pointer-events: none; max-width: none; }
.crop-zoom-row { display: flex; align-items: center; gap: 12px; color: var(--muted); font-size: 17px; margin: 16px 2px 14px; user-select: none; }
#cropZoom { flex: 1; height: auto !important; padding: 0 !important; border: none !important; background: transparent !important; accent-color: var(--accent); cursor: pointer; }
.crop-actions { display: flex; gap: 10px; justify-content: flex-end; }

/* ---------- SCROLLBARS ---------- */
*::-webkit-scrollbar { width: 7px; height: 7px; }
*::-webkit-scrollbar-track { background: transparent; }
*::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, .14); border-radius: 8px; }
*::-webkit-scrollbar-thumb:hover { background: rgba(255, 255, 255, .24); }

input, textarea, select, button { font-family: inherit; }
button { user-select: none; }
input:focus-visible, textarea:focus-visible, select:focus-visible,
.btn:focus-visible, .seg-btn:focus-visible, .rbtn:focus-visible {
  outline: 2px solid rgba(255, 59, 66, .55); outline-offset: 1px;
}
