/* ==========================================================================
   Vala — design system
   Warm paper + ink, with an ember accent. Light & dark themes.
   ========================================================================== */

:root {
  --font: "Geist", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-display: "Bricolage Grotesque", var(--font);

  --accent: #F0532B;
  --accent-hover: #DC4520;
  --accent-ink: #FFFFFF;
  --accent-soft: rgba(240, 83, 43, .10);
  --accent-soft-2: rgba(240, 83, 43, .16);
  --grad: linear-gradient(135deg, #FF8A3D 0%, #F0532B 48%, #D2346A 100%);
  --glow: rgba(240, 83, 43, .07);

  --success: #12A066;
  --success-soft: rgba(18, 160, 102, .12);
  --danger: #E5484D;
  --danger-soft: rgba(229, 72, 77, .11);
  --warning: #D98A1C;
  --warning-soft: rgba(217, 138, 28, .13);
  --info: #3B7BF6;

  --bg: #F3F1EC;
  --surface: #FFFFFF;
  --surface-2: #F8F6F2;
  --surface-3: #EFECE6;
  --hover: rgba(23, 22, 26, .045);
  --active: rgba(23, 22, 26, .075);
  --border: rgba(23, 22, 26, .08);
  --border-strong: rgba(23, 22, 26, .15);

  --text: #16151A;
  --text-2: #5A5761;
  --text-3: #8F8B95;

  --shadow-sm: 0 1px 2px rgba(23, 22, 26, .05);
  --shadow: 0 1px 2px rgba(23, 22, 26, .04), 0 8px 28px -12px rgba(23, 22, 26, .12);
  --shadow-lg: 0 28px 70px -24px rgba(23, 22, 26, .32), 0 2px 8px rgba(23, 22, 26, .06);
  --ring: 0 0 0 4px var(--accent-soft-2);

  --r-xl: 22px;
  --r: 18px;
  --r-sm: 12px;
  --r-xs: 9px;
  --topbar-h: 64px;
  --ease: cubic-bezier(.2, .8, .2, 1);
  --ease-spring: cubic-bezier(.34, 1.56, .64, 1);

  color-scheme: light;
}

:root[data-theme="dark"] {
  --accent: #FF6A3D;
  --accent-hover: #FF7F57;
  --accent-soft: rgba(255, 106, 61, .13);
  --accent-soft-2: rgba(255, 106, 61, .22);
  --glow: rgba(255, 106, 61, .08);

  --success: #2BC488;
  --success-soft: rgba(43, 196, 136, .14);
  --danger: #FF5C61;
  --danger-soft: rgba(255, 92, 97, .14);
  --warning-soft: rgba(217, 138, 28, .18);

  --bg: #0B0B0E;
  --surface: #141418;
  --surface-2: #1A1A1F;
  --surface-3: #232329;
  --hover: rgba(255, 255, 255, .05);
  --active: rgba(255, 255, 255, .085);
  --border: rgba(255, 255, 255, .07);
  --border-strong: rgba(255, 255, 255, .14);

  --text: #F2F0ED;
  --text-2: #A8A4AE;
  --text-3: #6F6B76;

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .4);
  --shadow: 0 1px 2px rgba(0, 0, 0, .35), 0 10px 30px -12px rgba(0, 0, 0, .55);
  --shadow-lg: 0 30px 80px -20px rgba(0, 0, 0, .75), 0 0 0 1px rgba(255, 255, 255, .05);

  color-scheme: dark;
}

