/* ============================
   有肉社群 · 和牛雪花等级鉴定
   深炭色高端主题
   ============================ */

/* ============================
   设计系统 Token
   ============================ */
:root {
  --bg:            #0d0a07;
  --bg-surface:    #141009;
  --panel:         rgba(255,253,248,0.045);
  --panel-hover:   rgba(255,253,248,0.075);
  --panel-active:  rgba(255,253,248,0.11);

  --ink:           #fffdf8;
  --ink-2:         rgba(255,253,248,0.72);
  --ink-3:         rgba(255,253,248,0.44);
  --ink-4:         rgba(255,253,248,0.22);

  --line:          rgba(255,253,248,0.09);
  --line-2:        rgba(255,253,248,0.18);

  --accent:        #d4a853;
  --accent-h:      #e5be6b;
  --accent-dim:    rgba(212,168,83,0.15);
  --accent-glow:   0 0 24px rgba(212,168,83,0.22);

  --green:         #39a77e;
  --green-dim:     rgba(57,167,126,0.15);
  --red:           #b9382c;
  --red-dim:       rgba(185,56,44,0.15);

  --fat-color:     rgba(57,167,126,0.85);
  --roi-color:     #d4a853;

  --shadow-sm:     0 4px 16px rgba(0,0,0,0.28);
  --shadow-lg:     0 20px 60px rgba(0,0,0,0.65);

  --r-sm:  8px;
  --r-md:  12px;
  --r-lg:  16px;

  color-scheme: dark;
  font-family: 'Outfit', 'PingFang SC', system-ui, sans-serif;
}

/* Reset */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

/* 高度链路起点：html 占满视口，body 占满 html。
   这个高度链路是实现「内部滚动 (side-panel)」不是「整页滚动」的关键。 */
html {
  min-height: 100%;
  overflow-x: hidden;
}

/* 关键修复：确保 [hidden] 属性的 display:none 不被任何类样式覆盖 */
[hidden] { display: none !important; }

body {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
  background-color: var(--bg);
  background-image:
    radial-gradient(ellipse at 10% 60%, rgba(185,56,44,0.07) 0%, transparent 55%),
    radial-gradient(ellipse at 90% 20%, rgba(212,168,83,0.07) 0%, transparent 55%);
  color: var(--ink);
}

h1,h2,h3 { font-family: 'Noto Serif SC', serif; }
a { color: inherit; text-decoration: none; }

/* ============================
   顶栏
   ============================ */
.topbar {
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 0 28px;
  height: 52px;               /* 固定高度，不随内容变化 */
  background: rgba(10,8,5,0.88);
  backdrop-filter: blur(24px);
  border-bottom: 1px solid rgba(212,168,83,0.15);
  position: sticky;
  top: 0;
  z-index: 200;
}

/* ---- 品牌区整体容器 ---- */
.topbar-brand { flex: 0 0 auto; }

/* 一行锁定布局：有肉标志 + 竖线 + 标题+副标题 */
.brand-lockup {
  display: flex;
  align-items: center;
  gap: 12px;
}

/* 「有肉」汉字大字标志 */
.brand-logo-mark {
  display: flex;
  align-items: center;
  gap: 12px;
}
.brand-cn-main {
  font-family: 'Noto Serif SC', serif;
  font-size: 22px;
  font-weight: 700;
  /* 金色渐变，参考有肉 logo 风格 */
  background: linear-gradient(160deg, #f0d080 0%, #d4a853 45%, #b8892e 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  letter-spacing: 2px;
  line-height: 1;
  filter: drop-shadow(0 1px 4px rgba(212,168,83,0.4));
}
.brand-divider {
  width: 1px;
  height: 28px;
  background: linear-gradient(to bottom, transparent, rgba(212,168,83,0.5) 30%, rgba(212,168,83,0.5) 70%, transparent);
}

/* 右侧文字组：上方大标题，下方小字口号 */
.brand-text-group {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.brand-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--ink);
  display: flex;
  align-items: center;
  gap: 8px;
  line-height: 1;
  letter-spacing: 0.5px;
}
.brand-tagline {
  font-size: 10px;
  color: var(--ink-3);
  letter-spacing: 0.6px;
  line-height: 1;
  font-family: 'Outfit', sans-serif;
}
.version-badge {
  font-family: 'Outfit';
  font-size: 10px;
  font-weight: 500;
  background: var(--accent-dim);
  color: var(--accent);
  border: 1px solid rgba(212,168,83,0.3);
  padding: 1px 6px;
  border-radius: 20px;
}

.topbar-center {
  flex: 1;
  text-align: center;
}
.brand-sub {
  font-family: 'Outfit';
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 2px;
  color: var(--ink-3);
}

.topbar-right { flex: 0 0 auto; }
.upload-button {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--accent);
  color: var(--bg);
  padding: 9px 20px;
  border-radius: 24px;
  font-weight: 700;
  font-size: 14px;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 2px 10px rgba(212,168,83,0.3);
  border: none;
}
.upload-button:hover {
  background: var(--accent-h);
  transform: translateY(-1px);
  box-shadow: 0 4px 18px rgba(212,168,83,0.4);
}
.upload-button input {
  position: absolute;
  opacity: 0;
  width: 1px;
  height: 1px;
  pointer-events: none;
}

/* 天梯榜按钮 */
.nav-btn {
  background: transparent;
  color: var(--ink-2);
  border: 1px solid var(--line);
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}
.nav-btn:hover { background: var(--panel); color: var(--accent); border-color: var(--accent); }

.lb-join-btn {
  background: linear-gradient(to right, rgba(212,168,83,0.1), rgba(212,168,83,0.3)) !important;
  color: var(--accent) !important;
  border: 1px solid rgba(212,168,83,0.5) !important;
  font-weight: 700;
}
.lb-join-btn:not(:disabled) {
  animation: lbJoinPulse 2s infinite;
}
@keyframes lbJoinPulse {
  0% { box-shadow: 0 0 0 0 rgba(212,168,83,0.8); }
  70% { box-shadow: 0 0 0 12px rgba(212,168,83,0); }
  100% { box-shadow: 0 0 0 0 rgba(212,168,83,0); }
}
.lb-join-btn:hover {
  background: var(--accent) !important;
  color: var(--bg) !important;
}
.lb-join-btn:disabled {
  background: var(--panel) !important;
  color: var(--ink-4) !important;
  border-color: var(--line) !important;
  cursor: not-allowed;
  animation: none;
}

.lb-form-panel { background: rgba(20, 16, 9, 0.95); backdrop-filter: blur(16px); border-radius: 12px; border: 1px solid var(--line); }


/* ============================
   主体布局
   ============================ */
/* 参照旧版方案：不强求高度链，canvas-panel/drop-zone 用固定 min-height 保证画布有尺寸 */
.app-shell {
  flex: 0 0 auto;
  min-height: calc(100vh - 52px);
  overflow: visible;
  display: flex;
  flex-direction: column;
}

.tool-grid {
  display: grid;
  grid-template-columns: 1fr 320px;
  gap: 16px;
  padding: 16px;
  width: 100%;
  max-width: 1600px;
  margin: 0 auto;
  align-items: start;   /* grid 行高由最高子项决定，不强制拉伸 */
}

