/* ===================================================================
   SCIX — editorial science & tech publication
   Light-first with true dark mode. Reading-optimized measurements.
   =================================================================== */

:root {
  --bg: #f6f6fa;
  --surface: #ffffff;
  --surface-2: #fbfbfe;
  --ink: #1a1a28;
  --muted: #5f5f74;
  --faint: #8d8da4;
  --border: #e7e7f1;
  --border-strong: #d5d5e6;
  --accent: #6d5bff;
  --accent-2: #b84bff;
  --accent-ink: #ffffff;
  --like: #e0245e;
  --like-on: #e0245e;
  --chip-bg: #efeffa;
  --chip-ink: #4c43b8;
  --hero-ink: #ffffff;
  --shadow: 0 1px 2px rgba(26, 26, 60, .05), 0 8px 24px -12px rgba(26, 26, 60, .18);
  --shadow-lift: 0 2px 4px rgba(26, 26, 60, .06), 0 16px 40px -16px rgba(26, 26, 60, .28);
  --radius: 16px;
  --serif: Georgia, 'Times New Roman', serif;
  --sans: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Inter, 'Helvetica Neue', Arial, sans-serif;
}

[data-theme="dark"] {
  --bg: #0c0c14;
  --surface: #15151f;
  --surface-2: #191926;
  --ink: #ededf5;
  --muted: #a3a3bb;
  --faint: #74748c;
  --border: #252533;
  --border-strong: #34344a;
  --accent: #8b7cff;
  --accent-2: #c77dff;
  --chip-bg: #232340;
  --chip-ink: #b9b1ff;
  --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 8px 24px -12px rgba(0, 0, 0, .5);
  --shadow-lift: 0 2px 4px rgba(0, 0, 0, .4), 0 16px 40px -16px rgba(0, 0, 0, .6);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  transition: background .25s ease, color .25s ease;
}

.shell { max-width: 1120px; margin: 0 auto; padding: 0 24px; }

a { color: inherit; text-decoration: none; }
button { font: inherit; }

.ico-sun, .ico-moon { display: none; }
html:not([data-theme="dark"]) .ico-moon { display: block; }
[data-theme="dark"] .ico-sun { display: block; }

/* ---------------- header ---------------- */

.site-header {
  position: sticky;
  top: 0;
  z-index: 40;
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}

.header-inner {
  display: flex;
  align-items: center;
  gap: 28px;
  height: 64px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 800;
  font-size: 19px;
  letter-spacing: -.02em;
}

.brand-mark { width: 30px; height: 30px; flex: none; }
.brand-mark .bm-node { color: #fff; }
.brand-mark .gs0 { stop-color: #6d5bff; }
.brand-mark .gs1 { stop-color: #b84bff; }

.top-nav { display: flex; gap: 18px; font-size: 14.5px; font-weight: 600; }
.top-nav a { color: var(--muted); padding: 6px 2px; border-radius: 8px; }
.top-nav a:hover { color: var(--ink); }
.top-nav a.active { color: var(--ink); }

.nav-quiet { display: none; }
@media (min-width: 720px) { .nav-quiet { display: inline; } }

.header-tools { margin-left: auto; display: flex; align-items: center; gap: 10px; }

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border: 1px solid var(--border);
  border-radius: 11px;
  background: var(--surface);
  color: var(--muted);
  cursor: pointer;
  transition: color .15s, border-color .15s, transform .15s;
}
.icon-btn:hover { color: var(--ink); border-color: var(--border-strong); transform: translateY(-1px); }

.auth-box { display: flex; align-items: center; gap: 10px; }
.auth-box[data-pending="true"] { visibility: hidden; }

.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 16px;
  border-radius: 11px;
  border: 1px solid var(--border-strong);
  background: var(--surface);
  color: var(--ink);
  font-weight: 650;
  font-size: 14px;
  cursor: pointer;
  transition: transform .15s, box-shadow .15s, background .15s;
}
.btn:hover { transform: translateY(-1px); box-shadow: var(--shadow); }

.btn-primary {
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  border-color: transparent;
  color: #fff;
  box-shadow: 0 6px 18px -6px color-mix(in srgb, var(--accent) 55%, transparent);
}
.btn-primary:hover { filter: brightness(1.06); }

.btn-ghost { border-color: transparent; background: transparent; color: var(--muted); }
.btn-ghost:hover { color: var(--ink); background: var(--chip-bg); }

.user-chip { display: flex; align-items: center; gap: 9px; }
.avatar {
  width: 32px; height: 32px;
  border-radius: 50%;
  display: grid; place-items: center;
  font-size: 13px; font-weight: 700;
  color: #fff;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  flex: none;
}
.user-name { font-size: 13.5px; font-weight: 650; max-width: 140px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------------- hero ---------------- */

.hero { margin: 28px 0 8px; border-radius: 22px; overflow: hidden; }

.hero-card {
  position: relative;
  display: block;
  padding: clamp(28px, 5vw, 56px);
  border-radius: 22px;
  color: var(--hero-ink);
  min-height: 340px;
  isolation: isolate;
  box-shadow: var(--shadow);
  overflow: hidden;
}

.hero-card::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(900px 320px at 85% -10%, rgba(255,255,255,.28), transparent 60%),
    radial-gradient(700px 400px at -10% 110%, rgba(255,255,255,.16), transparent 60%),
    var(--hero-bg);
  z-index: -1;
}

.hero-card::after {
  content: "";
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(255,255,255,.07) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,.07) 1px, transparent 1px);
  background-size: 44px 44px;
  mask-image: radial-gradient(700px 500px at 70% 20%, #000, transparent 75%);
  z-index: -1;
}

