/* 四班互娱 · よんクラスの通信 · Class IV Internet */

:root {
  --bg: #f2f4f9;
  --bg-soft: #eaedf6;
  --card: #ffffff;
  --ink: #131a2b;
  --ink-2: #46506a;
  --muted: #8a93a8;
  --line: #e5e9f2;
  --field: #f4f6fb;
  --brand: #3358e8;
  --brand-2: #7b5cff;
  --grad: linear-gradient(135deg, #2f55e0 0%, #6b4bf0 55%, #8b5cf6 100%);
  --like: #ff4d6d;
  --ok: #10b981;
  --warn: #f59e0b;
  --radius: 18px;
  --shadow: 0 1px 2px rgba(19, 26, 43, 0.04), 0 10px 26px -16px rgba(19, 26, 43, 0.3);
  --topbar: rgba(255, 255, 255, 0.86);
  --tabbar: rgba(255, 255, 255, 0.94);
  --maxw: 720px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0c0f16;
    --bg-soft: #161c28;
    --card: #151b26;
    --ink: #e9edf6;
    --ink-2: #b3bccf;
    --muted: #7e8a9f;
    --line: #242c3a;
    --field: #1b2230;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.35), 0 14px 34px -20px rgba(0, 0, 0, 0.9);
    --topbar: rgba(12, 15, 22, 0.86);
    --tabbar: rgba(12, 15, 22, 0.94);
  }
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body { margin: 0; padding: 0; }

body {
  background: var(--bg);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Noto Sans SC", "Microsoft YaHei", sans-serif;
  font-size: 15px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  overflow-y: scroll;
}

a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
input, textarea { font: inherit; color: inherit; }
img { max-width: 100%; }
::selection { background: rgba(51, 88, 232, 0.18); }

:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }

.icon { display: inline-block; vertical-align: middle; flex: none; }

/* ---------- 顶栏 ---------- */

.topbar {
  position: sticky;
  top: 0;
  z-index: 60;
  background: var(--topbar);
  -webkit-backdrop-filter: saturate(180%) blur(16px);
  backdrop-filter: saturate(180%) blur(16px);
  border-bottom: 1px solid var(--line);
}

.topbar-inner {
  max-width: var(--maxw);
  margin: 0 auto;
  height: 58px;
  padding: 0 14px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.brand { display: flex; align-items: center; gap: 9px; min-width: 0; }

.brand-logo {
  width: 34px;
  height: 34px;
  border-radius: 11px;
  background: var(--grad);
  color: #fff;
  font-weight: 800;
  font-size: 17px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 6px 14px -6px rgba(79, 70, 229, 0.65);
  flex: none;
}

.brand-text { min-width: 0; line-height: 1.15; }
.brand-name { font-size: 15px; font-weight: 800; letter-spacing: 0.2px; display: block; }
.brand-sub {
  font-size: 9px;
  letter-spacing: 0.2px;
  color: var(--muted);
  display: block;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 210px;
  margin-top: 1px;
}

.top-nav { display: none; margin-left: 12px; gap: 2px; }
.top-nav a {
  padding: 7px 11px;
  border-radius: 10px;
  font-size: 13.5px;
  color: var(--ink-2);
  font-weight: 500;
}
.top-nav a:hover { background: var(--field); }
.top-nav a.active { color: var(--brand); background: rgba(51, 88, 232, 0.08); }

.top-actions { margin-left: auto; display: flex; align-items: center; gap: 4px; }

.icon-btn {
  width: 36px;
  height: 36px;
  border-radius: 11px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--ink-2);
}
.icon-btn:hover { background: var(--field); color: var(--ink); }

.avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: var(--c, #4f6ef7);
  color: #fff;
  font-weight: 600;
  flex: none;
  overflow: hidden;
  user-select: none;
  line-height: 1;
}

/* ---------- 布局 ---------- */

.view {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 14px 12px 96px;
  min-height: 70vh;
}

@media (min-width: 641px) {
  .view { padding: 22px 16px 60px; }
  .top-nav { display: flex; }
  .tabbar { display: none; }
  .topbar-inner { height: 64px; }
}

/* ---------- 首页 Hero ---------- */