/* canvas-panel：固定最小高度，保证 drop-zone 和 canvas 有实际尺寸 */
.canvas-panel {
  display: flex;
  flex-direction: column;
  gap: 8px;
  overflow: hidden;
  position: relative;
  min-height: calc(100vh - 84px);
}



/* 工具栏：在顶部，工具条内容多时允许横向滚动，不会被裁剪 */
.canvas-toolbar {
  display: flex;
  align-items: center;
  gap: 6px;
  background: rgba(10,8,5,0.88);
  border: 1px solid var(--line-2);
  border-radius: var(--r-sm);
  padding: 6px 10px;
  flex-shrink: 0;
  backdrop-filter: blur(12px);
  overflow-x: auto;
  overflow-y: visible;
  /* 隐藏滚动条但保留滚动能力 */
  scrollbar-width: none;
}
.canvas-toolbar::-webkit-scrollbar { display: none; }

.tb-group { display: flex; gap: 4px; }

.tb-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: var(--panel);
  border: 1px solid var(--line);
  color: var(--ink-2);
  padding: 5px 12px;
  border-radius: 6px;
  font-size: 13px;
  cursor: pointer;
  transition: all 0.18s;
  white-space: nowrap;
}
.tb-btn:hover { background: var(--panel-hover); color: var(--ink); }
.tb-btn.tb-active, .tb-btn.active {
  background: #fffdf8;
  color: #0d0a07;
  border-color: #fffdf8;
  font-weight: 600;
}

.tb-sep {
  width: 1px;
  height: 20px;
  background: var(--line-2);
  flex-shrink: 0;
}

.tb-opacity-group {
  display: flex;
  align-items: center;
  gap: 8px;
}
.tb-label { font-size: 12px; color: var(--ink-3); white-space: nowrap; }

.tb-range {
  -webkit-appearance: none;
  width: 80px;
  height: 4px;
  background: var(--line-2);
  border-radius: 2px;
  outline: none;
  cursor: pointer;
}
.tb-range::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--accent);
  cursor: pointer;
  box-shadow: 0 0 6px rgba(212,168,83,0.5);
}

.tb-shortcut {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  color: var(--ink-3);
  white-space: nowrap;
}
.tb-key {
  background: rgba(255, 253, 248, 0.08);
  border: 1px solid var(--line-2);
  border-radius: 5px;
  padding: 2px 6px;
  font-size: 11px;
  color: var(--ink-2);
  font-weight: 500;
  box-shadow: 0 1px 2px rgba(0,0,0,0.25);
  font-family: system-ui, sans-serif;
}
.tb-dim { color: var(--ink-3); margin-left: 2px; }

/* 等级对比按钮 — 最突出 */
.tb-compare-btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  background: #2a5bd7;
  border: 1px solid rgba(80,130,255,0.5);
  color: #fff;
  padding: 6px 16px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.18s;
  margin-left: auto;
  box-shadow: 0 2px 12px rgba(42,91,215,0.4);
}
.tb-compare-btn:hover {
  background: #3366e8;
  box-shadow: 0 4px 20px rgba(42,91,215,0.6);
  transform: translateY(-1px);
}

/* drop-zone：主视觉容器，给 canvas 和 emptyState 提供定位基准 */
.drop-zone {
  position: relative;
  flex: 1;             /* 在 canvas-panel（flex 列）内撑满剩余高度 */
  min-height: 400px;   /* 保底高度，确保 canvas 有实际尺寸 */
  background: rgba(0,0,0,0.3);
  border-radius: var(--r-lg);
  border: 1.5px dashed rgba(255,253,248,0.15);
  overflow: hidden;
  transition: border-color 0.25s, background 0.25s;
}
.drop-zone.drag-over {
  border-color: var(--accent);
  background: rgba(212,168,83,0.05);
}

/* canvas：绝对定位撑满 drop-zone，JS resizeCanvas() 读取 clientWidth/clientHeight 同步像素分辨率 */
#analysisCanvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  cursor: crosshair;
}



/* ============================
   空白状态
   ============================ */
/* 注意：.empty-state { display: flex } 与浏览器默认 [hidden] { display: none } 优先级相同，
   后来者覆盖前者。已在文件顶部用 [hidden] { display: none !important } 修复。
   此处保留 flex 布局供未被 hidden 时使用。 */
.empty-state {
  position: absolute;
  inset: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow-y: auto;
  /* 确保空白状态不阻挡下方 canvas 的鼠标事件（当它作为 flex 容器时） */
  pointer-events: none;
}
/* 只有在显示状态时，内部内容才响应交互 */
.empty-state:not([hidden]) > * {
  pointer-events: auto;
}

/* 大理石纹路背景 */
.marbling-bg {
  position: absolute;
  inset: 0;
  pointer-events: none;
}
.marbling-svg {
  width: 100%;
  height: 100%;
}
/* 漂浮动画 */
.ml { animation: marblingFloat 12s ease-in-out infinite; }
.ml1 { animation-duration: 14s; animation-delay: 0s; }
.ml2 { animation-duration: 18s; animation-delay: -3s; }
.ml3 { animation-duration: 16s; animation-delay: -6s; }
.ml4 { animation-duration: 20s; animation-delay: -9s; }
.ml5 { animation-duration: 13s; animation-delay: -1s; }
.ml6 { animation-duration: 17s; animation-delay: -4s; }
.ml7 { animation-duration: 15s; animation-delay: -7s; }
.ml8 { animation-duration: 19s; animation-delay: -11s; }
@keyframes marblingFloat {
  0%, 100% { opacity: 0.4; transform: translateY(0); }
  50%       { opacity: 0.9; transform: translateY(-6px); }
}

.empty-content {
  position: relative;
  z-index: 1;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
  padding: 20px;
}

/* 脉冲圆环 */
.pulse-ring {
  position: relative;
  width: 96px;
  height: 96px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.pulse-inner {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 2px solid rgba(212,168,83,0.4);
}
.pulse-wave {
  position: absolute;
  inset: -8px;
  border-radius: 50%;
  border: 1.5px solid rgba(212,168,83,0.25);
  animation: pulseExpand 2.5s ease-out infinite;
}
.pw2 { inset: -18px; animation-delay: 1s; opacity: 0.5; }
@keyframes pulseExpand {
  0%   { transform: scale(0.8); opacity: 0.6; }
  100% { transform: scale(1.4); opacity: 0; }
}
.pulse-icon {
  font-size: 40px;
  filter: drop-shadow(0 2px 8px rgba(0,0,0,0.5));
  animation: iconBob 3s ease-in-out infinite;
}
@keyframes iconBob {
  0%, 100% { transform: translateY(0); }
  50%       { transform: translateY(-4px); }
}

/* 可点击的上传图标 label */
.upload-icon-label {
  cursor: pointer;
  display: block;
  border-radius: 50%;
  transition: transform 0.2s ease, filter 0.2s ease;
}
.upload-icon-label:hover .pulse-ring {
  filter: drop-shadow(0 0 16px rgba(212,168,83,0.5));
}
.upload-icon-label:hover .pulse-icon {
  animation: none;
  transform: scale(1.12) translateY(-3px);
}
.upload-icon-label:hover .pulse-inner {
  border-color: rgba(212,168,83,0.9);
}

/* 右上角上传云朵角标 */
.upload-badge {
  position: absolute;
  top: 2px;
  right: 0;
  width: 26px;
  height: 26px;
  background: var(--accent);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--bg);
  box-shadow: 0 2px 8px rgba(0,0,0,0.4);
  transition: transform 0.2s ease, background 0.2s ease;
}
.upload-icon-label:hover .upload-badge {
  transform: scale(1.15);
  background: var(--accent-h);
}

