/* ===== QU MARKET 设计令牌 + 全局重置 + 公共部件 =====
 * 色板、字体层级照搬 QuPhone 的 css/base.css，改色只改这里。
 *
 * ⚠️ 圆角只有两个值，别再引入第三个：
 *     --r-4  4px  小件：标签、分区项、菜单项、行内小块
 *     --r-8  8px  容器：卡片、按钮、输入框、表格、弹窗
 *   **正圆不受这条约束**：头像、圆形图标钮、开关的滑钮仍然是 50%，
 *   开关的轨道也仍然是胶囊 —— 里面装着一颗圆滑钮，轨道切成方的会当场散架。
 *
 * 与 QuPhone 的第二处差别是「用描边而不是投影」：手机端那套阴影卡片放在网页的
 * 长列表里会一坨一坨地浮起来，论坛要的是一片能快速扫的、有分隔线的密排内容。 */

:root {
  /* 灰阶：与 QuPhone base.css 逐个对齐，不要在别处再写十六进制 */
  --c-bg: #ffffff;
  --c-surface-l: #f7f7f7;
  --c-surface: #f6f6f6;
  --c-surface-2: #ededed;
  --c-surface-3: #e4e4e4;
  --c-border: rgba(0, 0, 0, 0.09);
  --c-border-m: rgba(0, 0, 0, 0.14);

  --c-text: #3a3a3a;
  --c-title: #6e6e6e;
  --c-sub: #939393;
  --c-hint: #b8b8b8;

  --c-accent: #8a8a8a;
  --c-accent-dark: #787878;

  --shadow-sm: 0 1px 4px rgba(0, 0, 0, 0.06);
  --shadow-lg: 0 8px 28px rgba(0, 0, 0, 0.14);

  /* 圆角只此两档 */
  --r-4: 4px;
  --r-8: 8px;

  --ease: cubic-bezier(0.25, 0.46, 0.45, 0.94);
  --dur: 0.15s;

  --font-ui: -apple-system, 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;
  --font-size-body: 14px;

  --title-size: 26px;        /* 页面大标题。比手机端的 32px 小一档 —— 网页一屏里要塞更多东西 */
  --title-weight: 600;
  --label-size: 10px;        /* 英文小标题：大写 + 0.18em 字距，与 QuPhone 同一档 */
  --label-weight: 500;
  --row-name-size: 14px;
  --row-value-size: 12px;

  --shell-max: 1180px;
  --side-w: 190px;
  --head-h: 52px;
  --ctrl-h: 34px;            /* 按钮 / 输入框 / 分区项的统一高度 */
}

:root[data-theme="dark"] {
  --c-bg: #1c1c1c;
  --c-surface-l: #232323;
  --c-surface: #131313;
  --c-surface-2: #2a2a2a;
  --c-surface-3: #343434;
  --c-border: rgba(255, 255, 255, 0.10);
  --c-border-m: rgba(255, 255, 255, 0.16);

  --c-text: #ececec;
  --c-title: #c0c0c0;
  --c-sub: #8c8c8c;
  --c-hint: #6a6a6a;

  --c-accent: #9a9a9a;
  --c-accent-dark: #a8a8a8;

  --shadow-sm: 0 1px 4px rgba(0, 0, 0, 0.5);
  --shadow-lg: 0 8px 28px rgba(0, 0, 0, 0.6);
}

/* ===== 重置 ===== */
*, *::before, *::after { box-sizing: border-box; }

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

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font-ui);
  font-size: var(--font-size-body);
  line-height: 1.6;
  color: var(--c-text);
  background: var(--c-surface);
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4, p, figure { margin: 0; }
ul, ol { margin: 0; padding: 0; list-style: none; }
img { display: block; max-width: 100%; }
a { color: inherit; text-decoration: none; }

button {
  border: none;
  background: none;
  padding: 0;
  font-family: inherit;
  font-size: inherit;
  color: inherit;
  cursor: pointer;
}

input, textarea, select {
  font-family: inherit;
  /* 必须 >= 16px：小于它 iOS Safari 一聚焦就把整页放大 */
  font-size: 16px;
  color: var(--c-text);
  border: none;
  outline: none;
  background: none;
}

/* reicon 的自定义标签。与 QuPhone base.css 里那一条同源 */
re-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: none;
}

[hidden] { display: none !important; }

/* ===== 公共部件 ===== */
/* 卡片：描边，不投影。论坛的长列表里投影会让每一条都往前浮一层 */
.card {
  background: var(--c-bg);
  border: 1px solid var(--c-border);
  border-radius: var(--r-8);
}