/* ---------- Reset ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: calc(var(--topbar-h) + 16px); }
body {
  margin: 0;
  font: 15px/1.5 var(--font);
  color: var(--text);
  background:
    radial-gradient(1100px 520px at 50% -260px, var(--glow), transparent 70%),
    var(--bg);
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  min-height: 100vh;
}
img, svg, video { display: block; max-width: 100%; }
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: 0; padding: 0; }
h1, h2, h3, h4 { margin: 0; font-family: var(--font-display); letter-spacing: -.02em; line-height: 1.15; font-weight: 700; }
p { margin: 0; }
[hidden] { display: none !important; }
::selection { background: var(--accent-soft-2); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 6px; }
code, .mono { font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; font-size: .9em; }

.i { width: 20px; height: 20px; flex: none; }
.i-xs { width: 14px; height: 14px; }
.verified { width: 17px; height: 17px; color: var(--info); display: inline-block; vertical-align: -3px; margin-left: 4px; flex: none; }
.muted { color: var(--text-3); }
.small { font-size: 13px; }
.center { text-align: center; }
.nowrap { white-space: nowrap; }

/* ---------- Buttons ---------- */
.btn {
  --h: 40px;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: var(--h); padding: 0 16px;
  border-radius: 999px;
  font-weight: 600; font-size: 14px; letter-spacing: -.005em;
  white-space: nowrap;
  transition: background-color .2s var(--ease), color .2s, box-shadow .2s, transform .15s var(--ease), opacity .2s;
  user-select: none;
}
.btn .i { width: 18px; height: 18px; }
.btn:active:not(:disabled) { transform: scale(.97); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn-primary { background: var(--accent); color: var(--accent-ink); box-shadow: 0 1px 0 rgba(255,255,255,.18) inset, 0 6px 16px -6px var(--accent); }
.btn-primary:hover:not(:disabled) { background: var(--accent-hover); }
.btn-soft { background: var(--surface-3); color: var(--text); }
.btn-soft:hover { background: var(--active); }
.btn-ghost { color: var(--text-2); }
.btn-ghost:hover { background: var(--hover); color: var(--text); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { filter: brightness(1.06); }
.btn-glass { background: rgba(10, 10, 12, .45); color: #fff; backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); border: 1px solid rgba(255,255,255,.18); }
.btn-glass:hover { background: rgba(10, 10, 12, .62); }
.btn-sm { --h: 34px; padding: 0 13px; font-size: 13px; }
.btn-lg { --h: 50px; padding: 0 24px; font-size: 15px; }
.btn-block { width: 100%; }
.btn-round { width: 44px; height: 44px; padding: 0; border-radius: 50%; }

.btn-icon {
  display: inline-grid; place-items: center;
  width: 38px; height: 38px; border-radius: 50%;
  color: var(--text-2);
  transition: background-color .2s, color .2s, transform .15s var(--ease);
  flex: none;
}
.btn-icon:hover { background: var(--hover); color: var(--text); }
.btn-icon:active { transform: scale(.92); }
.btn-icon-soft { background: var(--accent-soft); color: var(--accent); }
.btn-icon-soft:hover { background: var(--accent-soft-2); color: var(--accent); }
.btn-icon-danger:hover { background: var(--danger-soft); color: var(--danger); }

.pill {
  display: inline-flex; align-items: center; gap: 5px;
  height: 24px; padding: 0 10px; border-radius: 999px;
  font-size: 12px; font-weight: 600;
  background: var(--surface-3); color: var(--text-2);
  white-space: nowrap;
}
.pill-accent { background: var(--accent-soft); color: var(--accent); }
.pill-success { background: var(--success-soft); color: var(--success); }
.pill-danger { background: var(--danger-soft); color: var(--danger); }

.badge {
  position: absolute; top: 4px; right: 50%; transform: translateX(22px);
  min-width: 19px; height: 19px; padding: 0 5px;
  display: grid; place-items: center;
  border-radius: 999px; background: var(--danger); color: #fff;
  font-size: 11px; font-weight: 700; line-height: 1;
  box-shadow: 0 0 0 2.5px var(--surface);
  animation: pop .35s var(--ease-spring);
}
.badge-inline { position: static; transform: none; box-shadow: none; margin-left: auto; animation: none; }

/* ---------- Forms ---------- */
.form { display: grid; gap: 16px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.field { display: grid; gap: 7px; }
.field > span:first-child { font-size: 13px; font-weight: 600; color: var(--text-2); display: flex; justify-content: space-between; gap: 8px; }
.input {
  width: 100%; height: 46px; padding: 0 14px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  outline: none;
  transition: border-color .2s, box-shadow .2s, background-color .2s;
}
textarea.input { height: auto; padding: 12px 14px; resize: vertical; line-height: 1.5; }
select.input { appearance: none; padding-right: 36px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' fill='none' stroke='%238F8B95' stroke-width='2' stroke-linecap='round' viewBox='0 0 24 24'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 10px center; background-size: 18px; }
.input:hover { border-color: var(--border-strong); }
.input:focus { border-color: var(--accent); box-shadow: var(--ring); background: var(--surface); }
.input::placeholder { color: var(--text-3); }
.has-error .input { border-color: var(--danger); }
.field-error { color: var(--danger); font-size: 12.5px; font-weight: 500; }
.input-ico { position: relative; display: flex; align-items: center; }
.input-ico > .i { position: absolute; left: 14px; color: var(--text-3); pointer-events: none; width: 18px; height: 18px; }
.input-ico > .input { padding-left: 42px; }
.input-prefix .prefix { position: absolute; left: 15px; color: var(--text-3); font-weight: 600; }
.input-prefix .input { padding-left: 32px; }
.pw-toggle { position: absolute; right: 6px; width: 36px; height: 36px; display: grid; place-items: center; color: var(--text-3); border-radius: 50%; }
.pw-toggle:hover { color: var(--text); background: var(--hover); }
.pw-meter { height: 4px; border-radius: 4px; background: var(--surface-3); overflow: hidden; }
.pw-meter i { display: block; height: 100%; width: 0; border-radius: inherit; background: var(--danger); transition: width .3s var(--ease), background-color .3s; }
.check { display: flex; gap: 10px; align-items: flex-start; font-size: 13.5px; color: var(--text-2); cursor: pointer; }
.check input { width: 18px; height: 18px; margin: 1px 0 0; accent-color: var(--accent); flex: none; }
.form-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 4px; }

.switch-row { display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 14px 16px; background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--r-sm); cursor: pointer; }
.switch-row small { display: block; color: var(--text-3); font-size: 13px; margin-top: 2px; }
.switch { position: relative; flex: none; }
.switch input { position: absolute; opacity: 0; inset: 0; cursor: pointer; }
.switch i { display: block; width: 46px; height: 28px; border-radius: 999px; background: var(--border-strong); transition: background-color .25s; position: relative; }
.switch i::after { content: ""; position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%; background: #fff; box-shadow: 0 2px 6px rgba(0,0,0,.2); transition: transform .3s var(--ease-spring); }
.switch input:checked + i { background: var(--accent); }
.switch input:checked + i::after { transform: translateX(18px); }
.switch input:focus-visible + i { box-shadow: var(--ring); }

.alert { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-radius: var(--r-sm); font-size: 14px; font-weight: 500; margin-bottom: 16px; }
.alert .i { width: 18px; height: 18px; margin-top: 1px; }
.alert-danger { background: var(--danger-soft); color: var(--danger); }
.alert-warning { background: var(--warning-soft); color: var(--warning); }

/* ---------- Cards ---------- */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r);
  box-shadow: var(--shadow-sm);
}
.pad-lg { padding: 28px; }
.card-title { display: flex; align-items: center; gap: 10px; font-size: 18px; margin-bottom: 18px; }
.card-title .i { color: var(--accent); }
.card-title.mt { margin-top: 10px; }
.section-title { font-size: 22px; margin: 6px 0 18px; display: flex; align-items: baseline; gap: 10px; }

/* ---------- Avatars ---------- */
.av { position: relative; display: inline-block; flex: none; border-radius: 50%; width: 44px; height: 44px; }
.av img, .av-fallback { width: 100%; height: 100%; border-radius: 50%; object-fit: cover; }
.av-fallback {
  display: grid; place-items: center;
  background: linear-gradient(140deg, hsl(var(--h) 85% 64%), hsl(calc(var(--h) + 40) 75% 48%));
  color: #fff; font-weight: 700; letter-spacing: .01em;
  font-size: calc(var(--s, 44px) * .38);
  text-shadow: 0 1px 2px rgba(0,0,0,.15);
}
.av img { background: var(--surface-3); }
.av-xs { width: 24px; height: 24px; --s: 24px; }
.av-sm { width: 36px; height: 36px; --s: 36px; }
.av-md { width: 44px; height: 44px; --s: 44px; }
.av-lg { width: 64px; height: 64px; --s: 64px; }
.av-xl { width: 160px; height: 160px; --s: 160px; }
.av-fill { width: 100%; height: auto; aspect-ratio: 1; border-radius: var(--r-sm); --s: 90px; }
.av-fill img, .av-fill .av-fallback { border-radius: var(--r-sm); }
.av-link { display: inline-flex; border-radius: 50%; transition: opacity .2s; }
.av-link:hover { opacity: .88; }
.online-dot { position: absolute; right: 0; bottom: 0; width: 28%; height: 28%; min-width: 10px; min-height: 10px; max-width: 18px; max-height: 18px; border-radius: 50%; background: var(--success); box-shadow: 0 0 0 2.5px var(--surface); }
.av-xl .online-dot { right: 10px; bottom: 10px; box-shadow: 0 0 0 4px var(--surface); }

/* ---------- Topbar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 50;
  height: var(--topbar-h);
  display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 16px;
  padding: 0 20px;
  background: color-mix(in srgb, var(--surface) 82%, transparent);
  backdrop-filter: saturate(180%) blur(18px);
  -webkit-backdrop-filter: saturate(180%) blur(18px);
  border-bottom: 1px solid var(--border);
}
.tb-left { display: flex; align-items: center; gap: 14px; min-width: 0; }
.brand { display: inline-flex; align-items: center; gap: 10px; flex: none; }
.brand-name { font-family: var(--font-display); font-weight: 800; font-size: 23px; letter-spacing: -.035em; }
.logo-mark { flex: none; filter: drop-shadow(0 6px 12px rgba(240, 83, 43, .3)); }
.tb-search { position: relative; flex: 1; max-width: 300px; display: flex; align-items: center; }
.tb-search .i { position: absolute; left: 14px; width: 17px; height: 17px; color: var(--text-3); pointer-events: none; }
.tb-search input {
  width: 100%; height: 42px; padding: 0 40px 0 40px;
  border-radius: 999px; border: 1px solid transparent;
  background: var(--surface-3); outline: none;
  transition: background-color .2s, border-color .2s, box-shadow .2s;
}
.tb-search input::placeholder { color: var(--text-3); }
.tb-search input:focus { background: var(--surface); border-color: var(--accent); box-shadow: var(--ring); }
.tb-search kbd { position: absolute; right: 12px; font: 600 11px var(--font); color: var(--text-3); border: 1px solid var(--border-strong); border-radius: 6px; padding: 1px 6px; }
.tb-search input:focus ~ kbd { display: none; }

.tb-center { display: flex; gap: 6px; height: 100%; }
.tb-tab {
  position: relative; display: grid; place-items: center;
  width: 96px; height: 100%;
  color: var(--text-3);
  transition: color .2s;
}
.tb-tab::before { content: ""; position: absolute; inset: 8px 4px; border-radius: 14px; transition: background-color .2s; }
.tb-tab:hover::before { background: var(--hover); }
.tb-tab .i { width: 24px; height: 24px; position: relative; }
.tb-tab:hover { color: var(--text); }
.tb-tab.is-active { color: var(--accent); }
.tb-tab.is-active::after { content: ""; position: absolute; left: 18px; right: 18px; bottom: -1px; height: 3px; border-radius: 3px 3px 0 0; background: var(--accent); }

.tb-right { display: flex; align-items: center; justify-content: flex-end; gap: 6px; }
.tb-me { display: flex; align-items: center; gap: 4px; padding: 3px 8px 3px 3px; border-radius: 999px; color: var(--text-2); transition: background-color .2s; }
.tb-me:hover { background: var(--hover); }
.tb-mobile-search { display: none; }
.theme-toggle .theme-sun { display: none; }
:root[data-theme="dark"] .theme-toggle .theme-sun { display: block; }
:root[data-theme="dark"] .theme-toggle .theme-moon { display: none; }

/* ---------- Dropdown menus ---------- */
.dropdown { position: relative; }
.menu {
  position: absolute; top: calc(100% + 8px); left: 0; z-index: 60;
  min-width: 230px; padding: 6px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: var(--shadow-lg);
  opacity: 0; visibility: hidden;
  transform: translateY(-6px) scale(.98); transform-origin: top left;
  transition: opacity .16s var(--ease), transform .2s var(--ease), visibility 0s .2s;
}
.menu-right { left: auto; right: 0; transform-origin: top right; }
.dropdown.is-open > .menu { opacity: 1; visibility: visible; transform: none; transition: opacity .16s var(--ease), transform .2s var(--ease); }
.menu a, .menu button, .menu .menu-btn {
  display: flex; align-items: center; gap: 12px; width: 100%;
  padding: 10px 12px; border-radius: 10px;
  font-size: 14px; font-weight: 500; text-align: left; color: var(--text);
  transition: background-color .15s;
}
.menu a:hover, .menu button:hover { background: var(--hover); }
.menu .i { width: 18px; height: 18px; color: var(--text-2); }
.menu .danger, .menu .danger .i { color: var(--danger); }
.menu-sep { height: 1px; background: var(--border); margin: 6px 4px; }
.menu form { margin: 0; }
.menu-account { min-width: 290px; }
.menu-profile { padding: 10px !important; }
.menu-profile span { display: grid; line-height: 1.3; }
.menu-profile small { color: var(--text-3); font-size: 13px; }

/* ---------- Shell & layouts ---------- */
.shell { padding: 24px 20px 60px; }
.layout-3 {
  display: grid;
  grid-template-columns: 272px minmax(0, 620px) 320px;
  justify-content: center;
  gap: 28px;
  max-width: 1340px; margin: 0 auto;
}
.layout-2 {
  display: grid;
  grid-template-columns: 272px minmax(0, 1fr);
  gap: 28px;
  max-width: 1240px; margin: 0 auto;
}
.col-main, .col-wide { min-width: 0; display: grid; gap: 18px; align-content: start; }
.sticky-col { position: sticky; top: calc(var(--topbar-h) + 24px); display: grid; gap: 16px; }
.narrow { max-width: 720px; margin: 0 auto; }
.wide { max-width: 1100px; margin: 0 auto; }

.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; padding: 6px 2px 0; }
.page-head h1 { font-size: 32px; letter-spacing: -.035em; }
.page-head p { color: var(--text-2); margin-top: 4px; }
.back-link { display: inline-flex; align-items: center; gap: 8px; color: var(--text-2); font-weight: 600; font-size: 14px; width: fit-content; padding: 6px 12px 6px 8px; border-radius: 999px; }
.back-link:hover { background: var(--hover); color: var(--text); }
.back-link .i { width: 18px; height: 18px; }

/* Left column */
.me-card { display: grid; justify-items: center; text-align: center; padding: 0 16px 16px; overflow: hidden; transition: box-shadow .25s, transform .25s var(--ease); }
.me-card:hover { box-shadow: var(--shadow); transform: translateY(-2px); }
.me-cover { display: block; width: calc(100% + 32px); height: 72px; margin: 0 -16px; background: var(--grad); background-size: cover; background-position: center; }
.me-card .av { margin-top: -32px; box-shadow: 0 0 0 4px var(--surface); border-radius: 50%; }
.me-card b { margin-top: 10px; font-size: 16px; font-family: var(--font-display); letter-spacing: -.01em; }
.me-card small { color: var(--text-3); }
.me-stats { display: grid; grid-template-columns: 1fr 1fr; width: 100%; margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--border); }
.me-stats span { display: grid; font-size: 12px; color: var(--text-3); }
.me-stats span b { margin: 0; font-size: 17px; color: var(--text); font-family: var(--font-display); }
.me-stats span + span { border-left: 1px solid var(--border); }

