/* ============================================================================
   EmojiAnnotations · 控制台样式层
   基调：阿里云式浅色控制台 + 科技蓝主色；脸部差分图保留深色画布（混合方案）。
   设计原则：全部走下方 token，页面结构样式与 JS 生成的 class 名一一对应，
   因此这套样式即使脱离 Tailwind CDN 也能独立成立（离线兜底）。
   ========================================================================== */

:root {
  /* 中性色阶 */
  --bg: #f2f4f7;             /* 页面底 */
  --surface: #ffffff;        /* 卡片/面板 */
  --surface-2: #f7f9fc;      /* 表头/次级面 */
  --surface-3: #eef1f6;      /* hover 面 */
  --border: #e5e9f0;         /* 分隔线 */
  --border-strong: #d4dae3;
  --text: #1d2129;           /* 主文本 */
  --text-2: #4e5969;         /* 次文本 */
  --muted: #86909c;          /* 辅助文本 */

  /* 品牌 / 语义色 */
  --primary: #0070cc;
  --primary-hover: #0084f0;
  --primary-active: #005bab;
  --primary-bg: #e8f3fd;     /* 选中底 */
  --ok: #00a870;
  --ok-bg: #e3f9ee;
  --ok-line: #acf0d0;
  --warn: #ff8f1f;
  --warn-bg: #fff5e6;
  --warn-line: #ffdfa3;
  --err: #f53f3f;
  --err-bg: #ffece8;
  --err-line: #fbaca3;
  --info: #0070cc;
  --info-bg: #e8f3fd;
  --info-line: #b5dbff;

  /* 图片深色画布 */
  --canvas: #0f1216;

  /* 圆角 / 阴影 / 间距刻度 */
  --r-sm: 4px; --r: 6px; --r-lg: 8px; --r-xl: 12px;
  --sh-1: 0 1px 2px rgba(15, 23, 42, .06);
  --sh-2: 0 4px 12px rgba(15, 23, 42, .08);
  --sh-pop: 0 10px 30px rgba(15, 23, 42, .16);
  --s1: 4px; --s2: 8px; --s3: 12px; --s4: 16px; --s5: 20px; --s6: 24px; --s8: 32px;

  --appbar-h: 56px;
  --rail-w: 220px;
  --font: system-ui, -apple-system, "PingFang SC", "Microsoft YaHei",
    "Segoe UI", Roboto, Arial, sans-serif;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 14px/1.55 var(--font);
  -webkit-font-smoothing: antialiased;
}
[hidden] { display: none !important; }
a { color: var(--primary); text-decoration: none; }
h1, h2, h3 { margin: 0; font-weight: 600; color: var(--text); }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: #cbd2dc; border-radius: 8px; border: 2px solid transparent; background-clip: padding-box; }
::-webkit-scrollbar-thumb:hover { background: #b3bcc9; background-clip: padding-box; }

.muted { color: var(--muted); }
.small { font-size: 12px; }
.msg { min-height: 20px; font-size: 13px; color: var(--text-2); margin: 6px 0 0; }
.msg.ok { color: var(--ok); }
.msg.err { color: var(--err); }

/* ---------- 按钮 ---------- */
button {
  font-family: inherit; font-size: 14px; line-height: 1;
  border: 1px solid var(--border-strong); background: var(--surface); color: var(--text);
  border-radius: var(--r); padding: 9px 16px; cursor: pointer;
  transition: background .15s, border-color .15s, color .15s, box-shadow .15s;
  white-space: nowrap;
}
button:hover { border-color: var(--primary); color: var(--primary); }
button:active { transform: translateY(.5px); }
button:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--primary-bg); border-color: var(--primary); }
button.primary { background: var(--primary); border-color: var(--primary); color: #fff; box-shadow: var(--sh-1); }
button.primary:hover { background: var(--primary-hover); border-color: var(--primary-hover); color: #fff; }
button.primary:active { background: var(--primary-active); }
button.primary:disabled { background: #a8cff0; border-color: #a8cff0; color: #fff; cursor: not-allowed; box-shadow: none; }
button.ghost { background: transparent; border-color: transparent; color: var(--text-2); }
button.ghost:hover { background: var(--surface-3); color: var(--primary); border-color: transparent; }
button.danger { background: transparent; border-color: var(--err-line); color: var(--err); }
button.danger:hover { background: var(--err-bg); border-color: var(--err); color: var(--err); }
button.danger:disabled { opacity: .5; cursor: not-allowed; }
button:disabled { cursor: not-allowed; opacity: .55; }
button.sm { padding: 5px 10px; font-size: 12px; }

/* ---------- 表单 ---------- */
input, select, textarea {
  font-family: inherit; font-size: 14px; color: var(--text);
  background: var(--surface); border: 1px solid var(--border-strong);
  border-radius: var(--r); padding: 9px 12px; width: 100%;
  transition: border-color .15s, box-shadow .15s;
}
input::placeholder, textarea::placeholder { color: #a9b1bd; }
input:hover, select:hover, textarea:hover { border-color: var(--primary); }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-bg); }
textarea { resize: vertical; line-height: 1.6; }
label { color: var(--text-2); }

/* ---------- 顶栏 ---------- */
.appbar {
  height: var(--appbar-h); display: flex; align-items: center; justify-content: space-between;
  padding: 0 var(--s6); background: var(--surface); border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 30;
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 600; font-size: 16px; color: var(--text); }
.brand .brand-mark {
  width: 28px; height: 28px; border-radius: var(--r); display: grid; place-items: center;
  background: var(--primary); color: #fff; font-size: 14px; font-weight: 700;
}
.brand .brand-sub { font-weight: 400; color: var(--muted); font-size: 13px; padding-left: 10px; margin-left: 2px; border-left: 1px solid var(--border); }
.appbar-right { display: flex; align-items: center; gap: var(--s3); }
.who { color: var(--text-2); font-size: 13px; }
.avatar-dot { width: 28px; height: 28px; border-radius: 50%; background: var(--primary-bg); color: var(--primary); display: grid; place-items: center; font-weight: 600; font-size: 13px; }

/* ---------- 通用卡片 ---------- */
.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-xl);
  padding: var(--s5); box-shadow: var(--sh-1);
}
.card-head { display: flex; align-items: center; justify-content: space-between; gap: var(--s3); margin: calc(-1 * var(--s5)) calc(-1 * var(--s5)) var(--s4); padding: var(--s4) var(--s5); border-bottom: 1px solid var(--border); }
.card-head h3 { font-size: 15px; }
.card.narrow { width: min(400px, 92vw); display: flex; flex-direction: column; gap: var(--s3); padding: var(--s8) var(--s6); box-shadow: var(--sh-2); }
.card.narrow h2 { font-size: 19px; }

