:root{
  --bg:#0b0f16;
  --panel:#121826;
  --card:#0f1724;
  --stroke:rgba(255,255,255,.08);
  --text:#e8eefc;
  --muted:rgba(232,238,252,.70);
  --accent:#23b4ff;
  --accent2:#22d3a7;
  --warn:#ffd166;
  --bad:#ff5c7a;
  --ok:#37d67a;
  --shadow:0 10px 30px rgba(0,0,0,.35);
}

/* ===== 基础 ===== */
* { box-sizing: border-box; }

body{
  margin:0;
  font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, "Apple Color Emoji","Segoe UI Emoji";
  background: radial-gradient(1200px 700px at 20% -10%, rgba(35,180,255,.18), transparent 55%),
              radial-gradient(900px 600px at 90% 0%, rgba(34,211,167,.14), transparent 55%),
              var(--bg);
  color:var(--text);
}


.top{
  display:flex;
  justify-content:space-between;
  align-items:center;
  padding:8px 12px;
  background:#0f1728;
  border-bottom:1px solid rgba(255,255,255,.08);
}

.title{
  font-size:16px;
  font-weight:600;
}

.actions{
  display:flex;
  gap:8px;
  align-items:center;
}

button,select,input{
  background:#141e33;
  border:1px solid rgba(255,255,255,.15);
  color:#fff;
  padding:8px 10px;
  border-radius:10px;
  font-size:13px;
}

button{ cursor:pointer; }

.wrap{
  padding:8px;
  display:flex;
  flex-direction:column;
  gap:8px;
}

/* ===== 取色区域（关键：iOS Safari 打开摄像头会导致 vh 变化，我们用 JS 锁定像素高度）===== */
.stage{
  position:relative;
  width:100%;
  height: var(--stage-h, 16vh);          /* 固定高度，不用 min-height */
  background:#000;
  border-radius:16px;
  overflow:hidden;
  border:1px solid rgba(255,255,255,.08);
}

/* 让 video 不参与布局，避免因为视频比例导致容器变化 */
.stage video,
.stage canvas{
  position:absolute;
  inset:0;
  width:100%;
  height:100%;
  object-fit:cover;
}

/* ===== ROI ===== */
.roi{
  position:absolute;
  width:36px;
  height:36px;
  border:2px solid #00ff9f;
  border-radius:12px;
  pointer-events:none;
}

#roiTarget{ left:20%; top:30%; }

#roiCurrent{
  right:20%;
  top:30%;
  border-color:#ff9800;
}

.roiLabel{
  position:absolute;
  bottom:-18px;
  font-size:12px;
}

/* ===== 卡片区域 ===== */
.panel{
  background: rgba(18,24,38,.55);
  border:1px solid var(--stroke);
  box-shadow: var(--shadow);
  backdrop-filter: blur(10px);
 display:flex; flex-direction:column; gap:8px; }
.row{ display:flex; gap:8px; flex-wrap:wrap; }

.card{
  background: rgba(15,23,36,.75);
  border:1px solid var(--stroke);
  box-shadow: 0 8px 22px rgba(0,0,0,.28);

  flex:1;
  min-width:48%;
  background:#111a2c;
  padding:10px;
  border-radius:16px;
  border:1px solid rgba(255,255,255,.08);
}

.cardTitle{
  font-size:13px;
  opacity:.8;
  margin-bottom:6px;
}

.mono{
  font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,"Liberation Mono",monospace;
  font-size:14px;
}

.swatch{
  height:18px;
  border-radius:6px;
  margin-top:6px;
  border:1px solid rgba(255,255,255,.12);
}

/* ===== 建议加色条 ===== */
.suggestion-item{ margin-bottom:10px; }
.suggestion-label{ font-size:13px; margin-bottom:6px; }

.suggestion-bar{
  height:16px;
  border-radius:6px;
  background:#222;
  overflow:hidden;
}

.suggestion-fill{
  height:100%;
  border-radius:6px;
}

