/* ============================================================
   NEBULA — light, blue-cyan, glass on deep space
   Kept deliberately lighter than AETHER: no giant display type,
   no full-page aurora blobs, tighter spacing, phone-first.
   ============================================================ */
@font-face { font-family: 'Space Grotesk'; src: url('../assets/fonts/space-grotesk.woff2') format('woff2'); font-weight: 300 700; font-display: swap; }
@font-face { font-family: 'Plex Mono'; src: url('../assets/fonts/plexmono-400.woff2') format('woff2'); font-weight: 400; font-display: swap; }
@font-face { font-family: 'Plex Mono'; src: url('../assets/fonts/plexmono-500.woff2') format('woff2'); font-weight: 500; font-display: swap; }

:root {
  --bg: #04070f;
  --panel: rgba(16, 23, 38, .72);
  --panel-solid: #0e1524;
  --line: rgba(140, 190, 255, .14);
  --line-2: rgba(140, 190, 255, .08);
  --ink: #e8f0ff;
  --ink-2: #a9bcd8;
  --ink-3: #6d809d;
  --ink-4: #4a5a73;
  --cyan: #67e7ff;
  --blue: #4d8dff;
  --violet: #9d7bff;
  --good: #4ee0a8;
  --warn: #ffb55c;
  --err: #ff7a8a;
  --r: 14px;
  --r-sm: 10px;
  --sans: 'Space Grotesk', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', system-ui, sans-serif;
  --mono: 'Plex Mono', 'PingFang SC', 'Microsoft YaHei', monospace;
  --ease: cubic-bezier(.22, 1, .36, 1);
  --bar-h: 62px;
}

