
:root{
  --bg:#0b1020;
  --card:#111a2e;
  --line:rgba(255,255,255,.12);
  --text:#e5e7eb;
  --muted:rgba(229,231,235,.72);
}
*{box-sizing:border-box}
body{margin:0;background:var(--bg);color:var(--text);font-family:system-ui,-apple-system,Segoe UI,Roboto,Arial,sans-serif;overflow-x:hidden}

/* ===== Layout Width Guardrails =====
   Desktop: within 1250px
   Mobile: within 375px (centered for 375~420px viewports)
*/
#page{
  width:min(1250px, 100%);
  margin:0 auto;
}
@media (max-width: 420px){
  #page{max-width:375px}
}
.top{padding:18px 18px 10px;border-bottom:1px solid var(--line)}
.top h1{margin:0;font-size:18px;font-weight:900}
.sub{margin-top:6px;color:var(--muted);font-size:12px}
.grid{
  display:grid;
  grid-template-columns: 1.2fr .8fr;
  gap:14px;
  padding:14px;
}
@media (max-width: 980px){
  .grid{grid-template-columns:1fr}
}
.card{
  background:var(--card);
  border:1px solid var(--line);
  border-radius:16px;
  padding:14px;
  box-shadow:0 10px 30px rgba(0,0,0,.25);
}
h2{margin:0 0 10px;font-size:14px}
.help{color:var(--muted);font-size:12px;margin-bottom:10px}

.dropzone{
  display:block;
  border:3px solid #3B82F6;
  border-radius:16px;
  padding:22px 14px;
  text-align:center;
  cursor:pointer;
  background:rgba(255,255,255,.03);
}
.dropzone:hover{background:rgba(255,255,255,.06)}
.dropzone.drag-over{
  border-color:#3B82F6;
  background:rgba(59,130,246,.08);
}

.dzTitle{font-weight:900}
.dzHint{margin-top:6px;color:var(--muted);font-size:12px}

.previewWrap{margin:12px 0 0}
.previewStage{
  position:relative;
  width:100%;
  aspect-ratio: 16/9;
  border-radius:14px;
  overflow:hidden;
  background:rgba(255,255,255,.04);
  border:1px solid var(--line);
}
#imgPreview{
  width:100%;
  height:100%;
  object-fit:contain;
  display:block;
  cursor:crosshair;
  user-select:none;
  -webkit-user-drag:none;
}
.pickOverlay{
  position:absolute; inset:0;
  pointer-events:none;
}
.marker{
  position:absolute;
  width:12px;height:12px;
  border-radius:999px;
  border:2px solid rgba(255,255,255,.9);
  box-shadow:0 2px 12px rgba(0,0,0,.5);
  transform: translate(-50%,-50%);
}
.meta{margin-top:10px;color:var(--muted);font-size:12px}

.swatches{
  display:grid;
  grid-template-columns: repeat(6, 1fr);
  gap:10px;
  margin:10px 0 12px;
}
.swatch{
  height:40px;
  border-radius:12px;
  border:2px solid rgba(255,255,255,.14);
  background:#000;
  cursor:pointer;
}
.swatch.is-active{border-color: rgba(59,130,246,.95); box-shadow:0 0 0 3px rgba(59,130,246,.22)}
.swatch:focus{outline:none; box-shadow:0 0 0 3px rgba(99,102,241,.24)}

.row{display:flex; gap:10px; align-items:center; margin-top:10px}
.picked{display:flex; gap:10px; align-items:center; flex:1}
.pickedSwatch{
  width:22px;height:22px;border-radius:8px;border:1px solid rgba(255,255,255,.18);background:#000;
}
.pickedHex{
  font-family: ui-monospace, Menlo, Consolas, monospace;
  font-weight:900;
}