/* 选区指南面板 */
.roi-guide {
  background: rgba(255,253,248,0.04);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  padding: 14px 18px;
  text-align: left;
  max-width: 440px;
  width: 100%;
}
.roi-guide-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--accent);
  margin-bottom: 10px;
}
.roi-guide ul {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.roi-guide li {
  font-size: 12px;
  color: var(--ink-3);
  line-height: 1.5;
}
.roi-guide li strong { color: var(--ink-2); }



.empty-title {
  font-size: 20px;
  font-weight: 700;
  color: var(--ink);
  font-family: 'Noto Serif SC', serif;
}
.empty-sub {
  font-size: 14px;
  color: var(--ink-3);
}
.empty-sub strong { color: var(--ink-2); }

/* 画布下方的框选指南弹窗 (Draggable Modal) */
.crop-hint-modal {
  position: fixed;
  bottom: 20px; /* 默认在左下角，但不直接遮挡中心 */
  left: 20px;
  background: rgba(10, 8, 5, 0.85);
  backdrop-filter: blur(8px);
  border: 1px solid rgba(255, 253, 248, 0.1);
  box-shadow: 0 8px 30px rgba(0,0,0,0.5);
  border-radius: var(--r-md);
  color: var(--ink-2);
  font-size: 13px;
  line-height: 1.6;
  width: 300px; /* 固定宽度，防止随内容变大 */
  max-width: 90vw;
  z-index: 1000;
  display: flex;
  flex-direction: column;
}
.crop-hint-modal.hidden {
  display: none !important;
}

/* 拖拽头部 */
.crop-hint-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  border-bottom: 1px dashed rgba(212,168,83,0.15);
  cursor: grab;
  user-select: none;
}
.crop-hint-header:active {
  cursor: grabbing;
}
.crop-hint-header .roi-guide-title {
  color: var(--accent);
  font-weight: 700;
  margin: 0;
}
.crop-hint-close {
  background: none;
  border: none;
  color: var(--ink-3);
  font-size: 20px;
  cursor: pointer;
  padding: 0 4px;
  line-height: 1;
}
.crop-hint-close:hover {
  color: #fff;
}

/* 提示内容区 */
.crop-hint-content {
  padding: 16px;
}
.crop-hint-content ul {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 16px; /* 为按钮留白 */
}
.crop-hint-content li {
  display: flex;
  gap: 8px;
  align-items: flex-start;
}
.crop-hint-content li strong {
  color: #fffdf8;
  font-weight: 600;
}

/* 确认按钮 */
.crop-hint-ok {
  width: 100%;
  background: rgba(212,168,83, 0.15);
  border: 1px solid rgba(212,168,83, 0.3);
  color: var(--accent);
  padding: 8px 0;
  border-radius: 4px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  transition: all 0.2s;
}
.crop-hint-ok:hover {
  background: rgba(212,168,83, 0.3);
  color: #fff;
}

/* 帮助唤出小按钮 */
.help-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  font-size: 12px;
  background: rgba(255,255,255,0.1);
  border-radius: 50%;
  margin-left: 4px;
  cursor: pointer;
  transition: transform 0.2s;
}
.help-btn:hover {
  transform: scale(1.1);
  background: rgba(255,255,255,0.2);
}

/* 操作指南 */
.guide-row {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  background: rgba(255,253,248,0.04);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  padding: 16px 20px;
  backdrop-filter: blur(8px);
}
.guide-step {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  text-align: center;
  flex: 1;
  min-width: 0;
}
.gs-circle {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--accent-dim);
  border: 1.5px solid rgba(212,168,83,0.4);
  color: var(--accent);
  font-weight: 700;
  font-size: 13px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.guide-step strong { font-size: 13px; color: var(--ink); }
.guide-step span   { font-size: 11px; color: var(--ink-3); }
.guide-arrow       { color: var(--ink-4); font-size: 18px; padding-top: 4px; flex-shrink: 0; }

/* 左下角：框选指南悬浮窗 */
.crop-hint-corner {
  position: absolute;
  bottom: 20px;
  left: 20px;
  background: rgba(10, 8, 5, 0.85);
  backdrop-filter: blur(8px);
  border: 1px solid rgba(255, 253, 248, 0.1);
  box-shadow: 0 8px 30px rgba(0,0,0,0.5);
  border-radius: var(--r-md);
  padding: 20px;
  z-index: 100;
  pointer-events: none; /* 让鼠标事件穿透，不影响框选拖拽 */
  animation: cornerSlideIn 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
  max-width: 320px;
}
.crop-hint-corner.hidden {
  display: none !important;
}
@keyframes cornerSlideIn {
  from { opacity: 0; transform: translate(-20px, 20px); }
  to   { opacity: 1; transform: translate(0, 0); }
}

/* 复用 roi-guide 的样式结构 */
.crop-hint-corner .roi-guide-title {
  color: var(--accent);
  font-weight: 700;
  font-size: 15px;
  margin-bottom: 12px;
}
.crop-hint-corner ul {
  list-style: none;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.crop-hint-corner li {
  color: var(--ink-3);
  font-size: 12px;
  line-height: 1.4;
  display: flex;
  align-items: flex-start;
}
.crop-hint-corner li strong {
  color: var(--ink-2);
}



/* 画布底部操作栏 */
.canvas-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
  padding: 6px 10px;
  background: rgba(10,8,5,0.7);
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  backdrop-filter: blur(10px);
  overflow-x: auto;
  scrollbar-width: none;
}
.canvas-actions::-webkit-scrollbar { display: none; }

