:root{
  --bg:#f5f4f0; --surface:#fbfbf9; --panel:#ffffff; --panel-soft:#f7f6f2;
  --ink:#1c1c1a; --ink-hover:#3a3935; --ink-2:#55534d; --sub:#7a776f; --muted:#8a877f;
  --line:#e3e1db; --line-2:#dcdad3; --line-3:#efeee9; --hover:#efeee9; --soft:#f3f2ee; --track:#ebe9e3;
  --accent:#e5357a; /* 리소 핑크 */
  --accent-2:#2f2a8f; /* 리소 블루 */
  --accent-soft:#fde4ee;
  --font:"IBM Plex Sans KR",sans-serif; --mono:"JetBrains Mono",monospace;
}
*{box-sizing:border-box}
[hidden]{display:none !important}
body{margin:0;background:var(--bg);color:var(--ink);font-family:var(--font);-webkit-font-smoothing:antialiased}
button,input{font:inherit;color:inherit}
.mono-label{font-family:var(--mono);font-size:11px;letter-spacing:.12em;color:var(--muted)}
.app{min-height:100vh;display:flex;flex-direction:column}
.topbar{display:flex;align-items:center;justify-content:space-between;gap:16px;padding:16px 28px;border-bottom:1px solid var(--line);background:var(--surface);flex-wrap:wrap}
.brand{display:flex;align-items:baseline;gap:14px;min-width:0;flex-wrap:wrap}
.brand-title{font-size:17px;font-weight:700;letter-spacing:-.01em}
.actions{display:flex;gap:8px;flex-wrap:wrap}
.btn{height:36px;padding:0 14px;background:transparent;border:1px solid var(--line-2);border-radius:999px;font-size:13px;cursor:pointer;white-space:nowrap}
.btn:hover{background:var(--hover)}
.btn--solid{background:var(--ink);color:#fff;border:none;font-weight:500}
.btn--solid:hover{background:var(--ink-hover)}
.btn--small{height:30px;font-size:12px;align-self:flex-start}
.sr-only{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);border:0}
:focus-visible{outline:2px solid var(--accent);outline-offset:2px}
input[type=range]{width:100%;accent-color:var(--accent)}
@media (max-width:640px){ .topbar{padding:14px 16px} }

/* ---------- 레이아웃 ---------- */
.pf{flex:1;width:100%;max-width:1320px;margin:0 auto;padding:28px;display:grid;grid-template-columns:minmax(0,1fr) 320px;gap:28px;align-items:start}
.viewer{display:flex;flex-direction:column;gap:12px;min-width:0;position:sticky;top:16px}
.compare{position:relative;align-self:center;max-width:100%;line-height:0;border-radius:6px;overflow:hidden;background:#ddd9cf;
  box-shadow:0 0 0 1px rgba(0,0,0,.06),0 30px 60px -30px rgba(40,20,40,.45);user-select:none;-webkit-user-select:none;touch-action:pan-y}