/* ---------- 登录 / 欢迎 ---------- */
.gate { display: flex; justify-content: center; align-items: flex-start; padding: 9vh 16px; }
.gate .lead { color: var(--text-2); font-size: 13px; margin: 0; }

/* ---------- 管理：控制台骨架 ---------- */
.shell { display: flex; min-height: calc(100vh - var(--appbar-h)); align-items: stretch; }
.nav-rail {
  width: var(--rail-w); min-width: var(--rail-w); background: var(--surface);
  border-right: 1px solid var(--border); padding: var(--s3) var(--s2);
  display: flex; flex-direction: column; gap: 2px;
  position: sticky; top: var(--appbar-h); height: calc(100vh - var(--appbar-h)); overflow-y: auto;
}
.nav-rail .nav-title { font-size: 11px; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); padding: var(--s2) var(--s3); }
.nav-rail button, .tabs button {
  display: flex; align-items: center; gap: 10px; width: 100%; text-align: left;
  background: transparent; border: none; border-radius: var(--r); padding: 10px var(--s3);
  color: var(--text-2); font-size: 14px; position: relative;
}
.nav-rail button:hover, .tabs button:hover { background: var(--surface-3); color: var(--text); }
.nav-rail button.active, .tabs button.active { background: var(--primary-bg); color: var(--primary); font-weight: 600; }
.nav-rail button.active::before, .tabs button.active::before {
  content: ""; position: absolute; left: -8px; top: 8px; bottom: 8px; width: 3px; border-radius: 0 3px 3px 0; background: var(--primary);
}
.nav-rail .nav-spacer { flex: 1; }
.nav-icon { width: 18px; display: inline-flex; align-items: center; justify-content: center; opacity: .9; }
.nav-icon .ic { width: 18px; height: 18px; display: block; }
/* 平台：模块分组导航 */
.nav-module { display: flex; flex-direction: column; gap: 2px; margin-bottom: var(--s2); }
.nav-module-head {
  display: flex; align-items: center; gap: 10px; padding: 10px var(--s3);
  color: var(--text); font-weight: 600; font-size: 14px;
}
.nav-module-items { display: flex; flex-direction: column; gap: 2px; padding-left: var(--s3); }
.nav-soon {
  display: flex; align-items: center; gap: 10px; width: 100%; text-align: left;
  background: transparent; border: none; border-radius: var(--r); padding: 10px var(--s3);
  color: var(--muted); font-size: 14px; cursor: not-allowed;
}
.nav-soon:hover { background: transparent; color: var(--muted); }
.nav-tag { margin-left: auto; font-size: 11px; color: var(--muted); background: var(--surface-3); border-radius: 999px; padding: 1px 8px; }
.content { flex: 1; min-width: 0; padding: var(--s6); overflow: auto; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: var(--s4); margin-bottom: var(--s5); flex-wrap: wrap; }
.breadcrumb { font-size: 13px; color: var(--muted); margin-bottom: 6px; }
.breadcrumb b { color: var(--text-2); font-weight: 500; }
.page-head h2 { font-size: 20px; }
.toolbar { display: flex; align-items: center; gap: var(--s3); flex-wrap: wrap; }
.toolbar input, .toolbar select { width: auto; }