.ca-btn {
  background: var(--panel);
  border: 1px solid var(--line);
  color: var(--ink-2);
  padding: 7px 14px;
  border-radius: var(--r-sm);
  font-size: 13px;
  cursor: pointer;
  transition: all 0.18s;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  white-space: nowrap;
}
.ca-btn:hover { background: var(--panel-hover); color: var(--ink); }
.ca-btn.ca-icon { padding: 7px 10px; }
.ca-btn:disabled { opacity: 0.35; cursor: not-allowed; }
.ca-btn.ca-danger { color: #ff7070; border-color: rgba(255,112,112,0.25); }
.ca-btn.ca-danger:hover { background: rgba(255,112,112,0.1); }
.ca-zoom { margin-left: 4px; font-size: 13px; color: var(--ink-3); font-family: 'Outfit'; }

/* ============================
   右侧边栏
   ============================ */
/* side-panel：
   在 grid 单元格内自动占满高度（grid 默认 align-items: stretch）。
   min-height: 0 是让 overflow-y: auto 生效的必要条件。
   不需要 height: 100%，grid 单元格的拉伸已经提供了高度约束。 */
.side-panel {
  display: flex;
  flex-direction: column;
  gap: 14px;
  overflow-y: auto;
  padding-right: 4px;
  max-height: calc(100vh - 84px);
  position: sticky;
  top: 68px;
}


.side-panel::-webkit-scrollbar { width: 4px; }
.side-panel::-webkit-scrollbar-track { background: transparent; }
.side-panel::-webkit-scrollbar-thumb { background: var(--line-2); border-radius: 2px; }

/* ============================
   步骤追踪器：置顶显示，不随右侧栏滚动而消失
   ============================ */
.step-track {
  display: flex;
  align-items: center;
  padding: 12px 16px;
  /* sticky 在 .side-panel（overflow-y: auto）内生效，始终生华在滚动内容之上 */
  position: sticky;
  top: 0;
  z-index: 50;
  /* 磨砂背景，确保内容从后面滚过时不透明 */
  background: rgba(13,10,7,0.96);
  backdrop-filter: blur(16px);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  /* 确保贴顶时边距不影响布局 */
  margin-bottom: 0;
}
.step-node {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  flex: 1;
  transition: all 0.3s;
}
.sn-circle {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--panel-active);
  border: 2px solid var(--line-2);
  color: var(--ink-3);
  font-weight: 700;
  font-size: 13px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s;
}
.sn-label {
  font-size: 10px;
  color: var(--ink-4);
  text-align: center;
  transition: all 0.3s;
}
.step-line {
  height: 2px;
  flex: 0.5;
  background: var(--line);
  border-radius: 1px;
  margin-bottom: 16px;
}

/* 步骤状态 */
.step-node.active .sn-circle {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--bg);
  /* 持续脉冲：光晕扩散 + 圆圈轻微缩放 */
  animation: stepPulse 1.4s ease-in-out infinite;
}
.step-node.active .sn-label {
  color: var(--accent);
  font-weight: 700;
  /* 标签同步闪动 */
  animation: stepLabelBlink 1.4s ease-in-out infinite;
}

/* 步骤刚切换进来时，触发强烈的入场闪光（持续时长由JS的setTimeout控制） */
.step-node.active.step-enter-flash .sn-circle {
  animation: stepEnterFlash 0.7s cubic-bezier(0.25, 0.46, 0.45, 0.94) infinite;
}

/* 持续脉冲：光晕从 0 扩散到 18px，圆圈微微弹动 */
@keyframes stepPulse {
  0%   { box-shadow: 0 0 0 0 rgba(212,168,83,0.75);  transform: scale(1);    }
  40%  { box-shadow: 0 0 0 10px rgba(212,168,83,0.3); transform: scale(1.08); }
  70%  { box-shadow: 0 0 0 18px rgba(212,168,83,0);   transform: scale(0.97); }
  100% { box-shadow: 0 0 0 0 rgba(212,168,83,0);      transform: scale(1);    }
}

/* 入场强烈一闪：光晕快速扩散到 28px，然后切回持续脉冲 */
@keyframes stepEnterFlash {
  0%   { box-shadow: 0 0 0 0 rgba(212,168,83,1);    transform: scale(1.25); }
  35%  { box-shadow: 0 0 0 20px rgba(212,168,83,0.5); transform: scale(0.92); }
  65%  { box-shadow: 0 0 0 28px rgba(212,168,83,0.2); transform: scale(1.05); }
  100% { box-shadow: 0 0 0 0 rgba(212,168,83,0);    transform: scale(1);    }
}

/* 标签同步闪烁 */
@keyframes stepLabelBlink {
  0%, 100% { opacity: 1;    color: var(--accent); }
  50%       { opacity: 0.65; color: var(--accent-h); }
}

.step-node.completed .sn-circle {
  background: var(--green);
  border-color: var(--green);
  color: #fff;
}
.step-node.completed .sn-circle span {
  font-size: 0;
}
.step-node.completed .sn-circle span::before {
  content: '\2713';  /* ✓ 标准完成对勾 */
  font-size: 16px;
}
.step-node.completed .sn-label { color: var(--green); }

/* guide-done：最终完成状态，绝对绿色 + 对勾动画 */
.step-node.guide-done .sn-circle {
  background: var(--green);
  border-color: var(--green);
  color: #fff;
  box-shadow: 0 0 0 0 rgba(57,167,126,0);
  animation: guideDonePulse 0.6s ease-out 1;
}
.step-node.guide-done .sn-circle span {
  font-size: 0;
}
.step-node.guide-done .sn-circle span::before {
  content: '\2713';  /* ✓ */
  font-size: 16px;
}
.step-node.guide-done .sn-label {
  color: var(--green);
  font-weight: 700;
}
@keyframes guideDonePulse {
  0%   { box-shadow: 0 0 0 0 rgba(57,167,126,0.6); }
  60%  { box-shadow: 0 0 0 10px rgba(57,167,126,0); }
  100% { box-shadow: 0 0 0 0 rgba(57,167,126,0); }
}

@keyframes stepPulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(212,168,83,0.5); }
  50%       { box-shadow: 0 0 0 8px rgba(212,168,83,0); }
}

/* ============================
   卡片面板
   ============================ */
.panel-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: 18px;
  scroll-margin-top: 84px; /* 防止滚动时被置顶的步骤条遮挡 */
  transition: border-color 0.2s, transform 0.2s;
  animation: cardSlideIn 0.4s ease both;
}
.panel-card:hover { border-color: var(--line-2); }

@keyframes cardSlideIn {
  from { opacity: 0; transform: translateX(12px); }
  to   { opacity: 1; transform: translateX(0); }
}

.panel-label {
  font-family: 'Noto Serif SC', serif;
  font-size: 14px;
  font-weight: 600;
  color: var(--ink);
  margin-bottom: 14px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.panel-label::before {
  content: '';
  width: 3px;
  height: 14px;
  background: var(--accent);
  border-radius: 2px;
  flex-shrink: 0;
}
.panel-num {
  font-family: 'Outfit';
  font-size: 12px;
  background: var(--accent-dim);
  color: var(--accent);
  width: 20px;
  height: 20px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
}
.panel-sub {
  font-family: 'Outfit';
  font-size: 11px;
  color: var(--ink-4);
  font-weight: 400;
  margin-left: auto;
}

/* ============================
   结果面板
   ============================ */
.result-card {
  background: linear-gradient(135deg, rgba(20,14,8,0.9), rgba(14,10,6,0.9));
  border-color: rgba(212,168,83,0.2);
  transition: opacity 0.4s, border-color 0.3s;
}

.result-big {
  display: flex;
  align-items: baseline;
  gap: 4px;
  padding: 12px 0 4px;
}
.result-pct {
  font-family: 'Outfit';
  font-size: 56px;
  font-weight: 800;
  color: var(--accent);
  line-height: 1;
  transition: color 0.5s;
}
.result-pct-unit {
  font-family: 'Outfit';
  font-size: 24px;
  font-weight: 700;
  color: var(--accent);
}
.result-caption {
  font-size: 12px;
  color: var(--ink-3);
  margin-bottom: 14px;
}

.metric-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 0;
  border-bottom: 1px solid var(--line);
  font-size: 13px;
}
.metric-row:last-of-type { border-bottom: none; }
.metric-row span { color: var(--ink-3); }
.metric-row strong { color: var(--ink); font-family: 'Outfit'; font-weight: 600; }