.btn{
  padding:10px 12px;
  border-radius:12px;
  border:1px solid rgba(255,255,255,.14);
  background:rgba(255,255,255,.06);
  color:var(--text);
  font-weight:800;
  cursor:pointer;
  white-space:nowrap;
}
.btn:hover{background:rgba(255,255,255,.1)}
.btn.ghost{background:transparent}
.btn.primary{background:rgba(59,130,246,.95); border-color:rgba(59,130,246,.95); color:#071226}
.btn.primary:hover{filter:brightness(1.05)}

.smallNote{margin-top:10px;color:var(--muted);font-size:12px}
.smallNote code{font-family:ui-monospace,Menlo,Consolas,monospace;background:rgba(255,255,255,.06);padding:2px 6px;border-radius:8px;border:1px solid rgba(255,255,255,.12)}
.hidden{display:none}

/* ===== Debug Panel (DKPPT) ===== */
.dbgFab{
  position:fixed;
  right:14px;
  bottom:14px;
  z-index:99999;
  padding:10px 12px;
  border-radius:999px;
  border:1px solid rgba(255,255,255,.16);
  background:rgba(255,255,255,.08);
  color:var(--text);
  font-weight:900;
  cursor:pointer;
  box-shadow:0 10px 30px rgba(0,0,0,.35);
}
.dbgFab:hover{background:rgba(255,255,255,.12)}
.dbgPanel{
  position:fixed;
  right:14px;
  bottom:64px;
  width:min(520px, calc(100vw - 28px));
  max-height:56vh;
  overflow:hidden;
  z-index:99999;
  border-radius:16px;
  border:1px solid rgba(255,255,255,.14);
  background:rgba(7,11,18,.92);
  box-shadow:0 20px 70px rgba(0,0,0,.55);
  backdrop-filter: blur(10px);
}
.dbgHead{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:10px;
  padding:10px 10px 8px;
  border-bottom:1px solid rgba(255,255,255,.10);
}
.dbgTitle{font-weight:900;font-size:13px}
.dbgBtns{display:flex;gap:8px}
.dbgBtn{
  padding:7px 10px;
  border-radius:12px;
  border:1px solid rgba(255,255,255,.14);
  background:rgba(255,255,255,.06);
  color:var(--text);
  font-weight:900;
  cursor:pointer;
}
.dbgBtn:hover{background:rgba(255,255,255,.10)}
.dbgLog{
  margin:0;
  padding:10px;
  font-size:12px;
  line-height:1.35;
  color:rgba(229,231,235,.92);
  white-space:pre-wrap;
  overflow:auto;
  max-height:calc(56vh - 52px);
  font-family: ui-monospace, Menlo, Consolas, monospace;
}


.modeTitle{
  font-size:20px;
  font-weight:900;
  margin-bottom:8px;
  color:#ffffff;
}

/* resultsSection 앞 반자동 모드 헤더 */
#resultsModeText{margin:18px 14px 8px;}

/* ---------- Semi Auto Results (Set A/B/C) ---------- */
.results{margin:0 14px 96px;}
.resultsHead{display:flex;align-items:flex-end;justify-content:space-between;gap:12px;margin-bottom:12px;}
.resultsSub{color:var(--muted);font-size:12px}
.setGrid{display:grid;grid-template-columns:repeat(3,1fr);gap:12px}
@media (max-width: 980px){
  .setGrid{grid-template-columns:1fr}
}
.setCard{border:1px solid rgba(255,255,255,.12);border-radius:16px;padding:12px;background:rgba(255,255,255,.02)}
.setTop{display:flex;align-items:flex-start;justify-content:space-between;gap:10px;margin-bottom:10px}
.setTitle{font-weight:900;font-size:13px}
.setDesc{color:var(--muted);font-size:12px;margin-top:3px}
.setBadge{font-weight:900;font-size:12px;padding:6px 10px;border-radius:999px;border:1px solid rgba(255,255,255,.14);background:rgba(255,255,255,.06)}
.setSwatches{display:grid;grid-template-columns:1fr 1fr;gap:10px;margin:10px 0 12px}
.setSwatch{display:flex;align-items:center;gap:10px;padding:0px;border-radius:14px;border:1px solid rgba(255,255,255,.10);background:rgba(0,0,0,.10)}
.setSwatch .chip{width:54px;height:42px;border-radius:12px;border:1px solid rgba(255,255,255,.14);background:#000}
.setSwatch .txt{min-width:0;flex:1}
.setSwatch .lab{font-weight:900;font-size:12px;opacity:.95}
.setSwatch .hex{margin-top:2px;font-family:ui-monospace,Menlo,Consolas,monospace;font-weight:900;font-size:12px;color:rgba(229,231,235,.92)}
.miniBtn{padding:8px 10px;border-radius:12px;border:1px solid rgba(255,255,255,.14);background:rgba(255,255,255,.06);color:var(--text);font-weight:900;cursor:pointer;white-space:nowrap}
.miniBtn:hover{background:rgba(255,255,255,.10)}
.setBtns{display:flex;gap:10px;flex-wrap:wrap}

/* Mobile 375px: prevent overflow from swatch rows (chip + text + button) */
@media (max-width: 420px){
  .setSwatches{grid-template-columns:1fr}
  .setSwatch{flex-wrap:wrap;align-items:flex-start}
  .miniBtn{width:100%;text-align:center}
}

/* ---------- Bottom Bar (Semi Refresh) ---------- */
.bottomBar{
  position:fixed;
  /* Align with the centered page frame (desktop 1250px / mobile 375px)
     so it doesn't visually "stick out" on wide screens. */
  left:50%;
  right:auto;
  width:min(1250px, calc(100% - 28px));
  transform:translateX(-50%);
  bottom:14px;
  z-index:99998;
  display:flex;
  align-items:center;
  gap:12px;
  padding:12px;
  border-radius:16px;
  border:1px solid rgba(255,255,255,.14);
  background:rgba(7,11,18,.86);
  backdrop-filter: blur(10px);
  box-shadow:0 20px 70px rgba(0,0,0,.55);
}

@media (max-width: 420px){
  .bottomBar{width:min(375px, calc(100% - 28px));}
}
.bottomHint{color:rgba(229,231,235,.72);font-size:12px;font-weight:800}


/* ===== Banner (Top / Bottom) ===== */
.banner{display:block;flex-shrink:0}
.banner img{width:70%;max-width:900px;height:auto;display:block;border-radius:12px}

/* Top banner (header right) */

/* (1) 상단 배너: 컨테이너 자체를 70% 크기(900*0.7=630px)로 */


/* (2) 이미지는 컨테이너를 100% 채움 */
.banner-top img {
  width: 100%;
}
/* Bottom banner (centered) */
.banner-bottom{  width: 70%;margin:24px auto 0;display:flex;justify-content:center}
.banner-bottom img {
  width: 70%;
}
/* Responsive */
@media (max-width: 980px){
  #headerRoot{flex-direction:column;align-items:flex-start}
  .banner-top{display:none}
}
@media (max-width: 420px){
  .banner-bottom{display:none}
}
#headerSubText,
#headerModeText {
  word-break: keep-all;
  line-break: strict;
}

/* ===== Header layout (banner on top-right, texts below) ===== */
#headerRoot{
  display:block !important;
}
#headerRoot .headerInner{
  max-width:1250px;
  margin:0 auto;
}

