/* ==========================================================================
   基础层：设计令牌、reset 与通用组件。
   视觉语言：现代编辑风——暖纸底、墨色文字、朱柿橙主色、
   语义三色（翠绿/琥珀/绯红），细边框 + 轻投影，数字全部等宽对齐。
   ========================================================================== */
:root {
  /* 「暖纸 + 墨色 + 朱柿橙」编辑风：奶油纸底、近黑暖墨、单一暖调主色 */
  --bg: #faf7f1;
  --panel: #ffffff;
  --panel-soft: #f6f2ea;
  --ink: #201b14;
  --text: #4a443b;
  --muted: #7d7466;
  --faint: #a89e8d;
  --line: #e8e2d6;
  --line-2: #d8d0c0;
  --accent: #d9481f;
  --accent-deep: #b23a17;
  --accent-soft: #fdeee6;
  --accent-mist: #f8ddcd;
  --on-dark-accent: #f4a578;
  --on-dark-dim: #b0a48d;
  --dark-1: #272117;
  --dark-2: #18140d;
  --ok: #2f7d5b;
  --ok-bg: #e7f2ec;
  --warn: #8a5a06;
  --warn-bg: #fbf0cf;
  --bad: #c2364b;
  --bad-bg: #fbe9e7;
  --focus: #ec9468;
  --shadow: 0 1px 2px rgba(32, 27, 20, .05), 0 6px 20px rgba(32, 27, 20, .06);
  --shadow-lift: 0 2px 6px rgba(32, 27, 20, .07), 0 14px 36px rgba(32, 27, 20, .12);
  --r-s: 9px;
  --r-m: 13px;
  --r-l: 17px;
  --font: 'Inter', 'PingFang SC', 'Microsoft YaHei', 'Segoe UI', sans-serif;
  --serif: 'Songti SC', 'STSong', 'SimSun', serif;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--bg);
  font: 14px/1.65 var(--font);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3, h4 { color: var(--ink); margin: 0; line-height: 1.35; letter-spacing: .2px; }
h1 { font-size: 24px; font-weight: 700; }
h2 { font-size: 18px; font-weight: 700; }
h3 { font-size: 15px; font-weight: 650; }
p { margin: 0; }
small { display: inline; }
ul { margin: 0; padding: 0; list-style: none; }
button, input, textarea, select { font: inherit; color: inherit; }
button, a, input, textarea { -webkit-tap-highlight-color: transparent; }
button { cursor: pointer; border: 0; background: none; padding: 0; }
button:disabled { cursor: not-allowed; }
a { color: inherit; text-decoration: none; }
img { display: block; max-width: 100%; }
[hidden] { display: none !important; }