.hero {
  position: relative;
  overflow: hidden;
  border-radius: 22px;
  padding: 18px 18px 15px;
  background: linear-gradient(130deg, #1f2a63 0%, #3a2f9e 48%, #7a45d8 100%);
  color: #fff;
  box-shadow: 0 18px 36px -24px rgba(45, 34, 130, 0.9);
}

.hero::after {
  content: "";
  position: absolute;
  width: 210px;
  height: 210px;
  right: -70px;
  top: -90px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 255, 255, 0.22), transparent 65%);
}

.hero::before {
  content: "";
  position: absolute;
  width: 130px;
  height: 130px;
  right: 40px;
  bottom: -80px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 160, 220, 0.25), transparent 70%);
}

.hero-pill {
  display: inline-block;
  font-size: 10.5px;
  letter-spacing: 1px;
  padding: 3px 9px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.16);
  border: 1px solid rgba(255, 255, 255, 0.18);
  margin-bottom: 8px;
}

.hero-title { font-size: 24px; font-weight: 800; letter-spacing: 1px; margin: 0; line-height: 1.2; }
.hero-jp { font-size: 12.5px; opacity: 0.82; margin: 3px 0 0; letter-spacing: 1.6px; }
.hero-en { font-size: 10px; opacity: 0.6; margin: 1px 0 0; letter-spacing: 2.2px; text-transform: uppercase; }

.hero-stats { display: flex; gap: 20px; margin-top: 14px; position: relative; }
.hero-stat b { font-size: 16px; font-weight: 700; }
.hero-stat span { font-size: 11px; opacity: 0.72; margin-left: 4px; }

.announce {
  margin-top: 10px;
  display: flex;
  gap: 9px;
  align-items: flex-start;
  background: var(--card);
  border: 1px solid var(--line);
  border-left: 3px solid var(--warn);
  border-radius: 14px;
  padding: 10px 13px;
  font-size: 13px;
  color: var(--ink-2);
  box-shadow: var(--shadow);
}
.announce b { color: var(--ink); font-weight: 600; }

/* ---------- 快捷发布 ---------- */

.quick {
  margin-top: 12px;
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 10px 12px;
  box-shadow: var(--shadow);
  cursor: text;
}
.quick-input {
  flex: 1;
  min-width: 0;
  color: var(--muted);
  font-size: 14px;
  background: var(--field);
  border-radius: 999px;
  padding: 9px 15px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.quick-tools { display: flex; gap: 2px; }
.quick-tools button {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--ink-2);
}
.quick-tools button:hover { background: var(--field); }

/* ---------- 标签切换 ---------- */

.tabs {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  padding: 12px 2px 10px;
  scrollbar-width: none;
}
.tabs::-webkit-scrollbar { display: none; }

