/* ==========================================================================
   设计语言：米白纸底 + 墨色粗描边 + 硬投影 + 一点手作的歪斜
   刻意避开的东西：渐变、毛玻璃、柔光阴影、圆润的紫蓝配色
   ========================================================================== */

:root {
  /* 纸与墨 */
  --paper:        #FBF6EC;
  --paper-sunk:   #F3EADA;
  --ink:          #191510;
  --ink-70:       #57504a;
  --ink-45:       #8b837b;
  --card:         #FFFFFF;

  /* 主色 */
  --accent:       #FFCE45;
  --accent-deep:  #F3B01C;
  --danger:       #E4572E;
  --ok:           #3F8F5B;

  /* 便利贴六色 */
  --note-yellow:  #FFE9A8;
  --note-pink:    #FFD3D3;
  --note-blue:    #C7E4FA;
  --note-green:   #CDEBC5;
  --note-purple:  #E0D6FB;
  --note-white:   #FFFFFF;

  /* 描边与投影 */
  --bw:           2px;
  --bw-thick:     3px;
  --r-card:       16px;
  --r-input:      12px;
  --r-pill:       999px;
  --shadow:       4px 4px 0 var(--ink);
  --shadow-sm:    3px 3px 0 var(--ink);
  --shadow-lg:    6px 6px 0 var(--ink);

  /* 字体：拉丁字母用自托管的 Space Grotesk，中文交给系统黑体 */
  --font: "Space Grotesk", "PingFang SC", "HarmonyOS Sans SC", "Microsoft YaHei",
          "Hiragino Sans GB", "Source Han Sans SC", "Noto Sans CJK SC", sans-serif;
  --font-mono: ui-monospace, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;

  --wrap: 1160px;
}

/* 自托管的可变字体，只含拉丁字符（22KB）。
   国内访问不了 Google Fonts，所以字体文件必须放在自己服务器上。
   unicode-range 限制成拉丁范围，中文自然回落到系统黑体，不会白等。 */
@font-face {
  font-family: "Space Grotesk";
  src: url("/static/fonts/space-grotesk-latin.woff2") format("woff2");
  font-weight: 300 700;
  font-style: normal;
  font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA,
                 U+02DC, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212,
                 U+2215, U+FEFF, U+FFFD;
}

*, *::before, *::after { box-sizing: border-box; }

/* hidden 属性必须能压住后面那些 display:flex / grid 的规则，
   否则 JS 里 el.hidden = true 会失效。 */
[hidden] { display: none !important; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100vh;
  background-color: var(--paper);
  /* 极轻的纸纹，靠一点噪点让大面积米白不显得"数码" */
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='3'/%3E%3CfeColorMatrix values='0 0 0 0 0.1 0 0 0 0 0.08 0 0 0 0 0.05 0 0 0 0.045 0'/%3E%3C/filter%3E%3Crect width='120' height='120' filter='url(%23n)'/%3E%3C/svg%3E");
  color: var(--ink);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4 { margin: 0; font-weight: 700; line-height: 1.15; letter-spacing: -0.01em; }
p { margin: 0 0 0.8em; }
p:last-child { margin-bottom: 0; }
a { color: var(--ink); text-decoration: underline; text-decoration-thickness: 2px; text-underline-offset: 2px; }
a:hover { text-decoration-color: var(--accent-deep); }

/* 小号等宽大写标签，是这套语言里最有辨识度的一个细节 */
.eyebrow {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ink-70);
}

