* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: #141619; color: #e6e8eb;
  font-family: "Pretendard", "Malgun Gothic", system-ui, sans-serif;
  font-size: 14px;
}
#app { display: flex; height: 100vh; }

#stage {
  flex: 1; position: relative; display: flex; align-items: center; justify-content: center;
  overflow: hidden; padding: 24px;
  background:
    linear-gradient(45deg, #1b1d21 25%, transparent 25%, transparent 75%, #1b1d21 75%),
    linear-gradient(45deg, #1b1d21 25%, transparent 25%, transparent 75%, #1b1d21 75%);
  background-color: #17191c; background-size: 24px 24px; background-position: 0 0, 12px 12px;
}
#stage.over #drop { border-color: #f27a8a; color: #fff; }
#drop {
  border: 2px dashed #3a3f47; border-radius: 12px; padding: 56px 64px; text-align: center; color: #9aa1ab;
}
#drop .big { font-size: 20px; color: #e6e8eb; margin: 0 0 8px; }
#drop .small { font-size: 12px; margin-top: 18px; }
#view { position: absolute; box-shadow: 0 8px 40px rgba(0,0,0,.5); }
#stage { touch-action: none; }
#zoomReset { position: absolute; right: 16px; top: 16px; height: 34px; background: rgba(20,22,25,.85); z-index: 2; }
#status {
  position: absolute; left: 50%; bottom: 20px; transform: translateX(-50%);
  background: rgba(0,0,0,.75); padding: 8px 14px; border-radius: 6px; font-size: 13px;
}

#panel {
  width: 300px; background: #1e2126; border-left: 1px solid #2a2e35;
  display: flex; flex-direction: column; overflow-y: auto; padding: 16px 18px;
}
.topbar { display: flex; gap: 8px; }
.topbar .btn { flex: 1; }
#faceinfo { margin: 12px 0 4px; font-size: 13px; color: #9aa1ab; }
#faceinfo.ok { color: #8fd19e; }
#faceinfo.bad { color: #f2a07a; }