.tab {
  flex: none;
  padding: 6px 14px;
  border-radius: 999px;
  font-size: 13px;
  color: var(--ink-2);
  background: var(--card);
  border: 1px solid var(--line);
  font-weight: 500;
  transition: 0.15s;
}
.tab:hover { border-color: #c9d2ea; }
.tab.active {
  background: var(--ink);
  color: var(--bg);
  border-color: var(--ink);
  font-weight: 600;
}

.tabs-end { margin-left: auto; display: flex; align-items: center; color: var(--muted); font-size: 12px; }

/* ---------- 帖子卡片 ---------- */

.feed { display: flex; flex-direction: column; gap: 12px; }

.post {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 15px 15px 6px;
  box-shadow: var(--shadow);
}

.post-head { display: flex; align-items: center; gap: 10px; }
.post-who { min-width: 0; flex: 1; line-height: 1.3; }
.post-name {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 14.5px;
  font-weight: 650;
  color: var(--ink);
  min-width: 0;
}
.post-name .nick { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.post-meta { font-size: 11.5px; color: var(--muted); display: flex; align-items: center; gap: 6px; margin-top: 2px; }
.post-meta .dot { width: 2px; height: 2px; border-radius: 50%; background: var(--muted); opacity: 0.6; }

.badge {
  font-size: 9.5px;
  font-weight: 600;
  padding: 1.5px 6px;
  border-radius: 5px;
  line-height: 1.5;
  flex: none;
}
.badge-admin { background: var(--grad); color: #fff; }
.badge-pin { background: rgba(245, 158, 11, 0.14); color: #c2740a; }
.badge-lz { background: rgba(51, 88, 232, 0.1); color: var(--brand); }
.badge-lock { background: var(--field); color: var(--muted); }

.post-text {
  margin: 10px 0 0;
  font-size: 15px;
  line-height: 1.75;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  color: var(--ink);
}
.post-text a { color: var(--brand); }

.tag { color: var(--brand); font-weight: 500; }

/* 媒体 */
.media {
  margin-top: 11px;
  display: grid;
  gap: 3px;
  border-radius: 14px;
  overflow: hidden;
  background: var(--field);
}
.media.m1 { grid-template-columns: 1fr; }
.media.m2 { grid-template-columns: 1fr 1fr; }
.media.m3 { grid-template-columns: repeat(3, 1fr); }
.media img, .media video { display: block; width: 100%; height: 100%; object-fit: cover; background: #0b0f19; }
.media.m1 img { height: auto; max-height: 540px; object-fit: contain; }
.media.m2 img { aspect-ratio: 4 / 3; }
.media.m3 img { aspect-ratio: 1; }
.media .vid { grid-column: 1 / -1; background: #000; }
.media video { max-height: 540px; object-fit: contain; }

.post-actions {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-top: 8px;
  padding-top: 6px;
}
.act {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: var(--muted);
  font-size: 12.5px;
  padding: 7px 10px;
  border-radius: 10px;
  font-variant-numeric: tabular-nums;
}
.act:hover { background: var(--field); color: var(--ink-2); }
.act.liked { color: var(--like); }
.act.liked .icon { fill: currentColor; }
.act.pop .icon { animation: pop 0.35s ease; }
.act.more { margin-left: auto; color: var(--muted); }

@keyframes pop {
  0% { transform: scale(1); }
  40% { transform: scale(1.35); }
  100% { transform: scale(1); }
}

/* 空状态 */
.empty {
  text-align: center;
  padding: 46px 20px;
  color: var(--muted);
  font-size: 13.5px;
  background: var(--card);
  border: 1px dashed var(--line);
  border-radius: var(--radius);
}
.empty .big { font-size: 34px; margin-bottom: 8px; display: block; }

.load-more { margin: 14px 0 4px; }

/* ---------- 按钮 ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 18px;
  border-radius: 12px;
  font-size: 14px;
  font-weight: 600;
  background: var(--field);
  color: var(--ink);
  transition: 0.15s;
  border: 1px solid transparent;
}
.btn:hover { filter: brightness(0.97); }
.btn:disabled { opacity: 0.55; cursor: not-allowed; }
.btn.primary { background: var(--grad); color: #fff; box-shadow: 0 8px 18px -10px rgba(70, 60, 220, 0.8); }
.btn.ghost { background: transparent; border-color: var(--line); }
.btn.danger { background: rgba(239, 68, 68, 0.1); color: #dc2626; }
.btn.block { width: 100%; }
.btn.sm { padding: 7px 14px; font-size: 13px; border-radius: 10px; }
.btn.tiny { padding: 5px 10px; font-size: 12px; border-radius: 9px; }
.btn.round { border-radius: 999px; }

/* ---------- 详情 ---------- */

.detail-bar {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 10px;
  color: var(--ink-2);
  font-size: 13.5px;
  font-weight: 500;
}
.detail-bar .back { display: inline-flex; align-items: center; gap: 2px; padding: 5px 8px 5px 3px; border-radius: 9px; }
.detail-bar .back:hover { background: var(--field); }

.comments-wrap {
  margin-top: 14px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 4px 15px 14px;
  box-shadow: var(--shadow);
}

.comments-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--ink-2);
  padding: 12px 0 6px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.comment { padding: 12px 0; border-bottom: 1px solid var(--line); display: flex; gap: 10px; }
.comment:last-child { border-bottom: 0; }
.c-main { flex: 1; min-width: 0; }
.c-head { display: flex; align-items: center; gap: 6px; line-height: 1.3; }
.c-name { font-size: 13px; font-weight: 600; }
.c-head time { font-size: 11px; color: var(--muted); margin-left: auto; }
.c-text { font-size: 14px; margin: 4px 0 0; white-space: pre-wrap; overflow-wrap: anywhere; line-height: 1.65; }
.c-text .to { color: var(--brand); font-weight: 500; }
.c-acts { display: flex; align-items: center; gap: 2px; margin-top: 2px; }
.c-acts .act { padding: 5px 7px; font-size: 11.5px; }
.c-del { color: var(--muted); font-size: 11.5px; padding: 5px 7px; border-radius: 8px; }
.c-del:hover { color: #dc2626; background: rgba(239, 68, 68, 0.08); }
.floor { font-size: 10.5px; color: var(--muted); opacity: 0.7; }

.comment-form { display: flex; gap: 8px; align-items: flex-end; margin-top: 12px; }
.comment-form textarea {
  flex: 1;
  min-height: 42px;
  max-height: 120px;
  resize: none;
  background: var(--field);
  border: 1px solid transparent;
  border-radius: 13px;
  padding: 10px 13px;
  font-size: 14px;
  line-height: 1.5;
  outline: none;
}
.comment-form textarea:focus { border-color: rgba(51, 88, 232, 0.45); background: var(--card); }
.comment-form .btn { height: 42px; padding: 0 16px; }

.reply-banner {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--ink-2);
  background: rgba(51, 88, 232, 0.07);
  border-radius: 9px;
  padding: 6px 10px;
  margin-top: 10px;
}
.reply-banner button { margin-left: auto; color: var(--muted); display: flex; }

.locked-note {
  margin-top: 12px;
  text-align: center;
  font-size: 12.5px;
  color: var(--muted);
  background: var(--field);
  border-radius: 10px;
  padding: 10px;
}

/* ---------- 登录 / 注册 ---------- */

.auth { display: flex; justify-content: center; padding-top: 4vh; }
.auth-card {
  width: 100%;
  max-width: 380px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 24px;
  padding: 28px 24px 22px;
  box-shadow: var(--shadow);
}
.auth-logo {
  width: 54px;
  height: 54px;
  border-radius: 17px;
  background: var(--grad);
  color: #fff;
  font-size: 26px;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 14px;
  box-shadow: 0 12px 24px -12px rgba(79, 70, 229, 0.8);
}
.auth h1 { font-size: 20px; text-align: center; margin: 0; letter-spacing: 1px; }
.auth-sub { text-align: center; font-size: 10.5px; color: var(--muted); letter-spacing: 0.4px; margin: 4px 0 0; }
.auth-desc { text-align: center; font-size: 12.5px; color: var(--ink-2); margin: 12px 0 18px; }

.field { display: block; margin-bottom: 12px; }
.field span { display: block; font-size: 12px; color: var(--ink-2); margin-bottom: 5px; font-weight: 500; }
.field input {
  width: 100%;
  background: var(--field);
  border: 1px solid transparent;
  border-radius: 12px;
  padding: 11px 13px;
  font-size: 14.5px;
  outline: none;
}
.field input:focus { border-color: rgba(51, 88, 232, 0.5); background: var(--card); }

.auth-switch { text-align: center; font-size: 12.5px; color: var(--muted); margin: 16px 0 0; }
.auth-switch a { color: var(--brand); font-weight: 600; }
.auth-note {
  margin-top: 14px;
  font-size: 11.5px;
  color: var(--muted);
  background: var(--field);
  border-radius: 10px;
  padding: 9px 11px;
  line-height: 1.55;
  text-align: center;
}

/* ---------- 个人主页 ---------- */

.profile-head {
  position: relative;
  overflow: hidden;
  border-radius: 22px;
  padding: 20px 18px 16px;
  background: linear-gradient(135deg, #1f2a63, #4a35b0 55%, #7d4ad6);
  color: #fff;
  box-shadow: 0 18px 36px -26px rgba(45, 34, 130, 0.9);
}
.profile-head::after {
  content: "";
  position: absolute;
  width: 220px; height: 220px; right: -80px; top: -110px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 255, 255, 0.18), transparent 65%);
}
.profile-top { display: flex; align-items: center; gap: 14px; position: relative; }
.profile-avatar { border: 3px solid rgba(255, 255, 255, 0.22); box-shadow: 0 8px 20px -8px rgba(0, 0, 0, 0.5); }
.profile-info { min-width: 0; }
.profile-name { font-size: 19px; font-weight: 750; display: flex; align-items: center; gap: 7px; flex-wrap: wrap; }
.profile-handle { font-size: 11.5px; opacity: 0.65; margin-top: 1px; }
.profile-sign { font-size: 12.5px; opacity: 0.85; margin-top: 5px; line-height: 1.5; }
.profile-stats { display: flex; gap: 24px; margin-top: 16px; position: relative; }
.profile-stats b { font-size: 16px; }
.profile-stats span { font-size: 11px; opacity: 0.7; margin-left: 4px; }
.profile-actions { display: flex; gap: 8px; margin-top: 14px; position: relative; flex-wrap: wrap; }
.profile-actions .btn { background: rgba(255, 255, 255, 0.14); color: #fff; border-color: rgba(255, 255, 255, 0.16); backdrop-filter: blur(6px); }
.profile-actions .btn:hover { background: rgba(255, 255, 255, 0.22); }
.profile-actions .btn.light { background: #fff; color: #2c2a7a; border-color: #fff; }

.section-title { font-size: 13px; font-weight: 700; color: var(--ink-2); margin: 18px 2px 10px; display: flex; align-items: center; gap: 6px; }

/* ---------- 管理后台 ---------- */

.stat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-bottom: 14px; }
@media (max-width: 480px) { .stat-grid { grid-template-columns: repeat(2, 1fr); } }
.stat-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 12px 13px;
  box-shadow: var(--shadow);
}
.stat-card b { display: block; font-size: 20px; font-weight: 750; letter-spacing: -0.3px; }
.stat-card span { font-size: 11px; color: var(--muted); }

.admin-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: var(--shadow);
  margin-bottom: 12px;
}
.admin-card h3 { font-size: 13.5px; margin: 0 0 10px; display: flex; align-items: center; gap: 6px; }
.admin-card h3 .hint { font-size: 11px; font-weight: 400; color: var(--muted); margin-left: auto; }

.admin-textarea {
  width: 100%;
  min-height: 74px;
  resize: vertical;
  background: var(--field);
  border: 1px solid transparent;
  border-radius: 12px;
  padding: 10px 12px;
  font-size: 13.5px;
  outline: none;
  line-height: 1.6;
}
.admin-textarea:focus { border-color: rgba(51, 88, 232, 0.45); background: var(--card); }

.switch-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 4px 0; }
.switch-row p { margin: 0; font-size: 12px; color: var(--muted); }

.switch { position: relative; width: 46px; height: 27px; flex: none; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch i {
  position: absolute; inset: 0; border-radius: 999px; background: var(--line); transition: 0.2s; cursor: pointer;
}
.switch i::after {
  content: ""; position: absolute; width: 21px; height: 21px; border-radius: 50%;
  background: #fff; top: 3px; left: 3px; transition: 0.2s; box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}
.switch input:checked + i { background: var(--ok); }
.switch input:checked + i::after { transform: translateX(19px); }

.user-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
}
.user-row:last-child { border-bottom: 0; }
.user-row .u-info { min-width: 0; flex: 1; line-height: 1.35; }
.user-row .u-name { font-size: 13.5px; font-weight: 600; display: flex; align-items: center; gap: 5px; flex-wrap: wrap; }
.user-row .u-sub { font-size: 11px; color: var(--muted); }
.user-row .u-acts { display: flex; gap: 4px; flex: none; }
.banned-tag { font-size: 9.5px; color: #dc2626; background: rgba(239, 68, 68, 0.1); padding: 1px 6px; border-radius: 5px; }

/* ---------- 搜索 ---------- */

.search-bar { display: flex; gap: 8px; margin-bottom: 14px; }
.search-bar input {
  flex: 1;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 13px;
  padding: 11px 14px;
  font-size: 14.5px;
  outline: none;
  box-shadow: var(--shadow);
}
.search-bar input:focus { border-color: rgba(51, 88, 232, 0.5); }
.search-bar .btn { height: 46px; border-radius: 13px; }

.user-chips { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }
.user-chip {
  display: flex; align-items: center; gap: 8px;
  background: var(--card); border: 1px solid var(--line);
  border-radius: 999px; padding: 5px 12px 5px 5px; font-size: 12.5px;
}
.user-chip:hover { border-color: #c9d2ea; }

/* ---------- 弹层 / 发布器 ---------- */

.overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: rgba(10, 14, 24, 0.55);
  -webkit-backdrop-filter: blur(3px);
  backdrop-filter: blur(3px);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  animation: fade 0.16s ease;
}
@media (min-width: 641px) {
  .overlay { align-items: center; padding: 24px; }
}

.sheet {
  width: 100%;
  max-width: 560px;
  background: var(--card);
  border-radius: 22px 22px 0 0;
  max-height: 94vh;
  max-height: 94dvh;
  display: flex;
  flex-direction: column;
  animation: slideup 0.24s cubic-bezier(0.2, 0.85, 0.25, 1);
  overflow: hidden;
}
@media (min-width: 641px) {
  .sheet { border-radius: 22px; max-height: 86vh; max-height: 86dvh; }
}

@keyframes slideup { from { transform: translateY(26px); opacity: 0.6; } to { transform: none; opacity: 1; } }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }

.sheet-head {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  flex: none;
}
.sheet-head h3 { font-size: 14.5px; margin: 0 auto; font-weight: 650; }
.sheet-body { padding: 14px 16px 18px; overflow-y: auto; }

.compose-user { display: flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 600; }
.compose-user span { font-size: 11.5px; color: var(--muted); font-weight: 400; }

.compose-textarea {
  width: 100%;
  min-height: 140px;
  margin-top: 10px;
  background: transparent;
  border: 0;
  outline: none;
  resize: none;
  font-size: 16px;
  line-height: 1.7;
  color: var(--ink);
}

.media-preview { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; margin-top: 8px; }
.preview-item {
  position: relative;
  border-radius: 10px;
  overflow: hidden;
  aspect-ratio: 1;
  background: var(--field);
}
.preview-item img, .preview-item video { width: 100%; height: 100%; object-fit: cover; }
.preview-item button {
  position: absolute;
  top: 4px; right: 4px;
  width: 22px; height: 22px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.62);
  color: #fff;
  display: flex; align-items: center; justify-content: center;
}
.preview-item .tag-type {
  position: absolute; left: 5px; bottom: 5px;
  font-size: 9px; color: #fff; background: rgba(0, 0, 0, 0.55);
  padding: 1px 5px; border-radius: 5px;
}

.compose-tools { display: flex; align-items: center; gap: 4px; margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--line); }
.compose-tools .tool {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 7px 10px; border-radius: 10px; font-size: 12.5px; color: var(--ink-2);
}
.compose-tools .tool:hover { background: var(--field); }
.compose-tools .counter { margin-left: auto; font-size: 11px; color: var(--muted); font-variant-numeric: tabular-nums; }

.upload-bar { height: 3px; border-radius: 3px; background: var(--field); overflow: hidden; margin-top: 12px; display: none; }
.upload-bar.on { display: block; }
.upload-bar i { display: block; height: 100%; width: 0; background: var(--grad); transition: width 0.2s; }

.dialog {
  width: calc(100% - 40px);
  max-width: 340px;
  background: var(--card);
  border-radius: 18px;
  padding: 20px;
  box-shadow: 0 24px 60px -20px rgba(0, 0, 0, 0.4);
  animation: pop-in 0.18s ease;
  align-self: center;
  margin: auto;
}
@keyframes pop-in { from { transform: scale(0.96); opacity: 0; } to { transform: none; opacity: 1; } }
.dialog h3 { margin: 0 0 6px; font-size: 15.5px; }
.dialog p { margin: 0 0 16px; font-size: 13px; color: var(--muted); line-height: 1.6; }
.dialog .row { display: flex; gap: 8px; }
.dialog .row .btn { flex: 1; }
.dialog .code-box {
  background: var(--field); border-radius: 10px; padding: 10px 12px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 16px; letter-spacing: 2px; text-align: center; margin-bottom: 14px;
}

/* ---------- Toast ---------- */

.toast-root {
  position: fixed;
  left: 50%;
  bottom: calc(76px + env(safe-area-inset-bottom));
  transform: translateX(-50%);
  z-index: 200;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  pointer-events: none;
  width: max-content;
  max-width: 90vw;
}
@media (min-width: 641px) { .toast-root { bottom: 30px; } }
.toast {
  background: rgba(17, 22, 34, 0.94);
  color: #fff;
  padding: 9px 16px;
  border-radius: 999px;
  font-size: 13px;
  box-shadow: 0 10px 24px -10px rgba(0, 0, 0, 0.5);
  animation: toast-in 0.2s ease;
  backdrop-filter: blur(8px);
}
.toast.bad { background: rgba(220, 38, 38, 0.95); }
.toast.good { background: rgba(5, 150, 105, 0.95); }
@keyframes toast-in { from { transform: translateY(8px); opacity: 0; } to { transform: none; opacity: 1; } }

/* ---------- 底部导航 ---------- */

.tabbar {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  z-index: 70;
  background: var(--tabbar);
  -webkit-backdrop-filter: saturate(180%) blur(16px);
  backdrop-filter: saturate(180%) blur(16px);
  border-top: 1px solid var(--line);
  padding-bottom: env(safe-area-inset-bottom);
  display: grid;
  grid-template-columns: 1fr 84px 1fr;
  align-items: center;
  height: calc(60px + env(safe-area-inset-bottom));
}
.tab-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  height: 60px;
  font-size: 10.5px;
  color: var(--muted);
  font-weight: 500;
}
.tab-item.active { color: var(--brand); }
.tab-item .icon { width: 22px; height: 22px; }

