:root {
  --bg: #E6E7E9;
  --panel: #F3F3F4;
  --paper: #FFFFFF;
  --ink: #16171A;
  --ink-2: #41444B;
  --muted: #73767E;
  --line: #CBCED3;
  --line-2: #DFE1E4;
  --stage: #808080;
  --r: 8px;
  --r-lg: 14px;
  --hdr: 60px;
  --shadow: 0 1px 2px rgba(22, 23, 26, .05), 0 4px 14px rgba(22, 23, 26, .04);

  font-family: "Pretendard Variable", Pretendard, -apple-system, "Apple SD Gothic Neo", "Malgun Gothic", sans-serif;
  font-size: 14px;
  line-height: 1.5;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); }
button, input { font: inherit; color: inherit; }
h1, h2, h3 { margin: 0; }
[hidden] { display: none !important; }

.ic {
  width: 16px; height: 16px; flex: none;
  fill: none; stroke: currentColor; stroke-width: 1.75;
  stroke-linecap: round; stroke-linejoin: round;
}
.ic-xl { width: 36px; height: 36px; stroke-width: 1.25; }
.num { font-variant-numeric: tabular-nums; }
.hex { font-variant-numeric: tabular-nums; font-weight: 600; letter-spacing: .01em; }

:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }

/* ---------- header ---------- */
.bar {
  position: sticky; top: 0; z-index: 30;
  height: var(--hdr);
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 0 20px;
  background: var(--panel);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 800; font-size: 17px; letter-spacing: -.02em; }
