*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg:        #000;
  --panel:     #000;
  --hover:     rgba(231, 233, 234, 0.08);
  --line:      #2f3336;
  --text:      #e7e9ea;
  --dim:       #71767b;
  --accent:    #8ab4ff;
  --accent-bg: #8ab4ff;
  --accent-fg: #06101f;
  --card:      #16181c;
  --radius:    16px;
  --font: "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
  --bar-h: 53px;
}

html { color-scheme: dark; }
body {
  background: var(--bg);
  color: var(--text);
  font: 15px/1.4 var(--font);
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; cursor: pointer; }
svg { fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 6px; }
[hidden] { display: none !important; }
.dim { color: var(--dim); }

/* starfield behind everything */
#stars { position: fixed; inset: 0; width: 100%; height: 100%; z-index: 0; pointer-events: none; }

/* ── layout ── */
.layout {
  position: relative; z-index: 1;
  display: grid;
  grid-template-columns: minmax(230px, 290px) minmax(0, 600px) minmax(280px, 350px);
  justify-content: center;
  min-height: 100vh;
}

.side { position: sticky; top: 0; height: 100vh; overflow-y: auto; scrollbar-width: none; }
.side::-webkit-scrollbar { display: none; }
.side-inner { display: flex; flex-direction: column; gap: 14px; padding: 8px 12px 16px; min-height: 100%; }
.side-left  .side-inner { padding-right: 20px; }
.side-right .side-inner { padding-left: 24px; padding-top: 12px; }

.feed {
  background: var(--panel);
  border-inline: 1px solid var(--line);
  min-height: 100vh;
}

/* ── left: tools ── */
.logo { display: grid; place-items: center; width: 50px; height: 50px; border-radius: 50%; }
.logo:hover { background: var(--hover); }
.logo svg { width: 30px; height: 30px; fill: var(--accent); stroke: none; }

.side-title { font-size: 13px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--dim); padding: 6px 12px 0; }

.tool-list { display: flex; flex-direction: column; gap: 2px; }
.tool {
  display: flex; align-items: flex-start; gap: 16px;
  padding: 12px; border-radius: 16px;
  transition: background .15s;
}
.tool:hover { background: var(--hover); }
.tool.active { background: var(--hover); }
.tool svg { width: 26px; height: 26px; flex: none; margin-top: 2px; }
.tool-name { font-size: 19px; font-weight: 500; line-height: 1.25; display: flex; align-items: center; gap: 6px; }
.tool.active .tool-name { font-weight: 700; }
.tool-name svg { width: 14px; height: 14px; margin: 0; color: var(--dim); }
.tool-desc { font-size: 13px; color: var(--dim); margin-top: 2px; }

