/* ===================================================================
   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; }

/* =================== shared additions =================== */
.show-sm { display: none !important; }
@media (max-width: 640px) { .show-sm { display: inline-grid !important; place-items: center; } }
.sr-only { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.avatar-img { object-fit: cover; padding: 0; background: var(--chip-bg); }
.btn-danger { color: #d93a55 !important; }
.btn-danger:hover { background: color-mix(in srgb, #d93a55 12%, transparent) !important; }
.role-badge { display: inline-flex; align-items: center; font-size: 10.5px; font-weight: 800; letter-spacing: .04em; text-transform: uppercase; padding: 2px 7px; border-radius: 6px; line-height: 1.4; }
.role-badge.owner { background: linear-gradient(135deg, #f7b500, #ff7a00); color: #fff; }
.role-badge.admin { background: var(--chip-bg); color: var(--chip-ink); }
.field textarea { 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%; resize: vertical; }
.field textarea:focus { outline: 0; border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 18%, transparent); }
.av-row { display: flex !important; align-items: center; gap: 16px; }
.av-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.avatar-xl { width: 76px; height: 76px; border-radius: 50%; object-fit: cover; display: grid; place-items: center; font-size: 30px; font-weight: 800; color: #fff; flex: none; background: linear-gradient(135deg, var(--accent), var(--accent-2)); }
.article-media { margin: 28px 0; }
.article-media img, .article-media video { width: 100%; height: auto; border-radius: 14px; display: block; background: var(--surface-2); }
.article-media figcaption { font-size: 14px; color: var(--muted); margin-top: 8px; text-align: center; }
.article-body h3 { font-size: 1.2em; margin: 1.6em 0 .5em; }

/* =================== chat =================== */
[data-page="chat"] .site-footer { display: none; }
[data-page="chat"] body, html[data-page="chat"] body { overflow: hidden; }
.chat-shell { height: calc(100dvh - 65px); display: flex; justify-content: center; }
@media (max-width: 640px) { .chat-shell { height: calc(100dvh - 59px); } }
.chat-app { width: 100%; max-width: 1000px; display: flex; flex-direction: column; min-height: 0; background: var(--surface); border-inline: 1px solid var(--border); position: relative; }
@media (max-width: 1000px) { .chat-app { border-inline: 0; } }
.chat-loading { padding: 24px; }
.chat-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 18px; border-bottom: 1px solid var(--border); background: var(--surface); }
.chat-title { display: flex; align-items: center; gap: 8px; min-width: 0; }
.chat-title h1 { font-size: 17px; margin: 0; letter-spacing: -.01em; }
.chat-hash { font-size: 22px; font-weight: 700; color: var(--faint); line-height: 1; }
.chat-sub { font-size: 13px; color: var(--muted); padding-left: 10px; margin-left: 4px; border-left: 1px solid var(--border-strong); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat-head-r { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--muted); flex: none; }
.dot-live { width: 8px; height: 8px; border-radius: 50%; background: #23a55a; box-shadow: 0 0 0 3px color-mix(in srgb, #23a55a 25%, transparent); }
.chat-status { font-size: 12px; color: #e8a400; font-weight: 650; }
.chat-body { position: relative; flex: 1; min-height: 0; }
.chat-scroll { position: absolute; inset: 0; overflow-y: auto; overscroll-behavior: contain; padding: 8px 0 12px; scrollbar-width: thin; -webkit-overflow-scrolling: touch; }
.chat-sentinel { height: 1px; }
.chat-welcome { padding: 28px 20px 12px; }
.chat-welcome-ico { width: 64px; height: 64px; border-radius: 50%; display: grid; place-items: center; font-size: 34px; font-weight: 700; color: #fff; background: linear-gradient(135deg, var(--accent), var(--accent-2)); margin-bottom: 12px; }
.chat-welcome h2 { margin: 0 0 4px; font-size: 24px; }
.chat-welcome p { margin: 0; color: var(--muted); }
.chat-day { display: flex; align-items: center; gap: 10px; margin: 18px 16px 6px; color: var(--faint); font-size: 12px; font-weight: 700; }
.chat-day::before, .chat-day::after { content: ''; flex: 1; height: 1px; background: var(--border); }
.chat-msg { position: relative; display: grid; grid-template-columns: 56px 1fr; padding: 3px 16px 3px 0; margin-top: 12px; transition: background .12s; }
.chat-msg.grouped { margin-top: 0; padding-top: 1px; padding-bottom: 1px; }
.chat-msg:hover, .chat-msg.sel { background: var(--surface-2); }
[data-theme="dark"] .chat-msg:hover, [data-theme="dark"] .chat-msg.sel { background: #1b1b28; }
.chat-msg.flash { animation: chatflash 1.6s ease; }
@keyframes chatflash { 0%, 40% { background: color-mix(in srgb, var(--accent) 22%, transparent); } 100% { background: transparent; } }
.chat-gutter { display: flex; justify-content: center; padding-top: 2px; }
.chat-face-btn { border: 0; padding: 0; background: none; cursor: pointer; border-radius: 50%; height: 40px; }
.chat-face { width: 40px; height: 40px; border-radius: 50%; object-fit: cover; display: grid; place-items: center; color: #fff; font-weight: 700; font-size: 16px; }
.chat-hover-time { font-size: 10.5px; color: var(--faint); opacity: 0; padding-top: 4px; white-space: nowrap; }
.chat-msg:hover .chat-hover-time, .chat-msg.sel .chat-hover-time { opacity: 1; }
.chat-content { min-width: 0; }
.chat-meta { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; line-height: 1.3; }
.chat-name { border: 0; background: none; padding: 0; font: inherit; font-weight: 700; font-size: 15px; color: var(--ink); cursor: pointer; }
.chat-name:hover { text-decoration: underline; }
.chat-name.role-owner { color: #e08a00; }
.chat-name.role-admin { color: var(--accent); }
.chat-meta time { font-size: 11.5px; color: var(--faint); }
.chat-text { font-size: 15.5px; line-height: 1.5; white-space: pre-wrap; overflow-wrap: anywhere; word-break: break-word; color: var(--ink); unicode-bidi: plaintext; text-align: start; }
.chat-text a { color: var(--accent); text-decoration: underline; text-underline-offset: 2px; }
.chat-msg.deleted .chat-text { color: var(--faint); }
.chat-edited { font-size: 11px; color: var(--faint); }
.chat-replyref { grid-column: 1 / -1; display: flex; align-items: center; gap: 6px; border: 0; background: none; padding: 0 0 2px 22px; font: inherit; font-size: 13px; color: var(--muted); cursor: pointer; min-width: 0; text-align: start; }
.chat-replyref b { color: var(--ink); font-weight: 650; flex: none; }
.chat-replyref span:last-child, .chat-replyref em { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.rr-curve { width: 28px; height: 10px; border-left: 2px solid var(--border-strong); border-top: 2px solid var(--border-strong); border-top-left-radius: 7px; margin-top: 8px; flex: none; }
.chat-rx { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 5px; }
.rx-chip { display: inline-flex; align-items: center; gap: 5px; padding: 2px 8px; border-radius: 9px; border: 1px solid var(--border); background: var(--surface-2); color: var(--muted); font-size: 13px; cursor: pointer; }
.rx-chip b { font-size: 12px; }
.rx-chip.on { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 14%, transparent); color: var(--accent); }
.chat-actions { position: absolute; top: -14px; right: 16px; display: none; gap: 2px; padding: 2px; background: var(--surface); border: 1px solid var(--border); border-radius: 10px; box-shadow: var(--shadow); z-index: 3; }
.chat-msg:hover .chat-actions, .chat-msg.sel .chat-actions { display: flex; }
.chat-msg.grouped .chat-actions { top: -18px; }
.chat-actions:empty { display: none !important; }
.chat-actions > button { width: 32px; height: 32px; border: 0; background: none; border-radius: 8px; color: var(--muted); cursor: pointer; display: grid; place-items: center; }
.chat-actions > button:hover { background: var(--chip-bg); color: var(--ink); }
.chat-actions svg { width: 18px; height: 18px; }
.rx-pick { position: absolute; bottom: calc(100% + 6px); right: 0; display: flex; gap: 2px; padding: 4px; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; box-shadow: var(--shadow-lift); }
.rx-pick[hidden] { display: none; }
.rx-pick button { font-size: 20px; width: 38px; height: 38px; border: 0; background: none; border-radius: 9px; cursor: pointer; }
.rx-pick button:hover { background: var(--chip-bg); transform: scale(1.12); }
@media (hover: none) { .chat-msg:hover { background: transparent; } .chat-msg:hover .chat-actions { display: none; } .chat-msg.sel .chat-actions { display: flex; } .chat-msg.sel { background: var(--surface-2); } }
.chat-jump { position: absolute; left: 50%; bottom: 12px; transform: translateX(-50%); border: 0; border-radius: 999px; padding: 8px 16px; font-weight: 700; font-size: 13px; color: #fff; background: linear-gradient(135deg, var(--accent), var(--accent-2)); box-shadow: var(--shadow-lift); cursor: pointer; z-index: 4; }
.chat-typing { height: 20px; padding: 0 18px; font-size: 12.5px; color: var(--muted); display: flex; align-items: center; gap: 7px; }
.typing-dots { display: inline-flex; gap: 3px; }
.typing-dots i { width: 5px; height: 5px; border-radius: 50%; background: var(--muted); animation: tdot 1.2s infinite ease-in-out; }
.typing-dots i:nth-child(2) { animation-delay: .15s; } .typing-dots i:nth-child(3) { animation-delay: .3s; }
@keyframes tdot { 0%, 80%, 100% { opacity: .3; transform: translateY(0); } 40% { opacity: 1; transform: translateY(-3px); } }
.chat-composer { padding: 0 16px calc(14px + env(safe-area-inset-bottom)); }
.chat-ctx { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 7px 12px; font-size: 13px; color: var(--muted); background: var(--surface-2); border: 1px solid var(--border); border-bottom: 0; border-radius: 12px 12px 0 0; }
.chat-ctx b { color: var(--ink); }
.chat-ctx + .chat-box { border-top-left-radius: 0; border-top-right-radius: 0; }
.chat-ctx[hidden] + .chat-box { border-radius: 14px; }
.ctx-x { border: 0; background: var(--chip-bg); color: var(--muted); width: 24px; height: 24px; border-radius: 50%; cursor: pointer; font-size: 12px; }
.chat-box { display: flex; align-items: flex-end; gap: 8px; padding: 6px 6px 6px 14px; border: 1px solid var(--border-strong); border-radius: 14px; background: var(--surface-2); transition: border-color .15s, box-shadow .15s; }
.chat-box:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 16%, transparent); }
.chat-input { flex: 1; border: 0; outline: 0; background: transparent; color: var(--ink); font: inherit; font-size: 16px; line-height: 1.45; resize: none; padding: 8px 0; max-height: 180px; unicode-bidi: plaintext; }
.chat-send { flex: none; width: 40px; height: 40px; border: 0; border-radius: 11px; color: #fff; background: linear-gradient(135deg, var(--accent), var(--accent-2)); cursor: pointer; display: grid; place-items: center; }
.chat-send svg { width: 19px; height: 19px; }
.chat-send:active { transform: scale(.94); }
.chat-gate { display: flex; align-items: center; justify-content: center; flex-wrap: wrap; gap: 10px; padding: 14px 16px calc(14px + env(safe-area-inset-bottom)); border-top: 1px solid var(--border); font-size: 14px; color: var(--muted); }
@media (max-width: 640px) {
  .chat-head { padding: 10px 14px; }
  .chat-msg { grid-template-columns: 50px 1fr; padding-right: 10px; }
  .chat-face, .chat-face-btn { width: 36px; height: 36px; }
  .chat-actions { right: 10px; }
  .chat-composer { padding: 0 10px calc(10px + env(safe-area-inset-bottom)); }
}
.pcard-wrap { position: fixed; inset: 0; z-index: 80; background: rgba(10, 10, 20, .5); display: grid; place-items: center; padding: 16px; animation: fadein .15s; }
@keyframes fadein { from { opacity: 0; } }
.pcard { width: min(360px, 100%); background: var(--surface); border-radius: 18px; overflow: hidden; box-shadow: var(--shadow-lift); border: 1px solid var(--border); }
.pcard-banner { height: 84px; background: linear-gradient(135deg, var(--accent), var(--accent-2)); }
.pcard-face { margin: -44px 0 0 20px; }
.pcard-img { width: 88px; height: 88px; border-radius: 50%; border: 5px solid var(--surface); object-fit: cover; display: grid; place-items: center; color: #fff; font-size: 34px; font-weight: 800; background: var(--chip-bg); }
.pcard-body { padding: 8px 20px 4px; }
.pcard-name { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.pcard-name h2 { margin: 0; font-size: 21px; }
.pcard-bio { white-space: pre-wrap; overflow-wrap: anywhere; margin: 10px 0 6px; unicode-bidi: plaintext; }
.pcard-bio.muted { color: var(--faint); }
.pcard-since { font-size: 13px; color: var(--muted); margin: 0 0 8px; }
.pcard-actions { display: flex; justify-content: flex-end; gap: 8px; padding: 12px 16px 16px; flex-wrap: wrap; }

/* =================== admin =================== */
.admin-shell { padding-top: 28px; padding-bottom: 60px; }
.adm-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
.adm-h1 { margin: 6px 0 0; font-size: 30px; letter-spacing: -.02em; }
.adm-tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 20px; overflow-x: auto; }
.adm-tab { padding: 10px 14px; font-weight: 650; font-size: 14.5px; color: var(--muted); border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; }
.adm-tab.on { color: var(--ink); border-color: var(--accent); }
.adm-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.adm-row { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 14px 16px; background: var(--surface); border: 1px solid var(--border); border-radius: 14px; }
.adm-row-main { min-width: 0; display: grid; gap: 4px; }
.adm-row-top { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.adm-row-title { font-weight: 700; font-size: 16px; color: var(--ink); }
.adm-row-title:hover { color: var(--accent); }
.adm-row-act { display: flex; gap: 4px; flex: none; flex-wrap: wrap; justify-content: flex-end; }
.adm-draft { font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: .04em; padding: 2px 7px; border-radius: 6px; background: color-mix(in srgb, #e8a400 18%, transparent); color: #b07800; }
.adm-person { display: flex; align-items: center; gap: 12px; min-width: 0; }
.adm-person .avatar { width: 40px; height: 40px; }
.adm-search { font: inherit; font-size: 16px; width: 100%; max-width: 420px; padding: 10px 13px; border-radius: 11px; border: 1px solid var(--border-strong); background: var(--surface-2); color: var(--ink); margin-bottom: 14px; }
.ed-form { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 22px; align-items: start; }
@media (max-width: 640px) { .adm-row { flex-direction: column; align-items: stretch; } .adm-row-act { justify-content: flex-start; } .adm-h1 { font-size: 24px; } }
[hidden] { display: none !important; }
.auth-forgot { margin: -6px 0 2px; text-align: right; font-size: 13.5px; }
.auth-forgot a { color: var(--accent, #7c5cff); text-decoration: none; font-weight: 600; }
.form-ok { margin: 0; padding: 10px 12px; border-radius: 10px; font-size: 14px; background: rgba(34,197,94,.12); color: #15803d; }
[data-theme="dark"] .form-ok { color: #4ade80; }

/* ===================================================================
   SCIX theme v2 — warm paper, ink and ember. Newsreader + Hanken Grotesk.
   =================================================================== */
@font-face { font-family: 'Newsreader'; src: url('/newsreader.woff2') format('woff2'); font-weight: 200 800; font-style: normal; font-display: swap; }
@font-face { font-family: 'Newsreader'; src: url('/newsreader-italic.woff2') format('woff2'); font-weight: 200 800; font-style: italic; font-display: swap; }
@font-face { font-family: 'Hanken Grotesk'; src: url('/hanken.woff2') format('woff2'); font-weight: 100 900; font-style: normal; font-display: swap; }

:root {
  --bg: #f7f4ee;
  --surface: #fffdf9;
  --surface-2: #f1ede4;
  --ink: #1d1b18;
  --muted: #69645b;
  --faint: #9b958a;
  --border: #e6e0d4;
  --border-strong: #d6cebf;
  --accent: #c8553a;
  --accent-2: #c8553a;
  --accent-ink: #ffffff;
  --chip-bg: #efe8dc;
  --chip-ink: #8a3a26;
  --shadow: 0 1px 2px rgba(60, 40, 20, .05), 0 6px 20px -12px rgba(60, 40, 20, .16);
  --shadow-lift: 0 2px 4px rgba(60, 40, 20, .06), 0 14px 36px -16px rgba(60, 40, 20, .24);
  --radius: 14px;
  --serif: 'Newsreader', Georgia, 'Times New Roman', serif;
  --sans: 'Hanken Grotesk', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Arial, sans-serif;
}
[data-theme="dark"] {
  --bg: #191816;
  --surface: #211f1c;
  --surface-2: #282622;
  --ink: #ece7de;
  --muted: #aaa397;
  --faint: #7a7469;
  --border: #322f2a;
  --border-strong: #423e37;
  --accent: #e2785a;
  --accent-2: #e2785a;
  --chip-bg: #2e2a25;
  --chip-ink: #f0a58e;
  --shadow: 0 1px 2px rgba(0, 0, 0, .35), 0 6px 20px -12px rgba(0, 0, 0, .5);
  --shadow-lift: 0 2px 4px rgba(0, 0, 0, .35), 0 14px 36px -16px rgba(0, 0, 0, .6);
}
body { font-family: var(--sans); font-size: 16.5px; letter-spacing: -.003em; }
::selection { background: color-mix(in srgb, var(--accent) 24%, transparent); }

/* headings in the serif, lighter and calmer */
.post-title, .hero-title, .adm-h1, .auth-title, .comments-head h2, .related h2, .post-card h3, .section-head h2, .ssr-article h1, .chat-welcome h2, .code-404 {
  font-family: var(--serif); font-weight: 500; letter-spacing: -.015em;
}
.post-title { font-size: clamp(34px, 5.2vw, 52px); line-height: 1.08; }
.hero-title { font-weight: 500; }
.section-head h2 { font-size: 22px; }
.post-dek { font-family: var(--serif); font-size: clamp(19px, 2.2vw, 22px); line-height: 1.45; color: var(--muted); font-weight: 400; }
.brand-mini, .brand-name { font-family: var(--serif); font-weight: 600; letter-spacing: -.02em; }

/* flat, quiet buttons and accents */
.btn { border-radius: 10px; font-weight: 600; }
.btn:hover { transform: none; }
.btn-primary { background: var(--ink); color: var(--bg); box-shadow: none; }
.btn-primary:hover { filter: none; background: color-mix(in srgb, var(--ink) 86%, var(--accent)); }
.avatar, .avatar-xl, .chat-welcome-ico, .pcard-banner, .chat-send, .chat-jump { background: var(--accent); }
.brand-mark .gs0 { stop-color: #c8553a; }
.brand-mark .gs1 { stop-color: #e08a5f; }
.code-404 { background: none; -webkit-background-clip: border-box; background-clip: border-box; color: var(--accent); }
.read-progress span, #readProgress { background: var(--accent); }

/* earthy covers instead of neon */
.hero-accent0 { --hero-bg: linear-gradient(140deg, #2b2620 0%, #5a3626 60%, #c8553a 120%); }
.hero-accent1 { --hero-bg: linear-gradient(140deg, #1d2b2c 0%, #2f5551 60%, #7fa59a 120%); }
.hero-accent2 { --hero-bg: linear-gradient(140deg, #24221f 0%, #3c3832 60%, #8b7d68 120%); }
.hero-accent3 { --hero-bg: linear-gradient(140deg, #2d1f24 0%, #6b3346 60%, #c97a7a 120%); }
.hero-accent4 { --hero-bg: linear-gradient(140deg, #1f2a1f 0%, #3f5a3a 60%, #a4b07a 120%); }
.hero-accent5 { --hero-bg: linear-gradient(140deg, #2e2316 0%, #7a4b1f 60%, #d9a05b 120%); }
.thumb-0 { background: linear-gradient(140deg, #5a3626, #c8553a); }
.thumb-1 { background: linear-gradient(140deg, #2f5551, #7fa59a); }
.thumb-2 { background: linear-gradient(140deg, #3c3832, #8b7d68); }
.thumb-3 { background: linear-gradient(140deg, #6b3346, #c97a7a); }
.thumb-4 { background: linear-gradient(140deg, #3f5a3a, #a4b07a); }
.thumb-5 { background: linear-gradient(140deg, #7a4b1f, #d9a05b); }
.tag { font-weight: 600; }

/* ---------------- article typography ---------------- */
.article-body { font-family: var(--serif); font-size: 20px; line-height: 1.7; max-width: 680px; font-weight: 400; }
.article-body p { margin: 0 0 1.15em; }
.article-body p:first-of-type::first-letter { font-weight: 500; color: var(--accent); }
.article-body h2 { font-family: var(--serif); font-weight: 600; font-size: clamp(25px, 3vw, 30px); letter-spacing: -.012em; line-height: 1.2; margin: 1.8em 0 .55em; }
.article-body h3 { font-family: var(--sans); font-weight: 700; font-size: 18px; letter-spacing: -.005em; margin: 1.7em 0 .5em; }
.article-body a { color: inherit; text-decoration: underline; text-decoration-color: color-mix(in srgb, var(--accent) 60%, transparent); text-decoration-thickness: 1.5px; text-underline-offset: 3px; }
.article-body a:hover { color: var(--accent); }
.article-body strong { font-weight: 650; }
.article-body blockquote { margin: 1.6em 0; padding: .1em 0 .1em 1.1em; border-left: 3px solid var(--accent); font-size: 1.12em; font-style: italic; color: color-mix(in srgb, var(--ink) 85%, var(--muted)); }
.article-body blockquote p { margin: 0; }
.article-body ul, .article-body ol { margin: 0 0 1.2em; padding-left: 1.3em; }
.article-body li { margin: .35em 0; padding-left: .2em; }
.article-body li::marker { color: var(--accent); }
.article-body hr { border: 0; height: auto; margin: 2.2em 0; text-align: center; }
.article-body hr::after { content: '· · ·'; color: var(--faint); letter-spacing: .6em; font-size: 18px; }
.article-body code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .82em; background: var(--surface-2); border: 1px solid var(--border); padding: .1em .35em; border-radius: 5px; }
.article-media { margin: 2em 0; }
.article-media img, .article-media video { display: block; width: 100%; height: auto; border-radius: 12px; background: var(--surface-2); }
.article-media figcaption { font-family: var(--sans); font-size: 14px; color: var(--muted); text-align: center; margin-top: 10px; line-height: 1.5; }
.table-wrap { margin: 1.8em 0; overflow-x: auto; -webkit-overflow-scrolling: touch; border: 1px solid var(--border); border-radius: 12px; background: var(--surface); }
.table-wrap table { width: 100%; border-collapse: collapse; font-family: var(--sans); font-size: 15px; line-height: 1.45; }
.table-wrap th, .table-wrap td { padding: 11px 14px; text-align: left; border-bottom: 1px solid var(--border); vertical-align: top; min-width: 90px; }
.table-wrap th { font-weight: 700; font-size: 13px; letter-spacing: .02em; text-transform: uppercase; color: var(--muted); background: var(--surface-2); }
.table-wrap tr:last-child td { border-bottom: 0; }
@media (max-width: 640px) { .article-body { font-size: 18.5px; } }

/* ---------------- editor v2 ---------------- */
.ed-wrap { max-width: 860px; margin: 0 auto; padding-bottom: 120px; }
.ed-top { position: sticky; top: 64px; z-index: 30; display: flex; align-items: center; gap: 10px; padding: 12px 0; background: color-mix(in srgb, var(--bg) 90%, transparent); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); }
.ed-back { font-size: 14px; color: var(--muted); font-weight: 600; }
.ed-back:hover { color: var(--ink); }
.ed-status { font-size: 13px; color: var(--faint); }
.ed-spacer { flex: 1; }
.ed-icon { width: 38px; height: 38px; display: grid; place-items: center; border: 1px solid var(--border); background: var(--surface); color: var(--muted); border-radius: 10px; cursor: pointer; }
.ed-icon svg { width: 18px; height: 18px; }
.ed-icon:hover { color: var(--ink); border-color: var(--border-strong); }
.ed-toolbar { position: sticky; top: 126px; z-index: 29; display: flex; align-items: center; gap: 2px; padding: 5px; margin: 0 0 8px; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; box-shadow: var(--shadow); overflow-x: auto; scrollbar-width: none; }
.ed-toolbar::-webkit-scrollbar { display: none; }
.ed-tb { flex: none; height: 34px; min-width: 34px; padding: 0 9px; display: inline-flex; align-items: center; justify-content: center; gap: 6px; border: 0; background: transparent; color: var(--ink); border-radius: 8px; cursor: pointer; font-size: 15px; }
.ed-tb svg { width: 17px; height: 17px; }
.ed-tb:hover { background: var(--surface-2); }
.ed-tb.ed-add { background: var(--accent); color: #fff; font-weight: 600; font-size: 14px; padding: 0 12px 0 9px; }
.ed-tb.ed-add:hover { filter: brightness(1.05); background: var(--accent); }
.ed-sep { width: 1px; height: 20px; background: var(--border); margin: 0 6px; flex: none; }
.ed-count { flex: none; font-size: 12.5px; color: var(--faint); padding: 0 8px; white-space: nowrap; }
.ed-canvas { position: relative; max-width: 680px; margin: 0 auto; padding: 34px 0 0; }
.ed-kicker-inline { border: 0; background: transparent; padding: 0; font: 600 12.5px var(--sans); letter-spacing: .09em; text-transform: uppercase; color: var(--accent); outline: none; width: 100%; }
.ed-title, .ed-dek { display: block; width: 100%; border: 0; background: transparent; resize: none; outline: none; padding: 0; color: var(--ink); overflow: hidden; }
.ed-title { font: 500 clamp(34px, 5.2vw, 50px)/1.1 var(--serif); letter-spacing: -.015em; margin: 10px 0 12px; }
.ed-dek { font: 400 clamp(19px, 2.2vw, 22px)/1.45 var(--serif); color: var(--muted); margin: 0 0 28px; }
.ed-title::placeholder, .ed-dek::placeholder { color: var(--faint); opacity: .7; }
.ed-body { outline: none; min-height: 50vh; max-width: none; caret-color: var(--accent); }
.ed-body p:first-of-type::first-letter { all: unset; }
.ed-body.is-empty::before { content: attr(data-ph); position: absolute; pointer-events: none; color: var(--faint); opacity: .75; }
.ed-fig { position: relative; }
.ed-fig figcaption { outline: none; min-height: 1.4em; }
.ed-fig figcaption:empty::before { content: attr(data-ph); color: var(--faint); }
.ed-blk-x { position: absolute; top: 10px; right: 10px; z-index: 2; width: 32px; height: 32px; border-radius: 50%; border: 0; display: grid; place-items: center; background: rgba(20, 18, 15, .65); color: #fff; cursor: pointer; opacity: 0; transition: opacity .15s; }
.ed-blk-x svg { width: 16px; height: 16px; }
.ed-fig:hover .ed-blk-x, .ed-fig:focus-within .ed-blk-x { opacity: 1; }
@media (hover: none) { .ed-blk-x { opacity: 1; } }
.ed-tbl td, .ed-tbl th { outline: none; }
.ed-tbl td:focus, .ed-tbl th:focus { box-shadow: inset 0 0 0 2px color-mix(in srgb, var(--accent) 55%, transparent); }
.ed-tbl-bar { display: flex; gap: 4px; padding: 6px; border-bottom: 1px solid var(--border); background: var(--surface-2); overflow-x: auto; }
.ed-tbl-bar button { flex: none; border: 1px solid var(--border); background: var(--surface); color: var(--muted); font: 600 12px var(--sans); padding: 4px 9px; border-radius: 7px; cursor: pointer; }
.ed-tbl-bar button:hover { color: var(--ink); }
.ed-tbl-bar .danger { margin-left: auto; color: #b3261e; }
.ed-body hr { cursor: default; }
.ed-uploading { display: flex; align-items: center; gap: 12px; margin: 1.6em 0; padding: 22px; border: 1px dashed var(--border-strong); border-radius: 12px; font: 500 14.5px var(--sans); color: var(--muted); background: var(--surface); }
.ed-spin { width: 18px; height: 18px; border-radius: 50%; border: 2px solid var(--border-strong); border-top-color: var(--accent); animation: edspin .8s linear infinite; }
@keyframes edspin { to { transform: rotate(360deg); } }
.ed-menu { position: absolute; left: 0; z-index: 35; width: min(320px, 100%); max-height: 60vh; overflow-y: auto; padding: 6px; background: var(--surface); border: 1px solid var(--border); border-radius: 14px; box-shadow: var(--shadow-lift); }
.ed-menu-item { width: 100%; display: flex; align-items: center; gap: 12px; padding: 9px 10px; border: 0; background: transparent; border-radius: 9px; cursor: pointer; text-align: left; color: var(--ink); }
.ed-menu-item:hover, .ed-menu-item:focus-visible { background: var(--surface-2); outline: none; }
.ed-menu-ico { width: 36px; height: 36px; flex: none; display: grid; place-items: center; border: 1px solid var(--border); border-radius: 9px; background: var(--bg); color: var(--ink); }
.ed-menu-ico svg { width: 18px; height: 18px; }
.ed-ico-t { font: 700 17px var(--serif); }
.ed-ico-t.sm { font-size: 13px; }
.ed-menu-txt { display: grid; gap: 1px; }
.ed-menu-txt strong { font: 600 14.5px var(--sans); }
.ed-menu-txt small { font-size: 12.5px; color: var(--muted); }
.ed-drawer { position: fixed; top: 0; right: 0; bottom: 0; z-index: 60; width: min(380px, 100%); overflow-y: auto; padding: 18px 20px 40px; background: var(--surface); border-left: 1px solid var(--border); box-shadow: var(--shadow-lift); display: flex; flex-direction: column; gap: 14px; }
.ed-drawer-head { display: flex; align-items: center; justify-content: space-between; font-size: 16px; padding-bottom: 6px; }
.ed-drawer .field { display: grid; gap: 6px; margin: 0; }
.ed-lbl { font-size: 13px; font-weight: 650; color: var(--ink); }
.ed-drawer input, .ed-drawer textarea { width: 100%; padding: 10px 12px; border: 1px solid var(--border); border-radius: 10px; background: var(--bg); color: var(--ink); font: 15px var(--sans); }
.ed-drawer input:focus, .ed-drawer textarea:focus { outline: none; border-color: var(--accent); }
.ed-view { font-size: 14px; color: var(--accent); font-weight: 600; }
@media (max-width: 720px) {
  .ed-top { top: 58px; padding: 10px 0; }
  .ed-toolbar { top: 116px; }
  .ed-draft-btn { display: none; }
  .ed-canvas { padding-top: 22px; }
  .ed-count { display: none; }
}

/* ---------------- custom cover images ---------------- */
.cover-img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; display: block; }
.post-band.has-cover { margin: 26px 0 30px; height: auto; aspect-ratio: 16 / 9; max-height: 520px; background: var(--surface-2); }
.post-band.has-cover::after, .hero-card.has-cover::after { display: none; }
.hero-card.has-cover { background: #1d1b18; }
.hero-card.has-cover::before { background: linear-gradient(180deg, rgba(20,18,15,.05) 0%, rgba(20,18,15,.35) 45%, rgba(20,18,15,.82) 100%); z-index: 1; }
.hero-card.has-cover .hero-link, .hero-card.has-cover .post-meta { z-index: 2; }
.hero-cover { z-index: 0; }
.thumb.has-cover { position: relative; overflow: hidden; background: var(--surface-2); }
.ed-cover { margin: 0 0 22px; }
.ed-cover-add { display: inline-flex; align-items: center; gap: 8px; border: 1px dashed var(--border-strong); background: transparent; color: var(--muted); font: 600 14px var(--sans); padding: 9px 14px; border-radius: 10px; cursor: pointer; }
.ed-cover-add svg { width: 18px; height: 18px; }
.ed-cover-add:hover { color: var(--ink); border-color: var(--accent); }
.ed-cover-fig { position: relative; margin: 0; border-radius: 14px; overflow: hidden; aspect-ratio: 16 / 9; background: var(--surface-2); }
.ed-cover-fig img { width: 100%; height: 100%; object-fit: cover; display: block; }
.ed-cover-act { position: absolute; right: 10px; bottom: 10px; display: flex; gap: 6px; }
.ed-cover-act button { border: 0; background: rgba(20,18,15,.72); color: #fff; font: 600 13px var(--sans); padding: 7px 12px; border-radius: 9px; cursor: pointer; backdrop-filter: blur(6px); }
.ed-cover .ed-uploading { margin: 0; }
.adm-storage { margin: 0 0 18px; padding: 12px 14px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface); font: 13px var(--sans); color: var(--muted); }
.adm-storage-top { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 4px 12px; margin-bottom: 8px; }
.adm-storage-top strong { color: var(--ink); }
.adm-storage-bar { height: 6px; border-radius: 6px; background: var(--surface-2); overflow: hidden; }
.adm-storage-bar i { display: block; height: 100%; background: var(--accent); border-radius: 6px; }
.adm-storage-bar i.warn { background: #b3261e; }

/* ---------------- Persian / RTL text + chat rooms ---------------- */
@font-face { font-family: "Vazirmatn"; src: url("/vazirmatn.woff2") format("woff2"); font-weight: 100 900; font-display: swap; unicode-range: U+0600-06FF, U+0750-077F, U+0870-088E, U+0890-0891, U+0898-08E1, U+08E3-08FF, U+200C-200E, U+2010-2011, U+204F, U+2E41, U+FB50-FDFF, U+FE70-FE74, U+FE76-FEFC; }
:root { --sans: "Hanken Grotesk", "Vazirmatn", system-ui, -apple-system, "Segoe UI", sans-serif; }
body, .chat-text, .chat-input, .article-body, .comment-body { font-family: var(--sans); }
.article-body { font-family: "Newsreader", "Vazirmatn", Georgia, serif; }
.chat-text, .chat-input, .comment-body, .chat-reply-txt { unicode-bidi: plaintext; text-align: start; }
.chat-text:dir(rtl), .chat-input:dir(rtl) { line-height: 1.75; }
.chat-rooms { display: flex; gap: 6px; padding: 8px 16px 0; overflow-x: auto; }
.chat-room { display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border-radius: 999px; border: 1px solid var(--border); color: var(--muted); font: 600 13px var(--sans); text-decoration: none; white-space: nowrap; }
.chat-room.on { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.room-badge { min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: var(--accent); color: #fff; font: 700 11px/18px var(--sans); text-align: center; }
.chat-bell { border: 0; background: transparent; font-size: 17px; cursor: pointer; padding: 4px 6px; border-radius: 8px; line-height: 1; }
.chat-bell:hover { background: var(--surface-2); }

/* language switcher (v8) */
.lang-wrap { position: relative; }
.lang-btn { width: auto; padding: 0 10px; gap: 6px; display: inline-flex; align-items: center; }
.lang-code { font-size: 12px; font-weight: 700; letter-spacing: .04em; }
.flag { width: 22px; height: 14px; border-radius: 3px; flex: none; box-shadow: 0 0 0 1px rgba(0,0,0,.12); display: block; }
.lang-menu { position: absolute; right: 0; top: calc(100% + 8px); min-width: 170px; 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: 80; }
.lang-menu[hidden] { display: none; }
.lang-menu a { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 9px; font-size: 14px; font-weight: 600; color: var(--ink); text-decoration: none; }
.lang-menu a:hover { background: var(--chip-bg); }
.lang-menu a[aria-checked="true"] { background: var(--chip-bg); }
.lang-menu a[aria-checked="true"]::after { content: '✓'; margin-left: auto; color: var(--accent); }
.tr-note { font-size: 13px; color: var(--muted, #777); background: var(--chip-bg); border-radius: 10px; padding: 8px 12px; margin: 0 0 16px; }
@media (max-width: 640px) { .lang-code { display: none; } .lang-btn { padding: 0 8px; } }
.tr-panel { display: flex; flex-direction: column; gap: 14px; max-width: 860px; }
.tr-panel .btn-row { display: flex; flex-wrap: wrap; gap: 8px; }
.tr-status { font-size: 14px; color: var(--muted, #777); margin: 0; }
.tr-body { width: 100%; font: 14px/1.6 ui-monospace, SFMono-Regular, Menlo, monospace; padding: 12px; border-radius: 12px; border: 1px solid var(--border); background: var(--surface); color: var(--ink); resize: vertical; }
.adm-h2 { font-size: 22px; margin: 4px 0 0; }

/* ---------------- mobile fit fixes (2026-11-06) ---------------- */
html, body { max-width: 100%; overflow-x: clip; }
.feed-layout > *, .feed-main, .feed-list, .post-card, .post-card > div, .section-head, .feed-tools, .search-box { min-width: 0; }
.post-card h3, .post-card .dek, .article-body, .comment-body { overflow-wrap: anywhere; }
.topic-chips { max-width: 100%; }
.search-box input { min-width: 0; width: 100%; }

/* sign in with Google / X, email opt-ins */
.oauth-box{margin-top:18px;display:grid;gap:10px}
.oauth-or{display:flex;align-items:center;gap:12px;color:var(--muted,#7a6f64);font-size:.85rem}
.oauth-or::before,.oauth-or::after{content:"";flex:1;height:1px;background:var(--line,#ddd3c4)}
.oauth-btn{display:flex;align-items:center;justify-content:center;gap:10px;text-decoration:none}
.oauth-btn svg{flex:none}
.oauth-btn[hidden],.oauth-box[hidden],.check-row[hidden]{display:none}
.check-row{display:flex;align-items:flex-start;gap:10px;font-size:.92rem;line-height:1.4;cursor:pointer;margin:4px 0 10px}
.check-row input{margin-top:3px;width:18px;height:18px;accent-color:#c8553a;flex:none}

.ssr-feed{list-style:none;margin:0;padding:0}.ssr-feed li{padding:1.1rem 0;border-bottom:1px solid rgba(0,0,0,.08)}.ssr-feed h3{margin:.2rem 0}.ssr-feed .kicker{font-size:.8rem;text-transform:uppercase;letter-spacing:.06em;opacity:.7;margin:0}

.article-body video,.post video{width:100%;height:auto;aspect-ratio:16/9;background:#000}.article-body img{height:auto}.related-ssr{max-width:720px;margin:2rem auto}.related-ssr ul{padding-left:1.1rem}.related-ssr li{margin:.4rem 0}

/* ================= PunkRecords identity (2026-11-08) ================= */
/* Logo: a geometric apple split down the middle. Orange = science, indigo = Ether, antenna = signal. */
:root { --sci: #c8553a; --fic: #4f46c8; --fic-soft: #e9e8fb; --fic-ink: #352fa0; }
[data-theme="dark"] { --sci: #e2785a; --fic: #8f8af5; --fic-soft: #25234a; --fic-ink: #c4c1ff; }
.brand-mark .bm-sci { fill: var(--sci); }
.brand-mark .bm-fic { fill: var(--fic); }
.brand-mark { color: var(--ink); }
.brand-name { font-family: var(--serif); font-weight: 600; letter-spacing: -.02em; }
.brand-name b { font-weight: 600; color: var(--fic); }
.top-nav a.nav-ether { color: var(--fic); }
.top-nav a.nav-ether::before { content: ''; display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--fic); margin-right: 7px; vertical-align: 1px; }
.adm-ether { display: inline-block; margin-left: 8px; padding: 1px 8px; border-radius: 999px; background: var(--fic-soft); color: var(--fic-ink); font: 700 11px var(--sans); letter-spacing: .04em; text-transform: uppercase; }
.ed-section { width: 100%; padding: 10px 12px; border: 1px solid var(--border); border-radius: 10px; background: var(--bg); color: var(--ink); font: 15px var(--sans); }

/* Ether: the fiction look. Indigo accent, dotted engineering-paper background, italic headings. */
html[data-page="worlds"], html[data-section="fiction"] {
  --accent: var(--fic); --chip-bg: var(--fic-soft); --chip-ink: var(--fic-ink);
}
html[data-page="worlds"] body, html[data-section="fiction"] body {
  background-image: radial-gradient(color-mix(in srgb, var(--fic) 22%, transparent) 1px, transparent 1.2px);
  background-size: 18px 18px;
  background-attachment: fixed;
}
html[data-page="worlds"] .top-nav a.nav-ether, html[data-section="fiction"] .top-nav a.nav-ether { font-weight: 700; }
html[data-section="fiction"] .top-nav a[aria-current="page"]:not(.nav-ether) { color: inherit; }
html[data-page="worlds"] .hero-title, html[data-page="worlds"] .section-head h2, html[data-page="worlds"] .post-card h3,
html[data-section="fiction"] .post-title, html[data-section="fiction"] .ssr-article h1, html[data-section="fiction"] .article-body h2,
html[data-section="fiction"] .related h2, .ether-title { font-style: italic; }
html[data-page="worlds"] .hero-card:not(.has-cover) { --hero-bg: linear-gradient(140deg, #16163a 0%, #2e2a85 55%, #6d66e8 120%); }
html[data-page="worlds"] .thumb:not(.has-cover) { background: linear-gradient(140deg, #2e2a85, #8f8af5); }
html[data-page="worlds"] .btn-primary { background: var(--fic); color: #fff; }
.ether-intro { padding: 44px 0 18px; max-width: 720px; }
.ether-kicker { margin: 0 0 6px; font: 700 12.5px var(--sans); letter-spacing: .12em; text-transform: uppercase; color: var(--fic); }
.ether-title { margin: 0; font-family: var(--serif); font-weight: 500; font-size: clamp(38px, 6vw, 60px); line-height: 1.05; letter-spacing: -.02em; }
.ether-dek { margin: 12px 0 0; font-family: var(--serif); font-size: clamp(18px, 2.2vw, 21px); line-height: 1.5; color: var(--muted); }
@media (max-width: 720px) {
  .ether-intro { padding: 26px 0 10px; }
  .top-nav a.nav-ether::before { margin-right: 5px; }
}
.mob-tabs { display: none; }
@media (max-width: 640px) {
  .mob-tabs { display: flex; gap: 8px; padding: 10px 16px 2px; overflow-x: auto; scrollbar-width: none; }
  .mob-tabs::-webkit-scrollbar { display: none; }
  .mob-tabs a { flex: none; padding: 6px 14px; border-radius: 999px; border: 1px solid var(--border); background: var(--surface); font: 600 13.5px var(--sans); color: var(--muted); }
  .mob-tabs a.mt-fic { color: var(--fic); }
  .mob-tabs a[aria-current="page"].mt-sci { background: var(--sci); border-color: var(--sci); color: #fff; }
  .mob-tabs a[aria-current="page"].mt-fic, html[data-section="fiction"] .mob-tabs a.mt-fic { background: var(--fic); border-color: var(--fic); color: #fff; }
  .brand-name { font-size: 17px; }
}
