/* =====================================================================
   ORBIT — Design System
   A calm, glassy, motion-aware interface. Hue is user-controlled.
   ===================================================================== */

/* ---------- Tokens ---------- */
:root {
  --hue: 258;

  /* accent ramp derived from a single hue */
  --a-50:  hsl(var(--hue) 90% 96%);
  --a-100: hsl(var(--hue) 90% 90%);
  --a-300: hsl(var(--hue) 88% 76%);
  --a-400: hsl(var(--hue) 88% 68%);
  --a-500: hsl(var(--hue) 86% 60%);
  --a-600: hsl(var(--hue) 80% 52%);
  --a-700: hsl(var(--hue) 76% 42%);
  --a2:    hsl(calc(var(--hue) + 58) 88% 62%);
  --a3:    hsl(calc(var(--hue) - 42) 88% 62%);

  --ok:   hsl(152 72% 45%);
  --warn: hsl(38 95% 58%);
  --err:  hsl(352 85% 62%);
  --info: hsl(205 90% 60%);

  /* geometry */
  --r-xs: 8px;  --r-sm: 12px; --r: 16px; --r-lg: 22px; --r-xl: 28px; --r-full: 999px;
  --sp: 4px;
  --rail-w: 250px;
  --aside-w: 320px;
  --feed-w: 620px;
  --header-h: 62px;
  --tabbar-h: 64px;

  /* motion */
  --ease: cubic-bezier(.22, 1, .36, 1);
  --ease-bounce: cubic-bezier(.2, 1.5, .4, 1);
  --t-fast: .14s; --t: .24s; --t-slow: .42s;

  --font: -apple-system, BlinkMacSystemFont, 'Segoe UI', Inter, Roboto, 'Helvetica Neue', sans-serif;
  --mono: ui-monospace, SFMono-Regular, 'SF Mono', Menlo, monospace;
}

/* ---------- Dark (default) ---------- */
:root, [data-theme="dark"] {
  --bg:       hsl(230 28% 5%);
  --bg-deep:  hsl(232 32% 3%);
  --surface:  hsl(230 24% 9%);
  --surface-2:hsl(230 22% 12%);
  --glass:    hsla(230, 30%, 100%, .045);
  --glass-2:  hsla(230, 30%, 100%, .075);
  --line:     hsla(230, 30%, 100%, .085);
  --line-2:   hsla(230, 30%, 100%, .14);
  --text:     hsl(228 30% 95%);
  --text-2:   hsl(228 14% 68%);
  --text-3:   hsl(228 12% 50%);
  --shadow:   0 24px 60px hsla(230, 60%, 2%, .6);
  --shadow-sm:0 4px 16px hsla(230, 60%, 2%, .4);
  --glow:     0 0 0 1px hsla(var(--hue), 90%, 70%, .2), 0 12px 40px hsla(var(--hue), 90%, 50%, .22);
  color-scheme: dark;
}

/* ---------- Light ---------- */
[data-theme="light"] {
  --bg:       hsl(230 40% 98%);
  --bg-deep:  hsl(230 44% 96%);
  --surface:  hsl(0 0% 100%);
  --surface-2:hsl(230 40% 97%);
  --glass:    hsla(230, 40%, 100%, .72);
  --glass-2:  hsla(230, 40%, 100%, .9);
  --line:     hsla(230, 30%, 12%, .09);
  --line-2:   hsla(230, 30%, 12%, .16);
  --text:     hsl(230 32% 12%);
  --text-2:   hsl(230 12% 40%);
  --text-3:   hsl(230 10% 56%);
  --shadow:   0 20px 50px hsla(230, 40%, 40%, .13);
  --shadow-sm:0 2px 10px hsla(230, 40%, 40%, .09);
  --glow:     0 0 0 1px hsla(var(--hue), 90%, 55%, .25), 0 10px 34px hsla(var(--hue), 90%, 55%, .18);
  color-scheme: light;
}

/* ---------- Reset ---------- */
*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  font: 15px/1.6 var(--font);
  background: var(--bg);
  color: var(--text);
  min-height: 100dvh;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
  text-rendering: optimizeLegibility;
}
img, svg, video { display: block; max-width: 100%; }
button, input, textarea, select { font: inherit; color: inherit; }
button { background: none; border: 0; cursor: pointer; }
a { color: inherit; text-decoration: none; }
ul, ol { list-style: none; padding: 0; }
:focus-visible { outline: 2px solid var(--a-400); outline-offset: 2px; border-radius: 4px; }
::selection { background: hsla(var(--hue), 90%, 60%, .3); }

/* Ambient background wash */
body::before {
  content: ''; position: fixed; inset: 0; z-index: -2; pointer-events: none;
  background:
    radial-gradient(52vw 52vw at 8% -8%,  hsla(var(--hue), 92%, 55%, .16), transparent 62%),
    radial-gradient(46vw 46vw at 104% 4%, hsla(calc(var(--hue) + 60), 92%, 55%, .13), transparent 62%),
    radial-gradient(60vw 42vw at 50% 108%,hsla(calc(var(--hue) - 45), 92%, 55%, .10), transparent 66%);
}
[data-theme="light"] body::before { opacity: .55; }