.pill-btn {
  display: grid; place-items: center; height: 52px; margin: 6px 12px 0;
  border-radius: 999px; background: var(--text); color: #0f1419;
  font-size: 17px; font-weight: 700; transition: background .15s;
}
.pill-btn:hover { background: #d7dbdc; }

.me-chip {
  margin-top: auto; display: flex; align-items: center; gap: 12px;
  padding: 12px; border-radius: 999px;
}
.me-chip:hover { background: var(--hover); }
.me-text { display: flex; flex-direction: column; min-width: 0; line-height: 1.25; }
.me-text span { font-size: 14px; color: var(--dim); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* avatar */
.avatar {
  flex: none; display: grid; place-items: center;
  width: 40px; height: 40px; border-radius: 50%;
  background: linear-gradient(135deg, #b9c6dd, #5f7397 55%, #2b3550);
  color: #fff; font-weight: 700; font-size: 18px;
}
.avatar.sm { width: 40px; height: 40px; }
.avatar.xl { width: 120px; height: 120px; font-size: 52px; border: 4px solid #000; margin-top: -64px; }

/* ── middle: sticky tabs ── */
.feed-head {
  position: sticky; top: 0; z-index: 5;
  background: rgba(0, 0, 0, .78); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}
.tabs { display: flex; }
.tabs a {
  flex: 1; display: grid; place-items: center; height: var(--bar-h);
  color: var(--dim); font-weight: 500; transition: background .15s;
}
.tabs a:hover { background: var(--hover); }
.tabs a span { position: relative; display: inline-block; padding: 15px 0; }
.tabs a.active { color: var(--text); font-weight: 700; }
.tabs a.active span::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 4px;
  border-radius: 999px; background: var(--accent);
}

.view { animation: fade .25s ease; }
@keyframes fade { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

/* home profile */
.banner {
  height: 200px; border-bottom: 1px solid var(--line);
  background:
    radial-gradient(1.5px 1.5px at 12% 30%, #fff 50%, transparent 51%),
    radial-gradient(1px 1px at 33% 68%, #fff 50%, transparent 51%),
    radial-gradient(1.5px 1.5px at 61% 22%, #fff 50%, transparent 51%),
    radial-gradient(1px 1px at 82% 55%, #fff 50%, transparent 51%),
    radial-gradient(1px 1px at 92% 18%, #fff 50%, transparent 51%),
    radial-gradient(120% 90% at 50% 120%, #2a3f6d 0%, #121a30 45%, #05070d 100%);
}
.profile { padding: 0 16px 16px; border-bottom: 1px solid var(--line); }
.profile h1 { font-size: 22px; font-weight: 800; margin-top: 10px; line-height: 1.2; }
.handle { color: var(--dim); }
.bio { margin-top: 12px; }
.meta { display: flex; flex-wrap: wrap; gap: 4px 16px; margin-top: 12px; color: var(--dim); font-size: 15px; }
.meta span { display: inline-flex; align-items: center; gap: 4px; }
.meta svg { width: 18px; height: 18px; }
.cta-row { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 16px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center;
  height: 36px; padding: 0 18px; border-radius: 999px;
  border: 1px solid #536471; font-weight: 700; font-size: 15px; background: transparent;
  transition: background .15s;
}
.btn:hover { background: var(--hover); }
.btn.primary { background: var(--accent-bg); border-color: transparent; color: var(--accent-fg); }
.btn.primary:hover { background: #a3c4ff; }
.btn.sm { height: 32px; padding: 0 14px; font-size: 13px; }
.btn.show-mobile { display: none; }

.section-label { font-size: 20px; font-weight: 800; padding: 16px; border-bottom: 1px solid var(--line); }
.view-intro { padding: 16px; border-bottom: 1px solid var(--line); }
.view-intro h1 { font-size: 22px; font-weight: 800; }

/* feed "posts" */
.post {
  display: flex; gap: 12px; padding: 16px;
  border-bottom: 1px solid var(--line);
  transition: background .15s;
}
.link-post:hover { background: rgba(255,255,255,.03); }
.post-body { min-width: 0; flex: 1; }
.post-head { display: flex; gap: 6px; align-items: baseline; flex-wrap: wrap; }
.post-head strong { font-weight: 700; }
.post-body p { margin-top: 4px; }
.post-body p + p { margin-top: 10px; }
.post-go { display: inline-block; margin-top: 8px; color: var(--accent); font-size: 14px; }
.text-link { color: var(--accent); }
.text-link:hover { text-decoration: underline; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; list-style: none; margin-top: 8px; }
.chips li { padding: 4px 12px; border: 1px solid var(--line); border-radius: 999px; font-size: 14px; }

.goal-num {
  flex: none; width: 40px; height: 40px; border-radius: 50%;
  display: grid; place-items: center; font-weight: 800;
  border: 1.5px solid var(--accent); color: var(--accent);
}
.progress { height: 6px; border-radius: 999px; background: #202327; margin-top: 12px; overflow: hidden; }
.progress i { display: block; height: 100%; border-radius: inherit; background: var(--accent); }

.not-found { padding: 32px 16px; text-align: center; color: var(--dim); }

/* embedded tool */
.tool-bar {
  position: sticky; top: var(--bar-h); z-index: 4;
  display: flex; align-items: center; gap: 12px; padding: 8px 12px;
  background: rgba(0,0,0,.78); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}
.tool-bar-title { flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 1.25; }
.tool-bar-title strong { font-size: 17px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tool-bar-title .dim { font-size: 12px; }
.icon-btn { display: grid; place-items: center; width: 36px; height: 36px; border-radius: 50%; flex: none; }
.icon-btn:hover { background: var(--hover); }
.icon-btn svg { width: 20px; height: 20px; }
#tool-frame { display: block; width: 100%; height: calc(100vh - var(--bar-h) - 53px); border: 0; background: #0f0f0e; }

/* ── right: articles ── */
.search {
  position: sticky; top: 0; z-index: 2;
  display: flex; align-items: center; gap: 12px; height: 44px; padding: 0 16px;
  background: #000; border: 1px solid var(--line); border-radius: 999px;
}
.search:focus-within { border-color: var(--accent); }
.search svg { width: 18px; height: 18px; color: var(--dim); flex: none; }
.search:focus-within svg { color: var(--accent); }
.search input {
  flex: 1; min-width: 0; background: none; border: 0; outline: 0; color: var(--text); font: inherit;
}
.search input::placeholder { color: var(--dim); }

.card { border: 1px solid var(--line); border-radius: var(--radius); background: rgba(0,0,0,.72); overflow: hidden; }
.card h2 { font-size: 20px; font-weight: 800; padding: 12px 16px; }

.post-card { display: block; padding: 12px 16px; transition: background .15s; }
a.post-card:hover { background: var(--hover); }
div.post-card { cursor: default; }
.post-card .kicker { display: flex; gap: 6px; font-size: 13px; color: var(--dim); }
.post-card .kicker b { color: var(--accent); font-weight: 600; }
.post-card .title { font-weight: 700; font-size: 15px; margin: 2px 0; line-height: 1.3; }
.post-card .soon { display: inline-block; margin-top: 2px; font-size: 12px; color: var(--dim); border: 1px solid var(--line); border-radius: 999px; padding: 0 8px; }
.empty { padding: 4px 16px 16px; color: var(--dim); }

.topic-row { display: flex; flex-wrap: wrap; gap: 8px; padding: 0 16px 16px; }
.topic {
  padding: 4px 12px; border: 1px solid var(--line); border-radius: 999px;
  background: transparent; font-size: 14px; transition: background .15s, border-color .15s;
}
.topic:hover { background: var(--hover); }
.topic[aria-pressed="true"] { border-color: var(--accent); color: var(--accent); }

.side-foot { padding: 4px 16px; color: var(--dim); font-size: 13px; }


/* ── stories ── */
.latest {
  display: flex; flex-direction: column; gap: 2px;
  margin: 4px 12px 8px; padding: 12px 14px; border-radius: 16px;
  border: 1px solid var(--line); background: rgba(22, 24, 28, .75);
  transition: background .15s, border-color .15s;
}
.latest:hover, .latest.active { background: rgba(138, 180, 255, .1); border-color: rgba(138, 180, 255, .45); }
.latest-label { font-size: 12px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--accent); }
.latest-title { font-family: Georgia, "Times New Roman", serif; font-size: 18px; font-weight: 700; line-height: 1.3; }
.latest-meta { font-size: 13px; color: var(--dim); }
.latest-meta:empty { display: none; }

.empty-note { padding: 32px 16px; color: var(--dim); text-align: center; }
.story-card .story-meta { font-size: 13px; }
.story-card .post-head strong { font-family: Georgia, "Times New Roman", serif; font-size: 18px; }

.story { padding: 24px 20px 64px; }
.story h1 { font-family: Georgia, "Times New Roman", serif; font-size: 32px; line-height: 1.2; font-weight: 700; }
.story .story-meta { margin: 8px 0 28px; font-size: 14px; }

/* mobile bottom bar */
.bottom-bar { display: none; }

/* ── responsive ── */
@media (max-width: 1100px) {
  .layout { grid-template-columns: minmax(230px, 260px) minmax(0, 600px) minmax(260px, 300px); }
  .side-right .side-inner { padding-left: 16px; }
}

/* below this: one panel at a time, switched from the bottom bar */
@media (max-width: 900px) {
  .layout { display: block; max-width: 640px; margin: 0 auto; padding-bottom: 64px; }
  .side { position: static; height: auto; overflow: visible; }
  .side-inner { padding: 12px 16px 24px; min-height: 0; background: rgba(0,0,0,.85); }
  .side-right .side-inner { padding-left: 16px; }
  .feed { border-inline: 1px solid var(--line); }
  .side, .feed { display: none; }
  body[data-panel="left"]  .side-left,
  body[data-panel="right"] .side-right { display: block; }
  body[data-panel="mid"]   .feed { display: block; }
  .logo, .me-chip { display: none; }
  .btn.show-mobile { display: inline-flex; }
  #tool-frame { height: calc(100vh - var(--bar-h) - 53px - 64px); }

  .bottom-bar {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; height: 64px;
    display: flex; background: rgba(0,0,0,.92); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
    border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom);
  }
  .bottom-bar button {
    flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
    background: none; border: 0; color: var(--dim); font-size: 12px;
  }
  .bottom-bar svg { width: 24px; height: 24px; }
  body[data-panel="left"]  .bottom-bar [data-show="left"],
  body[data-panel="mid"]   .bottom-bar [data-show="mid"],
  body[data-panel="right"] .bottom-bar [data-show="right"] { color: var(--accent); }
}

@media (max-width: 480px) {
  .banner { height: 140px; }
  .avatar.xl { width: 92px; height: 92px; font-size: 40px; margin-top: -48px; }
}

@media (prefers-reduced-motion: reduce) {
  .view { animation: none; }
  * { transition: none !important; }
}
