:root {
  --bg: #f4f7fb;
  --glass: rgba(255, 255, 255, .78);
  --glass-hi: rgba(255, 255, 255, .95);
  --line: rgba(16, 34, 64, .085);
  --line-2: rgba(16, 34, 64, .16);
  --text: #0a1220;
  --text-2: #45526b;
  --text-3: #78849b;
  --muted: #93a0b4;
  --accent: #0b6cf0;
  --accent-2: #12a8d8;
  --accent-soft: rgba(11, 108, 240, .08);
  --ink: #0a1220;
  --ink-hover: #1b2a44;
  --radius: 16px;
  --shadow-sm: 0 1px 2px rgba(10, 20, 40, .04);
  --shadow-md: 0 1px 2px rgba(10, 20, 40, .04), 0 18px 40px -28px rgba(10, 20, 40, .45);
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
          "Hiragino Sans GB", "Microsoft YaHei", "Helvetica Neue", sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, "Cascadia Mono", monospace;
}

* { box-sizing: border-box; }

html { color-scheme: light; }

html, body { margin: 0; padding: 0; }

body {
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background-image:
    radial-gradient(880px 500px at 50% -12%, rgba(59, 130, 246, .12), transparent 72%),
    radial-gradient(720px 440px at 90% -2%, rgba(18, 168, 216, .1), transparent 72%),
    linear-gradient(rgba(10, 20, 40, .03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(10, 20, 40, .03) 1px, transparent 1px);
  background-size: auto, auto, 44px 44px, 44px 44px;
  -webkit-mask-image: radial-gradient(1080px 640px at 50% -4%, #000 0%, transparent 74%);
  mask-image: radial-gradient(1080px 640px at 50% -4%, #000 0%, transparent 74%);
}

.shell, .toast { position: relative; z-index: 1; }

a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; }
input, textarea { font-family: inherit; }

::selection { background: rgba(11, 108, 240, .18); }

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: rgba(16, 34, 64, .14);
  border-radius: 10px;
  border: 3px solid var(--bg);
}
::-webkit-scrollbar-thumb:hover { background: rgba(16, 34, 64, .26); }

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 8px;
}

/* ================= 骨架布局 ================= */

.shell {
  max-width: 1040px;
  margin: 0 auto;
  padding: 0 28px;
  display: grid;
  grid-template-columns: 200px minmax(0, 1fr);
  gap: 56px;
  align-items: start;
}

/* ---------- 侧栏 ---------- */

.sidebar {
  position: sticky;
  top: 0;
  padding: 40px 0;
  display: flex;
  flex-direction: column;
  gap: 26px;
  align-self: start;
}

.brand {
  display: flex;
  align-items: center;
  gap: 9px;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: .01em;
}

.brand svg {
  color: var(--accent);
  transition: transform .35s cubic-bezier(.2, .8, .3, 1);
}

.brand:hover svg { transform: rotate(-8deg) scale(1.06); }

.tagline {
  margin: 7px 0 0 -1px;
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: .04em;
  color: var(--muted);
}

.nav {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin: 0 -10px;
}

.nav-item {
  position: relative;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 11px;
  border-radius: 9px;
  font-size: 14px;
  color: var(--text-3);
  transition: color .16s, background .16s, box-shadow .16s;
}

.nav-item:hover {
  color: var(--text);
  background: rgba(16, 34, 64, .045);
}

.nav-item.active {
  color: var(--text);
  font-weight: 600;
  background: var(--glass-hi);
  box-shadow: var(--shadow-sm);
}