.wrap { width: 100%; max-width: var(--wrap); margin: 0 auto; padding: 0 20px; }
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

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

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 44px; padding: 10px 20px;
  font-family: inherit; font-size: 16px; font-weight: 700; line-height: 1;
  color: var(--ink); background: var(--card);
  border: var(--bw) solid var(--ink); border-radius: var(--r-input);
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  transition: transform 0.08s ease, box-shadow 0.08s ease, background-color 0.15s ease;
  text-decoration: none;
  white-space: nowrap; /* 窄屏上按钮文字不许折行，否则顶栏会散架 */
  -webkit-tap-highlight-color: transparent;
}
.btn:hover { background: var(--paper-sunk); }
/* 按下时真的"压下去"，这是硬投影风格的关键手感 */
.btn:active { transform: translate(3px, 3px); box-shadow: 0 0 0 var(--ink); }
.btn:focus-visible { outline: 3px solid var(--accent-deep); outline-offset: 2px; }
.btn[disabled] { opacity: 0.5; cursor: not-allowed; box-shadow: var(--shadow-sm); transform: none; }

.btn-primary { background: var(--accent); }
.btn-primary:hover { background: var(--accent-deep); }
.btn-lg { min-height: 54px; padding: 14px 28px; font-size: 18px; box-shadow: var(--shadow); }
.btn-lg:active { transform: translate(4px, 4px); box-shadow: 0 0 0 var(--ink); }
.btn-sm { min-height: 34px; padding: 6px 12px; font-size: 13px; box-shadow: 2px 2px 0 var(--ink); }
.btn-sm:active { transform: translate(2px, 2px); box-shadow: 0 0 0 var(--ink); }
.btn-ghost { background: transparent; border-color: transparent; box-shadow: none; }
.btn-ghost:hover { background: var(--paper-sunk); border-color: var(--ink); }
.btn-ghost:active { transform: none; box-shadow: none; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { background: #c9431f; }
.btn-block { width: 100%; }

/* ---------- 卡片与输入 ---------- */

.card {
  background: var(--card);
  border: var(--bw) solid var(--ink);
  border-radius: var(--r-card);
  box-shadow: var(--shadow);
}
.card-pad { padding: 20px; }

label { display: block; }

.field { margin-bottom: 16px; }
.field > .eyebrow { display: block; margin-bottom: 6px; }

.input, .textarea, select.input {
  width: 100%;
  min-height: 46px;
  padding: 11px 14px;
  font-family: inherit; font-size: 16px; font-weight: 500;
  color: var(--ink); background: var(--card);
  border: var(--bw) solid var(--ink); border-radius: var(--r-input);
  transition: box-shadow 0.12s ease;
}
.input::placeholder, .textarea::placeholder { color: var(--ink-45); font-weight: 400; }
.input:focus, .textarea:focus, select.input:focus {
  outline: none;
  box-shadow: 0 0 0 3px var(--accent);
}
.textarea { min-height: 130px; resize: vertical; line-height: 1.6; }

.hint { font-size: 13px; color: var(--ink-70); line-height: 1.5; }
.hint-err { color: var(--danger); font-weight: 700; }

/* 蜜罐：正常用户看不到也 tab 不到，脚本一填就露馅 */
.trap { position: absolute; left: -9999px; width: 1px; height: 1px; opacity: 0; }

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

.topbar {
  position: sticky; top: 0; z-index: 40;
  background: var(--paper);
  border-bottom: var(--bw) solid var(--ink);
}
.topbar-in {
  display: flex; align-items: center; gap: 14px;
  min-height: 58px;
  max-width: var(--wrap); margin: 0 auto; padding: 8px 20px;
}
.brand {
  display: inline-flex; align-items: center; gap: 10px;
  font-weight: 700; font-size: 17px; text-decoration: none; letter-spacing: -0.01em;
}
.brand-mark {
  display: grid; place-items: center;
  width: 30px; height: 30px;
  background: var(--accent);
  border: var(--bw) solid var(--ink); border-radius: 8px;
  transform: rotate(-4deg);
  font-size: 15px;
}
.topbar-title {
  font-weight: 700; font-size: 17px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.topbar-spacer { flex: 1 1 auto; }
.topbar-tools { display: flex; align-items: center; gap: 8px; flex: 0 0 auto; }

.lang-switch {
  display: inline-flex;
  border: var(--bw) solid var(--ink);
  border-radius: var(--r-input);
  overflow: hidden;
  box-shadow: 2px 2px 0 var(--ink);
}
.lang-switch button {
  min-height: 34px; padding: 4px 10px;
  font-family: inherit; font-size: 13px; font-weight: 700;
  background: var(--card); color: var(--ink);
  border: 0; border-right: var(--bw) solid var(--ink);
  cursor: pointer;
}
.lang-switch button:last-child { border-right: 0; }
.lang-switch button[aria-pressed="true"] { background: var(--accent); }

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

.hero { padding: 56px 0 36px; }
.hero h1 { font-size: clamp(34px, 6vw, 56px); margin: 10px 0 16px; }
.hero-lede { max-width: 620px; font-size: 17px; color: var(--ink-70); }

.section-head {
  display: flex; align-items: baseline; gap: 14px;
  margin: 48px 0 18px; padding-bottom: 12px;
  border-bottom: var(--bw) solid var(--ink);
}
.section-head h2 { font-size: 24px; }
.section-head .count { font-family: var(--font-mono); font-size: 13px; color: var(--ink-70); }

.wall-grid {
  display: grid; gap: 18px;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  padding-bottom: 40px;
}
.wall-card {
  display: flex; flex-direction: column; gap: 12px;
  padding: 20px;
  text-decoration: none;
  transition: transform 0.1s ease, box-shadow 0.1s ease;
}
.wall-card:hover { transform: translate(-2px, -2px); box-shadow: var(--shadow-lg); }
.wall-card:active { transform: translate(2px, 2px); box-shadow: 2px 2px 0 var(--ink); }
.wall-card h3 { font-size: 20px; }
.wall-card .q { color: var(--ink-70); font-size: 15px; }
.wall-card .meta {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  margin-top: auto; padding-top: 12px;
  border-top: 1px dashed var(--ink-45);
  font-family: var(--font-mono); font-size: 12px; color: var(--ink-70);
}

/* ---------- 提问横幅（像贴了张纸条） ---------- */

.question-band {
  position: relative;
  margin: 26px 0 8px; padding: 22px 26px;
  background: var(--accent);
  border: var(--bw) solid var(--ink); border-radius: var(--r-card);
  box-shadow: var(--shadow);
  transform: rotate(-0.4deg);
}
.question-band h1 { font-size: clamp(21px, 3.4vw, 31px); }
.question-band .intro { margin-top: 10px; font-size: 15px; max-width: 70ch; }
/* 两侧的胶带 */
.question-band::before, .question-band::after {
  content: ""; position: absolute; top: -11px;
  width: 74px; height: 22px;
  background: rgba(255, 255, 255, 0.55);
  border: 1px solid rgba(25, 21, 16, 0.28);
}
.question-band::before { left: 26px; transform: rotate(-4deg); }
.question-band::after { right: 26px; transform: rotate(3deg); }

/* ---------- 工具条 ---------- */

.toolbar {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  margin: 26px 0 20px;
}
.toolbar .search { flex: 1 1 220px; max-width: 320px; min-height: 40px; padding: 8px 13px; font-size: 15px; }
.segmented { display: inline-flex; border: var(--bw) solid var(--ink); border-radius: var(--r-input); overflow: hidden; box-shadow: 2px 2px 0 var(--ink); }
.segmented button {
  min-height: 40px; padding: 8px 15px;
  font-family: inherit; font-size: 14px; font-weight: 700;
  background: var(--card); color: var(--ink);
  border: 0; border-right: var(--bw) solid var(--ink);
  cursor: pointer;
}
.segmented button:last-child { border-right: 0; }
.segmented button[aria-pressed="true"] { background: var(--accent); }

.live {
  display: inline-flex; align-items: center; gap: 7px;
  font-family: var(--font-mono); font-size: 11px; letter-spacing: 0.1em;
  text-transform: uppercase; color: var(--ink-70);
}
.live-dot { width: 8px; height: 8px; background: var(--ok); border: 1px solid var(--ink); border-radius: 50%; }
.live[data-state="off"] .live-dot { background: var(--ink-45); }
.live[data-state="loading"] .live-dot { animation: blink 1s steps(2) infinite; }
@keyframes blink { 50% { opacity: 0.25; } }

/* ---------- 便利贴墙 ---------- */

/* 不用 CSS columns：分栏会把硬投影和轻微旋转裁成上下两条黑线。
   Grid + align-items:start 让每张贴按自身高度排，投影也能完整画出来。 */
.wall {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 18px;
  align-items: start;
  padding: 8px 6px 130px 4px;
}
@media (max-width: 900px) { .wall { grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 14px; } }
@media (max-width: 560px) { .wall { grid-template-columns: 1fr; } }

.wall > .empty { grid-column: 1 / -1; }

.note {
  display: block; width: 100%;
  margin: 0;
  padding: 16px 17px 12px;
  text-align: left;
  appearance: none;
  background: var(--note-yellow);
  border: var(--bw) solid var(--ink);
  border-radius: 4px 14px 6px 12px; /* 四角不一样，手撕纸的感觉 */
  box-shadow: var(--shadow-sm);
  font-family: inherit; font-size: 16px; color: var(--ink);
  cursor: pointer;
  position: relative;
  overflow: visible;
  transition: transform 0.1s ease, box-shadow 0.1s ease;
}
.note:hover { transform: translate(-2px, -3px) rotate(0deg) !important; box-shadow: var(--shadow-lg); z-index: 2; }
.note:focus-visible { outline: 3px solid var(--ink); outline-offset: 3px; }

/* 轻微的随机歪斜，按帖子编号取余，所以刷新后位置不会乱跳 */
.note[data-tilt="0"] { transform: rotate(-1.1deg); }
.note[data-tilt="1"] { transform: rotate(0.7deg); }
.note[data-tilt="2"] { transform: rotate(-0.4deg); }
.note[data-tilt="3"] { transform: rotate(1.2deg); }
.note[data-tilt="4"] { transform: rotate(-0.8deg); }

.note[data-color="yellow"] { background: var(--note-yellow); }
.note[data-color="pink"]   { background: var(--note-pink); }
.note[data-color="blue"]   { background: var(--note-blue); }
.note[data-color="green"]  { background: var(--note-green); }
.note[data-color="purple"] { background: var(--note-purple); }
.note[data-color="white"]  { background: var(--note-white); }

.note-body {
  margin: 0;
  font-size: 16px; line-height: 1.55;
  white-space: pre-wrap; overflow-wrap: anywhere;
}
.note-foot {
  display: flex; align-items: center; gap: 10px;
  margin-top: 13px; padding-top: 9px;
  border-top: 1px dashed rgba(25, 21, 16, 0.28);
  font-family: var(--font-mono); font-size: 11px; color: var(--ink-70);
}
.note-who { font-weight: 700; color: var(--ink); max-width: 9em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.note-foot .sep { opacity: 0.5; }
.note-foot .grow { flex: 1 1 auto; }

.note-act {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 7px; min-height: 26px;
  font-family: var(--font-mono); font-size: 11px; font-weight: 700;
  background: rgba(255, 255, 255, 0.65);
  border: 1px solid var(--ink); border-radius: var(--r-pill);
  cursor: pointer;
}
.note-act:hover { background: #fff; }
.note-act[aria-pressed="true"] { background: var(--accent); }

.tag {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 2px 8px;
  font-family: var(--font-mono); font-size: 10px; font-weight: 700;
  letter-spacing: 0.08em; text-transform: uppercase;
  background: var(--card); border: 1px solid var(--ink); border-radius: var(--r-pill);
}
.tag-pinned { background: var(--accent); }
.tag-pending { background: var(--paper-sunk); border-style: dashed; }
.tag-mine { background: var(--note-blue); }

.note-tags { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 9px; }
.note[data-status="pending"] { border-style: dashed; opacity: 0.85; }
.note[data-pinned="1"] { box-shadow: var(--shadow); border-width: var(--bw-thick); }

/* ---------- 空状态 / 骨架 ---------- */

.empty {
  padding: 54px 24px; text-align: center;
  border: var(--bw) dashed var(--ink); border-radius: var(--r-card);
  color: var(--ink-70);
}
.empty h3 { font-size: 20px; margin-bottom: 8px; color: var(--ink); }

.skeleton {
  height: 108px;
  background: var(--paper-sunk);
  border: var(--bw) solid var(--ink-45); border-radius: 10px;
  opacity: 0.7;
}

/* ---------- 底部发帖条 ---------- */

.composer-bar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 45;
  padding: 12px 20px calc(12px + env(safe-area-inset-bottom));
  background: var(--paper);
  border-top: var(--bw) solid var(--ink);
}
.composer-bar-in {
  display: flex; align-items: center; gap: 12px;
  max-width: var(--wrap); margin: 0 auto;
}
.composer-bar .locked { font-size: 14px; color: var(--ink-70); }

/* ---------- 弹层 ---------- */

.sheet-backdrop {
  position: fixed; inset: 0; z-index: 60;
  display: flex; align-items: center; justify-content: center;
  padding: 20px;
  background: rgba(25, 21, 16, 0.42);
}

.sheet {
  width: 100%; max-width: 560px; max-height: 88vh;
  display: flex; flex-direction: column;
  background: var(--card);
  border: var(--bw-thick) solid var(--ink); border-radius: var(--r-card);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
}
.sheet-head {
  display: flex; align-items: center; gap: 12px;
  padding: 15px 18px;
  border-bottom: var(--bw) solid var(--ink);
  background: var(--paper);
}
.sheet-head h2 { font-size: 18px; flex: 1 1 auto; }
.sheet-body { padding: 18px; overflow-y: auto; -webkit-overflow-scrolling: touch; }
.sheet-foot {
  display: flex; align-items: center; gap: 10px;
  padding: 14px 18px;
  border-top: var(--bw) solid var(--ink);
  background: var(--paper);
}
.sheet-foot .grow { flex: 1 1 auto; }
.icon-btn {
  display: grid; place-items: center;
  width: 34px; height: 34px; padding: 0;
  font-size: 18px; line-height: 1;
  background: var(--card); border: var(--bw) solid var(--ink); border-radius: 9px;
  cursor: pointer;
}
.icon-btn:hover { background: var(--paper-sunk); }
.icon-btn:active { transform: translate(2px, 2px); }

@media (max-width: 560px) {
  /* 手机上从底部升起，拇指能够到 */
  .sheet-backdrop { align-items: flex-end; padding: 0; }
  .sheet { max-width: none; max-height: 92vh; border-radius: var(--r-card) var(--r-card) 0 0; border-bottom: 0; }
  .sheet-foot { padding-bottom: calc(14px + env(safe-area-inset-bottom)); }
}

/* 颜色选择 */
.swatches { display: flex; gap: 9px; flex-wrap: wrap; }
.swatch {
  width: 38px; height: 38px; padding: 0;
  border: var(--bw) solid var(--ink); border-radius: 8px;
  cursor: pointer;
  transition: transform 0.08s ease;
}
.swatch[aria-pressed="true"] { box-shadow: 0 0 0 3px var(--ink) inset, 2px 2px 0 var(--ink); transform: translate(-1px, -2px); }
.swatch[data-color="yellow"] { background: var(--note-yellow); }
.swatch[data-color="pink"]   { background: var(--note-pink); }
.swatch[data-color="blue"]   { background: var(--note-blue); }
.swatch[data-color="green"]  { background: var(--note-green); }
.swatch[data-color="purple"] { background: var(--note-purple); }
.swatch[data-color="white"]  { background: var(--note-white); }

.counter { font-family: var(--font-mono); font-size: 12px; color: var(--ink-70); }
.counter[data-over="1"] { color: var(--danger); font-weight: 700; }

/* ---------- 详情与回复 ---------- */

.detail-note {
  padding: 16px 17px;
  border: var(--bw) solid var(--ink); border-radius: 4px 14px 6px 12px;
  box-shadow: var(--shadow-sm);
}
.replies { margin-top: 22px; }
.replies-head {
  display: flex; align-items: baseline; gap: 10px;
  margin-bottom: 12px; padding-bottom: 8px;
  border-bottom: var(--bw) solid var(--ink);
}
.replies-head h3 { font-size: 15px; }

.reply {
  padding: 11px 0;
  border-bottom: 1px dashed var(--ink-45);
}
.reply:last-child { border-bottom: 0; }
.reply-child { margin-left: 20px; padding-left: 13px; border-left: var(--bw) solid var(--ink-45); }
.reply-head {
  display: flex; align-items: center; gap: 8px;
  margin-bottom: 5px;
  font-family: var(--font-mono); font-size: 11px; color: var(--ink-70);
}
.reply-head b { font-family: var(--font); font-size: 13px; color: var(--ink); }
.reply-body { font-size: 15px; line-height: 1.55; white-space: pre-wrap; overflow-wrap: anywhere; }
.reply-tools { display: flex; gap: 8px; margin-top: 6px; }
.link-btn {
  padding: 0; font-family: var(--font-mono); font-size: 11px; color: var(--ink-70);
  background: none; border: 0; cursor: pointer;
  text-decoration: underline; text-underline-offset: 2px;
}
.link-btn:hover { color: var(--ink); }

.reply-form { margin-top: 18px; padding-top: 16px; border-top: var(--bw) solid var(--ink); }
.reply-to {
  display: flex; align-items: center; gap: 8px;
  margin-bottom: 9px; padding: 6px 10px;
  background: var(--paper-sunk); border: 1px dashed var(--ink); border-radius: 8px;
  font-size: 13px;
}

/* ---------- 提示条 ---------- */

.toasts {
  position: fixed; left: 50%; bottom: 92px; z-index: 90;
  display: flex; flex-direction: column; gap: 8px; align-items: center;
  transform: translateX(-50%);
  pointer-events: none;
}
.toast {
  max-width: min(88vw, 420px);
  padding: 11px 17px;
  background: var(--ink); color: var(--paper);
  border: var(--bw) solid var(--ink); border-radius: var(--r-pill);
  box-shadow: var(--shadow-sm);
  font-size: 14px; font-weight: 700;
  animation: rise 0.18s ease-out;
}
.toast[data-kind="error"] { background: var(--danger); }
.toast[data-kind="ok"] { background: var(--ok); }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } }

/* ---------- 页脚 ---------- */

.footer {
  margin-top: 60px; padding: 26px 0 40px;
  border-top: var(--bw) solid var(--ink);
  font-size: 13px; color: var(--ink-70);
}
.footer-in { display: flex; gap: 16px; flex-wrap: wrap; align-items: center; max-width: var(--wrap); margin: 0 auto; padding: 0 20px; }
.footer .grow { flex: 1 1 auto; }

/* ---------- 二维码 ---------- */

.qr-box { text-align: center; }
.qr-box img {
  width: 100%; max-width: 280px; height: auto;
  background: #fff;
  border: var(--bw) solid var(--ink); border-radius: 10px;
}
.qr-url {
  margin-top: 6px; font-family: var(--font-mono); font-size: 13px; color: var(--ink-70);
  overflow-wrap: anywhere;
}

/* ---------- 后台 ---------- */

.admin-main { padding: 26px 0 60px; }
.login-wrap { max-width: 400px; margin: 60px auto; }

.tabs { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 22px; border-bottom: var(--bw) solid var(--ink); }
.tabs button {
  min-height: 42px; padding: 9px 16px;
  font-family: inherit; font-size: 15px; font-weight: 700;
  background: transparent; color: var(--ink-70);
  border: var(--bw) solid transparent; border-bottom: 0; border-radius: 10px 10px 0 0;
  margin-bottom: -2px;
  cursor: pointer;
}
.tabs button[aria-selected="true"] {
  background: var(--card); color: var(--ink);
  border-color: var(--ink);
}
.tab-badge {
  display: inline-block; margin-left: 6px; padding: 1px 7px;
  font-family: var(--font-mono); font-size: 11px;
  background: var(--danger); color: #fff;
  border: 1px solid var(--ink); border-radius: var(--r-pill);
}

.stats { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); margin-bottom: 24px; }
.stat { padding: 14px 16px; background: var(--card); border: var(--bw) solid var(--ink); border-radius: var(--r-input); box-shadow: 2px 2px 0 var(--ink); }
.stat b { display: block; font-family: var(--font-mono); font-size: 26px; line-height: 1.2; }
.stat span { font-family: var(--font-mono); font-size: 11px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--ink-70); }