.eyebrow {
  font-size: var(--label-size);
  font-weight: var(--label-weight);
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--c-hint);
  line-height: 1.2;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: var(--ctrl-h);
  padding: 0 14px;
  border: 1px solid var(--c-border);
  border-radius: var(--r-8);
  background: var(--c-bg);
  font-size: var(--row-value-size);
  font-weight: 500;
  color: var(--c-text);
  white-space: nowrap;
  transition: background var(--dur) var(--ease), border-color var(--dur) var(--ease);
}
.btn:hover { background: var(--c-surface-2); border-color: var(--c-border-m); }
.btn:active { background: var(--c-surface-3); }

.btn-primary {
  background: var(--c-accent-dark);
  border-color: var(--c-accent-dark);
  color: var(--c-bg);
}
.btn-primary:hover { background: var(--c-text); border-color: var(--c-text); color: var(--c-bg); }

.btn-ghost { background: none; border-color: transparent; }
.btn-ghost:hover { background: var(--c-surface-2); border-color: transparent; }

.btn-sm { height: 28px; padding: 0 10px; }
.btn-lg { height: 40px; padding: 0 20px; font-size: var(--font-size-body); }

.btn:disabled { opacity: 0.45; cursor: not-allowed; }
.btn:disabled:hover { background: var(--c-bg); border-color: var(--c-border); }

/* 圆形图标钮：**正圆保持不变** */
.icon-btn {
  width: 32px;
  height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: none;
  color: var(--c-sub);
  transition: background var(--dur) var(--ease), color var(--dur) var(--ease);
}
.icon-btn:hover { background: var(--c-surface-2); color: var(--c-text); }

/* 输入字段：外面这层出边框与高度，里面的 input 自己不带背景 */
.field {
  display: flex;
  align-items: center;
  gap: 8px;
  height: var(--ctrl-h);
  padding: 0 10px;
  border: 1px solid var(--c-border);
  border-radius: var(--r-8);
  background: var(--c-bg);
  color: var(--c-hint);
  transition: border-color var(--dur) var(--ease);
}
.field:focus-within { border-color: var(--c-accent); }
.field input { flex: 1; min-width: 0; font-size: 16px; }
.field input::placeholder { color: var(--c-hint); }
.field-lg { height: 40px; padding: 0 12px; }

.area {
  display: block;
  width: 100%;
  min-height: 150px;
  padding: 12px;
  border: 1px solid var(--c-border);
  border-radius: var(--r-8);
  background: var(--c-bg);
  line-height: 1.7;
  resize: vertical;
  transition: border-color var(--dur) var(--ease);
}
.area:focus { border-color: var(--c-accent); }
.area::placeholder { color: var(--c-hint); }

.label {
  display: block;
  margin-bottom: 6px;
  font-size: var(--row-value-size);
  font-weight: 500;
  color: var(--c-sub);
}

/* 开关：轨道保持胶囊、滑钮保持正圆 —— 见文件头那条豁免 */
.switch {
  position: relative;
  flex: none;
  width: 40px;
  height: 24px;
  border-radius: 100px;
  background: var(--c-surface-3);
  transition: background var(--dur) var(--ease);
}
.switch::after {
  content: '';
  position: absolute;
  top: 3px;
  left: 3px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--c-bg);
  box-shadow: var(--shadow-sm);
  transition: transform 0.2s var(--ease);
}
.switch[aria-checked="true"] { background: var(--c-accent-dark); }
.switch[aria-checked="true"]::after { transform: translateX(16px); }

/* 标签：分区名、状态、置顶 */
.tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  height: 20px;
  padding: 0 6px;
  border-radius: var(--r-4);
  background: var(--c-surface-2);
  font-size: 11px;
  font-weight: 500;
  color: var(--c-sub);
  white-space: nowrap;
}
.tag-strong { background: var(--c-accent-dark); color: var(--c-bg); }
.tag-warn { background: var(--c-surface-3); color: var(--c-text); }
/* 精华：站里只有灰阶，实心块已经被「已隐藏」占了，
   所以这一个走描边 —— 同一屏出现置顶 + 精华时两者还能分得开 */
.tag-best {
  background: var(--c-bg);
  border: 1px solid var(--c-accent-dark);
  color: var(--c-text);
}

.muted { color: var(--c-sub); }
.hint { color: var(--c-hint); font-size: var(--row-value-size); }

.empty {
  padding: 48px 20px;
  text-align: center;
  color: var(--c-hint);
  font-size: var(--row-value-size);
}