.nav-count {
  margin-left: auto;
  font-family: var(--mono);
  font-size: 10.5px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.nav-item.active .nav-count { color: var(--accent); }

/* 主操作按钮：纯色，不用渐变 */
.new-post {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 10px 14px;
  border: 0;
  border-radius: 10px;
  background: var(--ink);
  color: #fff;
  font-size: 13.5px;
  font-weight: 600;
  letter-spacing: .02em;
  box-shadow: 0 2px 4px rgba(10, 18, 32, .12), 0 10px 22px -16px rgba(10, 18, 32, .7);
  transition: background .16s, transform .14s, box-shadow .16s;
}

.new-post:hover {
  background: var(--ink-hover);
  box-shadow: 0 3px 6px rgba(10, 18, 32, .14), 0 14px 28px -16px rgba(10, 18, 32, .8);
}

.new-post:active { transform: scale(.985); }

.sidebar-foot {
  margin: 0;
  padding-top: 18px;
  border-top: 1px solid var(--line);
  font-size: 11.5px;
  line-height: 1.75;
  color: var(--muted);
}

/* ---------- 主区 ---------- */

.main {
  min-width: 0;
  padding: 40px 0 calc(110px + env(safe-area-inset-bottom));
}

body.is-detail .main { padding-bottom: calc(150px + env(safe-area-inset-bottom)); }

body.is-detail .compose-fab { bottom: 104px; }

.section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
  padding: 0 2px;
}

.section-head h1 {
  margin: 0;
  font-size: 21px;
  font-weight: 700;
  letter-spacing: -.025em;
}

.section-head .count {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  letter-spacing: .05em;
}

/* ================= 发帖：右下角常驻入口 ================= */

.compose-fab {
  position: fixed;
  right: 28px;
  bottom: 28px;
  z-index: 40;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 20px;
  border: 0;
  border-radius: 999px;
  background: var(--ink);
  color: #fff;
  font-size: 14px;
  font-weight: 600;
  letter-spacing: .01em;
  box-shadow: 0 4px 10px rgba(10, 18, 32, .16), 0 20px 40px -18px rgba(10, 18, 32, .75);
  transition: background .16s, transform .16s, box-shadow .16s;
}

.compose-fab:hover {
  background: var(--ink-hover);
  transform: translateY(-1px);
  box-shadow: 0 6px 14px rgba(10, 18, 32, .18), 0 24px 44px -18px rgba(10, 18, 32, .8);
}

.compose-fab:active { transform: scale(.98); }

.compose-fab[hidden] { display: none; }

.compose-panel {
  position: fixed;
  right: 28px;
  bottom: 28px;
  z-index: 45;
  width: 420px;
  max-width: calc(100vw - 40px);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 15px 18px 16px;
  box-shadow: 0 2px 6px rgba(10, 20, 40, .05), 0 32px 64px -28px rgba(10, 20, 40, .5);
  animation: popIn .22s cubic-bezier(.2, .8, .3, 1);
  transform-origin: bottom right;
}

.compose-panel[hidden] { display: none; }

@keyframes popIn {
  from { opacity: 0; transform: translateY(10px) scale(.985); }
  to { opacity: 1; transform: none; }
}

.compose-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}

.compose-label {
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: .1em;
  color: var(--muted);
  text-transform: uppercase;
}

.compose-close {
  width: 26px;
  height: 26px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 50%;
  background: rgba(16, 34, 64, .05);
  color: var(--text-3);
  transition: background .16s, color .16s;
}

.compose-close:hover { background: rgba(16, 34, 64, .1); color: var(--text); }

.compose-panel .c-body { min-height: 96px; }

.c-title,
.c-body {
  display: block;
  width: 100%;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--text);
  resize: none;
}

.c-title {
  padding: 2px 0 8px;
  font-size: 16px;
  font-weight: 600;
  letter-spacing: -.012em;
  border-bottom: 1px solid var(--line);
}

.c-body {
  padding: 10px 0 4px;
  font-size: 14.5px;
  line-height: 1.8;
  min-height: 92px;
}

.c-title::placeholder,
.c-body::placeholder { color: #aab4c5; font-weight: 400; }

.c-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 6px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}

.c-chips {
  display: flex;
  gap: 4px;
}

.c-chip {
  padding: 5px 12px;
  border: 1px solid transparent;
  border-radius: 999px;
  background: rgba(16, 34, 64, .045);
  color: var(--text-3);
  font-size: 12.5px;
  transition: all .15s;
}

.c-chip:hover { color: var(--text); }

.c-chip.active {
  background: var(--accent-soft);
  border-color: rgba(11, 108, 240, .22);
  color: var(--accent);
  font-weight: 600;
}

