/* ==========================================================================
   KraaSpace — style.css
   Token → base → komponen → halaman → responsive. Tema light/dark via [data-theme].
   Satu font family: Plus Jakarta Sans. Semua icon = SVG (currentColor).
   ========================================================================== */

:root {
  --font: "Plus Jakarta Sans", system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --accent: #6C5CFF;
  --accent-strong: #5646E6;
  --accent-soft: rgba(108, 92, 255, .11);
  --accent-2: #FF5D8F;
  --like: #FF3B6B;
  --danger: #E5384F;
  --success: #12A37A;
  --bg: #F5F5FA;
  --surface: #FFFFFF;
  --surface-2: #EFEFF6;
  --border: #E4E4EE;
  --text: #15151F;
  --text-2: #5A5A70;
  --text-3: #8A8AA0;
  --bubble-me: #6C5CFF;
  --bubble-them: #FFFFFF;
  --shadow: 0 1px 2px rgba(22, 22, 48, .04), 0 10px 30px rgba(22, 22, 48, .06);
  --shadow-lg: 0 24px 60px rgba(14, 14, 40, .22);
  --r-sm: 10px; --r-md: 14px; --r-lg: 20px; --r-xl: 26px;
  --ico: 20px;
  --top-h: 56px; --nav-h: 60px;
  --side-w: 244px;
  --safe-t: env(safe-area-inset-top, 0px);
  --safe-b: env(safe-area-inset-bottom, 0px);
  --ring: linear-gradient(45deg, #FFB020, #FF5D8F 52%, #7C5CFF);
  color-scheme: light;
}
[data-theme="dark"] {
  --accent: #8E80FF;
  --accent-strong: #A398FF;
  --accent-soft: rgba(142, 128, 255, .16);
  --bg: #0D0E13;
  --surface: #16171F;
  --surface-2: #1F212C;
  --border: #272936;
  --text: #F2F2F8;
  --text-2: #A8A9BD;
  --text-3: #7D7F95;
  --bubble-me: #6A5AF0;
  --bubble-them: #1F212C;
  --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 12px 32px rgba(0, 0, 0, .35);
  --shadow-lg: 0 24px 60px rgba(0, 0, 0, .6);
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; font-family: var(--font); font-size: 15px; line-height: 1.45;
  background: var(--bg); color: var(--text);
  -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility;
  overflow-x: hidden;
}
body.no-scroll { overflow: hidden; }
h1, h2, h3, p { margin: 0; }
h1, h2, h3 { letter-spacing: -.015em; line-height: 1.2; }
a { color: inherit; text-decoration: none; }
button, input, textarea, select { font: inherit; color: inherit; }
button { background: none; border: 0; padding: 0; cursor: pointer; -webkit-tap-highlight-color: transparent; }
button:disabled { cursor: not-allowed; }
img, video, svg { max-width: 100%; }
ul { margin: 0; padding: 0; list-style: none; }
time { font-variant-numeric: tabular-nums; }
::selection { background: var(--accent-soft); }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 8px; }
:focus:not(:focus-visible) { outline: none; }

.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.muted { color: var(--text-3); }
.hint { color: var(--text-3); font-size: 13px; }
.pad { padding: 16px; }
.center { display: grid; place-items: center; }
.spacer, .grow { flex: 1; }
.right { align-self: flex-end; }
.only-mobile { display: none; }

.ico { width: var(--ico); height: var(--ico); flex: none; display: inline-block; vertical-align: middle; }
.rx-ico { flex: none; display: block; }
.spin { animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes fade { from { opacity: 0; } }
@keyframes rise { from { opacity: 0; transform: translateY(14px) scale(.98); } }
@keyframes sheet-up { from { transform: translateY(100%); } }
@keyframes pop { 0% { transform: scale(.6); } 50% { transform: scale(1.3); } 100% { transform: scale(1); } }
@keyframes big-heart { 0% { opacity: 0; transform: translate(-50%, -50%) scale(.3); } 25% { opacity: 1; transform: translate(-50%, -50%) scale(1.15); } 60% { transform: translate(-50%, -50%) scale(.95); } 100% { opacity: 0; transform: translate(-50%, -60%) scale(1.05); } }
@keyframes shimmer { 0% { background-position: 100% 0; } 100% { background-position: 0 0; } }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: .35; } }
@keyframes blink { 0%, 60%, 100% { opacity: .25; } 30% { opacity: 1; } }

/* ------------------------------------------------------------------ buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 40px; padding: 0 18px; border-radius: 999px; font-weight: 700; font-size: 14px;
  background: var(--surface-2); color: var(--text); white-space: nowrap; position: relative;
  transition: background .15s, transform .1s, opacity .15s, box-shadow .15s;
}
.btn:hover { background: var(--border); }
.btn:active { transform: scale(.97); }
.btn:disabled { opacity: .55; }
.btn-sm { height: 34px; padding: 0 14px; font-size: 13px; }
.btn-md { height: 40px; padding: 0 22px; }
.btn-lg { height: 48px; font-size: 15px; }
.btn-block { width: 100%; }
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-strong); }
.btn-ghost { background: transparent; border: 1px solid var(--border); }
.btn-ghost:hover { background: var(--surface-2); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { background: #c92c42; }
.btn-danger-ghost { background: transparent; border: 1px solid color-mix(in srgb, var(--danger) 35%, transparent); color: var(--danger); }
.btn-danger-ghost:hover { background: color-mix(in srgb, var(--danger) 10%, transparent); }
.follow-btn { background: var(--accent); color: #fff; min-width: 92px; }
.follow-btn:hover { background: var(--accent-strong); }
.follow-btn.is-following { background: var(--surface-2); color: var(--text); }
.follow-btn.is-following:hover { background: var(--border); }
.link-btn { color: var(--text-3); font-weight: 600; font-size: 13px; }
.link-btn:hover { color: var(--text); }

.icon-btn {
  display: inline-grid; place-items: center; width: 40px; height: 40px; border-radius: 50%;
  color: var(--text-2); position: relative; transition: background .15s, color .15s, transform .1s;
}
.icon-btn:hover { background: var(--surface-2); color: var(--text); }
.icon-btn:active { transform: scale(.92); }
.btn-outline { border: 1px solid var(--border); }
.icon-btn.has-badge .badge { position: absolute; top: 2px; right: 2px; }

.send-btn {
  width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center; flex: none;
  background: var(--accent); color: #fff; transition: transform .1s, background .15s; position: relative;
}
.send-btn:hover { background: var(--accent-strong); }
.send-btn:active { transform: scale(.92); }
.mic-btn { background: var(--surface-2); color: var(--text-2); touch-action: none; user-select: none; -webkit-user-select: none; }
.mic-btn:hover { background: var(--accent-soft); color: var(--accent); }

.banner-btn { display: flex; align-items: center; gap: 10px; width: calc(100% - 32px); margin: 0 16px 8px; padding: 12px 14px; border-radius: var(--r-md); background: var(--accent-soft); color: var(--accent); font-weight: 600; font-size: 13px; text-align: left; }

/* tooltip (desktop, hanya untuk tombol ikon) */
@media (hover: hover) {
  .icon-btn[data-tip]:hover::after, .act[data-tip]:hover::after, .send-btn[data-tip]:hover::after {
    content: attr(data-tip); position: absolute; top: calc(100% + 6px); left: 50%; transform: translateX(-50%);
    background: var(--text); color: var(--bg); font-size: 12px; font-weight: 600; padding: 4px 9px; border-radius: 8px;
    white-space: nowrap; pointer-events: none; z-index: 60;
  }
  .side-item[data-tip]:hover::after {
    content: attr(data-tip); position: absolute; left: calc(100% + 10px); top: 50%; transform: translateY(-50%);
    background: var(--text); color: var(--bg); font-size: 12px; font-weight: 600; padding: 4px 9px; border-radius: 8px;
    white-space: nowrap; pointer-events: none; z-index: 60; display: none;
  }
  .modal [data-tip]::after { display: none !important; }
}

