/* ==========================================================================
   Batch Image Studio · dicekorea.com
   셀러용 상품 이미지 일괄 보정기 (100% 클라이언트 · Canvas API)
   외부 CDN·폰트·아이콘 라이브러리 0. CSP `default-src 'self'; style-src 'self';
   script-src 'self'` 환경에서 그대로 동작합니다. 인라인 style/script 없음.
   ========================================================================== */

*, *::before, *::after { box-sizing: border-box; }

:root {
  --bg: #F4F7FC;
  --surface: #FFFFFF;
  --surface-2: #F8FAFE;
  --ink: #0F172A;
  --ink-2: #3B4A63;
  --muted: #6B7A90;
  --line: #E3E9F4;
  --line-soft: #EEF2F9;
  --brand: #2563EB;
  --brand-dark: #1D4ED8;
  --brand-soft: #EDF3FF;
  --green: #0E9F6E;
  --green-soft: #E7F8F0;
  --amber: #B45309;
  --amber-soft: #FEF5E7;
  --red: #D92D20;
  --red-soft: #FEECEB;
  --radius-lg: 20px;
  --radius: 14px;
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, .05);
  --shadow: 0 1px 2px rgba(15, 23, 42, .04), 0 18px 38px -28px rgba(15, 23, 42, .45);
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", "Apple SD Gothic Neo",
          "Malgun Gothic", "Noto Sans KR", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
}

html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.55;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, p, ul, ol, figure { margin: 0; }
ul { padding: 0; list-style: none; }
img, canvas { max-width: 100%; }
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }

.wrap { width: 100%; max-width: 1240px; margin: 0 auto; padding: 0 24px; }

.skip {
  position: absolute; left: -999px; top: 8px; z-index: 100;
  background: var(--brand); color: #fff; padding: 8px 14px; border-radius: 8px;
}
.skip:focus { left: 16px; }

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

/* ---------- top bar ---------- */

