
:root {
  --primary: #168fd0;
  --primary-2: #15b8b0;
  --primary-ink: #076494;
  --primary-soft: #e1f3ff;
  --accent-glow: rgba(22, 143, 208, .28);
  --gradient: linear-gradient(135deg, #137fd2 0%, #168fd0 48%, #18b8ad 100%);
  --gradient-deep: linear-gradient(145deg, #0b3155 0%, #0f699e 52%, #0c8d87 100%);
  --gradient-soft: linear-gradient(135deg, #e4f5ff, #e3fbf8);
  --bg: #f3f7fb;
  --surface: #ffffff;
  --surface-2: #edf3f8;
  --surface-3: #e7eef5;
  --text: #122333;
  --text-2: #334b5e;
  --muted: #718395;
  --line: #e1e9f0;
  --danger: #df4b5d;
  --success: #19ad79;
  --mine: #d9f3ff;
  --bubble: #ffffff;
  --nav-height: 78px;
  --topbar-height: 82px;
  --shadow-sm: 0 5px 18px rgba(21, 57, 82, .07);
  --shadow-md: 0 14px 36px rgba(20, 67, 96, .13);
  --shadow-primary: 0 13px 28px var(--accent-glow);
  --font-scale: 1;
}

body[data-palette="violet"] {
  --primary: #7558e8;
  --primary-2: #d04b9e;
  --primary-ink: #5940b8;
  --primary-soft: #eee9ff;
  --accent-glow: rgba(117, 88, 232, .27);
  --gradient: linear-gradient(135deg, #5d5ce2 0%, #8354e5 48%, #d54f9d 100%);
  --gradient-deep: linear-gradient(145deg, #25215d, #5f43b8 52%, #a93475);
  --gradient-soft: linear-gradient(135deg, #efedff, #ffe8f4);
  --mine: #eee8ff;
}
body[data-palette="emerald"] {
  --primary: #0d9d7a;
  --primary-2: #49b95e;
  --primary-ink: #08725a;
  --primary-soft: #ddf7ef;
  --accent-glow: rgba(13, 157, 122, .26);
  --gradient: linear-gradient(135deg, #0b8178 0%, #0ea47b 48%, #6dbf54 100%);
  --gradient-deep: linear-gradient(145deg, #093b42, #087364 54%, #497e35);
  --gradient-soft: linear-gradient(135deg, #e0f8f2, #eef9df);
  --mine: #daf6e9;
}
body[data-palette="sunset"] {
  --primary: #ed6c4d;
  --primary-2: #e7a329;
  --primary-ink: #b64a34;
  --primary-soft: #ffebe4;
  --accent-glow: rgba(237, 108, 77, .27);
  --gradient: linear-gradient(135deg, #df4d68 0%, #ef7050 48%, #ecae30 100%);
  --gradient-deep: linear-gradient(145deg, #6b2539, #b94e3c 54%, #a9711c);
  --gradient-soft: linear-gradient(135deg, #ffebe9, #fff3d9);
  --mine: #ffeadf;
}
body[data-palette="ocean"] {
  --primary: #2566dc;
  --primary-2: #1aa8e8;
  --primary-ink: #194da9;
  --primary-soft: #e4edff;
  --accent-glow: rgba(37, 102, 220, .27);
  --gradient: linear-gradient(135deg, #244fc1 0%, #256fe0 48%, #18a9e2 100%);
  --gradient-deep: linear-gradient(145deg, #12295e, #1f52ac 54%, #117ca8);
  --gradient-soft: linear-gradient(135deg, #e5ebff, #e2f7ff);
  --mine: #e0ebff;
}

body.dark {
  --bg: #090f1b;
  --surface: #111a2a;
  --surface-2: #182438;
  --surface-3: #1e2d44;
  --text: #f1f5fb;
  --text-2: #d1dbea;
  --muted: #96a7bc;
  --line: rgba(194, 214, 235, .12);
  --primary-soft: color-mix(in srgb, var(--primary) 22%, #111a2a);
  --mine: color-mix(in srgb, var(--primary) 31%, #111a2a);
  --bubble: #152135;
  --gradient-soft: linear-gradient(135deg, color-mix(in srgb, var(--primary) 19%, #111a2a), color-mix(in srgb, var(--primary-2) 14%, #111a2a));
  --shadow-sm: 0 6px 20px rgba(0, 0, 0, .18);
  --shadow-md: 0 16px 40px rgba(0, 0, 0, .32);
}

body[data-font-scale="small"] { --font-scale: .93; }
body[data-font-scale="large"] { --font-scale: 1.09; }
body[data-font-family="modern"] { font-family: system-ui, -apple-system, "Segoe UI", Arial, sans-serif; }
body[data-font-family="readable"] { font-family: Arial, system-ui, sans-serif; letter-spacing: .005em; }
body[data-font-family="classic"] { font-family: Tahoma, Arial, sans-serif; }
body[data-font-family="readable"] input, body[data-font-family="readable"] textarea, body[data-font-family="readable"] button { font-family: Arial, system-ui, sans-serif; }
body[data-font-family="classic"] input, body[data-font-family="classic"] textarea, body[data-font-family="classic"] button { font-family: Tahoma, Arial, sans-serif; }


* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
svg { fill: none; stroke: currentColor; stroke-width: 1.85; stroke-linecap: round; stroke-linejoin: round; }
html, body { width: 100%; height: 100%; margin: 0; overflow: hidden; }
body {
  font-family: system-ui, -apple-system, "Segoe UI", Arial, sans-serif;
  font-size: calc(16px * var(--font-scale));
  background: var(--bg);
  color: var(--text);
  direction: rtl;
  transition: background .25s ease, color .25s ease;
  overscroll-behavior: none;
}
body, button, input, textarea { font-feature-settings: "ss01"; }
button, input, textarea { font: inherit; }
button { color: inherit; cursor: pointer; }
input, textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--surface-2);
  color: var(--text);
  padding: 13px 14px;
  outline: none;
  caret-color: var(--primary);
  transition: border .2s ease, box-shadow .2s ease, background .2s ease;
}
input::placeholder, textarea::placeholder { color: color-mix(in srgb, var(--muted) 78%, transparent); }
input:focus, textarea:focus {
  border-color: color-mix(in srgb, var(--primary) 68%, var(--line));
  background: var(--surface);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--primary) 13%, transparent);
}
textarea { resize: none; line-height: 1.8; }
label { display: block; color: var(--text-2); font-size: .82rem; font-weight: 600; margin: 15px 0; }
label input, label textarea, label .input-wrap { margin-top: 7px; }
svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
.svg-sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
.hidden { display: none !important; }
.wide { width: 100%; }
.muted { color: var(--muted); }

.primary, .danger {
  min-height: 50px;
  border: 0;
  border-radius: 16px;
  padding: 12px 18px;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}
.primary { background: var(--gradient); color: white; box-shadow: var(--shadow-primary); }
.primary:active, .fab:active, .send-btn:active { transform: scale(.97); }
.primary:disabled { opacity: .65; transform: none; }
.primary svg, .danger svg { width: 20px; height: 20px; }
.danger { color: var(--danger); background: color-mix(in srgb, var(--danger) 10%, transparent); }

.login-screen {
  min-height: 100%;
  display: grid;
  place-items: center;
  padding: calc(24px + env(safe-area-inset-top)) 21px calc(24px + env(safe-area-inset-bottom));
  position: relative;
  overflow-y: auto;
  overflow-x: hidden;
  background: var(--gradient-deep);
}
.aurora { position: fixed; pointer-events: none; border-radius: 50%; filter: blur(4px); opacity: .36; }
.aurora-one { width: 320px; height: 320px; top: -130px; right: -80px; background: #64e9db; }
.aurora-two { width: 280px; height: 280px; left: -110px; bottom: -90px; background: #5a7fff; }
.login-shell { width: min(100%, 420px); position: relative; z-index: 1; }
.login-brand { color: white; text-align: center; padding: 8px 0 26px; }
.brand-orbit {
  width: 88px; height: 88px; margin: 0 auto 14px;
  display: grid; place-items: center;
  border-radius: 30px;
  background: rgba(255,255,255,.97);
  color: var(--primary);
  box-shadow: 0 22px 46px rgba(1,23,42,.28), inset 0 0 0 1px rgba(255,255,255,.7);
  transform: rotate(-3deg);
}

.brand-orbit svg { width: 43px; height: 43px; stroke-width: 2; transform: rotate(3deg); }
.logo-photo { overflow: hidden; padding: 0 !important; }
.logo-photo img { width: 100%; height: 100%; object-fit: cover; display: block; }
.brand-orbit.logo-photo { border-radius: 28px; box-shadow: 0 18px 34px rgba(0,0,0,.18); }
.brand-orbit.logo-photo img { animation: none; }

.login-brand h1 { font-size: 2rem; margin: 0; letter-spacing: -.6px; }
.login-brand p { margin: 5px 0 0; font-size: .84rem; color: rgba(255,255,255,.78); }
.login-card {
  width: 100%;
  padding: 23px 20px 18px;
  border: 1px solid rgba(255,255,255,.45);
  border-radius: 28px;
  background: color-mix(in srgb, var(--surface) 94%, transparent);
  box-shadow: 0 28px 65px rgba(0, 29, 49, .28);
  animation: rise .5s cubic-bezier(.2,.8,.2,1);
  backdrop-filter: blur(18px);
}
.login-card-title { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; margin-bottom: 7px; }
.login-card-title h2 { margin: 0; font-size: 1.32rem; }
.login-card-title p { margin: 2px 0 0; color: var(--muted); font-size: .76rem; }
.secure-pill {
  display: flex; align-items: center; gap: 4px;
  background: color-mix(in srgb, var(--success) 11%, var(--surface));
  color: var(--success);
  border-radius: 99px; padding: 6px 9px; font-size: .68rem; font-weight: 700;
}
.secure-pill svg { width: 14px; height: 14px; }
.input-wrap { display: flex; align-items: center; border: 1px solid var(--line); border-radius: 16px; background: var(--surface-2); padding: 0 12px; }
.input-wrap:focus-within { border-color: color-mix(in srgb, var(--primary) 68%, var(--line)); box-shadow: 0 0 0 4px color-mix(in srgb, var(--primary) 13%, transparent); background: var(--surface); }
.input-wrap svg { width: 20px; height: 20px; color: var(--muted); flex: 0 0 auto; }
.input-wrap input { min-height: 49px; border: 0; border-radius: 0; box-shadow: none; background: transparent; margin: 0; padding: 12px 11px; }
.ltr-field { direction: ltr; }
.login-card .primary { margin-top: 20px; }
.error { min-height: 19px; color: var(--danger); text-align: center; padding-top: 9px; font-size: .76rem; }
.login-hint { display: flex; align-items: center; justify-content: center; gap: 5px; color: var(--muted); margin: 4px 0 0; font-size: .66rem; text-align: center; }
.login-hint svg { width: 14px; height: 14px; }

.app { height: 100%; padding-bottom: calc(var(--nav-height) + env(safe-area-inset-bottom)); }
.topbar {
  height: calc(var(--topbar-height) + env(safe-area-inset-top));
  padding: calc(10px + env(safe-area-inset-top)) 17px 10px;
  display: flex; align-items: center; justify-content: space-between;
  color: white;
  background: var(--gradient);
  box-shadow: 0 8px 26px color-mix(in srgb, var(--primary) 22%, transparent);
  position: relative; z-index: 5;
}
.topbar::after {
  content: ""; position: absolute; inset: auto 0 -14px; height: 28px;
  background: var(--gradient); border-radius: 0 0 55% 55%; z-index: -1; opacity: .98;
}
.topbar-copy { display: flex; align-items: center; gap: 11px; }
.mini-brand { width: 42px; height: 42px; border-radius: 15px; display: grid; place-items: center; background: rgba(255,255,255,.17); border: 1px solid rgba(255,255,255,.2); }
.mini-brand svg { width: 23px; height: 23px; }
.mini-brand.logo-photo img { border-radius: 15px; }
.topbar h1 { margin: 0; font-size: 1.23rem; line-height: 1.2; }
.topbar small { opacity: .86; font-size: .68rem; display: flex; align-items: center; gap: 5px; margin-top: 3px; }
.topbar small i { width: 6px; height: 6px; border-radius: 50%; background: #a9ffda; box-shadow: 0 0 8px #80ffc3; }
.icon-btn { width: 43px; height: 43px; border: 0; border-radius: 50%; background: transparent; display: grid; place-items: center; padding: 0; }
.icon-btn svg { width: 22px; height: 22px; }
.glass-btn { color: white; background: rgba(255,255,255,.16); border: 1px solid rgba(255,255,255,.2); backdrop-filter: blur(8px); }
.view {
  height: calc(100% - var(--topbar-height));
  overflow-y: auto;
  overscroll-behavior-y: contain;
  display: none;
  padding: 22px 13px 28px;
  scroll-behavior: smooth;
}
.view.active { display: block; animation: fade .22s ease-out; }
.list { display: flex; flex-direction: column; }
.empty { text-align: center; padding: 62px 22px; color: var(--muted); line-height: 1.9; font-size: .82rem; }

.chat-tools { margin-bottom: 8px; }
.search-box {
  min-height: 48px; display: flex; align-items: center; gap: 7px;
  padding: 0 13px; border: 1px solid var(--line); border-radius: 17px;
  background: var(--surface); box-shadow: var(--shadow-sm);
}
.search-box svg { width: 21px; height: 21px; color: var(--muted); }
.search-box input { border: 0; background: transparent; box-shadow: none; padding: 10px 4px; min-width: 0; }
.clear-search { border: 0; background: var(--surface-2); color: var(--muted); border-radius: 50%; width: 25px; height: 25px; }
.sticky-search { position: sticky; top: -10px; z-index: 3; margin-bottom: 17px; }
.filter-row { display: flex; gap: 8px; overflow-x: auto; padding: 11px 2px 4px; scrollbar-width: none; }
.filter-row::-webkit-scrollbar { display: none; }
.filter-pill {
  flex: 0 0 auto; min-height: 35px; border: 1px solid var(--line); border-radius: 13px;
  background: var(--surface); color: var(--muted); padding: 6px 13px;
  display: flex; align-items: center; gap: 5px; font-size: .74rem; font-weight: 600;
}
.filter-pill svg { width: 15px; height: 15px; }
.filter-pill.active { color: var(--primary); background: var(--primary-soft); border-color: color-mix(in srgb, var(--primary) 20%, transparent); }

.list-row {
  width: 100%; min-height: 78px; display: flex; align-items: center; gap: 12px;
  padding: 11px; border: 1px solid transparent; border-radius: 20px;
  background: transparent; text-align: right; transition: background .18s, transform .18s, border-color .18s;
}
.room-list .list-row { margin-top: 5px; }
.list-row:active { transform: scale(.985); background: var(--surface-2); }
.room-list .list-row:hover, .contact-list .list-row:hover { background: var(--surface); border-color: var(--line); box-shadow: var(--shadow-sm); }
.row-main { min-width: 0; flex: 1; }
.row-title { display: flex; align-items: center; justify-content: space-between; gap: 9px; }
.row-title b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text); font-size: .92rem; }
.row-title time { color: var(--muted); font-size: .64rem; direction: ltr; flex: 0 0 auto; }
.row-sub { margin-top: 5px; color: var(--muted); font-size: .73rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row-sub .preview-author { color: var(--text-2); font-weight: 600; }
.avatar {
  position: relative; flex: 0 0 auto; width: 52px; height: 52px; border: 0; border-radius: 18px;
  display: grid; place-items: center; color: white; background: var(--gradient);
  font-size: 1.25rem; font-weight: 800; background-size: cover; background-position: center;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.14);
}
.room-channel .avatar { border-radius: 17px; background-image: var(--gradient) !important; }
.avatar-xl {
  width: 104px; height: 104px; border-radius: 34px; margin: 0;
  font-size: 2.35rem; box-shadow: 0 15px 34px rgba(0,0,0,.2);
}
.online-dot {
  position: absolute; width: 12px; height: 12px; border-radius: 50%; background: var(--success);
  box-shadow: 0 0 0 3px var(--surface); right: 47px; bottom: 13px; z-index: 2;
}
.type-tag { display: inline-flex; align-items: center; background: var(--primary-soft); color: var(--primary); border-radius: 8px; padding: 2px 6px; font-size: .56rem; margin-right: 6px; vertical-align: 2px; }
.unread-badge { min-width: 21px; height: 21px; border-radius: 11px; display: grid; place-items: center; background: var(--gradient); color: white; font-size: .62rem; font-weight: 800; padding: 0 6px; }
.fab {
  position: fixed; left: 18px; bottom: calc(var(--nav-height) + 18px + env(safe-area-inset-bottom));
  width: 60px; height: 60px; border: 0; border-radius: 21px; color: white;
  display: grid; place-items: center; background: var(--gradient);
  box-shadow: var(--shadow-primary); transition: transform .15s ease;
}
.fab svg { width: 27px; height: 27px; }

.section-heading { display: flex; align-items: center; justify-content: space-between; padding: 0 8px 7px; }
.section-heading h2 { margin: 0; font-size: .94rem; }
.section-heading small { display: block; color: var(--muted); font-size: .65rem; margin-top: 2px; }
.online-legend { display: flex; align-items: center; gap: 5px; color: var(--success); font-size: .66rem; font-weight: 700; }
.online-legend i { width: 7px; height: 7px; background: var(--success); border-radius: 50%; }
.contact-row { position: relative; background: var(--surface); border-color: var(--line); margin-top: 8px; box-shadow: var(--shadow-sm); }
.contact-action {
  min-width: 62px; min-height: 34px; padding: 6px 10px; border-radius: 12px;
  color: var(--primary); background: var(--primary-soft); font-size: .69rem; font-weight: 800;
  display: flex; align-items: center; justify-content: center; gap: 4px;
}
.contact-action svg { width: 15px; height: 15px; }
.contact-row.loading { pointer-events: none; opacity: .65; }
.contact-row.loading .contact-action { font-size: 0; }
.contact-row.loading .contact-action::after { content: ""; width: 15px; height: 15px; border: 2px solid color-mix(in srgb,var(--primary) 25%, transparent); border-top-color: var(--primary); border-radius: 50%; animation: spin .7s linear infinite; }

.profile-view { padding: 15px 12px 32px; }
.profile-hero {
  position: relative; overflow: hidden; min-height: 270px; padding: 30px 20px 25px;
  border-radius: 28px; text-align: center; color: white; background: var(--gradient-deep);
  box-shadow: var(--shadow-md);
}
.profile-pattern {
  position: absolute; inset: 0; opacity: .22;
  background-image: radial-gradient(circle at 20% 15%, rgba(255,255,255,.42) 0 2px, transparent 3px), radial-gradient(circle at 75% 65%, rgba(255,255,255,.3) 0 2px, transparent 3px);
  background-size: 78px 78px, 95px 95px;
}
.profile-hero::after { content: ""; position: absolute; width: 220px; height: 220px; top: -95px; left: -75px; border-radius: 50%; background: rgba(255,255,255,.1); }
.profile-avatar-wrap { width: 104px; margin: 0 auto 13px; position: relative; z-index: 1; }
.avatar-camera { position: absolute; left: -5px; bottom: -3px; width: 35px; height: 35px; border: 3px solid rgba(255,255,255,.8); border-radius: 13px; background: white; color: var(--primary); display: grid; place-items: center; }
.avatar-camera svg { width: 17px; height: 17px; }
.profile-hero h2 { position: relative; z-index: 1; margin: 0; font-size: 1.32rem; }
.profile-hero > p { position: relative; z-index: 1; margin: 4px auto 10px; max-width: 280px; color: rgba(255,255,255,.76); font-size: .76rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.profile-status { position: relative; z-index: 1; display: inline-flex; align-items: center; gap: 6px; border: 1px solid rgba(255,255,255,.18); background: rgba(255,255,255,.13); border-radius: 99px; padding: 6px 10px; font-size: .67rem; }
.profile-status i { width: 7px; height: 7px; background: #a9ffda; border-radius: 50%; box-shadow: 0 0 8px #a9ffda; }
.profile-card, .about-card {
  max-width: 560px; margin: 12px auto 0; padding: 18px;
  border: 1px solid var(--line); border-radius: 24px; background: var(--surface); box-shadow: var(--shadow-sm);
}
.profile-form { position: relative; margin-top: -18px; z-index: 2; }
.card-heading, .settings-title { display: flex; align-items: center; gap: 10px; }
.heading-icon, .setting-icon { width: 40px; height: 40px; flex: 0 0 40px; border-radius: 14px; display: grid; place-items: center; color: var(--primary); background: var(--primary-soft); }
.heading-icon svg, .setting-icon svg { width: 20px; height: 20px; }
.card-heading h3, .settings-title h2 { margin: 0; color: var(--text); font-size: .9rem; }
.card-heading p, .settings-title p { margin: 2px 0 0; color: var(--muted); font-size: .66rem; }
.two-fields { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.field-label { color: var(--text-2); font-size: .8rem; font-weight: 600; margin-top: 16px; }
.color-choices { display: flex; gap: 11px; margin: 11px 0 21px; flex-wrap: wrap; }
.color-choice { width: 36px; height: 36px; border-radius: 50%; border: 4px solid var(--surface); box-shadow: 0 0 0 1px var(--line); }
.color-choice.selected { box-shadow: 0 0 0 2px currentColor, 0 6px 15px color-mix(in srgb,currentColor 25%,transparent); transform: scale(1.06); }

.settings-view { padding-top: 18px; }
.settings-intro { display: flex; align-items: center; gap: 12px; margin: 0 3px 14px; padding: 14px; border-radius: 20px; color: var(--text); background: var(--gradient-soft); border: 1px solid color-mix(in srgb,var(--primary) 13%,var(--line)); }
.settings-intro > span { width: 45px; height: 45px; border-radius: 16px; color: white; background: var(--gradient); display: grid; place-items: center; box-shadow: var(--shadow-primary); }
.settings-intro svg { width: 23px; height: 23px; }
.settings-intro h2 { margin: 0; font-size: .98rem; }
.settings-intro p { margin: 2px 0 0; color: var(--muted); font-size: .7rem; }
.settings-group { background: var(--surface); border: 1px solid var(--line); border-radius: 22px; margin: 0 0 13px; padding: 14px; box-shadow: var(--shadow-sm); }
.settings-title { margin-bottom: 10px; }
.setting-row, .info-row {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 13px 1px; margin: 0; border-top: 1px solid var(--line);
}
.setting-copy { flex: 1; min-width: 0; }
.setting-copy b, .setting-copy small, .font-setting b, .font-setting small { display: block; }
.setting-copy b, .font-setting b { color: var(--text); font-size: .83rem; }
.setting-copy small, .font-setting small { color: var(--muted); margin-top: 3px; font-size: .68rem; line-height: 1.55; }
.theme-choices { display: grid; grid-template-columns: repeat(5,minmax(56px,1fr)); gap: 8px; padding: 10px 0 16px; overflow-x: auto; scrollbar-width: none; }
.theme-choices::-webkit-scrollbar { display: none; }
.theme-choice { position: relative; min-width: 58px; height: 70px; border: 1px solid var(--line); border-radius: 17px; padding: 6px; background: var(--surface-2); box-shadow: var(--shadow-sm); display: flex; flex-direction: column; align-items: center; justify-content: space-between; gap: 4px; }
.theme-swatch { width: 100%; height: 40px; border-radius: 12px; background: var(--choice-gradient); box-shadow: inset 0 0 0 1px rgba(255,255,255,.18); }
.theme-choice small { color: var(--muted); font-size: .55rem; font-weight: 800; }
.theme-choice.selected { border-color: var(--primary); background: var(--primary-soft); box-shadow: 0 0 0 2px color-mix(in srgb,var(--primary) 30%,transparent), 0 8px 17px var(--accent-glow); }
.theme-choice.selected small { color: var(--primary); }
.theme-choice.selected::after { content: "✓"; position: absolute; top: 10px; right: 10px; width: 18px; height: 18px; display: grid; place-items: center; border-radius: 50%; color: white; background: rgba(0,0,0,.36); font-size: .62rem; font-weight: 900; text-shadow: 0 1px 4px rgba(0,0,0,.25); }
.switch {
  appearance: none; -webkit-appearance: none; width: 49px; height: 28px; flex: 0 0 49px;
  border: 0; border-radius: 99px; background: var(--surface-3); padding: 3px; margin: 0;
  transition: background .22s ease; box-shadow: inset 0 0 0 1px var(--line);
}
.switch::after { content: ""; display: block; width: 22px; height: 22px; border-radius: 50%; background: white; box-shadow: 0 3px 8px rgba(0,0,0,.18); transition: transform .22s ease; }
.switch:checked { background: var(--primary); }
.switch:checked::after { transform: translateX(-21px); }
.font-setting { padding-top: 14px; border-top: 1px solid var(--line); }
.segmented { display: grid; grid-template-columns: repeat(3,1fr); gap: 4px; margin-top: 11px; padding: 4px; border-radius: 14px; background: var(--surface-2); }
.segmented button { min-height: 36px; border: 0; border-radius: 10px; background: transparent; color: var(--muted); font-size: .68rem; font-weight: 700; }
.segmented button.active { color: var(--primary); background: var(--surface); box-shadow: 0 3px 10px rgba(18,43,62,.08); }
.server-card { display: flex; flex-direction: column; gap: 8px; margin: 6px 0 13px; padding: 12px; border-radius: 15px; background: var(--surface-2); }
.server-card code { color: var(--muted); direction: ltr; text-align: left; overflow-wrap: anywhere; font-size: .66rem; }
.server-state { display: flex; align-items: center; gap: 6px; color: var(--success); font-size: .68rem; font-weight: 700; }
.server-state i { width: 7px; height: 7px; border-radius: 50%; background: var(--success); }
.compact-group { padding: 6px 14px; }
.plain-row, .action-row { width: 100%; border: 0; background: transparent; display: flex; align-items: center; justify-content: space-between; padding: 9px 0; }
.row-label { display: flex; align-items: center; gap: 10px; }
.row-label b { font-size: .82rem; }
.chevron { width: 19px; height: 19px; color: var(--muted); }

.about-card { text-align: center; margin-top: 5px; line-height: 1.9; padding: 28px 20px; }
.about-logo { width: 76px; height: 76px; margin: 0 auto 12px; display: grid; place-items: center; border-radius: 25px; color: white; background: var(--gradient); box-shadow: var(--shadow-primary); }
.about-logo svg { width: 36px; height: 36px; }
.about-logo.logo-photo img { border-radius: 25px; }
.version-pill { display: inline-block; border-radius: 99px; padding: 4px 9px; color: var(--primary); background: var(--primary-soft); font-size: .65rem; font-weight: 800; }
.about-card h2 { margin: 5px 0 0; font-size: 1.35rem; }
.about-card > p { margin: 5px auto; color: var(--muted); font-size: .76rem; max-width: 360px; }
.feature-grid { display: grid; grid-template-columns: repeat(2,1fr); gap: 9px; text-align: right; margin: 22px 0; }
.feature-grid span { display: flex; align-items: center; gap: 8px; padding: 11px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface-2); font-size: .7rem; }
.feature-grid svg { width: 18px; height: 18px; color: var(--primary); }
.privacy-note { display: flex; align-items: flex-start; gap: 8px; padding: 12px; color: var(--muted); background: var(--gradient-soft); border-radius: 15px; text-align: right; }
.privacy-note svg { width: 19px; height: 19px; color: var(--primary); flex: 0 0 auto; margin-top: 3px; }
.privacy-note p { margin: 0; font-size: .68rem; line-height: 1.8; }

.bottom-nav {
  position: fixed; z-index: 20; bottom: 0; right: 0; left: 0;
  height: calc(var(--nav-height) + env(safe-area-inset-bottom));
  padding: 6px 8px env(safe-area-inset-bottom);
  background: color-mix(in srgb, var(--surface) 94%, transparent);
  border-top: 1px solid var(--line);
  display: grid; grid-template-columns: repeat(4,1fr);
  box-shadow: 0 -8px 25px rgba(20,50,72,.06);
  backdrop-filter: blur(18px);
}
.bottom-nav button {
  position: relative; border: 0; background: transparent; color: var(--muted);
  display: flex; flex-direction: column; gap: 3px; align-items: center; justify-content: center;
  min-width: 0; padding: 3px;
}
.nav-icon { width: 45px; height: 34px; border-radius: 14px; display: grid; place-items: center; transition: .2s ease; }
.nav-icon svg { width: 24px; height: 24px; stroke-width: 1.8; }
.bottom-nav button small { font-size: .65rem; font-weight: 600; }
.bottom-nav button.active { color: var(--primary); }
.bottom-nav button.active .nav-icon { background: var(--primary-soft); transform: translateY(-1px); }
.bottom-nav button.active small { font-weight: 800; }

.chat-screen { position: fixed; inset: 0; z-index: 40; background: var(--bg); display: flex; flex-direction: column; animation: slideIn .24s ease-out; }
.chat-header {
  min-height: calc(70px + env(safe-area-inset-top));
  padding: calc(8px + env(safe-area-inset-top)) 8px 8px;
  display: flex; align-items: center; gap: 8px;
  background: color-mix(in srgb,var(--surface) 96%,transparent);
  border-bottom: 1px solid var(--line); box-shadow: var(--shadow-sm); backdrop-filter: blur(18px);
}
.chat-header > .icon-btn:first-child svg { transform: rotate(180deg); }
.chat-header .avatar { width: 46px; height: 46px; border-radius: 16px; font-size: 1.05rem; }
.chat-title { flex: 1; min-width: 0; }
.chat-title b, .chat-title small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat-title b { font-size: .9rem; }
.chat-title small { color: var(--muted); margin-top: 2px; font-size: .65rem; }
.private-badge { color: var(--primary); background: var(--primary-soft); border-radius: 10px; padding: 5px 7px; font-size: .58rem; display: flex; align-items: center; gap: 3px; }
.private-badge svg { width: 12px; height: 12px; }
.chat-more { color: var(--muted); }
.messages {
  flex: 1; overflow-y: auto; padding: 14px 10px 10px;
  background-color: var(--bg);
  background-image:
    radial-gradient(circle at center, color-mix(in srgb,var(--primary) 7%,transparent) 0 1.3px, transparent 1.7px),
    linear-gradient(135deg, transparent 46%, color-mix(in srgb,var(--primary-2) 3%,transparent) 47% 53%, transparent 54%);
  background-size: 30px 30px, 58px 58px;
}
.date-chip { width: max-content; margin: 3px auto 14px; padding: 5px 10px; border-radius: 10px; background: color-mix(in srgb,var(--text) 54%,transparent); color: white; font-size: .59rem; font-weight: 700; backdrop-filter: blur(8px); }
.message { display: flex; flex-direction: column; align-items: flex-start; margin: 3px 0 8px; animation: bubble .18s ease-out; }
.message.mine { align-items: flex-end; }
.bubble {
  position: relative; max-width: 84%; min-width: 76px; padding: 8px 11px 6px;
  border: 1px solid color-mix(in srgb,var(--line) 70%,transparent);
  border-radius: 18px 18px 18px 6px; background: var(--bubble);
  box-shadow: 0 3px 10px rgba(22,50,71,.08); overflow: hidden;
}
.mine .bubble { background: var(--mine); border-color: color-mix(in srgb,var(--primary) 11%,var(--line)); border-radius: 18px 18px 6px 18px; }
.author { color: var(--primary); font-size: .64rem; font-weight: 800; margin-bottom: 4px; }
.message-text { white-space: pre-wrap; overflow-wrap: anywhere; line-height: 1.72; font-size: .81rem; }
.message-time { display: flex; align-items: center; justify-content: flex-end; gap: 3px; direction: ltr; color: var(--muted); font-size: .53rem; margin-top: 3px; }
.mine .message-time::before { content: "✓✓"; letter-spacing: -3px; padding-right: 3px; color: var(--primary); font-size: .58rem; }
.attachment-image { display: block; width: min(270px,72vw); max-height: 370px; object-fit: cover; border-radius: 13px; margin-bottom: 6px; }
.attachment-file { display: flex; align-items: center; gap: 9px; min-width: 215px; padding: 9px; border-radius: 13px; background: color-mix(in srgb,var(--primary) 9%,transparent); color: var(--text); text-decoration: none; }
.attachment-file span:first-child { font-size: 1.5rem; }
.attachment-file small { display: block; color: var(--muted); margin-top: 2px; direction: ltr; font-size: .58rem; }
.bubble audio { max-width: 255px; height: 40px; }
.typing { width: max-content; margin: 0 12px 5px; padding: 5px 10px; border-radius: 10px; color: var(--primary); background: var(--primary-soft); font-size: .61rem; }
.composer {
  min-height: calc(65px + env(safe-area-inset-bottom));
  padding: 8px 7px calc(8px + env(safe-area-inset-bottom));
  display: flex; align-items: flex-end; gap: 3px; background: var(--surface); border-top: 1px solid var(--line);
}
.composer .icon-btn { flex: 0 0 38px; width: 38px; height: 43px; color: var(--muted); }
.composer .icon-btn svg { width: 21px; height: 21px; }
.composer textarea { flex: 1; min-height: 43px; max-height: 112px; padding: 10px 13px; border: 0; border-radius: 17px; background: var(--surface-2); box-shadow: none; line-height: 1.55; }
.send-btn { flex: 0 0 44px; width: 44px; height: 44px; border: 0; border-radius: 16px; display: grid; place-items: center; background: var(--gradient); color: white; box-shadow: 0 7px 18px var(--accent-glow); transition: transform .15s; }
.send-btn svg { width: 21px; height: 21px; transform: rotate(-5deg); }
#voiceButton.recording { background: #e34b5f; color: white; animation: pulse 1s infinite; border-radius: 15px; }
#voiceButton.recording svg { display: none; }
#voiceButton.recording::after { content: "■"; font-size: .8rem; }
.emoji-panel { padding: 10px; display: grid; grid-template-columns: repeat(8,1fr); gap: 4px; background: var(--surface); border-top: 1px solid var(--line); max-height: 195px; overflow-y: auto; }
.emoji-panel button { border: 0; background: transparent; font-size: 1.45rem; padding: 5px 0; }

.sheet-backdrop { position: fixed; inset: 0; z-index: 60; display: flex; align-items: flex-end; background: rgba(4,12,22,.58); backdrop-filter: blur(4px); }
.sheet { width: 100%; max-height: 88vh; overflow-y: auto; background: var(--surface); border-radius: 28px 28px 0 0; padding: 10px 17px calc(18px + env(safe-area-inset-bottom)); animation: sheetUp .26s ease-out; box-shadow: 0 -20px 50px rgba(0,0,0,.2); }
.sheet-handle { width: 43px; height: 4px; border-radius: 5px; background: var(--line); margin: 0 auto 13px; }
.sheet-title { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.sheet-title h2 { margin: 0; font-size: 1.07rem; }
.sheet-title p { margin: 2px 0 0; color: var(--muted); font-size: .68rem; }
.sheet-title .sheet-close { background: var(--surface-2); color: var(--muted); font-size: 1.2rem; }
.sheet h3 { color: var(--muted); font-size: .72rem; margin: 19px 3px 6px; }
.action-row { justify-content: flex-start; gap: 11px; text-align: right; margin: 14px 0 0; padding: 11px; border: 1px solid var(--line); border-radius: 18px; background: var(--surface-2); }
.action-row > span:nth-child(2) { flex: 1; }
.action-row span b, .action-row span small { display: block; }
.action-row b { font-size: .82rem; }
.action-row small { color: var(--muted); margin-top: 3px; font-size: .65rem; }
.round-icon { width: 47px; height: 47px; border-radius: 16px; display: grid; place-items: center; color: white; }
.round-icon svg { width: 23px; height: 23px; }
.channel-gradient { background: var(--gradient); box-shadow: 0 8px 18px var(--accent-glow); }
.compact-list .list-row { min-height: 63px; padding: 8px; }
.compact-list .avatar { width: 43px; height: 43px; border-radius: 15px; }
.compact-list .contact-action { min-width: 56px; min-height: 31px; }
.channel-preview { display: flex; align-items: center; gap: 11px; margin: 15px 0 6px; padding: 12px; border: 1px solid color-mix(in srgb,var(--primary) 14%,var(--line)); border-radius: 18px; background: var(--gradient-soft); }
.channel-preview-icon { width: 52px; height: 52px; border-radius: 17px; display: grid; place-items: center; color: white; background: var(--gradient); font-size: 1.45rem; box-shadow: var(--shadow-primary); }
.channel-preview b, .channel-preview small { display: block; }
.channel-preview b { font-size: .86rem; }
.channel-preview small { color: var(--muted); font-size: .65rem; margin-top: 3px; }
.emoji-input { text-align: center; font-size: 1.3rem; }
.channel-privacy { border: 1px solid var(--line); border-radius: 17px; padding: 10px; background: var(--surface-2); }
.member-list { max-height: 220px; overflow-y: auto; border: 1px solid var(--line); border-radius: 16px; background: var(--surface-2); }
.member-check { display: flex; align-items: center; gap: 10px; padding: 11px; margin: 0; border-bottom: 1px solid var(--line); color: var(--text); }
.member-check:last-child { border: 0; }
.member-check input { appearance: none; -webkit-appearance: none; width: 21px; height: 21px; border: 2px solid var(--muted); border-radius: 7px; margin: 0; padding: 0; background: transparent; }
.member-check input:checked { border-color: var(--primary); background: var(--primary); box-shadow: inset 0 0 0 4px var(--surface); }

.toast {
  position: fixed; z-index: 100; left: 50%; bottom: 98px;
  transform: translate(-50%,20px); padding: 10px 15px; color: white;
  background: rgba(12,24,36,.94); border: 1px solid rgba(255,255,255,.08);
  border-radius: 14px; opacity: 0; pointer-events: none; transition: .2s;
  max-width: 86%; text-align: center; font-size: .72rem; box-shadow: 0 12px 28px rgba(0,0,0,.25);
}
.toast.show { opacity: 1; transform: translate(-50%,0); }

body.compact .list-row { min-height: 64px; padding-top: 7px; padding-bottom: 7px; }
body.compact .avatar { width: 45px; height: 45px; border-radius: 15px; }
body.compact .message { margin-bottom: 4px; }
body.compact .bubble { padding: 6px 9px 4px; }
body.compact .view { padding-top: 17px; }

@media (max-width: 370px) {
  .two-fields { grid-template-columns: 1fr; gap: 0; }
  .theme-choices { gap: 5px; }
  .contact-action { min-width: 48px; padding-inline: 7px; }
  .bottom-nav button small { font-size: .59rem; }
  .composer .icon-btn:nth-of-type(2) { display: none; }
}

@keyframes rise { from { opacity: 0; transform: translateY(22px) scale(.98); } }
@keyframes fade { from { opacity: 0; transform: translateY(6px); } }
@keyframes slideIn { from { transform: translateX(-20px); opacity: 0; } }
@keyframes sheetUp { from { transform: translateY(45px); opacity: .35; } }
@keyframes bubble { from { opacity: 0; transform: scale(.96) translateY(4px); } }
@keyframes pulse { 50% { transform: scale(.9); } }
@keyframes spin { to { transform: rotate(360deg); } }

/* Motion system — lightweight, transform/opacity-first animations */
.ripple-host { position: relative; overflow: hidden; isolation: isolate; }
.touch-ripple {
  position: absolute; z-index: 20; pointer-events: none; border-radius: 50%;
  background: color-mix(in srgb, currentColor 18%, transparent);
  transform: scale(0); opacity: .75;
  animation: touchRipple .66s cubic-bezier(.2,.7,.2,1) forwards;
}

.aurora-one { animation: auroraOne 13s ease-in-out infinite alternate; }
.aurora-two { animation: auroraTwo 15s ease-in-out -4s infinite alternate; }
.login-brand { animation: brandReveal .75s cubic-bezier(.16,1,.3,1) both; }
.brand-orbit {
  animation: brandFloat 5.5s ease-in-out 1s infinite;
  transform-origin: 50% 58%;
}
.brand-orbit::before {
  content: ""; position: absolute; width: 110px; height: 110px; border-radius: 38px;
  border: 1px solid rgba(255,255,255,.24); transform: rotate(18deg);
  animation: orbitRing 9s linear infinite;
}
.brand-orbit { position: relative; }
.brand-orbit svg { animation: planeHover 4s ease-in-out infinite; }
.brand-orbit.logo-photo img { animation: none; }
.login-brand h1 { animation: textRise .65s .14s cubic-bezier(.16,1,.3,1) both; }
.login-brand p { animation: textRise .65s .23s cubic-bezier(.16,1,.3,1) both; }
.login-card { animation: cardSpring .72s .1s cubic-bezier(.16,1,.3,1) both; }
.login-card-title { animation: textRise .55s .24s both; }
.login-card > label { animation: fieldReveal .55s cubic-bezier(.16,1,.3,1) both; }
.login-card > label:nth-of-type(1) { animation-delay: .27s; }
.login-card > label:nth-of-type(2) { animation-delay: .34s; }
.login-card > label:nth-of-type(3) { animation-delay: .41s; }
.login-card .primary { animation: fieldReveal .55s .49s cubic-bezier(.16,1,.3,1) both; }
.secure-pill svg { animation: shieldBeat 2.8s ease-in-out infinite; }
.input-wrap:focus-within > svg { animation: inputIconPop .4s cubic-bezier(.2,1.5,.4,1); color: var(--primary); }
.login-screen.leaving { animation: loginLeave .28s ease-in forwards; }
.login-screen.login-return { animation: loginReturn .52s cubic-bezier(.16,1,.3,1) both; }
.login-card.shake { animation: cardShake .48s ease both; }
.button-spinner {
  width: 18px; height: 18px; border: 2px solid rgba(255,255,255,.38);
  border-top-color: white; border-radius: 50%; animation: spin .7s linear infinite;
}
.primary.connecting { background-size: 180% 180%; animation: gradientTravel 1.4s ease-in-out infinite; }

.app.app-enter { animation: appReveal .58s cubic-bezier(.16,1,.3,1) both; }
.topbar::after { animation: headerWave 7s ease-in-out infinite; transform-origin: center top; }
.mini-brand { animation: miniBrandBreath 4.4s ease-in-out infinite; }
.mini-brand svg { animation: miniPlane 5s ease-in-out infinite; }
.mini-brand.logo-photo img { animation: none; }
.topbar small i, .server-state i, .online-legend i { animation: statusPulse 2.2s ease-out infinite; }
.glass-btn:active svg { animation: plusTurn .42s cubic-bezier(.2,1.4,.4,1); }

.view.active { animation: none; }
.view.active.view-forward { animation: viewForward .34s cubic-bezier(.2,.8,.2,1) both; }
.view.active.view-back { animation: viewBack .34s cubic-bezier(.2,.8,.2,1) both; }
.view.active .search-box,
.view.active .section-heading,
.view.active .settings-intro,
.view.active .profile-hero,
.view.active .about-card {
  animation: contentRise .46s cubic-bezier(.16,1,.3,1) both;
}
.search-box:focus-within {
  transform: translateY(-1px);
  box-shadow: 0 8px 24px color-mix(in srgb,var(--primary) 12%,transparent);
  transition: transform .22s ease, box-shadow .22s ease, border-color .22s ease;
}
.filter-pill { transition: transform .2s ease, background .25s ease, color .25s ease, border-color .25s ease; }
.filter-pill.active { position: relative; overflow: hidden; }
.filter-pill.active::after {
  content: ""; position: absolute; inset: 0; transform: translateX(120%) skewX(-18deg);
  background: linear-gradient(90deg,transparent,rgba(255,255,255,.55),transparent);
  animation: pillShine 1.15s ease-out;
}
.filter-pill.filter-pop { animation: pillPop .43s cubic-bezier(.2,1.55,.4,1); }

.list-row {
  transform-origin: center right;
  backface-visibility: hidden;
}
.room-list .list-row, .contact-list .list-row, .compact-list .list-row {
  animation: rowReveal .42s cubic-bezier(.16,1,.3,1) both;
  animation-delay: calc(min(var(--item-index, 0), 12) * 34ms);
}
.list-row:active .avatar { transform: scale(.93) rotate(-3deg); }
.list-row .avatar { transition: transform .26s cubic-bezier(.2,1.4,.4,1), box-shadow .25s ease; }
.list-row:active .row-main { transform: translateX(-2px); }
.row-main { transition: transform .2s ease; }
.contact-action { transition: transform .2s ease, background .2s ease; }
.contact-row:active .contact-action { transform: scale(.94); }
.online-dot { animation: onlinePop .48s cubic-bezier(.2,1.6,.4,1) both, onlineHalo 2.4s .55s infinite; }
.type-tag { animation: tagAppear .38s .12s cubic-bezier(.2,1.45,.4,1) both; }
.fab { animation: fabFloat 4s ease-in-out 1.2s infinite; }
.fab:active svg { animation: pencilWiggle .4s ease; }

.bottom-nav button { overflow: hidden; transition: color .25s ease; }
.nav-icon { position: relative; }
.nav-icon::before {
  content: ""; position: absolute; inset: 50%; border-radius: 14px;
  background: var(--primary-soft); opacity: 0;
  transition: inset .32s cubic-bezier(.16,1,.3,1), opacity .2s ease;
}
.bottom-nav button.active .nav-icon::before { inset: 0; opacity: 1; }
.nav-icon svg { position: relative; z-index: 1; transition: transform .32s cubic-bezier(.2,1.5,.4,1); }
.bottom-nav button.active .nav-icon svg { transform: translateY(-1px) scale(1.08); }
.bottom-nav button.active .nav-icon { background: transparent; }
.bottom-nav button.nav-pop .nav-icon svg { animation: navIconPop .52s cubic-bezier(.2,1.6,.4,1); }
.bottom-nav button.nav-pop small { animation: navLabel .42s ease both; }

.chat-screen { animation: none; }
.chat-screen.opening { animation: chatOpen .4s cubic-bezier(.16,1,.3,1) both; }
.chat-screen.closing { animation: chatClose .26s ease-in both; pointer-events: none; }
.chat-screen.opening .chat-header > * {
  animation: headerItem .38s cubic-bezier(.16,1,.3,1) both;
}
.chat-screen.opening .chat-header > *:nth-child(2) { animation-delay: 45ms; }
.chat-screen.opening .chat-header > *:nth-child(3) { animation-delay: 85ms; }
.chat-screen.opening .chat-header > *:nth-child(4) { animation-delay: 115ms; }
.chat-screen.opening .chat-header > *:nth-child(5) { animation-delay: 140ms; }
.chat-header .avatar.avatar-arrive { animation: avatarArrive .6s cubic-bezier(.2,1.6,.4,1); }
.date-chip { animation: dateDrop .45s cubic-bezier(.2,1.4,.4,1) both; }
.message { animation: none; }
.message.message-history {
  animation: historyBubble .35s cubic-bezier(.16,1,.3,1) both;
  animation-delay: calc(max(var(--item-index, 0), 0) * 22ms);
}
.message.message-new-in { animation: messageIn .48s cubic-bezier(.16,1,.3,1) both; transform-origin: right bottom; }
.message.message-new-out { animation: messageOut .48s cubic-bezier(.16,1,.3,1) both; transform-origin: left bottom; }
.message-new-out .bubble::after {
  content: ""; position: absolute; inset: -30% -70%; transform: translateX(120%) rotate(15deg);
  background: linear-gradient(90deg,transparent,rgba(255,255,255,.3),transparent);
  animation: bubbleShine .72s .08s ease-out;
}
.attachment-image { animation: imageReveal .5s .08s cubic-bezier(.16,1,.3,1) both; }
.attachment-file:active { transform: scale(.98); }
.attachment-file { transition: transform .2s ease, background .2s ease; }
.mine .message-time::before { animation: checksArrive .55s .25s ease both; }

.message-skeletons { display: flex; flex-direction: column; gap: 13px; padding: 22px 4px; }
.skeleton-bubble {
  display: block; width: 58%; height: 55px; border-radius: 18px 18px 18px 6px;
  background: linear-gradient(105deg,var(--surface-2) 35%,var(--surface-3) 47%,var(--surface-2) 60%);
  background-size: 240% 100%; animation: skeletonSweep 1.25s ease-in-out infinite;
}
.skeleton-bubble.mine { align-self: flex-end; border-radius: 18px 18px 6px 18px; }
.skeleton-bubble.short { width: 34%; height: 42px; }
.skeleton-bubble.medium { width: 49%; height: 64px; }
.skeleton-bubble.long { width: 71%; height: 76px; }
.skeleton-bubble:nth-child(2) { animation-delay: -.25s; }
.skeleton-bubble:nth-child(3) { animation-delay: -.55s; }
.skeleton-bubble:nth-child(4) { animation-delay: -.8s; }

.typing {
  display: flex; align-items: center; gap: 7px;
  animation: typingAppear .3s cubic-bezier(.2,1.4,.4,1) both;
}
.typing-dots { display: inline-flex; direction: ltr; gap: 3px; }
.typing-dots i {
  width: 4px; height: 4px; border-radius: 50%; background: currentColor;
  animation: typingDot .9s ease-in-out infinite;
}
.typing-dots i:nth-child(2) { animation-delay: .14s; }
.typing-dots i:nth-child(3) { animation-delay: .28s; }
.composer { transition: box-shadow .25s ease, transform .25s ease; }
.composer:focus-within { box-shadow: 0 -8px 28px color-mix(in srgb,var(--primary) 9%,transparent); }
.composer.composer-send { animation: composerSend .5s cubic-bezier(.2,1.3,.4,1); }
.send-btn.sending svg { animation: planeLaunch .72s ease-in-out infinite; }
.send-btn:not(:disabled):active { animation: sendPress .36s ease; }
#voiceButton.recording { animation: recordingPulse 1.2s ease-in-out infinite; }
#voiceButton.recording::before {
  content: ""; position: absolute; inset: -5px; border: 2px solid #e34b5f; border-radius: 19px;
  animation: recordingRing 1.2s ease-out infinite;
}
.emoji-panel.emoji-open { animation: emojiPanelOpen .38s cubic-bezier(.16,1,.3,1) both; transform-origin: bottom; }
.emoji-panel button { animation: emojiPop .34s cubic-bezier(.2,1.55,.4,1) both; }
.emoji-panel button:nth-child(3n+1) { animation-delay: 25ms; }
.emoji-panel button:nth-child(3n+2) { animation-delay: 55ms; }
.emoji-panel button:nth-child(3n) { animation-delay: 85ms; }
.emoji-panel button:active { transform: scale(1.35) rotate(-8deg); }
#emojiButton.active { color: var(--primary); background: var(--primary-soft); }

.sheet-backdrop { animation: backdropIn .25s ease-out both; }
.sheet-backdrop .sheet { animation: sheetSpring .42s cubic-bezier(.16,1,.3,1) both; }
.sheet-backdrop.closing { animation: backdropOut .24s ease-in both; }
.sheet-backdrop.closing .sheet { animation: sheetDown .24s ease-in both; }
.sheet-backdrop.opening .sheet-title,
.sheet-backdrop.opening .action-row,
.sheet-backdrop.opening .channel-preview,
.sheet-backdrop.opening .sheet > label,
.sheet-backdrop.opening .sheet > h3,
.sheet-backdrop.opening .sheet > .primary {
  animation: sheetContent .42s cubic-bezier(.16,1,.3,1) both;
}
.sheet-backdrop.opening .action-row { animation-delay: 55ms; }
.sheet-backdrop.opening .channel-preview { animation-delay: 45ms; }
.sheet-handle { animation: handleBreath 2.6s ease-in-out infinite; }
.action-row:active .round-icon { transform: rotate(-8deg) scale(.94); }
.round-icon { transition: transform .28s cubic-bezier(.2,1.4,.4,1); }
.channel-preview { position: relative; overflow: hidden; }
.channel-preview::after {
  content: ""; position: absolute; inset: 0; transform: translateX(120%);
  background: linear-gradient(100deg,transparent,rgba(255,255,255,.45),transparent);
}
.channel-preview.preview-refresh { animation: previewPop .4s cubic-bezier(.2,1.4,.4,1); }
.channel-preview.preview-refresh::after { animation: previewShine .58s ease-out; }
.channel-preview.preview-refresh .channel-preview-icon { animation: emojiBounce .42s cubic-bezier(.2,1.6,.4,1); }
.member-check {
  animation: rowReveal .36s cubic-bezier(.16,1,.3,1) both;
  animation-delay: calc(min(var(--item-index, 0), 10) * 30ms);
}
.member-check input:checked { animation: checkBounce .4s cubic-bezier(.2,1.5,.4,1); }

.profile-pattern { animation: patternDrift 18s linear infinite; }
.profile-hero::after { animation: profileGlow 8s ease-in-out infinite alternate; }
.profile-avatar-wrap { animation: profileAvatarFloat 5s ease-in-out 1s infinite; }
.avatar-camera { transition: transform .25s cubic-bezier(.2,1.5,.4,1); }
.avatar-camera:active { transform: rotate(-12deg) scale(.9); }
.profile-status i { animation: statusPulse 2s ease-out infinite; }
.profile-form { animation: profileCardRise .55s .08s cubic-bezier(.16,1,.3,1) both; }
.color-choice {
  animation: colorDrop .4s cubic-bezier(.2,1.5,.4,1) both;
  animation-delay: calc(var(--item-index, 0) * 35ms);
  transition: transform .25s cubic-bezier(.2,1.5,.4,1), box-shadow .25s ease;
}
.color-choice:active { transform: scale(.86); }
.color-choice.selected { animation: selectedColor .5s cubic-bezier(.2,1.6,.4,1); }
.avatar-color-pop { animation: avatarColorPop .55s cubic-bezier(.2,1.6,.4,1) !important; }
.success-bounce { animation: successBounce .66s cubic-bezier(.2,1.5,.4,1) !important; }

.settings-view.active .settings-group {
  animation: settingsGroup .46s cubic-bezier(.16,1,.3,1) both;
}
.settings-view.active .settings-group:nth-of-type(2) { animation-delay: 55ms; }
.settings-view.active .settings-group:nth-of-type(3) { animation-delay: 105ms; }
.settings-view.active .settings-group:nth-of-type(4) { animation-delay: 155ms; }
.settings-view.active .settings-group:nth-of-type(5) { animation-delay: 205ms; }
.settings-intro > span { animation: sparkleTilt 4s ease-in-out infinite; }
.settings-intro > span svg { animation: sparklePulse 2.4s ease-in-out infinite; }
.theme-choice {
  animation: themeDrop .38s cubic-bezier(.2,1.5,.4,1) both;
  animation-delay: calc(var(--item-index, 0) * 45ms);
  transition: transform .24s cubic-bezier(.2,1.4,.4,1), box-shadow .25s ease;
}
.theme-choice:active { transform: scale(.88) rotate(-3deg); }
.theme-choice.selected { animation: themeSelected .52s cubic-bezier(.2,1.55,.4,1); }
.theme-choice.selected::after { animation: checkDraw .42s .08s cubic-bezier(.2,1.5,.4,1) both; }
.switch:checked::after { animation: switchBounce .42s cubic-bezier(.2,1.55,.4,1); }
.segmented button { transition: transform .2s ease, color .2s ease, background .2s ease, box-shadow .2s ease; }
.segmented button.active { animation: segmentPop .38s cubic-bezier(.2,1.4,.4,1); }
.palette-flash::after {
  content: ""; position: fixed; z-index: 80; inset: 0; pointer-events: none;
  background: radial-gradient(circle at 50% 60%,var(--primary-soft),transparent 60%);
  animation: paletteFlash .6s ease-out both;
}

.about-logo { animation: aboutLogo 5s ease-in-out infinite; }
.about-logo svg { animation: planeHover 4s ease-in-out infinite; }
.about-logo.logo-photo img { animation: none; }
.feature-grid span {
  animation: featureReveal .4s cubic-bezier(.16,1,.3,1) both;
}
.feature-grid span:nth-child(2) { animation-delay: 35ms; }
.feature-grid span:nth-child(3) { animation-delay: 70ms; }
.feature-grid span:nth-child(4) { animation-delay: 105ms; }
.feature-grid span:nth-child(5) { animation-delay: 140ms; }
.feature-grid span:nth-child(6) { animation-delay: 175ms; }
.feature-grid span:nth-child(7) { animation-delay: 210ms; }
.feature-grid span:nth-child(8) { animation-delay: 245ms; }

.toast {
  display: flex; align-items: center; gap: 8px; overflow: hidden;
}
.toast.show { animation: toastSpring .42s cubic-bezier(.16,1,.3,1) both; }
.toast-mark {
  width: 20px; height: 20px; flex: 0 0 20px; border-radius: 50%;
  display: grid; place-items: center; color: #fff; background: #e75c6c;
  font-weight: 900; font-size: .69rem;
}
.toast.success .toast-mark { background: #1bb487; }
.toast.show::after {
  content: ""; position: absolute; right: 0; bottom: 0; height: 2px; width: 100%;
  background: var(--gradient); transform-origin: right;
  animation: toastTimer 2.7s linear both;
}
.celebration-layer { position: fixed; z-index: 150; inset: 0; pointer-events: none; overflow: hidden; }
.celebration-piece {
  position: absolute; width: 8px; height: 12px; border-radius: 3px;
  background: var(--burst-color); opacity: 0;
  animation: celebrationBurst .95s var(--burst-delay) cubic-bezier(.15,.7,.2,1) forwards;
}

/* Owner console, group roles, and message tools */
.admin-entry {
  margin-bottom: 7px; padding: 11px 8px; border-radius: 16px;
  color: var(--text); background: linear-gradient(135deg,
    color-mix(in srgb,var(--primary) 13%,var(--surface)),
    color-mix(in srgb,#9f62ff 12%,var(--surface)));
  border: 1px solid color-mix(in srgb,var(--primary) 18%,var(--line));
}
.admin-entry .setting-icon { color: #f6ad2f; background: color-mix(in srgb,#f6ad2f 13%,var(--surface)); }
.admin-entry .row-label > span:last-child { text-align: right; }
.admin-entry .row-label b, .admin-entry .row-label small { display: block; }
.admin-entry .row-label small { margin-top: 3px; color: var(--muted); font-size: .61rem; }
.admin-view { padding-top: 13px; }
.admin-hero {
  position: relative; overflow: hidden; display: flex; align-items: center; gap: 14px;
  min-height: 132px; padding: 18px; border-radius: 25px; color: white;
  background:
    radial-gradient(circle at 12% 0,rgba(255,218,132,.28),transparent 38%),
    linear-gradient(135deg,#071c36,#163f71 54%,#583a87);
  box-shadow: 0 16px 36px rgba(6,25,52,.25);
}
.admin-hero::after {
  content: ""; position: absolute; width: 170px; height: 170px; left: -52px; bottom: -105px;
  border: 1px solid rgba(255,255,255,.12); border-radius: 50%;
  box-shadow: 0 0 0 24px rgba(255,255,255,.035),0 0 0 50px rgba(255,255,255,.02);
}
.admin-orbit {
  position: relative; z-index: 1; flex: 0 0 66px; width: 66px; height: 66px;
  display: grid; place-items: center; border-radius: 23px;
  color: #ffcf66; background: rgba(255,255,255,.1); border: 1px solid rgba(255,255,255,.16);
  box-shadow: inset 0 0 24px rgba(255,207,102,.1),0 10px 25px rgba(0,0,0,.17);
}
.admin-orbit svg { width: 34px; height: 34px; }
.admin-hero > div:last-child { position: relative; z-index: 1; }
.admin-hero h2 { margin: 6px 0 2px; font-size: 1.15rem; }
.admin-hero p { margin: 0; opacity: .72; font-size: .66rem; line-height: 1.7; }
.developer-chip {
  width: max-content; display: flex; align-items: center; gap: 6px;
  padding: 4px 8px; direction: ltr; border-radius: 99px; color: #ffe19d;
  background: rgba(255,207,102,.1); font-size: .52rem; font-weight: 900; letter-spacing: .7px;
}
.developer-chip i { width: 6px; height: 6px; border-radius: 50%; background: #55e8ad; box-shadow: 0 0 9px #55e8ad; }
.admin-stats { display: grid; grid-template-columns: repeat(4,1fr); gap: 7px; margin: 12px 0; }
.admin-stat {
  min-width: 0; display: flex; flex-direction: column; align-items: center;
  padding: 10px 3px; border: 1px solid var(--line); border-radius: 17px;
  background: var(--surface); box-shadow: var(--shadow-sm);
  animation: adminStatIn .45s cubic-bezier(.16,1,.3,1) both;
  animation-delay: calc(var(--item-index) * 45ms);
}
.admin-stat span { width: 30px; height: 30px; display: grid; place-items: center; border-radius: 11px; color: var(--primary); background: var(--primary-soft); }
.admin-stat svg { width: 17px; height: 17px; }
.admin-stat b { margin-top: 4px; font-size: .9rem; }
.admin-stat small { color: var(--muted); font-size: .52rem; }
.admin-loading { grid-column: 1/-1; padding: 28px; text-align: center; color: var(--muted); }
.admin-loading i { display: inline-block; width: 14px; height: 14px; margin-left: 6px; border: 2px solid var(--line); border-top-color: var(--primary); border-radius: 50%; animation: spin .7s linear infinite; vertical-align: middle; }
.admin-tabs {
  position: sticky; top: -12px; z-index: 4; display: grid; grid-template-columns: repeat(4,1fr);
  gap: 4px; padding: 5px; margin-bottom: 12px; border: 1px solid var(--line);
  border-radius: 17px; background: color-mix(in srgb,var(--surface) 94%,transparent);
  backdrop-filter: blur(14px); box-shadow: var(--shadow-sm);
}
.admin-tabs button {
  min-height: 43px; border: 0; border-radius: 13px; color: var(--muted);
  background: transparent; font-size: .57rem; font-weight: 800;
}
.admin-tabs svg { display: block; width: 18px; height: 18px; margin: 0 auto 2px; }
.admin-tabs button.active { color: white; background: var(--gradient); box-shadow: 0 6px 15px var(--accent-glow); animation: adminTabPop .4s cubic-bezier(.2,1.5,.4,1); }
.admin-panel { display: none; }
.admin-panel.active { display: block; }
.admin-panel.admin-panel-enter { animation: adminPanelIn .42s cubic-bezier(.16,1,.3,1); }
.admin-section-heading { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: 6px 2px 11px; }
.admin-section-heading h3 { margin: 0; font-size: .9rem; }
.admin-section-heading p { margin: 2px 0 0; color: var(--muted); font-size: .6rem; }
.small-primary {
  flex: 0 0 auto; min-height: 35px; padding: 6px 10px; border: 0; border-radius: 12px;
  color: white; background: var(--gradient); font-size: .62rem; font-weight: 800;
}
.small-primary svg { width: 15px; height: 15px; vertical-align: middle; }
.code-creator {
  padding: 14px; margin: 9px 0 12px; border: 1px solid color-mix(in srgb,var(--primary) 17%,var(--line));
  border-radius: 20px; background: var(--gradient-soft); transform-origin: top;
}
.code-creator.code-creator-in { animation: codeCreatorIn .44s cubic-bezier(.16,1,.3,1); }
.code-creator label { display: block; margin-bottom: 9px; font-size: .68rem; font-weight: 700; }
.code-creator label small { color: var(--muted); font-size: .55rem; font-weight: 500; }
.code-creator input { margin-top: 5px; background: var(--surface); }
.generated-code {
  display: flex; align-items: center; gap: 10px; padding: 12px; margin-bottom: 11px;
  border: 1px solid rgba(31,180,130,.25); border-radius: 18px;
  background: color-mix(in srgb,#22b985 10%,var(--surface));
}
.generated-code > span { width: 40px; height: 40px; display: grid; place-items: center; border-radius: 14px; color: #1a9d72; background: rgba(31,180,130,.13); }
.generated-code > span svg { width: 21px; height: 21px; }
.generated-code > div { flex: 1; min-width: 0; }
.generated-code small, .generated-code code { display: block; }
.generated-code small { color: var(--muted); font-size: .56rem; }
.generated-code code { margin-top: 3px; overflow-wrap: anywhere; font-size: .72rem; font-weight: 900; color: var(--text); }
.admin-list { display: flex; flex-direction: column; gap: 8px; }
.admin-code-card, .admin-user-card, .audit-entry {
  display: flex; align-items: center; gap: 10px; padding: 11px;
  border: 1px solid var(--line); border-radius: 18px; background: var(--surface);
  box-shadow: var(--shadow-sm); animation: adminRowIn .42s cubic-bezier(.16,1,.3,1) both;
  animation-delay: calc(min(var(--item-index,0),14) * 28ms);
}
.admin-code-card.is-revoked, .admin-user-card.is-suspended { opacity: .62; filter: saturate(.45); }
.admin-code-icon { flex: 0 0 43px; width: 43px; height: 43px; display: grid; place-items: center; border-radius: 15px; color: var(--primary); background: var(--primary-soft); }
.admin-code-icon svg { width: 21px; height: 21px; }
.admin-code-main, .admin-user-card > div { flex: 1; min-width: 0; }
.admin-code-main > div, .admin-user-card > div > div { display: flex; align-items: center; flex-wrap: wrap; gap: 5px; }
.admin-code-main b, .admin-user-card b { font-size: .75rem; }
.admin-code-main small, .admin-user-card small { display: block; color: var(--muted); font-size: .58rem; margin-top: 2px; }
.admin-code-main code, .admin-user-card code { display: block; color: color-mix(in srgb,var(--muted) 82%,transparent); font-size: .49rem; margin-top: 3px; overflow: hidden; text-overflow: ellipsis; }
.status-chip, .owner-chip { display: inline-flex; align-items: center; gap: 3px; padding: 3px 6px; border-radius: 99px; font-size: .48rem; font-weight: 900; }
.status-chip.active { color: #12855f; background: rgba(29,184,130,.12); }
.status-chip.revoked { color: #cb4a5c; background: rgba(216,66,88,.1); }
.owner-chip { color: #aa7412; background: rgba(246,173,47,.14); }
.owner-chip svg { width: 11px; height: 11px; }
.danger-mini, .restore-mini, .code-toggle {
  flex: 0 0 auto; min-height: 31px; padding: 5px 8px; border-radius: 10px;
  font-size: .54rem; font-weight: 900;
}
.danger-mini { color: #d74b60; border: 1px solid rgba(215,75,96,.18); background: rgba(215,75,96,.08); }
.restore-mini { color: #138863; border: 1px solid rgba(25,165,118,.18); background: rgba(25,165,118,.08); }
.admin-select {
  width: 100%; min-height: 45px; margin: 0 0 10px; padding: 0 12px;
  border: 1px solid var(--line); border-radius: 15px; color: var(--text);
  background: var(--surface); font-family: inherit;
}
.developer-console {
  overflow: hidden; border: 1px solid rgba(85,232,173,.15); border-radius: 22px;
  color: #dffbef; background: linear-gradient(160deg,#06151e,#0a2430);
  box-shadow: 0 17px 34px rgba(3,18,28,.22); direction: ltr;
}
.console-head { display: flex; justify-content: space-between; align-items: center; padding: 13px 14px; border-bottom: 1px solid rgba(255,255,255,.07); font: 700 .61rem monospace; color: #75f0bb; }
.console-head span { display: flex; align-items: center; gap: 6px; }
.console-head i { width: 7px; height: 7px; border-radius: 50%; background: #52e8ac; box-shadow: 0 0 9px #52e8ac; }
.console-head b { color: #9cb9c4; }
.console-grid { display: grid; grid-template-columns: repeat(2,1fr); gap: 1px; background: rgba(255,255,255,.05); }
.console-grid > div { padding: 12px; background: #081c27; min-width: 0; }
.console-grid small, .console-grid code { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.console-grid small { color: #64818c; font: 700 .48rem monospace; letter-spacing: .5px; }
.console-grid code { margin-top: 4px; color: #c9f8e5; font-size: .62rem; }
.capability-list { display: flex; flex-wrap: wrap; gap: 6px; padding: 12px; direction: rtl; }
.capability-list span { display: flex; align-items: center; gap: 4px; padding: 5px 7px; border-radius: 9px; color: #a4d7c4; background: rgba(82,232,172,.07); font: 600 .52rem monospace; }
.capability-list svg { width: 12px; height: 12px; color: #52e8ac; }
.console-note { display: flex; align-items: flex-start; gap: 6px; margin: 0; padding: 11px 13px; direction: rtl; color: #7796a2; background: rgba(0,0,0,.12); font-size: .55rem; line-height: 1.7; }
.console-note svg { flex: 0 0 15px; width: 15px; height: 15px; color: #52e8ac; }
.audit-list { display: flex; flex-direction: column; gap: 7px; }
.audit-entry > span { flex: 0 0 39px; width: 39px; height: 39px; display: grid; place-items: center; border-radius: 14px; color: #8c67dc; background: rgba(126,91,212,.1); }
.audit-entry > span svg { width: 19px; height: 19px; }
.audit-entry > div { min-width: 0; }
.audit-entry b, .audit-entry small, .audit-entry code { display: block; }
.audit-entry b { font-size: .68rem; direction: ltr; text-align: left; }
.audit-entry small { margin-top: 2px; color: var(--muted); font-size: .54rem; }
.audit-entry code { margin-top: 2px; color: color-mix(in srgb,var(--muted) 80%,transparent); font-size: .47rem; overflow: hidden; text-overflow: ellipsis; }

.message-actions-trigger {
  position: absolute; top: 3px; left: 3px; width: 27px; height: 27px;
  display: grid; place-items: center; padding: 0; border: 0; border-radius: 10px;
  color: color-mix(in srgb,var(--muted) 72%,transparent); background: transparent;
  opacity: .58; transition: opacity .2s,background .2s,transform .2s;
}
.message:not(.deleted-message) .bubble { padding-left: 34px; }
.message-actions-trigger svg { width: 16px; height: 16px; }
.message-actions-trigger:active { opacity: 1; transform: scale(.88); background: color-mix(in srgb,var(--primary) 10%,transparent); }
.message-meta { display: flex; align-items: center; justify-content: flex-end; gap: 5px; }
.edited-mark { color: var(--muted); font-size: .48rem; }
.deleted-message .bubble { border-style: dashed; color: var(--muted); background: color-mix(in srgb,var(--surface-2) 85%,transparent); box-shadow: none; }
.deleted-copy { display: flex; align-items: center; gap: 6px; padding: 2px 3px; font-size: .65rem; font-style: italic; }
.deleted-copy svg { width: 15px; height: 15px; }
.message.message-removing { animation: messageRemove .34s ease-in both !important; }
.edit-banner {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: 7px 10px; border-top: 1px solid var(--line); color: var(--text);
  background: color-mix(in srgb,var(--primary) 8%,var(--surface));
}
.edit-banner > span { min-width: 0; display: flex; align-items: center; gap: 8px; }
.edit-banner > span > svg { flex: 0 0 18px; width: 18px; height: 18px; color: var(--primary); }
.edit-banner b, .edit-banner small { display: block; }
.edit-banner b { font-size: .65rem; color: var(--primary); }
.edit-banner small { max-width: 65vw; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--muted); font-size: .57rem; }
.edit-banner.edit-banner-in { animation: editBannerIn .42s cubic-bezier(.16,1,.3,1); }
.composer.composer-edit { animation: composerEdit .55s cubic-bezier(.2,1.3,.4,1); }
.edit-gradient { background: linear-gradient(135deg,#5d6fe5,#9f62e8); }
.muted-gradient { background: linear-gradient(135deg,#638194,#8aa1ad); }
.danger-gradient { background: linear-gradient(135deg,#d84861,#ef7868); }
.danger-row { border-color: rgba(216,72,97,.14); background: color-mix(in srgb,#d84861 5%,var(--surface-2)); }
.danger-row b { color: #d84861; }

.group-summary { display: flex; align-items: center; gap: 10px; padding: 12px; margin: 12px 0; border-radius: 17px; background: var(--gradient-soft); }
.group-summary > span { width: 41px; height: 41px; display: grid; place-items: center; border-radius: 14px; color: var(--primary); background: var(--surface); }
.group-summary svg { width: 21px; height: 21px; }
.group-summary b, .group-summary small { display: block; }
.group-summary b { font-size: .76rem; }
.group-summary small { margin-top: 2px; color: var(--muted); font-size: .56rem; }
.group-member-list { display: flex; flex-direction: column; gap: 7px; }
.group-member {
  display: grid; grid-template-columns: 42px minmax(70px,1fr) auto auto;
  align-items: center; gap: 8px; padding: 8px; border: 1px solid var(--line);
  border-radius: 16px; background: var(--surface-2);
  animation: adminRowIn .4s cubic-bezier(.16,1,.3,1) both;
  animation-delay: calc(var(--item-index) * 28ms);
}
.group-member .avatar { width: 42px; height: 42px; border-radius: 14px; }
.group-member b, .group-member small { display: block; }
.group-member b { font-size: .7rem; }
.group-member small { color: var(--muted); font-size: .54rem; }
.group-member select { max-width: 92px; min-height: 34px; padding: 3px 5px; border: 1px solid var(--line); border-radius: 10px; color: var(--text); background: var(--surface); font-family: inherit; font-size: .55rem; }
.member-remove { width: 33px; height: 33px; display: grid; place-items: center; padding: 0; border: 0; border-radius: 10px; color: #d84861; background: rgba(216,72,97,.08); }
.member-remove svg { width: 16px; height: 16px; }
.role-badge { display: inline-flex; align-items: center; gap: 4px; padding: 5px 7px; border-radius: 99px; color: var(--muted); background: var(--surface); font-size: .51rem; font-weight: 800; }
.role-badge.owner { color: #aa7412; background: rgba(246,173,47,.13); }
.role-badge svg { width: 12px; height: 12px; }
.add-member-box { margin-top: 15px; padding-top: 9px; border-top: 1px solid var(--line); }
.add-member-box button { width: 100%; display: flex; align-items: center; gap: 8px; padding: 7px; border: 0; border-radius: 14px; color: var(--text); background: transparent; text-align: right; }
.add-member-box button:active { background: var(--surface-2); }
.add-member-box .avatar { width: 38px; height: 38px; border-radius: 13px; }
.add-member-box button span:nth-child(2) { flex: 1; font-size: .67rem; font-weight: 700; }
.add-member-box button > svg { width: 17px; height: 17px; color: var(--primary); }

.motion-paused *, .motion-paused *::before, .motion-paused *::after {
  animation-play-state: paused !important;
}
.motion-off *, .motion-off *::before, .motion-off *::after {
  animation: none !important;
  transition-duration: .001ms !important;
  scroll-behavior: auto !important;
}

@keyframes touchRipple { 60% { opacity: .28; } to { transform: scale(1); opacity: 0; } }
@keyframes auroraOne { to { transform: translate(-38px,52px) scale(1.16); opacity: .46; } }
@keyframes auroraTwo { to { transform: translate(48px,-35px) scale(.88); opacity: .5; } }
@keyframes brandReveal { from { opacity: 0; transform: translateY(-18px) scale(.92); } }
@keyframes brandFloat { 0%,100% { transform: translateY(0) rotate(-3deg); } 50% { transform: translateY(-7px) rotate(1deg); } }
@keyframes orbitRing { to { transform: rotate(378deg); } }
@keyframes planeHover { 0%,100% { transform: rotate(3deg) translate(0); } 50% { transform: rotate(-2deg) translate(2px,-2px); } }
@keyframes textRise { from { opacity: 0; transform: translateY(12px); } }
@keyframes cardSpring { from { opacity: 0; transform: translateY(36px) scale(.94); } 70% { transform: translateY(-2px) scale(1.005); } }
@keyframes fieldReveal { from { opacity: 0; transform: translateX(18px); } }
@keyframes shieldBeat { 50% { transform: scale(1.16); } }
@keyframes inputIconPop { 50% { transform: scale(1.2) rotate(-5deg); } }
@keyframes loginLeave { to { opacity: 0; transform: scale(1.035); filter: blur(4px); } }
@keyframes loginReturn { from { opacity: 0; transform: scale(.97); } }
@keyframes cardShake { 20% { transform: translateX(8px); } 40% { transform: translateX(-7px); } 60% { transform: translateX(5px); } 80% { transform: translateX(-3px); } }
@keyframes gradientTravel { 50% { background-position: 100% 50%; } }
@keyframes appReveal { from { opacity: 0; transform: scale(.985); } }
@keyframes headerWave { 50% { transform: scaleX(.92) translateY(1px); border-radius: 0 0 44% 44%; } }
@keyframes miniBrandBreath { 50% { background: rgba(255,255,255,.25); transform: scale(1.035); } }
@keyframes miniPlane { 50% { transform: translate(2px,-2px) rotate(-4deg); } }
@keyframes statusPulse { 0% { box-shadow: 0 0 0 0 color-mix(in srgb,currentColor 45%,transparent); } 70% { box-shadow: 0 0 0 6px transparent; } }
@keyframes plusTurn { 50% { transform: rotate(100deg) scale(1.15); } }
@keyframes viewForward { from { opacity: 0; transform: translateX(-22px) scale(.99); } }
@keyframes viewBack { from { opacity: 0; transform: translateX(22px) scale(.99); } }
@keyframes contentRise { from { opacity: 0; transform: translateY(14px); } }
@keyframes pillShine { to { transform: translateX(-130%) skewX(-18deg); } }
@keyframes pillPop { 50% { transform: scale(.92); } }
@keyframes rowReveal { from { opacity: 0; transform: translateY(14px) scale(.975); } }
@keyframes onlinePop { from { opacity: 0; transform: scale(0); } }
@keyframes onlineHalo { 0% { box-shadow: 0 0 0 3px var(--surface),0 0 0 3px color-mix(in srgb,var(--success) 45%,transparent); } 70% { box-shadow: 0 0 0 3px var(--surface),0 0 0 8px transparent; } }
@keyframes tagAppear { from { opacity: 0; transform: scale(.6); } }
@keyframes fabFloat { 0%,100% { transform: translateY(0) rotate(0); } 50% { transform: translateY(-4px) rotate(1deg); } }
@keyframes pencilWiggle { 35% { transform: rotate(-14deg); } 70% { transform: rotate(8deg); } }
@keyframes navIconPop { 35% { transform: translateY(-5px) scale(1.18); } 70% { transform: translateY(1px) scale(.96); } }
@keyframes navLabel { from { opacity: 0; transform: translateY(4px); } }
@keyframes chatOpen { from { opacity: 0; transform: translateX(-42px) scale(.985); } }
@keyframes chatClose { to { opacity: 0; transform: translateX(-34px) scale(.985); } }
@keyframes headerItem { from { opacity: 0; transform: translateY(-10px); } }
@keyframes avatarArrive { from { transform: scale(.5) rotate(-18deg); opacity: 0; } 70% { transform: scale(1.08) rotate(3deg); } }
@keyframes dateDrop { from { opacity: 0; transform: translateY(-8px) scale(.9); } }
@keyframes historyBubble { from { opacity: 0; transform: translateY(8px) scale(.97); } }
@keyframes messageIn { from { opacity: 0; transform: translateX(22px) translateY(8px) scale(.86); } 70% { transform: translateX(-2px) scale(1.02); } }
@keyframes messageOut { from { opacity: 0; transform: translateX(-22px) translateY(8px) scale(.86); } 70% { transform: translateX(2px) scale(1.02); } }
@keyframes bubbleShine { to { transform: translateX(-120%) rotate(15deg); } }
@keyframes imageReveal { from { opacity: 0; transform: scale(.92); filter: blur(3px); } }
@keyframes checksArrive { from { opacity: 0; transform: translateX(5px); } }
@keyframes skeletonSweep { to { background-position: -140% 0; } }
@keyframes typingAppear { from { opacity: 0; transform: translateY(6px) scale(.94); } }
@keyframes typingDot { 0%,60%,100% { transform: translateY(0); opacity: .45; } 30% { transform: translateY(-4px); opacity: 1; } }
@keyframes composerSend { 40% { transform: scale(.992) translateY(2px); } }
@keyframes planeLaunch { 45% { transform: translate(7px,-7px) rotate(-12deg) scale(.85); opacity: .2; } 55% { transform: translate(-7px,7px) rotate(-5deg) scale(.85); opacity: .2; } }
@keyframes sendPress { 50% { transform: scale(.88) rotate(-4deg); } }
@keyframes recordingPulse { 50% { transform: scale(.92); box-shadow: 0 0 0 7px rgba(227,75,95,.13); } }
@keyframes recordingRing { to { transform: scale(1.25); opacity: 0; } }
@keyframes emojiPanelOpen { from { opacity: 0; transform: translateY(20px) scaleY(.82); } }
@keyframes emojiPop { from { opacity: 0; transform: scale(.45) rotate(-14deg); } }
@keyframes backdropIn { from { opacity: 0; backdrop-filter: blur(0); } }
@keyframes backdropOut { to { opacity: 0; backdrop-filter: blur(0); } }
@keyframes sheetSpring { from { transform: translateY(100%); } 75% { transform: translateY(-7px); } }
@keyframes sheetDown { to { transform: translateY(100%); } }
@keyframes sheetContent { from { opacity: 0; transform: translateY(15px); } }
@keyframes handleBreath { 50% { width: 58px; background: var(--primary); opacity: .55; } }
@keyframes previewPop { 50% { transform: scale(.985); } }
@keyframes previewShine { to { transform: translateX(-120%); } }
@keyframes emojiBounce { 45% { transform: scale(1.13) rotate(-8deg); } }
@keyframes checkBounce { 50% { transform: scale(.8); } }
@keyframes patternDrift { to { background-position: 78px 78px,-95px 95px; } }
@keyframes profileGlow { to { transform: translate(45px,28px) scale(1.12); } }
@keyframes profileAvatarFloat { 50% { transform: translateY(-5px); } }
@keyframes profileCardRise { from { opacity: 0; transform: translateY(20px) scale(.985); } }
@keyframes colorDrop { from { opacity: 0; transform: translateY(-10px) scale(.8); } }
@keyframes selectedColor { 50% { transform: scale(1.2); } }
@keyframes avatarColorPop { 35% { transform: scale(.88) rotate(-5deg); } 70% { transform: scale(1.06) rotate(2deg); } }
@keyframes successBounce { 35% { transform: scale(.94); } 65% { transform: scale(1.025); } }
@keyframes settingsGroup { from { opacity: 0; transform: translateY(16px) scale(.985); } }
@keyframes sparkleTilt { 50% { transform: rotate(-7deg) scale(1.04); } }
@keyframes sparklePulse { 50% { transform: scale(1.14) rotate(8deg); } }
@keyframes themeDrop { from { opacity: 0; transform: translateY(-8px) scale(.82); } }
@keyframes themeSelected { 45% { transform: translateY(-3px) scale(1.07); } }
@keyframes checkDraw { from { opacity: 0; transform: scale(.25) rotate(-30deg); } }
@keyframes switchBounce { 55% { transform: translateX(-21px) scale(.84); } }
@keyframes segmentPop { 50% { transform: scale(.96); } }
@keyframes paletteFlash { from { opacity: .72; } to { opacity: 0; } }
@keyframes aboutLogo { 50% { transform: translateY(-5px) rotate(2deg); border-radius: 31px; } }
@keyframes featureReveal { from { opacity: 0; transform: translateY(10px) scale(.97); } }
@keyframes toastSpring { from { opacity: 0; transform: translate(-50%,24px) scale(.9); } 70% { transform: translate(-50%,-3px) scale(1.015); } }
@keyframes toastTimer { to { transform: scaleX(0); } }
@keyframes celebrationBurst {
  0% { opacity: 0; transform: translate(0,0) rotate(0) scale(.4); }
  15% { opacity: 1; }
  70% { opacity: 1; transform: translate(var(--burst-x),var(--burst-y)) rotate(var(--burst-r)) scale(1); }
  100% { opacity: 0; transform: translate(var(--burst-x),calc(var(--burst-y) + 110px)) rotate(var(--burst-r)) scale(.75); }
}
@keyframes adminStatIn { from { opacity: 0; transform: translateY(15px) scale(.9); } 70% { transform: translateY(-2px) scale(1.02); } }
@keyframes adminTabPop { 45% { transform: translateY(-2px) scale(1.04); } }
@keyframes adminPanelIn { from { opacity: 0; transform: translateY(12px) scale(.988); } }
@keyframes codeCreatorIn { from { opacity: 0; transform: scaleY(.76) translateY(-10px); } }
@keyframes adminRowIn { from { opacity: 0; transform: translateX(18px) scale(.98); } }
@keyframes messageRemove { to { opacity: 0; transform: translateX(-35px) scale(.82); filter: blur(3px); } }
@keyframes editBannerIn { from { opacity: 0; transform: translateY(100%); } 70% { transform: translateY(-2px); } }
@keyframes composerEdit { 40% { transform: scale(.99); box-shadow: 0 -8px 26px color-mix(in srgb,var(--primary) 18%,transparent); } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .001ms !important;
    scroll-behavior: auto !important;
  }
}


/* Message pinning */
.pinned-message-banner {
  width: 100%; min-height: 54px; display: grid; grid-template-columns: 38px minmax(0,1fr) 22px;
  align-items: center; gap: 9px; padding: 7px 13px; border: 0; border-bottom: 1px solid var(--line);
  color: var(--text); text-align: right; background: color-mix(in srgb,var(--primary) 7%,var(--surface));
  box-shadow: 0 6px 16px rgba(5,25,40,.05);
}
.pinned-message-banner:active { background: color-mix(in srgb,var(--primary) 12%,var(--surface)); }
.pinned-message-icon { width: 35px; height: 35px; display: grid; place-items: center; border-radius: 12px; color: #fff; background: var(--gradient); box-shadow: 0 7px 16px color-mix(in srgb,var(--primary) 24%,transparent); }
.pinned-message-icon svg { width: 18px; height: 18px; }
.pinned-message-copy { min-width: 0; }
.pinned-message-copy b, .pinned-message-copy small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pinned-message-copy b { color: var(--primary); font-size: .65rem; }
.pinned-message-copy small { margin-top: 2px; color: var(--muted); font-size: .57rem; }
.pinned-message-arrow { width: 17px; height: 17px; color: var(--muted); transform: rotate(180deg); }
.message-pin-mark { display: inline-flex; align-items: center; gap: 3px; margin: 0 0 4px; color: var(--primary); font-size: .48rem; font-weight: 800; }
.message-pin-mark svg { width: 11px; height: 11px; }
.pin-gradient { background: linear-gradient(135deg,#168fd0,#19b8ad); }
.message.message-pin-focus .bubble { animation: pinMessageFocus .86s cubic-bezier(.16,1,.3,1); }
@keyframes pinMessageFocus { 0%,100% { transform: scale(1); } 35% { transform: scale(1.035); box-shadow: 0 0 0 4px color-mix(in srgb,var(--primary) 16%,transparent), var(--shadow); } }

/* Hamrah 3.3 — client-only productivity and personalization */
body.high-contrast {
  --line: color-mix(in srgb,var(--text) 28%,transparent);
  --muted: color-mix(in srgb,var(--text) 72%,transparent);
}
body[data-bubble="round"] .bubble { border-radius: 23px !important; }
body[data-bubble="compact"] .bubble { border-radius: 12px !important; padding: 6px 9px 5px; }
body[data-wallpaper="plain"] .messages { background-image: none; }
body[data-wallpaper="dots"] .messages {
  background-image: radial-gradient(circle at center, color-mix(in srgb,var(--primary) 10%,transparent) 0 1.4px, transparent 1.8px);
  background-size: 25px 25px;
}
body[data-wallpaper="aurora"] .messages {
  background-image:
    radial-gradient(circle at 15% 15%, color-mix(in srgb,var(--primary) 16%,transparent), transparent 32%),
    radial-gradient(circle at 85% 78%, color-mix(in srgb,var(--primary-2) 14%,transparent), transparent 34%);
  background-size: 100% 100%;
}
.wallpaper-options button { padding-inline: 5px; }
.secondary { border: 1px solid var(--line); color: var(--primary); background: var(--primary-soft); }
.secondary svg { width: 19px; height: 19px; }
.room-shell {
  position: relative; display: flex; align-items: center; width: 100%; margin-top: 5px;
  border: 1px solid transparent; border-radius: 20px; transition: .2s ease;
}
.room-shell:hover { background: var(--surface); border-color: var(--line); box-shadow: var(--shadow-sm); }
.room-shell .room-open { margin: 0; flex: 1; min-width: 0; border: 0; box-shadow: none !important; }
.room-shell .room-open:hover { background: transparent; border-color: transparent; box-shadow: none; }
.room-local-menu { flex: 0 0 38px; width: 38px; height: 38px; margin-left: 5px; border: 0; border-radius: 13px; background: transparent; color: var(--muted); display: grid; place-items: center; }
.room-local-menu svg { width: 20px; height: 20px; }
.room-flags { display: inline-flex; align-items: center; gap: 3px; margin-right: 5px; color: var(--muted); }
.room-flags svg { width: 12px; height: 12px; }
.room-flags .pin-flag { color: var(--primary); }
.room-unread { margin-right: auto; }
.chat-search-button { color: var(--muted); }
.chat-search-bar {
  display: flex; align-items: center; gap: 7px; padding: 7px 9px; border-bottom: 1px solid var(--line);
  background: var(--surface); box-shadow: var(--shadow-sm); animation: chatSearchIn .25s ease-out;
}
.chat-search-bar > svg { width: 19px; height: 19px; color: var(--muted); }
.chat-search-bar input { min-width: 0; flex: 1; border: 0; padding: 7px 5px; background: transparent; box-shadow: none; }
.chat-search-bar span { min-width: 30px; color: var(--primary); font-size: .65rem; font-weight: 800; text-align: center; }
.chat-search-bar .icon-btn { width: 32px; height: 32px; background: var(--surface-2); color: var(--muted); }
.message.search-hidden { display: none; }
.message.search-hit .bubble { outline: 2px solid color-mix(in srgb,var(--primary) 55%,transparent); outline-offset: 2px; }
.message-bookmark-mark { display: inline-flex; align-items: center; gap: 3px; margin-bottom: 3px; color: #d89200; font-size: .53rem; font-weight: 900; }
.message-bookmark-mark svg { width: 12px; height: 12px; fill: currentColor; }
.message-text a { color: var(--primary); text-decoration: underline; text-underline-offset: 2px; }
.message-text code { direction: ltr; display: inline-block; max-width: 100%; padding: 2px 5px; border-radius: 6px; background: color-mix(in srgb,var(--text) 9%,transparent); font-family: monospace; }
.message-text strong { font-weight: 900; }
.message-text em { font-style: italic; }
.reply-banner { border-right-color: #6c63ff; }
.reply-gradient { background: linear-gradient(135deg,#625be7,#8f79f2); }
.copy-gradient { background: linear-gradient(135deg,#168fd0,#23b7ad); }
.star-gradient { background: linear-gradient(135deg,#e4a11a,#f5c34b); }
.archive-gradient { background: linear-gradient(135deg,#607d8b,#8096a2); }
.bookmark-list { display: grid; gap: 9px; margin-top: 12px; }
.bookmark-card { width: 100%; border: 1px solid var(--line); border-radius: 17px; padding: 11px; background: var(--surface-2); text-align: right; }
.bookmark-card b, .bookmark-card small, .bookmark-card p { display: block; }
.bookmark-card b { font-size: .75rem; color: var(--primary); }
.bookmark-card p { margin: 5px 0; color: var(--text); white-space: pre-wrap; line-height: 1.65; font-size: .73rem; }
.bookmark-card small { color: var(--muted); font-size: .6rem; }
.bookmark-card-actions { display: flex; gap: 6px; margin-top: 8px; }
.bookmark-card-actions button { min-height: 32px; border: 0; border-radius: 10px; padding: 5px 9px; color: var(--primary); background: var(--primary-soft); font-size: .62rem; font-weight: 800; }
.connection-result { margin-top: 8px; padding: 9px; border-radius: 13px; background: var(--surface-2); color: var(--muted); font-size: .68rem; line-height: 1.7; }
@keyframes chatSearchIn { from { opacity: 0; transform: translateY(-8px); } }


/* 3.4.1 hotfix: login scrolling + stable compose button */
.login-screen {
  position: fixed !important;
  inset: 0 !important;
  width: 100% !important;
  height: 100% !important;
  min-height: 0 !important;
  display: block !important;
  overflow-y: scroll !important;
  overflow-x: hidden !important;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-y: auto;
  touch-action: pan-y;
  padding-top: calc(22px + env(safe-area-inset-top)) !important;
  padding-bottom: calc(44px + env(safe-area-inset-bottom)) !important;
}
.login-screen.hidden { display: none !important; }
.login-shell {
  width: min(100%, 420px);
  margin: 0 auto !important;
  padding-bottom: 28px;
}
.login-screen::-webkit-scrollbar { width: 0; height: 0; }
.fab {
  z-index: 40 !important;
  animation: none !important;
  transform: none !important;
  left: 18px !important;
  bottom: calc(var(--nav-height) + 18px + env(safe-area-inset-bottom)) !important;
  will-change: auto;
}
.fab:active { transform: scale(.97) !important; }
@media (min-height: 900px) {
  .login-shell { padding-top: 10px; }
}


/* 3.4.2 UI stability and visual polish */
.fab {
  position: fixed !important;
  left: max(18px, env(safe-area-inset-left)) !important;
  right: auto !important;
  bottom: calc(var(--nav-height) + 20px + env(safe-area-inset-bottom)) !important;
  width: 58px !important; height: 58px !important;
  border-radius: 19px !important;
  z-index: 120 !important;
  overflow: hidden;
  animation: none !important;
  transform: translate3d(0,0,0) !important;
  transition: transform .16s ease, box-shadow .2s ease, opacity .2s ease !important;
  box-shadow: 0 14px 34px color-mix(in srgb,var(--primary) 42%,transparent), inset 0 1px 0 rgba(255,255,255,.28) !important;
}
.fab.hidden { display: none !important; }
.fab .fab-glow { position:absolute; inset:-30% 35% 40% -25%; border-radius:50%; background:rgba(255,255,255,.24); transform:rotate(-20deg); pointer-events:none; }
.fab svg { position:relative; z-index:1; width:25px; height:25px; stroke-width:2.15; }
.fab:active { transform:scale(.94) !important; }
.settings-intro { position:relative; align-items:center; }
.settings-saved-badge { margin-inline-start:auto; flex:none; padding:5px 8px; border-radius:99px; background:var(--surface); color:var(--muted); border:1px solid var(--line); font-size:.54rem; font-weight:800; transition:.22s ease; }
.settings-saved-badge.show { color:var(--success); border-color:color-mix(in srgb,var(--success) 35%,var(--line)); background:color-mix(in srgb,var(--success) 10%,var(--surface)); transform:scale(1.04); }
.settings-group { border-radius:24px; box-shadow:0 10px 30px rgba(0,0,0,.08); }
.setting-row, .plain-row { min-height:58px; border-radius:16px; padding-inline:6px; transition:background .18s ease, transform .16s ease; }
.setting-row:active, .plain-row:active { background:var(--surface-2); transform:scale(.99); }
.setting-icon { border-radius:13px; background:linear-gradient(145deg,var(--primary-soft),color-mix(in srgb,var(--primary-soft) 65%,var(--surface))); box-shadow:inset 0 0 0 1px color-mix(in srgb,var(--primary) 10%,transparent); }
.setting-icon svg { stroke-width:1.9; }
.bottom-nav { box-shadow:0 -10px 30px rgba(0,0,0,.12); }
.bottom-nav button { border-radius:18px; }
.nav-icon { width:48px; height:38px; border-radius:15px; }
.bottom-nav button.active .nav-icon { background:linear-gradient(145deg,var(--primary-soft),color-mix(in srgb,var(--primary-soft) 55%,var(--surface))); box-shadow:inset 0 0 0 1px color-mix(in srgb,var(--primary) 15%,transparent); }
.bottom-nav button.active .nav-icon svg { stroke-width:2.15; }
.profile-color-label { display:flex; flex-direction:column; gap:2px; }
.profile-color-label small { color:var(--muted); font-size:.61rem; font-weight:500; }
.profile-color-preview { display:flex; align-items:center; gap:9px; margin-top:10px; padding:9px 11px; border-radius:14px; background:var(--surface-2); color:var(--muted); font-size:.64rem; }
.profile-color-preview i { width:26px; height:26px; border-radius:9px; background:var(--profile-accent,#168fd0); box-shadow:0 5px 14px color-mix(in srgb,var(--profile-accent,#168fd0) 35%,transparent); }
.color-choices { gap:10px; padding:3px 2px 6px; }
.color-choice { width:39px; height:39px; border:4px solid var(--surface); transition:transform .18s ease,box-shadow .18s ease; }
.color-choice.selected { transform:scale(1.14); box-shadow:0 0 0 3px var(--surface),0 0 0 5px currentColor,0 8px 20px color-mix(in srgb,currentColor 38%,transparent); }
.font-family-options button[data-font-family="modern"] { font-family:system-ui,-apple-system,"Segoe UI",sans-serif; }
.font-family-options button[data-font-family="readable"] { font-family:Arial,sans-serif; }
.font-family-options button[data-font-family="classic"] { font-family:Tahoma,Arial,sans-serif; }
@media (max-width:390px){ .theme-choices{grid-template-columns:repeat(5,64px)} .settings-saved-badge{display:none} }