button:focus-visible, a:focus-visible, input:focus-visible, textarea:focus-visible, [tabindex]:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
  border-radius: 6px;
}
::selection { background: #f7d4c4; }

.ico { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.65; stroke-linecap: round; stroke-linejoin: round; flex-shrink: 0; vertical-align: middle; }
.serif { font-family: var(--serif); }
.num { font-variant-numeric: tabular-nums; }
.kicker { display: block; font-size: 10px; letter-spacing: 2.2px; color: var(--accent-deep); font-weight: 700; text-transform: uppercase; }
.muted { color: var(--muted); }
.correct-text { color: var(--ok); font-weight: 600; }
.error-text { color: var(--bad); font-weight: 600; }

/* —— 徽章 pill ————————————————————————————————— */
.pill {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 10px; border-radius: 999px;
  font-size: 11.5px; font-weight: 600; line-height: 1.5;
  background: var(--accent-soft); color: var(--accent-deep);
  border: 1px solid var(--accent-mist);
  white-space: nowrap; vertical-align: middle;
}
.pill i { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.pill.quiet { background: #f3efe6; color: var(--text); border-color: var(--line); }
.pill.mint { background: var(--ok-bg); color: #206248; border-color: #c4e3d2; }
.pill.amber { background: var(--warn-bg); color: var(--warn); border-color: #efd9ac; }
.pill.red { background: var(--bad-bg); color: var(--bad); border-color: #eec3bd; }
.pill.glass { background: rgba(255, 255, 255, .22); color: #ffffff; border-color: rgba(255, 255, 255, .38); backdrop-filter: blur(6px); }
.pill .ico { width: 13px; height: 13px; }

/* —— 按钮 ——————————————————————————————————— */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 10px 20px; border-radius: var(--r-s);
  font-size: 13.5px; font-weight: 650; letter-spacing: .3px;
  border: 1px solid transparent; transition: .16s;
  white-space: nowrap;
}
.btn .ico { width: 16px; height: 16px; }
.btn.primary { background: var(--accent); color: #fff; box-shadow: 0 6px 16px rgba(217, 72, 31, .28); }
.btn.primary:hover:not(:disabled) { background: var(--accent-deep); transform: translateY(-1px); box-shadow: 0 9px 22px rgba(217, 72, 31, .34); }
.btn.secondary { background: var(--panel); color: var(--accent-deep); border-color: var(--line-2); box-shadow: 0 1px 2px rgba(20, 29, 51, .04); }
.btn.secondary:hover:not(:disabled) { border-color: var(--accent); background: var(--accent-soft); }
.btn.text { padding: 6px 10px; color: var(--accent-deep); background: none; font-weight: 600; }
.btn.text:hover { background: var(--accent-soft); }
.btn.choice { background: var(--panel); color: var(--text); border-color: var(--line-2); font-weight: 600; padding: 8px 16px; }
.btn.choice:hover:not(:disabled) { border-color: var(--accent); color: var(--accent-deep); }
.btn.choice.selected { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn:disabled { opacity: .4; box-shadow: none; transform: none; }
.btn.wide { width: 100%; }

/* —— 面板 / 分区头 ————————————————————————— */
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r-l); box-shadow: var(--shadow); padding: 24px 26px; }
.panel-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 16px; }
.panel-head h2 { margin-top: 4px; }
.panel-head > .pill, .panel-head > .btn { margin-top: 6px; flex-shrink: 0; }
.section-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin: 26px 0 14px; }
.section-head h3 { margin-top: 3px; }
.section-head p { color: var(--muted); font-size: 12.5px; margin-top: 3px; }
.section-head > .pill, .section-head > .btn { margin-bottom: 2px; flex-shrink: 0; }
.section-head.spaced { margin-top: 34px; }

/* —— 反馈条 ————————————————————————————————— */
.feedback {
  border-radius: var(--r-s); padding: 10px 14px; font-size: 13px;
  background: var(--panel-soft); border: 1px dashed var(--line-2); color: var(--muted);
  margin: 12px 0;
}
.feedback.success { background: var(--ok-bg); border: 1px solid #c4e3d2; color: #206248; }
.feedback.error { background: var(--bad-bg); border: 1px solid #eec3bd; color: #a52a3e; }

/* —— 完成条件清单（深色卡）———————————————————— */
.checklist { background: linear-gradient(150deg, var(--dark-1), var(--dark-2)); border-radius: var(--r-l); color: #ded5c4; padding: 20px 24px; box-shadow: var(--shadow-lift); }
.checklist header { display: flex; align-items: baseline; gap: 12px; margin-bottom: 12px; }
.checklist .kicker { color: var(--on-dark-accent); }
.checklist h3 { color: #f2ede2; flex: 1; }
.checklist b { font-size: 22px; color: var(--on-dark-accent); font-variant-numeric: tabular-nums; }
.checklist b small { font-size: 12px; color: var(--on-dark-dim); }
.checklist ul { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 8px 22px; }
.checklist li { display: flex; gap: 9px; align-items: flex-start; font-size: 13px; padding: 5px 0; color: #a89d89; transition: .2s; }
.checklist li .ico { width: 16px; height: 16px; margin-top: 3px; color: #566194; }
.checklist li.done { color: #dfe6fa; }
.checklist li.done .ico { color: var(--on-dark-accent); }
.checklist li small { display: block; font-size: 11.5px; color: #93887a; margin-top: 2px; }
.checklist.all-done { background: linear-gradient(150deg, #1d3a63, #16294d); box-shadow: 0 14px 38px rgba(22, 41, 77, .35); }

/* —— 底部操作坞（吸底）—————————————————————— */
.action-dock {
  position: sticky; bottom: 16px; z-index: 30;
  display: flex; align-items: center; justify-content: space-between; gap: 18px;
  margin-top: 26px; padding: 15px 22px;
  background: rgba(255, 255, 255, .95); backdrop-filter: blur(14px);
  border: 1px solid var(--line); border-radius: var(--r-l);
  box-shadow: var(--shadow-lift);
}
.action-dock strong { color: var(--ink); font-size: 15px; }
.action-dock p { color: var(--muted); font-size: 12.5px; margin-top: 3px; }
.dock-buttons { display: flex; gap: 10px; flex-wrap: wrap; justify-content: flex-end; }
.action-dock.column { flex-direction: column; align-items: stretch; }
.action-dock.inner { position: static; }

/* —— 门禁卡 ————————————————————————————————— */
.gate-card {
  display: flex; align-items: center; gap: 20px; flex-wrap: wrap;
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--r-l);
  padding: 30px 28px; box-shadow: var(--shadow);
}
.gate-card > .ico { width: 42px; height: 42px; color: var(--accent); }
.gate-card > div { flex: 1; min-width: 240px; }
.gate-card h2 { margin: 6px 0 6px; }
.gate-card p { color: var(--muted); }

/* —— 评分环 ————————————————————————————————— */
.score-ring { position: relative; width: 76px; height: 76px; border-radius: 50%; display: grid; place-items: center;
  background: conic-gradient(var(--accent) calc(var(--pct)), #efe9dd 0); flex-shrink: 0; }
.score-ring::before { content: ''; position: absolute; inset: 6px; border-radius: 50%; background: var(--panel); }
.score-ring b { position: relative; font-size: 19px; color: var(--ink); font-variant-numeric: tabular-nums; }
.score-ring b small { font-size: 10.5px; color: var(--muted); }
.score-ring span { position: absolute; bottom: 11px; font-size: 8.5px; letter-spacing: 1px; color: var(--accent-deep); }

/* —— 锁定横幅 ———————————————————————————— */
.locked-banner { display: flex; align-items: center; gap: 10px; margin-bottom: 18px; padding: 12px 18px;
  border-radius: var(--r-m); background: var(--accent-soft); border: 1px solid var(--accent-mist);
  color: var(--accent-deep); font-size: 13px; font-weight: 600; }
.locked-banner .ico { color: var(--accent-deep); }
.locked-banner .btn { margin-left: auto; flex-shrink: 0; }

/* —— 空态 ————————————————————————————————— */
.empty-state { border: 1.5px dashed var(--line-2); border-radius: var(--r-m); padding: 18px; text-align: center; color: var(--faint); font-size: 13px; background: var(--panel-soft); }

/* —— 表单 ————————————————————————————————— */
textarea, input[type='number'] { width: 100%; border: 1px solid var(--line-2); border-radius: var(--r-s); padding: 10px 13px;
  background: var(--panel); resize: vertical; transition: .15s; color: var(--ink); }
textarea:focus, input[type='number']:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px #d9481f1f; }
input[type='range'] { width: 100%; accent-color: var(--accent); cursor: pointer; height: 22px; }
.check-row { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border: 1px solid var(--line);
  border-radius: var(--r-m); background: var(--panel-soft); cursor: pointer; transition: .15s; font-size: 13px; }
.check-row:hover { border-color: var(--accent); }
.check-row input { margin-top: 3px; accent-color: var(--accent); width: 15px; height: 15px; flex-shrink: 0; }
.check-row b { display: block; color: var(--ink); }
.check-row small { display: block; color: var(--muted); font-size: 12px; }
.check-row.missing { border-color: #f0b9b2; background: var(--bad-bg); }
.check-row.em { margin-left: auto; font-style: normal; color: var(--bad); font-size: 11.5px; font-weight: 700; white-space: nowrap; }
.check-inline { display: flex; gap: 8px; align-items: center; margin-top: 10px; font-size: 12.5px; color: var(--muted); cursor: pointer; }
.check-inline input { accent-color: var(--accent); width: 14px; height: 14px; }

/* —— Toast / 模态框 ————————————————————————— */
.toast { position: fixed; left: 50%; bottom: 30px; transform: translate(-50%, 16px); z-index: 200;
  max-width: min(560px, 88vw); padding: 11px 22px; border-radius: 999px;
  background: #241f16; color: #e9edfb; font-size: 13.5px; box-shadow: 0 12px 30px rgba(30, 25, 15, .35);
  opacity: 0; pointer-events: none; transition: .25s; }
.toast.on { opacity: 1; transform: translate(-50%, 0); }

dialog#modal { border: 0; border-radius: var(--r-l); padding: 0; width: min(640px, 90vw); max-height: 86vh;
  background: var(--panel); color: var(--text); box-shadow: 0 30px 80px rgba(30, 25, 15, .4); }
dialog#modal::backdrop { background: rgba(15, 22, 46, .5); backdrop-filter: blur(3px); }
dialog#modal > .kicker { padding: 24px 28px 0; }
dialog#modal h2 { padding: 8px 28px 0; font-size: 20px; }
dialog#modal .modal-body { padding: 14px 28px 8px; overflow-y: auto; max-height: 58vh; font-size: 13.5px; }
dialog#modal .modal-body p { margin: 8px 0; }
dialog#modal .modal-actions { display: flex; gap: 10px; justify-content: flex-end; flex-wrap: wrap; padding: 12px 28px 24px; }
.modal-x { position: absolute; top: 14px; right: 14px; width: 34px; height: 34px; display: grid; place-items: center;
  border-radius: 50%; color: var(--muted); background: var(--panel-soft); z-index: 2; }
.modal-x:hover { color: var(--bad); background: var(--bad-bg); }

/* —— 文档预览（模态内） ———————————————————— */
.document-preview { border: 1px solid var(--line); border-radius: var(--r-m); padding: 14px 18px; background: var(--panel-soft); margin-top: 10px; }
.document-preview h3 { margin: 10px 0 4px; font-size: 13.5px; color: var(--accent-deep); }
.document-preview p { font-size: 13px; margin: 4px 0; }
.document-preview small { color: var(--warn); }
.modal-summary { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 12px; }
.modal-summary span { flex: 1; min-width: 130px; background: var(--panel-soft); border: 1px solid var(--line);
  border-radius: var(--r-s); padding: 9px 13px; font-size: 12px; color: var(--muted); }
.modal-summary span > b { display: block; font-size: 15px; color: var(--ink); margin-top: 2px; }
.confirm-lock-art { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 18px 0 6px; }
.confirm-lock-art .ico { width: 44px; height: 44px; color: var(--accent-deep); }
.confirm-lock-art span { font-size: 10.5px; letter-spacing: 2.5px; color: var(--accent-deep); font-weight: 700; }
.confirm-lock-art.success .ico { color: var(--ok); }
.confirm-lock-art.success span { color: var(--ok); }
.confirm-lock-art.danger .ico { color: var(--bad); }
.confirm-lock-art.danger span { color: var(--bad); }

/* —— 拖放通用 ———————————————————————————— */
.drag-ghost { position: fixed; left: 0; top: 0; z-index: 400; pointer-events: none; opacity: .94;
  transform-origin: 0 0; box-shadow: 0 18px 44px rgba(30, 25, 15, .28) !important; }
body.drag-active { user-select: none; }
[data-zone].drag-over { outline: 2.5px dashed var(--accent); outline-offset: 4px; background: var(--accent-soft) !important; }
.drop-caption { display: block; border: 1.5px dashed var(--line-2); border-radius: var(--r-m); padding: 14px;
  text-align: center; color: var(--faint); font-size: 12.5px; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
  html { scroll-behavior: auto; }
}