.topbar {
  position: sticky; top: 0; z-index: 50;
  background: rgba(255, 255, 255, .9);
  backdrop-filter: saturate(180%) blur(12px);
  -webkit-backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid var(--line);
}
.topbar__inner {
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px; height: 64px;
}
.brand { display: inline-flex; align-items: center; gap: 10px; color: var(--ink); }
.brand:hover { text-decoration: none; }
.brand__mark {
  display: grid; place-items: center;
  width: 34px; height: 34px; border-radius: 11px;
  background: linear-gradient(150deg, #3B82F6, #1D4ED8);
  color: #fff; font-weight: 700; font-size: 16px;
  box-shadow: 0 6px 14px -6px rgba(37, 99, 235, .8);
  letter-spacing: -.02em;
}
.brand__text { display: flex; flex-direction: column; line-height: 1.15; }
.brand__text strong { font-size: 15px; letter-spacing: -.01em; white-space: nowrap; }
.brand__text small { font-size: 11.5px; color: var(--muted); letter-spacing: .02em; }

.topbar__actions { display: flex; align-items: center; gap: 10px; }

.seg {
  display: inline-flex; gap: 2px; padding: 3px;
  background: #EEF2F9; border-radius: 11px;
}
.seg button {
  border: 0; background: transparent; cursor: pointer;
  font: inherit; font-size: 12.5px; font-weight: 700; letter-spacing: .02em;
  color: var(--muted); padding: 6px 11px; border-radius: 8px;
  white-space: nowrap;
  transition: background .15s ease, color .15s ease, box-shadow .15s ease;
}
.seg button:hover { color: var(--ink-2); }
.seg button[aria-pressed="true"] {
  background: var(--surface); color: var(--brand);
  box-shadow: var(--shadow-sm);
}
.seg--wide { display: flex; width: 100%; }
.seg--wide button { flex: 1 1 0; padding: 9px 12px; font-size: 12.5px; text-align: center; }
.seg--sm { padding: 2px; border-radius: 9px; }
.seg--sm button { font-size: 11.5px; padding: 5px 10px; border-radius: 7px; }
.seg--grid {
  display: grid; grid-template-columns: 1fr 1fr; gap: 4px;
  width: 100%; padding: 4px; background: #EEF2F9; border-radius: 12px;
}
.seg--grid button {
  font-size: 11.5px; font-weight: 650; line-height: 1.3; white-space: normal;
  padding: 8px 9px; border-radius: 9px; text-align: left;
}
.seg--grid button[aria-pressed="true"] { color: var(--brand); }
.seg--grid2 {
  display: grid; grid-template-columns: 1fr 1fr; gap: 4px;
  width: 100%; padding: 4px; background: #EEF2F9; border-radius: 12px;
}
.seg--grid2 button { font-size: 12px; padding: 7px 8px; border-radius: 9px; text-align: center; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  font: inherit; font-size: 13.5px; font-weight: 650; cursor: pointer;
  padding: 9px 15px; border-radius: 10px; white-space: nowrap;
  border: 1px solid var(--line); background: var(--surface); color: var(--ink-2);
  transition: border-color .15s ease, background .15s ease, color .15s ease, transform .1s ease;
}
.btn:hover { border-color: #C8D5EC; background: var(--surface-2); }
.btn:active { transform: translateY(1px); }
.btn--primary {
  background: var(--brand); border-color: var(--brand); color: #fff;
  box-shadow: 0 8px 18px -12px rgba(37, 99, 235, .95);
}
.btn--primary:hover { background: var(--brand-dark); border-color: var(--brand-dark); color: #fff; }
.btn--ghost { background: transparent; border-color: transparent; color: var(--muted); }
.btn--ghost:hover { background: #EEF2F9; color: var(--ink-2); }
.btn--sm { padding: 6px 10px; font-size: 12.5px; border-radius: 8px; }
.btn--lg { width: 100%; padding: 13px 18px; font-size: 14.5px; border-radius: 12px; }
.btn--danger { color: var(--red); border-color: #F4D3D0; background: #fff; }
.btn--danger:hover { background: var(--red-soft); border-color: #EFC4C0; }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn__count {
  display: inline-grid; place-items: center; min-width: 22px; height: 20px;
  padding: 0 6px; margin-left: 2px; border-radius: 999px;
  background: rgba(255, 255, 255, .22); font-size: 11.5px; font-variant-numeric: tabular-nums;
}

/* ---------- hero ---------- */

.hero { padding: 44px 0 8px; }
.eyebrow {
  display: inline-flex; align-items: center; gap: 8px;
  font-size: 11.5px; font-weight: 700; letter-spacing: .13em;
  color: var(--brand); text-transform: uppercase;
}
.eyebrow::before {
  content: ""; width: 18px; height: 2px; border-radius: 2px; background: var(--brand);
}
.hero h1 {
  margin-top: 14px;
  font-size: clamp(28px, 4.2vw, 42px);
  line-height: 1.22; letter-spacing: -.035em; font-weight: 700;
  max-width: 20em;
}
.hero h1 em {
  font-style: normal; color: var(--brand);
  background: linear-gradient(transparent 62%, #DCE7FF 62%);
  padding: 0 2px;
}
.hero__sub { margin-top: 14px; max-width: 56em; font-size: 15px; color: var(--ink-2); }
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 18px; }
.chips li {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 12.5px; font-weight: 600; color: var(--ink-2);
  background: var(--surface); border: 1px solid var(--line);
  border-radius: 999px; padding: 6px 12px;
  box-shadow: var(--shadow-sm);
}
.chips li::before { content: "✓"; color: var(--green); font-weight: 700; font-size: 12px; }

/* ---------- cards ---------- */

.card {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius-lg); box-shadow: var(--shadow);
  padding: 22px;
}
.card__head { display: flex; gap: 12px; align-items: flex-start; margin-bottom: 18px; }
.card__head--row { justify-content: space-between; align-items: flex-start; gap: 16px; flex-wrap: wrap; margin-bottom: 16px; }
.card__head--tight { margin-bottom: 0; }
.card__headMain { display: flex; gap: 12px; align-items: flex-start; }
.card__num {
  flex: none; display: grid; place-items: center;
  width: 26px; height: 26px; border-radius: 9px;
  background: var(--brand-soft); color: var(--brand);
  font-size: 12.5px; font-weight: 700; margin-top: 1px;
}
.card__title { font-size: 15.5px; font-weight: 700; letter-spacing: -.01em; }
.card__hint { margin-top: 2px; font-size: 12.5px; color: var(--muted); }

.card--queue { margin-top: 28px; }

/* ---------- dropzone ---------- */

.dropzone {
  display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
  padding: 16px 18px;
  border: 1.5px dashed #C3D3EC; border-radius: 14px;
  background: linear-gradient(180deg, #FBFDFF, #F4F8FE);
  transition: border-color .15s ease, background .15s ease, box-shadow .15s ease;
}
.dropzone.is-over {
  border-color: var(--brand); background: var(--brand-soft);
  box-shadow: 0 0 0 4px rgba(37, 99, 235, .1) inset;
}
.dropzone__icon {
  flex: none; display: grid; place-items: center;
  width: 42px; height: 42px; border-radius: 12px;
  background: #fff; border: 1px solid var(--line); color: var(--brand);
}
.dropzone__text { display: flex; flex-direction: column; gap: 1px; min-width: 0; flex: 1 1 220px; }
.dropzone__text strong { font-size: 13.5px; font-weight: 700; }
.dropzone__text span { font-size: 12px; color: var(--muted); }
.dropzone__actions { display: flex; gap: 8px; flex-wrap: wrap; }
.dropzone__actions .btn { flex: none; }

/* ---------- queue ---------- */

.queue {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(112px, 1fr));
  gap: 10px; margin-top: 16px;
  max-height: 268px; overflow-y: auto; padding: 2px;
}
.thumb-item { position: relative; display: flex; min-width: 0; }
.thumb {
  position: relative; display: flex; flex-direction: column;
  width: 100%;
  border: 1.5px solid var(--line); border-radius: 12px; overflow: hidden;
  background: #fff; cursor: pointer; text-align: left;
  font: inherit; color: inherit; padding: 0;
  transition: border-color .15s ease, box-shadow .15s ease, transform .1s ease;
}
.thumb:hover { border-color: #B9CBEA; box-shadow: var(--shadow-sm); }
.thumb[aria-current="true"] {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, .16);
}
.thumb__box {
  position: relative; display: grid; place-items: center;
  aspect-ratio: 1 / 1; background:
    repeating-conic-gradient(#F1F5FB 0% 25%, #FFFFFF 0% 50%) 50% / 12px 12px;
}
.thumb__box img { width: 100%; height: 100%; object-fit: contain; display: block; }
.thumb__idx {
  position: absolute; top: 5px; left: 5px;
  font-size: 10px; font-weight: 700; color: #fff;
  background: rgba(15, 23, 42, .62); border-radius: 5px; padding: 1px 5px;
  font-variant-numeric: tabular-nums;
}
.thumb__name {
  font-size: 10.5px; color: var(--muted); padding: 5px 7px 6px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.thumb__x {
  position: absolute; top: 4px; right: 4px; z-index: 2;
  width: 20px; height: 20px; border-radius: 50%; border: 0;
  display: grid; place-items: center;
  background: rgba(255, 255, 255, .9); color: var(--ink-2);
  font-size: 13px; line-height: 1; cursor: pointer; padding: 0;
  box-shadow: 0 1px 3px rgba(15, 23, 42, .16);
}
.thumb__x:hover { background: var(--red); color: #fff; }

/* ---------- studio grid ---------- */

.studio {
  display: grid;
  grid-template-columns: minmax(0, 400px) minmax(0, 1fr);
  gap: 20px; align-items: start; margin-top: 20px;
}
.settings { display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.stage { display: flex; flex-direction: column; gap: 14px; min-width: 0; }

/* ---------- fields ---------- */

.fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field--wide { grid-column: 1 / -1; }
.field > .seg { align-self: flex-start; }
.field__row { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }

.field > label,
.field .label {
  display: flex; align-items: baseline; gap: 6px;
  font-size: 12.5px; font-weight: 650; color: var(--ink-2);
}
.field__row label { font-size: 12.5px; font-weight: 650; color: var(--ink-2); }
.val {
  font-size: 12px; font-weight: 700; color: var(--brand);
  font-variant-numeric: tabular-nums;
  background: var(--brand-soft); border-radius: 6px; padding: 1px 7px;
}
.readout {
  display: inline-flex; align-items: center; gap: 8px;
  font-size: 13px; font-weight: 700; color: var(--ink);
  font-variant-numeric: tabular-nums;
  background: var(--surface-2); border: 1px solid var(--line-soft);
  border-radius: 10px; padding: 8px 12px;
}
.readout::before {
  content: ""; width: 7px; height: 7px; border-radius: 50%;
  background: var(--brand);
}

.pair { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
#customSizeRow { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.pair label { font-size: 12.5px; font-weight: 650; color: var(--ink-2); }
.pair input { max-width: 100%; }

input[type="text"], input[type="number"], input[type="search"], select, textarea {
  width: 100%;
  padding: 10px 12px;
  font: inherit; font-size: 14px; color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--line); border-radius: 10px;
  transition: border-color .15s ease, box-shadow .15s ease, background .15s ease;
  appearance: none; -webkit-appearance: none;
}
input[type="text"], select { height: 42px; padding-top: 0; padding-bottom: 0; }
input[type="number"] { height: 42px; }
textarea { resize: vertical; min-height: 92px; line-height: 1.55; }
input:hover, select:hover, textarea:hover { border-color: #CFD9EA; }
input:focus, select:focus, textarea:focus {
  outline: none; border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, .16);
}
input::placeholder, textarea::placeholder { color: #A6B2C4; }

.fi-note { font-size: 11.5px; color: var(--muted); line-height: 1.5; }
.fi-note strong { color: var(--ink-2); font-weight: 650; }
.fi-note.names {
  font-family: var(--mono); font-size: 11px; letter-spacing: -.01em;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

.is-hidden { display: none !important; }

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* ---------- range ---------- */

input[type="range"] {
  -webkit-appearance: none; appearance: none;
  width: 100%; height: 22px; margin: 0; padding: 0;
  background: transparent; cursor: pointer;
}
input[type="range"]::-webkit-slider-runnable-track {
  height: 6px; border-radius: 999px;
  background: linear-gradient(90deg, #C7D9FA, #E6EEFB);
}
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none;
  width: 18px; height: 18px; margin-top: -6px; border-radius: 50%;
  background: #fff; border: 2.5px solid var(--brand);
  box-shadow: 0 1px 4px rgba(15, 23, 42, .22);
  transition: transform .1s ease;
}
input[type="range"]:active::-webkit-slider-thumb { transform: scale(1.08); }
input[type="range"]::-moz-range-track { height: 6px; border-radius: 999px; background: #DCE7FA; }
input[type="range"]::-moz-range-thumb {
  width: 16px; height: 16px; border-radius: 50%;
  background: #fff; border: 2.5px solid var(--brand);
}
input[type="range"]:focus-visible { outline: none; }
input[type="range"]:focus-visible::-webkit-slider-thumb {
  box-shadow: 0 0 0 4px rgba(37, 99, 235, .2);
}

/* ---------- swatces ---------- */

.swatches { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.swatch {
  display: flex; flex-direction: column; align-items: center; gap: 5px;
  padding: 8px 4px; border-radius: 10px; cursor: pointer;
  border: 1.5px solid var(--line); background: #fff;
  font: inherit; font-size: 11px; font-weight: 650; color: var(--muted);
  transition: border-color .15s ease, color .15s ease;
}
.swatch:hover { border-color: #C4D4EC; color: var(--ink-2); }
.swatch[aria-pressed="true"] { border-color: var(--brand); color: var(--brand); }
.swatch__dot {
  width: 22px; height: 22px; border-radius: 7px;
  border: 1px solid rgba(15, 23, 42, .14); background: #fff;
}
.swatch__dot--alpha {
  background: repeating-conic-gradient(#E7ECF5 0% 25%, #FFFFFF 0% 50%) 50% / 8px 8px;
}
.swatch__dot--custom { background: #EFF6FF; }

.color-row { display: flex; gap: 8px; align-items: center; margin-top: 2px; }
input[type="color"] {
  -webkit-appearance: none; appearance: none;
  width: 44px; height: 42px; padding: 3px; cursor: pointer;
  border: 1px solid var(--line); border-radius: 10px; background: #fff;
}
input[type="color"]::-webkit-color-swatch-wrapper { padding: 0; }
input[type="color"]::-webkit-color-swatch { border: 0; border-radius: 7px; }
.hex { max-width: 120px; font-family: var(--mono); text-transform: uppercase; }

/* ---------- switch ---------- */

.switchrow { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.switch {
  display: inline-flex; align-items: center; gap: 10px;
  border: 0; background: transparent; padding: 0; cursor: pointer;
  font: inherit; font-size: 13px; font-weight: 650; color: var(--ink-2);
}
.switch__track {
  position: relative; display: inline-block;
  width: 40px; height: 23px; border-radius: 999px;
  background: #D6DFEC; transition: background .15s ease; flex: none;
}
.switch__knob {
  position: absolute; top: 2.5px; left: 2.5px;
  width: 18px; height: 18px; border-radius: 50%; background: #fff;
  box-shadow: 0 1px 3px rgba(15, 23, 42, .3);
  transition: transform .16s ease;
}
.switch[aria-checked="true"] .switch__track { background: var(--brand); }
.switch[aria-checked="true"] .switch__knob { transform: translateX(17px); }
.switch:hover .switch__track { filter: brightness(.97); }

.subfields {
  border-top: 1px solid var(--line-soft); padding-top: 14px; margin-top: 2px;
  display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px;
}

/* ---------- preset list ---------- */

.presetform { display: flex; gap: 8px; }
.presetform input { flex: 1 1 auto; }
.presetlist { display: flex; flex-direction: column; gap: 6px; margin-top: 10px; }
.presetlist li { display: flex; align-items: center; gap: 6px; }
.presetlist .chip {
  flex: 1 1 auto; min-width: 0; text-align: left;
  display: flex; flex-direction: column; gap: 0;
  border: 1px solid var(--line); background: var(--surface-2);
  border-radius: 10px; padding: 7px 11px; cursor: pointer;
  font: inherit; color: var(--ink-2); transition: border-color .15s ease, background .15s ease;
}
.presetlist .chip:hover { border-color: var(--brand); background: var(--brand-soft); }
.presetlist .chip strong { font-size: 12.5px; font-weight: 700; }
.presetlist .chip span {
  font-size: 10.5px; color: var(--muted);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.presetlist .del {
  flex: none; width: 28px; height: 28px; border-radius: 8px;
  border: 1px solid var(--line); background: #fff; color: var(--muted);
  cursor: pointer; font-size: 14px; line-height: 1;
}
.presetlist .del:hover { border-color: #EFC4C0; color: var(--red); background: var(--red-soft); }

/* ---------- preview ---------- */

.card--prev { position: static; }
.prev__head {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 14px; flex-wrap: wrap; margin-bottom: 14px;
}
.prev__body { display: flex; flex-direction: column; gap: 12px; }
.prev__bar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.prev__id { display: flex; align-items: center; gap: 8px; min-width: 0; flex: 1 1 auto; }
.prev__id strong {
  font-size: 13px; font-weight: 650; color: var(--ink);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 34ch;
}
.iconbtn {
  flex: none; width: 30px; height: 30px; border-radius: 9px;
  border: 1px solid var(--line); background: #fff; color: var(--ink-2);
  font-size: 16px; line-height: 1; cursor: pointer; padding: 0;
}
.iconbtn:hover { border-color: var(--brand); color: var(--brand); }
.iconbtn:disabled { opacity: .4; cursor: not-allowed; }
#viewSeg { margin-left: auto; }

.frames { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.frame {
  display: flex; flex-direction: column; gap: 6px; min-width: 0;
  border: 1px solid var(--line); border-radius: 14px; padding: 10px;
  background: var(--surface-2);
}
.frame figcaption {
  display: flex; align-items: baseline; justify-content: space-between; gap: 8px;
  font-size: 11.5px; font-weight: 700; color: var(--ink-2);
  letter-spacing: .01em;
}
.frame figcaption em {
  font-style: normal; font-size: 10.5px; font-weight: 650; color: var(--muted);
  font-variant-numeric: tabular-nums;
}
.frame__box {
  display: grid; place-items: center;
  aspect-ratio: 1 / 1; width: 100%; overflow: hidden;
  border-radius: 10px; border: 1px solid var(--line-soft);
}
.frame__box--orig {
  background: repeating-conic-gradient(#F1F5FB 0% 25%, #FFFFFF 0% 50%) 50% / 14px 14px;
}
.frame__box--out {
  background: repeating-conic-gradient(#F1F5FB 0% 25%, #FFFFFF 0% 50%) 50% / 14px 14px;
}
.frame__box img { max-width: 100%; max-height: 100%; object-fit: contain; display: block; }
.frame__box canvas { display: block; max-width: 100%; max-height: 100%; width: auto; height: auto; }

.frames[data-view="orig"] #frameOut { display: none; }
.frames[data-view="out"] #frameOrig { display: none; }
.frames[data-view="orig"], .frames[data-view="out"] { grid-template-columns: 1fr; }
.frames[data-view="orig"] .frame, .frames[data-view="out"] .frame { max-width: 100%; }

.prev__foot {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; flex-wrap: wrap; padding-top: 2px;
}
.prev__actions { display: flex; gap: 8px; flex-wrap: wrap; }
.prev__foot .fi-note { flex: 1 1 220px; font-variant-numeric: tabular-nums; }

/* ---------- 마켓 규격 메모 ---------- */

.card--cheat { padding: 20px 22px; }
.card__num--ghost { background: #EEF2F9; color: var(--muted); font-family: Georgia, "Times New Roman", serif; font-style: italic; }
.cheat { display: flex; flex-direction: column; gap: 1px; margin-top: 12px; }
.cheat li {
  display: grid; grid-template-columns: 96px auto 1fr; align-items: baseline; gap: 10px;
  padding: 8px 10px; border-radius: 9px; font-size: 12.5px;
}
.cheat li:nth-child(odd) { background: var(--surface-2); }
.cheat__market { font-weight: 700; color: var(--ink-2); }
.cheat li b { font-size: 12px; font-weight: 700; color: var(--brand); font-variant-numeric: tabular-nums; white-space: nowrap; }
.cheat__note { color: var(--muted); font-size: 11.5px; }
.cheattips { margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--line-soft); display: flex; flex-direction: column; gap: 5px; }
.cheattips li {
  font-size: 11.5px; color: var(--muted); line-height: 1.5;
  padding-left: 14px; position: relative;
}
.cheattips li::before { content: "·"; position: absolute; left: 4px; color: var(--brand); font-weight: 700; }

/* ---------- empty / pills / toast ---------- */

.empty {
  padding: 34px 20px; text-align: center; color: var(--muted); font-size: 13px;
  border: 1px dashed var(--line); border-radius: var(--radius-lg); background: var(--surface-2);
}
.empty strong { display: block; color: var(--ink-2); font-size: 13.5px; margin-bottom: 4px; }
.empty--queue { padding: 26px 20px; margin-top: 14px; }

.pill {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 4px 10px; border-radius: 999px;
  font-size: 11.5px; font-weight: 700; letter-spacing: .01em;
  white-space: nowrap; font-variant-numeric: tabular-nums;
}
.pill--green { background: var(--green-soft); color: var(--green); }
.pill--amber { background: var(--amber-soft); color: var(--amber); }
.pill--red { background: var(--red-soft); color: var(--red); }
.pill--blue { background: var(--brand-soft); color: var(--brand); }
.pill--grey { background: #EEF2F9; color: var(--muted); }
.pill__dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.pill--local { font-size: 11px; padding: 4px 10px; }

.progress {
  position: fixed; left: 50%; bottom: 74px; transform: translateX(-50%);
  display: flex; align-items: center; gap: 10px;
  background: #0F172A; color: #fff; border-radius: 12px;
  padding: 10px 16px; z-index: 79; font-size: 12.5px; font-weight: 600;
  box-shadow: 0 18px 34px -18px rgba(15, 23, 42, .8);
  max-width: min(92vw, 460px);
}
.progress__bar {
  display: block; width: 84px; height: 5px; border-radius: 999px;
  background: rgba(255, 255, 255, .22); overflow: hidden;
}
.progress__fill { display: block; height: 100%; width: 0; background: #60A5FA; transition: width .15s ease; }

.toast {
  position: fixed; left: 50%; bottom: 26px; transform: translate(-50%, 14px);
  background: #0F172A; color: #fff; font-size: 13px; font-weight: 600;
  padding: 11px 18px; border-radius: 12px; z-index: 80;
  box-shadow: 0 18px 34px -18px rgba(15, 23, 42, .8);
  opacity: 0; pointer-events: none; transition: opacity .2s ease, transform .2s ease;
  max-width: min(92vw, 520px); text-align: center;
}
.toast.is-show { opacity: 1; transform: translate(-50%, 0); }

/* ---------- footer ---------- */

.foot {
  margin: 40px 0 0; padding: 24px 0 46px;
  border-top: 1px solid var(--line);
  color: var(--muted); font-size: 12px; line-height: 1.7;
}
.foot p + p { margin-top: 6px; }
.foot strong { color: var(--ink-2); font-weight: 650; }

/* ---------- responsive ---------- */

@media (max-width: 1080px) {
  .studio { grid-template-columns: minmax(0, 1fr); }
  .settings { order: 2; }
  .stage { order: 1; }
  .cheat li { grid-template-columns: 88px auto 1fr; }
}

@media (max-width: 720px) {
  .wrap { padding: 0 16px; }
  .card { padding: 17px; border-radius: 16px; }
  .fields { grid-template-columns: minmax(0, 1fr); gap: 12px; }
  .subfields { grid-template-columns: minmax(0, 1fr); }
  .topbar__inner { height: 58px; }
  .brand__text small { display: none; }
  .hero { padding-top: 28px; }
  .hero h1 { font-size: 27px; }
  .hero__sub { font-size: 14px; }
  .dropzone { padding: 14px; }
  .dropzone__text { flex: 1 1 100%; }
  .dropzone__actions { width: 100%; }
  .dropzone__actions .btn { flex: 1 1 auto; }
  .queue { grid-template-columns: repeat(auto-fill, minmax(84px, 1fr)); max-height: 220px; }
  .frames { grid-template-columns: 1fr; }
  .cheat li { grid-template-columns: 78px auto; }
  .cheat__note { grid-column: 1 / -1; padding-left: 0; }
  .seg--grid { grid-template-columns: 1fr; }
  .seg--grid button { text-align: center; }
  .swatches { grid-template-columns: repeat(2, 1fr); }
  .prev__id strong { max-width: 18ch; }
  #btnSamplesTop { display: none; }
  .pill--local { display: none; }
}

@media (max-width: 460px) {
  .topbar__actions .btn--ghost { display: none; }
  .prev__foot { justify-content: flex-end; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; scroll-behavior: auto !important; }
}

@media print {
  .topbar, .toast, .btn, .chips, .progress, .settings { display: none !important; }
  body { background: #fff; }
  .card { box-shadow: none; break-inside: avoid; }
}