.result-warn {
  margin-top: 12px;
  font-size: 11.5px;
  color: rgba(212,168,83,0.7);
  line-height: 1.55;
  padding: 8px 10px;
  background: rgba(212,168,83,0.06);
  border-radius: 6px;
  border-left: 2px solid rgba(212,168,83,0.4);
}

.copy-btn {
  width: 100%;
  margin-top: 14px;
  background: var(--red);
  border: none;
  color: #fff;
  padding: 10px 16px;
  border-radius: var(--r-sm);
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  transition: all 0.2s;
}
.copy-btn:hover:not(:disabled) { background: #cc4539; box-shadow: 0 4px 16px rgba(185,56,44,0.4); }
.copy-btn:disabled { background: var(--panel-active); color: var(--ink-4); cursor: not-allowed; }

/* ============================
   颜色取样
   ============================ */
.sampling-hint {
  font-size: 12px;
  color: var(--ink-3);
  line-height: 1.55;
  padding: 10px 12px;
  background: rgba(212,168,83,0.06);
  border-radius: 6px;
  border: 1px solid rgba(212,168,83,0.15);
  margin-bottom: 12px;
}
.sampling-hint strong { color: var(--ink-2); }
.sampling-hint.done {
  background: rgba(57,167,126,0.08);
  border-color: rgba(57,167,126,0.25);
}

.sample-status {
  font-size: 12px;
  color: var(--accent);
  margin-bottom: 10px;
  min-height: 18px;
}

.sample-btns {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 12px;
}
.sample-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 8px;
  border-radius: var(--r-sm);
  border: 1px solid var(--line-2);
  background: var(--panel-active);
  color: var(--ink);
  font-size: 13px;
  cursor: pointer;
  transition: all 0.2s;
  font-weight: 500;
}
.sample-btn:hover { background: var(--panel-hover); }
.sample-btn.active { box-shadow: 0 0 0 2px currentColor; }

.fat-btn { color: var(--green); border-color: rgba(57,167,126,0.3); }
.fat-btn:hover, .fat-btn.active { background: var(--green-dim); border-color: var(--green); }
.lean-btn { color: #e05c8a; border-color: rgba(224,92,138,0.3); }
.lean-btn:hover, .lean-btn.active { background: rgba(224,92,138,0.1); border-color: #e05c8a; }

.sample-btn-sm {
  background: var(--panel);
  border: 1px solid var(--line);
  color: var(--ink-3);
  padding: 8px;
  border-radius: var(--r-sm);
  font-size: 12px;
  cursor: pointer;
  transition: all 0.18s;
}
.sample-btn-sm:hover { color: var(--ink); background: var(--panel-hover); }

.generate-btn {
  width: 100%;
  margin-top: 14px;
  background: var(--accent);
  border: none;
  color: var(--bg);
  padding: 11px 16px;
  border-radius: var(--r-sm);
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: all 0.2s;
  box-shadow: 0 2px 12px rgba(212,168,83,0.3);
}
.generate-btn:hover:not(:disabled) {
  background: var(--accent-h);
  box-shadow: 0 4px 20px rgba(212,168,83,0.5);
  transform: translateY(-1px);
}
.generate-btn:disabled {
  background: var(--panel-active);
  color: var(--ink-4);
  cursor: not-allowed;
  box-shadow: none;
}

/* ============================
   滑块
   ============================ */
.slider-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}
.slider-label {
  font-size: 12px;
  color: var(--ink-2);
  width: 56px;
  flex-shrink: 0;
}
.slider-row input[type=range] {
  flex: 1;
  -webkit-appearance: none;
  height: 4px;
  background: var(--line-2);
  border-radius: 2px;
  outline: none;
  cursor: pointer;
}
.slider-row input[type=range]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--accent);
  cursor: pointer;
  box-shadow: 0 0 6px rgba(212,168,83,0.5);
}
.slider-row output {
  font-family: 'Outfit';
  font-size: 13px;
  color: var(--accent);
  width: 28px;
  text-align: right;
}

.hint-text {
  font-size: 12px;
  color: var(--ink-3);
  line-height: 1.55;
  margin: 8px 0;
}
.hint-text strong { color: var(--ink-2); }
.hint-text em     { color: var(--ink-2); font-style: normal; }

/* ============================
   反转模式
   ============================ */
.invert-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 10px 0;
}
.invert-btn {
  background: var(--panel-active);
  border: 1px solid var(--line-2);
  color: var(--ink-2);
  padding: 6px 14px;
  border-radius: var(--r-sm);
  font-size: 12px;
  cursor: pointer;
  transition: all 0.18s;
}
.invert-btn:hover, .invert-btn.active {
  background: rgba(212,168,83,0.2);
  border-color: var(--accent);
  color: var(--accent);
}
.invert-status {
  font-size: 12px;
  color: var(--ink-3);
  font-family: 'Outfit';
}

/* ============================
   高级折叠
   ============================ */
.adv-toggle {
  margin-top: 10px;
  font-size: 13px;
}
.adv-toggle summary {
  color: var(--ink-3);
  cursor: pointer;
  padding: 6px 0;
  user-select: none;
  transition: color 0.15s;
}
.adv-toggle summary:hover { color: var(--ink); }
.adv-body {
  padding-top: 12px;
  border-top: 1px dashed var(--line);
  margin-top: 8px;
}

/* ============================
   画笔修正
   ============================ */
.brush-btns {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 12px;
}
.brush-btn {
  padding: 9px 8px;
  border-radius: var(--r-sm);
  border: 1px solid var(--line-2);
  background: var(--panel-active);
  color: var(--ink);
  font-size: 13px;
  cursor: pointer;
  transition: all 0.2s;
  text-align: center;
}
.fat-brush  { color: var(--green);  border-color: rgba(57,167,126,0.3); }
.fat-brush:hover, .fat-brush.active  { background: var(--green-dim);  border-color: var(--green);  box-shadow: 0 0 0 1px var(--green); }
.lean-brush { color: var(--red);    border-color: rgba(185,56,44,0.3); }
.lean-brush:hover, .lean-brush.active { background: var(--red-dim); border-color: var(--red);   box-shadow: 0 0 0 1px var(--red); }

.brush-btn-clear {
  grid-column: span 2;
  background: var(--panel);
  border: 1px solid var(--line);
  color: var(--ink-3);
  padding: 8px;
  border-radius: var(--r-sm);
  font-size: 12px;
  cursor: pointer;
  transition: all 0.18s;
}
.brush-btn-clear:hover { background: var(--panel-hover); color: var(--ink); }

.status-chip {
  display: inline-block;
  font-size: 12px;
  color: var(--ink-3);
  padding: 4px 10px;
  background: var(--panel-active);
  border-radius: 12px;
  margin: 4px 0 0;
}

/* ============================
   等级表
   ============================ */