.bar-red{ background:#ff3b3b; }
.bar-green{ background:#00c853; }
.bar-blue{ background:#2979ff; }
.bar-yellow{ background:#ffd600; }
.bar-black{ background:#444; }
.bar-white{ background:#eee; }

/* ===== 手机优化 ===== */
@media (max-width:600px){
  .stage{ height: var(--stage-h, 15vh); }   /* 手机更矮，一屏放得下 */
  .roi{ width:34px; height:34px; }
  .card{
  background: rgba(15,23,36,.75);
  border:1px solid var(--stroke);
  box-shadow: 0 8px 22px rgba(0,0,0,.28);
 min-width:100%; }
  button,select,input{ padding:6px 8px; font-size:12px; }
  .title{ font-size:14px; }
}


.btnWide{
  border-color: rgba(34,211,167,.28);
  background: linear-gradient(180deg, rgba(34,211,167,.20), rgba(34,211,167,.10));

  width: 180px;
  max-width: 100%;
}


.camError{margin:6px 10px;padding:8px 10px;border-radius:12px;background:rgba(255,70,70,.12);border:1px solid rgba(255,70,70,.25);color:#ffd6d6;font-size:13px;line-height:1.35;}


input, select{ background: rgba(255,255,255,.04); border:1px solid var(--stroke); color:var(--text); border-radius:12px; padding:8px 10px; }
input:focus{ outline:none; border-color: rgba(35,180,255,.45); box-shadow: 0 0 0 3px rgba(35,180,255,.12); }
.swatch{ border:1px solid rgba(255,255,255,.14); box-shadow: 0 6px 16px rgba(0,0,0,.25); }

.suggestion-fill.bar-red{background: linear-gradient(90deg, rgba(255,92,122,.95), rgba(255,92,122,.35)); box-shadow:0 0 14px rgba(255,92,122,.20);}

.suggestion-fill.bar-yellow{background: linear-gradient(90deg, rgba(255,209,102,.95), rgba(255,209,102,.35)); box-shadow:0 0 14px rgba(255,209,102,.18);}

.suggestion-fill.bar-blue{background: linear-gradient(90deg, rgba(35,180,255,.95), rgba(35,180,255,.35)); box-shadow:0 0 14px rgba(35,180,255,.18);}

.suggestion-fill.bar-black{background: linear-gradient(90deg, rgba(120,130,150,.9), rgba(120,130,150,.25));}

.suggestion-fill.bar-white{background: linear-gradient(90deg, rgba(232,238,252,.95), rgba(232,238,252,.35));}

.status-ok{ color: var(--ok); }
.status-warn{ color: var(--warn); }
.status-bad{ color: var(--bad); }

.rgbInputs{ display:flex; gap:8px; align-items:center; flex-wrap:wrap; }
.rgbInputs input{ width:72px; }
.chip{ display:inline-flex; align-items:center; gap:8px; padding:8px 10px; border-radius:999px; border:1px solid var(--stroke); background: rgba(255,255,255,.03); }
.chip input{ width:16px; height:16px; }

.inlineEditor{
  margin-top:10px;
  padding:10px 10px;
  border-radius:14px;
  border:1px dashed rgba(35,180,255,.25);
  background: rgba(255,255,255,.02);
}

.muted.tiny{font-size:11px; opacity:.78; margin-top:4px;}

.status-info{color:#c7d8ff;}
#selPigmentSystem{
  padding:8px 10px;
  border-radius:10px;
  border:1px solid rgba(255,255,255,.12);
  background:rgba(0,0,0,.25);
  color:#fff;
}

.suggestion-fill.bar-magenta{background: linear-gradient(90deg, rgba(232,67,147,.95), rgba(232,67,147,.35)); box-shadow:0 0 14px rgba(232,67,147,.18);}
.suggestion-fill.bar-violet{background: linear-gradient(90deg, rgba(135,98,255,.95), rgba(135,98,255,.35)); box-shadow:0 0 14px rgba(135,98,255,.18);}
.suggestion-fill.bar-cyanblue{background: linear-gradient(90deg, rgba(63,170,255,.95), rgba(63,170,255,.35)); box-shadow:0 0 14px rgba(63,170,255,.18);}
.suggestion-fill.bar-warmyellow{background: linear-gradient(90deg, rgba(255,182,41,.95), rgba(255,182,41,.35)); box-shadow:0 0 14px rgba(255,182,41,.18);}


/* ===== V43 固定4个建议色浆位置 ===== */
.suggestFixed{
  min-height: 190px;
  display:block;
}
.suggest-head{
  min-height:54px;
  line-height:1.55;
  margin-bottom:8px;
  opacity:.92;
}
.suggest-grid{
  display:grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap:10px;
  align-items:stretch;
}
.suggest-slot{
  min-height:104px;
  padding:10px;
  border:1px solid rgba(255,255,255,.10);
  background:rgba(0,0,0,.18);
  border-radius:12px;
  display:flex;
  flex-direction:column;
  justify-content:space-between;
}
.slot-rank{
  font-size:12px;
  opacity:.65;
}
.slot-name{
  font-size:13px;
  min-height:20px;
  white-space:nowrap;
  overflow:hidden;
  text-overflow:ellipsis;
}
.slot-percent{
  font-size:18px;
  font-weight:700;
  color:#39a7ff;
}
.suggest-slot .suggestion-bar{
  height:10px;
  margin-top:6px;
}
@media (max-width:600px){
  .suggest-grid{
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .suggestFixed{ min-height: 300px; }
}
