:root {
  --bg: #121316; --panel: #1b1c21; --panel2: #24262c; --line: #30323a;
  --text: #f3f4f6; --sub: #9aa0aa; --accent: #ff4f81; --accent2: #ff8a5c;
  --radius: 14px;
  font-family: "Pretendard Variable", Pretendard, -apple-system, "Apple SD Gothic Neo", "Malgun Gothic", sans-serif;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text); }
body { display: flex; flex-direction: column; overflow: hidden; }
button { font: inherit; color: inherit; cursor: pointer; border: 0; background: none; }
button:disabled { opacity: .4; cursor: default; }

.top { display: flex; align-items: center; gap: 12px; padding: 10px 14px; padding-top: max(10px, env(safe-area-inset-top)); border-bottom: 1px solid var(--line); background: var(--bg); z-index: 3; }
.brand { display: flex; align-items: center; gap: 8px; font-weight: 800; font-size: 17px; letter-spacing: -0.02em; }
.brand img { width: 28px; height: 28px; border-radius: 8px; }
.status { flex: 1; min-width: 0; font-size: 12.5px; color: var(--sub); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.status.ok { color: #7ee0b0; }
.status.warn { color: #ffc46b; }
.actions { display: flex; gap: 8px; }
.primary { background: linear-gradient(135deg, var(--accent), var(--accent2)); color: #fff; font-weight: 700; padding: 9px 16px; border-radius: 999px; }
.primary.big { font-size: 17px; padding: 14px 34px; margin: 8px 0 4px; }
.ghost { border: 1px solid var(--line); padding: 8px 14px; border-radius: 999px; color: var(--text); }
.link { color: var(--sub); font-size: 13px; text-decoration: underline; padding: 6px 2px; }

.layout { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.stage { position: relative; flex: 1; min-height: 0; display: flex; align-items: center; justify-content: center; overflow: hidden;
  background: radial-gradient(circle at 50% 40%, #1d1f25 0%, #111215 70%); }
.canvas-wrap { position: relative; line-height: 0; box-shadow: 0 10px 40px rgba(0,0,0,.45); }
.canvas-wrap[hidden] { display: none; }
#gl { display: block; }
#overlay { position: absolute; left: 0; top: 0; pointer-events: none; touch-action: none; }
#overlay.drag { pointer-events: auto; cursor: ns-resize; }

.empty { text-align: center; padding: 24px; }
.empty-card { max-width: 380px; margin: auto; }
.empty-icon { width: 92px; height: 92px; margin: 0 auto 14px; border-radius: 28px; display: grid; place-items: center; color: #fff;
  background: linear-gradient(135deg, var(--accent), var(--accent2)); box-shadow: 0 12px 30px rgba(255,79,129,.35); }
.empty h1 { font-size: 24px; margin: 6px 0 8px; letter-spacing: -0.03em; }
.empty p { color: var(--sub); line-height: 1.6; margin: 0 0 12px; }
.empty .hint { font-size: 12.5px; margin-top: 14px; }
.stage.dragover { outline: 3px dashed var(--accent); outline-offset: -12px; }

.compare { position: absolute; left: 12px; bottom: 12px; display: flex; align-items: center; gap: 6px; background: rgba(20,21,25,.78); backdrop-filter: blur(6px);
  border: 1px solid rgba(255,255,255,.12); padding: 8px 12px; border-radius: 999px; font-size: 12.5px; user-select: none; -webkit-user-select: none; touch-action: none; }
.compare[hidden] { display: none; }
.compare.on { background: var(--accent); }
.toast { position: absolute; left: 50%; top: 14px; transform: translateX(-50%) translateY(-8px); background: rgba(20,21,25,.92); border: 1px solid var(--line);
  padding: 9px 14px; border-radius: 12px; font-size: 13px; opacity: 0; transition: .25s; pointer-events: none; max-width: 90%; text-align: center; z-index: 5; }
.toast.show { opacity: 1; transform: translateX(-50%); }
.busy::after { content: ""; position: absolute; inset: 0; background: rgba(0,0,0,.25); }

.panel { background: var(--panel); border-top: 1px solid var(--line); display: flex; flex-direction: column; max-height: 46vh; padding-bottom: env(safe-area-inset-bottom); }
.tabs { display: flex; gap: 2px; padding: 6px 8px 0; overflow-x: auto; scrollbar-width: none; flex-shrink: 0; }
.tabs::-webkit-scrollbar { display: none; }
.tab { flex: 1; min-width: 62px; display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 8px 4px 9px; color: var(--sub); font-size: 12.5px; font-weight: 600; border-bottom: 2px solid transparent; }
.tab svg { width: 22px; height: 22px; }
.tab.active { color: var(--text); border-bottom-color: var(--accent); }
.controls { flex: 1; overflow-y: auto; padding: 12px 16px 6px; border-top: 1px solid var(--line); scrollbar-width: thin; scrollbar-color: #3a3d46 transparent; }
.controls::-webkit-scrollbar { width: 6px; }
.controls::-webkit-scrollbar-thumb { background: #3a3d46; border-radius: 3px; }
.controls::-webkit-scrollbar-track { background: transparent; }
.panel-foot { display: flex; justify-content: space-between; align-items: center; padding: 4px 16px 8px; }
.ver { color: #5d626c; font-size: 11px; }

.sec-title { font-size: 12px; color: var(--sub); margin: 12px 0 6px; font-weight: 600; }
.note { font-size: 12.5px; color: var(--sub); line-height: 1.55; background: var(--panel2); border-radius: 10px; padding: 9px 11px; margin: 4px 0 10px; }
.note.warn { color: #ffd59a; }
.ctl { margin: 6px 0 12px; }
.ctl-head { display: flex; justify-content: space-between; align-items: baseline; font-size: 14px; margin-bottom: 4px; }
.ctl-head .val { color: var(--sub); font-variant-numeric: tabular-nums; font-size: 13px; min-width: 34px; text-align: right; }
.ctl-head .val.on { color: var(--accent); font-weight: 700; }
input[type=range] { -webkit-appearance: none; appearance: none; width: 100%; height: 28px; background: transparent; margin: 0; touch-action: pan-y; }
input[type=range]::-webkit-slider-runnable-track { height: 4px; border-radius: 4px; background: linear-gradient(to right, var(--accent) var(--fillA, 0%), var(--accent) var(--fillB, 0%), #3a3d46 var(--fillB, 0%)); }
input[type=range]::-moz-range-track { height: 4px; border-radius: 4px; background: #3a3d46; }
input[type=range]::-moz-range-progress { height: 4px; background: var(--accent); }
input[type=range]::-webkit-slider-thumb { -webkit-appearance: none; width: 22px; height: 22px; border-radius: 50%; background: #fff; margin-top: -9px; box-shadow: 0 2px 6px rgba(0,0,0,.4); }
input[type=range]::-moz-range-thumb { width: 22px; height: 22px; border-radius: 50%; background: #fff; border: 0; }
input[type=range].center::-webkit-slider-runnable-track { background: linear-gradient(to right, #3a3d46 var(--fillA, 50%), var(--accent) var(--fillA, 50%), var(--accent) var(--fillB, 50%), #3a3d46 var(--fillB, 50%)); }

.btn-row { display: flex; gap: 8px; flex-wrap: wrap; margin: 4px 0 12px; }
.chip { border: 1px solid var(--line); background: var(--panel2); padding: 8px 12px; border-radius: 999px; font-size: 13px; }
.chip.active { border-color: var(--accent); color: #fff; background: rgba(255,79,129,.18); }
.cta { width: 100%; padding: 12px; border-radius: 12px; font-weight: 700; background: linear-gradient(135deg, var(--accent), var(--accent2)); color: #fff; margin: 2px 0 8px; display: flex; align-items: center; justify-content: center; gap: 6px; }
.toggle { display: flex; align-items: center; justify-content: space-between; font-size: 14px; margin: 8px 0 12px; }
.switch { width: 44px; height: 26px; border-radius: 13px; background: #3a3d46; position: relative; transition: .2s; flex-shrink: 0; }
.switch::after { content: ""; position: absolute; left: 3px; top: 3px; width: 20px; height: 20px; border-radius: 50%; background: #fff; transition: .2s; }
.switch.on { background: var(--accent); }
.switch.on::after { left: 21px; }

.filters { display: flex; gap: 10px; overflow-x: auto; padding: 2px 0 10px; scrollbar-width: none; }
.filters::-webkit-scrollbar { display: none; }
.filter { flex-shrink: 0; width: 66px; text-align: center; font-size: 12px; color: var(--sub); }
.filter .th { width: 66px; height: 66px; border-radius: 12px; background: #2a2c33 center/cover no-repeat; border: 2px solid transparent; margin-bottom: 4px; }
.filter.active { color: var(--text); font-weight: 700; }
.filter.active .th { border-color: var(--accent); }
details.more { margin: 2px 0 8px; }
details.more summary { font-size: 13px; color: var(--sub); cursor: pointer; padding: 6px 0; list-style: none; }
details.more summary::before { content: "▸ "; }
details.more[open] summary::before { content: "▾ "; }

@media (min-width: 900px) {
  .layout { flex-direction: row; }
  .panel { width: 380px; max-height: none; border-top: 0; border-left: 1px solid var(--line); }
  .tabs { padding-top: 10px; }
  .filters { flex-wrap: wrap; overflow: visible; gap: 8px; }
  .filter { width: 62px; }
  .filter .th { width: 62px; height: 62px; }
}
@media (max-width: 420px) {
  .brand span { display: none; }
  .ghost { padding: 8px 11px; }
}