.rows { display: flex; flex-direction: column; gap: 12px; }
.row {
  display: flex; gap: 14px; align-items: flex-start;
  padding: 15px 17px;
  background: var(--card); border: var(--bw) solid var(--ink); border-radius: var(--r-input);
  box-shadow: 2px 2px 0 var(--ink);
}
.row .grow { flex: 1 1 auto; min-width: 0; }
.row-title { font-weight: 700; font-size: 16px; }
.row-body { margin-top: 5px; font-size: 15px; white-space: pre-wrap; overflow-wrap: anywhere; }
.row-meta { margin-top: 7px; font-family: var(--font-mono); font-size: 11px; color: var(--ink-70); display: flex; gap: 10px; flex-wrap: wrap; }
.row-tools { display: flex; gap: 8px; flex-wrap: wrap; flex: 0 0 auto; }
.flagged { color: var(--danger); font-weight: 700; }

.admin-grid { display: grid; gap: 18px; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); }
.switch-row { display: flex; align-items: center; gap: 9px; margin-bottom: 11px; font-size: 15px; }
.switch-row input { width: 20px; height: 20px; accent-color: var(--accent-deep); }

.log-list { font-family: var(--font-mono); font-size: 12px; line-height: 1.9; }
.log-list div { display: flex; gap: 12px; border-bottom: 1px dashed var(--ink-45); padding: 2px 0; }
.log-list time { flex: 0 0 130px; color: var(--ink-70); }