.grade-table {
  display: flex;
  flex-direction: column;
  gap: 3px;
  margin: 10px 0;
}
.grade-row {
  display: grid;
  grid-template-columns: 30px 60px 1fr 60px;
  align-items: center;
  gap: 8px;
  padding: 7px 10px;
  background: var(--panel-active);
  border-radius: 5px;
  font-size: 12px;
  cursor: pointer;
  transition: all 0.18s;
  border: 1px solid transparent;
}
.grade-row:hover {
  background: var(--panel-hover);
  transform: translateX(3px);
  border-color: var(--line);
}
.grade-row.active {
  background: var(--accent-dim);
  border-color: rgba(212,168,83,0.4);
  transform: translateX(3px);
}
.grade-label { font-weight: 700; color: var(--accent); font-family: 'Outfit'; }
.grade-imf   { color: var(--ink-3); font-family: 'Outfit'; font-size: 11px; }
.grade-desc  { color: var(--ink-2); font-size: 11px; line-height: 1.4; }
.grade-bar-wrap {
  height: 4px;
  background: var(--line-2);
  border-radius: 2px;
  overflow: hidden;
}
.grade-bar-wrap span {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, var(--green), var(--accent));
  border-radius: 2px;
  transition: width 0.4s ease;
}
.grade-row.active .grade-bar-wrap span {
  background: var(--accent);
}

.data-link { color: rgba(212,168,83,0.7); text-decoration: underline; }
.data-link:hover { color: var(--accent); }

/* ============================
   Footer
   ============================ */
.page-footer {
  flex-shrink: 0;
  background: #080604;
  border-top: 1px solid var(--line);
  padding: 20px 0 16px;
  text-align: center;
}
.footer-inner {
  max-width: 980px;
  margin: 0 auto;
  padding: 0 24px;
  display: flex;
  flex-direction: column;
  gap: 24px;
  align-items: center;
}
.footer-brand { }
.brand-slogan {
  font-family: 'Noto Serif SC', serif;
  font-size: 26px;
  font-weight: 700;
  color: var(--accent);
  margin-bottom: 8px;
}
.brand-desc {
  font-size: 13px;
  color: var(--ink-3);
  max-width: 580px;
}
.footer-tags {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
}
.f-tag {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: rgba(255,253,248,0.05);
  border: 1px solid var(--line-2);
  color: var(--ink-2);
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 13px;
  transition: all 0.2s;
  cursor: default;
}
.f-tag:hover {
  background: var(--accent-dim);
  border-color: rgba(212,168,83,0.35);
  color: var(--accent);
  transform: translateY(-2px);
}
.footer-trust {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--ink-4);
}
.ft-dot    { color: var(--ink-4); }
.ft-highlight { color: var(--accent); font-weight: 700; }

/* ============================
   等级对比浮窗
   ============================ */
.compare-overlay {
  position: fixed;
  inset: 0;
  /* 移除遮罩背景，使得底层内容可见 */
  pointer-events: none; /* 让鼠标事件穿透 overlay */
  z-index: 1000;
  display: flex;
  align-items: center; /* 恢复居中显示，方便用户第一时间看到 */
  justify-content: center; /* 恢复居中显示 */
  animation: fadeInOverlay 0.25s ease;
}
.compare-overlay[hidden] { display: none !important; }

@keyframes fadeInOverlay {
  from { opacity: 0; }
  to   { opacity: 1; }
}

.compare-panel {
  pointer-events: auto;
  background: #100c08;
  border: 1px solid rgba(212,168,83,0.28);
  border-radius: 14px;
  width: min(420px, calc(100vw - 28px));
  max-height: 88vh;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-lg), 0 0 60px rgba(212,168,83,0.1);
  overflow: hidden;
  animation: panelSlideUp 0.3s cubic-bezier(0.25,0.46,0.45,0.94);
  position: relative;
}
@keyframes panelSlideUp {
  from { opacity: 0; transform: translateY(20px) scale(0.97); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}
.compare-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  background: rgba(56,27,19,0.72);
  border-bottom: 1px solid rgba(212,168,83,0.18);
  cursor: move;
  user-select: none;
}
.compare-header-left {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--accent);
  font-weight: 700;
  font-family: 'Noto Serif SC', serif;
  font-size: 15px;
}
.compare-header-right {
  display: flex;
  align-items: center;
  gap: 12px;
}
.compare-drag-hint { font-size: 11px; color: var(--ink-4); }
.compare-close {
  width: 28px;
  height: 28px;
  background: rgba(255,253,248,0.08);
  border: 1px solid rgba(255,253,248,0.12);
  color: var(--ink-3);
  cursor: pointer;
  padding: 5px;
  border-radius: 7px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
}
.compare-close:hover { color: var(--ink); background: var(--panel-active); }
.compare-switch-bar {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 0;
  padding: 0 14px;
  background: rgba(255,253,248,0.025);
  border-bottom: 1px solid var(--line);
}
.grade-switch-btn {
  min-height: 42px;
  background: transparent;
  border: 0;
  border-bottom: 2px solid transparent;
  color: var(--ink-3);
  white-space: nowrap;
  padding: 8px 4px;
  border-radius: 0;
  font-size: 13px;
  font-family: 'Outfit';
  font-weight: 700;
  cursor: pointer;
  transition: all 0.18s;
}
.grade-switch-btn:hover { color: var(--ink); background: rgba(255,253,248,0.04); }
.grade-switch-btn.active {
  background: rgba(212,168,83,0.08);
  color: var(--accent);
  border-bottom-color: var(--accent);
}
.gsb-all { color: var(--green); }
.gsb-all.active {
  background: rgba(57,167,126,0.1);
  color: var(--green);
  border-bottom-color: var(--green);
}
.compare-body {
  display: block;
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 14px;
}
.compare-panel.view-all .grade-image-viewer { display: none; }
.grade-image-viewer {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 0;
  border-right: 0;
  overflow: visible;
}
.grade-image-caption {
  padding: 8px 10px;
  border: 1px solid rgba(57,167,126,0.28);
  border-radius: 6px;
  background: rgba(57,167,126,0.12);
  color: #c7e6d8;
  font-size: 12px;
  font-weight: 700;
  line-height: 1.35;
  text-align: left;
}
.grade-image-stage {
  width: 100%;
  min-height: 360px;
  max-height: min(52vh, 430px);
  background: #090806;
  border-radius: 9px;
  border: 1px solid rgba(255,253,248,0.12);
  overflow: hidden; /* 隐藏原生滚动条，通过 JS 拖动来平移图片 */
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 8px;
  cursor: grab;
  overscroll-behavior: contain;
}
.grade-image-stage[data-zoomed="true"] {
  justify-content: flex-start;
  align-items: flex-start;
  cursor: grab;
}
.grade-image-stage[data-zoomed="true"] img {
  cursor: grab;
}
.grade-image-stage img,
.grade-image-stage #gradeCompareImg {
  width: 100%;
  max-width: none;
  max-height: none;
  height: auto;
  flex: 0 0 auto;
  object-fit: contain;
  border-radius: 6px;
  transition: width 0.18s ease;
  display: block;
  background: #fff;
}
.compare-zoom-hint {
  margin: 0;
  font-size: 11px;
  color: var(--ink-4);
  line-height: 1.4;
}
.compare-info {
  padding: 14px 0 0;
  overflow: visible;
  font-size: 13px;
  color: var(--ink-2);
  line-height: 1.65;
}
.compare-info strong {
  display: block;
  margin-bottom: 8px;
  color: var(--ink);
  font-size: 19px;
  line-height: 1.2;
}
.grade-imf-tag {
  display: inline-block;
  background: rgba(185,56,44,0.22);
  color: #ffb18c;
  border-radius: 6px;
  padding: 4px 8px;
  font-size: 11px;
  margin: 0 6px 8px 0;
  font-family: 'Outfit';
  font-weight: 700;
}
.grade-tier-tag {
  display: inline-block;
  background: rgba(57,167,126,0.16);
  color: #6dd2a8;
  border-radius: 6px;
  padding: 4px 8px;
  font-size: 11px;
  margin-bottom: 8px;
  font-family: 'Outfit';
  font-weight: 700;
}
.compare-info p { margin: 8px 0 0; }


