/* ═══════════════════════════════════════════════════════════
   大隐静脉超声智能分割与三维重建系统 — 青绿医疗风精修版
   ═══════════════════════════════════════════════════════════ */
:root {
  --teal-900: #0a5c5f;
  --teal-700: #0d7377;
  --teal-500: #149a8c;
  --teal-400: #149b9b;
  --teal-200: #d5dde3;  /* 边框灰（原淡青 #9fd4d4） */
  --teal-100: #eef2f5;  /* 浅灰底（原淡青 #e0f2f2） */
  --teal-50: #ffffff;   /* 白底（原淡青 #f0fbfa） */
  --ink: #2c3e50;
  --ink-2: #5a6e8a;
  --ink-3: #95a5a6;
  --bg: #f4f7f9;
  --card: #ffffff;
  --border: #e4ebed;
  --danger: #e74c3c;
  --shadow-sm: 0 1px 3px rgba(16, 42, 67, 0.06);
  --shadow-md: 0 6px 18px rgba(16, 42, 67, 0.08);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
/* hidden 属性必须无条件生效,否则会被 .results 等 display 规则覆盖 */
[hidden] { display: none !important; }
body {
  background: var(--bg);
  color: var(--ink);
  font-family: "PingFang SC", "Microsoft YaHei", "Noto Sans SC", -apple-system, sans-serif;
  font-size: 14px;
  line-height: 1.6;
}

/* ── 顶部导航 ── */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 28px;
  background: linear-gradient(135deg, #0d7377 0%, #149a8c 100%);
  color: #fff;
  box-shadow: var(--shadow-md);
}
.brand { display: flex; align-items: center; gap: 14px; margin-right: auto; }
.brand-mark { display: inline-flex; }
.brand-text h1 { margin: 0; font-size: 19px; font-weight: 700; letter-spacing: 0.02em; }
.brand-text p { margin: 2px 0 0; font-size: 12px; color: rgba(255,255,255,0.88); }
.topbar-status {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  height: 32px;
  box-sizing: border-box;
  font-size: 12px; color: rgba(255,255,255,0.9);
  background: rgba(255,255,255,0.14);
  border: 1px solid rgba(255,255,255,0.25);
  padding: 6px 14px; border-radius: 999px;
}

/* 语言切换按钮(顶栏, 白色半透明胶囊; 与状态胶囊同高并留间距) */
.lang-switch {
  display: flex; align-items: center; gap: 4px;
  height: 32px;
  box-sizing: border-box;
  margin-left: 12px;
  background: rgba(255,255,255,0.14);
  border: 1px solid rgba(255,255,255,0.25);
  padding: 3px 6px; border-radius: 999px;
}
.lang-switch .lang-btn {
  border: none; background: none;
  color: rgba(255,255,255,0.75);
  font-size: 12px; font-weight: 700;
  padding: 3px 8px; border-radius: 999px;
  cursor: pointer; transition: background .15s, color .15s;
}
.lang-switch .lang-btn:hover { color: #ffffff; }
.lang-switch .lang-btn.active {
  background: #ffffff;
  color: var(--teal-700);
}
.lang-switch .lang-sep { color: rgba(255,255,255,0.4); font-size: 12px; }

/* 退出登录按钮(顶栏, 与语言切换同款白色半透明胶囊) */
.logout-btn {
  height: 32px;
  box-sizing: border-box;
  margin-left: 12px;
  background: rgba(255,255,255,0.14);
  border: 1px solid rgba(255,255,255,0.25);
  border-radius: 999px;
  color: rgba(255,255,255,0.85);
  font-size: 12px; font-weight: 700;
  padding: 0 14px;
  cursor: pointer;
  transition: background .15s, color .15s;
}
.logout-btn:hover { background: rgba(255,255,255,0.25); color: #ffffff; }
.topbar-status .dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: #7ce0c9;
  animation: pulse 2s infinite;
}
@keyframes pulse {
  0% { box-shadow: 0 0 0 0 rgba(124,224,201,0.6); }
  70% { box-shadow: 0 0 0 7px rgba(124,224,201,0); }
  100% { box-shadow: 0 0 0 0 rgba(124,224,201,0); }
}

main { max-width: 1280px; margin: 0 auto; padding: 22px 24px 0; }

/* ── 卡片 ── */
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: var(--shadow-sm);
  padding: 20px 22px;
  margin-bottom: 18px;
}

/* ── 配置面板 ── */
.cfg-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
  align-items: start;
}
.cfg-item > label { display: block; font-size: 12.5px; font-weight: 700; color: var(--ink-2); margin-bottom: 6px; }
.cfg-row { display: flex; gap: 8px; align-items: center; }
.cfg-input {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 12px;
  font-size: 13px;
  color: var(--ink);
  background: #fbfdfd;
  transition: border-color .15s, box-shadow .15s;
}
.cfg-input:focus { outline: none; border-color: var(--teal-500); box-shadow: 0 0 0 3px rgba(20,154,140,0.12); }
select.cfg-input { appearance: none; background-image: linear-gradient(45deg, transparent 50%, #95a5a6 50%), linear-gradient(135deg, #95a5a6 50%, transparent 50%); background-position: calc(100% - 16px) 55%, calc(100% - 11px) 55%; background-size: 5px 5px; background-repeat: no-repeat; }
.cfg-input.grow { flex: 1; }
.cfg-hint { font-size: 11.5px; color: var(--ink-3); margin-top: 4px; }
.cfg-hint.ok { color: var(--teal-700); }

.mini-btn {
  flex-shrink: 0;
  display: inline-block;
  padding: 8px 14px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--teal-700);
  background: var(--teal-50);
  border: 1px solid var(--teal-200);
  border-radius: 8px;
  cursor: pointer;
  transition: background .15s;
}
.mini-btn:hover { background: var(--teal-100); }

/* ── 页签 ── */
.tabbar {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 18px;
  border-bottom: 1px solid var(--border);
}

/* 使用注意事项(页签行上方, 暖色警示条) */
.notice-bar {
  margin-bottom: 14px;
  padding: 10px 16px;
  background: #fdf6ec;
  border: 1px solid #f0d9b5;
  color: #8a6d3b;
  border-radius: 10px;
  font-size: 13px;
  line-height: 1.7;
  text-align: center;
}

/* 刷新按钮(页签行右侧, 红色; 点击整页刷新重新开始) */
.btn-refresh {
  margin-left: auto;
  align-self: center;
  border: none;
  background: var(--danger);
  color: #ffffff;
  font-size: 12.5px;
  font-weight: 600;
  padding: 8px 20px;
  border-radius: 8px;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(231, 76, 60, 0.25);
  transition: opacity .15s, transform .12s;
}
.btn-refresh:hover { opacity: 0.88; transform: translateY(-1px); }
.tab {
  border: none;
  background: none;
  padding: 11px 26px;
  font-size: 14.5px;
  font-weight: 600;
  color: var(--ink-2);
  cursor: pointer;
  border-bottom: 3px solid transparent;
  margin-bottom: -1px;
  transition: color .15s, border-color .15s;
}
.tab:hover { color: var(--teal-700); }
.tab.active { color: var(--teal-700); border-bottom-color: var(--teal-700); }

.tab-panel { display: none; }
.tab-panel.active { display: block; }

/* ── 控制行 ── */
.ctl-row { display: flex; align-items: flex-end; gap: 14px; margin-bottom: 16px; }
.ctl-row.wrap { flex-wrap: wrap; align-items: flex-end; }
.ctl-row.center { justify-content: center; }
.ctl-row.middle { align-items: center; }
.push-right { margin-left: auto; }
/* 视频框顶部按钮行: 两个按钮同宽同高 */
#videoStage .ctl-row.center > button {
  width: 148px;
  height: 40px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 13.5px;
  border-radius: 10px;
}
.ctl-desc { margin: 0; flex: 1; font-size: 13px; color: var(--ink-2); }
.ctl-field { display: flex; flex-direction: column; gap: 6px; font-size: 12.5px; font-weight: 700; color: var(--ink-2); }
.ctl-field .cfg-input { width: 170px; }