.brand-mark { display: grid; grid-template-columns: 1fr 1fr; gap: 2px; width: 22px; height: 22px; }
.brand-mark i { background: #A3A5AA; border-radius: 3px; transition: background .4s; }
.brand-mark i:nth-child(2) { background: #8B8D92; }
.brand-mark i:nth-child(3) { background: #6E7075; }
.brand-mark i:nth-child(4) { background: #C4C6CA; }
.bar-actions { display: flex; gap: 8px; flex-wrap: wrap; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  height: 34px; padding: 0 12px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--r);
  font-weight: 500; white-space: nowrap; cursor: pointer;
}
.btn:hover { border-color: var(--ink-2); }
.btn:disabled { opacity: .45; cursor: not-allowed; border-color: var(--line); }
.btn.primary { background: var(--ink); border-color: var(--ink); color: #fff; }
.btn.primary:hover { background: #2C2E33; }
.btn.ghost { background: transparent; }
.btn.sm { height: 30px; padding: 0 10px; font-size: 13px; }
.btn[aria-pressed="true"] { background: var(--ink); border-color: var(--ink); color: #fff; }
.btn.danger { color: #A3261B; }
.btn.danger.armed { background: #A3261B; border-color: #A3261B; color: #fff; }

.icon-btn {
  display: grid; place-items: center;
  width: 32px; height: 32px; padding: 0;
  background: transparent; border: 1px solid transparent; border-radius: var(--r);
  cursor: pointer;
}
.icon-btn:hover { border-color: var(--line); background: var(--paper); }

/* ---------- layout ---------- */
.layout { display: grid; grid-template-columns: minmax(0, 1fr) 400px; min-height: calc(100vh - var(--hdr)); }
.work { display: flex; flex-direction: column; gap: 20px; min-width: 0; padding: 20px; }
.top { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 20px; align-items: start; }
.panel { background: var(--panel); border: 1px solid var(--line-2); border-radius: var(--r-lg); box-shadow: var(--shadow); }

.sec-title { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; flex-wrap: wrap; }
.sec-title h2 { font-size: 15px; font-weight: 700; letter-spacing: -.01em; }
.sec-title small { font-size: 12px; color: var(--muted); }
.count { margin-left: 4px; font-weight: 500; color: var(--muted); font-variant-numeric: tabular-nums; }

/* ---------- stage ---------- */
.stage {
  position: relative;
  display: grid; place-items: center;
  min-height: 460px; padding: 24px;
  background: var(--stage);
  border-radius: var(--r-lg);
  overflow: hidden;
}
.stage.dragging { box-shadow: inset 0 0 0 2px #fff; }
.frame img, .frame canvas { border-radius: 6px; }
.drop {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px;
  width: 100%; min-height: 412px; padding: 24px;
  background: transparent;
  border: 1.5px dashed rgba(255, 255, 255, .55);
  border-radius: 10px;
  color: #fff; text-align: center; cursor: pointer;
}
.drop:hover { border-style: solid; background: rgba(255, 255, 255, .06); }
.drop strong { font-size: 16px; font-weight: 600; }
.drop span { font-size: 13px; color: rgba(255, 255, 255, .78); max-width: 34ch; }

.frame { position: relative; line-height: 0; cursor: crosshair; }
.frame img { display: block; max-width: 100%; max-height: 64vh; user-select: none; -webkit-user-drag: none; }
.frame canvas { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.pins { position: absolute; inset: 0; pointer-events: none; }
.pin {
  position: absolute;
  display: grid; place-items: center;
  width: 24px; height: 24px;
  transform: translate(-50%, -50%);
  background: var(--c);
  border: 2px solid #fff;
  border-radius: 5px;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, .65), 0 2px 6px rgba(0, 0, 0, .35);
  font-size: 11px; font-weight: 700; line-height: 1;
  animation: pin-in .25s ease-out;
}
.pin .ic { width: 12px; height: 12px; stroke-width: 2.25; }
.pins.small .pin { width: 18px; height: 18px; font-size: 10px; border-width: 1.5px; }
@keyframes pin-in { from { transform: translate(-50%, -50%) scale(.4); opacity: 0; } }

.readout {
  position: absolute; z-index: 3; pointer-events: none;
  display: flex; align-items: center; gap: 6px;
  padding: 4px 8px 4px 4px;
  background: var(--ink); color: #fff;
  border-radius: 5px;
  font-size: 12px; line-height: 1; font-weight: 600; font-variant-numeric: tabular-nums;
}
.readout i { width: 16px; height: 16px; border: 1px solid rgba(255, 255, 255, .45); }
.busy {
  position: absolute; inset: auto 16px 16px auto;
  padding: 6px 10px; background: var(--ink); color: #fff; font-size: 12px; border-radius: 5px;
}

/* ---------- main colors ---------- */
.main-colors { padding: 16px; }
.main-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.main-list .ph { height: 58px; background: var(--line-2); border-radius: var(--r); }
.main-list .ph:nth-child(2) { opacity: .8; } .main-list .ph:nth-child(3) { opacity: .6; }
.main-list .ph:nth-child(4) { opacity: .4; } .main-list .ph:nth-child(5) { opacity: .2; }
.main-item {
  position: relative;
  display: grid; grid-template-columns: 58px minmax(0, 1fr) auto; align-items: center; gap: 12px;
  width: 100%; padding: 6px 12px 10px 6px;
  background: var(--paper);
  border: 1px solid var(--line-2);
  border-radius: var(--r);
  text-align: left; cursor: pointer;
}
.main-item:hover { border-color: var(--ink-2); }
.main-item.is-sel { border-color: var(--ink); box-shadow: inset 0 0 0 1px var(--ink); }
.mi-sw { width: 58px; height: 44px; border-radius: 5px; outline: 1px solid rgba(0, 0, 0, .08); outline-offset: -1px; }
.mi-txt { display: flex; flex-direction: column; min-width: 0; line-height: 1.35; }
.mi-txt span { font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mi-pct { font-size: 20px; font-weight: 700; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.mi-bar { position: absolute; left: 6px; right: 12px; bottom: 4px; height: 2px; background: var(--line-2); }
.mi-bar i { display: block; height: 100%; }

/* ---------- all colors ---------- */
.all { padding: 16px; }
.tools { display: flex; gap: 6px; }
.spectrum {
  display: flex; height: 48px; margin-bottom: 16px;
  border-radius: 10px; overflow: hidden;
  background: var(--line-2);
}
.spectrum button { flex: var(--g) 1 0; min-width: 0; padding: 0; border: 0; background: var(--c); cursor: pointer; }
.spectrum button:hover { box-shadow: inset 0 0 0 2px rgba(255, 255, 255, .85); }
.spectrum button.is-sel { min-width: 6px; box-shadow: inset 0 0 0 2px #fff, inset 0 0 0 3px var(--ink); }

.chips { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 8px; }
.chips-empty { grid-column: 1 / -1; margin: 0; padding: 28px 0; color: var(--muted); text-align: center; }
.chip-break {
  grid-column: 1 / -1;
  display: flex; align-items: center; gap: 10px;
  margin-top: 6px; font-size: 12px; color: var(--muted);
}
.chip-break::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.chip {
  position: relative;
  display: flex; flex-direction: column;
  padding: 0; overflow: hidden;
  background: var(--paper);
  border: 1px solid var(--line-2);
  border-radius: 10px;
  text-align: left; cursor: pointer;
}
.chip:hover { border-color: var(--ink-2); }
.chip.is-sel { border-color: var(--ink); box-shadow: 0 0 0 1px var(--ink); }
.chip .sw { width: 100%; height: 54px; }
.chip .meta { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 0 4px; padding: 6px 8px; font-size: 12px; line-height: 1.35; }
.chip .meta span { color: var(--muted); font-variant-numeric: tabular-nums; }

.badge {
  position: absolute; top: 5px; left: 5px; z-index: 1;
  display: grid; place-items: center;
  min-width: 18px; height: 18px; padding: 0 4px;
  background: var(--ink); color: #fff;
  border-radius: 5px; font-size: 11px; font-weight: 700; line-height: 1;
}
.badge:empty { display: none; }

/* ---------- detail ---------- */
.detail {
  position: sticky; top: var(--hdr);
  height: calc(100vh - var(--hdr));
  overflow: auto;
  margin: 20px 20px 20px 0;
  padding: 20px;
  top: calc(var(--hdr) + 20px);
  height: calc(100vh - var(--hdr) - 40px);
  background: var(--panel);
  border: 1px solid var(--line-2);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow);
}
.d-empty { color: var(--ink-2); }
.d-empty h2 { display: flex; align-items: center; gap: 8px; font-size: 15px; margin-bottom: 8px; }
.d-empty p { margin: 0 0 16px; color: var(--muted); }
.d-empty ul { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.d-empty li { display: grid; grid-template-columns: 20px 1fr; gap: 8px; font-size: 13px; }
.d-empty li .ic { margin-top: 2px; color: var(--muted); }
.kbd { padding: 0 5px; border: 1px solid var(--line); border-bottom-width: 2px; border-radius: 5px; background: var(--paper); font-size: 12px; }

.d-swatch {
  display: flex; align-items: flex-end; justify-content: space-between; gap: 8px;
  height: 148px; padding: 12px 14px;
  border-radius: var(--r);
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .08);
  font-size: 13px;
}
.d-swatch b { font-weight: 600; }
.d-hexrow { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin: 12px 0 10px; }
.d-hexrow .d-pct { margin-right: auto; }
.d-pct { padding: 3px 8px; background: var(--c); border-radius: 6px; font-size: 12px; font-weight: 600; font-variant-numeric: tabular-nums; box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .08); }

/* 드래그용 색 이미지 */
.drag-fig { margin: 0; }
.drag-fig figcaption { display: flex; align-items: center; gap: 6px; margin-top: 6px; font-size: 12px; color: var(--muted); }
.drag-fig figcaption .ic { width: 14px; height: 14px; }
.d-img { display: block; width: 100%; height: auto; border-radius: 10px; outline: 1px solid rgba(0, 0, 0, .08); outline-offset: -1px; cursor: grab; }
.pal-img { display: block; max-width: 100%; height: auto; max-height: 220px; border-radius: 8px; outline: 1px solid var(--line-2); outline-offset: -1px; cursor: grab; }
.cmp-head + .drag-fig { margin-bottom: 14px; }
.main-pal { margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--line-2); }
.pal .drag-fig { margin-bottom: 10px; }
.swimg { display: block; object-fit: fill; }
.swimg, .d-img, .pal-img {
  -webkit-touch-callout: default;   /* 아이패드: 길게 누르면 이미지 드래그/복사 */
  -webkit-user-drag: element;
  -webkit-user-select: none; user-select: none;
}
.d-hex { font-size: 30px; font-weight: 700; letter-spacing: -.01em; font-variant-numeric: tabular-nums; line-height: 1.1; }

.vals { display: flex; flex-direction: column; border-top: 1px solid var(--line-2); }
.val {
  display: grid; grid-template-columns: 76px minmax(0, 1fr) 16px; align-items: center; gap: 8px;
  padding: 7px 2px;
  background: none; border: 0; border-bottom: 1px solid var(--line-2);
  text-align: left; cursor: pointer;
}
.val span { color: var(--muted); font-size: 12px; }
.val b { font-weight: 500; font-variant-numeric: tabular-nums; }
.val .ic { width: 14px; height: 14px; color: var(--muted); opacity: 0; }
.val:hover .ic, .val:focus-visible .ic { opacity: 1; }
.val:hover b { text-decoration: underline; text-underline-offset: 3px; }
.val.static { cursor: default; }
.val.static:hover b { text-decoration: none; }
.pass { display: inline-block; margin-left: 6px; padding: 0 5px; border: 1px solid currentColor; border-radius: 5px; font-size: 11px; font-weight: 600; }
.pass.ok { color: #1F6B3A; }
.pass.no { color: #A3261B; }

.d-sec { margin-top: 24px; padding-top: 16px; border-top: 1px solid var(--line); }
.d-sec > h3 { display: flex; align-items: center; gap: 7px; margin-bottom: 4px; font-size: 14px; font-weight: 700; }
.d-sec > p { margin: 0 0 12px; font-size: 12px; color: var(--muted); }

.mini { padding: 8px; background: var(--stage); border-radius: 10px; line-height: 0; }
.mini canvas { border-radius: 5px; }
.mini-in { position: relative; }
.mini canvas { display: block; width: 100%; height: auto; }
.range { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 10px; margin-top: 10px; font-size: 12px; color: var(--ink-2); }
.range input { width: 100%; accent-color: var(--ink); }
.range output { min-width: 3.5em; text-align: right; font-variant-numeric: tabular-nums; }
.coverage { margin-top: 6px; font-size: 12px; color: var(--muted); }
.coverage b { color: var(--ink); font-variant-numeric: tabular-nums; }

.harm { display: grid; grid-template-columns: 80px minmax(0, 1fr); gap: 10px; align-items: center; margin-bottom: 8px; }
.harm-lb { font-size: 12px; line-height: 1.3; }
.harm-lb small { display: block; color: var(--muted); font-size: 11px; }
.strip { display: flex; height: 44px; border-radius: 5px; overflow: hidden; box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .06); }
.strip-cell { position: relative; flex: 1; min-width: 0; cursor: pointer; }
.strip-cell img { position: absolute; inset: 0; width: 100%; height: 100%; }
.strip-cell span {
  position: absolute; left: 0; right: 0; bottom: 5px;
  text-align: center; pointer-events: none;
  font-size: 10.5px; font-weight: 600; font-variant-numeric: tabular-nums; line-height: 1;
}
.strip-cell.cur::after { content: ""; position: absolute; inset: 0; box-shadow: inset 0 0 0 2px var(--ink), inset 0 0 0 3px #fff; pointer-events: none; }
.strip-cell:hover img { filter: brightness(1.05); }

.sim { display: flex; flex-direction: column; gap: 4px; }
.sim-item {
  position: relative;
  display: grid; grid-template-columns: 36px minmax(0, 1fr) auto; align-items: center; gap: 10px;
  padding: 4px 10px 4px 4px;
  background: var(--paper);
  border: 1px solid var(--line-2);
  border-radius: var(--r);
  text-align: left; cursor: pointer;
}
.sim-item:hover { border-color: var(--ink-2); }
.sim-item.is-sel { border-color: var(--ink); }
.sim-item .sim-sw { width: 36px; height: 28px; border-radius: 5px; }
.sim-item span { font-size: 12px; line-height: 1.3; }
.sim-item span small { display: block; color: var(--muted); }
.sim-item em { font-style: normal; font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.sim-item .badge { display: none; }

.d-actions { display: flex; gap: 8px; margin-top: 24px; }
.d-actions .btn { flex: 1; }

/* compare */
.cmp-head { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 10px; }
.cmp-head h2 { font-size: 15px; }
.cmp-head small { color: var(--muted); font-size: 12px; }
.cmp-cols { display: grid; gap: 4px; }
.cmp-col {
  position: relative;
  display: flex; flex-direction: column; min-width: 0;
  padding: 0; background: var(--paper);
  border: 1px solid var(--line-2); border-radius: var(--r);
  text-align: left; cursor: pointer; overflow: hidden;
}
.cmp-col:hover, .cmp-col.iso { border-color: var(--ink); }
.cmp-col .sw { width: 100%; height: 92px; }
.cmp-col .meta { padding: 6px 7px 7px; font-size: 11.5px; line-height: 1.35; }
.cmp-col .meta b { display: block; font-size: 12px; }
.cmp-col .meta span { color: var(--muted); display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cmp-col .x {
  position: absolute; top: 4px; right: 4px;
  display: grid; place-items: center; width: 20px; height: 20px;
  background: rgba(255, 255, 255, .9); border-radius: 5px; color: var(--ink);
}
.cmp-col .x .ic { width: 12px; height: 12px; }

.legend { display: flex; flex-wrap: wrap; gap: 4px 12px; margin-top: 10px; font-size: 12px; }
.legend button { display: inline-flex; align-items: center; gap: 6px; padding: 2px 4px; background: none; border: 0; cursor: pointer; border-radius: 5px; }
.legend button:hover, .legend button.iso { background: var(--paper); box-shadow: 0 0 0 1px var(--line); }
.legend i { width: 12px; height: 12px; background: var(--c); box-shadow: 0 0 0 1px rgba(0, 0, 0, .2); }
.legend b { font-variant-numeric: tabular-nums; }

.tbl-wrap { overflow-x: auto; }
.tbl { width: 100%; border-collapse: collapse; font-size: 12px; font-variant-numeric: tabular-nums; }
.tbl th, .tbl td { padding: 6px 6px; border-bottom: 1px solid var(--line-2); text-align: left; white-space: nowrap; }
.tbl th { color: var(--muted); font-weight: 500; }
.tbl td i { display: inline-block; width: 10px; height: 10px; margin-right: 6px; background: var(--c); vertical-align: -1px; box-shadow: 0 0 0 1px rgba(0, 0, 0, .2); }

.pairs { display: flex; flex-direction: column; gap: 6px; }
.pair {
  display: grid; grid-template-columns: 72px minmax(0, 1fr); gap: 10px; align-items: center;
  padding: 6px; background: var(--paper); border: 1px solid var(--line-2); border-radius: var(--r);
}
.pair-demo {
  display: grid; place-items: center; height: 48px;
  border-radius: 5px; font-size: 18px; font-weight: 700;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .06);
}
.pair-info { font-size: 12px; line-height: 1.45; }
.pair-info b { font-variant-numeric: tabular-nums; }
.pair-info .n { color: var(--muted); }

/* ---------- modal ---------- */
.modal {
  position: fixed; inset: 0; z-index: 50;
  display: grid; place-items: center;
  padding: 16px;
  background: rgba(22, 23, 26, .55);
}
.dialog {
  display: flex; flex-direction: column;
  width: min(480px, 100%); max-height: 86vh;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: 0 18px 50px rgba(0, 0, 0, .3);
}
.dialog.wide { width: min(860px, 100%); }
.dlg-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 16px 14px 20px; border-bottom: 1px solid var(--line); }
.dlg-head h2 { font-size: 16px; }
.dlg-tools { display: flex; gap: 4px; }
.dlg-body { padding: 20px; overflow: auto; }
.dlg-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 14px 20px; border-top: 1px solid var(--line); }

.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 18px; }
.field span { font-size: 13px; font-weight: 600; }
.field input {
  height: 38px; padding: 0 12px;
  background: var(--paper); border: 1px solid var(--line); border-radius: var(--r);
}
.field input:focus { outline: 2px solid var(--ink); outline-offset: -1px; border-color: var(--ink); }
.seg { margin: 0 0 16px; padding: 0; border: 0; }
.seg legend { margin-bottom: 6px; padding: 0; font-size: 13px; font-weight: 600; }
.seg label {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 12px; margin-bottom: -1px;
  background: var(--paper); border: 1px solid var(--line);
  cursor: pointer;
}
.seg label:first-of-type { border-radius: var(--r) var(--r) 0 0; }
.seg label:last-of-type { border-radius: 0 0 var(--r) var(--r); }
.seg label:has(input:checked) { position: relative; border-color: var(--ink); z-index: 1; }
.seg label:has(input:disabled) { opacity: .45; cursor: not-allowed; }
.seg input { accent-color: var(--ink); margin: 0; }
.seg em { font-style: normal; color: var(--muted); font-variant-numeric: tabular-nums; }
.save-preview { display: flex; flex-wrap: wrap; height: auto; min-height: 36px; border-radius: 5px; overflow: hidden; }
.save-preview i { flex: 1 0 18px; height: 36px; background: var(--c); }

.pal-list { display: flex; flex-direction: column; gap: 12px; }
.pal {
  display: grid; grid-template-columns: 120px minmax(0, 1fr); gap: 16px;
  padding: 12px;
  background: var(--paper); border: 1px solid var(--line-2); border-radius: var(--r);
}
.pal-thumb { aspect-ratio: 1; background: var(--stage); border-radius: 5px; overflow: hidden; display: grid; place-items: center; }
.pal-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.pal-top { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; margin-bottom: 8px; }
.pal-top h3 { font-size: 15px; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pal-top time { flex: none; font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.pal-cells { display: grid; grid-template-columns: repeat(auto-fill, minmax(64px, 1fr)); gap: 4px; margin-bottom: 10px; }
.pal-cell {
  display: flex; flex-direction: column; padding: 0;
  background: none; border: 0; cursor: pointer; text-align: left;
}
.pal-cell img { width: 100%; height: 36px; border-radius: 5px; outline: 1px solid rgba(0, 0, 0, .08); outline-offset: -1px; }
.pal-cell span { margin-top: 3px; font-size: 11px; font-weight: 600; font-variant-numeric: tabular-nums; }
.pal-cell:hover span { text-decoration: underline; }
.pal-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.list-msg { padding: 40px 12px; text-align: center; color: var(--muted); }
.list-msg strong { display: block; margin-bottom: 4px; color: var(--ink); }
.list-msg code { padding: 1px 4px; background: var(--paper); border: 1px solid var(--line-2); border-radius: 5px; font-size: 12px; }

/* ---------- toast ---------- */
.toast {
  position: fixed; left: 50%; bottom: 24px; z-index: 60;
  display: flex; align-items: center; gap: 8px;
  padding: 10px 14px;
  transform: translateX(-50%);
  background: var(--ink); color: #fff;
  border-radius: var(--r);
  font-size: 13px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, .25);
}
.toast i { width: 14px; height: 14px; border: 1px solid rgba(255, 255, 255, .5); }

/* ---------- long-press drag ---------- */
.chip, .main-item, .spectrum button, .strip-cell, .sim-item, .pal-cell,
.cmp-col, .d-swatch, .frame {
  -webkit-user-select: none; user-select: none;
  -webkit-touch-callout: none;
}
.lifted {
  position: relative; z-index: 5;
  transform: scale(.97);
  box-shadow: 0 0 0 2px var(--ink), 0 10px 24px rgba(22, 23, 26, .22) !important;
  cursor: grab;
  transition: transform .15s, box-shadow .15s;
}
.frame.lifted { transform: none; border-radius: 6px; }
.drag-ghost {
  position: fixed; top: -200px; left: -200px;
  display: flex; align-items: center; gap: 8px;
  padding: 6px 12px 6px 6px;
  background: #fff; border-radius: 10px;
  box-shadow: 0 0 0 1px var(--line);
  font: 600 13px "Pretendard Variable", Pretendard, sans-serif; color: var(--ink);
}
.drag-ghost i { width: 32px; height: 32px; border-radius: 7px; box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .1); }

/* ---------- photo history ---------- */
.history { padding: 14px 16px 16px; }
.history .sec-title { margin-bottom: 10px; }
.hist-strip { display: flex; gap: 10px; overflow-x: auto; padding: 2px 2px 6px; scroll-snap-type: x proximity; }
.hist-empty { margin: 0; padding: 10px 0; font-size: 13px; color: var(--muted); }
.hist {
  position: relative; flex: none;
  width: 112px; scroll-snap-align: start;
}
.hist-open {
  display: flex; flex-direction: column; gap: 6px;
  width: 100%; padding: 0;
  background: none; border: 0; text-align: left; cursor: pointer;
}
.hist-img {
  position: relative;
  width: 112px; height: 80px;
  background: var(--stage);
  border-radius: 10px; overflow: hidden;
  box-shadow: 0 0 0 1px var(--line-2);
}
.hist-img img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform .25s; }
.hist-open:hover .hist-img img { transform: scale(1.04); }
.hist.is-cur .hist-img { box-shadow: 0 0 0 2px var(--ink); }
.hist-dots { position: absolute; left: 6px; bottom: 6px; display: flex; gap: 3px; }
.hist-dots i { width: 10px; height: 10px; border-radius: 50%; background: var(--c); box-shadow: 0 0 0 1.5px #fff; }
.hist-meta { font-size: 12px; line-height: 1.3; min-width: 0; }
.hist-meta b { display: block; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hist-meta span { color: var(--muted); font-variant-numeric: tabular-nums; }
.hist-del {
  position: absolute; top: 5px; right: 5px;
  display: grid; place-items: center;
  height: 22px; min-width: 22px; padding: 0 5px;
  background: rgba(255, 255, 255, .92); color: var(--ink);
  border: 0; border-radius: 6px;
  font-size: 11px; font-weight: 600;
  opacity: 0; cursor: pointer;
}
.hist-del .ic { width: 12px; height: 12px; }
.hist:hover .hist-del, .hist-del:focus-visible, .hist-del.armed { opacity: 1; }
.hist-del.armed { background: #A3261B; color: #fff; }
@media (hover: none) { .hist-del { opacity: 1; } }

/* ---------- responsive ---------- */
@media (max-width: 1180px) {
  .layout { grid-template-columns: minmax(0, 1fr); }
  .detail { position: static; height: auto; overflow: visible; margin: 0 20px 20px; }
}
@media (max-width: 860px) {
  .top { grid-template-columns: minmax(0, 1fr); }
  .stage { min-height: 300px; padding: 16px; }
  .drop { min-height: 268px; }
  .work { padding: 16px; }
  .detail { padding: 16px; margin: 0 16px 16px; }
  .bar { height: auto; padding: 10px 16px; flex-wrap: wrap; }
  .pal { grid-template-columns: 72px minmax(0, 1fr); gap: 12px; }
}
@media (max-width: 520px) {
  .bar-actions .btn { padding: 0 9px; font-size: 13px; }
  .chips { grid-template-columns: repeat(auto-fill, minmax(78px, 1fr)); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