.hero-accent0 { --hero-bg: linear-gradient(130deg, #4318c9 0%, #6d5bff 55%, #a24bd8 100%); }
.hero-accent1 { --hero-bg: linear-gradient(130deg, #0a4f8f 0%, #1273d4 55%, #19b6c4 100%); }
.hero-accent2 { --hero-bg: linear-gradient(130deg, #131318 0%, #34343e 60%, #5a3a72 100%); }
.hero-accent3 { --hero-bg: linear-gradient(130deg, #7a1e88 0%, #b12d92 55%, #e6467d 100%); }
.hero-accent4 { --hero-bg: linear-gradient(130deg, #135c46 0%, #159170 50%, #1fbfa0 100%); }
.hero-accent5 { --hero-bg: linear-gradient(130deg, #b23a12 0%, #e05e1f 60%, #f5a623 110%); }

.chip {
  display: inline-block;
  padding: 5px 12px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 750;
  letter-spacing: .08em;
  text-transform: uppercase;
}
.chip-solid { background: rgba(255,255,255,.18); color: #fff; border: 1px solid rgba(255,255,255,.35); backdrop-filter: blur(4px); }

.hero-card .chip { margin-bottom: 18px; }

.hero-title {
  margin: 0 0 14px;
  font-size: clamp(26px, 4.4vw, 44px);
  line-height: 1.14;
  letter-spacing: -.025em;
  font-weight: 800;
  max-width: 22ch;
}
.hero-card a { color: inherit; display: block; }
.hero-card a:hover .hero-title, .post-card h3 a:hover { text-decoration: underline; text-decoration-thickness: 2px; text-underline-offset: 4px; }

.hero-excerpt { max-width: 62ch; font-size: 17px; line-height: 1.6; opacity: .94; margin: 0 0 20px; }

.hero-meta, .post-meta { display: flex; align-items: center; flex-wrap: wrap; gap: 9px; font-size: 13.5px; }
.hero-meta { opacity: .92; }
.meta-dot { opacity: .55; }
.meta-item { display: inline-flex; align-items: center; gap: 6px; }
.meta-item svg { width: 14px; height: 14px; opacity: .8; }

/* ---------------- feed layout ---------------- */

.section-head { display: flex; align-items: center; gap: 14px; margin: 26px 0 16px; }
.section-head h2 { margin: 0; font-size: 17px; font-weight: 800; letter-spacing: -.01em; }
.section-rule { flex: 1; height: 1px; background: var(--border); }

.feed-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 300px;
  gap: 40px;
  padding-bottom: 56px;
}
@media (max-width: 960px) {
  .feed-layout { grid-template-columns: 1fr; }
}

.feed-list { display: flex; flex-direction: column; }

.post-card {
  display: grid;
  grid-template-columns: 1fr;
  gap: 4px 16px;
  padding: 22px 4px;
  border-bottom: 1px solid var(--border);
  transition: background .15s;
}
@media (min-width: 640px) {
  .post-card { grid-template-columns: minmax(0, 1fr) 148px; }
}
.post-card:hover { background: var(--surface); }

.post-card .chip { justify-self: start; margin-left: -9px; background: var(--chip-bg); color: var(--chip-ink); }
.post-card h3 { margin: 0; font-size: 21px; line-height: 1.3; letter-spacing: -.015em; font-weight: 750; }
.post-card .dek { margin: 0; color: var(--muted); font-size: 15px; line-height: 1.55; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.card-meta { grid-column: 1; display: flex; align-items: center; flex-wrap: wrap; gap: 9px; color: var(--faint); font-size: 13px; margin-top: 8px; }

.thumb {
  grid-row: 1 / span 3;
  align-self: stretch;
  border-radius: 12px;
  min-height: 96px;
  transform: translateZ(0);
  transition: transform .2s ease;
}
.post-card:hover .thumb { transform: scale(1.03); }
@media (max-width: 639px) { .thumb { display: none; } }

.thumb-0 { background: linear-gradient(135deg, #6d5bff, #b84bff); }
.thumb-1 { background: linear-gradient(135deg, #1273d4, #19b6c4); }
.thumb-2 { background: linear-gradient(135deg, #3a3a4a, #7a5aa8); }
.thumb-3 { background: linear-gradient(135deg, #b12d92, #e6467d); }
.thumb-4 { background: linear-gradient(135deg, #159170, #1fbfa0); }
.thumb-5 { background: linear-gradient(135deg, #e05e1f, #f5a623); }

.thumb svg { width: 100%; height: 100%; display: block; opacity: .5; }

.count-pill { display: inline-flex; align-items: center; gap: 5px; }
.count-pill svg { width: 14px; height: 14px; }

/* like buttons */
.like-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 11px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  color: var(--muted);
  font-size: 12.5px;
  font-weight: 650;
  cursor: pointer;
  transition: color .15s, border-color .15s, background .15s, transform .1s;
}
.like-btn:hover { border-color: var(--like); color: var(--like); }
.like-btn:active { transform: scale(.94); }
.like-btn.liked { color: var(--like); border-color: color-mix(in srgb, var(--like) 45%, transparent); background: color-mix(in srgb, var(--like) 9%, transparent); }
.like-btn.liked svg { fill: var(--like); }
.like-btn svg { width: 14px; height: 14px; fill: none; }

/* ---------------- sidebar ---------------- */

.side-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 20px 16px;
  box-shadow: var(--shadow);
  margin-bottom: 22px;
}
.side-card .section-head, .side-card .section-rule { margin: 0 0 12px; }
.h-side { font-size: 15px; }

.popular-list { list-style: none; margin: 0; padding: 0; counter-reset: pop; }
.popular-list li { border-bottom: 1px solid var(--border); }
.popular-list li:last-child { border-bottom: 0; }
.popular-list a { display: flex; gap: 14px; padding: 12px 0; }
.popular-list a::before {
  counter-increment: pop;
  content: counter(pop);
  font-size: 22px;
  font-weight: 800;
  color: var(--faint);
  line-height: 1.1;
  min-width: 22px;
  font-variant-numeric: tabular-nums;
}
.popular-list a:hover::before { color: var(--accent); }
.pop-title { font-size: 14.5px; font-weight: 650; line-height: 1.35; display: block; }
.pop-meta { font-size: 12px; color: var(--faint); display: flex; gap: 10px; margin-top: 4px; }

.side-about { margin: 0; color: var(--muted); font-size: 14px; line-height: 1.6; }

/* ---------------- footer ---------------- */

.site-footer { border-top: 1px solid var(--border); background: var(--surface-2); }
.footer-inner { padding: 36px 24px 40px; }
.footer-brand { display: flex; align-items: baseline; gap: 12px; margin-bottom: 20px; }
.brand-mini { font-weight: 800; font-size: 17px; letter-spacing: -.02em; }
.footer-tag { color: var(--faint); font-size: 13.5px; }
.footer-cols { display: flex; gap: 64px; margin-bottom: 22px; }
.footer-cols h3 { font-size: 12px; text-transform: uppercase; letter-spacing: .1em; color: var(--faint); margin: 0 0 10px; }
.footer-cols a { display: block; color: var(--muted); font-size: 14px; padding: 3px 0; }
.footer-cols a:hover { color: var(--ink); }
.footer-note { color: var(--faint); font-size: 13px; margin: 0; }

/* ---------------- post page ---------------- */

.post-shell { max-width: 860px; padding-bottom: 72px; }

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin: 26px 0 6px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 600;
}
.back-link:hover { color: var(--ink); }

.post-head { padding-top: 10px; }
.post-kicker { background: var(--chip-bg); color: var(--chip-ink); margin-bottom: 16px; }

.post-title {
  margin: 0 0 18px;
  font-size: clamp(28px, 4.6vw, 42px);
  line-height: 1.15;
  letter-spacing: -.025em;
  font-weight: 800;
}

.post-head .post-meta { color: var(--muted); gap: 12px; }
.by-author { display: inline-flex; align-items: center; gap: 8px; font-weight: 650; color: var(--ink); }
.by-author .avatar { width: 28px; height: 28px; font-size: 12px; }

.post-band {
  height: clamp(180px, 32vw, 300px);
  border-radius: 18px;
  margin: 26px 0 30px;
  position: relative;
  overflow: hidden;
}
.post-band::after {
  content: "";
  position: absolute; inset: 0;
  background-image:
    linear-gradient(rgba(255,255,255,.09) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,.09) 1px, transparent 1px);
  background-size: 40px 40px;
  mask-image: radial-gradient(600px 300px at 65% 30%, #000, transparent 78%);
}

.article-body {
  font-family: var(--serif);
  font-size: 19px;
  line-height: 1.72;
  color: var(--ink);
  max-width: 68ch;
}
.article-body p { margin: 0 0 24px; }
.article-body p:first-of-type::first-letter {
  font-size: 3.1em;
  font-weight: 700;
  float: left;
  line-height: .82;
  padding: 4px 10px 0 0;
  color: var(--accent);
}

.post-tags { display: flex; flex-wrap: wrap; gap: 8px; max-width: 68ch; margin: 6px 0 26px; }
.tag { padding: 4px 12px; border-radius: 999px; background: var(--chip-bg); color: var(--chip-ink); font-size: 12.5px; font-weight: 650; }

.post-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  padding: 16px 0;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  margin: 10px 0 40px;
  max-width: 68ch;
}

.like-big {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  padding: 9px 18px;
  border-radius: 999px;
  border: 1px solid var(--border-strong);
  background: var(--surface);
  font-weight: 700;
  font-size: 14.5px;
  color: var(--muted);
  cursor: pointer;
  transition: color .15s, border-color .15s, background .15s, transform .1s;
}
.like-big:hover { border-color: var(--like); color: var(--like); }
.like-big:active { transform: scale(.95); }
.like-big.liked { color: var(--like); border-color: color-mix(in srgb, var(--like) 45%, transparent); background: color-mix(in srgb, var(--like) 9%, transparent); }
.like-big.liked svg { fill: var(--like); }
.like-big svg { width: 18px; height: 18px; fill: none; }
.like-hint { font-size: 12.5px; color: var(--faint); }

.share-row { margin-left: auto; display: flex; gap: 8px; }
.share-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px; height: 36px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--muted);
  cursor: pointer;
  transition: color .15s, border-color .15s, transform .15s;
}
.share-btn:hover { color: var(--ink); border-color: var(--border-strong); transform: translateY(-1px); }
.share-btn svg { width: 16px; height: 16px; }

/* comments */

.comments { max-width: 68ch; }
.comments-head { display: flex; align-items: baseline; gap: 10px; margin: 0 0 18px; }
.comments-head h2 { margin: 0; font-size: 20px; font-weight: 800; letter-spacing: -.01em; }
.comments-count { color: var(--faint); font-size: 14px; }

.comment-composer { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow); margin-bottom: 28px; }
.composer-placeholder { display: flex; justify-content: center; padding: 14px 0; }
.composer-row { display: flex; gap: 12px; align-items: flex-start; }
.comment-box { flex: 1; }
.comment-box textarea {
  width: 100%;
  min-height: 92px;
  resize: vertical;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--bg);
  color: var(--ink);
  font: inherit;
  font-size: 15px;
  line-height: 1.55;
  padding: 12px 14px;
  outline: none;
  transition: border-color .15s, box-shadow .15s;
}
.comment-box textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 18%, transparent); }
.composer-foot { display: flex; align-items: center; justify-content: space-between; margin-top: 10px; }
.composer-hint { font-size: 12px; color: var(--faint); }
.btn[disabled] { opacity: .55; cursor: not-allowed; transform: none !important; }

.comment-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.comment { display: flex; gap: 12px; padding: 18px 0; border-bottom: 1px solid var(--border); }
.avatar-comment { width: 36px; height: 36px; border-radius: 50%; flex: none; display: grid; place-items: center; color: #fff; font-size: 14px; font-weight: 700; }
.comment-top { display: flex; align-items: baseline; gap: 9px; flex-wrap: wrap; }
.comment-author { font-weight: 700; font-size: 14.5px; }
.comment-time { color: var(--faint); font-size: 12.5px; }
.comment-body { margin: 5px 0 0; font-size: 15px; line-height: 1.6; white-space: pre-wrap; overflow-wrap: anywhere; }

.empty-notes { color: var(--faint); font-size: 14.5px; text-align: center; padding: 26px 0; }

/* related */

.related { margin-top: 46px; }
.related h2 { font-size: 20px; font-weight: 800; margin: 0 0 16px; }
.related-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
@media (max-width: 720px) { .related-grid { grid-template-columns: 1fr; } }
.related-card {
  border: 1px solid var(--border);
  background: var(--surface);
  border-radius: 14px;
  padding: 16px;
  display: block;
  transition: transform .15s, box-shadow .15s, border-color .15s;
}
.related-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-lift); border-color: var(--border-strong); }
.rc-kicker { font-size: 11px; font-weight: 750; letter-spacing: .08em; text-transform: uppercase; color: var(--accent); }
.rc-title { margin: 8px 0 10px; font-size: 15px; line-height: 1.35; font-weight: 700; }
.rc-meta { font-size: 12.5px; color: var(--faint); display: flex; gap: 10px; }

/* ---------------- toast & utilities ---------------- */

.toast {
  position: fixed;
  left: 50%;
  bottom: 26px;
  transform: translateX(-50%) translateY(8px);
  background: var(--ink);
  color: var(--bg);
  padding: 11px 18px;
  border-radius: 12px;
  font-size: 14px;
  font-weight: 600;
  box-shadow: var(--shadow-lift);
  opacity: 0;
  transition: opacity .2s ease, transform .2s ease;
  z-index: 90;
  pointer-events: none;
  max-width: min(88vw, 480px);
  text-align: center;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

.post-banner {
  max-width: 68ch;
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 14px 18px;
  font-size: 14.5px;
  color: var(--muted);
  background: var(--surface);
  margin-bottom: 40px;
}

.err-state { padding: 80px 0; text-align: center; color: var(--muted); }

/* skeletons */
.sk { height: 16px; border-radius: 8px; margin-bottom: 14px;
  background: linear-gradient(90deg, var(--border) 25%, var(--border-strong) 50%, var(--border) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.4s infinite; }
.sk-chip { width: 90px; height: 26px; border-radius: 999px; }
.sk-line { height: 22px; }
.sk-line.big { height: 40px; }
.sk-band { height: 220px; border-radius: 18px; }
.w60 { width: 60%; } .w70 { width: 70%; } .w80 { width: 80%; } .w95 { width: 95%; } .w100 { width: 100%; }
@keyframes shimmer { to { background-position: -200% 0; } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}


/* =================== SCIX additions (v2) =================== */

html { -webkit-text-size-adjust: 100%; }
body { overflow-x: hidden; }
img, svg { max-width: 100%; }
:focus-visible { outline: 3px solid color-mix(in srgb, var(--accent) 60%, transparent); outline-offset: 2px; border-radius: 6px; }
.skip-link { position: absolute; left: -999px; top: 8px; z-index: 100; background: var(--surface); padding: 8px 14px; border-radius: 10px; box-shadow: var(--shadow); }
.skip-link:focus { left: 12px; }
::selection { background: color-mix(in srgb, var(--accent) 28%, transparent); }

.read-progress { position: fixed; top: 0; left: 0; right: 0; height: 3px; z-index: 60; transform-origin: 0 50%; transform: scaleX(0);
  background: linear-gradient(90deg, var(--accent), var(--accent-2)); transition: transform .08s linear; }

/* header: mobile */
@media (max-width: 640px) {
  .shell { padding: 0 16px; }
  .header-inner { gap: 12px; height: 58px; }
  .top-nav { display: none; }
  .user-name { display: none; }
  .hide-sm { display: none !important; }
  .btn { padding: 8px 13px; }
}
.user-wrap { position: relative; }
.user-chip { background: none; border: 1px solid var(--border); border-radius: 999px; padding: 3px 12px 3px 3px; cursor: pointer; color: var(--ink); }
.user-chip:hover { border-color: var(--border-strong); }
@media (max-width: 640px) { .user-chip { padding: 3px; } }
.user-menu { position: absolute; right: 0; top: calc(100% + 8px); min-width: 190px; background: var(--surface); border: 1px solid var(--border);
  border-radius: 14px; box-shadow: var(--shadow-lift); padding: 6px; display: flex; flex-direction: column; z-index: 70; }
.user-menu[hidden] { display: none; }
.user-menu a, .user-menu button { text-align: left; padding: 10px 12px; border-radius: 9px; font-size: 14px; font-weight: 600; color: var(--ink); background: none; border: 0; cursor: pointer; }
.user-menu a:hover, .user-menu button:hover { background: var(--chip-bg); }

/* hero */
.hero-card { display: flex; flex-direction: column; justify-content: flex-end; }
.hero-link { position: relative; z-index: 1; }
.hero-card .post-meta { position: relative; z-index: 1; }
.hero-art { position: absolute; right: -40px; top: -30px; width: 360px; height: 360px; opacity: .22; z-index: 0; pointer-events: none; }
.hero-art svg { width: 100%; height: 100%; }
@media (max-width: 640px) {
  .hero { margin-top: 16px; }
  .hero-card { min-height: 0; padding: 24px 20px; border-radius: 18px; }
  .hero-excerpt { font-size: 15.5px; }
  .hero-art { width: 220px; height: 220px; right: -50px; top: -40px; }
}

/* feed tools */
.feed-tools { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin: -4px 0 6px; }
.search-box { flex: 1 1 220px; display: flex; align-items: center; gap: 8px; background: var(--surface); border: 1px solid var(--border);
  border-radius: 12px; padding: 0 12px; color: var(--faint); }
.search-box:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 16%, transparent); }
.search-box input { flex: 1; border: 0; outline: 0; background: transparent; color: var(--ink); font: inherit; font-size: 15px; padding: 10px 0; min-width: 0; }
.topic-chips { display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
.topic-chips::-webkit-scrollbar { display: none; }
.topic-chip { white-space: nowrap; border: 1px solid var(--border); background: var(--surface); color: var(--muted); border-radius: 999px; padding: 7px 14px; font-size: 13.5px; font-weight: 650; cursor: pointer; }
.topic-chip.on { background: var(--ink); color: var(--bg); border-color: var(--ink); }

.post-card .thumb { display: grid; place-items: center; overflow: hidden; }
.post-card .thumb svg { opacity: .55; }
.card-actions { display: inline-flex; align-items: center; gap: 8px; margin-left: auto; }
.save-btn { display: inline-grid; place-items: center; width: 32px; height: 30px; border-radius: 999px; border: 1px solid var(--border); background: transparent; color: var(--faint); cursor: pointer; }
.save-btn svg { width: 14px; height: 14px; fill: none; }
.save-btn:hover { color: var(--accent); border-color: var(--accent); }
.save-btn.saved, .save-big.saved { color: var(--accent); border-color: color-mix(in srgb, var(--accent) 45%, transparent); }
.save-btn.saved svg, .save-big.saved svg { fill: currentColor; }
.like-btn, .save-btn, .like-big, .save-big, .share-btn, .topic-chip { min-height: 34px; -webkit-tap-highlight-color: transparent; }
@media (max-width: 639px) {
  .post-card { padding: 18px 2px; }
  .post-card h3 { font-size: 18.5px; }
  .card-meta { width: 100%; }
}
.side-link { display: inline-block; margin-top: 10px; font-size: 14px; font-weight: 700; color: var(--accent); }
.side-join .btn { margin-top: 12px; }
.feed-side { display: flex; flex-direction: column; gap: 18px; }
@media (max-width: 960px) { .feed-side { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); } }

/* article */
.crumbs { display: flex; gap: 8px; align-items: center; font-size: 13.5px; color: var(--faint); margin: 26px 0 14px; font-weight: 600; }
.crumbs a:hover { color: var(--ink); }
.post-dek { font-size: clamp(17px, 2.2vw, 20px); line-height: 1.55; color: var(--muted); margin: 0 0 20px; max-width: 62ch; }
.post-band { display: grid; place-items: center; }
.band-art { width: min(340px, 70%); height: 100%; opacity: .35; position: relative; z-index: 1; }
.band-art svg { width: 100%; height: 100%; }
.post-actions.top { border-bottom: 0; margin: -6px 0 18px; padding-top: 0; border-top: 0; }
.save-big { display: inline-flex; align-items: center; gap: 8px; padding: 9px 16px; border-radius: 999px; border: 1px solid var(--border-strong); background: var(--surface); color: var(--muted); font-weight: 700; font-size: 14.5px; cursor: pointer; }
.save-big svg { width: 17px; height: 17px; fill: none; }
.save-big:hover { color: var(--accent); border-color: var(--accent); }
.article-body h2 { font-family: var(--sans); font-size: clamp(21px, 2.6vw, 25px); line-height: 1.3; letter-spacing: -.015em; margin: 40px 0 14px; font-weight: 800; scroll-margin-top: 80px; }
.article-body p.disclosure { font-family: var(--sans); font-size: 14.5px; color: var(--muted); border-left: 3px solid var(--accent); padding: 10px 14px; background: var(--surface); border-radius: 0 10px 10px 0; }
.toc { max-width: 68ch; border: 1px solid var(--border); border-radius: 14px; background: var(--surface); padding: 12px 18px; margin: 0 0 28px; }
.toc summary { cursor: pointer; font-weight: 750; font-size: 14.5px; }
.toc ol { margin: 10px 0 4px; padding-left: 20px; display: grid; gap: 6px; font-size: 14.5px; }
.toc a { color: var(--muted); } .toc a:hover { color: var(--accent); }
.sources { max-width: 68ch; margin: 10px 0 26px; padding: 18px 20px; border: 1px solid var(--border); border-radius: 14px; background: var(--surface-2); }
.sources h2 { font-size: 15px; margin: 0 0 10px; text-transform: uppercase; letter-spacing: .08em; color: var(--faint); }
.sources ol { margin: 0; padding-left: 20px; display: grid; gap: 7px; font-size: 14px; }
.sources a { color: var(--accent); overflow-wrap: anywhere; }
.sources a:hover { text-decoration: underline; }
@media (max-width: 640px) {
  .article-body { font-size: 17.5px; line-height: 1.68; }
  .post-band { margin: 18px 0 20px; border-radius: 14px; height: 150px; }
  .share-row { margin-left: 0; }
  .post-actions { gap: 8px; }
  .like-hint { display: none; }
}

/* comments */
.comment-main { flex: 1; min-width: 0; }
.comment-del { margin-left: auto; background: none; border: 0; color: var(--faint); cursor: pointer; padding: 4px; border-radius: 8px; display: inline-grid; }
.comment-del svg { width: 15px; height: 15px; }
.comment-del:hover { color: var(--like); background: var(--chip-bg); }
.comment:target { background: color-mix(in srgb, var(--accent) 8%, transparent); border-radius: 12px; }
.composer-placeholder { flex-direction: column; align-items: center; gap: 10px; text-align: center; }
.composer-placeholder p { margin: 0; color: var(--muted); }
.btn-row { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; }
.comment-box textarea { resize: none; min-height: 84px; font-size: 16px; }

/* forms & auth */
.auth-shell { min-height: calc(100vh - 260px); display: grid; place-items: start center; padding-top: clamp(24px, 6vh, 64px); padding-bottom: 60px; }
.auth-card { width: 100%; max-width: 430px; background: var(--surface); border: 1px solid var(--border); border-radius: 22px; padding: clamp(22px, 4vw, 34px); box-shadow: var(--shadow-lift); }
.auth-tabs { display: grid; grid-template-columns: 1fr 1fr; background: var(--chip-bg); border-radius: 12px; padding: 4px; margin-bottom: 22px; }
.auth-tabs button { border: 0; background: none; padding: 9px; border-radius: 9px; font-weight: 700; color: var(--muted); cursor: pointer; }
.auth-tabs button[aria-selected="true"] { background: var(--surface); color: var(--ink); box-shadow: var(--shadow); }
.auth-title { margin: 0 0 6px; font-size: 26px; letter-spacing: -.02em; }
.auth-sub { margin: 0 0 20px; color: var(--muted); font-size: 15px; }
.auth-switch { text-align: center; font-size: 14px; color: var(--muted); margin: 18px 0 0; }
.auth-switch a { color: var(--accent); font-weight: 700; }
.auth-fine { text-align: center; font-size: 12px; color: var(--faint); margin: 14px 0 0; }
.form { display: grid; gap: 14px; }
.field { display: grid; gap: 6px; }
.field[hidden] { display: none; }
.field label { font-size: 13.5px; font-weight: 700; }
.field input { font: inherit; font-size: 16px; padding: 11px 13px; border-radius: 11px; border: 1px solid var(--border-strong); background: var(--surface-2); color: var(--ink); width: 100%; }
.field input:focus { outline: 0; border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 18%, transparent); }
.field input:disabled { opacity: .7; }
.field-hint { color: var(--faint); font-size: 12.5px; }
.pw-wrap { position: relative; }
.pw-wrap input { padding-right: 64px; }
.pw-toggle { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); border: 0; background: none; color: var(--accent); font-weight: 700; font-size: 13px; cursor: pointer; padding: 6px 8px; }
.pw-meter { height: 5px; border-radius: 99px; background: var(--border); overflow: hidden; }
.pw-meter span { display: block; height: 100%; width: 0; transition: width .2s, background .2s; }
.pw-meter[data-score="1"] span { width: 25%; background: #e0245e; }
.pw-meter[data-score="2"] span { width: 50%; background: #f5a623; }
.pw-meter[data-score="3"] span { width: 75%; background: #1fbfa0; }
.pw-meter[data-score="4"] span { width: 100%; background: #159170; }
.form-error { margin: 0; padding: 10px 12px; border-radius: 10px; background: color-mix(in srgb, var(--like) 10%, transparent); color: var(--like); font-size: 14px; font-weight: 600; }
.btn-block { width: 100%; justify-content: center; padding: 12px; font-size: 15.5px; }
.btn-danger { color: #fff; background: #d22a50; border-color: #d22a50; }

/* account */
.account-shell { padding-top: 28px; padding-bottom: 64px; }
.acct-head { display: flex; align-items: center; gap: 16px; margin-bottom: 24px; }
.acct-head .post-title { margin: 0; }
.avatar-comment.big { width: 60px; height: 60px; font-size: 24px; }
.acct-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 18px; }
.acct-grid .wide { grid-column: 1 / -1; }
.acct-list { list-style: none; padding: 0; margin: 0; }
.acct-list li { border-bottom: 1px solid var(--border); }
.acct-list li:last-child { border-bottom: 0; }
.acct-list a { display: flex; flex-direction: column; gap: 3px; padding: 11px 0; }
.acct-list a:hover .acct-title { color: var(--accent); }
.acct-title { font-weight: 700; font-size: 14.5px; line-height: 1.35; }
.acct-quote { color: var(--muted); font-size: 14px; white-space: pre-wrap; overflow-wrap: anywhere; }
.danger { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--border); }

/* prose (about) */
.prose-shell { max-width: 760px; padding-top: 30px; padding-bottom: 70px; }
.prose { font-size: 17px; line-height: 1.7; }
.prose h2 { font-size: 22px; margin: 32px 0 10px; }
.prose ul { padding-left: 20px; display: grid; gap: 8px; }
.prose .lead { font-size: 19px; color: var(--muted); }

/* 404 */
.big-404 { display: grid; gap: 14px; justify-items: center; }
.code-404 { font-size: clamp(72px, 16vw, 140px); font-weight: 900; letter-spacing: -.05em; line-height: 1;
  background: linear-gradient(135deg, var(--accent), var(--accent-2)); -webkit-background-clip: text; background-clip: text; color: transparent; }

@media (max-width: 640px) {
  .footer-cols { gap: 36px; }
  .footer-brand { flex-direction: column; gap: 4px; }
  .toast { bottom: calc(18px + env(safe-area-inset-bottom)); }
}
@media (hover: none) { .post-card:hover { background: transparent; } .post-card:hover .thumb { transform: none; } }
.feed-side .side-card, .acct-grid .side-card { margin: 0; }
.post-card > .chip, .post-card > div, .post-card > .card-meta { grid-column: 1; }
.post-card > .thumb { grid-column: 2; grid-row: 1 / span 3; aspect-ratio: 4 / 3; align-self: start; min-height: 0; }
@media (max-width: 639px) { .post-card > .thumb { display: none; } .post-card > .chip { margin-left: 0; } }
.post-card .chip { margin-left: 0; }
.post-band { background: radial-gradient(600px 240px at 80% 0%, rgba(255,255,255,.25), transparent 60%), var(--hero-bg); }
.rc-kicker, .rc-title, .rc-meta { display: block; }