/* ---------- Utilities ---------- */
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; overflow: hidden;
  clip: rect(0,0,0,0); white-space: nowrap; border: 0;
}
.muted   { color: var(--text-2); }
.dim     { color: var(--text-3); }
.tiny    { font-size: 12.5px; }
.small   { font-size: 13.5px; }
.bold    { font-weight: 650; }
.center  { text-align: center; }
.truncate{ overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.clamp-2 { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.clamp-3 { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.row     { display: flex; align-items: center; gap: 10px; }
.row-b   { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.col     { display: flex; flex-direction: column; }
.wrap    { flex-wrap: wrap; }
.grow    { flex: 1; min-width: 0; }
.gap-sm  { gap: 6px; } .gap-lg { gap: 18px; }
.mt      { margin-top: 16px; } .mt-lg { margin-top: 28px; }
.mb      { margin-bottom: 16px; }
.hide    { display: none !important; }

/* ---------- Glass surface ---------- */
.glass {
  background: var(--glass);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  backdrop-filter: blur(20px) saturate(160%);
  -webkit-backdrop-filter: blur(20px) saturate(160%);
}
.card {
  background: var(--glass);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  backdrop-filter: blur(18px) saturate(150%);
  -webkit-backdrop-filter: blur(18px) saturate(150%);
  box-shadow: var(--shadow-sm);
  transition: border-color var(--t) var(--ease), transform var(--t) var(--ease);
}
.card-pad { padding: 18px; }

/* =====================================================================
   LAYOUT
   ===================================================================== */
.shell {
  display: grid;
  grid-template-columns: var(--rail-w) minmax(0, var(--feed-w)) var(--aside-w);
  gap: 26px;
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 22px 120px;
  align-items: start;
}
.shell.wide { grid-template-columns: var(--rail-w) minmax(0, 1fr); max-width: 1180px; }
.shell.solo { grid-template-columns: minmax(0, 760px); justify-content: center; }

/* ---------- Top bar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 60;
  height: var(--header-h);
  display: flex; align-items: center; gap: 14px;
  padding: 0 22px;
  background: color-mix(in srgb, var(--bg) 72%, transparent);
  backdrop-filter: blur(18px) saturate(170%);
  -webkit-backdrop-filter: blur(18px) saturate(170%);
  border-bottom: 1px solid var(--line);
}
.topbar .inner { display: flex; align-items: center; gap: 14px; width: 100%; max-width: 1280px; margin: 0 auto; }

.brand { display: flex; align-items: center; gap: 11px; font-weight: 750; letter-spacing: -.03em; font-size: 18px; }
.brand .orb {
  width: 34px; height: 34px; border-radius: 11px; display: grid; place-items: center;
  background: linear-gradient(135deg, var(--a-400), var(--a2));
  box-shadow: 0 6px 20px hsla(var(--hue), 90%, 55%, .4);
  color: #0a0a12; font-size: 16px; font-weight: 800;
  position: relative; overflow: hidden;
}
.brand .orb::after {
  content: ''; position: absolute; inset: -50%;
  background: conic-gradient(from 0deg, transparent, hsla(0,0%,100%,.5), transparent);
  animation: spin 5s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Search trigger (⌘K) ---------- */
.omni {
  flex: 1; max-width: 420px;
  display: flex; align-items: center; gap: 10px;
  height: 40px; padding: 0 14px;
  border-radius: var(--r-full);
  background: var(--glass); border: 1px solid var(--line);
  color: var(--text-3); font-size: 14px;
  transition: all var(--t) var(--ease);
}
.omni:hover { border-color: var(--line-2); background: var(--glass-2); }
.kbd {
  margin-left: auto; font: 600 11px var(--mono);
  padding: 3px 7px; border-radius: 6px;
  background: var(--glass-2); border: 1px solid var(--line); color: var(--text-3);
}

/* ---------- Icon buttons ---------- */
.ibtn {
  position: relative;
  width: 40px; height: 40px; border-radius: var(--r-full);
  display: grid; place-items: center;
  color: var(--text-2);
  transition: all var(--t) var(--ease);
}
.ibtn:hover { background: var(--glass-2); color: var(--text); transform: translateY(-1px); }
.ibtn.active { color: var(--a-400); }
.ibtn svg { width: 21px; height: 21px; }

.dot {
  position: absolute; top: 6px; right: 6px;
  min-width: 17px; height: 17px; padding: 0 4px;
  border-radius: var(--r-full);
  background: linear-gradient(135deg, var(--err), hsl(14 90% 58%));
  color: #fff; font: 700 10px/17px var(--font); text-align: center;
  border: 2px solid var(--bg);
  animation: pop .3s var(--ease-bounce);
}
@keyframes pop { from { transform: scale(0); } to { transform: scale(1); } }

/* =====================================================================
   LEFT RAIL
   ===================================================================== */
.rail { position: sticky; top: calc(var(--header-h) + 18px); padding-top: 18px; }
.nav { display: flex; flex-direction: column; gap: 3px; }
.nav a {
  display: flex; align-items: center; gap: 14px;
  padding: 11px 15px; border-radius: var(--r);
  color: var(--text-2); font-weight: 550; font-size: 15px;
  position: relative; transition: all var(--t) var(--ease);
}
.nav a svg { width: 22px; height: 22px; flex: none; }
.nav a:hover { background: var(--glass); color: var(--text); }
.nav a.active { color: var(--text); background: var(--glass-2); font-weight: 650; }
.nav a.active::before {
  content: ''; position: absolute; left: 0; top: 50%; transform: translateY(-50%);
  width: 3px; height: 22px; border-radius: 0 3px 3px 0;
  background: linear-gradient(180deg, var(--a-400), var(--a2));
}
.nav .pill {
  margin-left: auto; min-width: 20px; height: 20px; padding: 0 6px;
  border-radius: var(--r-full); background: var(--a-500); color: #0a0a12;
  font: 700 11px/20px var(--font); text-align: center;
}

.btn-compose {
  margin-top: 14px; width: 100%;
  display: flex; align-items: center; justify-content: center; gap: 9px;
  padding: 14px; border-radius: var(--r);
  background: linear-gradient(135deg, var(--a-500), var(--a2));
  color: #0a0a12; font-weight: 700; font-size: 15px;
  box-shadow: 0 10px 28px hsla(var(--hue), 90%, 50%, .32);
  transition: transform var(--t) var(--ease), box-shadow var(--t) var(--ease), filter var(--t);
}
.btn-compose:hover { transform: translateY(-2px); filter: brightness(1.07); box-shadow: 0 16px 38px hsla(var(--hue), 90%, 50%, .42); }
.btn-compose:active { transform: translateY(0) scale(.98); }

.me-chip {
  margin-top: 18px; display: flex; align-items: center; gap: 11px;
  padding: 9px; border-radius: var(--r); transition: background var(--t);
}
.me-chip:hover { background: var(--glass); }

/* =====================================================================
   AVATARS
   ===================================================================== */
.av {
  --size: 42px;
  width: var(--size); height: var(--size);
  border-radius: var(--r-full); object-fit: cover; flex: none;
  background: var(--surface-2);
  box-shadow: 0 0 0 1px var(--line);
}
.av.xs { --size: 26px; } .av.sm { --size: 34px; }
.av.lg { --size: 56px; } .av.xl { --size: 96px; } .av.xxl { --size: 132px; }

.av-wrap { position: relative; flex: none; }
.online-dot {
  position: absolute; right: 0; bottom: 0;
  width: 12px; height: 12px; border-radius: var(--r-full);
  background: var(--ok); border: 2.5px solid var(--bg);
}

/* story ring */
.ring {
  padding: 2.5px; border-radius: var(--r-full);
  background: conic-gradient(from 210deg, var(--a-400), var(--a2), var(--a3), var(--a-400));
  transition: transform var(--t) var(--ease);
}
.ring.seen { background: var(--line-2); }
.ring:hover { transform: scale(1.05); }
.ring > * { border: 2.5px solid var(--bg); }

/* =====================================================================
   BUTTONS
   ===================================================================== */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 10px 20px; border-radius: var(--r-full);
  font-weight: 650; font-size: 14.5px; white-space: nowrap;
  background: linear-gradient(135deg, var(--a-500), var(--a2)); color: #0a0a12;
  transition: transform var(--t-fast) var(--ease), filter var(--t-fast), box-shadow var(--t-fast), background var(--t);
  box-shadow: 0 6px 18px hsla(var(--hue), 90%, 50%, .26);
}
.btn:hover { transform: translateY(-1.5px); filter: brightness(1.07); }
.btn:active { transform: scale(.97); }
.btn:disabled { opacity: .5; pointer-events: none; }
.btn.ghost   { background: var(--glass); color: var(--text); border: 1px solid var(--line); box-shadow: none; }
.btn.ghost:hover { background: var(--glass-2); border-color: var(--line-2); }
.btn.outline { background: transparent; color: var(--a-400); border: 1.5px solid var(--a-500); box-shadow: none; }
.btn.danger  { background: linear-gradient(135deg, var(--err), hsl(14 88% 56%)); color: #fff; }
.btn.sm      { padding: 7px 15px; font-size: 13.5px; }
.btn.lg      { padding: 14px 28px; font-size: 16px; }
.btn.block   { width: 100%; }
.btn.icon    { padding: 10px; width: 40px; }

/* =====================================================================
   VIBE CHIPS  (feed filters + composer moods)
   ===================================================================== */
.vibes {
  display: flex; gap: 8px; overflow-x: auto; padding: 4px 0 12px;
  scrollbar-width: none; -ms-overflow-style: none;
  scroll-snap-type: x proximity;
}
.vibes::-webkit-scrollbar { display: none; }
.vibe {
  --vh: 220;
  display: inline-flex; align-items: center; gap: 7px; flex: none;
  padding: 8px 15px; border-radius: var(--r-full);
  font-size: 13.5px; font-weight: 600; white-space: nowrap;
  background: var(--glass); border: 1px solid var(--line); color: var(--text-2);
  transition: all var(--t) var(--ease); scroll-snap-align: start;
}
.vibe:hover { border-color: hsla(var(--vh), 85%, 60%, .5); color: var(--text); transform: translateY(-1px); }
.vibe.on {
  background: hsla(var(--vh), 85%, 58%, .16);
  border-color: hsla(var(--vh), 85%, 60%, .55);
  color: hsl(var(--vh) 85% 72%);
  box-shadow: 0 4px 16px hsla(var(--vh), 85%, 55%, .2);
}
[data-theme="light"] .vibe.on { color: hsl(var(--vh) 70% 38%); }

/* =====================================================================
   COMPOSER
   ===================================================================== */
.composer { padding: 16px 18px; margin-bottom: 20px; }
.composer textarea {
  width: 100%; border: 0; background: transparent; resize: none;
  font-size: 17px; line-height: 1.55; min-height: 54px; max-height: 340px;
  outline: none; color: var(--text);
}
.composer textarea::placeholder { color: var(--text-3); }
.composer-foot {
  display: flex; align-items: center; gap: 6px; flex-wrap: wrap;
  padding-top: 12px; margin-top: 10px; border-top: 1px solid var(--line);
}
.tool {
  width: 36px; height: 36px; border-radius: var(--r-full);
  display: grid; place-items: center; color: var(--text-2);
  transition: all var(--t) var(--ease);
}
.tool:hover { background: hsla(var(--hue), 90%, 60%, .14); color: var(--a-400); transform: translateY(-1px); }
.tool.on { background: hsla(var(--hue), 90%, 60%, .18); color: var(--a-400); }
.tool svg { width: 19px; height: 19px; }

.counter {
  width: 26px; height: 26px; transform: rotate(-90deg);
}
.counter circle { fill: none; stroke-width: 2.5; }
.counter .track { stroke: var(--line-2); }
.counter .val { stroke: var(--a-400); stroke-linecap: round; transition: stroke-dashoffset .25s var(--ease), stroke .25s; }
.counter.warn .val { stroke: var(--warn); }
.counter.over .val { stroke: var(--err); }

.media-grid {
  display: grid; gap: 6px; margin-top: 12px;
  border-radius: var(--r); overflow: hidden;
}
.media-grid.n1 { grid-template-columns: 1fr; }
.media-grid.n2 { grid-template-columns: 1fr 1fr; }
.media-grid.n3 { grid-template-columns: 2fr 1fr; grid-template-rows: 1fr 1fr; }
.media-grid.n3 > :first-child { grid-row: span 2; }
.media-grid.n4 { grid-template-columns: 1fr 1fr; }
.media-grid img, .media-grid video {
  width: 100%; height: 100%; object-fit: cover; aspect-ratio: 4/3; background: var(--surface-2);
}
.media-grid.n1 img, .media-grid.n1 video { aspect-ratio: auto; max-height: 560px; }
.media-item { position: relative; overflow: hidden; }
.media-item .rm {
  position: absolute; top: 8px; right: 8px; width: 28px; height: 28px;
  border-radius: var(--r-full); background: rgba(0,0,0,.62); color: #fff;
  display: grid; place-items: center; backdrop-filter: blur(6px); font-size: 15px;
}

/* audience / schedule popovers */
.pop {
  position: absolute; z-index: 90; min-width: 250px;
  background: var(--surface); border: 1px solid var(--line-2);
  border-radius: var(--r-lg); box-shadow: var(--shadow); padding: 8px;
  backdrop-filter: blur(24px); animation: popIn .18s var(--ease);
}
@keyframes popIn { from { opacity: 0; transform: translateY(6px) scale(.97); } }
.pop-item {
  display: flex; align-items: flex-start; gap: 11px; width: 100%;
  padding: 10px 12px; border-radius: var(--r-sm); text-align: left;
  transition: background var(--t-fast);
}
.pop-item:hover { background: var(--glass-2); }
.pop-item.on { background: hsla(var(--hue), 90%, 60%, .14); }
.pop-item .ic { font-size: 17px; line-height: 1.2; }
.pop-item b { display: block; font-size: 14px; font-weight: 600; }
.pop-item span { display: block; font-size: 12px; color: var(--text-3); margin-top: 1px; }

/* =====================================================================
   POST CARD
   ===================================================================== */
.post {
  padding: 17px 18px; margin-bottom: 14px;
  animation: rise .38s var(--ease) both;
}
@keyframes rise { from { opacity: 0; transform: translateY(14px); } }
.post:hover { border-color: var(--line-2); }

.post-head { display: flex; align-items: flex-start; gap: 11px; margin-bottom: 11px; }
.post-who { min-width: 0; flex: 1; }
.post-name { display: flex; align-items: center; gap: 5px; font-weight: 650; font-size: 15px; }
.post-name a:hover { text-decoration: underline; }
.verified { width: 15px; height: 15px; color: var(--info); flex: none; }
.post-meta { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--text-3); margin-top: 1px; }
.post-meta .sep::before { content: '·'; }

.chip {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 2px 8px; border-radius: var(--r-full);
  font-size: 11.5px; font-weight: 600;
  background: var(--glass-2); border: 1px solid var(--line); color: var(--text-2);
}
.chip.vibe-chip { background: hsla(var(--vh, 220), 85%, 58%, .15); border-color: hsla(var(--vh, 220), 85%, 58%, .35); color: hsl(var(--vh, 220) 85% 72%); }
[data-theme="light"] .chip.vibe-chip { color: hsl(var(--vh, 220) 70% 38%); }

.post-body { font-size: 15.5px; line-height: 1.62; overflow-wrap: anywhere; }
.post-body a { color: var(--a-400); }
.post-body a:hover { text-decoration: underline; }
.post-body .mention, .post-body .hashtag { font-weight: 600; }

.post-actions {
  display: flex; align-items: center; gap: 2px;
  margin-top: 12px; padding-top: 10px; border-top: 1px solid var(--line);
}
.act {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 7px 12px; border-radius: var(--r-full);
  color: var(--text-3); font-size: 13.5px; font-weight: 600;
  transition: all var(--t-fast) var(--ease);
}
.act svg { width: 19px; height: 19px; }
.act:hover { background: var(--glass-2); color: var(--text); }
.act.react:hover, .act.react.on { color: var(--err); }
.act.comment:hover { color: var(--info); }
.act.share:hover, .act.share.on { color: var(--ok); }
.act.save:hover, .act.save.on { color: var(--a-400); }
.act.on svg { fill: currentColor; }
.act .n { font-variant-numeric: tabular-nums; }
.act.bump { animation: bump .42s var(--ease-bounce); }
@keyframes bump { 40% { transform: scale(1.28); } }

/* reaction picker */
.reactbar {
  position: absolute; bottom: calc(100% + 8px); left: -6px; z-index: 80;
  display: flex; gap: 3px; padding: 7px;
  background: var(--surface); border: 1px solid var(--line-2);
  border-radius: var(--r-full); box-shadow: var(--shadow);
  animation: reactIn .22s var(--ease-bounce);
}
@keyframes reactIn { from { opacity: 0; transform: translateY(10px) scale(.85); } }
.reactbar button {
  width: 40px; height: 40px; border-radius: var(--r-full); font-size: 23px;
  display: grid; place-items: center;
  transition: transform var(--t-fast) var(--ease-bounce), background var(--t-fast);
}
.reactbar button:hover { transform: scale(1.32) translateY(-4px); background: var(--glass-2); }

.react-stack { display: flex; align-items: center; gap: -4px; }
.react-stack .em {
  width: 21px; height: 21px; border-radius: var(--r-full);
  display: grid; place-items: center; font-size: 12px;
  background: var(--surface-2); border: 1.5px solid var(--bg); margin-right: -6px;
}

/* burst particles on reaction */
.burst { position: absolute; pointer-events: none; font-size: 15px; animation: burst .8s var(--ease) forwards; }
@keyframes burst {
  0%   { opacity: 1; transform: translate(0,0) scale(.6); }
  100% { opacity: 0; transform: translate(var(--bx, 0), var(--by, -46px)) scale(1.3); }
}

/* quoted post */
.quoted {
  margin-top: 12px; padding: 13px; border-radius: var(--r);
  border: 1px solid var(--line); background: var(--glass);
  transition: border-color var(--t);
}
.quoted:hover { border-color: var(--line-2); }

/* capsule locked state */
.capsule {
  position: relative; margin-top: 10px; padding: 26px 20px;
  border-radius: var(--r-lg); text-align: center; overflow: hidden;
  border: 1px dashed hsla(var(--hue), 90%, 62%, .45);
  background: linear-gradient(140deg, hsla(var(--hue), 90%, 55%, .12), hsla(calc(var(--hue) + 60), 90%, 55%, .08));
}
.capsule::after {
  content: ''; position: absolute; inset: 0;
  background: repeating-linear-gradient(45deg, transparent, transparent 12px, hsla(0,0%,100%,.02) 12px, hsla(0,0%,100%,.02) 24px);
  pointer-events: none;
}
.capsule .lock { font-size: 30px; margin-bottom: 8px; animation: float 3.5s ease-in-out infinite; }
@keyframes float { 50% { transform: translateY(-7px); } }
.capsule .when {
  display: inline-flex; align-items: center; gap: 7px; margin-top: 11px;
  padding: 7px 15px; border-radius: var(--r-full);
  background: var(--glass-2); border: 1px solid var(--line-2);
  font-size: 13px; font-weight: 650; font-variant-numeric: tabular-nums;
}

/* poll */
.poll { margin-top: 13px; display: flex; flex-direction: column; gap: 8px; }
.poll-opt {
  position: relative; width: 100%; text-align: left;
  padding: 12px 15px; border-radius: var(--r);
  border: 1px solid var(--line); background: var(--glass);
  font-size: 14.5px; font-weight: 550; overflow: hidden;
  transition: all var(--t) var(--ease);
}
.poll-opt:hover { border-color: var(--a-500); }
.poll-opt .fill {
  position: absolute; inset: 0 auto 0 0; width: 0;
  background: hsla(var(--hue), 90%, 58%, .18);
  transition: width .6s var(--ease); z-index: 0;
}
.poll-opt.mine { border-color: var(--a-500); }
.poll-opt.mine .fill { background: hsla(var(--hue), 90%, 58%, .3); }
.poll-opt > span { position: relative; z-index: 1; display: flex; justify-content: space-between; gap: 12px; }

/* link preview */
.link-card {
  display: flex; gap: 0; margin-top: 12px; overflow: hidden;
  border: 1px solid var(--line); border-radius: var(--r);
  transition: border-color var(--t);
}
.link-card:hover { border-color: var(--line-2); }
.link-card img { width: 120px; height: 100px; object-fit: cover; flex: none; }
.link-card .lc-body { padding: 11px 13px; min-width: 0; }

/* =====================================================================
   STORIES RAIL
   ===================================================================== */
.story-rail {
  display: flex; gap: 14px; overflow-x: auto; padding: 4px 2px 16px;
  scrollbar-width: none;
}
.story-rail::-webkit-scrollbar { display: none; }
.story-item { flex: none; width: 72px; text-align: center; }
.story-item .label {
  display: block; margin-top: 7px; font-size: 11.5px; color: var(--text-2);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.story-add {
  width: 62px; height: 62px; border-radius: var(--r-full);
  display: grid; place-items: center; font-size: 25px;
  border: 2px dashed var(--line-2); color: var(--text-3);
  transition: all var(--t) var(--ease);
}
.story-add:hover { border-color: var(--a-500); color: var(--a-400); transform: scale(1.05); }

/* story viewer */
.viewer { position: fixed; inset: 0; z-index: 200; background: #000; display: grid; place-items: center; }
.viewer .frame {
  position: relative; width: min(100vw, 460px); height: min(100dvh, 860px);
  border-radius: 0; overflow: hidden; background: #0a0a12;
}
@media (min-width: 560px) { .viewer .frame { border-radius: var(--r-xl); } }
.viewer img, .viewer video { width: 100%; height: 100%; object-fit: contain; }
.viewer .bars { position: absolute; top: 12px; left: 12px; right: 12px; display: flex; gap: 4px; z-index: 5; }
.viewer .bar { flex: 1; height: 2.5px; border-radius: 2px; background: rgba(255,255,255,.28); overflow: hidden; }
.viewer .bar i { display: block; height: 100%; width: 0; background: #fff; border-radius: 2px; }
.viewer .bar.done i { width: 100%; }
.viewer .top { position: absolute; top: 28px; left: 14px; right: 14px; display: flex; align-items: center; gap: 10px; z-index: 5; color: #fff; }
.viewer .tap { position: absolute; top: 0; bottom: 90px; width: 34%; z-index: 4; }
.viewer .tap.prev { left: 0; } .viewer .tap.next { right: 0; }
.viewer .foot { position: absolute; left: 0; right: 0; bottom: 0; padding: 18px; z-index: 6;
  background: linear-gradient(transparent, rgba(0,0,0,.75)); color: #fff; }

/* =====================================================================
   REELS
   ===================================================================== */
.reels {
  height: 100dvh; overflow-y: auto; scroll-snap-type: y mandatory;
  scrollbar-width: none; background: #000;
}
.reels::-webkit-scrollbar { display: none; }
.reel {
  position: relative; height: 100dvh; scroll-snap-align: start; scroll-snap-stop: always;
  display: grid; place-items: center; overflow: hidden;
}
.reel video { width: 100%; height: 100%; object-fit: contain; }
.reel .overlay {
  position: absolute; inset: auto 0 0 0; padding: 24px 88px 34px 20px;
  background: linear-gradient(transparent, rgba(0,0,0,.8)); color: #fff;
}
.reel .side {
  position: absolute; right: 12px; bottom: 96px; z-index: 3;
  display: flex; flex-direction: column; gap: 20px; align-items: center; color: #fff;
}
.reel .side button { display: grid; place-items: center; gap: 4px; color: #fff; font-size: 12px; font-weight: 650; }
.reel .side svg { width: 29px; height: 29px; filter: drop-shadow(0 2px 8px rgba(0,0,0,.5)); }

/* =====================================================================
   MESSAGES
   ===================================================================== */
.dm { display: grid; grid-template-columns: 340px 1fr; gap: 0; height: calc(100dvh - var(--header-h)); }
.dm-list { border-right: 1px solid var(--line); overflow-y: auto; }
.dm-row {
  display: flex; gap: 12px; padding: 13px 16px; align-items: center;
  border-bottom: 1px solid var(--line); transition: background var(--t-fast);
}
.dm-row:hover { background: var(--glass); }
.dm-row.on { background: var(--glass-2); }
.dm-row .preview { font-size: 13px; color: var(--text-3); }
.dm-row.unread .preview { color: var(--text); font-weight: 600; }

.dm-thread { display: flex; flex-direction: column; min-width: 0; height: 100%; }
.dm-head { display: flex; align-items: center; gap: 12px; padding: 12px 18px; border-bottom: 1px solid var(--line); }
.dm-body { flex: 1; overflow-y: auto; padding: 20px 18px; display: flex; flex-direction: column; gap: 3px; }
.dm-foot { padding: 12px 16px; border-top: 1px solid var(--line); }

.bubble {
  max-width: min(74%, 460px); padding: 10px 14px; border-radius: 20px;
  font-size: 14.8px; line-height: 1.5; overflow-wrap: anywhere;
  animation: bubbleIn .3s var(--ease) both;
}
@keyframes bubbleIn { from { opacity: 0; transform: translateY(8px) scale(.97); } }
.bubble.them { align-self: flex-start; background: var(--surface-2); border: 1px solid var(--line); border-bottom-left-radius: 7px; }
.bubble.me {
  align-self: flex-end; border-bottom-right-radius: 7px;
  background: linear-gradient(135deg, var(--a-500), var(--a2)); color: #0a0a12; font-weight: 500;
}
.bubble.system { align-self: center; background: none; color: var(--text-3); font-size: 12.5px; }
.bubble + .bubble { margin-top: 3px; }
.bubble-time { font-size: 11px; color: var(--text-3); margin: 2px 6px 8px; }
.bubble.me + .bubble-time { align-self: flex-end; }

.typing { display: flex; gap: 4px; align-self: flex-start; padding: 12px 16px; }
.typing i { width: 7px; height: 7px; border-radius: 50%; background: var(--text-3); animation: blink 1.3s infinite; }
.typing i:nth-child(2) { animation-delay: .18s; } .typing i:nth-child(3) { animation-delay: .36s; }
@keyframes blink { 0%, 60%, 100% { opacity: .3; transform: translateY(0); } 30% { opacity: 1; transform: translateY(-4px); } }

.dm-input {
  display: flex; align-items: flex-end; gap: 9px;
  padding: 8px 8px 8px 16px; border-radius: 24px;
  background: var(--glass); border: 1px solid var(--line);
  transition: border-color var(--t);
}
.dm-input:focus-within { border-color: var(--a-500); box-shadow: 0 0 0 3px hsla(var(--hue), 90%, 60%, .12); }
.dm-input textarea {
  flex: 1; border: 0; background: none; outline: none; resize: none;
  max-height: 130px; padding: 8px 0; font-size: 15px;
}

/* =====================================================================
   FORMS
   ===================================================================== */
.field { margin-bottom: 17px; }
.field label { display: block; font-size: 13px; font-weight: 650; margin-bottom: 7px; color: var(--text-2); }
.input, input[type="text"], input[type="email"], input[type="password"], input[type="url"],
input[type="date"], input[type="datetime-local"], input[type="number"], input[type="search"], textarea, select {
  width: 100%; padding: 12px 15px; border-radius: var(--r);
  background: var(--glass); border: 1px solid var(--line); color: var(--text);
  font-size: 15px; outline: none; transition: all var(--t) var(--ease);
}
textarea { resize: vertical; min-height: 100px; line-height: 1.6; }
.input:focus, input:focus, textarea:focus, select:focus {
  border-color: var(--a-500); background: var(--glass-2);
  box-shadow: 0 0 0 3.5px hsla(var(--hue), 90%, 60%, .14);
}
.field.has-error .input, .field.has-error input, .field.has-error textarea { border-color: var(--err); }
.field-error { display: block; font-size: 12.5px; color: var(--err); margin-top: 6px; }
.field-hint  { display: block; font-size: 12.5px; color: var(--text-3); margin-top: 6px; }
select { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'%3E%3Cpath d='M3 4.5L6 8l3-3.5' stroke='%23888' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 14px center; padding-right: 38px; }

.switch { display: flex; align-items: center; gap: 13px; cursor: pointer; padding: 13px 0; }
.switch input { display: none; }
.switch .track {
  width: 46px; height: 27px; border-radius: var(--r-full); flex: none;
  background: var(--line-2); position: relative; transition: background var(--t) var(--ease);
}
.switch .track::after {
  content: ''; position: absolute; top: 3px; left: 3px;
  width: 21px; height: 21px; border-radius: var(--r-full); background: #fff;
  transition: transform var(--t) var(--ease-bounce); box-shadow: 0 2px 6px rgba(0,0,0,.3);
}
.switch input:checked + .track { background: linear-gradient(135deg, var(--a-500), var(--a2)); }
.switch input:checked + .track::after { transform: translateX(19px); }

.hue-picker { display: flex; gap: 9px; flex-wrap: wrap; }
.hue-dot {
  width: 36px; height: 36px; border-radius: var(--r-sm); cursor: pointer;
  border: 2.5px solid transparent; transition: all var(--t) var(--ease-bounce);
}
.hue-dot:hover { transform: scale(1.12); }
.hue-dot.on { border-color: var(--text); transform: scale(1.14); }

/* =====================================================================
   TABS / SEGMENTED
   ===================================================================== */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 18px; overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tabs a, .tabs button {
  position: relative; padding: 13px 17px; font-weight: 600; font-size: 14.5px;
  color: var(--text-3); white-space: nowrap; transition: color var(--t);
}
.tabs a:hover, .tabs button:hover { color: var(--text); }
.tabs .on { color: var(--text); }
.tabs .on::after {
  content: ''; position: absolute; left: 14px; right: 14px; bottom: -1px; height: 2.5px;
  border-radius: 3px 3px 0 0; background: linear-gradient(90deg, var(--a-400), var(--a2));
}

.seg {
  display: inline-flex; padding: 3px; gap: 2px; border-radius: var(--r-full);
  background: var(--glass); border: 1px solid var(--line);
}
.seg button, .seg a {
  padding: 7px 16px; border-radius: var(--r-full); font-size: 13.5px; font-weight: 600;
  color: var(--text-3); transition: all var(--t) var(--ease);
}
.seg .on { background: var(--glass-2); color: var(--text); box-shadow: var(--shadow-sm); }

/* =====================================================================
   ASIDE WIDGETS
   ===================================================================== */
.aside { position: sticky; top: calc(var(--header-h) + 18px); padding-top: 18px; display: flex; flex-direction: column; gap: 16px; }
.widget { padding: 17px; }
.widget h3 { font-size: 15px; font-weight: 700; margin-bottom: 13px; letter-spacing: -.01em; }
.widget .more { display: block; margin-top: 11px; font-size: 13.5px; color: var(--a-400); font-weight: 600; }

.trend { display: block; padding: 9px 0; border-bottom: 1px solid var(--line); }
.trend:last-child { border-bottom: 0; }
.trend b { display: block; font-size: 14.5px; font-weight: 650; }
.trend span { font-size: 12.5px; color: var(--text-3); }

.person { display: flex; align-items: center; gap: 11px; padding: 9px 0; }

/* pulse ring widget */
.pulse-ring { width: 92px; height: 92px; transform: rotate(-90deg); }
.pulse-ring circle { fill: none; stroke-width: 8; stroke-linecap: round; }
.pulse-ring .track { stroke: var(--line); }
.pulse-ring .val   { stroke: url(#pulseGrad); transition: stroke-dashoffset 1s var(--ease); }

.spark { display: flex; align-items: flex-end; gap: 4px; height: 46px; }
.spark i {
  flex: 1; min-height: 3px; border-radius: 3px 3px 1px 1px;
  background: linear-gradient(180deg, var(--a-400), var(--a-600));
  opacity: .55; transition: opacity var(--t), transform var(--t);
}
.spark i.today { opacity: 1; }
.spark i:hover { opacity: 1; transform: scaleY(1.06); }

/* =====================================================================
   COMMAND PALETTE (⌘K)
   ===================================================================== */
.cmdk-back {
  position: fixed; inset: 0; z-index: 300;
  background: hsla(230, 40%, 3%, .62); backdrop-filter: blur(8px);
  display: flex; justify-content: center; padding-top: 12vh;
  animation: fade .18s var(--ease);
}
@keyframes fade { from { opacity: 0; } }
.cmdk {
  width: min(94vw, 600px); height: fit-content; max-height: 66vh;
  background: var(--surface); border: 1px solid var(--line-2);
  border-radius: var(--r-xl); box-shadow: var(--shadow); overflow: hidden;
  animation: cmdIn .24s var(--ease);
}
@keyframes cmdIn { from { opacity: 0; transform: translateY(-16px) scale(.97); } }
.cmdk input {
  width: 100%; padding: 19px 22px; border: 0; background: none;
  font-size: 17px; outline: none; border-bottom: 1px solid var(--line);
}
.cmdk-list { max-height: 50vh; overflow-y: auto; padding: 8px; }
.cmdk-item {
  display: flex; align-items: center; gap: 13px; width: 100%;
  padding: 11px 14px; border-radius: var(--r); text-align: left;
  transition: background var(--t-fast);
}
.cmdk-item:hover, .cmdk-item.sel { background: var(--glass-2); }
.cmdk-item .ic {
  width: 32px; height: 32px; border-radius: var(--r-sm); flex: none;
  display: grid; place-items: center; font-size: 15px; background: var(--glass-2);
}
.cmdk-item b { display: block; font-size: 14.5px; font-weight: 600; }
.cmdk-item span { display: block; font-size: 12.5px; color: var(--text-3); }
.cmdk-foot { padding: 10px 18px; border-top: 1px solid var(--line); font-size: 12px; color: var(--text-3); display: flex; gap: 16px; }

/* =====================================================================
   MODAL / SHEET
   ===================================================================== */
.modal-back {
  position: fixed; inset: 0; z-index: 250;
  background: hsla(230, 40%, 3%, .68); backdrop-filter: blur(6px);
  display: grid; place-items: center; padding: 20px;
  animation: fade .18s var(--ease);
}
.modal {
  width: min(94vw, 560px); max-height: 86dvh; overflow-y: auto;
  background: var(--surface); border: 1px solid var(--line-2);
  border-radius: var(--r-xl); box-shadow: var(--shadow);
  animation: modalIn .28s var(--ease);
}
@keyframes modalIn { from { opacity: 0; transform: translateY(24px) scale(.96); } }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 18px 22px; border-bottom: 1px solid var(--line); }
.modal-head h2 { font-size: 17px; font-weight: 700; }
.modal-body { padding: 22px; }
.modal-foot { padding: 16px 22px; border-top: 1px solid var(--line); display: flex; gap: 10px; justify-content: flex-end; }

@media (max-width: 620px) {
  .modal-back { align-items: flex-end; padding: 0; }
  .modal { width: 100%; max-height: 92dvh; border-radius: var(--r-xl) var(--r-xl) 0 0; animation: sheetIn .3s var(--ease); }
  @keyframes sheetIn { from { transform: translateY(100%); } }
}

/* =====================================================================
   TOASTS
   ===================================================================== */
.toasts {
  position: fixed; bottom: calc(var(--tabbar-h) + 16px); left: 50%; transform: translateX(-50%);
  z-index: 400; display: flex; flex-direction: column; gap: 9px; align-items: center;
  pointer-events: none; width: min(94vw, 420px);
}
@media (min-width: 900px) { .toasts { bottom: 26px; left: 26px; transform: none; align-items: flex-start; } }
.toast {
  display: flex; align-items: center; gap: 11px;
  padding: 13px 18px; border-radius: var(--r);
  background: var(--surface); border: 1px solid var(--line-2);
  box-shadow: var(--shadow); font-size: 14px; font-weight: 550;
  pointer-events: auto; animation: toastIn .34s var(--ease-bounce);
  max-width: 100%;
}
@keyframes toastIn { from { opacity: 0; transform: translateY(22px) scale(.92); } }
.toast.out { animation: toastOut .26s var(--ease) forwards; }
@keyframes toastOut { to { opacity: 0; transform: translateY(12px) scale(.95); } }
.toast .ic { width: 22px; height: 22px; border-radius: var(--r-full); display: grid; place-items: center; font-size: 12px; flex: none; }
.toast.ok  .ic { background: hsla(152, 72%, 45%, .2); color: var(--ok); }
.toast.err .ic { background: hsla(352, 85%, 62%, .2); color: var(--err); }
.toast.info .ic{ background: hsla(var(--hue), 90%, 60%, .2); color: var(--a-400); }

/* =====================================================================
   EMPTY / SKELETON
   ===================================================================== */
.empty { text-align: center; padding: 60px 24px; }
.empty .art { font-size: 46px; margin-bottom: 14px; opacity: .8; animation: float 4s ease-in-out infinite; }
.empty h3 { font-size: 18px; font-weight: 700; margin-bottom: 7px; }
.empty p { color: var(--text-2); max-width: 380px; margin: 0 auto 20px; font-size: 14.5px; }

.skel { border-radius: var(--r-sm); background: linear-gradient(90deg, var(--glass) 25%, var(--glass-2) 37%, var(--glass) 63%);
  background-size: 400% 100%; animation: shimmer 1.5s ease-in-out infinite; }
@keyframes shimmer { 0% { background-position: 100% 0; } 100% { background-position: -100% 0; } }
.skel-post { padding: 17px 18px; margin-bottom: 14px; }
.skel-line { height: 11px; margin-bottom: 9px; }

.divider { height: 1px; background: var(--line); margin: 20px 0; }
.caught-up {
  display: flex; align-items: center; gap: 12px; margin: 24px 0;
  color: var(--text-3); font-size: 13px; font-weight: 600;
}
.caught-up::before, .caught-up::after { content: ''; flex: 1; height: 1px; background: var(--line); }

/* =====================================================================
   PROFILE
   ===================================================================== */
.cover {
  height: 210px; border-radius: var(--r-xl); overflow: hidden; position: relative;
  background: linear-gradient(120deg, hsl(var(--ph, 258) 70% 42%), hsl(calc(var(--ph, 258) + 60) 70% 38%));
}
.cover img { width: 100%; height: 100%; object-fit: cover; }
.profile-head { padding: 0 22px 22px; margin-top: -54px; position: relative; }
.stat-row { display: flex; gap: 26px; margin-top: 16px; }
.stat b { display: block; font-size: 19px; font-weight: 750; letter-spacing: -.02em; }
.stat span { font-size: 12.5px; color: var(--text-3); }

/* bento grid for explore */
.bento { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 10px; grid-auto-rows: 190px; }
.bento .tile {
  position: relative; overflow: hidden; border-radius: var(--r);
  background: var(--surface-2); transition: transform var(--t) var(--ease);
}
.bento .tile:hover { transform: scale(.985); }
.bento .tile img, .bento .tile video { width: 100%; height: 100%; object-fit: cover; }
.bento .tile.tall { grid-row: span 2; }
.bento .tile.wide { grid-column: span 2; }
.bento .tile .cap {
  position: absolute; inset: auto 0 0 0; padding: 26px 13px 12px;
  background: linear-gradient(transparent, rgba(0,0,0,.8)); color: #fff; font-size: 13px;
}
.bento .tile.text { padding: 18px; display: flex; flex-direction: column; justify-content: space-between;
  border: 1px solid var(--line); background: var(--glass); }

/* =====================================================================
   MOBILE TAB BAR
   ===================================================================== */
.tabbar {
  display: none;
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 90;
  height: calc(var(--tabbar-h) + env(safe-area-inset-bottom));
  padding-bottom: env(safe-area-inset-bottom);
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: blur(22px) saturate(180%);
  -webkit-backdrop-filter: blur(22px) saturate(180%);
  border-top: 1px solid var(--line);
  align-items: center; justify-content: space-around;
}
.tabbar a {
  display: grid; place-items: center; gap: 3px;
  width: 60px; color: var(--text-3); font-size: 10px; font-weight: 600;
  position: relative; transition: color var(--t);
}
.tabbar a svg { width: 24px; height: 24px; }
.tabbar a.active { color: var(--a-400); }
.tabbar .fab {
  width: 52px; height: 52px; border-radius: 18px; margin-top: -16px;
  background: linear-gradient(135deg, var(--a-500), var(--a2)); color: #0a0a12;
  display: grid; place-items: center;
  box-shadow: 0 8px 24px hsla(var(--hue), 90%, 50%, .45);
  transition: transform var(--t) var(--ease-bounce);
}
.tabbar .fab:active { transform: scale(.9); }
.tabbar .fab svg { width: 26px; height: 26px; }

/* =====================================================================
   RESPONSIVE
   ===================================================================== */
@media (max-width: 1180px) {
  .shell { grid-template-columns: 84px minmax(0, 1fr) var(--aside-w); gap: 20px; }
  .nav a span, .btn-compose span, .me-chip .who { display: none; }
  .nav a { justify-content: center; padding: 13px; }
  .nav a.active::before { display: none; }
  .btn-compose { padding: 14px 0; }
  .me-chip { justify-content: center; }
}
@media (max-width: 960px) {
  .shell, .shell.wide { grid-template-columns: minmax(0, 1fr); max-width: 680px; padding-bottom: calc(var(--tabbar-h) + 40px); }
  .rail, .aside { display: none; }
  .tabbar { display: flex; }
  .dm { grid-template-columns: 1fr; height: calc(100dvh - var(--header-h) - var(--tabbar-h)); }
  .dm-list { display: none; } .dm.list-only .dm-list { display: block; border-right: 0; }
  .dm.list-only .dm-thread { display: none; }
}
@media (max-width: 620px) {
  .topbar { padding: 0 14px; }
  .shell { padding: 0 12px calc(var(--tabbar-h) + 40px); }
  .post { padding: 15px 15px; border-radius: var(--r); }
  .omni .label { display: none; }
  .omni { max-width: 44px; padding: 0; justify-content: center; }
  .kbd { display: none; }
  .cover { height: 150px; border-radius: 0 0 var(--r-lg) var(--r-lg); }
  .profile-head { padding: 0 16px 18px; }

  /* Keep the composer toolbar on one line */
  .composer-foot { flex-wrap: nowrap; gap: 2px; }
  .composer-foot .tool { width: 32px; }
  .composer-foot [data-pop-toggle] .tiny { display: none; }
  .composer-foot [data-pop-toggle] { padding: 0 8px !important; }
  .composer textarea { font-size: 16px; }   /* stops iOS zoom-on-focus */
  .composer .row > img.av { display: none; }
}

/* ---------- Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
html[data-motion="off"] *, html[data-motion="off"] *::before, html[data-motion="off"] *::after {
  animation: none !important; transition: none !important;
}

/* ---------- Scrollbars ---------- */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--line-2); border-radius: 10px; border: 3px solid transparent; background-clip: content-box; }
::-webkit-scrollbar-thumb:hover { background: var(--text-3); background-clip: content-box; }

/* ---------- Print ---------- */
@media print { .topbar, .rail, .aside, .tabbar, .post-actions { display: none !important; } }

/* =====================================================================
   POLISH LAYER — micro-interactions and the small things that make an
   interface feel considered rather than merely styled.
   ===================================================================== */

/* ---------- Cursor spotlight on cards ---------- */
.card { position: relative; }
.card::after {
  content: ''; position: absolute; inset: 0; border-radius: inherit;
  pointer-events: none; opacity: 0; transition: opacity .4s var(--ease);
  background: radial-gradient(360px circle at var(--mx, 50%) var(--my, 50%),
              hsla(var(--hue), 90%, 65%, .07), transparent 65%);
}
.card:hover::after { opacity: 1; }
html[data-motion="off"] .card::after { display: none; }

/* ---------- Reading progress ---------- */
.progress {
  position: fixed; top: 0; left: 0; height: 2.5px; width: 0; z-index: 100;
  background: linear-gradient(90deg, var(--a-400), var(--a2), var(--a3));
  border-radius: 0 3px 3px 0; transition: width .12s linear;
  box-shadow: 0 0 12px hsla(var(--hue), 90%, 60%, .6);
}

/* ---------- "New posts" pill ---------- */
.newpill {
  position: fixed; top: calc(var(--header-h) + 14px); left: 50%;
  transform: translateX(-50%) translateY(-24px);
  z-index: 70; opacity: 0; pointer-events: none;
  display: flex; align-items: center; gap: 8px;
  padding: 9px 18px; border-radius: var(--r-full);
  background: linear-gradient(135deg, var(--a-500), var(--a2)); color: #0a0a12;
  font-size: 13.5px; font-weight: 700;
  box-shadow: 0 10px 30px hsla(var(--hue), 90%, 50%, .4);
  transition: opacity .3s var(--ease), transform .3s var(--ease-bounce);
}
.newpill.show { opacity: 1; transform: translateX(-50%) translateY(0); pointer-events: auto; }

/* ---------- Back to top ---------- */
.totop {
  position: fixed; right: 22px; bottom: 22px; z-index: 70;
  width: 44px; height: 44px; border-radius: var(--r-full);
  display: grid; place-items: center; font-size: 17px;
  background: var(--glass-2); border: 1px solid var(--line-2); color: var(--text);
  backdrop-filter: blur(14px); box-shadow: var(--shadow-sm);
  opacity: 0; transform: translateY(14px) scale(.9); pointer-events: none;
  transition: all .3s var(--ease-bounce);
}
.totop.show { opacity: 1; transform: none; pointer-events: auto; }
.totop:hover { border-color: var(--a-500); color: var(--a-400); }
@media (max-width: 960px) { .totop { bottom: calc(var(--tabbar-h) + 18px); right: 16px; } }

/* ---------- Profile hover card ---------- */
.hovercard {
  position: fixed; z-index: 150; width: 296px; padding: 16px;
  background: var(--surface); border: 1px solid var(--line-2);
  border-radius: var(--r-lg); box-shadow: var(--shadow);
  backdrop-filter: blur(24px);
  opacity: 0; transform: translateY(8px) scale(.97);
  transition: opacity .18s var(--ease), transform .18s var(--ease);
  pointer-events: none;
}
.hovercard.show { opacity: 1; transform: none; pointer-events: auto; }
.hovercard .hc-cover {
  height: 56px; margin: -16px -16px 0; border-radius: var(--r-lg) var(--r-lg) 0 0;
  background: linear-gradient(120deg, hsl(var(--hh, 258) 70% 45%), hsl(calc(var(--hh, 258) + 55) 70% 38%));
}
.hovercard .hc-av { margin: -26px 0 10px; border: 3px solid var(--surface); }
.hovercard .hc-stats { display: flex; gap: 18px; margin-top: 12px; }
.hovercard .hc-stats b { font-size: 15px; font-weight: 700; }

/* ---------- Coach marks (first-run tour) ---------- */
.coach-back { position: fixed; inset: 0; z-index: 320; background: hsla(230,40%,3%,.72);
  backdrop-filter: blur(3px); animation: fade .25s var(--ease); }
.coach {
  position: fixed; z-index: 330; width: min(92vw, 330px); padding: 20px;
  background: var(--surface); border: 1px solid var(--line-2);
  border-radius: var(--r-lg); box-shadow: var(--shadow);
  animation: coachIn .34s var(--ease-bounce);
}
@keyframes coachIn { from { opacity: 0; transform: translateY(14px) scale(.94); } }
.coach .ic { font-size: 26px; margin-bottom: 10px; display: block; }
.coach h4 { font-size: 16px; letter-spacing: -.02em; margin-bottom: 6px; }
.coach p { font-size: 13.5px; color: var(--text-2); line-height: 1.55; margin-bottom: 16px; }
.coach-dots { display: flex; gap: 5px; }
.coach-dots i { width: 6px; height: 6px; border-radius: 50%; background: var(--line-2); }
.coach-dots i.on { background: var(--a-500); width: 18px; border-radius: 3px; }
.coach-halo {
  position: fixed; z-index: 325; border-radius: var(--r);
  box-shadow: 0 0 0 3px var(--a-400), 0 0 0 9999px transparent, 0 0 30px hsla(var(--hue),90%,60%,.6);
  pointer-events: none; transition: all .35s var(--ease);
}

/* ---------- Sticky header shrink ---------- */
.topbar { transition: height .25s var(--ease), box-shadow .25s var(--ease); }
.topbar.shrunk { height: 52px; box-shadow: 0 6px 22px hsla(230,50%,3%,.28); }

/* ---------- Better focus & touch targets ---------- */
@media (pointer: coarse) {
  .act, .tool, .ibtn { min-height: 42px; }
  .nav a { padding: 13px 15px; }
}
.act:focus-visible, .btn:focus-visible, .vibe:focus-visible { outline-offset: 3px; }

/* ---------- Image reveal ---------- */
.media-item img, .bento .tile img { animation: reveal .5s var(--ease) both; }
@keyframes reveal { from { opacity: 0; transform: scale(1.015); } }

/* ---------- Live vibe tint on the whole shell ---------- */
body { transition: none; }
html { transition: --hue .5s var(--ease); }

/* ---------- Composer focus expansion ---------- */
.composer { transition: box-shadow .3s var(--ease), border-color .3s var(--ease); }
.composer:focus-within {
  border-color: hsla(var(--hue), 90%, 60%, .45);
  box-shadow: 0 0 0 4px hsla(var(--hue), 90%, 60%, .09), var(--shadow-sm);
}
.composer.drag { border-color: var(--a-500); border-style: dashed; }
.composer.drag::before {
  content: 'Drop to attach'; position: absolute; inset: 0; z-index: 5;
  display: grid; place-items: center; border-radius: inherit;
  background: hsla(var(--hue), 90%, 55%, .12); font-weight: 700; color: var(--a-400);
  backdrop-filter: blur(3px);
}

/* ---------- Nicer selection of feed sort ---------- */
.seg .on { position: relative; }

/* ---------- Subtle press feedback everywhere ---------- */
.act:active, .tool:active, .ibtn:active, .vibe:active, .chip:active { transform: scale(.94); }

/* ---------- Long text readability ---------- */
.post-body { max-width: 68ch; }

/* ---------- Print-friendly ---------- */
@media print { .progress, .newpill, .totop, .hovercard { display: none !important; } }
