/* ============ 主题变量 ============ */
:root {
  --bg: #f5f7fb;
  --bg-grad: radial-gradient(1200px 600px at 50% -10%, #e6f7f5 0%, rgba(230,247,245,0) 60%),
             radial-gradient(900px 500px at 100% 0%, #eef2ff 0%, rgba(238,242,255,0) 55%);
  --surface: #ffffff;
  --surface-2: #f3f6fa;
  --surface-3: #eef2f7;
  --border: #e5eaf1;
  --border-strong: #d6dee9;
  --text: #0f172a;
  --muted: #64748b;
  --muted-2: #94a3b8;
  --brand: #0d9488;
  --brand-2: #14b8a6;
  --brand-soft: #d7f5f1;
  --brand-ring: rgba(13, 148, 136, .18);
  --danger: #ef4444;
  --warn: #f59e0b;
  --good: #22c55e;
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, .05);
  --shadow: 0 4px 16px -4px rgba(15, 23, 42, .10), 0 1px 3px rgba(15, 23, 42, .05);
  --shadow-lg: 0 24px 60px -24px rgba(15, 23, 42, .25);
  --radius: 18px;
}
html[data-theme="dark"] {
  --bg: #080d17;
  --bg-grad: radial-gradient(1200px 600px at 50% -10%, #0e2b2c 0%, rgba(14,43,44,0) 60%),
             radial-gradient(900px 500px at 100% 0%, #16204a 0%, rgba(22,32,74,0) 55%);
  --surface: #101826;
  --surface-2: #16202f;
  --surface-3: #1b2637;
  --border: #22304a;
  --border-strong: #2e3f5c;
  --text: #e9eefb;
  --muted: #93a3bd;
  --muted-2: #6b7c99;
  --brand: #2dd4bf;
  --brand-2: #5eead4;
  --brand-soft: #10312f;
  --brand-ring: rgba(45, 212, 191, .20);
  --shadow-sm: 0 1px 2px rgba(0,0,0,.4);
  --shadow: 0 6px 20px -6px rgba(0,0,0,.6);
  --shadow-lg: 0 30px 70px -30px rgba(0,0,0,.8);
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans SC", sans-serif;
  background: var(--bg);
  background-image: var(--bg-grad);
  background-attachment: fixed;
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  line-height: 1.6;
  font-size: 15px;
}
h1, h2, h3 { margin: 0; line-height: 1.28; letter-spacing: -.02em; }
p { margin: 0; }
button { font: inherit; color: inherit; }
.hidden { display: none !important; }
.wrap { width: 100%; max-width: 1160px; margin: 0 auto; padding: 0 20px; }
kbd {
  font-family: ui-monospace, monospace; font-size: 11px; padding: 1px 5px;
  border: 1px solid var(--border-strong); border-bottom-width: 2px; border-radius: 5px;
  background: var(--surface-2); color: var(--muted);
}

/* ============ 头部 ============ */
.site-header {
  position: sticky; top: 0; z-index: 40;
  backdrop-filter: saturate(180%) blur(14px);
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  border-bottom: 1px solid var(--border);
}
.header-inner { display: flex; align-items: center; justify-content: space-between; height: 62px; }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--text); }
.brand-mark {
  width: 36px; height: 36px; border-radius: 11px; display: grid; place-items: center;
  background: linear-gradient(140deg, var(--brand), #0e7490); color: #fff;
  box-shadow: 0 6px 16px -6px var(--brand);
}
.brand-mark svg { width: 21px; height: 21px; }
.brand-text { display: flex; flex-direction: column; line-height: 1.15; }
.brand-text strong { font-size: 15.5px; letter-spacing: -.02em; }
.brand-text em { font-style: normal; font-size: 11.5px; color: var(--muted); }
.header-actions { display: flex; gap: 8px; }
.icon-btn {
  width: 38px; height: 38px; border-radius: 11px; display: grid; place-items: center;
  background: var(--surface); border: 1px solid var(--border); cursor: pointer;
  transition: .16s ease;
}
.icon-btn:hover { border-color: var(--border-strong); background: var(--surface-2); }
.icon-btn svg { width: 18px; height: 18px; }
#btnTheme .ico-moon { display: none; }
html[data-theme="dark"] #btnTheme .ico-sun { display: none; }
html[data-theme="dark"] #btnTheme .ico-moon { display: block; }

/* ============ 通用 ============ */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.btn {
  display: inline-flex; align-items: center; gap: 7px; justify-content: center;
  padding: 10px 18px; border-radius: 12px; border: 1px solid transparent;
  font-weight: 600; font-size: 14px; cursor: pointer; transition: .16s ease;
  white-space: nowrap;
}
.btn svg { width: 17px; height: 17px; }
.btn-primary { background: var(--brand); color: #fff; box-shadow: 0 8px 18px -8px var(--brand); }
.btn-primary:hover { filter: brightness(1.07); transform: translateY(-1px); }
.btn-ghost { background: var(--surface); color: var(--text); border-color: var(--border); }
.btn-ghost:hover { background: var(--surface-2); border-color: var(--border-strong); }
.btn:active { transform: translateY(0); }

.view { padding: 40px 0 70px; animation: fadeUp .45s ease both; }
@keyframes fadeUp { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

/* ============ Hero ============ */
.hero { text-align: center; max-width: 720px; margin: 0 auto 30px; }
.pill {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 5px 13px; border-radius: 999px; font-size: 12.5px; font-weight: 500;
  background: var(--brand-soft); color: #0f766e; border: 1px solid color-mix(in srgb, var(--brand) 22%, transparent);
}
html[data-theme="dark"] .pill { color: var(--brand-2); }
.pill .dot { width: 6px; height: 6px; border-radius: 50%; background: var(--brand); box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 22%, transparent); }
.hero h1 { font-size: clamp(30px, 5.4vw, 48px); font-weight: 800; margin: 18px 0 14px; letter-spacing: -.035em; }
.hero h1 em {
  font-style: normal;
  background: linear-gradient(100deg, var(--brand), #6366f1 70%);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.hero-sub { color: var(--muted); font-size: 15.5px; }
.hero-sub b { color: var(--text); }

/* ============ 上传 ============ */
.upload-card { padding: 22px; }
.dropzone {
  border: 2px dashed var(--border-strong); border-radius: 16px;
  background: var(--surface-2);
  padding: 46px 24px 34px; text-align: center; cursor: pointer;
  transition: .18s ease; outline: none;
}
.dropzone:hover, .dropzone:focus-visible { border-color: var(--brand); background: color-mix(in srgb, var(--brand-soft) 45%, var(--surface-2)); }
.dropzone.dragover { border-color: var(--brand); background: var(--brand-soft); transform: scale(1.005); }
.dz-icon {
  width: 62px; height: 62px; margin: 0 auto 16px; border-radius: 18px; display: grid; place-items: center;
  background: var(--surface); border: 1px solid var(--border); color: var(--brand); box-shadow: var(--shadow-sm);
}
.dz-icon svg { width: 26px; height: 26px; }
.dropzone h2 { font-size: 18px; font-weight: 700; }
.dropzone > p { color: var(--muted); font-size: 13.5px; margin-top: 7px; }
.dz-btns { display: flex; gap: 10px; justify-content: center; margin-top: 20px; flex-wrap: wrap; }
.dz-hint { font-size: 12.5px !important; color: var(--muted-2) !important; margin-top: 16px !important; }

.samples {
  display: flex; align-items: center; gap: 8px; justify-content: center;
  flex-wrap: wrap; margin-top: 18px; padding-top: 18px; border-top: 1px solid var(--border);
}
.samples-label { font-size: 13px; color: var(--muted); }
.chip {
  padding: 6px 13px; border-radius: 999px; font-size: 13px; cursor: pointer;
  background: var(--surface); border: 1px solid var(--border); transition: .16s ease;
}
.chip:hover { border-color: var(--brand); color: var(--brand); background: var(--brand-soft); }

/* ============ 特性 ============ */
.features { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-top: 26px; }
.feature {
  background: var(--surface); border: 1px solid var(--border); border-radius: 15px;
  padding: 18px; box-shadow: var(--shadow-sm);
}
.f-ico { width: 38px; height: 38px; border-radius: 11px; display: grid; place-items: center; margin-bottom: 12px; }
.f-ico svg { width: 19px; height: 19px; }
.f1 { background: #dcfce7; color: #15803d; }
.f2 { background: #dbeafe; color: #1d4ed8; }
.f3 { background: #fef3c7; color: #b45309; }
.f4 { background: #ede9fe; color: #6d28d9; }
.feature h3 { font-size: 14.5px; font-weight: 700; }
.feature p { font-size: 13px; color: var(--muted); margin-top: 5px; }

/* ============ 分析中 ============ */
.loading-card { max-width: 520px; margin: 0 auto; padding: 32px; text-align: center; }
.scan-wrap { display: flex; justify-content: center; }
.scan-frame {
  position: relative; width: 190px; height: 190px; border-radius: 50%; overflow: hidden;
  border: 3px solid var(--brand-soft); box-shadow: 0 0 0 6px color-mix(in srgb, var(--brand) 8%, transparent);
}
.scan-frame img { width: 100%; height: 100%; object-fit: cover; display: block; }
.scan-line {
  position: absolute; left: 0; right: 0; height: 42%;
  background: linear-gradient(to bottom, transparent, color-mix(in srgb, var(--brand) 45%, transparent), transparent);
  animation: scan 1.5s ease-in-out infinite;
}
@keyframes scan { 0% { top: -45%; } 100% { top: 105%; } }
.scan-grid {
  position: absolute; inset: 0;
  background-image: linear-gradient(rgba(255,255,255,.18) 1px, transparent 1px),
                    linear-gradient(90deg, rgba(255,255,255,.18) 1px, transparent 1px);
  background-size: 22px 22px;
}
.loading-title { font-size: 19px; font-weight: 700; margin: 22px 0 16px; }
.progress { height: 6px; border-radius: 999px; background: var(--surface-3); overflow: hidden; }
.progress-bar { height: 100%; width: 0%; border-radius: 999px; background: linear-gradient(90deg, var(--brand), #6366f1); transition: width .35s ease; }
.steps { list-style: none; margin: 20px 0 0; padding: 0; text-align: left; display: grid; gap: 9px; }
.steps li {
  display: flex; align-items: center; gap: 9px; font-size: 13.5px; color: var(--muted-2);
  padding: 7px 12px; border-radius: 10px; transition: .2s ease;
}
.steps li::before {
  content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--border-strong); flex: none;
}
.steps li.active { color: var(--text); background: var(--surface-2); }
.steps li.active::before { background: var(--brand); box-shadow: 0 0 0 4px color-mix(in srgb, var(--brand) 18%, transparent); }
.steps li.done { color: var(--muted); }
.steps li.done::before { background: var(--good); }

/* ============ 结果 ============ */
.result-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 18px; }
.rh-title { font-size: 26px; font-weight: 800; letter-spacing: -.03em; }
.rh-sub { color: var(--muted); font-size: 13.5px; margin-top: 4px; }
.rh-actions { display: flex; gap: 10px; }

.notice {
  padding: 12px 16px; border-radius: 13px; font-size: 13.5px; margin-bottom: 16px;
  background: #fff7ed; border: 1px solid #fed7aa; color: #9a3412;
}
html[data-theme="dark"] .notice { background: #2a1a08; border-color: #7c2d12; color: #fdba74; }

.result-grid { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: 18px; align-items: start; }

.image-card { padding: 16px; overflow: hidden; }
.img-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.seg { display: inline-flex; padding: 3px; gap: 2px; background: var(--surface-2); border: 1px solid var(--border); border-radius: 11px; }
.seg-btn {
  padding: 6px 14px; border: 0; background: transparent; border-radius: 8px;
  font-size: 13px; font-weight: 600; color: var(--muted); cursor: pointer; transition: .15s ease;
}
.seg-btn.active { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm); }
.switch { display: inline-flex; align-items: center; gap: 7px; font-size: 13px; color: var(--muted); cursor: pointer; user-select: none; }
.switch input { accent-color: var(--brand); width: 15px; height: 15px; }

.canvas-wrap {
  width: 100%; border-radius: 13px; overflow: hidden; background: var(--surface-3);
  display: flex; align-items: center; justify-content: center; min-height: 200px;
}
.canvas-wrap canvas { display: block; max-width: 100%; touch-action: none; user-select: none; -webkit-user-select: none; }
.legend { display: flex; flex-wrap: wrap; gap: 8px 14px; margin-top: 14px; }
.legend-item { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--muted); }
.legend-swatch { width: 11px; height: 11px; border-radius: 3px; flex: none; }

/* ---- 标注编辑 ---- */
.edit-bar { margin-top: 14px; padding: 14px; border-top: 1px solid var(--border); background: var(--surface-2); border-radius: 13px; }
.edit-toolbar { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; justify-content: space-between; }
.edit-toolbar .edit-title { font-size: 13.5px; font-weight: 700; color: var(--text); }
.edit-btns { display: inline-flex; gap: 7px; flex-wrap: wrap; }
.tbtn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 7px 13px; border-radius: 10px; font-size: 12.5px; font-weight: 600;
  background: var(--surface); border: 1px solid var(--border); color: var(--text);
  cursor: pointer; transition: .16s ease; box-shadow: var(--shadow-sm);
}
.tbtn svg { width: 15px; height: 15px; }
.tbtn:hover:not(:disabled) { border-color: var(--brand); color: var(--brand); transform: translateY(-1px); }
.tbtn:active:not(:disabled) { transform: translateY(0); }
.tbtn:disabled { opacity: .45; cursor: not-allowed; box-shadow: none; }
.tbtn[aria-pressed="true"] {
  background: linear-gradient(135deg, var(--brand), var(--brand-2));
  border-color: transparent; color: #fff; box-shadow: 0 4px 14px -4px var(--brand);
}
.dirty-chip {
  font-size: 11.5px; font-weight: 700; padding: 4px 10px; border-radius: 999px;
  background: #fef3c7; color: #b45309; border: 1px solid #fde68a;
}
html[data-theme="dark"] .dirty-chip { background: #2b1f06; color: #fcd34d; border-color: #78350f; }
.edit-tip { font-size: 12px; color: var(--muted-2); margin-top: 10px; }
.edit-tip.active { color: var(--brand); font-weight: 600; }
.edit-tip.active::before { content: "●"; margin-right: 5px; color: var(--brand); }

.edit-panel {
  margin-top: 12px; padding: 14px; border-radius: 13px;
  background: var(--surface); border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
}
.ep-head { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; }
.ep-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--brand); }
.ep-title { font-size: 13.5px; font-weight: 700; color: var(--text); }
.ep-fields { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.ep-field { display: grid; gap: 6px; }
.ep-field > span { font-size: 12px; font-weight: 600; color: var(--muted); }
.ep-field b { color: var(--text); font-variant-numeric: tabular-nums; }
.ep-field select {
  padding: 9px 11px; border-radius: 10px; border: 1px solid var(--border);
  background: var(--surface-2); color: var(--text); font-size: 14px; outline: none; width: 100%;
  cursor: pointer;
}
.ep-field select:focus { border-color: var(--brand); background: var(--surface); }
.ep-field input[type="range"] { width: 100%; accent-color: var(--brand); }
.ep-actions { display: flex; align-items: center; gap: 10px; margin-top: 14px; flex-wrap: wrap; }
.ep-hint { font-size: 11.5px; color: var(--muted-2); flex: 1; min-width: 180px; }
.btn-sm { padding: 7px 14px; font-size: 13px; }
.canvas-wrap.editing { outline: 2px solid var(--brand); outline-offset: 2px; }
.canvas-wrap.editing canvas { cursor: crosshair; }
.canvas-wrap.editing.grabbing canvas { cursor: grabbing; }

/* 添加标注时就地类型选择浮层 */
.add-type-popover {
  position: fixed; z-index: 100;
  background: var(--surface); border: 1px solid var(--border); border-radius: 13px;
  padding: 10px; box-shadow: var(--shadow-lg); min-width: 156px;
  animation: pop .18s ease both;
}
.atp-title { font-size: 12px; font-weight: 700; color: var(--muted); margin-bottom: 8px; }
.atp-list { display: grid; gap: 4px; }
.atp-item {
  display: flex; align-items: center; gap: 8px;
  padding: 7px 9px; border-radius: 8px; border: 1px solid transparent;
  background: transparent; color: var(--text); font-size: 13px; font-weight: 600;
  cursor: pointer; transition: .14s ease; width: 100%; text-align: left;
}
.atp-item:hover { background: var(--surface-2); border-color: var(--border); }
.atp-item:active { transform: scale(.98); }
.atp-dot { width: 9px; height: 9px; border-radius: 50%; flex: none; }

/* 标注清单（始终可见的可点击列表，画布点选之外的可靠选择入口） */
.box-list-panel {
  margin-top: 12px; padding: 12px 13px; border-radius: 13px;
  background: var(--surface-2); border: 1px solid var(--border);
}
.blp-head { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; }
.blp-title { font-size: 13px; font-weight: 700; color: var(--text); }
.blp-count {
  font-size: 11.5px; font-weight: 700; min-width: 22px; height: 20px; padding: 0 7px;
  display: inline-flex; align-items: center; justify-content: center; border-radius: 999px;
  background: var(--brand); color: #fff;
}
.blp-hint { font-size: 11px; color: var(--muted-2); margin-left: auto; }
.blp-body {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 7px; max-height: 184px; overflow-y: auto; padding-right: 2px;
}
.bl-item {
  display: flex; align-items: center; gap: 7px; width: 100%;
  padding: 7px 9px; border-radius: 9px; cursor: pointer; text-align: left;
  background: var(--surface); border: 1px solid var(--border); color: var(--text);
  font: inherit; transition: .14s ease;
}
.bl-item:hover { border-color: var(--brand); transform: translateY(-1px); }
.bl-item.sel { border-color: var(--brand); background: color-mix(in srgb, var(--brand) 12%, var(--surface)); box-shadow: 0 0 0 2px color-mix(in srgb, var(--brand) 30%, transparent); }
.bl-dot { width: 9px; height: 9px; border-radius: 50%; flex: none; }
.bl-label { font-size: 12.5px; font-weight: 600; flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bl-region { font-size: 11px; color: var(--muted-2); white-space: nowrap; max-width: 56px; overflow: hidden; text-overflow: ellipsis; }
.bl-sev { font-size: 12px; font-weight: 700; font-variant-numeric: tabular-nums; }
.bl-sev em { font-style: normal; font-size: 9.5px; opacity: .8; margin-left: 1px; }
.bl-item.manual .bl-dot { box-shadow: 0 0 0 2px color-mix(in srgb, var(--brand) 35%, transparent); }

@media (max-width: 560px) {
  .edit-toolbar { align-items: stretch; flex-direction: column; }
  .edit-btns { justify-content: stretch; }
  .tbtn { flex: 1; justify-content: center; }
  .ep-fields { grid-template-columns: 1fr; }
  .ep-actions { flex-direction: column; align-items: stretch; }
  .ep-hint { text-align: center; }
}

.score-card { padding: 22px; }
.score-top { display: flex; gap: 20px; align-items: center; }
.score-edit-form { display: grid; gap: 12px; margin-bottom: 18px; }
.se-field { display: grid; gap: 6px; }
.se-field span { font-size: 12px; font-weight: 600; color: var(--muted); }
.se-field input[type="number"], .se-field textarea {
  padding: 9px 11px; border-radius: 10px; border: 1px solid var(--border);
  background: var(--surface-2); color: var(--text); font-size: 14px; font-family: inherit; outline: none; width: 100%;
}
.se-field input[type="number"]:focus, .se-field textarea:focus { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-ring); }
.se-field textarea { resize: vertical; }
.ring { position: relative; width: 132px; height: 132px; flex: none; }
.ring svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.ring-bg { fill: none; stroke: var(--surface-3); stroke-width: 11; }
.ring-fg {
  fill: none; stroke: var(--brand); stroke-width: 11; stroke-linecap: round;
  stroke-dasharray: 326.7; stroke-dashoffset: 326.7;
  transition: stroke-dashoffset 1s cubic-bezier(.22,1,.36,1), stroke .4s ease;
}
.ring-center { position: absolute; inset: 0; display: grid; place-content: center; text-align: center; }
.ring-center strong { display: block; font-size: 34px; font-weight: 800; letter-spacing: -.04em; line-height: 1; }
.ring-center span { font-size: 11.5px; color: var(--muted); }
.score-meta { min-width: 0; }
.level-chip {
  display: inline-block; padding: 4px 11px; border-radius: 999px; font-size: 12.5px; font-weight: 700;
  background: var(--brand-soft); color: #0f766e;
}
html[data-theme="dark"] .level-chip { color: var(--brand-2); }
.score-meta p { font-size: 13.5px; color: var(--muted); margin-top: 9px; }

.metrics { margin-top: 22px; display: grid; gap: 14px; }
.metric-row { display: grid; grid-template-columns: 1fr auto; gap: 4px 10px; align-items: center; }
.metric-row.editing { grid-template-columns: 1fr auto; gap: 8px 10px; padding: 10px; border-radius: 11px; background: var(--surface-2); border: 1px solid var(--border); }
.metric-name { font-size: 13.5px; font-weight: 600; display: flex; align-items: center; gap: 7px; }
.metric-name i { width: 8px; height: 8px; border-radius: 50%; flex: none; }
.metric-val { font-size: 12.5px; color: var(--muted); font-variant-numeric: tabular-nums; }
.metric-num {
  width: 64px; padding: 5px 8px; border-radius: 8px; border: 1px solid var(--border);
  background: var(--surface); color: var(--text); font-size: 13px; font-weight: 700; text-align: center; outline: none;
}
.metric-num:focus { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-ring); }
.metric-range { grid-column: 1 / -1; width: 100%; accent-color: var(--brand); }
.metric-bar { grid-column: 1 / -1; height: 7px; border-radius: 999px; background: var(--surface-3); overflow: hidden; }
.metric-bar span { display: block; height: 100%; width: 0; border-radius: 999px; transition: width .9s cubic-bezier(.22,1,.36,1); }

.card-head { margin-bottom: 16px; }
.card-head h2 { font-size: 17px; font-weight: 700; display: flex; align-items: center; gap: 9px; }
.count-badge {
  font-size: 12px; font-weight: 700; padding: 2px 9px; border-radius: 999px;
  background: var(--brand-soft); color: #0f766e;
}
html[data-theme="dark"] .count-badge { color: var(--brand-2); }
.card-sub { font-size: 13px; color: var(--muted); margin-top: 5px; }

.issues-card { padding: 22px; margin-top: 18px; }
.issue-list { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
.issue {
  display: flex; gap: 13px; padding: 15px; border-radius: 14px;
  border: 1px solid var(--border); background: var(--surface-2);
}
.issue-ico { width: 38px; height: 38px; border-radius: 11px; display: grid; place-items: center; flex: none; font-size: 13px; font-weight: 800; color: #fff; }
.issue-body { min-width: 0; }
.issue-title { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.issue-title h3 { font-size: 14.5px; font-weight: 700; }
.sev-chip { font-size: 11.5px; font-weight: 700; padding: 2px 8px; border-radius: 6px; }
.sev-1 { background: #dcfce7; color: #15803d; }
.sev-2 { background: #fef3c7; color: #b45309; }
.sev-3 { background: #fee2e2; color: #b91c1c; }
html[data-theme="dark"] .sev-1 { background: #0d2a17; color: #6ee7a8; }
html[data-theme="dark"] .sev-2 { background: #2b1f06; color: #fcd34d; }
html[data-theme="dark"] .sev-3 { background: #2c0f0f; color: #fca5a5; }
.issue-desc { font-size: 12.8px; color: var(--muted); margin-top: 5px; }
.issue-loc { font-size: 12.5px; margin-top: 7px; display: flex; gap: 6px; flex-wrap: wrap; }
.loc-tag { padding: 2px 8px; border-radius: 6px; background: var(--surface); border: 1px solid var(--border); font-size: 11.5px; color: var(--muted); }

.advice-card { padding: 22px; margin-top: 18px; }
.advice-list { margin: 0; padding-left: 0; list-style: none; counter-reset: a; display: grid; gap: 10px; }
.advice-list li {
  counter-increment: a; display: flex; gap: 12px; align-items: flex-start;
  padding: 13px 15px; border-radius: 13px; background: var(--surface-2); border: 1px solid var(--border);
  font-size: 13.5px;
}
.advice-list li::before {
  content: counter(a); flex: none; width: 22px; height: 22px; border-radius: 50%;
  background: var(--brand); color: #fff; font-size: 12px; font-weight: 700;
  display: grid; place-items: center; margin-top: 1px;
}
.advice-list b { display: block; font-size: 13.5px; }

/* ---- 问题与方案手动编辑 ---- */
.inline-edit-bar { margin-bottom: 16px; }
.issues-card.editing, .advice-card.editing, .score-card.editing {
  outline: 2px solid var(--brand); outline-offset: -2px;
}
html[data-theme="dark"] .issues-card.editing,
html[data-theme="dark"] .advice-card.editing,
html[data-theme="dark"] .score-card.editing { outline-color: var(--brand-2); }
.issue-list.editing { grid-template-columns: 1fr; }
.issue.editing { align-items: stretch; }
.iss-row { display: flex; gap: 8px; align-items: center; }
.iss-row .iss-name {
  flex: 1; min-width: 0; padding: 8px 11px; border-radius: 10px; border: 1px solid var(--border);
  background: var(--surface); color: var(--text); font-size: 14px; font-weight: 600; outline: none;
}
.iss-row .iss-name:focus, .iss-desc:focus, .iss-locs:focus, .plan-title:focus, .plan-text:focus { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-ring); }
.iss-sev-lab { display: flex; align-items: center; gap: 10px; font-size: 12.5px; color: var(--muted); margin: 8px 0; }
.iss-sev-lab input[type="range"] { flex: 1; accent-color: var(--brand); }
.iss-sev-val { font-weight: 700; color: var(--text); font-variant-numeric: tabular-nums; }
.iss-desc, .iss-locs, .plan-text {
  width: 100%; padding: 8px 11px; border-radius: 10px; border: 1px solid var(--border);
  background: var(--surface); color: var(--text); font-size: 13px; font-family: inherit; outline: none; resize: vertical;
}
.iss-desc { margin-bottom: 8px; }
.iss-locs { margin-top: 2px; }
.iss-del {
  flex: none; padding: 7px 12px; border-radius: 9px; font-size: 12.5px; font-weight: 600;
  background: transparent; border: 1px solid var(--danger, #ef4444); color: var(--danger, #ef4444); cursor: pointer;
  transition: .15s ease;
}
.iss-del:hover { background: var(--danger, #ef4444); color: #fff; }
.advice-list.editing { gap: 12px; }
.advice-list.editing li { padding: 12px 14px; }
.plan-edit { display: grid; gap: 8px; width: 100%; }
.plan-title {
  width: 100%; padding: 8px 11px; border-radius: 10px; border: 1px solid var(--border);
  background: var(--surface); font-size: 14px; font-weight: 700; outline: none;
}
.plan-text { min-height: 52px; }
.plan-edit .iss-del { justify-self: start; }

.disclaimer { font-size: 12.5px; color: var(--muted); margin-top: 20px; line-height: 1.7; }
.disclaimer b { color: var(--text); }

/* ============ 弹窗 / 提示 ============ */
.modal { position: fixed; inset: 0; z-index: 90; display: grid; place-items: center; padding: 20px; background: rgba(8, 13, 23, .55); backdrop-filter: blur(4px); }
.modal[hidden] { display: none; }
.modal-card { width: 100%; max-width: 440px; padding: 22px; box-shadow: var(--shadow-lg); animation: pop .2s ease both; }
@keyframes pop { from { opacity: 0; transform: scale(.97) translateY(6px); } to { opacity: 1; transform: none; } }
.modal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.modal-head h2 { font-size: 17px; font-weight: 700; }
.modal-tip { font-size: 13px; color: var(--muted); margin-bottom: 14px; }
.modal-tip b { color: var(--text); }
.cam-stage { position: relative; border-radius: 14px; overflow: hidden; background: #000; aspect-ratio: 3 / 4; }
.cam-stage video { width: 100%; height: 100%; object-fit: cover; display: block; transform: scaleX(-1); }
.cam-guide {
  position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%);
  width: 58%; height: 68%; border: 2px dashed rgba(255,255,255,.6); border-radius: 50%;
  pointer-events: none;
}
.modal-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 18px; }
.field { display: grid; gap: 5px; margin-bottom: 12px; }
.field label { font-size: 12.5px; font-weight: 600; color: var(--muted); }
.field input {
  padding: 10px 13px; border-radius: 11px; border: 1px solid var(--border);
  background: var(--surface-2); color: var(--text); font-size: 14px; outline: none; width: 100%;
}
.field input:focus { border-color: var(--brand); background: var(--surface); }
.field-hint { font-size: 11.5px; color: var(--muted-2); line-height: 1.5; }
.field-hint code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; background: var(--surface-2); padding: 1px 5px; border-radius: 4px; font-size: 11px; border: 1px solid var(--border); }

.toast {
  position: fixed; left: 50%; bottom: 30px; transform: translateX(-50%);
  background: #0f172a; color: #fff; padding: 11px 20px; border-radius: 12px;
  font-size: 13.5px; z-index: 120; box-shadow: var(--shadow-lg); animation: pop .2s ease both;
}
html[data-theme="dark"] .toast { background: #e9eefb; color: #0f172a; }

.site-footer { border-top: 1px solid var(--border); padding: 20px 0; margin-top: 20px; }
.footer-inner { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; font-size: 12.5px; color: var(--muted-2); }

/* ============ 响应式 ============ */
@media (max-width: 980px) {
  .result-grid { grid-template-columns: 1fr; }
  .features { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 700px) {
  body { font-size: 14.5px; }
  .view { padding: 26px 0 50px; }
  .wrap { padding: 0 14px; }
  .hero h1 { font-size: 28px; }
  .upload-card { padding: 14px; }
  .dropzone { padding: 32px 16px 26px; }
  .features { grid-template-columns: 1fr; }
  .issue-list { grid-template-columns: 1fr; }
  .score-top { flex-direction: column; text-align: center; }
  .score-meta p { text-align: center; }
  .result-head { align-items: stretch; }
  .rh-actions { display: grid; grid-template-columns: 1fr 1fr; }
  .brand-text em { display: none; }
}