.clamp-1 { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.clamp-2, .clamp-3 {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.clamp-2 { -webkit-line-clamp: 2; }
.clamp-3 { -webkit-line-clamp: 3; }

/* ===== 提示条 ===== */
.toast {
  position: fixed;
  left: 50%;
  bottom: 28px;
  z-index: 90;
  transform: translate(-50%, 10px);
  max-width: min(520px, calc(100vw - 32px));
  padding: 10px 16px;
  border-radius: var(--r-8);
  background: var(--c-text);
  color: var(--c-bg);
  font-size: var(--row-value-size);
  box-shadow: var(--shadow-lg);
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--dur) var(--ease), transform var(--dur) var(--ease);
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
:root[data-theme="dark"] .toast { background: var(--c-surface-3); color: var(--c-text); }

/* ===== 弹窗 ===== */
.modal {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--dur) var(--ease);
}
.modal.show { opacity: 1; pointer-events: auto; }
.modal-scrim { position: absolute; inset: 0; background: rgba(0, 0, 0, 0.4); }
.modal-card {
  position: relative;
  width: min(400px, 100%);
  padding: 20px;
  background: var(--c-bg);
  border: 1px solid var(--c-border);
  border-radius: var(--r-8);
  box-shadow: var(--shadow-lg);
}
.modal-title { font-size: 16px; font-weight: 600; }
.modal-text { margin-top: 8px; color: var(--c-sub); font-size: var(--row-value-size); }
.modal-btns { margin-top: 20px; display: flex; gap: 8px; justify-content: flex-end; }

/* ===== 看大图 ===== */
/* 与 .modal 同一层（80）：它就是一个只装着一张图的弹窗，
   同时压在顶栏之上 —— 看大图时顶栏露在图上面，那张图就不像「打开了」 */
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--dur) var(--ease);
}
.lightbox.show { opacity: 1; pointer-events: auto; }
/* 比确认弹窗那层黑得多：那一层底下要读得见页面，这一层底下**不该**看得见 ——
   图与页面同样亮的话，看的人得先找一下图的边在哪 */
.lb-scrim { position: absolute; inset: 0; background: rgba(0, 0, 0, 0.82); }
.lb-img {
  position: relative;
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  border-radius: var(--r-8);
}
.lb-x {
  position: absolute;
  top: 14px;
  right: 14px;
  display: flex;
  color: rgba(255, 255, 255, 0.8);
}
.lb-x:hover { color: #fff; }
.lb-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.45);
  color: rgba(255, 255, 255, 0.85);
}
.lb-nav:hover { background: rgba(0, 0, 0, 0.65); color: #fff; }
.lb-prev { left: 12px; }
/* 「下一张」用的是同一颗左箭头转过来的：图标表里只登记语义名，
   为一个镜像的箭头再登记一条，两条名字指同一个图案，将来换库时必漏一条 */
.lb-next { right: 12px; transform: translateY(-50%) rotate(180deg); }
.lb-n {
  position: absolute;
  bottom: 18px;
  left: 50%;
  transform: translateX(-50%);
  padding: 3px 10px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.5);
  font-size: 11px;
  font-variant-numeric: tabular-nums;
  color: rgba(255, 255, 255, 0.85);
}

/* ===== 登录卡 ===== */
/* 前台登录与后台登录用同一张卡，所以它住在这里而不是 forum.css ——
 * 放在前台那张里的话，admin.html 没引它，后台登录页会塌成一堆裸文字 */
.auth-wrap {
  min-height: calc(100vh - var(--head-h));
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px 20px 80px;
}
.auth-card {
  width: min(400px, 100%);
  padding: 28px;
  border: 1px solid var(--c-border);
  border-radius: var(--r-8);
  background: var(--c-bg);
}
.auth-title { margin-top: 6px; font-size: 20px; font-weight: 600; }
.auth-note {
  margin-top: 14px;
  padding: 10px 12px;
  border-radius: var(--r-4);
  background: var(--c-surface);
  font-size: var(--row-value-size);
  line-height: 1.6;
  color: var(--c-sub);
}
.auth-note code {
  padding: 1px 5px;
  border-radius: var(--r-4);
  background: var(--c-surface-2);
  font-size: 11px;
}
.auth-card .field { margin-top: 10px; }
.auth-card .btn { width: 100%; margin-top: 18px; }

/* 键盘可达性：全站统一一个焦点圈，不要在各处 outline: none 掉 */
:focus-visible {
  outline: 2px solid var(--c-accent);
  outline-offset: 2px;
  border-radius: var(--r-4);
}

/* 唯一的例外：.field 已经用 :focus-within 把外框变成强调色了。
 * 里面那个 input 再吃一圈 outline，就等于在框里又画了一个灰框。 */
.field input:focus-visible,
.field textarea:focus-visible,
.field select:focus-visible { outline: none; }