.side-nav { display: grid; gap: 2px; }
.side-nav a {
  display: flex; align-items: center; gap: 14px;
  padding: 11px 14px; border-radius: 14px;
  font-weight: 500; color: var(--text-2);
  transition: background-color .2s, color .2s;
}
.side-nav a .i { width: 21px; height: 21px; }
.side-nav a:hover { background: var(--hover); color: var(--text); }
.side-nav a.is-active { background: var(--surface); color: var(--text); font-weight: 600; box-shadow: var(--shadow-sm); border: 1px solid var(--border); padding: 10px 13px; }
.side-nav a.is-active .i { color: var(--accent); }
.side-admin { margin-top: 8px; border-top: 1px solid var(--border); border-radius: 0 0 14px 14px !important; padding-top: 16px !important; }
.side-foot { font-size: 12px; color: var(--text-3); padding: 0 14px; }

/* Right rail */
.rail-card { padding: 16px; display: grid; gap: 12px; }
.rail-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.rail-head h3 { font-size: 15.5px; letter-spacing: -.01em; }
.rail-head a { font-size: 13px; font-weight: 600; color: var(--accent); }
.rail-head a:hover { text-decoration: underline; }
.rail-person { display: flex; gap: 12px; align-items: flex-start; }
.rail-person.is-row { align-items: center; }
.rp-info { flex: 1; min-width: 0; display: grid; gap: 1px; font-size: 14px; }
.rp-info small { color: var(--text-3); font-size: 12.5px; }
.rp-info .friend-actions { margin-top: 8px; }
.name-link { font-weight: 600; color: var(--text); }
.name-link:hover { text-decoration: underline; text-underline-offset: 2px; }
.contacts { display: grid; gap: 2px; margin: 0 -8px; }
.contact { display: flex; align-items: center; gap: 12px; padding: 7px 8px; border-radius: 12px; font-size: 14px; font-weight: 500; transition: background-color .15s; }
.contact:hover { background: var(--hover); }
.contact span:last-child { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- Announcement ---------- */
.announce {
  display: flex; align-items: center; gap: 14px;
  padding: 14px 14px 14px 16px;
  border-radius: var(--r);
  background: linear-gradient(120deg, var(--accent-soft), transparent 70%), var(--surface);
  border: 1px solid var(--accent-soft-2);
}
.announce p { flex: 1; font-weight: 500; }
.announce-ico { width: 38px; height: 38px; border-radius: 12px; display: grid; place-items: center; background: var(--grad); color: #fff; flex: none; }
.announce-ico .i { width: 19px; height: 19px; }

/* ---------- Stories ---------- */
.stories-wrap { position: relative; }
.stories { display: flex; gap: 10px; overflow-x: auto; scroll-snap-type: x mandatory; padding: 2px; margin: -2px; scrollbar-width: none; }
.stories::-webkit-scrollbar { display: none; }
.story {
  position: relative; flex: none; scroll-snap-align: start;
  width: 112px; height: 188px; border-radius: 16px; overflow: hidden;
  background: var(--surface-3); cursor: pointer;
  box-shadow: var(--shadow-sm);
  isolation: isolate;
  transition: transform .3s var(--ease);
}
.story:hover { transform: translateY(-3px); }
.story-bg { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; transition: transform .5s var(--ease); z-index: -1; }
.story:hover .story-bg { transform: scale(1.06); }
.story::after { content: ""; position: absolute; inset: 0; background: linear-gradient(180deg, rgba(0,0,0,.25), transparent 35%, transparent 55%, rgba(0,0,0,.65)); z-index: -1; }
.story-ring { position: absolute; top: 10px; left: 10px; padding: 2.5px; border-radius: 50%; background: var(--grad); }
.story-ring .av { box-shadow: 0 0 0 2.5px #111; }
.story-name { position: absolute; left: 10px; right: 10px; bottom: 10px; color: #fff; font-size: 12.5px; font-weight: 600; line-height: 1.25; text-align: left; text-shadow: 0 1px 3px rgba(0,0,0,.4); }
.story-create { background: var(--surface); border: 1px solid var(--border); }
.story-create::after { display: none; }
.story-thumb { position: absolute; inset: 0 0 52px; overflow: hidden; }
.story-thumb img { width: 100%; height: 100%; object-fit: cover; transition: transform .5s var(--ease); }
.story-create:hover .story-thumb img { transform: scale(1.05); }
.story-thumb-fallback { display: block; width: 100%; height: 100%; background: var(--grad); opacity: .85; }
.story-plus { position: absolute; left: 50%; bottom: 36px; transform: translateX(-50%); width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; background: var(--accent); color: #fff; box-shadow: 0 0 0 4px var(--surface); }
.story-plus .i { width: 18px; height: 18px; stroke-width: 2.6; }
.story-create .story-name { color: var(--text); text-shadow: none; text-align: center; bottom: 9px; }
.story.is-uploading { opacity: .6; pointer-events: none; }

.story-viewer { position: fixed; inset: 0; z-index: 120; background: rgba(5,5,7,.94); display: grid; place-items: center; animation: fade .25s var(--ease); }
.sv-stage { position: relative; width: min(420px, 100vw); height: min(92vh, 760px); border-radius: 18px; overflow: hidden; background: #000; box-shadow: 0 30px 80px rgba(0,0,0,.6); }
.sv-stage img { width: 100%; height: 100%; object-fit: contain; }
.sv-bars { position: absolute; top: 10px; left: 10px; right: 10px; display: flex; gap: 4px; z-index: 2; }
.sv-bars i { flex: 1; height: 3px; border-radius: 3px; background: rgba(255,255,255,.3); overflow: hidden; }
.sv-bars i b { display: block; height: 100%; width: 0; background: #fff; }
.sv-head { position: absolute; top: 22px; left: 12px; right: 8px; display: flex; align-items: center; gap: 10px; color: #fff; z-index: 2; text-shadow: 0 1px 3px rgba(0,0,0,.5); }
.sv-head b { font-size: 14px; }
.sv-head small { opacity: .75; font-size: 12.5px; margin-left: 6px; }
.sv-head .btn-icon { color: #fff; margin-left: auto; }
.sv-head .btn-icon + .btn-icon { margin-left: 0; }
.sv-head .btn-icon:hover { background: rgba(255,255,255,.15); }
.sv-caption { position: absolute; left: 0; right: 0; bottom: 0; padding: 40px 18px 22px; color: #fff; font-size: 15px; background: linear-gradient(transparent, rgba(0,0,0,.7)); text-align: center; z-index: 2; }
.sv-nav { position: absolute; top: 0; bottom: 0; width: 35%; z-index: 1; }
.sv-prev { left: 0; } .sv-next { right: 0; }
.sv-av { width: 34px; height: 34px; border-radius: 50%; object-fit: cover; box-shadow: 0 0 0 2px rgba(255,255,255,.8); }

/* ---------- Composer ---------- */
.composer { padding: 16px 16px 12px; }
.composer-top { display: flex; gap: 12px; align-items: flex-start; }
.composer textarea {
  flex: 1; min-height: 44px; max-height: 320px;
  padding: 10px 0; border: 0; outline: none; resize: none;
  background: transparent; font-size: 17px; line-height: 1.45;
}
.composer textarea::placeholder { color: var(--text-3); }
.composer-preview { position: relative; margin: 12px 0 4px; border-radius: 14px; overflow: hidden; border: 1px solid var(--border); background: var(--surface-2); }
.composer-preview img { width: 100%; max-height: 420px; object-fit: contain; }
.composer-remove { position: absolute; top: 10px; right: 10px; background: rgba(0,0,0,.55); color: #fff; backdrop-filter: blur(6px); }
.composer-remove:hover { background: rgba(0,0,0,.75); color: #fff; }
.composer-bar { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 10px; padding-top: 12px; border-top: 1px solid var(--border); }
.composer-tools { display: flex; gap: 6px; flex-wrap: wrap; }
.chip {
  position: relative; display: inline-flex; align-items: center; gap: 7px;
  height: 36px; padding: 0 12px; border-radius: 999px;
  font-size: 13.5px; font-weight: 600; color: var(--text-2);
  cursor: pointer; transition: background-color .2s, color .2s;
}
.chip:hover { background: var(--hover); color: var(--text); }
.chip .i { width: 19px; height: 19px; }
.chip-photo .i { color: var(--success); }
.chip-select .priv-ico { color: var(--info); }
.chip-select select { appearance: none; border: 0; background: transparent; outline: none; font-weight: 600; cursor: pointer; padding-right: 2px; color: inherit; }
.chip-select select option { color: var(--text); background: var(--surface); }
.composer.is-busy { opacity: .7; pointer-events: none; }

/* ---------- Posts ---------- */
.feed { display: grid; gap: 18px; }
.post { overflow: visible; animation: rise .45s var(--ease) both; }
.post.is-new { animation: rise .55s var(--ease-spring) both; }
.post.is-removing { animation: shrink .35s var(--ease) forwards; }
.post-head { display: flex; align-items: center; gap: 12px; padding: 14px 10px 0 16px; }
.post-meta { flex: 1; min-width: 0; }
.post-author { font-size: 15px; line-height: 1.3; }
.post-sub { display: flex; align-items: center; gap: 6px; color: var(--text-3); font-size: 13px; margin-top: 1px; }
.post-sub a:hover { text-decoration: underline; }
.post-sub .dot { opacity: .6; }
.post-sub .priv { display: inline-flex; }
.post-body { padding: 12px 18px 2px; font-size: 15.5px; line-height: 1.55; overflow-wrap: anywhere; }
.post-body.is-large { font-size: 23px; line-height: 1.35; font-family: var(--font-display); font-weight: 600; letter-spacing: -.02em; padding-top: 14px; padding-bottom: 8px; }
.post-body a, .c-text a, .bio a, .msg-bubble a, .announce a { color: var(--accent); font-weight: 500; }
.post-body a:hover, .c-text a:hover { text-decoration: underline; }
.hashtag { color: var(--accent); font-weight: 600; }
.post-media { margin: 12px 0 0; background: var(--surface-2); border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); overflow: hidden; }
.post-media img { width: 100%; max-height: 640px; object-fit: cover; cursor: zoom-in; transition: transform .6s var(--ease); }
.post-media:hover img { transform: scale(1.012); }

.post-stats { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 12px 18px 0; color: var(--text-3); font-size: 13.5px; }
.react-summary { display: inline-flex; align-items: center; gap: 6px; }
.react-stack { display: inline-flex; }
.react-stack i { font-style: normal; width: 22px; height: 22px; display: grid; place-items: center; font-size: 13px; background: var(--surface); border-radius: 50%; box-shadow: 0 0 0 2px var(--surface); margin-left: -5px; }
.react-stack i:first-child { margin-left: 0; }
.comment-count:hover { text-decoration: underline; color: var(--text-2); }

.post-actions { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; margin: 10px 10px 0; padding: 4px 0 8px; border-top: 1px solid var(--border); }
.pa-btn {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  height: 42px; border-radius: 12px; width: 100%;
  font-weight: 600; font-size: 14px; color: var(--text-2);
  transition: background-color .15s, color .15s;
}
.pa-btn:hover { background: var(--hover); color: var(--text); }
.pa-btn .i { width: 20px; height: 20px; }
.react-wrap { position: relative; }
.react-ico { display: grid; place-items: center; font-size: 19px; line-height: 1; }
.react-btn.is-active { color: var(--accent); }
.react-btn.r-love { color: #E5384F; }
.react-btn.r-haha, .react-btn.r-wow, .react-btn.r-sad { color: #E3A008; }
.react-btn.r-angry { color: #E5602A; }
.react-btn.is-bump .react-ico { animation: bump .45s var(--ease-spring); }

.react-picker {
  position: absolute; bottom: calc(100% + 6px); left: 0; z-index: 30;
  display: flex; gap: 2px; padding: 6px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 999px; box-shadow: var(--shadow-lg);
  opacity: 0; visibility: hidden; transform: translateY(8px) scale(.9); transform-origin: bottom left;
  transition: opacity .18s var(--ease), transform .25s var(--ease-spring), visibility 0s .25s;
}
.react-wrap.is-picking .react-picker { opacity: 1; visibility: visible; transform: none; transition-delay: 0s; }
.react-picker button {
  width: 42px; height: 42px; font-size: 27px; line-height: 1; border-radius: 50%;
  display: grid; place-items: center;
  transition: transform .2s var(--ease-spring);
}
.react-picker button:hover { transform: translateY(-6px) scale(1.28); }
.react-wrap.is-picking .react-picker button { animation: pickIn .35s var(--ease-spring) both; }
.react-wrap.is-picking .react-picker button:nth-child(2) { animation-delay: .025s; }
.react-wrap.is-picking .react-picker button:nth-child(3) { animation-delay: .05s; }
.react-wrap.is-picking .react-picker button:nth-child(4) { animation-delay: .075s; }
.react-wrap.is-picking .react-picker button:nth-child(5) { animation-delay: .1s; }
.react-wrap.is-picking .react-picker button:nth-child(6) { animation-delay: .125s; }

/* Comments */
.comments { padding: 4px 16px 14px; border-top: 1px solid var(--border); margin: 0 10px; padding-left: 6px; padding-right: 6px; }
.comment-list { display: grid; gap: 10px; padding: 12px 0 2px; }
.comment-list:empty { padding: 0; }
.comment { display: flex; gap: 9px; align-items: flex-start; animation: rise .3s var(--ease) both; }
.comment-main { min-width: 0; }
.bubble { background: var(--surface-3); border-radius: 18px; padding: 8px 14px 9px; width: fit-content; max-width: 100%; }
.c-author { font-size: 13.5px; }
.c-text { font-size: 14.5px; overflow-wrap: anywhere; }
.c-meta { display: flex; gap: 12px; padding: 3px 12px 0; font-size: 12px; color: var(--text-3); font-weight: 500; }
.c-meta button { font-weight: 600; color: var(--text-3); }
.c-meta button:hover { color: var(--danger); text-decoration: underline; }
.comment-form { display: flex; gap: 9px; align-items: center; margin-top: 12px; }
.comment-input { flex: 1; position: relative; display: flex; align-items: center; }
.comment-input input { width: 100%; height: 40px; padding: 0 46px 0 16px; border-radius: 999px; background: var(--surface-3); border: 1px solid transparent; outline: none; transition: border-color .2s, box-shadow .2s, background-color .2s; }
.comment-input input:focus { border-color: var(--accent); background: var(--surface); box-shadow: var(--ring); }
.comment-input .send { position: absolute; right: 3px; width: 34px; height: 34px; color: var(--accent); }
.comment-input .send .i { width: 17px; height: 17px; }
.comments-loading { display: grid; place-items: center; padding: 14px; }

.feed-sentinel { display: grid; place-items: center; padding: 24px; }
.feed-end { display: flex; align-items: center; justify-content: center; gap: 8px; padding: 24px; color: var(--text-3); font-weight: 500; font-size: 14px; }
.feed-end .i { width: 18px; height: 18px; color: var(--success); }
.spinner { width: 26px; height: 26px; border-radius: 50%; border: 3px solid var(--surface-3); border-top-color: var(--accent); animation: spin .8s linear infinite; display: inline-block; }

/* ---------- Empty state ---------- */
.empty { display: grid; justify-items: center; text-align: center; gap: 8px; padding: 44px 24px; }
.empty-ico { width: 64px; height: 64px; border-radius: 20px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); margin-bottom: 6px; transform: rotate(-6deg); }
.empty-ico .i { width: 28px; height: 28px; }
.empty h3 { font-size: 19px; }
.empty p { color: var(--text-2); max-width: 380px; }
.empty .btn { margin-top: 10px; }

/* ---------- Friend actions & user cards ---------- */
.friend-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.friend-actions.is-compact .btn { flex: 1; }
.user-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 16px; }
.user-card { overflow: hidden; display: flex; flex-direction: column; transition: transform .3s var(--ease), box-shadow .3s; }
.user-card:hover { transform: translateY(-3px); box-shadow: var(--shadow); }
.uc-cover { display: block; height: 76px; background: var(--grad); background-size: cover; background-position: center; opacity: .95; }
.uc-body { display: flex; flex-direction: column; align-items: center; text-align: center; padding: 0 14px 14px; flex: 1; }
.uc-body > .av-link, .uc-body > .av { margin-top: -34px; box-shadow: 0 0 0 4px var(--surface); border-radius: 50%; }
.uc-name { margin-top: 10px; font-size: 15px; }
.uc-sub { color: var(--text-3); font-size: 13px; margin-bottom: 14px; }
.uc-body .friend-actions { margin-top: auto; width: 100%; }

/* ---------- Tabs ---------- */
.tabs { display: flex; gap: 4px; overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tabs a { position: relative; display: inline-flex; align-items: center; gap: 7px; padding: 14px 16px; font-weight: 600; font-size: 14.5px; color: var(--text-2); white-space: nowrap; border-radius: 12px 12px 0 0; transition: color .2s, background-color .2s; }
.tabs a:hover { color: var(--text); background: var(--hover); }
.tabs a.is-active { color: var(--accent); }
.tabs a.is-active::after { content: ""; position: absolute; left: 12px; right: 12px; bottom: 0; height: 3px; border-radius: 3px 3px 0 0; background: var(--accent); }
.tabs a small { font-size: 12px; color: var(--text-3); font-weight: 600; }
.tabs a .i { width: 17px; height: 17px; }
.tabs-pill { gap: 6px; padding: 2px; }
.tabs-pill a { padding: 9px 16px; border-radius: 999px; background: var(--surface); border: 1px solid var(--border); }
.tabs-pill a.is-active { background: var(--text); color: var(--surface); border-color: var(--text); }
.tabs-pill a.is-active::after { display: none; }
.tabs-pill a.is-active small { color: inherit; opacity: .7; }

/* ---------- Profile ---------- */
.shell-profile { padding-top: 0; }
.profile-hero { max-width: 1100px; margin: 0 auto 20px; background: var(--surface); border: 1px solid var(--border); border-top: 0; border-radius: 0 0 var(--r-xl) var(--r-xl); box-shadow: var(--shadow-sm); overflow: hidden; }
.cover { position: relative; height: 340px; background: var(--grad); background-size: cover; background-position: center; }
.cover:not([style])::before { content: ""; position: absolute; inset: 0; background: radial-gradient(600px 300px at 80% 20%, rgba(255,255,255,.25), transparent 60%), radial-gradient(500px 260px at 10% 110%, rgba(0,0,0,.25), transparent 60%); }
.cover-shade { position: absolute; inset: 0; background: linear-gradient(180deg, transparent 55%, rgba(0,0,0,.28)); }
.cover-edit { position: absolute; right: 20px; bottom: 20px; }
.profile-bar { display: flex; align-items: flex-end; gap: 24px; padding: 0 32px 20px; }
.profile-avatar { position: relative; margin-top: -84px; flex: none; }
.profile-avatar .av { box-shadow: 0 0 0 5px var(--surface), var(--shadow); border-radius: 50%; }
.avatar-edit { position: absolute; right: 8px; bottom: 8px; width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; background: var(--surface-3); color: var(--text); border: 3px solid var(--surface); cursor: pointer; transition: background-color .2s, transform .2s var(--ease-spring); }
.avatar-edit:hover { background: var(--active); transform: scale(1.08); }
.avatar-edit .i { width: 18px; height: 18px; }
.profile-id { flex: 1; min-width: 0; padding-bottom: 6px; }
.profile-id h1 { font-size: 34px; letter-spacing: -.04em; display: flex; align-items: center; flex-wrap: wrap; }
.profile-id h1 .verified { width: 26px; height: 26px; margin-left: 8px; }
.profile-handle { color: var(--text-3); font-weight: 500; margin-top: 2px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.profile-counts { display: flex; gap: 18px; margin-top: 8px; color: var(--text-2); font-size: 14.5px; flex-wrap: wrap; }
.profile-counts b { color: var(--text); }
.profile-counts a:hover { text-decoration: underline; }
.face-stack { display: flex; margin-top: 10px; }
.face-stack .av { box-shadow: 0 0 0 2.5px var(--surface); margin-left: -7px; }
.face-stack .av:first-child { margin-left: 0; }
.profile-actions { padding-bottom: 8px; }
.profile-tabs { border-top: 1px solid var(--border); margin: 0 20px; }

.profile-grid { display: grid; grid-template-columns: 380px minmax(0, 1fr); gap: 20px; max-width: 1100px; margin: 0 auto; align-items: start; }
.profile-side { display: grid; gap: 16px; position: sticky; top: calc(var(--topbar-h) + 20px); }
.profile-main { display: grid; gap: 18px; min-width: 0; }
.side-card { padding: 18px; display: grid; gap: 14px; }
.side-card > h3, .side-card .rail-head h3 { font-size: 18px; }
.bio { color: var(--text); text-align: center; font-size: 15px; line-height: 1.55; }
.bio-lg { text-align: left; font-size: 16.5px; margin-bottom: 18px; }
.details { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; }
.details li { display: flex; gap: 12px; align-items: flex-start; color: var(--text-2); font-size: 14.5px; }
.details li .i { color: var(--text-3); margin-top: 1px; }
.details li b { color: var(--text); font-weight: 600; }
.details a { color: var(--accent); font-weight: 600; }
.details-lg li { font-size: 15.5px; padding: 6px 0; }
.photo-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; border-radius: 14px; overflow: hidden; }
.photo-grid a { aspect-ratio: 1; overflow: hidden; background: var(--surface-3); }
.photo-grid img { width: 100%; height: 100%; object-fit: cover; transition: transform .4s var(--ease); }
.photo-grid a:hover img { transform: scale(1.07); }
.friend-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px 10px; }
.friend-grid a { display: grid; gap: 6px; font-size: 12.5px; font-weight: 600; line-height: 1.25; }
.friend-grid a:hover span { text-decoration: underline; }
.masonry { columns: 3 260px; column-gap: 12px; }
.masonry-item { display: block; margin-bottom: 12px; border-radius: 14px; overflow: hidden; break-inside: avoid; background: var(--surface-3); }
.masonry-item img { width: 100%; transition: transform .5s var(--ease); }
.masonry-item:hover img { transform: scale(1.04); }

/* ---------- Search ---------- */
.search-hero { display: flex; align-items: center; gap: 12px; padding: 8px 8px 8px 20px; border-radius: 999px; }
.search-hero > .i { color: var(--text-3); }
.search-hero input[type=search] { flex: 1; height: 46px; border: 0; background: transparent; outline: none; font-size: 17px; min-width: 0; }
.feed-narrow { max-width: 640px; }

/* ---------- Notifications ---------- */
.notif-card { padding: 8px; }
.notif-group { font-size: 15px; padding: 12px 12px 6px; color: var(--text-2); font-family: var(--font); font-weight: 600; letter-spacing: 0; }
.notif { position: relative; display: flex; gap: 14px; align-items: center; padding: 10px 40px 10px 12px; border-radius: 14px; transition: background-color .15s; }
.notif:hover { background: var(--hover); }
.notif.is-unread { background: var(--accent-soft); }
.notif.is-unread:hover { background: var(--accent-soft-2); }
.notif-av { position: relative; flex: none; }
.notif-av .av { width: 54px; height: 54px; --s: 54px; }
.notif-type { position: absolute; right: -3px; bottom: -3px; width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; color: #fff; background: var(--info); box-shadow: 0 0 0 2.5px var(--surface); }
.notif-type .i { width: 13px; height: 13px; stroke-width: 2.6; }
.t-reaction { background: #E5384F; }
.t-comment { background: var(--success); }
.t-friend_request, .t-friend_accept { background: var(--accent); }
.notif-text { font-size: 14.5px; color: var(--text-2); line-height: 1.4; }
.notif-text b { color: var(--text); font-weight: 600; }
.notif-text small { display: block; margin-top: 2px; font-size: 12.5px; color: var(--accent); font-weight: 600; }
.notif:not(.is-unread) .notif-text small { color: var(--text-3); }
.unread-dot { position: absolute; right: 16px; width: 10px; height: 10px; border-radius: 50%; background: var(--accent); }

/* ---------- Messages ---------- */
.shell-chat { padding-bottom: 20px; }
.chat { display: grid; grid-template-columns: 360px minmax(0, 1fr); gap: 16px; max-width: 1240px; margin: 0 auto; height: calc(100vh - var(--topbar-h) - 44px); height: calc(100dvh - var(--topbar-h) - 44px); }
.chat-list { display: flex; flex-direction: column; overflow: hidden; }
.chat-list-head { padding: 18px 16px 12px; display: grid; gap: 12px; }
.chat-list-head h1 { font-size: 26px; letter-spacing: -.03em; }
.chat-filter .input { height: 40px; border-radius: 999px; }
.chat-list-scroll { flex: 1; overflow-y: auto; padding: 0 8px 8px; }
.chat-section { padding: 14px 10px 6px; font-size: 12px; font-weight: 700; color: var(--text-3); text-transform: uppercase; letter-spacing: .06em; }
.convo { display: flex; align-items: center; gap: 12px; padding: 10px; border-radius: 14px; transition: background-color .15s; }
.convo:hover { background: var(--hover); }
.convo.is-active { background: var(--accent-soft); }
.convo-main { flex: 1; min-width: 0; display: grid; gap: 1px; }
.convo-top { display: flex; justify-content: space-between; gap: 8px; align-items: baseline; }
.convo-top b { font-weight: 600; font-size: 14.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.convo-top time { font-size: 12px; color: var(--text-3); flex: none; }
.convo-last { font-size: 13.5px; color: var(--text-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.convo.is-unread .convo-last { color: var(--text); font-weight: 600; }
.chat-empty-list { padding: 20px 0; }

.chat-thread { display: flex; flex-direction: column; overflow: hidden; min-width: 0; }
.thread-head { display: flex; align-items: center; gap: 10px; padding: 12px 14px; border-bottom: 1px solid var(--border); }
.thread-back { display: none; }
.thread-who { display: flex; align-items: center; gap: 12px; flex: 1; min-width: 0; padding: 4px 8px 4px 4px; border-radius: 14px; }
.thread-who:hover { background: var(--hover); }
.thread-who span { display: grid; line-height: 1.3; min-width: 0; }
.thread-who b { font-size: 15.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.thread-who small { color: var(--text-3); font-size: 12.5px; }
.thread-body { flex: 1; overflow-y: auto; padding: 20px 18px; display: flex; flex-direction: column; gap: 3px; scroll-behavior: smooth; }
.thread-intro { display: grid; justify-items: center; text-align: center; gap: 4px; padding: 20px 0 30px; }
.thread-intro .av { width: 96px; height: 96px; --s: 96px; margin-bottom: 8px; }
.thread-intro h3 { font-size: 20px; }
.thread-intro p { color: var(--text-3); font-size: 14px; }
.msg { display: flex; flex-direction: column; align-items: flex-start; max-width: 72%; animation: rise .3s var(--ease) both; }
.msg.is-me { align-self: flex-end; align-items: flex-end; }
.msg-bubble { padding: 9px 14px; border-radius: 20px; background: var(--surface-3); font-size: 15px; line-height: 1.45; overflow-wrap: anywhere; }
.msg.is-me .msg-bubble { background: var(--accent); color: #fff; }
.msg.is-me .msg-bubble a { color: #fff; text-decoration: underline; }
.msg time { font-size: 11px; color: var(--text-3); padding: 2px 8px 6px; opacity: 0; max-height: 0; transition: opacity .2s, max-height .2s; }
.msg:hover time, .msg:last-child time { opacity: 1; max-height: 24px; }
.msg.is-pending .msg-bubble { opacity: .6; }
.thread-form { display: flex; align-items: flex-end; gap: 10px; padding: 12px 14px; border-top: 1px solid var(--border); }
.thread-form textarea { flex: 1; min-height: 44px; max-height: 160px; padding: 11px 18px; border-radius: 22px; resize: none; border: 1px solid transparent; background: var(--surface-3); outline: none; line-height: 1.4; transition: border-color .2s, box-shadow .2s, background-color .2s; }
.thread-form textarea:focus { border-color: var(--accent); background: var(--surface); box-shadow: var(--ring); }
.thread-form .btn-round .i { width: 19px; height: 19px; }
.thread-placeholder { flex: 1; display: grid; place-content: center; justify-items: center; text-align: center; gap: 8px; padding: 30px; }
.tp-art { width: 96px; height: 96px; border-radius: 30px; display: grid; place-items: center; background: var(--grad); color: #fff; margin-bottom: 10px; transform: rotate(-8deg); box-shadow: 0 20px 40px -12px rgba(240, 83, 43, .5); }
.tp-art .i { width: 44px; height: 44px; }
.thread-placeholder h2 { font-size: 26px; }
.thread-placeholder p { color: var(--text-2); max-width: 320px; }

/* ---------- Settings ---------- */
.settings { max-width: 860px; }
.settings-card { overflow: hidden; }
.settings-media { position: relative; margin-bottom: 70px; }
.sm-cover { height: 180px; background: var(--grad); background-size: cover; background-position: center; display: flex; align-items: flex-end; justify-content: flex-end; padding: 14px; }
.sm-avatar { position: absolute; left: 28px; bottom: -60px; }
.sm-avatar .av { width: 120px; height: 120px; --s: 120px; box-shadow: 0 0 0 5px var(--surface); border-radius: 50%; }
.sm-avatar .avatar-edit { right: 0; bottom: 0; }
.form-wide { padding: 0 28px 28px; }
.danger-zone { border-color: var(--danger-soft); }
.danger-zone .card-title .i { color: var(--danger); }
.danger-zone p { color: var(--text-2); margin-bottom: 18px; }

/* ---------- Toasts, modal, lightbox ---------- */
.toast-stack { position: fixed; z-index: 200; left: 50%; bottom: 24px; transform: translateX(-50%); display: grid; gap: 8px; justify-items: center; pointer-events: none; width: max-content; max-width: calc(100vw - 32px); }
.toast { pointer-events: auto; padding: 12px 18px; border-radius: 14px; background: var(--text); color: var(--surface); font-weight: 500; font-size: 14px; box-shadow: var(--shadow-lg); animation: toastIn .4s var(--ease-spring) both; display: flex; align-items: center; gap: 10px; }
.toast::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--success); flex: none; }
.toast-error::before { background: var(--danger); }
.toast-info::before { background: var(--info); }
.toast.is-leaving { animation: toastOut .3s var(--ease) forwards; }

.modal-backdrop { position: fixed; inset: 0; z-index: 150; background: rgba(10, 10, 12, .5); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); display: grid; place-items: center; padding: 16px; animation: fade .2s var(--ease); }
.modal { width: min(460px, 100%); background: var(--surface); border-radius: var(--r-xl); box-shadow: var(--shadow-lg); padding: 24px; animation: modalIn .35s var(--ease-spring); border: 1px solid var(--border); }
.modal h3 { font-size: 20px; margin-bottom: 6px; }
.modal p { color: var(--text-2); margin-bottom: 16px; }
.modal-options { display: grid; gap: 8px; margin-bottom: 16px; }
.modal-options label { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: 12px; border: 1px solid var(--border); cursor: pointer; font-weight: 500; transition: border-color .15s, background-color .15s; }
.modal-options label:hover { background: var(--hover); }
.modal-options input { accent-color: var(--accent); width: 18px; height: 18px; }
.modal-options label:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; }
.modal-backdrop.is-leaving { animation: fade .2s var(--ease) reverse forwards; }

.lightbox { position: fixed; inset: 0; z-index: 140; background: rgba(5, 5, 7, .92); display: grid; place-items: center; padding: 20px; animation: fade .2s var(--ease); cursor: zoom-out; }
.lightbox img { max-width: 100%; max-height: 92vh; border-radius: 12px; box-shadow: 0 30px 80px rgba(0,0,0,.5); animation: modalIn .35s var(--ease-spring); }
.lightbox-close { position: absolute; top: 16px; right: 16px; color: #fff; background: rgba(255,255,255,.1); }
.lightbox-close:hover { background: rgba(255,255,255,.2); color: #fff; }

/* ---------- Bottom nav (mobile) ---------- */
.bottom-nav { display: none; }

/* ---------- Auth ---------- */
.auth-shell { display: grid; grid-template-columns: 1.05fr 1fr; min-height: 100vh; min-height: 100dvh; }
.auth-art {
  position: relative; overflow: hidden;
  background: #0E0D10;
  color: #fff;
  padding: 44px 56px;
  display: flex;
}
.auth-art::before {
  content: ""; position: absolute; inset: -20%;
  background:
    radial-gradient(40% 35% at 75% 25%, rgba(255, 138, 61, .55), transparent 70%),
    radial-gradient(45% 40% at 20% 85%, rgba(210, 52, 106, .45), transparent 70%),
    radial-gradient(30% 30% at 50% 55%, rgba(240, 83, 43, .35), transparent 70%);
  filter: blur(20px);
  animation: drift 18s ease-in-out infinite alternate;
}
.auth-art::after {
  content: ""; position: absolute; inset: 0; opacity: .25; mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}
.auth-art-inner { position: relative; z-index: 1; display: flex; flex-direction: column; width: 100%; max-width: 620px; }
.brand-light .brand-name { color: #fff; }
.auth-title { font-size: clamp(44px, 5.4vw, 80px); line-height: .98; letter-spacing: -.05em; font-weight: 800; margin-top: auto; }
.auth-title em { font-style: normal; background: linear-gradient(100deg, #FFB37A, #FF6A3D 50%, #FF7BA6); -webkit-background-clip: text; background-clip: text; color: transparent; }
.auth-lead { margin-top: 20px; font-size: 17px; color: rgba(255,255,255,.72); max-width: 460px; line-height: 1.55; }
.float-stage { position: relative; height: 300px; margin-top: 40px; margin-bottom: auto; }
.float-card {
  position: absolute; color: var(--text);
  background: rgba(255,255,255,.96); border-radius: 18px;
  box-shadow: 0 30px 60px -20px rgba(0,0,0,.6), 0 0 0 1px rgba(255,255,255,.1);
  font-size: 13px;
  animation: float 7s ease-in-out infinite;
}
:root[data-theme="dark"] .float-card { background: rgba(28, 28, 33, .92); color: #F2F0ED; }
.fc-av { width: 34px; height: 34px; border-radius: 50%; flex: none; background: linear-gradient(140deg, hsl(var(--h) 85% 64%), hsl(calc(var(--h) + 40) 75% 48%)); }
.fc-post { left: 0; top: 0; width: 300px; padding: 14px; }
.fc-head { display: flex; gap: 10px; align-items: center; }
.fc-head span { display: grid; line-height: 1.25; }
.fc-head small { opacity: .55; }
.fc-post p { margin: 10px 0; font-size: 13.5px; }
.fc-img { height: 110px; border-radius: 12px; background: linear-gradient(180deg, #FFB37A 0%, #FF6A3D 45%, #7A2E6B 100%); position: relative; overflow: hidden; }
.fc-img::after { content: ""; position: absolute; left: -10%; right: -10%; bottom: -30px; height: 60px; background: #2A1B3D; border-radius: 50%; }
.fc-foot { display: flex; justify-content: space-between; margin-top: 10px; opacity: .7; }
.fc-chat { right: 10px; top: 40px; display: flex; gap: 10px; padding: 12px 16px 12px 12px; align-items: center; animation-delay: -2s; }
.fc-chat p { opacity: .7; }
.fc-react { right: 90px; top: 170px; padding: 10px 14px; font-size: 18px; animation-delay: -4s; border-radius: 999px; }
.fc-react b { font-size: 14px; }
.fc-friends { left: 150px; top: 240px; display: flex; align-items: center; gap: 10px; padding: 10px 14px 10px 10px; animation-delay: -1s; }
.fc-friends .stack { display: flex; }
.fc-friends .stack i { width: 28px; height: 28px; border-radius: 50%; margin-left: -8px; box-shadow: 0 0 0 2px #fff; background: linear-gradient(140deg, hsl(var(--h) 85% 64%), hsl(calc(var(--h) + 40) 75% 48%)); }
.fc-friends .stack i:first-child { margin-left: 0; }
.fc-friends span:last-child { display: grid; line-height: 1.25; }
.fc-friends small { opacity: .6; }

.auth-main { display: flex; flex-direction: column; padding: 28px 40px; background: var(--surface); }
.auth-top { display: flex; justify-content: flex-end; align-items: center; }
.auth-brand-mobile { display: none; margin-right: auto; }
.auth-card { width: 100%; max-width: 420px; margin: auto; padding: 28px 0; animation: rise .6s var(--ease) both; }
.auth-h { font-size: 34px; letter-spacing: -.04em; }
.auth-sub { color: var(--text-2); margin: 6px 0 28px; font-size: 15.5px; }
.auth-divider { display: flex; align-items: center; gap: 14px; margin: 22px 0; color: var(--text-3); font-size: 13px; }
.auth-divider::before, .auth-divider::after { content: ""; flex: 1; height: 1px; background: var(--border); }
.auth-switch { margin-top: 22px; text-align: center; color: var(--text-2); }
.auth-switch a { color: var(--accent); font-weight: 600; }
.auth-legal { text-align: center; font-size: 12.5px; color: var(--text-3); }
.auth .input { height: 50px; }

/* ---------- Install ---------- */
.install-wrap { max-width: 640px; margin: 0 auto; padding: 48px 20px 80px; display: grid; gap: 20px; }
.install-brand { display: flex; gap: 16px; align-items: center; }
.install-brand h1 { font-size: 30px; letter-spacing: -.035em; }
.install-brand p { color: var(--text-2); }

/* ---------- Animations ---------- */
@keyframes rise { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
@keyframes shrink { to { opacity: 0; transform: scale(.96); } }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes pop { from { transform: translateX(22px) scale(.4); } to { transform: translateX(22px) scale(1); } }
@keyframes bump { 0% { transform: scale(1); } 40% { transform: scale(1.45) rotate(-10deg); } 100% { transform: scale(1); } }
@keyframes pickIn { from { opacity: 0; transform: translateY(12px) scale(.4); } to { opacity: 1; transform: none; } }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes toastIn { from { opacity: 0; transform: translateY(16px) scale(.95); } to { opacity: 1; transform: none; } }
@keyframes toastOut { to { opacity: 0; transform: translateY(10px) scale(.96); } }
@keyframes modalIn { from { opacity: 0; transform: translateY(14px) scale(.96); } to { opacity: 1; transform: none; } }
@keyframes float { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-12px); } }
@keyframes drift { from { transform: translate3d(-3%, -2%, 0) rotate(0deg); } to { transform: translate3d(3%, 2%, 0) rotate(8deg); } }

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

/* ---------- Responsive ---------- */
@media (max-width: 1240px) {
  .layout-3 { grid-template-columns: 260px minmax(0, 620px); }
  .col-right { display: none; }
  .tb-tab { width: 80px; }
}

@media (max-width: 1020px) {
  .profile-grid { grid-template-columns: 1fr; }
  .profile-side { position: static; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }
  .chat { grid-template-columns: 300px minmax(0, 1fr); }
}

@media (max-width: 900px) {
  :root { --topbar-h: 58px; }
  .topbar { grid-template-columns: 1fr auto; padding: 0 12px; }
  .tb-center, .tb-search { display: none; }
  .tb-mobile-search { display: inline-grid; }
  .brand-name { font-size: 21px; }
  .layout-3, .layout-2 { grid-template-columns: minmax(0, 1fr); max-width: 640px; }
  .layout-2 { max-width: 900px; }
  .col-left { display: none; }
  .shell { padding: 14px 12px 96px; }
  .shell-profile { padding: 0 0 96px; }

  .bottom-nav {
    position: fixed; z-index: 60; left: 0; right: 0; bottom: 0;
    display: grid; grid-template-columns: repeat(5, 1fr);
    padding: 6px 6px calc(6px + env(safe-area-inset-bottom));
    background: color-mix(in srgb, var(--surface) 88%, transparent);
    backdrop-filter: saturate(180%) blur(18px);
    -webkit-backdrop-filter: saturate(180%) blur(18px);
    border-top: 1px solid var(--border);
  }
  .bottom-nav a { position: relative; display: grid; justify-items: center; gap: 3px; padding: 6px 0 4px; font-size: 11px; font-weight: 600; color: var(--text-3); border-radius: 12px; }
  .bottom-nav a .i { width: 23px; height: 23px; }
  .bottom-nav a.is-active { color: var(--accent); }
  .bottom-nav .badge { top: 0; transform: translateX(16px); animation: none; }
  .bottom-nav .av-xs { width: 23px; height: 23px; }
  .bottom-nav a.is-active .av { box-shadow: 0 0 0 2px var(--accent); }
  .toast-stack { bottom: 90px; }

  .profile-hero { border-radius: 0; border-left: 0; border-right: 0; }
  .cover { height: 210px; }
  .cover-edit span { display: none; }
  .profile-bar { flex-direction: column; align-items: center; text-align: center; gap: 12px; padding: 0 18px 16px; }
  .profile-avatar { margin-top: -70px; }
  .av-xl { width: 132px; height: 132px; --s: 132px; }
  .profile-id h1 { font-size: 27px; justify-content: center; }
  .profile-handle, .profile-counts, .face-stack { justify-content: center; }
  .profile-actions .friend-actions { justify-content: center; }
  .profile-tabs { margin: 0 8px; }
  .profile-grid, .wide, .narrow { padding: 0 12px; }

  .chat { grid-template-columns: 1fr; height: calc(100dvh - var(--topbar-h) - 28px - 70px); }
  .chat.has-thread .chat-list { display: none; }
  .chat:not(.has-thread) .chat-thread { display: none; }
  .thread-back { display: inline-grid; }
  .msg { max-width: 85%; }

  .auth-shell { grid-template-columns: 1fr; }
  .auth-art { display: none; }
  .auth-main { padding: 18px 22px; }
  .auth-brand-mobile { display: inline-flex; }
}

@media (max-width: 560px) {
  .form-row { grid-template-columns: 1fr; }
  .pad-lg { padding: 20px; }
  .page-head h1 { font-size: 26px; }
  .post-head { padding-left: 14px; }
  .post-body { padding-left: 14px; padding-right: 14px; }
  .post-body.is-large { font-size: 20px; }
  .pa-btn span { font-size: 13px; }
  .pa-btn { gap: 6px; }
  .user-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .uc-body .friend-actions .btn span { display: none; }
  .story { width: 100px; height: 168px; }
  .composer textarea { font-size: 16px; }
  .search-hero .btn { display: none; }
  .tabs a { padding: 12px 12px; }
  .settings-media { margin-bottom: 60px; }
  .sm-avatar { left: 50%; transform: translateX(-50%); }
  .form-wide { padding: 0 18px 20px; }
  .react-picker button { width: 38px; height: 38px; font-size: 24px; }
}