* { box-sizing: border-box; }
/* the UA rule for [hidden] loses to any author `display`, so restate it once */
[hidden] { display: none !important; }
html { scroll-behavior: smooth; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
  min-height: 100svh;
}
::selection { background: rgba(103, 231, 255, .28); color: #fff; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
input, textarea { font: inherit; color: inherit; }
h1, h2, h3 { margin: 0; font-weight: 500; letter-spacing: -.015em; }
ul { margin: 0; padding: 0; list-style: none; }
svg { display: block; }
code { font-family: var(--mono); }

/* ---------- background ---------- */
#field { position: fixed; inset: 0; width: 100vw; height: 100vh; z-index: 0; pointer-events: none; }
.glow {
  position: fixed; z-index: 0; border-radius: 50%; pointer-events: none;
  filter: blur(90px); opacity: .5;
}
.glow--a {
  width: 52vw; height: 52vw; left: -14vw; top: -18vw;
  background: radial-gradient(circle, rgba(77, 141, 255, .28), transparent 66%);
  animation: drift 30s ease-in-out infinite;
}
.glow--b {
  width: 44vw; height: 44vw; right: -12vw; bottom: -14vw;
  background: radial-gradient(circle, rgba(103, 231, 255, .18), transparent 66%);
  animation: drift 38s ease-in-out infinite reverse;
}
@keyframes drift { 50% { transform: translate(3vw, 3vw) scale(1.1); } }
.grain {
  position: fixed; inset: 0; z-index: 1; pointer-events: none; opacity: .035;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2'/%3E%3C/filter%3E%3Crect width='160' height='160' filter='url(%23n)'/%3E%3C/svg%3E");
  mix-blend-mode: overlay;
}

/* ---------- top bar ---------- */
.bar {
  position: sticky; top: 0; z-index: 60;
  display: flex; align-items: center; gap: 18px;
  height: var(--bar-h); padding: 0 clamp(14px, 3vw, 34px);
  background: rgba(4, 7, 15, .74);
  -webkit-backdrop-filter: blur(18px) saturate(150%);
  backdrop-filter: blur(18px) saturate(150%);
  border-bottom: 1px solid var(--line-2);
}
.bar__brand { display: flex; align-items: center; gap: 9px; flex: none; }
.bar__mark { width: 22px; height: 22px; color: var(--cyan); }
.bar__mark svg { width: 100%; height: 100%; fill: none; stroke: currentColor; stroke-width: 1.4; }
.bar__brand b { font-size: 15px; letter-spacing: .16em; font-weight: 600; }
.bar__brand i { font-family: var(--mono); font-style: normal; font-size: 9px; letter-spacing: .1em; color: var(--ink-4); }
.bar__tabs { display: flex; gap: 2px; overflow-x: auto; scrollbar-width: none; flex: 1; min-width: 0; }
.bar__tabs::-webkit-scrollbar { display: none; }
.bar__tabs button {
  flex: none; padding: 7px 13px; border-radius: 100px;
  font-size: 13px; color: var(--ink-3); white-space: nowrap;
  transition: color .25s, background .25s;
}
.bar__tabs button:hover { color: var(--ink); background: rgba(255, 255, 255, .05); }
.bar__tabs button.is-on { color: #04121a; background: var(--cyan); font-weight: 500; }
.bar__right { display: flex; align-items: center; gap: 10px; flex: none; }
.search { position: relative; display: flex; align-items: center; }
.search svg {
  position: absolute; left: 11px; width: 15px; height: 15px;
  fill: none; stroke: var(--ink-4); stroke-width: 1.6; pointer-events: none;
}
.search input {
  width: 176px; padding: 8px 12px 8px 32px; border-radius: 100px;
  background: rgba(255, 255, 255, .05); border: 1px solid var(--line-2);
  font-size: 13px; outline: none; transition: .25s;
}
.search input::placeholder { color: var(--ink-4); }
.search input:focus { border-color: rgba(103, 231, 255, .5); background: rgba(255, 255, 255, .08); width: 220px; }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  padding: 9px 16px; border-radius: 100px; font-size: 13.5px; font-weight: 500;
  white-space: nowrap; transition: .25s var(--ease);
  min-height: 38px;
}
.btn svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 2; }
.btn--primary { background: var(--cyan); color: #04121a; box-shadow: 0 6px 24px -10px rgba(103, 231, 255, .9); }
.btn--primary:hover { background: #9af1ff; transform: translateY(-1px); }
.btn--primary:active { transform: none; }
.btn--ghost { border: 1px solid var(--line); color: var(--ink-2); }
.btn--ghost:hover { border-color: rgba(103, 231, 255, .45); color: var(--ink); }
.btn--wide { width: 100%; }
.btn[disabled] { opacity: .55; pointer-events: none; }

/* ---------- demo note ---------- */
.demo-note {
  position: relative; z-index: 50;
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  padding: 9px clamp(14px, 3vw, 34px);
  background: rgba(255, 181, 92, .1); border-bottom: 1px solid rgba(255, 181, 92, .25);
  font-size: 12px; color: var(--warn);
}
.demo-note b { font-weight: 600; }
.demo-note code {
  padding: 1px 5px; border-radius: 4px; background: rgba(0, 0, 0, .3);
  font-size: 11px; color: var(--ink);
}
.demo-note button { margin-left: auto; color: var(--warn); opacity: .7; font-size: 12px; padding: 2px 4px; }
.demo-note__short { display: none; }

/* ---------- page / views ---------- */
.page { position: relative; z-index: 5; max-width: 1180px; margin: 0 auto; padding: 26px clamp(14px, 3vw, 30px) 96px; }
.view[hidden] { display: none; }

.head {
  display: flex; align-items: flex-end; justify-content: space-between;
  gap: 18px; padding: 8px 0 22px; border-bottom: 1px solid var(--line-2); margin-bottom: 22px;
}
.eyebrow {
  display: inline-flex; align-items: center; gap: 7px; margin: 0 0 8px;
  font-family: var(--mono); font-size: 10px; letter-spacing: .18em;
  color: var(--ink-3); text-transform: uppercase;
}
.pulse { width: 5px; height: 5px; border-radius: 50%; background: var(--cyan); box-shadow: 0 0 0 0 rgba(103, 231, 255, .6); animation: pulse 2.4s infinite; }
@keyframes pulse {
  0% { box-shadow: 0 0 0 0 rgba(103, 231, 255, .55); }
  70% { box-shadow: 0 0 0 8px rgba(103, 231, 255, 0); }
  100% { box-shadow: 0 0 0 0 rgba(103, 231, 255, 0); }
}
.head h1 { font-size: clamp(21px, 3vw, 30px); font-weight: 500; letter-spacing: -.02em; }
.sort { display: flex; gap: 4px; padding: 3px; border-radius: 100px; border: 1px solid var(--line-2); background: rgba(255, 255, 255, .03); flex: none; }
.sort button {
  padding: 6px 14px; border-radius: 100px; font-size: 12.5px; color: var(--ink-3);
  transition: .25s;
}
.sort button.is-on { background: rgba(103, 231, 255, .14); color: var(--cyan); }

.layout { display: grid; grid-template-columns: minmax(0, 1fr) 268px; gap: 22px; align-items: start; }

/* ---------- feed ---------- */
.feed { display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.thread {
  position: relative; display: block; width: 100%; text-align: left;
  padding: 16px 18px; border-radius: var(--r);
  background: var(--panel); border: 1px solid var(--line-2);
  transition: border-color .25s, background .25s, transform .25s var(--ease);
  overflow: hidden;
}
.thread::before {
  content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 2px;
  background: var(--bc, var(--cyan)); opacity: .0; transition: opacity .25s;
}
.thread:hover { border-color: rgba(103, 231, 255, .3); background: rgba(22, 32, 52, .8); transform: translateY(-1px); }
.thread:hover::before { opacity: 1; }
.thread__top { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; flex-wrap: wrap; }
.badge {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 2px 8px; border-radius: 100px; font-size: 11px; font-weight: 500;
  background: color-mix(in srgb, var(--bc, var(--cyan)) 14%, transparent);
  color: var(--bc, var(--cyan)); border: 1px solid color-mix(in srgb, var(--bc, var(--cyan)) 28%, transparent);
}
.thread h2 {
  font-size: 16px; font-weight: 500; line-height: 1.5; margin: 0 0 7px;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.thread__excerpt {
  margin: 0 0 12px; font-size: 13.5px; line-height: 1.7; color: var(--ink-3);
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.thread__foot { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; font-size: 12px; color: var(--ink-4); }
.thread__author { display: inline-flex; align-items: center; gap: 6px; color: var(--ink-2); }
.avatar {
  width: 20px; height: 20px; border-radius: 50%; flex: none;
  display: grid; place-items: center; font-size: 10px; font-weight: 600;
  background: hsl(var(--h, 196 90% 62%));
  color: #04121a;
}
.thread__tags { display: flex; gap: 5px; flex-wrap: wrap; margin-left: auto; }
.thread__tags span {
  font-family: var(--mono); font-size: 10px; padding: 1px 7px; border-radius: 4px;
  background: rgba(255, 255, 255, .05); color: var(--ink-3);
}
.metric { display: inline-flex; align-items: center; gap: 4px; }
.metric svg { width: 13px; height: 13px; fill: none; stroke: currentColor; stroke-width: 1.7; }
.metric.is-liked { color: var(--cyan); }
.metric.is-liked svg { fill: rgba(103, 231, 255, .3); }

.skeleton { display: flex; flex-direction: column; gap: 10px; }
.skeleton i {
  display: block; height: 118px; border-radius: var(--r);
  background: linear-gradient(100deg, rgba(255, 255, 255, .04) 30%, rgba(255, 255, 255, .08) 50%, rgba(255, 255, 255, .04) 70%);
  background-size: 250% 100%; animation: shimmer 1.3s linear infinite;
}
@keyframes shimmer { to { background-position: -150% 0; } }
.empty { padding: 60px 20px; text-align: center; color: var(--ink-3); }
.empty p { margin: 0 0 16px; }
.loadmore {
  align-self: center; margin-top: 10px; padding: 10px 22px; border-radius: 100px;
  border: 1px solid var(--line); color: var(--ink-2); font-size: 13px; transition: .25s;
}
.loadmore:hover { border-color: rgba(103, 231, 255, .45); color: var(--ink); }

/* ---------- sidebar ---------- */
.side { display: flex; flex-direction: column; gap: 12px; position: sticky; top: calc(var(--bar-h) + 18px); }
.card {
  padding: 16px; border-radius: var(--r);
  background: var(--panel); border: 1px solid var(--line-2);
}
.card h3 {
  font-family: var(--mono); font-size: 10px; letter-spacing: .18em; text-transform: uppercase;
  color: var(--ink-4); margin: 0 0 12px; font-weight: 400;
}
.card--tips ul { display: flex; flex-direction: column; gap: 9px; }
.card--tips li { font-size: 12.5px; line-height: 1.6; color: var(--ink-3); }
.card--tips li b { color: var(--cyan); font-weight: 500; margin-right: 6px; }

.me { display: flex; align-items: center; gap: 11px; }
.me__avatar {
  width: 40px; height: 40px; border-radius: 50%; flex: none;
  display: grid; place-items: center; font-size: 16px; font-weight: 600;
  background: linear-gradient(150deg, var(--cyan), var(--blue)); color: #04121a;
  overflow: hidden;
}
.me__avatar--img { background: rgba(255, 255, 255, .06); }
.me__avatar img { width: 100%; height: 100%; object-fit: cover; display: block; }
.me__avatar-link { display: inline-flex; flex: none; }
.me__body { min-width: 0; }
.me__body b { display: block; font-size: 14px; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.me__body span { display: block; font-family: var(--mono); font-size: 10px; color: var(--ink-4); }
.me__actions { display: flex; gap: 6px; margin-top: 12px; }
.me__actions .btn { flex: 1; padding: 7px 10px; font-size: 12px; min-height: 32px; }

.boardlist { display: flex; flex-direction: column; gap: 2px; }
.boardlist button {
  display: flex; align-items: center; gap: 9px; width: 100%; text-align: left;
  padding: 8px 9px; border-radius: var(--r-sm); font-size: 13px; color: var(--ink-2);
  transition: background .2s, color .2s;
}
.boardlist button:hover { background: rgba(255, 255, 255, .05); color: var(--ink); }
.boardlist button.is-on { background: rgba(103, 231, 255, .1); color: var(--cyan); }
.boardlist .dot { width: 7px; height: 7px; border-radius: 50%; flex: none; }
.boardlist .cnt { margin-left: auto; font-family: var(--mono); font-size: 10.5px; color: var(--ink-4); }

/* ---------- thread detail ---------- */
.back {
  display: inline-flex; align-items: center; gap: 6px; margin-bottom: 16px;
  font-size: 13px; color: var(--ink-3); padding: 6px 0;
}
.back:hover { color: var(--cyan); }
.back svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 1.8; }

.article {
  padding: 24px; border-radius: var(--r);
  background: var(--panel); border: 1px solid var(--line-2);
}
.article__top { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }
.article h1 { font-size: clamp(20px, 3vw, 28px); line-height: 1.35; margin: 0 0 12px; font-weight: 500; }
.article__meta { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; font-size: 12.5px; color: var(--ink-4); padding-bottom: 16px; border-bottom: 1px solid var(--line-2); margin-bottom: 18px; }
.article__meta .avatar { width: 24px; height: 24px; font-size: 11px; }
.article__meta b { color: var(--ink-2); font-weight: 500; }
.article__body { font-size: 15px; line-height: 1.85; color: var(--ink-2); word-break: break-word; }
.article__body p { margin: 0 0 14px; }
.article__body pre {
  margin: 0 0 14px; padding: 12px 14px; border-radius: var(--r-sm);
  background: rgba(0, 0, 0, .34); border: 1px solid var(--line-2);
  border-left: 2px solid rgba(103, 231, 255, .5);
  overflow-x: auto; font-size: 12.5px; line-height: 1.7;
}
.article__body code {
  font-size: .92em; padding: 1px 5px; border-radius: 4px;
  background: rgba(103, 231, 255, .1); color: var(--cyan);
}
.article__body pre code { background: none; padding: 0; color: inherit; }
.article__tags { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 18px; }
.article__tags span {
  font-family: var(--mono); font-size: 10.5px; padding: 2px 8px; border-radius: 4px;
  background: rgba(255, 255, 255, .05); color: var(--ink-3);
}
.article__actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-top: 20px; padding-top: 16px; border-top: 1px solid var(--line-2); }
.likebtn {
  display: inline-flex; align-items: center; gap: 7px; padding: 9px 16px;
  border-radius: 100px; border: 1px solid var(--line); font-size: 13px;
  color: var(--ink-2); transition: .25s;
}
.likebtn svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 1.8; }
.likebtn.is-on { border-color: rgba(103, 231, 255, .55); color: var(--cyan); background: rgba(103, 231, 255, .1); }
.likebtn.is-on svg { fill: rgba(103, 231, 255, .35); }
.danger { color: var(--err); border-color: rgba(255, 122, 138, .3); }
.danger:hover { background: rgba(255, 122, 138, .1); }

/* ---------- moderation notice ---------- */
.notice {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  padding: 11px 15px; border-radius: 10px; margin-bottom: 12px;
  font-size: 12.5px; line-height: 1.6;
}
.notice--warn {
  background: rgba(255, 181, 92, .1); border: 1px solid rgba(255, 181, 92, .28); color: var(--warn);
}
.notice--bad {
  background: rgba(255, 122, 138, .1); border: 1px solid rgba(255, 122, 138, .3); color: var(--err);
}
.notice__score {
  margin-left: auto; font-family: var(--mono); font-size: 10px; opacity: .8;
}

/* the report button sits quietly next to like */
#reportBtn { color: var(--ink-3); }

/* ---------- comments ---------- */
.comments { margin-top: 18px; padding: 20px 24px; border-radius: var(--r); background: var(--panel); border: 1px solid var(--line-2); }
.comments h2 { font-size: 15px; margin: 0 0 4px; font-weight: 500; }
.comments__count { font-family: var(--mono); font-size: 11px; color: var(--ink-4); }
.comment {
  display: flex; gap: 11px; padding: 15px 0; border-bottom: 1px solid var(--line-2);
}
.comment:last-child { border-bottom: 0; }
.comment .avatar { width: 30px; height: 30px; font-size: 12px; margin-top: 2px; }
.comment__body { min-width: 0; flex: 1; }
.comment__head { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; margin-bottom: 3px; }
.comment__head b { font-size: 13px; font-weight: 500; color: var(--ink); }
.comment__head span { font-family: var(--mono); font-size: 10px; color: var(--ink-4); }
.comment__text { font-size: 14px; line-height: 1.75; color: var(--ink-2); white-space: pre-wrap; word-break: break-word; }
.comment__del { font-size: 11px; color: var(--ink-4); margin-left: auto; padding: 2px 6px; }
.comment__del:hover { color: var(--err); }
.comments__empty { padding: 26px 0; text-align: center; color: var(--ink-4); font-size: 13px; }

.commentbox { margin-top: 16px; }
.commentbox textarea {
  width: 100%; min-height: 82px; padding: 12px 14px; border-radius: var(--r-sm);
  background: rgba(0, 0, 0, .26); border: 1px solid var(--line-2);
  font-size: 14px; line-height: 1.7; resize: vertical; outline: none; transition: border-color .25s;
}
.commentbox textarea:focus { border-color: rgba(103, 231, 255, .5); }
.commentbox__foot { display: flex; align-items: center; gap: 12px; margin-top: 9px; flex-wrap: wrap; }
.commentbox__hint { font-size: 12px; color: var(--ink-4); }
.commentbox__hint a { color: var(--cyan); }
.commentbox__foot .btn { margin-left: auto; }

/* ---------- modals ---------- */
.modal {
  position: fixed; inset: 0; z-index: 120; display: grid; place-items: center;
  padding: 18px; opacity: 0; visibility: hidden; transition: opacity .25s, visibility .25s;
}
.modal.is-on { opacity: 1; visibility: visible; }
.modal__scrim { position: absolute; inset: 0; background: rgba(2, 4, 9, .72); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); }
.modal__panel {
  position: relative; width: min(410px, 100%); max-height: calc(100svh - 36px); overflow-y: auto;
  padding: 26px; border-radius: 18px;
  background: linear-gradient(165deg, rgba(22, 32, 52, .98), rgba(10, 16, 28, .99));
  border: 1px solid var(--line);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .08), 0 30px 80px -30px #000;
  transform: translateY(10px) scale(.985); transition: transform .3s var(--ease);
}
.modal.is-on .modal__panel { transform: none; }
.modal__panel--wide { width: min(620px, 100%); }
.modal__x {
  position: absolute; right: 14px; top: 14px; width: 30px; height: 30px;
  border-radius: 50%; display: grid; place-items: center;
  color: var(--ink-3); font-size: 13px; transition: .25s;
}
.modal__x:hover { background: rgba(255, 255, 255, .08); color: var(--ink); }
.modal__panel h2 { font-size: 20px; margin: 0 0 6px; font-weight: 500; }
.modal__sub { margin: 0 0 18px; font-size: 12.5px; color: var(--ink-3); line-height: 1.7; }

.seg { display: flex; gap: 4px; padding: 3px; border-radius: 100px; background: rgba(255, 255, 255, .05); margin-bottom: 16px; }
.seg button { flex: 1; padding: 8px; border-radius: 100px; font-size: 13px; color: var(--ink-3); transition: .25s; }
.seg button.is-on { background: rgba(103, 231, 255, .16); color: var(--cyan); font-weight: 500; }
.seg--boards { flex-wrap: wrap; border-radius: 12px; }
.seg--boards button { flex: 1 1 45%; padding: 9px 8px; border-radius: 9px; font-size: 12.5px; }

.field { display: block; margin-bottom: 14px; }
.field > span { display: block; margin-bottom: 6px; font-family: var(--mono); font-size: 10px; letter-spacing: .14em; text-transform: uppercase; color: var(--ink-3); }
.field input, .field textarea {
  width: 100%; padding: 11px 13px; border-radius: var(--r-sm);
  background: rgba(0, 0, 0, .26); border: 1px solid var(--line-2);
  font-size: 14px; outline: none; transition: border-color .25s, background .25s;
}
.field textarea { line-height: 1.7; resize: vertical; min-height: 150px; font-family: var(--sans); }
.field input:focus, .field textarea:focus { border-color: rgba(103, 231, 255, .5); background: rgba(0, 0, 0, .36); }
.field input::placeholder, .field textarea::placeholder { color: var(--ink-4); }
.formerr { min-height: 18px; margin: 0 0 8px; font-size: 12px; color: var(--err); }
.compose__foot { display: flex; align-items: center; gap: 12px; }
.counter { font-family: var(--mono); font-size: 10.5px; color: var(--ink-4); margin-right: auto; }

/* ---------- mobile sheet + tabbar ---------- */
.sheet { position: fixed; inset: 0; z-index: 110; display: none; }
.sheet.is-on { display: block; }
.sheet__scrim { position: absolute; inset: 0; background: rgba(2, 4, 9, .66); }
.sheet__panel {
  position: absolute; left: 0; right: 0; bottom: 0;
  padding: 10px 18px calc(20px + env(safe-area-inset-bottom));
  background: #0b1220; border-top: 1px solid var(--line);
  border-radius: 20px 20px 0 0;
  transform: translateY(100%); transition: transform .32s var(--ease);
}
.sheet.is-on .sheet__panel { transform: none; }
.sheet__grab { width: 38px; height: 4px; border-radius: 2px; background: rgba(255, 255, 255, .18); margin: 4px auto 14px; }
.sheet__panel h3 { font-size: 14px; margin: 0 0 12px; font-family: var(--mono); letter-spacing: .16em; text-transform: uppercase; color: var(--ink-4); font-weight: 400; }
.boardlist--sheet { margin-bottom: 14px; }
.boardlist--sheet button { padding: 12px 10px; font-size: 14px; }

.tabbar {
  display: none; position: fixed; left: 0; right: 0; bottom: 0; z-index: 100;
  padding: 6px 6px calc(6px + env(safe-area-inset-bottom));
  background: rgba(6, 10, 19, .92);
  -webkit-backdrop-filter: blur(18px); backdrop-filter: blur(18px);
  border-top: 1px solid var(--line);
  grid-template-columns: repeat(5, 1fr);
}
.tabbar a, .tabbar button {
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  padding: 7px 0; border-radius: 12px; color: var(--ink-4); font-size: 10px;
  transition: color .2s;
}
.tabbar svg { width: 21px; height: 21px; fill: none; stroke: currentColor; stroke-width: 1.7; }
.tabbar a.is-on, .tabbar button.is-on { color: var(--cyan); }
.tabbar__cta {
  justify-self: center; align-self: center;
  width: 46px; height: 46px; border-radius: 50% !important;
  background: var(--cyan); color: #04121a !important;
  box-shadow: 0 8px 26px -8px rgba(103, 231, 255, .9);
}
.tabbar__cta svg { width: 22px; height: 22px; stroke-width: 2.4; }

/* ---------- toast ---------- */
.toast {
  position: fixed; left: 50%; bottom: 26px; z-index: 200;
  transform: translate(-50%, 16px); opacity: 0; pointer-events: none;
  padding: 11px 20px; border-radius: 100px;
  background: rgba(14, 22, 36, .97); border: 1px solid var(--line);
  font-size: 12.5px; color: var(--ink);
  box-shadow: 0 16px 40px -16px #000;
  transition: .3s var(--ease); max-width: 88vw; text-align: center;
}
.toast.is-on { opacity: 1; transform: translate(-50%, 0); }

/* ---------- avatars ---------- */
.avatar--img {
  overflow: hidden; padding: 0;
  background: rgba(255, 255, 255, .06) !important;
  box-shadow: inset 0 0 0 1px rgba(140, 190, 255, .14);
}
.avatar--img img { width: 100%; height: 100%; object-fit: cover; display: block; }
.avatar--xl { width: 84px; height: 84px; font-size: 32px; }
.avatar-link { display: inline-flex; flex: none; }
.avatar-link:hover { transform: translateY(-1px); }
.uname { color: inherit; transition: color .2s; }
.uname:hover { color: var(--cyan); }

/* ---------- user profile page ---------- */
.uprofile {
  display: flex; gap: 20px; align-items: flex-start; flex-wrap: wrap;
  padding: 22px; border-radius: var(--r);
  background: var(--panel); border: 1px solid var(--line-2);
}
.uprofile__avatar { flex: none; }
.uprofile__main { flex: 1 1 260px; min-width: 0; }
.uprofile__nameline { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.uprofile__nameline h1 { font-size: clamp(20px, 2.6vw, 26px); margin: 0; }
.uprofile__sig { margin: 8px 0 0; font-size: 13.5px; line-height: 1.7; color: var(--ink-2); }
.uprofile__sig--empty { color: var(--ink-4); font-style: italic; }
.uprofile__bio { margin: 6px 0 0; font-size: 12.5px; line-height: 1.7; color: var(--ink-3); white-space: pre-wrap; }
.uprofile__stats {
  display: flex; align-items: baseline; flex-wrap: wrap;
  gap: 4px 18px; margin-top: 14px;
  font-size: 12px; color: var(--ink-4);
  font-family: var(--mono); letter-spacing: .04em;
}
.uprofile__stats b {
  color: var(--ink); font-size: 15px; font-weight: 600; margin-right: 5px;
  font-variant-numeric: tabular-nums;
}
.uprofile__stats > * { white-space: nowrap; }
.uprofile__stats > * + *::before {
  content: ''; display: inline-block; width: 3px; height: 3px; margin-right: 18px;
  border-radius: 50%; background: rgba(140, 190, 255, .28);
  transform: translateY(-3px);
}
.uprofile__stats a { color: var(--ink-4); transition: color .2s; }
.uprofile__stats a:hover { color: var(--cyan); }
.uprofile__acts { display: flex; gap: 8px; flex-wrap: wrap; margin-left: auto; }

.uprofile__bar {
  display: flex; align-items: center; justify-content: space-between;
  gap: 14px; margin: 24px 0 12px; padding-bottom: 10px;
  border-bottom: 1px solid var(--line-2);
}
.uprofile__bar h2 { font-size: 15px; font-weight: 500; }
.uposts { display: flex; flex-direction: column; gap: 9px; }
.upost {
  display: block; padding: 15px 17px; border-radius: 12px;
  background: var(--panel); border: 1px solid var(--line-2);
  transition: border-color .25s, transform .25s var(--ease), background .25s;
}
.upost:hover { border-color: rgba(103, 231, 255, .28); transform: translateY(-1px); background: rgba(22, 32, 52, .82); }
.upost__top { display: flex; gap: 7px; margin-bottom: 7px; flex-wrap: wrap; }
.upost h3 { font-size: 15px; font-weight: 500; line-height: 1.5; margin: 0 0 6px; }
.upost p {
  margin: 0 0 10px; font-size: 13px; line-height: 1.7; color: var(--ink-3);
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.upost__meta { display: flex; gap: 14px; flex-wrap: wrap; font-family: var(--mono); font-size: 10px; color: var(--ink-4); }

/* follow / follower list */
.ulist { display: flex; flex-direction: column; gap: 4px; max-height: 52vh; overflow-y: auto; }
.ulist__row {
  display: flex; align-items: center; gap: 11px; padding: 9px 10px; border-radius: 10px;
  transition: background .2s;
}
.ulist__row:hover { background: rgba(255, 255, 255, .05); }
.ulist__row div { min-width: 0; }
.ulist__row b { display: block; font-size: 13.5px; font-weight: 500; }
.ulist__row span {
  display: block; font-size: 11.5px; color: var(--ink-4);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

/* ---------- avatar editor ---------- */
.avedit { display: flex; gap: 16px; align-items: center; margin-bottom: 18px; flex-wrap: wrap; }
.avedit__preview { flex: none; }
.avedit__side { display: flex; flex-direction: column; gap: 8px; align-items: flex-start; }
.avedit__pick { cursor: pointer; }
.avedit__hint { font-family: var(--mono); font-size: 10px; color: var(--ink-4); letter-spacing: .06em; }
.avedit__hint.is-bad { color: var(--err); }

@media (max-width: 720px) {
  .uprofile { padding: 16px; gap: 14px; }
  .avatar--xl { width: 64px; height: 64px; font-size: 26px; }
  .uprofile__acts { margin-left: 0; width: 100%; }
  .uprofile__acts .btn { flex: 1; }
  .uprofile__stats { gap: 12px; font-size: 11.5px; }
}

/* ---------- responsive ---------- */
@media (max-width: 900px) {
  .layout { grid-template-columns: 1fr; }
  .side { display: none; }
  .search input { width: 130px; }
  .search input:focus { width: 150px; }
}
@media (max-width: 720px) {
  :root { --bar-h: 56px; }
  body { padding-bottom: 68px; }
  .bar { gap: 10px; padding: 0 12px; }
  .bar__brand i { display: none; }
  .bar__tabs { display: none; }
  .bar__right { margin-left: auto; gap: 8px; }
  .search { display: none; }
  .bar__right #authBtn { display: none; }
  .bar__right #newBtn { display: none; }
  .tabbar { display: grid; }
  .page { padding: 14px 12px 26px; }
  .head { flex-direction: column; align-items: flex-start; gap: 10px; padding: 2px 0 14px; margin-bottom: 14px; }
  .head h1 { font-size: 20px; }
  .thread { padding: 14px; border-radius: 12px; }
  .thread h2 { font-size: 15px; }
  .thread__excerpt { font-size: 13px; -webkit-line-clamp: 2; }
  .thread__tags { margin-left: 0; width: 100%; }
  .article { padding: 18px 16px; border-radius: 12px; }
  .article h1 { font-size: 20px; }
  .article__body { font-size: 14.5px; }
  .comments { padding: 16px 14px; border-radius: 12px; }
  .modal { padding: 0; align-items: flex-end; }
  .modal__panel {
    width: 100%; max-height: 92svh; border-radius: 20px 20px 0 0;
    padding: 22px 18px calc(20px + env(safe-area-inset-bottom));
    transform: translateY(16px);
  }
  .modal.is-on .modal__panel { transform: none; }
  .field input, .field textarea { font-size: 16px; } /* prevent iOS zoom-on-focus */
  .commentbox textarea { font-size: 16px; }
  .toast { bottom: 84px; }
  /* one compact line on a phone; the long explanation stays on desktop */
  .demo-note { font-size: 11px; padding: 7px 12px; gap: 6px; line-height: 1.5; }
  .demo-note__long { display: none; }
  .demo-note__short { display: inline; }
  .demo-note code { font-size: 10px; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
/* touch devices: no hover lift, bigger hit areas */
@media (hover: none) {
  .thread:hover { transform: none; }
  .btn { min-height: 42px; }
}