/* 全部等级网格 */
.grade-all-grid {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.grade-all-card {
  background: var(--panel-active);
  border-radius: 8px;
  padding: 10px;
  cursor: pointer;
  transition: all 0.18s;
  border: 1px solid transparent;
}
.grade-all-card:hover { background: var(--panel-hover); border-color: var(--line-2); }
.grade-all-card.current { border-color: rgba(212,168,83,0.4); background: var(--accent-dim); }
.grade-all-meta { display: flex; align-items: center; gap: 6px; margin-bottom: 4px; }
.grade-all-meta strong { font-family: 'Outfit'; font-size: 14px; color: var(--accent); }
.grade-all-tier { font-size: 11px; color: var(--ink-3); margin-bottom: 3px; }
.grade-all-desc { font-size: 12px; color: var(--ink-2); }
.grade-inline-thumb {
  width: 100%;
  height: 70px;
  object-fit: cover;
  border-radius: 5px;
  margin-bottom: 6px;
  cursor: pointer;
  transition: opacity 0.15s;
}
.grade-inline-thumb:hover { opacity: 0.85; }

/* ============================
   验收弹窗
   ============================ */
.result-popup {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: rgba(16,12,8,0.96);
  border: 1px solid rgba(212,168,83,0.4);
  border-radius: var(--r-lg);
  padding: 28px;
  width: 360px;
  max-width: 90vw; /* 增加移动端视口宽度保护 */
  text-align: center;
  box-shadow: var(--shadow-lg), var(--accent-glow);
  z-index: 9999; /* 提升层级，确保绝对置顶 */
  backdrop-filter: blur(12px);
  animation: popIn 0.35s cubic-bezier(0.175,0.885,0.32,1.275);
}
@keyframes popIn {
  from { opacity: 0; transform: translate(-50%, -44%) scale(0.88); }
  to   { opacity: 1; transform: translate(-50%, -50%) scale(1); }
}
.popup-emoji  { font-size: 36px; margin-bottom: 10px; }
.result-popup h3 {
  color: var(--accent);
  font-family: 'Noto Serif SC', serif;
  font-size: 16px;
  margin-bottom: 18px;
}
.popup-steps { text-align: left; display: flex; flex-direction: column; gap: 12px; margin-bottom: 20px; }
.ps-item { display: flex; align-items: flex-start; gap: 10px; font-size: 13px; color: var(--ink-2); line-height: 1.5; }
.ps-icon { font-size: 16px; flex-shrink: 0; margin-top: 1px; }

.popup-confirm-btn {
  background: var(--accent);
  border: none;
  color: var(--bg);
  padding: 11px 28px;
  border-radius: 24px;
  font-weight: 700;
  font-size: 14px;
  cursor: pointer;
  transition: all 0.2s;
}
.popup-confirm-btn:hover {
  background: var(--accent-h);
  transform: scale(1.04);
  box-shadow: var(--accent-glow);
}

.fade-out { animation: fadeOut 1s ease forwards; }
@keyframes fadeOut {
  0%   { opacity: 1; transform: translate(-50%, -50%) scale(1); }
  70%  { opacity: 0.3; transform: translate(-50%, -52%) scale(0.96); }
  100% { opacity: 0; transform: translate(-50%, -56%) scale(0.9); pointer-events: none; }
}

/* ============================
   Toast 提示
   ============================ */
.toast {
  position: fixed;
  bottom: 28px;
  left: 50%;
  transform: translateX(-50%) translateY(16px);
  background: rgba(212,168,83,0.92);
  color: var(--bg);
  padding: 10px 22px;
  border-radius: 24px;
  font-size: 13px;
  font-weight: 700;
  opacity: 0;
  pointer-events: none;
  transition: all 0.3s cubic-bezier(0.175,0.885,0.32,1.275);
  z-index: 3000;
  box-shadow: var(--shadow-sm);
  white-space: nowrap;
}
.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ============================
   移动端响应式布局 (Mobile Responsive)
   ============================ */
@media (max-width: 768px) {
  /* 顶栏瘦身，防止上传按钮被挤出屏幕 */
  .topbar { padding: 0 10px; height: 48px; gap: 8px; justify-content: space-between; }
  .brand-lockup { min-width: 0; flex: 1; }
  .brand-cn-main { font-size: 16px; flex-shrink: 0; }
  .brand-title { font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .brand-tagline { display: none; /* 隐藏口号，节省空间 */ }
  .topbar-right { flex-shrink: 0; margin-left: auto; }
  .upload-button { padding: 6px 10px; font-size: 12px; }
  /* 在极窄屏幕下隐藏“上传图片”文字，只留图标 */
  @media (max-width: 380px) {
    .upload-button { font-size: 0; padding: 6px 12px; }
    .upload-button svg { margin: 0; }
  }
  
  /* 主体布局：从左右网格改为上下堆叠 */
  .tool-grid {
    grid-template-columns: 1fr;
    padding: 10px;
    gap: 12px;
  }
  
  /* 画布区域：解决旧版浏览器 Flex 高度坍塌问题 */
  .canvas-panel {
    min-height: 400px;
    height: 60vh;
  }
  .drop-zone {
    height: 100%; /* 强制占满，不依赖 flex */
    min-height: 400px;
  }
  
  /* 关键：给画布加上 touch-action: none 防止手指画套索时页面乱滚 */
  #analysisCanvas {
    touch-action: none;
  }
  
  /* 悬浮工具条：缩小间距，允许横滑 */
  .canvas-toolbar {
    padding: 4px 6px;
    gap: 4px;
    width: 100%;
    border-radius: 4px;
  }
  .tb-btn { padding: 4px 8px; font-size: 12px; }
  .tb-opacity-group { display: none; /* 移动端可考虑隐藏透明度调节，或放入折叠菜单。暂且保留也可，用flex-shrink控制 */ }
  .tb-shortcut { display: none; /* 隐藏快捷键提示 */ }
  
  /* 右侧信息与设置面板 */
  .side-panel {
    border: none;
    background: transparent;
    padding: 0;
    display: flex;
    flex-direction: column;
    /* 取消内部滚动，高度由内容自然撑开，与整页滚动条合并 */
    max-height: none;
    overflow-y: visible;
    position: static;
  }
  #resultPanel {
    order: 99; /* 将结果面板强行排到最后，避免挡在画板和颜色取样区中间 */
  }
  .panel-card {
    padding: 16px;
  }
  
  /* 等级参考弹窗：满宽并吸底 */
  #gradeComparePanel {
    width: 100%;
    height: 80vh;
    left: 0;
    top: auto;
    bottom: 0;
    border-radius: 20px 20px 0 0;
    transform: translateY(100%);
  }
  /* 弹窗展现状态：覆盖原来拖拽改变的行内样式 */
  #gradeCompareOverlay:not([hidden]) #gradeComparePanel {
    transform: translateY(0);
    top: auto !important;
    left: 0 !important;
    bottom: 0 !important;
  }
  .grade-compare-header {
    border-radius: 20px 20px 0 0;
  }
  
  /* 等级卡片网格响应式 */
  .grade-all-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  
  /* Toast 提示位置调低，避免与上方内容冲突 */
  .toast {
    bottom: 30px;
  }

  /* 框选技巧弹窗：移动到中上方盖住图片，强引导阅读 */
  .crop-hint-modal {
    top: 35%;
    bottom: auto !important;
    left: 50% !important;
    transform: translate(-50%, -50%);
    width: 85vw;
  }

  /* 紧凑化空状态的新手指引 */
  .guide-row {
    gap: 6px;
    padding: 12px 8px;
  }
}

