/* ==========================================================================
   TheNexAeon — base, shell, components
   ========================================================================== */

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; -webkit-tap-highlight-color: transparent; scroll-padding-top: calc(var(--topbar-h) + 12px); }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-ui);
  font-size: var(--fs-md);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  min-height: 100vh;
}
body::before { /* atmospheric field */
  content: ""; position: fixed; inset: 0; pointer-events: none; z-index: -1;
  background:
    radial-gradient(900px 520px at 78% -8%, rgba(139, 92, 246, 0.16), transparent 60%),
    radial-gradient(700px 480px at -6% 30%, rgba(76, 52, 160, 0.12), transparent 62%),
    radial-gradient(600px 400px at 60% 110%, rgba(201, 170, 107, 0.05), transparent 60%),
    var(--bg);
}
img, svg { display: block; max-width: 100%; }
a { color: inherit; text-decoration: none; }
a:hover { color: var(--accent-3); }
p a, .prose a, .link { color: var(--accent-2); text-decoration: underline; text-decoration-color: rgba(167,139,250,.35); text-underline-offset: 3px; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
h1, h2, h3, h4 { margin: 0; line-height: 1.15; font-weight: 600; }
p { margin: 0 0 0.9em; }
::selection { background: rgba(139, 92, 246, 0.4); color: #fff; }
:focus-visible { outline: 2px solid var(--accent-2); outline-offset: 2px; border-radius: 6px; }
.sr-only { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.skip-link { position: absolute; left: 12px; top: -60px; z-index: 200; background: var(--accent); color: var(--text-on-accent); padding: 8px 14px; border-radius: var(--r-sm); font-weight: 600; }
.skip-link:focus { top: 12px; }

.display { font-family: var(--font-display); font-weight: 500; letter-spacing: -0.01em; }
.eyebrow { font-family: var(--font-mono); font-size: 0.6875rem; letter-spacing: 0.18em; text-transform: uppercase; color: var(--text-3); }
.muted { color: var(--text-2); }
.faint { color: var(--text-3); }
.small { font-size: var(--fs-sm); }
.xs { font-size: var(--fs-xs); }
.mono { font-family: var(--font-mono); }
.nowrap { white-space: nowrap; }
.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; }
.shimmer-text {
  background: linear-gradient(100deg, #9b97ad 0%, #ffffff 30%, #c9bfff 52%, #ffffff 70%, #8f8aa6 100%);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}

/* Layout primitives */
.row { display: flex; align-items: center; gap: 10px; }
.row.wrap { flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.row.top { align-items: flex-start; }
.stack { display: flex; flex-direction: column; gap: 14px; }
.stack.tight { gap: 8px; }
.stack.loose { gap: 24px; }
.grow { flex: 1; min-width: 0; }
.grid { display: grid; gap: 16px; }
.grid.cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid.cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid.auto { grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); }
.grid.auto-sm { grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); }
@media (max-width: 900px) { .grid.cols-3, .grid.cols-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 560px) { .grid.cols-2, .grid.cols-3 { grid-template-columns: 1fr; } .grid.auto-sm { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.mt-0 { margin-top: 0 } .mt-1 { margin-top: 6px } .mt-2 { margin-top: 12px } .mt-3 { margin-top: 20px } .mt-4 { margin-top: 32px }
.mb-0 { margin-bottom: 0 } .mb-2 { margin-bottom: 12px } .mb-3 { margin-bottom: 20px }

/* ==========================================================================
   Shell
   ========================================================================== */
.demo-banner {
  display: flex; align-items: center; justify-content: center; gap: 8px; flex-wrap: wrap;
  font-size: 0.75rem; color: var(--text-2); text-align: center;
  padding: 6px 14px; background: linear-gradient(90deg, rgba(139,92,246,.08), rgba(201,170,107,.07), rgba(139,92,246,.08));
  border-bottom: 1px solid var(--line);
}
.demo-banner b { color: var(--gold); font-weight: 600; letter-spacing: .04em; }
.demo-banner button { background: none; border: 0; color: var(--accent-2); text-decoration: underline; text-underline-offset: 2px; padding: 0; font-size: inherit; }

.topbar {
  position: sticky; top: 0; z-index: 50; height: var(--topbar-h);
  display: flex; align-items: center; gap: 16px; padding: 0 18px;
  background: rgba(8, 7, 12, 0.78); backdrop-filter: blur(18px) saturate(140%); -webkit-backdrop-filter: blur(18px) saturate(140%);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 10px; flex-shrink: 0; }
.brand:hover { color: inherit; }
.brand-mark { width: 30px; height: 30px; color: var(--accent-2); filter: drop-shadow(0 0 10px rgba(139,92,246,.45)); }
.brand-word { font-family: var(--font-display); font-size: 1.45rem; font-weight: 600; letter-spacing: 0.01em; line-height: 1; }
.brand-word .the { font-weight: 400; color: var(--text-2); font-style: italic; margin-right: 1px; }
.brand-word .nex { color: var(--text); }
.brand-word .aeon { background: linear-gradient(100deg, #cfc4ff, #8b5cf6 70%); -webkit-background-clip: text; background-clip: text; color: transparent; }

.search-global { flex: 1; max-width: 560px; margin: 0 auto; position: relative; }
.search-global input {
  width: 100%; height: 40px; padding: 0 14px 0 40px; border-radius: var(--r-pill);
  background: var(--surface); border: 1px solid var(--line-2); color: var(--text); font-size: var(--fs-sm);
  transition: border-color .2s, box-shadow .2s, background .2s;
}
.search-global input::placeholder { color: var(--text-3); }
.search-global input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); background: var(--surface-2); }
.search-global .icon { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: var(--text-3); width: 17px; height: 17px; }
.top-actions { display: flex; align-items: center; gap: 4px; flex-shrink: 0; }
.icon-btn {
  position: relative; display: inline-grid; place-items: center; width: 40px; height: 40px; border-radius: var(--r-pill);
  background: transparent; border: 1px solid transparent; color: var(--text-2); transition: background .15s, color .15s, border-color .15s;
}
.icon-btn:hover { background: var(--surface-2); color: var(--text); }
.icon-btn .icon { width: 20px; height: 20px; }
.icon-btn .dot { position: absolute; top: 6px; right: 6px; min-width: 16px; height: 16px; padding: 0 4px; border-radius: 99px; background: var(--accent); color: #fff; font-size: 10px; font-weight: 700; display: grid; place-items: center; border: 2px solid var(--bg); }
.top-search-btn { display: none; }

.shell { display: grid; grid-template-columns: var(--rail-w) minmax(0, 1fr); max-width: var(--content-max); margin: 0 auto; }
.rail {
  position: sticky; top: var(--topbar-h); height: calc(100vh - var(--topbar-h)); overflow-y: auto;
  padding: 18px 12px 24px; border-right: 1px solid var(--line); scrollbar-width: thin;
}
.nav-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 2px; }
.nav-link {
  display: flex; align-items: center; gap: 12px; padding: 9px 12px; border-radius: var(--r-md);
  color: var(--text-2); font-size: 0.9rem; font-weight: 500; transition: background .15s, color .15s;
}
.nav-link .icon { width: 19px; height: 19px; flex-shrink: 0; opacity: .85; }
.nav-link:hover { background: var(--surface); color: var(--text); }
.nav-link[aria-current="page"] { background: linear-gradient(90deg, var(--accent-soft), transparent); color: var(--text); box-shadow: inset 2px 0 0 var(--accent); }
.nav-link[aria-current="page"] .icon { color: var(--accent-2); opacity: 1; }
.nav-link .tag { margin-left: auto; font-size: 10px; font-family: var(--font-mono); color: var(--text-3); border: 1px solid var(--line-2); border-radius: 99px; padding: 0 6px; }
.nav-create { margin-top: 14px; }
.rail-section { margin-top: 22px; padding: 0 12px; }
.rail-section .eyebrow { margin-bottom: 8px; display: block; }
.rail-realm { display: flex; align-items: center; gap: 10px; padding: 6px 0; font-size: var(--fs-sm); color: var(--text-2); }
.rail-realm:hover { color: var(--text); }
.rail-realm .pip { width: 8px; height: 8px; border-radius: 50%; background: var(--realm, var(--accent)); box-shadow: 0 0 10px var(--realm, var(--accent)); }

.main { min-width: 0; padding: 24px 28px 40px; }
.main:focus { outline: none; }
.page { max-width: 1040px; margin: 0 auto; animation: rise .45s var(--ease) both; }
.page.wide { max-width: none; }
.page.narrow { max-width: 760px; }
.page.read { max-width: 700px; }
@keyframes rise { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

.with-aside { display: grid; grid-template-columns: minmax(0, 1fr) var(--aside-w); gap: 28px; align-items: start; }
.aside { position: sticky; top: calc(var(--topbar-h) + 20px); display: flex; flex-direction: column; gap: 16px; }

.footer { border-top: 1px solid var(--line); margin-top: 56px; padding: 28px 0 8px; display: flex; flex-wrap: wrap; gap: 18px 32px; justify-content: space-between; color: var(--text-3); font-size: var(--fs-sm); }
.footer nav { display: flex; flex-wrap: wrap; gap: 6px 18px; }
.footer a:hover { color: var(--text); }
.footer .disclaimer { flex-basis: 100%; font-size: var(--fs-xs); }

.bottom-nav, .drawer-backdrop, .drawer { display: none; }

@media (max-width: 1180px) {
  .with-aside { grid-template-columns: minmax(0, 1fr); }
  .aside { position: static; display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
}
@media (max-width: 960px) {
  :root { --topbar-h: 56px; }
  .shell { grid-template-columns: minmax(0, 1fr); }
  .rail { display: none; }
  .main { padding: 18px 16px 110px; }
  .search-global { display: none; }
  .top-search-btn { display: inline-grid; }
  .topbar { padding: 0 10px 0 14px; gap: 8px; }
  .topbar .brand { margin-right: auto; }
  .hide-mobile { display: none !important; }
  .bottom-nav {
    display: grid; grid-template-columns: repeat(5, 1fr); position: fixed; z-index: 60; left: 0; right: 0; bottom: 0;
    padding: 6px 6px calc(6px + env(safe-area-inset-bottom)); background: rgba(9, 8, 14, 0.92);
    backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px); border-top: 1px solid var(--line);
  }
  .bottom-nav a, .bottom-nav button {
    display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 6px 0; border: 0; background: none;
    color: var(--text-3); font-size: 10.5px; font-weight: 500; border-radius: var(--r-md);
  }
  .bottom-nav .icon { width: 22px; height: 22px; }
  .bottom-nav [aria-current="page"] { color: var(--text); }
  .bottom-nav [aria-current="page"] .icon { color: var(--accent-2); }
  .bottom-nav .create-fab .fab { width: 44px; height: 32px; border-radius: 12px; display: grid; place-items: center; background: linear-gradient(135deg, var(--accent), #6d3fe0); color: #fff; box-shadow: 0 6px 20px var(--glow); }
  .bottom-nav .create-fab .icon { width: 20px; height: 20px; color: #fff; }
  .drawer-backdrop { display: block; position: fixed; inset: 0; z-index: 80; background: rgba(0,0,0,.55); opacity: 0; pointer-events: none; transition: opacity .2s; }
  .drawer {
    display: flex; flex-direction: column; position: fixed; z-index: 90; top: 0; bottom: 0; left: 0; width: min(320px, 86vw);
    background: var(--bg-2); border-right: 1px solid var(--line); padding: 18px 14px; overflow-y: auto;
    transform: translateX(-102%); transition: transform .25s var(--ease);
  }
  body.drawer-open .drawer { transform: none; }
  body.drawer-open .drawer-backdrop { opacity: 1; pointer-events: auto; }
}
@media (min-width: 961px) { .show-mobile { display: none !important; } }

/* ==========================================================================
   Components
   ========================================================================== */
.icon { width: 18px; height: 18px; flex-shrink: 0; }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 40px; padding: 0 18px;
  border-radius: var(--r-pill); border: 1px solid var(--line-2); background: var(--surface-2); color: var(--text);
  font-size: var(--fs-sm); font-weight: 600; letter-spacing: .01em; white-space: nowrap;
  transition: transform .12s, background .15s, border-color .15s, box-shadow .2s, color .15s;
}
.btn:hover { background: var(--surface-3); border-color: rgba(255,255,255,.18); color: var(--text); }
.btn:active { transform: translateY(1px); }
.btn .icon { width: 16px; height: 16px; }
.btn.primary { background: linear-gradient(135deg, #9a6dff, #7444ea 60%, #5b2fd1); border-color: rgba(196, 181, 253, .35); color: #fff; box-shadow: 0 8px 26px rgba(124, 77, 240, .35), inset 0 1px 0 rgba(255,255,255,.22); }
.btn.primary:hover { box-shadow: 0 10px 34px rgba(124, 77, 240, .5), inset 0 1px 0 rgba(255,255,255,.25); filter: brightness(1.06); }
.btn.ghost { background: transparent; border-color: transparent; color: var(--text-2); }
.btn.ghost:hover { background: var(--surface-2); color: var(--text); }
.btn.outline { background: transparent; border-color: var(--line-accent); color: var(--accent-3); }
.btn.outline:hover { background: var(--accent-soft); }
.btn.gold { background: linear-gradient(135deg, #e0c48a, #b48c47); color: #1a1205; border-color: rgba(255,230,180,.4); }
.btn.danger { background: var(--danger-soft); border-color: rgba(242,107,132,.3); color: #ffb3c1; }
.btn.success { background: var(--ok-soft); border-color: rgba(82,209,166,.3); color: #a6f0d5; }
.btn.sm { height: 32px; padding: 0 13px; font-size: var(--fs-xs); }
.btn.xs { height: 26px; padding: 0 10px; font-size: 11.5px; gap: 5px; }
.btn.lg { height: 48px; padding: 0 26px; font-size: var(--fs-md); }
.btn.block { width: 100%; }
.btn[disabled], .btn[aria-disabled="true"] { opacity: .5; pointer-events: none; }
.btn.is-on { background: var(--accent-soft); border-color: var(--line-accent); color: var(--accent-3); }

/* Cards */
.card {
  position: relative; background: linear-gradient(180deg, rgba(255,255,255,.018), transparent 40%), var(--surface);
  border: 1px solid var(--line); border-radius: var(--r-lg); padding: 18px; box-shadow: var(--shadow-1);
}
.card.pad-lg { padding: 26px; }
.card.flush { padding: 0; overflow: hidden; }
.card.hover { transition: border-color .2s, transform .2s var(--ease), background .2s; }
.card.hover:hover { border-color: var(--line-accent); transform: translateY(-2px); }
.card.glow::after { content: ""; position: absolute; inset: -1px; border-radius: inherit; pointer-events: none; padding: 1px; background: linear-gradient(140deg, rgba(167,139,250,.55), transparent 35%, transparent 65%, rgba(201,170,107,.35)); -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0); -webkit-mask-composite: xor; mask-composite: exclude; }
.card-title { font-size: var(--fs-sm); font-weight: 600; display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 12px; }
.card-title .eyebrow { margin: 0; }
.card-title a { font-size: var(--fs-xs); color: var(--text-3); font-weight: 500; }
.card-title a:hover { color: var(--accent-3); }
.divider { height: 1px; background: var(--line); margin: 14px 0; border: 0; }

/* Page header */
.page-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 22px; }
.page-head h1 { font-family: var(--font-display); font-size: var(--fs-3xl); font-weight: 500; letter-spacing: -0.015em; }
.page-head p { margin: 6px 0 0; color: var(--text-2); max-width: 640px; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; margin: 30px 0 14px; }
.section-head h2 { font-family: var(--font-display); font-size: var(--fs-2xl); font-weight: 500; }
.section-head a { font-size: var(--fs-sm); color: var(--text-3); }

/* Chips, badges */
.chip {
  display: inline-flex; align-items: center; gap: 6px; height: 28px; padding: 0 11px; border-radius: var(--r-pill);
  background: var(--surface-2); border: 1px solid var(--line); color: var(--text-2); font-size: 12px; font-weight: 500; white-space: nowrap;
  transition: background .15s, border-color .15s, color .15s;
}
button.chip:hover, a.chip:hover { border-color: var(--line-2); color: var(--text); }
.chip.is-on, .chip[aria-pressed="true"] { background: var(--accent-soft); border-color: var(--line-accent); color: var(--accent-3); }
.chip .pip { width: 7px; height: 7px; border-radius: 50%; background: var(--realm, var(--accent)); }
.chip.realm { border-color: color-mix(in oklab, var(--realm) 35%, transparent); color: color-mix(in oklab, var(--realm) 70%, white); background: color-mix(in oklab, var(--realm) 10%, transparent); }
.badge { display: inline-flex; align-items: center; gap: 4px; padding: 1px 8px; border-radius: 99px; font-size: 10.5px; font-weight: 600; letter-spacing: .03em; border: 1px solid var(--line-2); color: var(--text-2); white-space: nowrap; vertical-align: middle; }
.badge .icon { width: 11px; height: 11px; }
.badge.accent { color: var(--accent-3); border-color: var(--line-accent); background: var(--accent-soft); }
.badge.gold { color: #ecd39f; border-color: rgba(201,170,107,.35); background: var(--gold-soft); }
.badge.live { color: #fff; border-color: transparent; background: var(--live); }
.badge.live::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: #fff; animation: pulse 1.6s infinite; }
.badge.demo { color: var(--warn); border-color: rgba(233,182,92,.3); background: var(--warn-soft); }
.badge.ok { color: var(--ok); border-color: rgba(82,209,166,.3); background: var(--ok-soft); }
.badge.danger { color: var(--danger); border-color: rgba(242,107,132,.3); background: var(--danger-soft); }
.badge.soon { color: var(--text-3); border-style: dashed; }
@keyframes pulse { 0%,100% { opacity: 1 } 50% { opacity: .35 } }
.verified { color: var(--accent-2); width: 15px; height: 15px; display: inline-block; vertical-align: -2px; }

/* Tabs */
.tabs { display: flex; gap: 4px; overflow-x: auto; scrollbar-width: none; border-bottom: 1px solid var(--line); margin-bottom: 18px; }
.tabs::-webkit-scrollbar { display: none; }
.tab { position: relative; flex-shrink: 0; padding: 10px 14px 12px; background: none; border: 0; color: var(--text-3); font-size: var(--fs-sm); font-weight: 600; white-space: nowrap; }
.tab:hover { color: var(--text); }
.tab[aria-selected="true"] { color: var(--text); }
.tab[aria-selected="true"]::after { content: ""; position: absolute; left: 12px; right: 12px; bottom: -1px; height: 2px; border-radius: 2px; background: linear-gradient(90deg, var(--accent), var(--accent-3)); box-shadow: 0 0 12px var(--glow); }
.tab .count { margin-left: 6px; font-weight: 500; color: var(--text-3); }
.seg { display: inline-flex; padding: 3px; gap: 2px; border-radius: var(--r-pill); background: var(--surface); border: 1px solid var(--line); }
.seg button { border: 0; background: none; padding: 6px 13px; border-radius: var(--r-pill); color: var(--text-3); font-size: 12px; font-weight: 600; }
.seg button[aria-pressed="true"] { background: var(--surface-3); color: var(--text); }

/* Forms */
.field { display: flex; flex-direction: column; gap: 6px; }
.field > label, .label { font-size: var(--fs-sm); font-weight: 600; color: var(--text); }
.field .hint { font-size: var(--fs-xs); color: var(--text-3); }
.field .error { font-size: var(--fs-xs); color: var(--danger); display: none; }
.field.invalid .error { display: block; }
.field.invalid .input { border-color: rgba(242,107,132,.6); }
.input, .select, .textarea {
  width: 100%; min-height: 42px; padding: 10px 13px; border-radius: var(--r-md); background: var(--bg-2);
  border: 1px solid var(--line-2); color: var(--text); font-size: var(--fs-md); transition: border-color .15s, box-shadow .15s;
}
.textarea { min-height: 110px; resize: vertical; line-height: 1.55; }
.input::placeholder, .textarea::placeholder { color: var(--text-3); }
.input:focus, .select:focus, .textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }
.select { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2385809b' stroke-width='2'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; padding-right: 34px; }
.check { display: flex; align-items: flex-start; gap: 10px; font-size: var(--fs-sm); color: var(--text-2); cursor: pointer; }
.check input { margin-top: 3px; accent-color: var(--accent); width: 16px; height: 16px; flex-shrink: 0; }
.switch { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 12px 0; border-bottom: 1px solid var(--line); cursor: pointer; }
.switch:last-child { border-bottom: 0; }
.switch input { appearance: none; width: 40px; height: 23px; border-radius: 99px; background: var(--surface-3); border: 1px solid var(--line-2); position: relative; flex-shrink: 0; cursor: pointer; transition: background .2s; }
.switch input::after { content: ""; position: absolute; top: 2px; left: 2px; width: 17px; height: 17px; border-radius: 50%; background: var(--text-2); transition: transform .2s var(--ease), background .2s; }
.switch input:checked { background: var(--accent); border-color: var(--accent); }
.switch input:checked::after { transform: translateX(17px); background: #fff; }
.switch .t { font-size: var(--fs-sm); font-weight: 600; }
.switch .d { font-size: var(--fs-xs); color: var(--text-3); }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.form-grid .full { grid-column: 1 / -1; }
@media (max-width: 600px) { .form-grid { grid-template-columns: 1fr; } }

/* Avatar */
.avatar {
  --s: 40px; width: var(--s); height: var(--s); border-radius: 50%; flex-shrink: 0; position: relative; display: grid; place-items: center;
  font-family: var(--font-display); font-weight: 600; font-size: calc(var(--s) * 0.42); color: #fff; letter-spacing: .02em;
  background: radial-gradient(circle at 30% 25%, hsl(var(--h) 80% 72% / .9), transparent 55%), conic-gradient(from 210deg, hsl(var(--h) 60% 30%), hsl(calc(var(--h) + 50) 55% 22%), hsl(var(--h) 60% 30%));
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.14), 0 2px 10px rgba(0,0,0,.4); overflow: hidden; text-shadow: 0 1px 4px rgba(0,0,0,.4);
}
.avatar::after { content: ""; position: absolute; inset: 18%; border-radius: 50%; border: 1px solid rgba(255,255,255,.14); }
.avatar img { width: 100%; height: 100%; object-fit: cover; position: absolute; inset: 0; }
.avatar.xs { --s: 24px; } .avatar.sm { --s: 32px; } .avatar.md { --s: 44px; } .avatar.lg { --s: 64px; } .avatar.xl { --s: 116px; }
.avatar-stack { display: flex; }
.avatar-stack .avatar { margin-left: -8px; box-shadow: 0 0 0 2px var(--surface); }
.avatar-stack .avatar:first-child { margin-left: 0; }

.user-line { display: flex; align-items: center; gap: 10px; min-width: 0; }
.user-line .name { font-weight: 600; font-size: var(--fs-sm); color: var(--text); }
.user-line .handle { color: var(--text-3); font-size: var(--fs-xs); }
.user-line a:hover .name { color: var(--accent-3); }

/* Feed card */
.feed { display: flex; flex-direction: column; gap: 14px; }
.post { padding: 16px 18px 10px; }
.post-head { display: flex; align-items: flex-start; gap: 11px; }
.post-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; font-size: var(--fs-xs); color: var(--text-3); }
.post-meta .name { font-size: var(--fs-sm); font-weight: 600; color: var(--text); }
.post-meta a.name:hover { color: var(--accent-3); }
.post-body { margin: 10px 0 8px; font-size: 0.97rem; white-space: pre-wrap; overflow-wrap: anywhere; }
.post-body .tag-link { color: var(--accent-2); }
.post-kind { display: inline-flex; align-items: center; gap: 6px; font-family: var(--font-mono); font-size: 10.5px; letter-spacing: .12em; text-transform: uppercase; color: var(--text-3); margin-bottom: 10px; }
.post-kind .icon { width: 13px; height: 13px; }
.post-media { margin: 10px 0; border-radius: var(--r-md); overflow: hidden; border: 1px solid var(--line); }
.post-media img { width: 100%; max-height: 520px; object-fit: cover; }
.post-link { display: flex; gap: 12px; align-items: center; margin: 10px 0; padding: 12px; border-radius: var(--r-md); border: 1px solid var(--line-2); background: var(--bg-2); }
.post-link .icon { color: var(--text-3); }
.post-actions { display: flex; align-items: center; gap: 2px; margin: 4px -8px 0; }
.act {
  display: inline-flex; align-items: center; gap: 6px; height: 34px; padding: 0 10px; border-radius: var(--r-pill); border: 0; background: none;
  color: var(--text-3); font-size: 12.5px; font-weight: 500; transition: background .15s, color .15s;
}
.act:hover { background: var(--surface-2); color: var(--text); }
.act .icon { width: 17px; height: 17px; }
.act.is-on { color: var(--accent-2); }
.act.is-on .icon { fill: currentColor; fill-opacity: .2; }
.act.spacer { margin-left: auto; }
.hidden-note { padding: 14px 18px; display: flex; align-items: center; justify-content: space-between; gap: 12px; font-size: var(--fs-sm); color: var(--text-3); }

/* Reaction popover */
.react-wrap { position: relative; }
.react-menu {
  position: absolute; bottom: calc(100% + 6px); left: 0; z-index: 20; display: flex; gap: 4px; padding: 6px; border-radius: var(--r-pill);
  background: var(--surface-3); border: 1px solid var(--line-2); box-shadow: var(--shadow-2); animation: rise .18s var(--ease);
}
.react-menu button { border: 0; background: none; padding: 6px 10px; border-radius: 99px; font-size: 12px; font-weight: 600; color: var(--text-2); white-space: nowrap; display: flex; align-items: center; gap: 6px; }
.react-menu button:hover, .react-menu button.is-on { background: var(--accent-soft); color: var(--accent-3); }
.reaction-summary { display: flex; gap: 6px; flex-wrap: wrap; margin: 2px 0 4px; }
.reaction-summary span { font-size: 11px; color: var(--text-3); }

/* Popover menu */
.menu-wrap { position: relative; }
.menu {
  position: absolute; right: 0; top: calc(100% + 4px); z-index: 40; min-width: 220px; padding: 6px; border-radius: var(--r-md);
  background: var(--surface-3); border: 1px solid var(--line-2); box-shadow: var(--shadow-2); animation: rise .15s var(--ease);
}
.menu button, .menu a { display: flex; width: 100%; align-items: center; gap: 10px; padding: 9px 10px; border: 0; background: none; border-radius: var(--r-sm); text-align: left; font-size: var(--fs-sm); color: var(--text-2); }
.menu button:hover, .menu a:hover { background: var(--surface-hover); color: var(--text); }
.menu .danger { color: var(--danger); }
.menu hr { border: 0; height: 1px; background: var(--line); margin: 4px 0; }

/* Poll */
.poll { display: flex; flex-direction: column; gap: 6px; margin: 10px 0; }
.poll-opt { position: relative; display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 9px 13px; border-radius: var(--r-sm); border: 1px solid var(--line-2); background: var(--bg-2); font-size: var(--fs-sm); overflow: hidden; text-align: left; }
button.poll-opt:hover { border-color: var(--line-accent); }
.poll-opt .bar { position: absolute; inset: 0 auto 0 0; background: var(--accent-soft); border-right: 1px solid var(--line-accent); z-index: 0; transition: width .5s var(--ease); }
.poll-opt > span { position: relative; z-index: 1; }
.poll-opt.mine { border-color: var(--line-accent); }
.poll-opt.mine .label-t::after { content: " ✓"; color: var(--accent-2); }

/* Composer */
.composer { padding: 14px 16px; }
.composer textarea { width: 100%; min-height: 64px; border: 0; background: none; resize: vertical; color: var(--text); font-size: 1rem; padding: 8px 2px; line-height: 1.5; }
.composer textarea:focus { outline: none; }
.composer-tools { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; padding-top: 10px; border-top: 1px solid var(--line); }
.composer-tools .select { min-height: 32px; height: 32px; padding: 0 30px 0 11px; font-size: 12px; width: auto; border-radius: var(--r-pill); }
.composer .extra { margin: 8px 0; display: flex; flex-direction: column; gap: 8px; }
.composer .img-preview { position: relative; border-radius: var(--r-md); overflow: hidden; border: 1px solid var(--line); max-width: 260px; }
.composer .img-preview button { position: absolute; top: 6px; right: 6px; }

/* Modal & toast */
.modal-root { position: fixed; inset: 0; z-index: 120; display: grid; place-items: center; padding: 18px; background: rgba(3, 2, 6, 0.72); backdrop-filter: blur(6px); animation: fade .18s; }
.modal { width: min(520px, 100%); max-height: calc(100vh - 36px); overflow-y: auto; background: var(--surface); border: 1px solid var(--line-2); border-radius: var(--r-xl); box-shadow: var(--shadow-2); padding: 24px; animation: rise .22s var(--ease); }
.modal.wide { width: min(720px, 100%); }
.modal-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
.modal-head h2 { font-family: var(--font-display); font-size: 1.7rem; font-weight: 500; }
@keyframes fade { from { opacity: 0 } }
.toasts { position: fixed; z-index: 140; left: 50%; bottom: 24px; transform: translateX(-50%); display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; }
@media (max-width: 960px) { .toasts { bottom: 86px; } }
.toast { pointer-events: auto; display: flex; align-items: center; gap: 10px; padding: 11px 16px; border-radius: var(--r-pill); background: var(--surface-3); border: 1px solid var(--line-2); box-shadow: var(--shadow-2); font-size: var(--fs-sm); animation: rise .2s var(--ease); max-width: 92vw; }
.toast .icon { color: var(--accent-2); }
.toast button { border: 0; background: none; color: var(--accent-2); font-weight: 600; padding: 0 0 0 6px; }

/* Empty / notice */
.empty { text-align: center; padding: 42px 20px; color: var(--text-3); }
.empty .icon { width: 34px; height: 34px; margin: 0 auto 12px; color: var(--text-3); opacity: .7; }
.empty h3 { color: var(--text); font-family: var(--font-display); font-size: 1.5rem; font-weight: 500; margin-bottom: 6px; }
.notice { display: flex; gap: 12px; align-items: flex-start; padding: 13px 15px; border-radius: var(--r-md); background: var(--accent-soft); border: 1px solid var(--line-accent); font-size: var(--fs-sm); color: var(--text-2); }
.notice .icon { color: var(--accent-2); margin-top: 2px; }
.notice.warn { background: var(--warn-soft); border-color: rgba(233,182,92,.28); }
.notice.warn .icon { color: var(--warn); }
.notice b { color: var(--text); }

/* Lists */
.list { display: flex; flex-direction: column; }
.list-item { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.list-item:last-child { border-bottom: 0; }
.list-item:first-child { padding-top: 0; }
.trend { display: flex; justify-content: space-between; align-items: center; padding: 8px 0; border-bottom: 1px solid var(--line); gap: 10px; }
.trend:last-child { border-bottom: 0; }
.trend b { font-weight: 600; font-size: var(--fs-sm); }
.trend span { font-size: var(--fs-xs); color: var(--text-3); }

/* Table */
.table-wrap { overflow-x: auto; }
table.table { width: 100%; border-collapse: collapse; font-size: var(--fs-sm); }
.table th { text-align: left; font-weight: 600; color: var(--text-3); font-size: var(--fs-xs); text-transform: uppercase; letter-spacing: .08em; padding: 10px 12px; border-bottom: 1px solid var(--line-2); white-space: nowrap; }
.table td { padding: 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
.table tr:last-child td { border-bottom: 0; }

/* Covers & art */
.cover { position: relative; overflow: hidden; background: var(--cover-bg, linear-gradient(135deg, #2a1d52, #0e0b18)); }
.cover svg.pattern { position: absolute; inset: 0; width: 100%; height: 100%; opacity: .55; }
.thumb { position: relative; aspect-ratio: 4 / 3; border-radius: var(--r-md); overflow: hidden; display: grid; place-items: center; background: var(--thumb-bg); }
.thumb .icon { width: 38%; height: 38%; max-width: 70px; max-height: 70px; color: rgba(255,255,255,.75); filter: drop-shadow(0 4px 14px rgba(0,0,0,.4)); stroke-width: 1.2; }
.thumb .ribbon { position: absolute; top: 10px; left: 10px; }
.thumb .ribbon-r { position: absolute; top: 10px; right: 10px; }
.thumb .dur { position: absolute; right: 8px; bottom: 8px; padding: 1px 7px; border-radius: 6px; background: rgba(0,0,0,.7); font-size: 11px; font-family: var(--font-mono); }
.thumb.vertical { aspect-ratio: 9 / 14; }
.thumb.wide { aspect-ratio: 16 / 9; }
.thumb.square { aspect-ratio: 1; }

/* Realm card */
.realm-card { --realm: var(--accent); position: relative; display: flex; flex-direction: column; gap: 10px; padding: 20px; min-height: 196px; border-radius: var(--r-lg); overflow: hidden; border: 1px solid color-mix(in oklab, var(--realm) 24%, transparent); background: radial-gradient(120% 90% at 100% 0%, color-mix(in oklab, var(--realm) 22%, transparent), transparent 60%), var(--surface); transition: transform .25s var(--ease), border-color .2s; }
.realm-card:hover { transform: translateY(-3px); border-color: color-mix(in oklab, var(--realm) 55%, transparent); color: inherit; }
.realm-card .sigil { width: 46px; height: 46px; color: var(--realm); filter: drop-shadow(0 0 14px color-mix(in oklab, var(--realm) 60%, transparent)); }
.realm-card h3 { font-family: var(--font-display); font-size: 1.6rem; font-weight: 500; }
.realm-card p { font-size: var(--fs-sm); color: var(--text-2); margin: 0; }
.realm-card .foot { margin-top: auto; display: flex; flex-wrap: wrap; gap: 6px; }

/* Stat */
.stat b { display: block; font-family: var(--font-display); font-size: 1.7rem; font-weight: 500; line-height: 1.1; }
.stat span { font-size: var(--fs-xs); color: var(--text-3); }

/* Kbd */
kbd { font-family: var(--font-mono); font-size: 11px; padding: 1px 6px; border-radius: 5px; border: 1px solid var(--line-2); background: var(--surface-2); color: var(--text-3); }

/* Prose */
.prose { font-size: 1.08rem; line-height: 1.78; color: #dddbe7; }
.prose p { margin: 0 0 1.25em; }
.prose h2 { font-family: var(--font-display); font-size: 1.8rem; font-weight: 500; margin: 1.6em 0 .6em; }
.prose blockquote { margin: 1.4em 0; padding: 4px 0 4px 20px; border-left: 2px solid var(--accent); color: var(--text-2); font-family: var(--font-display); font-size: 1.35rem; font-style: italic; line-height: 1.5; }
.prose .dropcap::first-letter { float: left; font-family: var(--font-display); font-size: 4.2em; line-height: .82; padding: 6px 10px 0 0; color: var(--accent-3); }

/* Popovers: hidden until their wrapper is opened */
[data-popover] > .menu, [data-popover] > .react-menu { display: none; }
[data-popover].open > .menu { display: block; }
[data-popover].open > .react-menu { display: flex; }
.profile-name .verified { width: 22px; height: 22px; vertical-align: 2px; margin-left: 4px; }
.icon-btn { flex-shrink: 0; }
.toast { border-radius: 16px; }
@media (max-width: 960px) {
  .brand-word { font-size: 1.28rem; }
  .brand-mark { width: 26px; height: 26px; }
  .topbar .brand { min-width: 0; gap: 7px; }
  .demo-banner { padding: 5px 10px; font-size: 11px; flex-wrap: nowrap; }
}
@media (max-width: 380px) { .brand-word .the { display: none; } }
.toasts { width: min(560px, calc(100vw - 32px)); }