/* ---------- 志愿者工作台 ---------- */
#workspace { display: flex; min-height: calc(100vh - var(--appbar-h)); align-items: stretch; }
.sidebar {
  width: 288px; min-width: 288px; background: var(--surface); border-right: 1px solid var(--border);
  padding: var(--s4); display: flex; flex-direction: column; gap: var(--s3);
  position: sticky; top: var(--appbar-h); height: calc(100vh - var(--appbar-h));
}
.sidebar .side-title { font-size: 12px; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); }
.char-list { overflow-y: auto; flex: 1; display: flex; flex-direction: column; gap: 2px; margin: 0 -4px; }
.char-item, .artwork-item {
  padding: 9px 10px; border-radius: var(--r); cursor: pointer; border: 1px solid transparent;
  display: flex; align-items: center; justify-content: space-between; gap: var(--s2); color: var(--text-2);
}
.char-item:hover, .artwork-item:hover { background: var(--surface-3); color: var(--text); }
.char-item.open { background: var(--surface-2); border-color: var(--border); color: var(--text); font-weight: 500; }
.artwork-item { margin-left: 14px; font-size: 13px; }
.artwork-item.active { background: var(--primary-bg); border-color: transparent; color: var(--primary); font-weight: 600; }
.badge {
  background: var(--surface-3); border: none; color: var(--text-2);
  border-radius: 999px; padding: 1px 8px; font-size: 12px; white-space: nowrap; min-width: 22px; text-align: center; line-height: 18px;
}
.badge.done { background: var(--ok-bg); color: var(--ok); }
.notice { background: var(--info-bg); border: 1px solid var(--info-line); border-radius: var(--r-lg); padding: 10px 12px; font-size: 13px; color: #0a5aa8; }
.workbench .content { padding: var(--s6); }
.artwork-header { margin-bottom: var(--s5); }
.artwork-header h2 { font-size: 18px; margin-bottom: 2px; }
.empty { padding: 64px 24px; text-align: center; color: var(--muted); display: flex; flex-direction: column; align-items: center; gap: 10px; }
.empty::before { content: "🖼"; font-size: 34px; opacity: .5; }

/* ---------- 志愿者派题页（系统随机单题 · 自由输入 · 默认↔差分对照）---------- */
.quiz-wrap { max-width: 720px; margin: 0 auto; padding: var(--s6) var(--s5) 72px; }
.quiz-notice { margin-bottom: var(--s5); }
.quiz { display: flex; justify-content: center; }
.quiz-card { width: 100%; max-width: 620px; display: flex; flex-direction: column; gap: var(--s4); }
.quiz-top { display: flex; align-items: center; justify-content: space-between; gap: var(--s3); }
.q-badge { background: var(--primary-bg); color: var(--primary); font-weight: 600; border-radius: 999px; padding: 4px 14px; font-size: 13px; }
.q-badge b { font-size: 15px; }
.quiz-images { display: flex; gap: var(--s4); align-items: stretch; justify-content: center; }
.quiz-images figure { margin: 0; flex: 1; min-width: 0; display: flex; flex-direction: column; align-items: center; gap: 8px; }
.quiz-images img { width: 100%; aspect-ratio: 1; object-fit: contain; background: var(--canvas); border: 1px solid var(--border); border-radius: var(--r-lg); display: block; }
.quiz-images figcaption { font-size: 13px; color: var(--muted); }
.quiz-images .is-target img { border: 2px solid var(--primary); box-shadow: var(--sh-2); }
.quiz-images .is-target figcaption { color: var(--primary); font-weight: 600; }
.quiz-images > .skeleton { flex: 1; min-width: 0; aspect-ratio: 1; }
.answer-row { display: flex; gap: var(--s2); }
.answer-row input { flex: 1; font-size: 16px; }
.quiz-actions { display: flex; align-items: center; justify-content: space-between; gap: var(--s3); flex-wrap: wrap; }

/* ---------- 差分卡片网格（深色图片画布）---------- */
.state-grid {
  display: grid; gap: var(--s4);
  grid-template-columns: repeat(auto-fill, minmax(188px, 1fr));
}
.state-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg);
  overflow: hidden; cursor: pointer; position: relative; box-shadow: var(--sh-1);
  transition: box-shadow .16s, border-color .16s, transform .16s;
}
.state-card:hover { border-color: var(--primary); box-shadow: var(--sh-2); transform: translateY(-2px); }
.state-card img { width: 100%; aspect-ratio: 1; object-fit: contain; background: var(--canvas); display: block; }
.state-card .cap { padding: 10px 12px; display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 6px; border-top: 1px solid var(--border); }
.state-card .fname { font-weight: 600; font-size: 13px; }
.state-card.ref { cursor: default; box-shadow: none; }
.state-card.ref:hover { border-color: var(--border); transform: none; box-shadow: none; }
.state-card .tag { font-size: 11px; border-radius: var(--r-sm); padding: 2px 6px; border: 1px solid var(--border); color: var(--muted); background: var(--surface); }
.tag.decided { color: var(--ok); background: var(--ok-bg); border-color: var(--ok-line); }
.tag.static { color: #b26a00; background: var(--warn-bg); border-color: var(--warn-line); }
.tag.ref { color: var(--info); background: var(--info-bg); border-color: var(--info-line); }

/* ---------- 弹窗 ---------- */
.modal {
  position: fixed; inset: 0; background: rgba(20, 27, 40, .45); backdrop-filter: blur(2px);
  display: flex; align-items: center; justify-content: center; z-index: 50; padding: 20px;
}
.modal-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-xl);
  max-width: 880px; width: 100%; max-height: 92vh; overflow: hidden; box-shadow: var(--sh-pop);
  display: flex; flex-direction: column;
}
.modal-preview { display: flex; gap: var(--s3); background: var(--canvas); padding: var(--s5); justify-content: center; align-items: center; }
.modal-preview img { max-height: 42vh; max-width: 46%; object-fit: contain; border-radius: var(--r-lg); background: var(--canvas); }
.modal-body { padding: var(--s5); display: flex; flex-direction: column; gap: var(--s3); overflow-y: auto; }
.modal-title { font-size: 16px; display: flex; align-items: baseline; gap: 8px; }
.options { display: flex; flex-wrap: wrap; gap: var(--s2); }
.options button.selected { background: var(--primary); border-color: var(--primary); color: #fff; }
#m-options .ref-option { border: 1px dashed var(--primary); color: var(--primary); background: var(--primary-bg); }
#m-options .ref-option.selected { border-style: solid; color: #fff; background: var(--primary); }
.custom-row { display: flex; gap: var(--s2); }
.m-mine { font-size: 12px; color: var(--muted); background: var(--surface-2); border-radius: var(--r); padding: 8px 10px; }
.m-mine:empty { display: none; }

/* ---------- Toast（顶部居中通知，阿里云 Message 风）---------- */
.toast {
  position: fixed; left: 50%; top: 20px; transform: translateX(-50%);
  background: var(--surface); color: var(--text); box-shadow: var(--sh-pop);
  border: 1px solid var(--border); border-left: 3px solid var(--primary);
  padding: 11px 18px; border-radius: var(--r-lg); z-index: 99; max-width: 90vw; font-size: 14px;
}
.toast.err { border-left-color: var(--err); }

/* ---------- 管理端：布局 / 表格 / 统计 ---------- */
.layout { display: flex; gap: var(--s5); align-items: flex-start; }
.col { flex: 1; min-width: 0; }
table.admin { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 13px; }
table.admin th, table.admin td { padding: 10px 12px; border-bottom: 1px solid var(--border); text-align: left; }
table.admin thead th { color: var(--text-2); font-weight: 600; background: var(--surface-2); position: sticky; top: 0; border-bottom: 1px solid var(--border); }
table.admin thead th:first-child { border-top-left-radius: var(--r); }
table.admin thead th:last-child { border-top-right-radius: var(--r); }
table.admin tbody tr:last-child td { border-bottom: none; }
table.admin tr.clickable { cursor: pointer; }
table.admin tbody tr:hover { background: var(--surface-2); }
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: var(--s4); }
.stat { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-xl); padding: var(--s5); box-shadow: var(--sh-1); }
.stat .label { color: var(--muted); font-size: 13px; }
.stat b { font-size: 26px; display: block; margin: 6px 0 2px; color: var(--text); font-weight: 700; }
.candidate-row { display: flex; align-items: center; gap: var(--s2); }
.candidate-row .bar { height: 8px; background: linear-gradient(90deg, var(--primary), #22a7ff); border-radius: 4px; min-width: 4px; }
.pager { display: flex; gap: var(--s3); align-items: center; }
#review-side .pick { margin: 0; }
.pick { min-width: 96px; }
.pick.ghost { border: 1px solid var(--border-strong); background: var(--surface); }
.pick.ghost:hover { border-color: var(--primary); }

/* ---------- 链接式按钮（门户/返回入口） ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 6px; font-size: 14px; line-height: 1;
  border: 1px solid var(--border-strong); background: var(--surface); color: var(--text);
  border-radius: var(--r); padding: 10px 18px; cursor: pointer; text-decoration: none; white-space: nowrap;
  transition: background .15s, border-color .15s, color .15s, box-shadow .15s;
}
.btn:hover { border-color: var(--primary); color: var(--primary); }
.btn.primary { background: var(--primary); border-color: var(--primary); color: #fff; box-shadow: var(--sh-1); }
.btn.primary:hover { background: var(--primary-hover); border-color: var(--primary-hover); color: #fff; }
.btn.ghost { background: transparent; border-color: transparent; color: var(--text-2); }
.btn.ghost:hover { background: var(--surface-3); color: var(--primary); border-color: transparent; }
.btn.sm { padding: 7px 12px; font-size: 13px; }

/* ---------- 平台门户首页 ---------- */
.portal-nav { display: flex; align-items: center; gap: var(--s5); }
.portal-nav a { color: var(--text-2); font-size: 14px; }
.portal-nav a:hover { color: var(--primary); }

.hero { background: var(--surface); border-bottom: 1px solid var(--border); }
.hero-inner { max-width: 1080px; margin: 0 auto; padding: 60px var(--s8) 56px; }
.hero .eyebrow { font-size: 13px; font-weight: 600; letter-spacing: .04em; color: var(--primary); margin-bottom: 14px; }
.hero h1 { font-size: 30px; line-height: 1.3; font-weight: 700; letter-spacing: -.01em; max-width: 18em; }
.hero .lead { margin: 16px 0 0; max-width: 620px; color: var(--text-2); font-size: 15px; line-height: 1.8; }
.hero-actions { margin-top: 28px; display: flex; gap: var(--s3); flex-wrap: wrap; }

.portal-main { max-width: 1080px; margin: 0 auto; padding: var(--s8) var(--s8) 64px; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: var(--s4); margin: var(--s8) 0 var(--s5); flex-wrap: wrap; }
.section-head h2 { font-size: 20px; }

.svc-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: var(--s4); }
.svc-card {
  display: flex; gap: var(--s4); align-items: flex-start; background: var(--surface);
  border: 1px solid var(--border); border-radius: var(--r-lg); padding: var(--s5);
  color: inherit; transition: border-color .15s, background .15s;
}
a.svc-card:hover { border-color: var(--primary); background: var(--surface-2); }
.svc-card.is-active { border-left: 3px solid var(--primary); padding-left: calc(var(--s5) - 2px); }
.svc-card.is-soon { color: var(--muted); background: var(--surface-2); border-style: dashed; cursor: not-allowed; }
.svc-icon { flex: none; width: 40px; height: 40px; border-radius: var(--r); display: grid; place-items: center; background: var(--surface-3); color: var(--text-2); }
.svc-icon svg { width: 22px; height: 22px; display: block; }
.svc-card.is-active .svc-icon { background: var(--primary-bg); color: var(--primary); }
.svc-card.is-soon .svc-icon { background: transparent; color: var(--muted); }
.svc-body { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.svc-title { display: flex; align-items: center; gap: 8px; }
.svc-body h3 { font-size: 15px; font-weight: 600; }
.svc-body p { margin: 0; font-size: 13px; color: var(--text-2); line-height: 1.65; }
.svc-card.is-soon .svc-body p { color: var(--muted); }
.svc-badge { font-size: 11px; font-weight: 500; padding: 2px 8px; border-radius: 999px; background: var(--ok-bg); color: var(--ok); }
.svc-badge.soon { background: var(--surface-3); color: var(--muted); }

.steps { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: var(--s6); }
.step { border-top: 2px solid var(--border-strong); padding-top: var(--s4); transition: border-color .15s; }
.step:hover { border-top-color: var(--primary); }
.step-no { font-size: 12px; font-weight: 600; letter-spacing: .08em; color: var(--muted); font-variant-numeric: tabular-nums; transition: color .15s; }
.step:hover .step-no { color: var(--primary); }
.step h4 { margin: 8px 0 6px; font-size: 15px; }
.step p { margin: 0; font-size: 13px; color: var(--text-2); line-height: 1.65; }

.portal-foot { border-top: 1px solid var(--border); background: var(--surface); }
.portal-foot .foot-inner { max-width: 1080px; margin: 0 auto; padding: var(--s6) var(--s8); display: flex; align-items: center; justify-content: space-between; gap: var(--s4); flex-wrap: wrap; color: var(--muted); font-size: 13px; }

@media (max-width: 760px) {
  .hero-inner { padding: 40px var(--s6) 36px; }
  .hero h1 { font-size: 26px; }
  .portal-main { padding: var(--s6) var(--s6) 48px; }
  .portal-nav { display: none; }
}

/* ---------- 响应式 ---------- */
@media (max-width: 900px) {
  .nav-rail { width: 68px; min-width: 68px; padding: var(--s3) 6px; }
  .nav-rail .nav-title, .nav-rail .nav-label, .nav-rail .nav-spacer { display: none; }
  .nav-rail .nav-tag { display: none; }
  .nav-module-items { padding-left: 0; }
  .nav-module-head { justify-content: center; padding: 10px 0; }
  .nav-rail button, .tabs button { justify-content: center; padding: 12px 0; }
  .nav-rail button.active::before, .tabs button.active::before { left: -6px; }
}
@media (max-width: 760px) {
  .appbar { padding: 0 var(--s4); }
  .brand .brand-sub { display: none; }
  #workspace, .shell { flex-direction: column; }
  .sidebar { width: 100%; min-width: 0; border-right: none; border-bottom: 1px solid var(--border); position: static; height: auto; }
  .layout { flex-direction: column; }
  .nav-rail { width: 100%; min-width: 0; flex-direction: row; overflow-x: auto; border-right: none; border-bottom: 1px solid var(--border); position: static; height: auto; }
  .nav-rail button.active::before { display: none; }
  .content { padding: var(--s4); }
}

/* ---------- 动效（纯 CSS：内容不依赖动画显示，动画只增强）---------- */
@keyframes fadeIn { from { opacity: 0 } to { opacity: 1 } }
@keyframes popIn { from { opacity: 0; transform: translateY(8px) scale(.98) } to { opacity: 1; transform: none } }
@keyframes riseIn { from { opacity: 0; transform: translateY(10px) } to { opacity: 1; transform: none } }
@keyframes toastIn { from { opacity: 0; transform: translate(-50%, -12px) } to { opacity: 1; transform: translate(-50%, 0) } }
@keyframes shimmer { 100% { transform: translateX(100%) } }
@keyframes growBar { from { width: 0 } }

.modal { animation: fadeIn .18s ease both; }
.modal-card { animation: popIn .22s cubic-bezier(.2,.7,.3,1) both; }
.toast { animation: toastIn .2s ease both; }
.card { animation: riseIn .3s ease both; }
.state-card { animation: riseIn .34s ease backwards; }
.state-grid .state-card:nth-child(1) { animation-delay: .01s; }
.state-grid .state-card:nth-child(2) { animation-delay: .05s; }
.state-grid .state-card:nth-child(3) { animation-delay: .09s; }
.state-grid .state-card:nth-child(4) { animation-delay: .13s; }
.state-grid .state-card:nth-child(5) { animation-delay: .17s; }
.state-grid .state-card:nth-child(6) { animation-delay: .21s; }
.state-grid .state-card:nth-child(7) { animation-delay: .24s; }
.state-grid .state-card:nth-child(8) { animation-delay: .27s; }
.state-grid .state-card:nth-child(9) { animation-delay: .29s; }
.state-grid .state-card:nth-child(10) { animation-delay: .31s; }
.state-grid .state-card:nth-child(11) { animation-delay: .33s; }
.state-grid .state-card:nth-child(n+12) { animation-delay: .35s; }
.candidate-row .bar { animation: growBar .5s ease both; }
table.admin tbody tr { animation: fadeIn .2s ease both; }

/* ---------- 骨架屏 ---------- */
.skeleton { position: relative; overflow: hidden; background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--r-lg); }
.skeleton::after { content: ""; position: absolute; inset: 0; transform: translateX(-100%); background: linear-gradient(90deg, transparent, rgba(255,255,255,.6), transparent); animation: shimmer 1.3s infinite; }
.sk-card { aspect-ratio: 1 / 1.18; }
.sk-line { height: 12px; border-radius: 6px; margin: 10px; }

/* ---------- 表情阅读教程（<details> 零 JS） ---------- */
.tutorial { margin: 14px 0 0; border: 1px solid var(--border); border-radius: var(--r); background: var(--surface-2); overflow: hidden; }
.tutorial > summary { cursor: pointer; padding: 10px var(--s3); font-weight: 600; font-size: 14px; color: var(--text); list-style: none; display: flex; align-items: center; gap: 8px; user-select: none; }
.tutorial > summary::-webkit-details-marker { display: none; }
.tutorial > summary::before { content: "?"; display: grid; place-items: center; width: 18px; height: 18px; border-radius: 999px; background: var(--primary); color: #fff; font-size: 12px; font-weight: 700; flex: none; }
.tutorial > summary::after { content: "展开"; margin-left: auto; font-size: 12px; font-weight: 400; color: var(--muted); }
.tutorial[open] > summary::after { content: "收起"; }
.tutorial > summary:hover { background: var(--surface-3); }
.tut-steps { margin: 0; padding: 4px var(--s4) var(--s3) var(--s5); font-size: 13.5px; line-height: 1.8; color: var(--text-2); }
.tut-steps li { margin: 6px 0; }
.tut-steps b { color: var(--text); }
.tut-steps em { font-style: normal; color: var(--primary); font-weight: 600; }
.tut-tags { display: inline-flex; gap: 6px; margin: 2px 0 2px; flex-wrap: wrap; }
.tut-tags i { font-style: normal; font-size: 12px; color: var(--primary); background: var(--surface); border: 1px solid var(--border-strong); border-radius: 999px; padding: 1px 10px; }
.tut-tip { margin: 0; padding: 10px var(--s4); border-top: 1px dashed var(--border); font-size: 13px; color: var(--muted); background: var(--surface); }
/* 答题页精简版 */
.tutorial-inline { margin: 10px 0 0; }
.tutorial-inline > summary { padding: 7px var(--s3); font-size: 13px; }
.tutorial-inline > summary::before { content: "?"; width: 16px; height: 16px; font-size: 11px; }
.tutorial-inline p { margin: 0; padding: 2px var(--s4) 12px; font-size: 13px; line-height: 1.7; color: var(--text-2); }
.tutorial-inline em { font-style: normal; color: var(--primary); font-weight: 600; }

/* ---------- 图片点击放大（lightbox） ---------- */
.quiz-images img, #review-side img { cursor: zoom-in; }
.lightbox {
  position: fixed; inset: 0; z-index: 1000; display: flex; align-items: center; justify-content: center;
  background: rgba(8, 10, 13, .82); backdrop-filter: blur(2px); padding: var(--s6);
  animation: lb-fade .16s ease-out;
}
.lightbox[hidden] { display: none; }
.lightbox-img { max-width: 92vw; max-height: 88vh; border-radius: 10px; background: #0b0d10; box-shadow: 0 12px 48px rgba(0,0,0,.5); image-rendering: auto; cursor: default; }
.lightbox-close {
  position: absolute; top: 18px; right: 22px; width: 40px; height: 40px; border-radius: 999px;
  border: 1px solid rgba(255,255,255,.24); background: rgba(255,255,255,.08); color: #fff;
  font-size: 24px; line-height: 1; cursor: pointer;
}
.lightbox-close:hover { background: rgba(255,255,255,.18); }
.lightbox-hint { position: absolute; bottom: 20px; left: 0; right: 0; text-align: center; color: rgba(255,255,255,.6); font-size: 13px; }
body.lightbox-open { overflow: hidden; }
@keyframes lb-fade { from { opacity: 0; } to { opacity: 1; } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; scroll-behavior: auto !important; }
}