/* ============================
   示例体验按钮
   ============================ */
.demo-try-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-top: 16px;
  padding: 10px 24px;
  background: transparent;
  border: 1.5px solid rgba(212,168,83,0.5);
  color: var(--accent);
  font-size: 13px;
  font-weight: 600;
  border-radius: 24px;
  cursor: pointer;
  transition: all 0.25s ease;
  letter-spacing: 0.3px;
}
.demo-try-btn:hover {
  background: rgba(212,168,83,0.12);
  border-color: var(--accent);
  box-shadow: 0 0 20px rgba(212,168,83,0.2);
  transform: translateY(-1px);
}

/* ============================
   对比故事卡（折叠式）
   ============================ */
.compare-story-card {
  margin-top: 20px;
  background: rgba(255,253,248,0.04);
  border: 1px solid rgba(212,168,83,0.15);
  border-radius: 12px;
  width: 100%;
  max-width: 560px;
  box-sizing: border-box;
  overflow: hidden;
  transition: all 0.3s ease;
}

/* 折叠态标题栏 */
.compare-collapsed-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 18px;
  cursor: pointer;
  transition: background 0.2s ease;
}
.compare-collapsed-header:hover {
  background: rgba(212,168,83,0.06);
}
.compare-collapsed-text {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--ink-2);
  line-height: 1.4;
}
.compare-collapsed-icon {
  font-size: 16px;
  flex-shrink: 0;
}
.compare-toggle-btn {
  background: none;
  border: 1px solid rgba(212,168,83,0.3);
  color: var(--accent);
  font-size: 12px;
  font-weight: 600;
  padding: 5px 14px;
  border-radius: 16px;
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
  transition: all 0.2s ease;
}
.compare-toggle-btn:hover {
  background: rgba(212,168,83,0.1);
  border-color: var(--accent);
}

/* 展开区域 */
.compare-expanded-body {
  max-height: 0;
  overflow: hidden;
  opacity: 0;
  transition: max-height 0.4s ease, opacity 0.3s ease, padding 0.3s ease;
  padding: 0 18px;
}
/* 展开状态 */
.compare-story-card:not(.collapsed) .compare-expanded-body {
  max-height: 1200px;
  opacity: 1;
  padding: 0 18px 18px;
}
.compare-story-card:not(.collapsed) .compare-toggle-btn {
  transform: rotate(180deg);
}

.compare-story-title {
  font-family: 'Noto Serif SC', serif;
  font-size: 15px;
  font-weight: 700;
  color: var(--ink);
  margin-bottom: 14px;
  text-align: center;
}

/* JMGA 背景介绍 */
.compare-intro {
  font-size: 12px;
  color: var(--ink-3);
  line-height: 1.8;
  margin-bottom: 14px;
  text-align: left;
}
.compare-intro strong {
  color: var(--ink-2);
}

/* 完整大图展示 */
.compare-full-image-wrap {
  position: relative;
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid rgba(255,253,248,0.08);
}
.compare-full-image {
  width: 100%;
  height: auto;
  display: block;
}

/* 图片上的叠加标签 */
.compare-image-overlay {
  position: absolute;
  inset: 0;
  pointer-events: none;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 6px 0;
}
.overlay-label {
  display: inline-block;
  background: rgba(10,8,5,0.75);
  color: var(--accent);
  font-size: 11px;
  font-weight: 600;
  padding: 4px 12px;
  backdrop-filter: blur(4px);
}
.overlay-top {
  align-self: flex-start;
  border-radius: 0 0 8px 0;
}
.overlay-bottom {
  align-self: flex-start;
  border-radius: 0 8px 0 0;
}

/* 结论区 */
.compare-conclusion {
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid rgba(255,253,248,0.06);
  text-align: center;
}
.compare-headline {
  font-size: 13px;
  font-weight: 700;
  color: var(--accent);
  margin-bottom: 6px;
  line-height: 1.5;
}
.compare-desc {
  font-size: 12px;
  color: var(--ink-3);
  line-height: 1.7;
}

.compare-story-card .demo-try-btn {
  margin-top: 12px;
}

/* 来源标注 */
.compare-source {
  margin-top: 10px;
  font-size: 10px;
  color: var(--ink-4);
  text-align: center;
}
/* ============================
    (Appraisal Card)
   ============================ */
.appraisal-card {
  background: var(--panel);
  border-radius: 12px;
  border: 1px solid var(--line);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: transform 0.2s, box-shadow 0.2s;
}
.appraisal-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 12px 24px rgba(0,0,0,0.4);
}
.ac-header {
  padding: 16px;
  border-bottom: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.ac-tag {
  align-self: flex-start;
  padding: 4px 10px;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 700;
}
.tag-black { background: rgba(255,255,255,0.1); color: var(--ink-2); }
.tag-red { background: rgba(220, 53, 69, 0.15); color: #ff6b6b; }
.ac-title {
  font-size: 18px;
  font-weight: 700;
  color: var(--ink);
}
.ac-body {
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.ac-image-wrapper {
  background: var(--bg);
  border-radius: 8px;
  height: 140px;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
}
.ac-scan-placeholder {
  border: 1px dashed rgba(212,168,83,0.4);
  width: 90%;
  height: 80%;
  border-radius: 6px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  position: relative;
}
.scan-line {
  position: absolute;
  top: 0; left: 0; right: 0; height: 2px;
  background: rgba(212,168,83,0.5);
  animation: scanUpDown 3s ease-in-out infinite;
}
@keyframes scanUpDown {
  0%, 100% { top: 10%; }
  50% { top: 90%; }
}
.ac-radar {
  display: flex;
  flex-direction: column;
  gap: 8px;
  background: var(--bg);
  padding: 12px;
  border-radius: 8px;
}
.radar-item {
  display: flex;
  justify-content: space-between;
  font-size: 13px;
  color: var(--ink-2);
}
.radar-item .stars { color: var(--accent); letter-spacing: 2px; font-size: 10px; }
.card-black .radar-item .stars { filter: grayscale(100%) opacity(0.7); }
.ac-footer {
  padding: 12px 16px;
  border-top: 1px dashed var(--line);
  background: rgba(0,0,0,0.1);
}
.ac-verdict {
  background: rgba(255,255,255,0.05);
  padding: 10px;
  border-radius: 6px;
  text-align: center;
  font-size: 13px;
  font-weight: 700;
  color: var(--ink-2);
}