.top-publish { display: none; }
@media (min-width: 641px) { .top-publish { display: inline-flex; margin-right: 2px; } }

.tab-publish {
  justify-self: center;
  width: 50px;
  height: 38px;
  border-radius: 13px;
  background: var(--grad);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 10px 20px -10px rgba(79, 70, 229, 0.9);
  margin-top: -14px;
  border: 3px solid var(--bg);
  box-sizing: content-box;
}
.tab-publish:active { transform: scale(0.94); }

/* ---------- 图片查看 ---------- */

.lightbox {
  position: fixed;
  inset: 0;
  z-index: 150;
  background: rgba(0, 0, 0, 0.94);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  animation: fade 0.15s;
}
.lightbox img { max-width: 100%; max-height: 100%; object-fit: contain; }
.lightbox .close {
  position: absolute;
  top: calc(10px + env(safe-area-inset-top));
  right: 12px;
  color: #fff;
  width: 40px; height: 40px;
  display: flex; align-items: center; justify-content: center;
  background: rgba(255, 255, 255, 0.12);
  border-radius: 50%;
}

/* ---------- 骨架屏 ---------- */

.skel {
  background: linear-gradient(90deg, var(--card) 25%, var(--field) 50%, var(--card) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.3s infinite;
  border-radius: var(--radius);
  height: 120px;
  margin-bottom: 12px;
  border: 1px solid var(--line);
}
@keyframes shimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }

/* ---------- 杂项 ---------- */

.muted { color: var(--muted); }
.small { font-size: 12px; }
.right { text-align: right; }
.mt8 { margin-top: 8px; }
.mt14 { margin-top: 14px; }
.row-between { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.hidden { display: none !important; }

.notice-line {
  text-align: center;
  font-size: 11.5px;
  color: var(--muted);
  padding: 16px 0 4px;
}
.notice-line a { color: var(--brand); }

/* ---------- 操作菜单 / 资料编辑 ---------- */

.menu-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 13px 12px;
  border-radius: 12px;
  font-size: 14px;
  text-align: left;
  color: var(--ink);
}
.menu-item:hover { background: var(--field); }
.menu-item.danger { color: #dc2626; }

.emoji-grid { display: grid; grid-template-columns: repeat(8, 1fr); gap: 6px; }
.emoji-btn {
  aspect-ratio: 1;
  border-radius: 10px;
  background: var(--field);
  font-size: 19px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1.5px solid transparent;
  line-height: 1;
}
.emoji-btn.on { border-color: var(--brand); background: rgba(51, 88, 232, 0.1); }

.color-grid { display: flex; flex-wrap: wrap; gap: 9px; padding: 2px 0; }
.color-btn {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--c);
  border: 2px solid transparent;
  box-shadow: inset 0 0 0 2px var(--card);
}
.color-btn.on { border-color: var(--ink); }

/* 手机上避免 iOS 聚焦缩放 */
@media (max-width: 640px) {
  .field input, .search-bar input, .comment-form textarea { font-size: 16px; }
}