section { border-top: 1px solid #2a2e35; padding: 12px 0 4px; margin-top: 10px; }
h2 { font-size: 13px; font-weight: 600; color: #f27a8a; margin: 0 0 10px; }

.ctl { margin-bottom: 14px; }
.ctl .lab { display: flex; justify-content: space-between; margin-bottom: 6px; }
.ctl .val { color: #9aa1ab; font-variant-numeric: tabular-nums; }
input[type=range] { width: 100%; accent-color: #f27a8a; height: 18px; cursor: pointer; }
input[type=range]:disabled { opacity: .4; cursor: default; }

.btn {
  display: inline-flex; align-items: center; justify-content: center;
  height: 36px; padding: 0 12px; border-radius: 6px; border: 1px solid #353a42;
  background: #262a30; color: #e6e8eb; font: inherit; cursor: pointer; user-select: none;
}
.btn:hover:not(:disabled) { background: #2e333a; }
.btn:disabled { opacity: .4; cursor: default; }
.btn.primary { background: #f27a8a; border-color: #f27a8a; color: #1a0f12; font-weight: 600; }
.btn.primary:hover { background: #f58e9c; }

.bottom { margin-top: auto; padding-top: 14px; border-top: 1px solid #2a2e35; display: flex; flex-direction: column; gap: 8px; }
.bottom .row { display: flex; gap: 8px; }
.bottom .row .btn { flex: 1; }
#compare.down { background: #3a3f47; }
.hint { font-size: 12px; color: #7d848e; margin: 4px 0 0; line-height: 1.5; }

#marks { position: absolute; pointer-events: auto; }
#marks.hand { cursor: pointer; }
#pick { display: flex; flex-direction: column; gap: 8px; margin-top: 8px; }
#chips { display: flex; flex-wrap: wrap; gap: 6px; }
#chips button {
  height: 30px; min-width: 64px; padding: 0 10px; border-radius: 6px; border: 1px solid #353a42;
  background: #262a30; color: #e6e8eb; font: inherit; font-size: 13px; cursor: pointer;
}
#chips button.on { background: #f27a8a; border-color: #f27a8a; color: #1a0f12; font-weight: 600; }
.chk { display: flex; align-items: center; gap: 6px; font-size: 13px; color: #c3c8cf; cursor: pointer; }
.chk input { accent-color: #f27a8a; margin: 0; }
#bodynote { font-weight: 400; color: #9aa1ab; font-size: 12px; margin-left: 6px; }
section .hint { margin: -6px 0 6px; }
#pickFace { width: 100%; margin-top: 8px; }
#pickFace.on { background: #7fe0c4; border-color: #7fe0c4; color: #10201b; font-weight: 600; }
#pickHint { color: #7fe0c4; margin-top: 6px; }
#marks.picking { cursor: crosshair; }
#spotTool { display: flex; flex-direction: column; gap: 8px; margin: 2px 0 12px; }
#spotTool .lab { display: flex; justify-content: space-between; }
#spotTool .row { display: flex; gap: 8px; }
#spotTool .row .btn { flex: 1; height: 32px; font-size: 13px; }
#spotBtn.on { background: #7fe0c4; border-color: #7fe0c4; color: #10201b; font-weight: 600; }
#spotOpts { display: flex; flex-direction: column; gap: 6px; }
#spotOpts[hidden] { display: none; }
#spotOpts .hint { color: #7fe0c4; margin: 0; }
#marks.spotting { cursor: none; }

/* ───────── 휴대폰 (html.mobile) ───────── */
#mTop, #mSheet, .mo { display: none; }
#marks { touch-action: none; }
html.mobile .pc { display: none; }
html.mobile .mo { display: block; }
html.mobile, html.mobile body { height: 100%; overflow: hidden; overscroll-behavior: none; }
html.mobile body { font-size: 15px; -webkit-tap-highlight-color: transparent; }
html.mobile #app { flex-direction: column; height: 100dvh; }
html.mobile #panel { display: none; }
html.mobile #mTop {
  display: flex; gap: 8px; order: -1;
  padding: calc(env(safe-area-inset-top) + 8px) 12px 8px; background: #141619;
}
html.mobile #mTop .btn { flex: 1; height: 42px; font-size: 15px; }
html.mobile #compare { -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; touch-action: none; }
html.mobile #stage { flex: 1; min-height: 0; padding: 8px; }
html.mobile #drop { padding: 36px 20px; border-radius: 12px; }
html.mobile #drop .big { font-size: 18px; }
html.mobile #status { bottom: 12px; width: max-content; max-width: calc(100% - 32px); text-align: center; font-size: 14px; }
#status .btn { margin-top: 8px; width: 100%; }

html.mobile #mSheet {
  display: block; background: #1e2126; border-top: 1px solid #2a2e35;
  padding-bottom: env(safe-area-inset-bottom); border-radius: 14px 14px 0 0;
}
#mHandle { display: none; }
html.mobile #mSheet.open #mHandle {
  display: block; height: 22px; position: relative; cursor: pointer;
}
html.mobile #mSheet.open #mHandle::after {
  content: ""; position: absolute; left: 50%; top: 9px; width: 40px; height: 4px; margin-left: -20px;
  border-radius: 2px; background: #3a3f47;
}
html.mobile #mBody { max-height: 0; overflow: hidden; transition: max-height .25s ease; }
html.mobile #mSheet.open #mBody { max-height: 42dvh; overflow-y: auto; -webkit-overflow-scrolling: touch; }
html.mobile #mBody > * { padding: 2px 18px 6px; }
html.mobile #mBody section { border-top: none; margin: 0; }
html.mobile #mBody h2 { font-size: 13px; margin-bottom: 8px; }
html.mobile #mBody #faceinfo { margin-top: 0; }

html.mobile #tabs {
  display: flex; gap: 2px; overflow-x: auto; padding: 6px 8px 4px;
  scrollbar-width: none; scroll-snap-type: x proximity;
}
html.mobile #tabs::-webkit-scrollbar { display: none; }
html.mobile #tabs button {
  flex: 0 0 auto; min-width: 64px; height: 46px; padding: 0 14px; scroll-snap-align: start;
  border: none; border-radius: 8px; background: transparent; color: #aeb4bc; font: inherit; font-size: 15px;
}
html.mobile #tabs button.on { background: #2a2e35; color: #f27a8a; font-weight: 600; }
html.mobile #tabs button.act { color: #e6e8eb; }
html.mobile #tabs button:disabled { opacity: .35; }
html.mobile #tabs .sep { flex: 0 0 1px; background: #2f343b; margin: 10px 4px; }

/* 손가락으로 잡기 쉬운 막대 */
html.mobile input[type=range] { -webkit-appearance: none; appearance: none; height: 34px; background: transparent; }
html.mobile input[type=range]::-webkit-slider-runnable-track { height: 4px; border-radius: 2px; background: #3a3f47; }
html.mobile input[type=range]::-webkit-slider-thumb {
  -webkit-appearance: none; width: 26px; height: 26px; margin-top: -11px; border-radius: 50%;
  background: #f27a8a; border: 3px solid #1e2126; box-shadow: 0 0 0 1px #f27a8a;
}
html.mobile .ctl { margin-bottom: 6px; }
html.mobile .ctl .lab { margin-bottom: 0; }
html.mobile .chk { font-size: 15px; padding: 4px 0; }
html.mobile .chk input { width: 18px; height: 18px; }
html.mobile #chips button { height: 36px; font-size: 14px; }
html.mobile #pickFace { height: 40px; }