#headerRoot .headerTextBlock{
  margin-top:12px;
}

/* Banner sizing: 70% of 900px => 630px, right aligned */
#headerRoot 
#headerRoot .banner-top img{
  width:100%;
  max-width:630px;
  height:auto;
}

/* Prevent awkward Korean character wrapping */
#headerTitle, #headerSubText, #headerModeText{
  word-break:keep-all;
  line-break:strict;
}

@media (max-width: 980px){
  #headerRoot .banner-top{display:none;}
}

/* ===== Top Banner : Center Aligned (authoritative) ===== */
#headerRoot{
  display:block !important;
}

#headerRoot .headerInner{
  max-width:1250px;
  margin:0 auto;
}

#headerRoot .headerBannerRow{
  display:flex;
  justify-content:center; /* centered */
  align-items:center;
}

#headerRoot .banner-top{
  width:min(630px, 100%); /* 70% of 900px = 630px */
  display:flex;
  justify-content:center;
}

#headerRoot .banner-top img{
  width:100%;
  max-width:630px;
  height:auto;
}

/* Prevent awkward Korean character wrapping */
#headerTitle, #headerSubText, #headerModeText{
  word-break:keep-all;
  line-break:strict;
}

/* Mobile: keep existing behavior (hide top banner) */
@media (max-width: 980px){
  #headerRoot .banner-top{display:none;}
}