.compare canvas{display:block;max-width:100%;height:auto}
#after{position:absolute;inset:0;width:100%;height:100%;clip-path:inset(0 0 0 50%)}
.divider{position:absolute;top:0;bottom:0;left:50%;width:2px;margin-left:-1px;background:#fff;box-shadow:0 0 0 1px rgba(0,0,0,.12);pointer-events:none}
.knob{position:absolute;top:50%;left:50%;width:40px;height:40px;margin:-20px 0 0 -20px;display:grid;place-items:center;border-radius:50%;background:#fff;color:var(--ink);font-size:16px;line-height:1;box-shadow:0 4px 14px rgba(0,0,0,.25);transition:transform .15s}
.compare:focus-within .knob{outline:3px solid var(--accent);outline-offset:2px}
.compare:active .knob{transform:scale(1.08)}
.split{position:absolute;inset:0;width:100%;height:100%;margin:0;opacity:0;pointer-events:none;-webkit-appearance:none;appearance:none}
.compare{cursor:ew-resize}
.tag{position:absolute;top:12px;padding:4px 10px;border-radius:999px;background:rgba(28,28,26,.72);color:#fff;font-family:var(--mono);font-size:11px;letter-spacing:.08em;line-height:1.4;pointer-events:none;transition:opacity .2s}
.tag--l{left:12px}
.tag--r{right:12px;background:var(--accent)}
.busy{position:absolute;right:12px;bottom:12px;line-height:1}
.busy span{display:block;width:18px;height:18px;border-radius:50%;border:2px solid rgba(255,255,255,.4);border-top-color:#fff;animation:spin .7s linear infinite}
.viewer-foot{display:flex;justify-content:space-between;gap:12px;flex-wrap:wrap}
.viewer-tip{font-size:12px;color:var(--sub)}

.panel{display:flex;flex-direction:column;gap:12px}
.effects{display:grid;grid-template-columns:repeat(3,1fr);gap:6px}
.effect{display:flex;flex-direction:column;align-items:center;gap:8px;padding:10px 4px;border:1px solid var(--line-2);border-radius:14px;background:var(--panel);font-size:13px;cursor:pointer;transition:all .15s}
.effect:hover{border-color:var(--ink)}
.effect.is-active{border-color:var(--ink);background:var(--ink);color:#fff}
.effect-sw{width:44px;height:44px;border-radius:50%}
.sw-none{background:conic-gradient(#f59e0b,#ef4444,#8b5cf6,#0ea5e9,#22c55e,#f59e0b)}
.sw-duo{background:linear-gradient(135deg,var(--accent-2) 0 50%,#ff8fb1 50%)}
.sw-half{background-color:#f4efe4;background-image:radial-gradient(circle,#1c1c1a 34%,transparent 37%);background-size:8px 8px;box-shadow:inset 0 0 0 1px var(--line-2)}
.effect.is-active .sw-half{box-shadow:none}

.box{display:flex;flex-direction:column;gap:12px;padding:16px;background:var(--panel);border:1px solid var(--line);border-radius:16px;animation:rise .25s ease}
.box-title{margin:0;font-size:14px;font-weight:700;display:flex;align-items:baseline;gap:8px}
.box-title small{font-weight:400;font-size:12px;color:var(--muted)}
.field{display:flex;flex-direction:column;gap:6px}
.field-label{display:flex;justify-content:space-between;font-size:12.5px;color:var(--ink-2)}
.field-label{align-items:center;gap:8px}
.field .tb-presets{margin-top:2px}
.presets{display:grid;grid-template-columns:repeat(4,1fr);gap:6px}
.presets button{height:36px;border-radius:10px;border:1px solid rgba(0,0,0,.08);cursor:pointer;padding:0;transition:transform .12s}
.presets button:hover{transform:translateY(-2px)}
.presets button.is-active{outline:2px solid var(--ink);outline-offset:2px}
.pair{display:flex;align-items:center;gap:8px}
.color-field{flex:1;display:flex;align-items:center;gap:8px;font-size:12.5px;color:var(--ink-2);cursor:pointer;min-width:0}
input[type=color]{width:38px;height:38px;padding:0;border:1px solid var(--line-2);border-radius:10px;background:none;cursor:pointer;flex:0 0 auto}
input[type=color]::-webkit-color-swatch-wrapper{padding:3px}
input[type=color]::-webkit-color-swatch{border:none;border-radius:7px}
.swap{width:32px;height:32px;border-radius:50%;border:1px solid var(--line-2);background:var(--surface);cursor:pointer;flex:0 0 auto}
.swap:hover{background:var(--hover)}
.ramp{height:10px;border-radius:999px}
.check{display:flex;align-items:center;gap:8px;font-size:13px;cursor:pointer}
.check input{width:16px;height:16px;accent-color:var(--accent)}

.box--save{background:var(--panel-soft)}
.seg{display:flex;background:var(--soft);border-radius:999px;padding:3px;gap:2px;border:1px solid var(--line)}
.seg-btn{flex:1;height:30px;border:none;background:transparent;border-radius:999px;font-family:var(--mono);font-size:12.5px;color:var(--sub);cursor:pointer}
.seg-btn.is-active{background:#fff;color:var(--ink);box-shadow:0 1px 3px rgba(0,0,0,.12)}
.btn--save{height:46px;font-size:14px;background:var(--accent)}
.btn--save:hover{background:#c92563}
.note{margin:0;font-size:12px;line-height:1.6;color:var(--muted)}
.dot{display:inline-block;width:7px;height:7px;border-radius:50%;background:var(--accent);margin-right:6px;vertical-align:1px}

.toast{position:fixed;left:50%;bottom:28px;transform:translate(-50%,20px);background:var(--ink);color:#fff;padding:10px 18px;border-radius:999px;font-size:13px;opacity:0;pointer-events:none;transition:opacity .2s,transform .2s;z-index:100;max-width:calc(100vw - 32px);text-align:center}
.toast.is-show{opacity:1;transform:translate(-50%,0)}
@keyframes rise{from{opacity:0;transform:translateY(6px)}to{opacity:1;transform:none}}
@keyframes spin{to{transform:rotate(360deg)}}

@media (max-width:900px){
  .pf{grid-template-columns:minmax(0,1fr)}
  .viewer{position:static}
}
@media (max-width:640px){
  .pf{padding:16px;gap:16px}
  .viewer-tip{display:none}
  .actions{width:100%}
  .actions .btn{flex:1}
  .knob{width:34px;height:34px;margin:-17px 0 0 -17px}
}
@media (prefers-reduced-motion:reduce){
  *{animation:none !important;transition:none !important}
}

/* 직접 입력칸: 단위(px·%·°)는 흐리게, 숫자는 본문색 */
.tb-num-wrap .tb-num{color:var(--ink)}

/* 다크 모드 (인쇄는 라이트 그대로). 비교 미리보기·저장 PNG·효과 견본은 그대로 둠 */
@media screen{
  :root[data-theme="dark"]{
    color-scheme:dark;
    --bg:#141316; --surface:#19181c; --panel:#1e1d21; --panel-soft:#232226;
    --ink:#eceaee; --ink-hover:#ffffff; --ink-2:#c9c6cd; --sub:#a29fa7; --muted:#8c8991;
    --line:#2f2d33; --line-2:#3a383e; --line-3:#27262b; --hover:#2a292e; --soft:#27262b; --track:#353339;
    --accent:#ff5c98; --accent-soft:rgba(255,92,152,.15);
  }
  :root[data-theme="dark"] .btn--solid,:root[data-theme="dark"] .toast,:root[data-theme="dark"] .effect.is-active,:root[data-theme="dark"] .tb-presets button[aria-pressed="true"]{color:var(--bg)}
  :root[data-theme="dark"] .btn--solid{background:var(--accent)}
  :root[data-theme="dark"] .btn--solid:hover,:root[data-theme="dark"] .btn--save:hover{background:#ff7fae}
  :root[data-theme="dark"] .effect.is-active{border-color:var(--accent);background:var(--accent-soft);color:var(--ink)}
  :root[data-theme="dark"] .compare{box-shadow:0 0 0 1px var(--line-2),0 30px 60px -30px rgba(0,0,0,.7)}
  :root[data-theme="dark"] .knob{color:#1c1c1a}
  :root[data-theme="dark"] .tag--r{background:#e5357a}
  :root[data-theme="dark"] .presets button{border-color:rgba(255,255,255,.1)}
  :root[data-theme="dark"] .seg-btn.is-active{background:var(--line-2);box-shadow:0 1px 3px rgba(0,0,0,.4)}
}