/* ── 按钮 ── */
.btn-primary {
  border: none;
  background: linear-gradient(135deg, #0d7377, #149b9b);
  color: #fff;
  font-size: 14px;
  font-weight: 600;
  padding: 10px 28px;
  border-radius: 10px;
  cursor: pointer;
  box-shadow: 0 3px 10px rgba(13,115,119,0.28);
  transition: transform .12s, box-shadow .12s, opacity .12s;
}
.btn-primary:hover { transform: translateY(-1px); box-shadow: 0 6px 16px rgba(13,115,119,0.35); }
.btn-primary:active { transform: translateY(0); opacity: .9; }
.btn-primary:disabled { opacity: .55; cursor: not-allowed; transform: none; }

/* ── 处理状态(环形转圈 + 阶段文案 + 已用时间) ── */
.progress { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; }
.spinner {
  flex-shrink: 0;
  width: 24px; height: 24px;
  border: 3px solid var(--teal-100);
  border-top-color: var(--teal-500);
  border-radius: 50%;
  animation: spin 0.9s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.progress-text { flex: 1; font-size: 12.5px; font-weight: 600; color: var(--teal-700); }
.progress-time { font-size: 12.5px; font-weight: 600; color: var(--ink-3); font-variant-numeric: tabular-nums; }

/* ── 结果区 ── */
.results { display: flex; flex-direction: column; gap: 18px; }
.dual { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
figure { margin: 0; }
figure img {
  width: 100%;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--teal-50);
  display: block;
}
figcaption { font-size: 12px; color: var(--ink-2); margin-top: 8px; text-align: center; }
figure.wide img { max-height: 520px; object-fit: contain; }

/* ── 指标瓦片 ── */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 14px; }
.stat {
  background: var(--teal-50);
  border: 1px solid var(--teal-200);
  border-radius: 12px;
  padding: 14px 16px 12px;
  text-align: center;
}
.stat-value { font-size: 24px; font-weight: 800; color: var(--teal-700); font-variant-numeric: tabular-nums; }
.stat-unit { font-size: 12px; color: var(--ink-3); display: inline-block; margin-left: 2px; }
.stat-label { font-size: 12px; color: var(--ink-2); margin-top: 2px; }

/* ── 统计表 ── */
.stats-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.stats-table th, .stats-table td {
  padding: 10px 14px;
  text-align: center;
  border-bottom: 1px solid var(--border);
}
.stats-table th { background: var(--teal-50); color: var(--teal-700); font-weight: 700; }
.stats-table tr:last-child td { border-bottom: none; }

/* ── 三维重建: 静态图 + 交互模型并排(等大, 顶部标题统一) ── */
.recon-dual { align-items: stretch; }
.recon-dual .frame-card.full { grid-column: 1 / -1; }
.frame-card .frame-body { background: #ffffff; }
.frame-card .frame-body img {
  width: 100%;
  height: auto;
  aspect-ratio: 4 / 3;
  object-fit: contain;
  display: block;
}

/* ── iframe 卡片 ── */
.frame-card {
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}
.frame-head {
  font-size: 13px;
  font-weight: 700;
  color: var(--teal-700);
  background: var(--teal-50);
  padding: 10px 16px;
  border-bottom: 1px solid var(--teal-200);
}
.frame-card iframe { width: 100%; height: 660px; border: none; display: block; }
#rcModelCard iframe { height: auto; aspect-ratio: 4 / 3; }
#rcVelCard iframe { height: 460px; }

/* ── 占位面板（批量分析 / 三维重建运行前） ── */
.batch-placeholder { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; align-items: stretch; }
.recon-placeholder { display: flex; flex-direction: column; gap: 18px; }
.ph-panel-wide { min-height: 220px; }
.ph-panel {
  min-height: 460px;
  border: 2px dashed var(--teal-200);
  border-radius: 12px;
  background: #ffffff;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  padding: 30px 24px;
  text-align: center;
}
.ph-icon { display: inline-flex; opacity: 0.9; }
.ph-title { font-size: 15.5px; font-weight: 700; color: var(--ink); }
.ph-desc { font-size: 12.5px; color: var(--ink-3); max-width: 300px; line-height: 1.8; }

/* ── 空态 ── */
.empty {
  border: 2px dashed var(--teal-200);
  border-radius: 12px;
  background: var(--teal-50);
  color: var(--ink-3);
  text-align: center;
  padding: 60px 20px;
  font-size: 13.5px;
}

/* ── 错误提示 ── */
.err-banner {
  position: relative;
  background: #fdf0ef;
  border: 1px solid #f5c6c2;
  color: var(--danger);
  border-radius: 10px;
  padding: 10px 36px 10px 16px;
  font-size: 13px;
  margin-bottom: 16px;
}

/* ── 提示条关闭按钮 ── */
.banner-close {
  position: absolute; top: 50%; right: 10px;
  transform: translateY(-50%);
  border: none; background: none;
  color: inherit; opacity: 0.55;
  font-size: 16px; line-height: 1;
  padding: 4px 6px;
  cursor: pointer;
  border-radius: 6px;
}
.banner-close:hover { opacity: 1; background: rgba(0, 0, 0, 0.06); }

/* ── 视频裁剪与抽帧 ── */
/* 右侧框: 与上传占位面板同尺寸的"盒子", 视频加载后在其中展示裁剪预览 */
.video-stage {
  flex: 1;
  display: flex; flex-direction: column; gap: 16px;
  min-height: 240px;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px;
  background: #ffffff;
}
/* 单图页签操作行: 帧号滑块 + 提取/上传/运行 同排 */
.single-row { align-items: center; flex-wrap: wrap; }
.single-row input[type=range] { flex: 1; min-width: 130px; accent-color: var(--teal-500); }
.single-row .slider-label { width: auto; }   /* 「帧号」两字横排(原 20px 宽只够单字) */
/* 提取此帧/上传图片/运行分割 三个按钮同高 */
.single-row > .mini-btn,
.single-row > .btn-primary {
  box-sizing: border-box;
  height: 40px;
  padding: 0 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 13.5px;
}
#singlePreview { max-width: 100%; max-height: 420px; object-fit: contain; border-radius: 8px; }
/* 单图页签: 分割结果图与选帧预览保持同一尺寸 */
#singleResults figure img { max-height: 420px; object-fit: contain; }
/* 视频上传页: 左示例播放器 + 右上传框(左右等高, 网格拉伸+内部 flex 填充) */
.video-layout { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-bottom: 16px; }
.demo-panel {
  display: flex; flex-direction: column; gap: 12px;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px;
  background: #ffffff;
}
.demo-video-wrap {
  flex: 1;
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #10262b; border: 1px solid var(--border);
  border-radius: 12px; overflow: hidden;
}
.demo-video-wrap video { display: block; width: 100%; height: 100%; object-fit: contain; }
.right-panel { display: flex; flex-direction: column; }
.upload-panel {
  flex: 1;
  min-height: 240px;
  border: 2px dashed var(--teal-200);
  border-radius: 12px;
  background: #ffffff;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  padding: 30px 24px;
  text-align: center;
  cursor: pointer;
  transition: border-color .15s, background .15s;
}
.upload-panel:hover { border-color: var(--teal-500); background: var(--teal-50); }
.ok-banner {
  position: relative;
  background: #eefaf6;
  border: 1px solid #b7e4d8;
  color: var(--teal-700);
  border-radius: 10px;
  padding: 10px 36px 10px 16px;
  font-size: 13px;
  margin-bottom: 16px;
  word-break: break-all;
}
.crop-stage {
  position: relative; max-width: 480px; margin: 0 auto;
  border: 1px solid var(--border); border-radius: 12px;
  overflow: hidden; background: #10262b; user-select: none;
}
.crop-stage img { display: block; width: 100%; height: auto; }
/* 四块半透明遮罩: 盖住裁剪框之外区域(深色, 不拦截鼠标) */
.roi-mask { position: absolute; background: rgba(24, 40, 52, 0.62); pointer-events: none; }
.roi-mask-top { top: 0; left: 0; right: 0; }
.roi-mask-bottom { bottom: 0; left: 0; right: 0; }
.roi-mask-left { left: 0; }
.roi-mask-right { right: 0; }
/* 裁剪框: 青绿描边 + 外发光 */
.roi-frame {
  position: absolute; border: 2px solid #7ce0c9;
  box-shadow: 0 0 0 1px rgba(13, 115, 119, 0.55); pointer-events: none;
}
.slider-row { display: flex; align-items: center; gap: 12px;
              max-width: 480px; width: 100%; margin: 0 auto; }
.slider-label { width: 20px; font-size: 12.5px; font-weight: 700; color: var(--ink-2); }
.slider-row input[type=range] { flex: 1; accent-color: var(--teal-500); }
.slider-val { width: 42px; text-align: right; font-size: 12px;
              color: var(--ink-3); font-variant-numeric: tabular-nums; }

/* ── 支持作者按钮与弹窗 ── */
.btn-support {
  margin-top: 10px;
  border: none;
  background: linear-gradient(135deg, #0d7377, #149b9b);
  color: #ffffff;
  font-size: 13px;
  font-weight: 600;
  padding: 9px 22px;
  border-radius: 10px;
  cursor: pointer;
  box-shadow: 0 3px 10px rgba(13, 115, 119, 0.28);
  transition: transform .12s, box-shadow .12s;
}
.btn-support:hover { transform: translateY(-1px); box-shadow: 0 6px 16px rgba(13, 115, 119, 0.35); }
.modal-mask {
  position: fixed;
  right: 24px; bottom: 24px;   /* 右下角弹出, 无全屏遮罩 */
  z-index: 100;
}
.modal-card {
  position: relative;
  background: #ffffff;
  border-radius: 14px;
  padding: 22px 28px 24px;
  width: min(360px, 86vw);
  box-shadow: var(--shadow-md);
  display: flex; flex-direction: column; align-items: center; gap: 14px;
}
.modal-head {
  width: 100%;
  display: flex; align-items: center; justify-content: center;
  font-size: 16px; font-weight: 700; color: var(--ink);
  position: relative;
}
.modal-head .banner-close { position: absolute; right: -12px; top: 50%; transform: translateY(-50%); color: var(--ink-3); }
.support-qr { width: 250px; height: auto; border-radius: 10px; border: 1px solid var(--border); }
.modal-desc { font-size: 13px; color: var(--ink-2); text-align: center; }
.modal-email-row {
  display: flex; align-items: center; gap: 6px;
  font-size: 12.5px; color: var(--ink-2);
}
.modal-email-row a { color: var(--teal-700); font-weight: 600; text-decoration: none; }
.modal-email-row a:hover { text-decoration: underline; }

/* ── 页脚 ── */
footer {
  max-width: 1280px;
  margin: 26px auto 0;
  padding: 0 24px 40px;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 18px;
}
.foot-col {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 18px 20px;
  box-shadow: var(--shadow-sm);
}
.foot-col h4 { margin: 0 0 10px; font-size: 13px; color: var(--teal-700); }
.foot-col ol { margin: 0; padding-left: 18px; }
.foot-col li, .foot-col p { font-size: 12.5px; color: var(--ink-2); line-height: 1.9; margin: 0; }
.foot-col li::marker { color: var(--teal-700); font-weight: 700; }
.legend { display: flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--ink); margin-bottom: 5px; }
.legend i { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }

/* ── 响应式 ── */
@media (max-width: 900px) {
  .cfg-grid { grid-template-columns: 1fr 1fr; }
  .dual { grid-template-columns: 1fr; }
  .batch-placeholder { grid-template-columns: 1fr; }
  .video-layout { grid-template-columns: 1fr; }
  footer { grid-template-columns: 1fr; }
  .topbar { flex-direction: column; gap: 10px; align-items: flex-start; }
}

/* ── 登录页(独立页: 全屏青绿渐变居中卡片) ── */
body.login-body {
  min-height: 100vh;
  margin: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  box-sizing: border-box;
  background: linear-gradient(135deg, #0d7377 0%, #149a8c 100%);
}
.login-card {
  background: #ffffff;
  border-radius: 14px;
  padding: 30px 34px 26px;
  width: min(400px, 92vw);
  box-shadow: 0 12px 44px rgba(10, 92, 95, 0.28);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
}
.login-brand { display: flex; flex-direction: column; align-items: center; gap: 8px; text-align: center; }
.login-brand h1 { margin: 0; font-size: 17px; font-weight: 700; color: var(--ink); line-height: 1.45; }
.login-brand p { margin: 0; font-size: 12.5px; color: var(--ink-2); }
.login-form { width: 100%; display: flex; flex-direction: column; gap: 12px; }
.login-form .cfg-input { box-sizing: border-box; }
.login-form .btn-primary { width: 100%; box-sizing: border-box; }
.login-hint { margin: 0; font-size: 12px; color: var(--ink-3); text-align: center; }
.login-lang { position: fixed; top: 18px; right: 20px; }