/* ------------------------------------------------------------------ forms */
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.field > span, .field > label { font-size: 13px; font-weight: 700; color: var(--text-2); }
.field em { font-style: normal; font-weight: 500; color: var(--text-3); }
.field input, .field textarea, .input-ic input {
  width: 100%; background: var(--surface-2); border: 1.5px solid transparent; border-radius: var(--r-md);
  padding: 12px 14px; outline: none; transition: border-color .15s, background .15s;
}
.field textarea { resize: vertical; min-height: 84px; }
.field input:focus, .field textarea:focus, .input-ic:focus-within { border-color: var(--accent); background: var(--surface); }
.field input:disabled { opacity: .6; }
.field.with-icon { position: relative; flex-direction: row; align-items: center; background: var(--surface-2); border-radius: var(--r-md); padding-left: 14px; color: var(--text-3); }
.field.with-icon input { background: transparent; border: 0; }
.input-ic { display: flex; align-items: center; gap: 10px; background: var(--surface-2); border: 1.5px solid transparent; border-radius: var(--r-md); padding: 0 6px 0 14px; color: var(--text-3); transition: border-color .15s, background .15s; }
.input-ic input { background: transparent; border: 0; padding: 13px 4px; }
.input-ic input:focus { background: transparent; }
.input-ic.invalid { border-color: var(--danger); }
.eye { width: 40px; height: 40px; display: grid; place-items: center; border-radius: 50%; color: var(--text-3); flex: none; }
.eye:hover { color: var(--text); background: var(--border); }
.eye .e-off { display: none; }
.eye.on .e-on { display: none; }
.eye.on .e-off { display: inline-flex; }
.field-err, .err-text, .form-err { color: var(--danger); font-size: 13px; font-weight: 600; }
.form-err { background: color-mix(in srgb, var(--danger) 10%, transparent); padding: 10px 14px; border-radius: var(--r-sm); margin-bottom: 14px; }
.counter { text-align: right; }
input[type="search"]::-webkit-search-cancel-button { display: none; }

.search-field { flex: 1; display: flex; align-items: center; gap: 10px; background: var(--surface-2); border-radius: 999px; padding: 0 16px; color: var(--text-3); height: 44px; }
.search-field input { flex: 1; min-width: 0; background: none; border: 0; outline: none; color: var(--text); }
.search-field.small { margin: 0 16px 8px; }

.seg { display: flex; background: var(--surface-2); border-radius: 999px; padding: 4px; gap: 4px; margin-bottom: 20px; }
.seg-btn { flex: 1; height: 38px; border-radius: 999px; font-weight: 700; font-size: 14px; color: var(--text-2); display: inline-flex; align-items: center; justify-content: center; gap: 8px; transition: background .15s, color .15s; }
.seg-btn.active { background: var(--surface); color: var(--text); box-shadow: 0 1px 4px rgba(20, 20, 40, .12); }

/* ------------------------------------------------------------------ avatar / skeleton */
.av { --s: 40px; width: var(--s); height: var(--s); border-radius: 50%; overflow: hidden; flex: none; display: inline-grid; place-items: center; background: var(--surface-2); position: relative; vertical-align: middle; }
.av img { width: 100%; height: 100%; object-fit: cover; display: block; }
.av-init { background: var(--c, var(--accent)); color: #fff; font-weight: 700; font-size: calc(var(--s) * .38); letter-spacing: .02em; user-select: none; }
.av-ring { box-shadow: 0 0 0 3px var(--bg), 0 0 0 5px var(--border); }
.skel, .skel-line, .skel-media, .skel-row {
  background: linear-gradient(90deg, var(--surface-2) 25%, var(--border) 37%, var(--surface-2) 63%);
  background-size: 400% 100%; animation: shimmer 1.4s ease infinite;
}
.skel-line { display: block; height: 12px; border-radius: 6px; width: 100%; margin: 8px 0; }
.skel-line.w40 { width: 40%; } .skel-line.w60 { width: 60%; }
.skel-media { aspect-ratio: 4 / 5; border-radius: var(--r-md); margin: 12px 0; }
.skel-head { display: flex; align-items: center; gap: 12px; }
.skel-row { height: 56px; border-radius: var(--r-md); margin: 8px 16px; }
.tile.skel { border-radius: 4px; }

/* ------------------------------------------------------------------ splash / fatal / offline */
.splash { position: fixed; inset: 0; z-index: 2000; background: var(--bg); display: grid; place-items: center; transition: opacity .3s; }
.splash.hide { opacity: 0; pointer-events: none; }
.splash-mark { animation: pulse 1.4s ease infinite; }
body.booting .app, body.booting .auth { visibility: hidden; }
.fatal { position: fixed; inset: 0; z-index: 2100; display: grid; place-items: center; background: var(--bg); padding: 24px; }
.fatal-card { max-width: 380px; text-align: center; display: flex; flex-direction: column; gap: 12px; align-items: center; }
.fatal-card p { color: var(--text-2); }
.net-banner { position: fixed; left: 50%; bottom: calc(var(--nav-h) + var(--safe-b) + 14px); transform: translateX(-50%); z-index: 1400; display: flex; gap: 8px; align-items: center; background: var(--text); color: var(--bg); padding: 10px 16px; border-radius: 999px; font-size: 13px; font-weight: 600; box-shadow: var(--shadow-lg); max-width: 92vw; }
@media (min-width: 768px) { .net-banner { bottom: 20px; } }

/* ------------------------------------------------------------------ empty state */
.empty { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 8px; padding: 40px 24px; color: var(--text-2); }
.empty h3 { color: var(--text); font-size: 17px; }
.empty p { max-width: 320px; font-size: 14px; }
.empty .btn { margin-top: 10px; }
.illo { margin-bottom: 8px; }
.il-a { fill: var(--accent-soft); }
.il-b { fill: var(--surface); stroke: var(--border); stroke-width: 2; }
.il-c { fill: var(--accent); }
.il-s { stroke: var(--accent); }
.end-note { color: var(--text-3); font-size: 13px; text-align: center; padding: 20px; }
.sentinel { min-height: 40px; display: grid; place-items: center; color: var(--accent); padding: 10px 0 30px; }

/* ------------------------------------------------------------------ shell */
.app { display: grid; grid-template-columns: var(--side-w) minmax(0, 1fr); min-height: 100dvh; }
.sidebar { position: sticky; top: 0; height: 100dvh; padding: 20px 12px; display: flex; flex-direction: column; border-right: 1px solid var(--border); background: var(--bg); z-index: 20; }
.brand { display: flex; align-items: center; gap: 10px; }
.sidebar .brand { padding: 4px 10px 22px; }
.brand-name { font-weight: 800; font-size: 22px; letter-spacing: -.03em; }
.side-nav { display: flex; flex-direction: column; gap: 4px; }
.side-item { display: flex; align-items: center; gap: 14px; height: 48px; padding: 0 14px; border-radius: 14px; font-weight: 600; font-size: 15px; color: var(--text-2); position: relative; transition: background .15s, color .15s; text-align: left; width: 100%; }
.side-item:hover { background: var(--surface-2); color: var(--text); }
.side-item.active { color: var(--accent); background: var(--accent-soft); }
.side-item .badge { position: absolute; left: 28px; top: 5px; }
.side-foot { margin-top: auto; display: flex; flex-direction: column; gap: 4px; }
.th-sun, .th-moon { display: inline-flex; }
.th-sun { display: none; }
[data-theme="dark"] .th-sun { display: inline-flex; }
[data-theme="dark"] .th-moon { display: none; }
.badge { min-width: 18px; height: 18px; padding: 0 5px; border-radius: 999px; background: var(--danger); color: #fff; font-size: 11px; font-weight: 700; display: grid; place-items: center; line-height: 1; border: 2px solid var(--bg); box-sizing: content-box; }
.main { min-width: 0; }
.topbar, .bottomnav { display: none; }

@media (min-width: 768px) and (max-width: 1099px) { :root { --side-w: 76px; } }
@media (min-width: 768px) { body.rail { --side-w: 76px; } }
@media (min-width: 768px) and (max-width: 1099px) {
  .sidebar { padding: 20px 10px; align-items: center; }
  .sidebar .label, .sidebar .brand-name { display: none; }
  .sidebar .brand { padding: 4px 0 22px; }
  .side-item { justify-content: center; padding: 0; width: 52px; height: 52px; }
  .side-item .badge { left: 28px; }
  .side-item[data-tip]:hover::after { display: block; }
}
@media (min-width: 768px) {
  body.rail .sidebar { padding: 20px 10px; align-items: center; }
  body.rail .sidebar .label, body.rail .sidebar .brand-name { display: none; }
  body.rail .sidebar .brand { padding: 4px 0 22px; }
  body.rail .side-item { justify-content: center; padding: 0; width: 52px; height: 52px; }
  body.rail .side-item[data-tip]:hover::after { display: block; }
}

@media (max-width: 767px) {
  :root { --ico: 22px; }
  .app { display: block; }
  .sidebar { display: none; }
  .topbar { display: flex; align-items: center; justify-content: space-between; position: fixed; top: 0; left: 0; right: 0; z-index: 40; height: calc(var(--top-h) + var(--safe-t)); padding: var(--safe-t) 14px 0; background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); border-bottom: 1px solid var(--border); }
  .top-actions { display: flex; align-items: center; gap: 2px; }
  .icon-btn { width: 44px; height: 44px; }
  .bottomnav { display: grid; grid-template-columns: repeat(5, 1fr); align-items: center; position: fixed; left: 0; right: 0; bottom: 0; z-index: 40; height: calc(var(--nav-h) + var(--safe-b)); padding: 0 6px var(--safe-b); background: color-mix(in srgb, var(--surface) 92%, transparent); backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px); border-top: 1px solid var(--border); }
  .bn-item { display: grid; place-items: center; height: 48px; min-width: 44px; color: var(--text-3); position: relative; border-radius: 14px; }
  .bn-item.active { color: var(--accent); }
  .bn-item.active .ico { stroke-width: 2.4; }
  .bn-item .badge { position: absolute; top: 4px; left: calc(50% + 6px); }
  .bn-create { width: 52px; height: 40px; margin: 0 auto; border-radius: 14px; background: var(--accent); color: #fff; box-shadow: 0 6px 16px color-mix(in srgb, var(--accent) 45%, transparent); }
  .bn-create .ico { stroke-width: 2.4; }
  .bn-item .av { box-shadow: 0 0 0 2px transparent; }
  .bn-item.active .av { box-shadow: 0 0 0 2px var(--accent); }
  .main { padding: calc(var(--top-h) + var(--safe-t)) 0 calc(var(--nav-h) + var(--safe-b)); }
  .only-mobile { display: inline-grid; }
  .hide-sm { display: none; }
}

/* ------------------------------------------------------------------ overlays */
#overlay-root { position: relative; }
.modal-backdrop { position: fixed; inset: 0; z-index: 1000; display: grid; place-items: center; background: rgba(9, 9, 20, .55); backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px); animation: fade .18s; padding: 16px; }
.modal-backdrop.closing { opacity: 0; transition: opacity .18s; }
.modal { background: var(--surface); color: var(--text); border-radius: var(--r-xl); width: min(480px, 100%); max-height: min(92dvh, 860px); overflow: auto; box-shadow: var(--shadow-lg); animation: rise .22s cubic-bezier(.2, .8, .2, 1); position: relative; }
.modal-sm { width: min(420px, 100%); }
.modal-md { width: min(520px, 100%); }
.modal-lg { width: min(600px, 100%); }
.modal-top { align-self: start; margin-top: 7vh; }
.modal-loading { display: grid; place-items: center; padding: 60px; color: var(--accent); }
.modal-drawer { width: min(440px, 100%); height: 100dvh; max-height: none; border-radius: 0; margin-left: auto; padding-bottom: 20px; }
.modal-backdrop:has(.modal-drawer) { padding: 0; place-items: stretch end; }
.sheet-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 18px 20px 12px; position: sticky; top: 0; background: var(--surface); z-index: 2; }
.sheet-head h2 { font-size: 20px; }
.sheet-head-actions { display: flex; align-items: center; gap: 4px; }
.dlg { padding: 24px; display: flex; flex-direction: column; gap: 8px; }
.dlg h3 { font-size: 18px; }
.dlg p { color: var(--text-2); }
.dlg-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 16px; }