.c-counter {
  margin-left: auto;
  font-family: var(--mono);
  font-size: 10.5px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.btn-send {
  padding: 7px 18px;
  border: 0;
  border-radius: 8px;
  background: var(--ink);
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: .02em;
  box-shadow: 0 1px 2px rgba(10, 18, 32, .14);
  transition: background .16s, opacity .16s, transform .14s;
}

.btn-send:hover:not(:disabled) { background: var(--ink-hover); }
.btn-send:active:not(:disabled) { transform: scale(.985); }
.btn-send:disabled { opacity: .45; cursor: default; }

/* ================= 信息流 ================= */

.stream {
  background: var(--glass);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  animation: rise .3s cubic-bezier(.2, .8, .3, 1) both;
}

@keyframes rise {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

.row {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  padding: 17px 20px;
  transition: background .16s;
}

.row + .row { border-top: 1px solid rgba(16, 34, 64, .055); }

.row:hover { background: rgba(244, 249, 255, .85); }

.row-main { flex: 1; min-width: 0; }

.row-title {
  margin: 0 0 5px;
  font-size: 15.5px;
  font-weight: 600;
  line-height: 1.45;
  letter-spacing: -.012em;
  color: var(--text);
}

.row:hover .row-title { color: var(--accent); }

.row-body {
  margin: 0;
  font-size: 14px;
  line-height: 1.72;
  color: var(--text-2);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  word-break: break-word;
  white-space: pre-wrap;
}

.row-meta {
  display: flex;
  align-items: center;
  gap: 7px;
  margin-top: 9px;
  font-size: 11.5px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.row-name {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--accent);
  font-weight: 600;
  font-size: 12px;
}

.row-name::before {
  content: "";
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: currentColor;
  opacity: .75;
}

.row-meta time {
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: -.02em;
}

.row-replies {
  display: none;
  font-size: 11px;
  color: var(--text-3);
}

.row-side {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 6px;
  padding-top: 2px;
  flex-shrink: 0;
  font-family: var(--mono);
  font-size: 11px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.row-arrow {
  color: var(--accent);
  opacity: 0;
  transform: translateX(-5px);
  transition: opacity .18s, transform .18s;
}

.row:hover .row-arrow { opacity: 1; transform: translateX(0); }

/* ---------- 空状态 / 骨架 ---------- */

.state {
  padding: 68px 24px;
  text-align: center;
  background: var(--glass);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.state-title {
  font-size: 14.5px;
  font-weight: 600;
  margin-bottom: 6px;
}

.state-desc {
  font-size: 13px;
  line-height: 1.75;
  color: var(--muted);
}

.btn-ghost {
  display: inline-flex;
  align-items: center;
  margin-top: 20px;
  padding: 8px 19px;
  border: 1px solid var(--line-2);
  border-radius: 999px;
  background: var(--glass-hi);
  color: var(--text);
  font-size: 13px;
  transition: background .16s, color .16s, border-color .16s;
}

.btn-ghost:hover {
  background: var(--ink);
  border-color: var(--ink);
  color: #fff;
}

.skeleton {
  padding: 17px 20px;
  animation: pulse 1.5s ease-in-out infinite;
}

.skeleton + .skeleton { border-top: 1px solid rgba(16, 34, 64, .055); }

.skeleton .bar {
  height: 9px;
  border-radius: 5px;
  background: rgba(16, 34, 64, .07);
  margin-bottom: 10px;
}

.skeleton .bar:last-child { margin-bottom: 0; }

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: .45; }
}

/* ================= 详情 ================= */

.crumb {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 14px;
  padding: 4px 2px;
  border: 0;
  background: none;
  font-size: 12.5px;
  color: var(--text-3);
  transition: color .16s;
}

.crumb:hover { color: var(--accent); }

.post-card {
  background: var(--glass-hi);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 30px 32px;
  box-shadow: var(--shadow-md);
  margin-bottom: 18px;
  animation: rise .3s cubic-bezier(.2, .8, .3, 1) both;
}

.post-card h1 {
  margin: 0 0 12px;
  font-size: 23px;
  font-weight: 700;
  line-height: 1.4;
  letter-spacing: -.022em;
}

.post-meta {
  display: flex;
  align-items: center;
  gap: 9px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--line);
  font-size: 11.5px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.post-meta .row-name { font-size: 12px; }

.post-meta time { font-family: var(--mono); font-size: 10.5px; }

.post-body {
  margin-top: 20px;
  font-size: 15.5px;
  line-height: 1.9;
  color: var(--text-2);
  white-space: pre-wrap;
  word-break: break-word;
}

.replies {
  background: var(--glass);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  margin-bottom: 18px;
  box-shadow: var(--shadow-sm);
}

.replies-title {
  padding: 13px 20px;
  border-bottom: 1px solid var(--line);
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: .1em;
  color: var(--muted);
  text-transform: uppercase;
}

.reply-row { padding: 16px 20px; }

.reply-row + .reply-row { border-top: 1px solid rgba(16, 34, 64, .055); }

.reply-body {
  margin: 8px 0 0;
  font-size: 14.5px;
  line-height: 1.8;
  color: var(--text-2);
  white-space: pre-wrap;
  word-break: break-word;
}

/* 底部固定回复条 */
.reply-composer {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 35;
  background: rgba(255, 255, 255, .92);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  border-top: 1px solid var(--line);
  padding: 12px 0 calc(12px + env(safe-area-inset-bottom));
  animation: dockUp .24s cubic-bezier(.2, .8, .3, 1);
}

@keyframes dockUp {
  from { transform: translateY(100%); }
  to { transform: translateY(0); }
}

.reply-inner {
  max-width: 1040px;
  margin: 0 auto;
  padding: 0 28px 0 284px;
  display: flex;
  align-items: flex-end;
  gap: 10px;
}

.reply-field {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 0 4px 0 14px;
  transition: border-color .18s, box-shadow .18s;
}

.reply-field:focus-within {
  border-color: rgba(11, 108, 240, .32);
  box-shadow: 0 0 0 4px var(--accent-soft);
}

.reply-field textarea {
  flex: 1;
  min-width: 0;
  border: 0;
  outline: 0;
  resize: none;
  overflow-y: auto;
  height: 46px;
  max-height: 108px;
  padding: 11px 0;
  font-size: 14.5px;
  line-height: 1.6;
  color: var(--text);
  background: transparent;
}

.reply-field textarea::placeholder { color: #aab4c5; }

.btn-reply {
  flex-shrink: 0;
  padding: 8px 20px;
  border: 0;
  border-radius: 9px;
  background: var(--ink);
  color: #fff;
  font-size: 13.5px;
  font-weight: 600;
  letter-spacing: .02em;
  transition: background .16s, transform .14s, opacity .16s;
}

.btn-reply:hover:not(:disabled) { background: var(--ink-hover); }
.btn-reply:active:not(:disabled) { transform: scale(.985); }
.btn-reply:disabled { opacity: .45; cursor: default; }

/* ================= Toast ================= */

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(34px + env(safe-area-inset-bottom));
  transform: translate(-50%, 10px);
  background: rgba(10, 18, 32, .93);
  color: #fff;
  padding: 9px 18px;
  border-radius: 999px;
  font-size: 13px;
  line-height: 1.5;
  max-width: 84vw;
  text-align: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s, transform .2s;
  z-index: 60;
  box-shadow: 0 16px 36px -18px rgba(10, 18, 32, .8);
}

.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ================= 手机端 ================= */

@media (max-width: 880px) {
  body::before {
    background-size: auto, auto, 34px 34px, 34px 34px;
    -webkit-mask-image: radial-gradient(680px 420px at 50% -6%, #000 0%, transparent 78%);
    mask-image: radial-gradient(680px 420px at 50% -6%, #000 0%, transparent 78%);
  }

  .shell {
    display: block;
    padding: 0;
  }

  /* 顶栏：只剩品牌 + 一个圆形发帖键 */
  .sidebar {
    position: sticky;
    top: 0;
    z-index: 20;
    flex-direction: row;
    align-items: center;
    gap: 10px;
    padding: 10px 15px;
    margin: 0;
    background: rgba(245, 248, 252, .96);
    border-bottom: 1px solid var(--line);
  }

  .sidebar-top { flex-shrink: 0; }
  .tagline, .sidebar-foot { display: none; }

  .brand { font-size: 14.5px; gap: 8px; }
  .brand svg { width: 20px; height: 20px; }

  /* 板块放回顶部横条，保留胶囊样式 */
  .new-post { display: none; }

  .nav {
    flex-direction: row;
    gap: 2px;
    margin: 0 0 0 auto;
    padding: 3px;
    background: rgba(255, 255, 255, .62);
    border: 1px solid var(--line);
    border-radius: 999px;
  }

  .nav-item {
    gap: 6px;
    padding: 6px 12px;
    border-radius: 999px;
    font-size: 13px;
    color: var(--text-3);
  }

  .nav-item:hover { background: rgba(16, 34, 64, .05); color: var(--text); }

  .nav-item.active {
    background: var(--ink);
    color: #fff;
    font-weight: 500;
    box-shadow: none;
  }

  .nav-item.active:hover { background: var(--ink); color: #fff; }

  .nav-count {
    margin-left: 0;
    font-size: 9.5px;
    color: var(--muted);
  }

  .nav-item.active .nav-count { color: rgba(255, 255, 255, .6); }

  .main {
    padding: 16px 14px calc(96px + env(safe-area-inset-bottom));
  }

  .section-head { margin-bottom: 12px; }
  .section-head h1 { font-size: 19px; }
  .section-head .count { font-size: 10px; }

  .compose-fab {
    right: 14px;
    bottom: calc(18px + env(safe-area-inset-bottom));
    padding: 11px 18px;
    font-size: 13.5px;
    gap: 7px;
  }

  .compose-panel {
    left: 0;
    right: 0;
    bottom: 0;
    width: auto;
    max-width: none;
    border-radius: 18px 18px 0 0;
    padding: 16px 16px calc(16px + env(safe-area-inset-bottom));
    transform-origin: bottom center;
    animation: slideIn .24s cubic-bezier(.2, .8, .3, 1);
  }

  @keyframes slideIn {
    from { transform: translateY(100%); }
    to { transform: translateY(0); }
  }

  .compose-panel .c-body { min-height: 88px; font-size: 14px; }
  .c-body { min-height: 84px; font-size: 14px; }
  .c-bar { gap: 6px; }

  .stream { border-radius: 14px; }
  .row { padding: 14px 15px; gap: 10px; }
  .row-title { font-size: 15px; margin-bottom: 4px; }
  .row-body { font-size: 13.5px; line-height: 1.7; }
  .row-meta { margin-top: 8px; gap: 6px; }
  .row-name { font-size: 11.5px; }
  .row-meta time { font-size: 10px; }
  .row-side { display: none; }
  .row-replies { display: inline; }

  .post-card {
    padding: 20px 18px;
    border-radius: 14px;
    margin-bottom: 12px;
  }

  .post-card h1 { font-size: 19px; line-height: 1.42; }
  .post-body { margin-top: 16px; font-size: 14.5px; line-height: 1.85; }
  .post-meta { padding-bottom: 16px; }

  .replies { border-radius: 14px; margin-bottom: 12px; }
  .replies-title { padding: 11px 16px; }
  .reply-row { padding: 14px 16px; }
  .reply-body { font-size: 14px; }

  .reply-composer { padding: 10px 0 calc(10px + env(safe-area-inset-bottom)); }

  .reply-inner { padding: 0 14px; gap: 8px; }

  .reply-field { padding-left: 12px; border-radius: 11px; }

  .btn-reply { padding: 8px 17px; font-size: 13px; }

  body.is-detail .compose-fab { bottom: calc(92px + env(safe-area-inset-bottom)); }

  .crumb { margin-bottom: 10px; }

  .toast { bottom: calc(82px + env(safe-area-inset-bottom)); }
}

@media (max-width: 400px) {
  .main { padding-left: 12px; padding-right: 12px; }
  .brand span { display: none; }
  .c-counter { display: none; }
  .c-chip { padding: 5px 10px; font-size: 12px; }
  .nav-item { font-size: 12px; }
}