@media (max-width: 640px) {
  .hero { padding: 34px 0 24px; }
  .row { flex-direction: column; }
  .row-tools { width: 100%; }
}

/* 手机上顶栏空间紧张，标题优先留给墙名 */
@media (max-width: 560px) {
  .topbar-in { gap: 8px; padding: 8px 14px; min-height: 52px; }
  .topbar-title { font-size: 15px; }
  .lang-switch button { min-height: 32px; padding: 4px 8px; font-size: 12px; }
  .wrap { padding: 0 14px; }
  .footer-in { padding: 0 14px; }
  .question-band { padding: 18px 18px; transform: none; }
  .question-band::before, .question-band::after { display: none; }
  .toolbar { gap: 8px; }
  .toolbar .search { max-width: none; }
  .composer-bar { padding: 10px 14px calc(10px + env(safe-area-inset-bottom)); }
  .composer-bar .btn-lg { flex: 1 1 auto; min-height: 50px; }
  .composer-bar-in .hint { display: none; }
  .toasts { bottom: 84px; }
}

/* 尊重系统的"减少动效"设置 */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.001ms !important; transition-duration: 0.001ms !important; }
  .note { transform: none !important; }
}

@media print {
  .topbar, .composer-bar, .toolbar, .footer, .sheet-backdrop, .toasts { display: none !important; }
  body { background: #fff; }
  .wall { display: grid; grid-template-columns: repeat(3, 1fr); padding-bottom: 0; }
  .note { box-shadow: none; transform: none !important; }
}