@media (max-width: 640px) {
  .modal-backdrop { place-items: end center; padding: 0; }
  .modal, .modal-sm, .modal-md, .modal-lg { width: 100%; border-radius: 26px 26px 0 0; max-height: 92dvh; animation: sheet-up .28s cubic-bezier(.2, .8, .2, 1); padding-bottom: var(--safe-b); }
  .modal-top { align-self: end; margin: 0; height: 92dvh; }
  .modal-drawer { height: 100dvh; max-height: none; border-radius: 0; }
  .modal-backdrop:has(.modal-drawer) { place-items: stretch; }
  .dlg { padding-bottom: 20px; }
}

#toast-root { position: fixed; z-index: 1500; top: calc(14px + var(--safe-t)); left: 50%; transform: translateX(-50%); display: flex; flex-direction: column; gap: 8px; align-items: center; width: min(440px, 92vw); pointer-events: none; }
.toast { display: flex; align-items: center; gap: 10px; background: var(--text); color: var(--bg); padding: 12px 16px; border-radius: 16px; font-size: 14px; font-weight: 600; box-shadow: var(--shadow-lg); animation: rise .24s; pointer-events: auto; max-width: 100%; }
.toast span { overflow-wrap: anywhere; }
.toast-error { background: var(--danger); color: #fff; }
.toast-success { background: var(--success); color: #fff; }
.toast.out { opacity: 0; transform: translateY(-8px); transition: .25s; }

.menu-backdrop { position: fixed; inset: 0; z-index: 1199; }
.menu { position: fixed; z-index: 1200; min-width: 230px; background: var(--surface); border: 1px solid var(--border); border-radius: 18px; box-shadow: var(--shadow-lg); padding: 6px; animation: rise .14s; }
.menu-item { display: flex; align-items: center; gap: 12px; width: 100%; padding: 11px 12px; border-radius: 12px; font-weight: 600; font-size: 14px; text-align: left; }
.menu-item:hover, .menu-item:focus-visible { background: var(--surface-2); }
.menu-item.danger { color: var(--danger); }
.menu-head { padding: 4px 4px 6px; border-bottom: 1px solid var(--border); margin-bottom: 4px; }
.rx-pick { display: flex; justify-content: space-between; gap: 2px; }
.rx-btn { width: 44px; height: 44px; display: grid; place-items: center; border-radius: 50%; transition: transform .12s, background .15s; }
.rx-btn:hover { transform: scale(1.22); }
.rx-btn.on { background: var(--accent-soft); }
@media (max-width: 640px) {
  .menu { left: 0 !important; right: 0; top: auto !important; bottom: 0; min-width: 0; border-radius: 26px 26px 0 0; border: 0; padding: 12px 12px calc(12px + var(--safe-b)); animation: sheet-up .25s cubic-bezier(.2, .8, .2, 1); }
  .menu-backdrop { background: rgba(9, 9, 20, .45); }
  .menu-item { padding: 15px 14px; font-size: 15px; }
  .rx-btn { width: 52px; height: 52px; }
}

/* ------------------------------------------------------------------ home */
.home { display: flex; justify-content: center; gap: 36px; padding: 24px 24px 60px; }
.feed-col { width: min(600px, 100%); min-width: 0; }
.side-col { display: none; width: 310px; position: sticky; top: 24px; align-self: flex-start; }
@media (min-width: 1100px) { .side-col { display: block; } }
.me-card { padding: 4px 0 18px; }
.side-title { font-size: 14px; color: var(--text-2); margin: 6px 0 8px; font-weight: 700; }
.side-note { color: var(--text-3); font-size: 12px; margin-top: 24px; }
.urow { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 8px 0; }
.urow-main { display: flex; align-items: center; gap: 12px; min-width: 0; flex: 1; }
.urow-main > span:last-child { display: flex; flex-direction: column; min-width: 0; }
.urow-main b, .urow-main small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.urow-main small { color: var(--text-3); font-size: 13px; }
.urow-actions { display: flex; gap: 8px; flex: none; }
.sheet-head + .list-body, .list-body, .fw-list, .viewers-list, .search-results { padding: 0 20px 20px; }
.fw-list { max-height: 50vh; overflow: auto; }
.sr-title, .conv-sec { font-size: 13px; font-weight: 700; color: var(--text-3); margin: 6px 0; }

.new-pill { position: fixed; top: calc(76px + var(--safe-t)); left: 50%; transform: translateX(-50%); z-index: 30; display: inline-flex; align-items: center; gap: 6px; padding: 9px 16px; border-radius: 999px; background: var(--accent); color: #fff; font-weight: 700; font-size: 13px; box-shadow: var(--shadow-lg); animation: rise .25s; }
@media (min-width: 768px) { .new-pill { top: 24px; } }

/* stories */
.stories { display: flex; flex-wrap: nowrap; gap: 14px; overflow-x: auto; padding: 4px 4px 16px; scroll-snap-type: x proximity; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
.stories::-webkit-scrollbar { display: none; }
.story { flex: 0 0 auto; display: flex; flex-direction: column; align-items: center; gap: 6px; width: 76px; max-width: 76px; position: relative; scroll-snap-align: start; }
.story-ring { display: inline-flex; flex: none; width: 72px; height: 72px; padding: 3px; border-radius: 50%; background: var(--border); transition: transform .15s; box-sizing: border-box; aspect-ratio: 1 / 1; }
.story:hover .story-ring { transform: scale(1.04); }
.story .story-ring .av { width: 60px !important; height: 60px !important; aspect-ratio: 1 / 1; border: 3px solid var(--bg); box-sizing: content-box; flex: none; }
.story .story-ring .av img { width: 100%; height: 100%; object-fit: cover; aspect-ratio: 1 / 1; }
.story.ring.live .story-ring { background: var(--ring); }
.story.own:not(.ring) .story-ring { background: transparent; border: 2px dashed var(--border); }
.story-plus { position: absolute; top: 44px; right: 2px; width: 24px; height: 24px; border-radius: 50%; background: var(--accent); color: #fff; border: 3px solid var(--bg); display: grid; place-items: center; box-sizing: content-box; }
.story-plus .ico { --ico: 14px; }
.story-name { font-size: 12px; font-weight: 600; color: var(--text-2); max-width: 76px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.story-name.skel-line { width: 44px; height: 10px; }
.story.ring.seen .story-name { color: var(--text-3); }

/* ------------------------------------------------------------------ post card */
.card { background: var(--surface); border-radius: var(--r-lg); box-shadow: var(--shadow); border: 1px solid var(--border); }
.feed { display: flex; flex-direction: column; gap: 20px; }
.post { overflow: hidden; }
.post-skel { padding: 16px; }
.post-head { display: flex; align-items: center; gap: 10px; padding: 12px 8px 12px 14px; }
.post-user { display: flex; align-items: center; gap: 12px; flex: 1; min-width: 0; }
.post-user .av { width: 38px !important; height: 38px !important; aspect-ratio: 1 / 1; flex: none; }
.post-meta { display: flex; flex-direction: column; min-width: 0; line-height: 1.25; }
.post-meta b { font-size: 14px; }
.post-meta small { color: var(--text-3); font-size: 12px; display: inline-flex; align-items: center; gap: 3px; }
.post-meta small .ico { --ico: 12px; }
.post-time { color: var(--text-3); font-size: 12px; font-weight: 600; }
.post-media { position: relative; background: var(--surface-2); aspect-ratio: 4 / 5; max-height: 660px; overflow: hidden; user-select: none; -webkit-user-select: none; }
.post-media > img { width: 100%; height: 100%; object-fit: cover; display: block; }
.pv { position: absolute; inset: 0; }
.pv video { width: 100%; height: 100%; object-fit: cover; display: block; background: #000; }
.pv-sound { position: absolute; right: 12px; bottom: 12px; width: 36px; height: 36px; border-radius: 50%; background: rgba(0, 0, 0, .55); color: #fff; display: grid; place-items: center; }
.pv-sound .s-on, .sv-mute .s-on { display: none; }
.pv-sound.on .s-on, .sv-mute.on .s-on { display: inline-flex; }
.pv-sound.on .s-off, .sv-mute.on .s-off { display: none; }
.big-heart { position: absolute; left: 50%; top: 50%; color: #fff; pointer-events: none; animation: big-heart .8s ease-out forwards; filter: drop-shadow(0 6px 18px rgba(0, 0, 0, .35)); }
.post-actions { display: flex; align-items: center; gap: 4px; padding: 8px 10px 0; }
.act { display: inline-flex; align-items: center; gap: 6px; height: 40px; min-width: 40px; padding: 0 8px; justify-content: center; border-radius: 12px; color: var(--text); position: relative; transition: transform .1s, color .15s; }
.act:hover { color: var(--accent); }
.act:active { transform: scale(.9); }
.act .ico { --ico: 24px; }
.act-n { font-size: 13px; font-weight: 700; }
.act .ico-on { display: none; }
[data-liked="1"] .act-like { color: var(--like); }
[data-liked="1"] .act-like .ico-off, [data-saved="1"] .act-save .ico-off { display: none; }
[data-liked="1"] .act-like .ico-on, [data-saved="1"] .act-save .ico-on { display: inline-flex; }
[data-saved="1"] .act-save { color: var(--accent); }
.pop .act-like .ico-on { animation: pop .45s ease; }
.post-body { padding: 4px 16px 16px; display: flex; flex-direction: column; gap: 4px; }
.post-likes { font-size: 14px; }
.post-caption { font-size: 14px; overflow-wrap: anywhere; }
.post-caption.clamp { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; cursor: pointer; }
.uname { font-weight: 700; }
.hashtag { color: var(--accent); font-weight: 600; }
.hashtag:hover { text-decoration: underline; }
.post-caption a:not(.uname), .cm a:not(.uname), .txt a { color: var(--accent); text-decoration: underline; }
.js-viewall { align-self: flex-start; }
.dot-sep::before { content: ""; display: inline-block; width: 3px; height: 3px; border-radius: 50%; background: var(--text-3); vertical-align: middle; margin: 0 4px; }

@media (max-width: 767px) {
  .home { padding: 8px 0 24px; }
  .stories { padding: 8px 14px 14px; }
  .card { border-radius: 0; border-left: 0; border-right: 0; box-shadow: none; }
  .feed { gap: 10px; }
  .post-media { max-height: none; }
}

/* ------------------------------------------------------------------ post modal */
.modal-post { width: min(1080px, 100%); height: min(88dvh, 760px); max-height: none; padding: 0; overflow: hidden; }
.pm { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(320px, .8fr); height: 100%; }
.pm-media { background: #000; display: grid; place-items: center; min-height: 0; position: relative; }
.pm-media > img, .pm-media .pv { max-width: 100%; max-height: 100%; }
.pm-media > img { object-fit: contain; }
.pm-media .pv { position: static; width: 100%; height: 100%; display: grid; place-items: center; }
.pm-media .pv video { object-fit: contain; max-height: 100%; }
.pm-side { display: flex; flex-direction: column; min-height: 0; border-left: 1px solid var(--border); }
.pm-head { display: flex; align-items: center; gap: 6px; padding: 12px 10px 12px 16px; border-bottom: 1px solid var(--border); }
.pm-scroll { flex: 1; overflow-y: auto; padding: 14px 16px; min-height: 0; }
.pm-side .post-actions { padding: 6px 10px 0; border-top: 1px solid var(--border); }
.pm-likes { padding: 0 16px 10px; font-size: 14px; }
.pm-input { display: flex; gap: 10px; padding: 10px 14px calc(12px + var(--safe-b)); border-top: 1px solid var(--border); }
.pm-input input { flex: 1; min-width: 0; background: var(--surface-2); border: 0; border-radius: 999px; padding: 0 16px; height: 40px; outline: none; }
.pm-input input:focus { box-shadow: 0 0 0 2px var(--accent); }
.comments { display: flex; flex-direction: column; gap: 14px; }
.cm { display: flex; gap: 10px; align-items: flex-start; }
.cm-caption { margin-bottom: 14px; }
.cm-body { min-width: 0; flex: 1; font-size: 14px; overflow-wrap: anywhere; }
.cm-meta { display: flex; gap: 12px; color: var(--text-3); font-size: 12px; font-weight: 600; margin-top: 2px; }
.cm-del { color: var(--text-3); font-weight: 700; font-size: 12px; }
.cm-del:hover { color: var(--danger); }
.cm-empty, .cm-loading { color: var(--text-3); text-align: center; padding: 24px 0; font-size: 14px; }
@media (max-width: 900px) {
  .modal-post { overflow: auto; }
  .pm { display: block; height: auto; }
  .pm-media { max-height: 56dvh; min-height: 240px; }
  .pm-side { border-left: 0; display: block; }
  .pm-scroll { overflow: visible; }
  .pm-input { position: sticky; bottom: 0; background: var(--surface); }
  .pm-head { position: sticky; top: 0; z-index: 3; background: var(--surface); }
}

/* ------------------------------------------------------------------ create / search / grid */
.drop { display: grid; place-items: center; min-height: 190px; margin: 0 20px 14px; border: 2px dashed var(--border); border-radius: var(--r-lg); background: var(--surface-2); cursor: pointer; text-align: center; position: relative; overflow: hidden; transition: border-color .15s, background .15s; }
.drop:hover, .drop.over { border-color: var(--accent); background: var(--accent-soft); }
.drop-inner { display: flex; flex-direction: column; align-items: center; gap: 6px; color: var(--text-2); padding: 20px; }
.drop-inner .ico { color: var(--accent); }
.drop-inner b { color: var(--text); }
.drop-inner small { color: var(--text-3); }
.drop-preview { position: absolute; inset: 0; background: #000; display: grid; place-items: center; }
.drop-preview img, .drop-preview video { max-width: 100%; max-height: 100%; object-fit: contain; }
.drop-clear { position: absolute; top: 10px; right: 10px; background: rgba(0, 0, 0, .6); color: #fff; }
.drop-clear:hover { background: rgba(0, 0, 0, .8); color: #fff; }
.create > .seg, .create > .field, .create > .cr-progress, .create > .btn, .create > .err-text { margin-left: 20px; margin-right: 20px; }
.create > .btn { width: calc(100% - 40px); margin-bottom: 20px; }
.create > .seg { margin-bottom: 14px; }
.cr-progress { height: 6px; border-radius: 99px; background: var(--surface-2); overflow: hidden; margin-bottom: 12px; }
.cr-progress i { display: block; height: 100%; width: 0; background: var(--ring); transition: width .2s; }
.search-sheet .sheet-head { padding-bottom: 10px; }
.search-results { min-height: 240px; max-height: 65dvh; overflow: auto; }
.hint.pad, .search-results .hint { padding: 4px 0; }

.grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; }
.grid.is-empty { display: block; }
.tile { position: relative; aspect-ratio: 1; overflow: hidden; background: var(--surface-2); border-radius: 6px; display: block; width: 100%; }
.tile img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform .3s; }
.tile:hover img { transform: scale(1.05); }
.tile-ph { display: grid; place-items: center; height: 100%; color: var(--text-3); }
.tile-badge { position: absolute; top: 8px; right: 8px; color: #fff; filter: drop-shadow(0 1px 3px rgba(0, 0, 0, .5)); }
.tile-over { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; gap: 18px; background: rgba(0, 0, 0, .42); color: #fff; font-weight: 700; font-size: 14px; opacity: 0; transition: opacity .15s; }
.tile-over span { display: inline-flex; align-items: center; gap: 6px; }
.tile:hover .tile-over, .tile:focus-visible .tile-over { opacity: 1; }
@media (hover: none) { .tile-over { display: none; } }
.search-results .grid { margin-top: 8px; }

/* notifications */
.notif-list { display: flex; flex-direction: column; padding: 0 8px; }
.notif { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: var(--r-md); text-align: left; width: 100%; transition: background .15s; }
.notif:hover { background: var(--surface-2); }
.notif.unread { background: var(--accent-soft); }
.notif-av { position: relative; flex: none; width: 44px; height: 44px; }
.notif-av .av { width: 44px !important; height: 44px !important; aspect-ratio: 1 / 1; }
.notif-type { position: absolute; right: -4px; bottom: -4px; width: 22px; height: 22px; border-radius: 50%; background: var(--accent); color: #fff; display: grid; place-items: center; border: 2px solid var(--surface); box-sizing: content-box; }
.notif-type .ico { --ico: 12px; }
.notif-text { flex: 1; min-width: 0; display: flex; flex-direction: column; font-size: 14px; }
.notif-text small { color: var(--text-3); }
.dot-unread { width: 9px; height: 9px; border-radius: 50%; background: var(--accent); flex: none; }

/* ------------------------------------------------------------------ profile */
.profile { max-width: 940px; margin: 0 auto; padding: 32px 20px 60px; }
.p-head { display: grid; grid-template-columns: auto minmax(0, 1fr); grid-template-areas: "avatar stats" "names names" "bio bio" "actions actions"; column-gap: 22px; row-gap: 12px; align-items: center; padding-bottom: 22px; }
.p-avatar { grid-area: avatar; padding: 0; }
.p-avatar .av { --s: 86px !important; }
.p-names { grid-area: names; min-width: 0; }
.p-name { font-size: 16px; font-weight: 800; letter-spacing: -.01em; overflow-wrap: anywhere; line-height: 1.25; }
.p-user { color: var(--text-3); font-weight: 500; font-size: 14px; }
.p-bio { grid-area: bio; white-space: pre-wrap; overflow-wrap: anywhere; font-size: 14px; line-height: 1.45; }
.p-actions { grid-area: actions; display: flex; align-items: stretch; gap: 8px; }
.p-actions > .btn, .p-actions > a.btn, .p-actions > button.btn { flex: 1 1 0; min-width: 0; justify-content: center; }
.p-actions .icon-btn { flex: none; width: 40px; height: 40px; }
.p-stats { grid-area: stats; display: flex; justify-content: space-around; gap: 6px; min-width: 0; }
.p-stats li, .stat { display: flex; flex-direction: column; align-items: center; gap: 1px; text-align: center; }
.p-stats b { font-size: 17px; font-weight: 800; line-height: 1.2; }
.p-stats span { color: var(--text-2); font-size: 13px; }
.p-stats li { padding: 0; }
.p-stats li:first-child { padding: 2px 4px; }
.stat { padding: 2px 4px; }
.stat { border-radius: 8px; font: inherit; line-height: 1.2; color: inherit; }
.p-stats li { line-height: 1.2; }
.stat:hover span { color: var(--text); }
@media (min-width: 768px) {
  .p-head { grid-template-columns: auto minmax(0, 1fr); grid-template-areas: "avatar names" "avatar stats" "avatar bio" "avatar actions"; grid-template-rows: auto auto auto 1fr; column-gap: 44px; row-gap: 14px; align-items: start; padding-bottom: 28px; }
  .p-actions { justify-content: flex-start; flex-wrap: wrap; }
  .p-avatar { padding: 6px; align-self: start; }
  .p-avatar .av { --s: 128px !important; }
  .p-name { font-size: 24px; }
  .p-user { font-size: 15px; }
  .p-bio { font-size: 15px; max-width: 60ch; }
  .p-actions > .btn, .p-actions > a.btn, .p-actions > button.btn { flex: none; }
  .p-stats { justify-content: flex-start; gap: 32px; }
  .p-stats li, .stat { flex-direction: row; align-items: baseline; gap: 6px; }
  .p-stats b { font-size: 18px; }
  .p-stats span { font-size: 15px; }
}
.tabs { display: flex; justify-content: center; gap: 8px; border-top: 1px solid var(--border); margin-bottom: 16px; }
.tab { display: inline-flex; align-items: center; gap: 8px; padding: 14px 22px; font-weight: 700; font-size: 13px; color: var(--text-3); border-top: 2px solid transparent; margin-top: -1px; }
.tab.active { color: var(--text); border-top-color: var(--text); }
.edit-body { padding: 4px 20px 20px; }
.edit-avatar { display: flex; align-items: center; gap: 16px; margin-bottom: 18px; }
.settings { padding: 0 20px 20px; display: flex; flex-direction: column; gap: 22px; }
.settings h3 { font-size: 13px; color: var(--text-3); margin-bottom: 10px; }
.settings section { display: flex; flex-direction: column; gap: 10px; align-items: flex-start; }
.settings .seg { width: 100%; margin: 0; }
.settings .btn { width: 100%; justify-content: flex-start; }
.set-row { display: flex; align-items: center; gap: 10px; color: var(--text-2); }
@media (max-width: 767px) {
  .profile { padding: 20px 16px 40px; }
  .p-actions .btn .ico { display: none; }
  .tabs { margin-left: -16px; margin-right: -16px; }
  .tab { flex: 1; justify-content: center; }
  .profile .grid { margin: 0 -16px; gap: 2px; }
  .profile .tile { border-radius: 0; }
}

/* ------------------------------------------------------------------ story viewer */
.sv { position: fixed; inset: 0; z-index: 900; background: #07070c; display: flex; align-items: center; justify-content: center; gap: 24px; animation: fade .2s; touch-action: manipulation; }
.sv-stage { position: relative; width: min(420px, 100vw); height: min(100dvh, 780px); background: #000; border-radius: 20px; overflow: hidden; user-select: none; -webkit-user-select: none; }
.sv-media { position: absolute; inset: 0; display: grid; place-items: center; }
.sv-media img, .sv-media video { width: 100%; height: 100%; object-fit: contain; display: block; }
.sv-stage::before, .sv-stage::after { content: ""; position: absolute; left: 0; right: 0; z-index: 2; pointer-events: none; }
.sv-stage::before { top: 0; height: 140px; background: linear-gradient(rgba(0, 0, 0, .55), transparent); }
.sv-stage::after { bottom: 0; height: 160px; background: linear-gradient(transparent, rgba(0, 0, 0, .6)); }
.sv-bars { position: absolute; top: calc(10px + var(--safe-t)); left: 10px; right: 10px; display: flex; gap: 4px; z-index: 5; }
.sv-bar { flex: 1; height: 3px; border-radius: 3px; background: rgba(255, 255, 255, .35); overflow: hidden; }
.sv-bar i { display: block; height: 100%; width: 0; background: #fff; }
.sv-head { position: absolute; top: calc(22px + var(--safe-t)); left: 10px; right: 6px; z-index: 5; display: flex; align-items: center; justify-content: space-between; color: #fff; }
.sv-user { display: flex; align-items: center; gap: 10px; min-width: 0; }
.sv-who { display: flex; flex-direction: column; line-height: 1.2; min-width: 0; }
.sv-who b { font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sv-who time { font-size: 12px; opacity: .8; }
.sv-tools { display: flex; }
.sv-btn { width: 44px; height: 44px; display: grid; place-items: center; color: #fff; border-radius: 50%; }
.sv-btn:hover { background: rgba(255, 255, 255, .16); }
.sv-caption { position: absolute; left: 16px; right: 16px; bottom: calc(70px + var(--safe-b)); z-index: 5; color: #fff; text-align: center; font-size: 15px; font-weight: 600; text-shadow: 0 1px 8px rgba(0, 0, 0, .6); overflow-wrap: anywhere; }
.sv-foot { position: absolute; left: 0; right: 0; bottom: calc(14px + var(--safe-b)); z-index: 5; display: flex; justify-content: center; }
.sv-viewers { display: inline-flex; align-items: center; gap: 8px; color: #fff; font-weight: 700; font-size: 14px; padding: 10px 18px; border-radius: 999px; background: rgba(255, 255, 255, .16); backdrop-filter: blur(8px); }
.sv-loading { display: none; position: absolute; inset: 0; place-items: center; color: #fff; z-index: 4; pointer-events: none; }
.sv-stage.loading .sv-loading { display: grid; }
.sv-stage.paused .sv-bars, .sv-stage.paused .sv-head { opacity: .0; transition: opacity .15s; }
.sv-arrow { width: 48px; height: 48px; border-radius: 50%; background: rgba(255, 255, 255, .14); color: #fff; display: grid; place-items: center; flex: none; }
.sv-arrow:hover { background: rgba(255, 255, 255, .26); }
@media (max-width: 640px) {
  .sv { gap: 0; }
  .sv-arrow { display: none; }
  .sv-stage { width: 100vw; height: 100dvh; border-radius: 0; }
}

/* ------------------------------------------------------------------ chat */
.page-chat .main { height: 100dvh; }
.chat { display: grid; grid-template-columns: 370px minmax(0, 1fr); height: 100%; min-height: 0; }
.conv-pane { display: flex; flex-direction: column; min-height: 0; border-right: 1px solid var(--border); background: var(--bg); }
.conv-head { padding: 22px 22px 8px; }
.conv-head h1 { font-size: 24px; font-weight: 800; letter-spacing: -.03em; }
.conv-search { display: flex; align-items: center; gap: 10px; margin: 8px 16px 10px; padding: 0 16px; height: 44px; border-radius: 999px; background: var(--surface-2); color: var(--text-3); }
.conv-search input { flex: 1; min-width: 0; background: none; border: 0; outline: none; color: var(--text); }
.conv-list { flex: 1; overflow-y: auto; padding: 0 8px 16px; }
.conv-sec { padding: 10px 14px 4px; }
.conv { display: flex; align-items: center; gap: 12px; width: 100%; padding: 10px 12px; border-radius: var(--r-md); text-align: left; transition: background .15s; }
.conv:hover { background: var(--surface-2); }
.conv.active { background: var(--accent-soft); }
.av-wrap { position: relative; flex: none; display: inline-flex; }
.dot-online { position: absolute; right: 1px; bottom: 1px; width: 13px; height: 13px; border-radius: 50%; background: var(--success); border: 3px solid var(--bg); box-sizing: content-box; }
.conv.active .dot-online { border-color: var(--surface); }
.conv-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.conv-top, .conv-bot { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.conv .name { font-size: 15px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.conv time { font-size: 12px; color: var(--text-3); flex: none; }
.conv .preview { display: flex; align-items: center; gap: 5px; color: var(--text-3); font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.conv.has-unread .preview, .conv.has-unread .name { color: var(--text); font-weight: 700; }
.conv.has-unread time { color: var(--accent); font-weight: 700; }
.unread { min-width: 20px; height: 20px; padding: 0 6px; border-radius: 999px; background: var(--accent); color: #fff; font-size: 12px; font-weight: 700; display: grid; place-items: center; flex: none; }

.thread-pane { display: flex; flex-direction: column; min-width: 0; min-height: 0; background: var(--bg); position: relative; }
.thread-empty { flex: 1; display: grid; place-items: center; }
.thread { flex: 1; display: flex; flex-direction: column; min-height: 0; position: relative; }
.thread-head { display: flex; align-items: center; gap: 8px; padding: 10px 12px; background: var(--surface); border-bottom: 1px solid var(--border); min-height: 64px; }
.thread-user { display: flex; align-items: center; gap: 12px; flex: 1; min-width: 0; }
#thread-av { position: relative; display: inline-flex; }
#thread-av.online::after { content: ""; position: absolute; right: 0; bottom: 0; width: 12px; height: 12px; border-radius: 50%; background: var(--success); border: 3px solid var(--surface); box-sizing: content-box; }
.thread-meta { display: flex; flex-direction: column; min-width: 0; line-height: 1.25; }
.thread-meta b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.thread-meta small { color: var(--text-3); font-size: 12px; font-weight: 600; }
.thread-meta small.is-online { color: var(--success); }
.thread-meta small.is-typing { color: var(--accent); }
.is-typing i { font-style: normal; animation: blink 1.2s infinite; }
.is-typing i:nth-child(2) { animation-delay: .2s; } .is-typing i:nth-child(3) { animation-delay: .4s; }
.thread-actions { display: flex; }
.msg-search { display: flex; align-items: center; gap: 6px; padding: 6px 12px; background: var(--surface); border-bottom: 1px solid var(--border); color: var(--text-3); }
.msg-search input { flex: 1; min-width: 0; background: none; border: 0; outline: none; padding: 8px 4px; color: var(--text); }
.msg-search small { font-size: 12px; font-weight: 600; white-space: nowrap; }

.msgs { flex: 1; overflow-y: auto; padding: 12px 16px 6px; min-height: 0; overscroll-behavior: contain; scroll-behavior: auto; }
.msgs-inner { display: flex; flex-direction: column; }
.msgs-top { text-align: center; }
.msgs-loading { display: grid; place-items: center; padding: 14px; color: var(--accent); }
.hello { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 36px 16px 20px; }
.hello p { color: var(--text-3); }
.day-sep { text-align: center; margin: 14px 0 8px; }
.day-sep span { display: inline-block; font-size: 12px; font-weight: 700; color: var(--text-3); background: var(--surface-2); padding: 4px 12px; border-radius: 999px; }
.msg { display: flex; align-items: flex-end; gap: 4px; margin-top: 10px; transition: opacity .2s; }
.msg.cont { margin-top: 2px; }
.msg.mine { justify-content: flex-end; }
.msg.mine .msg-more { order: -1; }
.msg.dim { opacity: .3; }
.msg.hit .bubble { box-shadow: 0 0 0 2px #FFB020; }
.msg.current .bubble { box-shadow: 0 0 0 3px var(--accent-2); }
.msg.flash .bubble { animation: pulse .5s 2; }
.bubble-wrap { max-width: min(78%, 520px); display: flex; flex-direction: column; min-width: 0; }
.msg.mine .bubble-wrap { align-items: flex-end; }
.fwd { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; font-style: italic; color: var(--text-3); margin: 0 6px 2px; }
.bubble { position: relative; padding: 8px 12px 6px; border-radius: 20px; background: var(--bubble-them); border: 1px solid var(--border); overflow-wrap: anywhere; word-break: break-word; min-width: 64px; -webkit-touch-callout: none; }
.msg.mine .bubble { background: var(--bubble-me); color: #fff; border-color: transparent; border-bottom-right-radius: 6px; }
.msg.theirs .bubble { border-bottom-left-radius: 6px; }
.msg.mine.cont .bubble { border-top-right-radius: 6px; }
.msg.theirs.cont .bubble { border-top-left-radius: 6px; }
.txt { white-space: pre-wrap; }
.msg.mine .txt a { color: #fff; }
.msg.mine .hashtag { color: #fff; text-decoration: underline; }
.meta { display: flex; justify-content: flex-end; align-items: center; gap: 4px; font-size: 11px; opacity: .72; margin-top: 2px; line-height: 1; }
.tick { display: inline-flex; }
.tick .ico { --ico: 15px; }
.msg.mine .tick.read { color: #8AF0FF; opacity: 1; }
.tick.pending .ico { --ico: 12px; }
.emoji-only { background: transparent !important; border-color: transparent !important; padding: 2px 4px; }
.emoji-only .txt { font-size: 40px; line-height: 1.15; }
.emoji-only .meta { color: var(--text-3); }
.unsent { display: inline-flex; align-items: center; gap: 6px; font-style: italic; opacity: .75; font-size: 14px; }
.bubble.t-deleted { background: transparent !important; border: 1px dashed var(--border) !important; color: var(--text-3) !important; }
.quote { display: flex; flex-direction: column; text-align: left; width: 100%; padding: 6px 10px; margin-bottom: 6px; border-left: 3px solid var(--accent-2); border-radius: 8px; background: rgba(0, 0, 0, .06); font-size: 13px; }
.msg.mine .quote { background: rgba(255, 255, 255, .18); border-left-color: #fff; }
.quote b { font-size: 12px; }
.quote span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 260px; opacity: .85; }
.bubble.media { padding: 3px; }
.bubble.media .meta { position: absolute; right: 10px; bottom: 9px; background: rgba(0, 0, 0, .5); color: #fff; padding: 3px 8px; border-radius: 999px; opacity: 1; }
.bubble.media .tick.read { color: #8AF0FF; }
.media-btn { display: block; border-radius: 17px; overflow: hidden; width: min(300px, 62vw); min-height: 120px; background: var(--surface-2); }
.media-btn img { width: 100%; height: 100%; object-fit: cover; display: block; max-height: 380px; }
.chat-video { display: block; border-radius: 17px; width: min(320px, 66vw); max-height: 380px; background: #000; }
.bubble.media .quote { margin: 4px; width: calc(100% - 8px); }
.file-card { display: flex; align-items: center; gap: 12px; min-width: 220px; padding: 4px 2px; }
.fc-text { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.fc-text b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 200px; font-size: 14px; }
.fc-text small { opacity: .75; font-size: 12px; }
.uploading { display: flex; align-items: center; gap: 12px; min-width: 200px; padding: 4px 2px; }
.up-text { display: flex; flex-direction: column; gap: 6px; flex: 1; min-width: 0; }
.up-text b { font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 180px; }
.up-bar { display: block; height: 5px; border-radius: 99px; background: rgba(255, 255, 255, .3); overflow: hidden; }
.up-bar i { display: block; height: 100%; width: 0; background: #fff; transition: width .2s; }
.msg.local .bubble { opacity: .9; }
.aud { display: flex; align-items: center; gap: 10px; min-width: 210px; padding: 2px 0; }
.aud-play { width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center; flex: none; background: var(--accent-soft); color: var(--accent); }
.msg.mine .aud-play { background: rgba(255, 255, 255, .22); color: #fff; }
.aud-play .i-pause { display: none; }
.aud.playing .i-play { display: none; }
.aud.playing .i-pause { display: inline-flex; }
.aud-track { flex: 1; height: 6px; border-radius: 99px; background: var(--border); cursor: pointer; overflow: hidden; position: relative; }
.aud-track::before { content: ""; position: absolute; inset: -10px 0; }
.aud-track i { display: block; height: 100%; width: 0; background: var(--accent); border-radius: inherit; }
.msg.mine .aud-track { background: rgba(255, 255, 255, .3); }
.msg.mine .aud-track i { background: #fff; }
.aud-time { font-size: 12px; font-weight: 600; min-width: 34px; text-align: right; font-variant-numeric: tabular-nums; }
.rxs { display: flex; gap: 4px; margin: -8px 8px 0; position: relative; z-index: 1; }
.rx-chip { display: inline-flex; align-items: center; gap: 4px; height: 24px; padding: 0 6px; border-radius: 999px; background: var(--surface); border: 1px solid var(--border); font-size: 12px; font-weight: 700; box-shadow: 0 2px 6px rgba(20, 20, 40, .1); }
.rx-chip.me { border-color: var(--accent); background: var(--accent-soft); }
.msg-more { width: 30px; height: 30px; opacity: 0; flex: none; }
.msg:hover .msg-more, .msg-more:focus-visible { opacity: 1; }
@media (hover: none) { .msg-more { opacity: 1; } }
.typing-row { padding: 6px 0 2px; }
.typing-bubble { display: inline-flex; gap: 4px; padding: 12px 14px; border-radius: 18px; border-bottom-left-radius: 6px; background: var(--bubble-them); border: 1px solid var(--border); }
.typing-bubble i { width: 7px; height: 7px; border-radius: 50%; background: var(--text-3); animation: blink 1.2s infinite; }
.typing-bubble i:nth-child(2) { animation-delay: .2s; } .typing-bubble i:nth-child(3) { animation-delay: .4s; }
.to-bottom { position: absolute; right: 18px; bottom: 96px; width: 42px; height: 42px; border-radius: 50%; background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow); display: grid; place-items: center; z-index: 5; }

.reply-bar { display: flex; align-items: center; gap: 10px; padding: 8px 12px 8px 16px; background: var(--surface); border-top: 1px solid var(--border); color: var(--accent); }
.reply-text { flex: 1; min-width: 0; display: flex; flex-direction: column; font-size: 13px; border-left: 3px solid var(--accent); padding-left: 10px; }
.reply-text b { color: var(--accent); }
.reply-text span { color: var(--text-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.composer { background: var(--surface); border-top: 1px solid var(--border); padding: 10px 12px calc(10px + var(--safe-b)); }
.composer-row { display: flex; align-items: flex-end; gap: 6px; }
.composer-row .icon-btn { height: 44px; width: 44px; flex: none; }
#msg-input { flex: 1; min-width: 0; resize: none; max-height: 140px; border: 0; outline: none; background: var(--surface-2); border-radius: 22px; padding: 12px 18px; line-height: 1.35; font-size: 15px; }
#msg-input:focus { box-shadow: 0 0 0 2px var(--accent-soft); }
.composer.recording .composer-row { display: none; }
.rec-bar { display: flex; align-items: center; gap: 12px; min-height: 44px; padding: 0 4px; }
.rec-dot { width: 11px; height: 11px; border-radius: 50%; background: var(--danger); animation: pulse 1s infinite; }
.rec-hint { flex: 1; color: var(--text-3); font-size: 13px; font-weight: 600; }
.rec-bar.will-cancel .rec-hint { color: var(--danger); }
.rec-bar .icon-btn { color: var(--danger); }
.emoji-panel { display: grid; grid-template-columns: repeat(8, 1fr); gap: 2px; padding-top: 8px; max-height: 190px; overflow: auto; }
.emoji-btn { height: 40px; font-size: 22px; border-radius: 10px; font-family: "Apple Color Emoji", "Segoe UI Emoji", "Noto Color Emoji", sans-serif; }
.emoji-btn:hover { background: var(--surface-2); }

.lightbox { position: fixed; inset: 0; z-index: 1100; background: rgba(4, 4, 10, .94); display: grid; place-items: center; animation: fade .18s; padding: 56px 12px; }
.lightbox img { max-width: 100%; max-height: 100%; object-fit: contain; border-radius: 8px; }
.lb-bar { position: absolute; top: calc(8px + var(--safe-t)); right: 8px; display: flex; gap: 4px; }
.lb-btn { color: #fff; }
.lb-btn:hover { background: rgba(255, 255, 255, .16); color: #fff; }

@media (max-width: 1099px) and (min-width: 768px) { .chat { grid-template-columns: 320px minmax(0, 1fr); } }
@media (max-width: 767px) {
  .page-chat .topbar { display: none; }
  .page-chat .main { height: 100dvh; padding: 0 0 calc(var(--nav-h) + var(--safe-b)); }
  .page-chat.chat-open .main { padding-bottom: 0; }
  .page-chat.chat-open .bottomnav { display: none; }
  .page-chat.chat-open .net-banner { bottom: 90px; }
  .chat { grid-template-columns: 1fr; }
  .thread-pane { display: none; }
  .chat.has-thread .conv-pane { display: none; }
  .chat.has-thread .thread-pane { display: flex; }
  .conv-pane { border-right: 0; padding-top: var(--safe-t); }
  .bubble-wrap { max-width: 84%; }
  .msgs { padding: 10px 12px 4px; }
  .thread-head { padding-top: calc(8px + var(--safe-t)); }
  .to-bottom { bottom: 88px; }
  .emoji-panel { grid-template-columns: repeat(7, 1fr); }
}

/* ------------------------------------------------------------------ auth */
.auth { display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); min-height: 100dvh; }
.auth-art { position: relative; overflow: hidden; color: #fff; padding: 56px; display: flex; align-items: center; background: linear-gradient(145deg, #4B37D6 0%, #7C4DF2 48%, #FF5D8F 110%); }
.art-inner { position: relative; z-index: 2; max-width: 460px; display: flex; flex-direction: column; gap: 18px; }
.art-brand { display: flex; align-items: center; gap: 12px; font-weight: 800; font-size: 26px; letter-spacing: -.03em; margin-bottom: 26px; }
.art-title { font-size: clamp(30px, 3.6vw, 46px); font-weight: 800; letter-spacing: -.035em; line-height: 1.08; }
.art-text { font-size: 17px; opacity: .88; max-width: 38ch; }
.art-stage { position: relative; height: 240px; margin-top: 18px; }
.art-stage .ring { position: absolute; border-radius: 50%; border: 3px solid transparent; background: linear-gradient(#5a41e0, #5a41e0) padding-box, var(--ring) border-box; }
.art-stage .ring.r1 { width: 92px; height: 92px; left: 0; top: 20px; }
.art-stage .ring.r2 { width: 64px; height: 64px; left: 120px; top: 0; opacity: .85; }
.art-stage .ring.r3 { width: 76px; height: 76px; left: 210px; top: 40px; opacity: .7; }
.bubble.b1, .bubble.b2, .bubble.b3 { position: absolute; background: rgba(255, 255, 255, .95); border: 0; border-radius: 22px; }
.bubble.b1 { width: 190px; height: 54px; left: 20px; top: 132px; border-bottom-left-radius: 6px; }
.bubble.b2 { width: 150px; height: 46px; left: 150px; top: 194px; background: rgba(255, 255, 255, .28); border-bottom-right-radius: 6px; }
.bubble.b3 { width: 78px; height: 42px; left: 250px; top: 120px; display: flex; align-items: center; justify-content: center; gap: 5px; padding: 0; min-width: 0; background: rgba(255, 255, 255, .28); }
.bubble.b3 i { width: 7px; height: 7px; border-radius: 50%; background: #fff; animation: blink 1.2s infinite; }
.bubble.b3 i:nth-child(2) { animation-delay: .2s; } .bubble.b3 i:nth-child(3) { animation-delay: .4s; }
.auth-panel { display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 32px 20px; gap: 18px; }
.auth-card { width: min(420px, 100%); }
.auth-brand { display: flex; align-items: center; gap: 12px; margin-bottom: 22px; }
.auth-title { font-size: 30px; font-weight: 800; letter-spacing: -.035em; }
.auth-sub { color: var(--text-2); margin: 6px 0 22px; }
.auth-card .seg { margin-bottom: 22px; }
.auth-card .btn-lg { margin-top: 6px; }
.auth-card .btn-ghost.btn-block { margin-top: 10px; }
.auth-card .link-btn.right { display: block; margin: -4px 0 14px auto; color: var(--accent); }
.auth-foot { color: var(--text-3); font-size: 12px; }
@media (max-width: 900px) {
  .auth { grid-template-columns: 1fr; }
  .auth-art { display: none; }
  .auth-panel { justify-content: flex-start; padding-top: calc(40px + var(--safe-t)); }
}

/* ------------------------------------------------------------------ cropper (post/story) */
.crop-modal .sheet-head { border-bottom: 1px solid var(--border); }
.crop-stage { display: grid; place-items: center; background: #000; padding: 16px 0; }
.crop-frame { position: relative; overflow: hidden; background: #111; touch-action: none; cursor: grab; }
.crop-frame:active { cursor: grabbing; }
.crop-frame img { position: absolute; top: 0; left: 0; transform-origin: 0 0; user-select: none; -webkit-user-drag: none; pointer-events: none; max-width: none; }
.crop-ratios { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; padding: 12px 16px 0; }
.crop-ratio-btn { padding: 7px 16px; border-radius: 999px; background: var(--surface-2); color: var(--text-2); font-size: 13px; font-weight: 600; }
.crop-ratio-btn.active { background: var(--accent); color: #fff; }
#crop-done { margin: 14px 16px 16px; width: calc(100% - 32px); }
.drop-crop { position: absolute; bottom: 10px; right: 10px; background: rgba(0, 0, 0, .6); color: #fff; }
.drop-crop:hover { background: rgba(0, 0, 0, .8); color: #fff; }

/* ------------------------------------------------------------------ verified badge */
.verified-badge { color: #3897f0; flex: none; margin-left: 3px; vertical-align: middle; --ico: 14px; }
.name-verified { display: inline-flex; align-items: center; gap: 0; }

/* ------------------------------------------------------------------ admin dashboard */
.admin-wrap { max-width: 720px; margin: 0 auto; padding: 20px 16px 40px; }
.admin-tabs { display: flex; gap: 8px; margin-bottom: 18px; border-bottom: 1px solid var(--border); }
.admin-tab { background: none; border: none; padding: 10px 16px; font-weight: 600; font-size: 14px; color: var(--text-3); cursor: pointer; border-bottom: 2px solid transparent; }
.admin-tab.active { color: var(--text); border-bottom-color: var(--accent); }
.admin-search { width: 100%; margin-bottom: 14px; }
.admin-row { display: flex; align-items: center; gap: 12px; padding: 10px 4px; border-bottom: 1px solid var(--border); }
.admin-row .av { flex: none; }
.admin-row-main { flex: 1; min-width: 0; }
.admin-row-name { font-weight: 600; font-size: 14px; display: flex; align-items: center; }
.admin-row-sub { font-size: 12.5px; color: var(--text-3); }
.admin-row-actions { flex: none; display: flex; gap: 8px; }
.admin-empty { text-align: center; color: var(--text-3); padding: 40px 0; font-size: 14px; }
.admin-post-thumb { width: 44px; height: 44px; border-radius: 8px; object-fit: cover; flex: none; background: var(--bg-2); }
.admin-caption { font-size: 13px; color: var(--text-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 260px; }
.admin-loadmore { display: block; margin: 16px auto 0; }

/* ------------------------------------------------------------------ misc */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
  .spin { animation-duration: 1.2s !important; animation-iteration-count: infinite !important; }
}
