:root {
  --ink: #141414;
  --muted: #666a70;
  --line: #d8d4cd;
  --paper: #fffdf9;
  --panel: #f5f2ec;
  --accent: #b91c1c;
  --focus: #1f6feb;
  --soft: #ece7de;
}

@font-face {
  font-family: "Pretendard";
  src: url("./fonts/PretendardVariable.woff2") format("woff2");
  font-weight: 100 900;
  font-display: swap;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  color: var(--ink);
  background: #e9e5dc;
  font-family: "Pretendard", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button,
input,
textarea,
select {
  font: inherit;
}

.app-shell {
  min-height: 100vh;
  padding: 20px;
}

.workspace {
  display: grid;
  grid-template-columns: 390px minmax(0, 1fr);
  gap: 18px;
  max-width: 1440px;
  margin: 0 auto;
}

.control-panel,
.preview-panel {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 8px;
  min-width: 0;
}

.control-panel {
  padding: 18px;
  max-height: calc(100vh - 40px);
  overflow: auto;
}

.preview-panel {
  display: flex;
  flex-direction: column;
  min-height: calc(100vh - 40px);
}

.brand-block {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--line);
}

.logo-text {
  font-size: 24px;
  letter-spacing: 0;
  display: flex;
  align-items: center;
  min-width: 0;
}

.ui-wordmark {
  font-family: "Pretendard", system-ui, sans-serif;
  font-weight: 300;
  letter-spacing: 0;
}

.ui-logo {
  display: block;
  width: 168px;
  max-height: 26px;
  object-fit: contain;
  object-position: left center;
}

.ui-logo.is-missing,
.pop-logo.is-missing {
  display: none;
}

.ui-logo:not(.is-missing) + .logo-fallback,
.pop-logo:not(.is-missing) + .pop-logo-fallback {
  display: none;
}

.brand-block p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

.panel-section {
  padding: 18px 0;
  border-bottom: 1px solid var(--line);
}

.section-title {
  margin-bottom: 10px;
  font-size: 13px;
  font-weight: 700;
  color: #363636;
}

.helper {
  margin: 0 0 10px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.55;
}

.segmented {
  display: grid;
  grid-template-columns: 1fr 1fr;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
}

.segment {
  min-height: 40px;
  border: 0;
  background: #fff;
  cursor: pointer;
  color: #3a3a3a;
}

.segment + .segment {
  border-left: 1px solid var(--line);
}

.segment.is-active {
  background: var(--ink);
  color: #fff;
  font-weight: 700;
}

.data-input,
.field input,
.field textarea,
.mini-field input,
.mini-field textarea,
.file-drop {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--ink);
  outline: none;
}

.data-input:focus,
.field input:focus,
.field textarea:focus,
.mini-field input:focus,
.mini-field textarea:focus {
  border-color: var(--focus);
  box-shadow: 0 0 0 3px rgba(31, 111, 235, 0.12);
}

.data-input {
  height: 112px;
  padding: 10px;
  resize: vertical;
  font-family: Consolas, monospace;
  font-size: 12px;
  line-height: 1.45;
}

.file-drop {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 40px;
  margin-bottom: 8px;
  padding: 8px 10px;
  background: #fff;
  cursor: pointer;
  font-size: 12px;
  color: var(--muted);
}

.file-drop span {
  color: var(--ink);
  font-weight: 700;
}

.file-drop input {
  max-width: 190px;
  font-size: 11px;
}

.button-row {
  display: flex;
  gap: 8px;
  align-items: center;
}

.primary-btn,
.secondary-btn {
  min-height: 38px;
  border-radius: 6px;
  padding: 0 14px;
  cursor: pointer;
  border: 1px solid var(--ink);
}

.primary-btn {
  background: var(--ink);
  color: #fff;
}

.secondary-btn {
  background: #fff;
  color: var(--ink);
}

.wide {
  width: 100%;
}

.status-line {
  min-height: 20px;
  margin-top: 10px;
  color: var(--muted);
  font-size: 12px;
}

.field,
.mini-field {
  display: grid;
  gap: 6px;
  margin-bottom: 10px;
}

.field span,
.mini-field span {
  font-size: 12px;
  color: #4a4a4a;
  font-weight: 700;
}

.field input,
.field textarea {
  min-height: 38px;
  padding: 8px 10px;
}

.field textarea {
  min-height: 74px;
  resize: vertical;
}

.edit-list {
  display: grid;
  gap: 12px;
}

.edit-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: #fff;
}

.edit-card-title {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 10px;
  font-size: 13px;
  font-weight: 700;
}

.edit-card-title small {
  color: var(--muted);
  font-weight: 400;
}

.edit-warning {
  margin: 0 0 12px;
  color: #8b1e1e;
  font-size: 12px;
  font-weight: 700;
  line-height: 1.5;
}

.mini-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.mini-field textarea {
  min-height: 48px;
  resize: vertical;
}

.image-tools {
  grid-column: 1 / -1;
  border: 1px dashed #bdb7ac;
  border-radius: 8px;
  padding: 10px;
  background: #fbfaf6;
}

.image-drop {
  display: grid;
  place-items: center;
  min-height: 72px;
  border: 1px dashed #9a958c;
  border-radius: 7px;
  background: #fff;
  color: #57534c;
  cursor: pointer;
  text-align: center;
  font-size: 12px;
  line-height: 1.45;
}

.image-drop input {
  display: none;
}

.image-drop.is-dragging {
  border-color: var(--focus);
  background: #f0f6ff;
}

.image-controls {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr auto;
  gap: 8px;
  align-items: end;
  margin-top: 10px;
}

.range-field {
  display: grid;
  gap: 5px;
  font-size: 11px;
  color: #4a4a4a;
  font-weight: 700;
}

.range-field input {
  width: 100%;
}

.small-btn {
  min-height: 30px;
  padding: 0 9px;
  border: 1px solid var(--ink);
  border-radius: 6px;
  background: #fff;
  color: var(--ink);
  cursor: pointer;
  font-size: 12px;
}

.mini-field input,
.mini-field textarea {
  padding: 7px 8px;
  font-size: 12px;
}

.preview-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 20px;
  border-bottom: 1px solid var(--line);
}

.preview-toolbar h1 {
  margin: 0;
  font-size: 22px;
}

.preview-toolbar p {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.preview-stage {
  flex: 1;
  display: grid;
  place-items: center;
  padding: 34px;
  overflow: auto;
  background:
    linear-gradient(90deg, rgba(0, 0, 0, 0.035) 1px, transparent 1px),
    linear-gradient(rgba(0, 0, 0, 0.035) 1px, transparent 1px);
  background-size: 24px 24px;
}

.print-page {
  background: #fff;
  color: #111;
  box-shadow: 0 18px 60px rgba(0, 0, 0, 0.18);
  overflow: visible;
  position: relative;
  margin: 82px;
}

.pop-count-label {
  position: absolute;
  top: -28px;
  left: 0;
  color: #555;
  font-size: 13px;
  font-weight: 700;
}

.single-preview-list {
  display: grid;
  gap: 34px;
}

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

.single-pop {
  width: 900px;
  height: 600px;
  padding: 74px 92px 54px;
  position: relative;
}

.single-pop::before,
.a5-pop::before {
  content: "";
  position: absolute;
  inset: 0;
  background: #fff;
  z-index: -1;
}

.single-hero {
  position: absolute;
  top: 72px;
  right: 92px;
  width: 245px;
  height: 170px;
}

.image-frame {
  overflow: hidden;
  display: grid;
  place-items: center;
}

.product-image {
  width: 100%;
  height: 100%;
  object-fit: contain;
  transform-origin: center;
  user-select: none;
  pointer-events: none;
}

.image-placeholder {
  display: grid;
  place-items: center;
  background: linear-gradient(145deg, #f7f5ef, #ded8cc);
  color: #6b665d;
  border: 1px solid #e4ded2;
  text-align: center;
}

.image-placeholder.single-hero,
.image-placeholder.a5-image {
  position: absolute;
}

.a5-item .image-placeholder.a5-image {
  position: static;
}

.image-placeholder::before {
  content: "";
  width: 55%;
  height: 38%;
  border-radius: 48% 48% 12% 12%;
  border: 5px solid rgba(20, 20, 20, 0.18);
  border-bottom-width: 14px;
}

.single-title-en {
  width: 470px;
  font-size: 54px;
  font-weight: 800;
  line-height: 1.18;
  letter-spacing: 0;
}

.single-title-kr {
  margin-top: 22px;
  font-size: 27px;
  font-weight: 700;
}

.single-rule {
  position: absolute;
  left: 92px;
  right: 92px;
  top: 300px;
  height: 4px;
  width: auto;
  margin: 0;
  background: #282828;
}

.single-specs {
  position: absolute;
  left: 92px;
  right: 92px;
  top: 332px;
  display: grid;
  grid-template-columns: 100px minmax(0, 1fr);
  gap: 8px 18px;
  max-width: none;
  font-size: 24px;
  color: #62666b;
  line-height: 1.25;
  white-space: pre-line;
}

.single-specs b {
  color: #5a5a5a;
}

.single-logo {
  position: absolute;
  left: 92px;
  bottom: 72px;
  width: 184px;
  height: 30px;
}

.pop-logo {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: left center;
}

.pop-logo-fallback {
  display: block;
  font-size: 32px;
  line-height: 1;
  letter-spacing: 0;
  white-space: nowrap;
}

.single-logo .pop-logo-fallback,
.a5-logo .pop-logo-fallback {
  display: none;
}

.single-price-area {
  position: absolute;
  right: 86px;
  bottom: 56px;
  display: grid;
  justify-items: end;
  gap: 6px;
  min-width: 350px;
}

.original-price {
  color: #858585;
  font-size: 38px;
  text-decoration: line-through;
  text-decoration-thickness: 1.4px;
  text-decoration-color: #858585;
}

.price-row {
  display: flex;
  align-items: center;
  gap: 22px;
  justify-content: flex-end;
  width: 100%;
}

.discount-badge {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 62px;
  height: 62px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  font-size: 18px;
  font-weight: 800;
  line-height: 1;
  text-align: center;
  padding-top: 1px;
}

.sale-price {
  font-size: 62px;
  font-weight: 800;
  letter-spacing: 0;
  line-height: 1;
  text-align: right;
  font-family: "Pretendard", Arial, Helvetica, sans-serif;
  font-variant-numeric: normal;
  font-feature-settings: normal;
  font-kerning: normal;
}

.a5-preview-list {
  display: grid;
  gap: 34px;
}

.a5-pop {
  width: 1188px;
  height: 840px;
  padding: 86px 118px 76px;
  position: relative;
}

.a5-hero {
  position: absolute;
  top: 92px;
  right: 118px;
  width: 330px;
  height: 230px;
}

.a5-title-en {
  width: 600px;
  font-size: 70px;
  font-weight: 800;
  line-height: 1.16;
}

.a5-title-kr {
  margin-top: 28px;
  font-size: 34px;
  font-weight: 700;
}

.a5-rule {
  position: absolute;
  left: 118px;
  right: 118px;
  top: 420px;
  height: 5px;
  background: #282828;
}

.a5-specs {
  position: absolute;
  left: 118px;
  right: 118px;
  top: 458px;
  display: grid;
  grid-template-columns: 130px minmax(0, 1fr);
  gap: 12px 24px;
  font-size: 31px;
  color: #62666b;
  line-height: 1.25;
  white-space: pre-line;
}

.a5-specs b {
  color: #5a5a5a;
}

.a5-single-logo {
  position: absolute;
  left: 118px;
  bottom: 92px;
  width: 240px;
  height: 39px;
}

.a5-price-area {
  position: absolute;
  right: 118px;
  bottom: 70px;
  display: grid;
  justify-items: end;
  gap: 8px;
  min-width: 450px;
}

.crop-mark {
  position: absolute;
  pointer-events: none;
  z-index: 5;
  background: #000;
}

.crop-h {
  width: 60px;
  height: 1px;
}

.crop-v {
  width: 1px;
  height: 60px;
}

.crop-tl-h {
  top: 0;
  right: calc(100% + 22px);
}

.crop-tl-v {
  left: 0;
  bottom: calc(100% + 22px);
}

.crop-tr-h {
  top: 0;
  left: calc(100% + 22px);
}

.crop-tr-v {
  right: 0;
  bottom: calc(100% + 22px);
}

.crop-bl-h {
  bottom: 0;
  right: calc(100% + 22px);
}

.crop-bl-v {
  left: 0;
  top: calc(100% + 22px);
}

.crop-br-h {
  bottom: 0;
  left: calc(100% + 22px);
}

.crop-br-v {
  right: 0;
  top: calc(100% + 22px);
}

@media (max-width: 980px) {
  .workspace {
    grid-template-columns: 1fr;
  }

  .control-panel {
    max-height: none;
  }

  .preview-panel {
    min-height: auto;
  }

  .preview-stage {
    min-height: auto;
    place-items: start center;
  }

  .single-pop {
    zoom: 0.72;
  }

  .a5-pop {
    zoom: 0.62;
  }
}

@media print {
  body {
    background: #fff;
  }

  .control-panel,
  .preview-toolbar,
  .pop-count-label {
    display: none !important;
  }

  .app-shell,
  .workspace,
  .preview-panel,
  .preview-stage {
    display: block;
    padding: 0;
    margin: 0;
    background: #fff;
    border: 0;
    min-height: 0;
  }

  .print-page {
    box-shadow: none;
    overflow: visible;
    break-inside: avoid;
    page-break-inside: avoid;
  }

  .single-preview-list,
  .a5-preview-list {
    display: block;
    gap: 0;
  }

  body.print-single .single-preview-list {
    page: small-pop-sheet;
    display: flex;
    flex-wrap: wrap;
    align-content: flex-start;
    width: 208mm;
    margin: 0 auto;
  }

  body.print-single .single-pop {
    margin: 7mm;
  }

  body.print-single .single-pop:nth-child(6n) {
    break-after: page;
    page-break-after: always;
  }

  body.print-single .single-pop:last-child {
    break-after: auto;
    page-break-after: auto;
  }

  body.print-multi .a5-preview-list {
    page: a5-pop-sheet;
    display: block;
  }

  body.print-multi .a5-pop {
    margin: 31mm auto;
    break-after: page;
    page-break-after: always;
  }

  body.print-multi .a5-pop:last-child {
    break-after: auto;
    page-break-after: auto;
  }

  body.print-single .single-pop {
    width: 90mm;
    height: 60mm;
    padding: 7.2mm 9.2mm 5.4mm;
  }

  body.print-single .single-pop .crop-h,
  body.print-multi .a5-pop .crop-h {
    width: 5mm;
    height: 0.18mm;
  }

  body.print-single .single-pop .crop-v,
  body.print-multi .a5-pop .crop-v {
    width: 0.18mm;
    height: 5mm;
  }

  body.print-single .single-pop .crop-tl-h,
  body.print-single .single-pop .crop-bl-h,
  body.print-multi .a5-pop .crop-tl-h,
  body.print-multi .a5-pop .crop-bl-h {
    right: calc(100% + 2mm);
  }

  body.print-single .single-pop .crop-tr-h,
  body.print-single .single-pop .crop-br-h,
  body.print-multi .a5-pop .crop-tr-h,
  body.print-multi .a5-pop .crop-br-h {
    left: calc(100% + 2mm);
  }

  body.print-single .single-pop .crop-tl-v,
  body.print-single .single-pop .crop-tr-v,
  body.print-multi .a5-pop .crop-tl-v,
  body.print-multi .a5-pop .crop-tr-v {
    bottom: calc(100% + 2mm);
  }

  body.print-single .single-pop .crop-bl-v,
  body.print-single .single-pop .crop-br-v,
  body.print-multi .a5-pop .crop-bl-v,
  body.print-multi .a5-pop .crop-br-v {
    top: calc(100% + 2mm);
  }

  body.print-single .single-title-en {
    width: 47mm;
    font-size: 5.4mm;
    line-height: 1.18;
  }

  body.print-single .single-title-kr {
    margin-top: 2.2mm;
    font-size: 2.7mm;
  }

  body.print-single .single-hero {
    top: 7.2mm;
    right: 9.2mm;
    width: 24.5mm;
    height: 17mm;
  }

  body.print-single .single-rule {
    left: 9.2mm;
    right: 9.2mm;
    top: 30mm;
    height: 0.4mm;
    width: auto;
    margin: 0;
  }

  body.print-single .single-specs {
    left: 9.2mm;
    right: 9.2mm;
    top: 33.2mm;
    grid-template-columns: 10mm 1fr;
    gap: 1mm 1.8mm;
    max-width: none;
    font-size: 2.4mm;
  }

  body.print-single .single-logo {
    left: 9.2mm;
    bottom: 7.2mm;
    width: 18.4mm;
    height: 3mm;
  }

  body.print-single .single-price-area {
    right: 8.6mm;
    bottom: 5.6mm;
    gap: 0.6mm;
    min-width: 35mm;
  }

  body.print-single .original-price {
    font-size: 3.8mm;
    text-decoration-thickness: 0.14mm;
  }

  body.print-single .discount-badge {
    width: 6.2mm;
    height: 6.2mm;
    font-size: 1.8mm;
    line-height: 1;
    padding-top: 0.1mm;
  }

  body.print-single .sale-price {
    font-size: 6.2mm;
  }

  body.print-multi .a5-pop {
    width: 210mm;
    height: 148mm;
    padding: 15.2mm 20.8mm 13.4mm;
  }

  body.print-multi .a5-hero {
    top: 16.2mm;
    right: 20.8mm;
    width: 58.2mm;
    height: 40.6mm;
  }

  body.print-multi .a5-title-en {
    width: 105mm;
    font-size: 12.3mm;
  }

  body.print-multi .a5-title-kr {
    margin-top: 4.9mm;
    font-size: 6mm;
  }

  body.print-multi .a5-rule {
    left: 20.8mm;
    right: 20.8mm;
    top: 74.1mm;
    height: 0.9mm;
  }

  body.print-multi .a5-specs {
    left: 20.8mm;
    right: 20.8mm;
    top: 80.8mm;
    grid-template-columns: 22.9mm 1fr;
    gap: 2.1mm 4.2mm;
    font-size: 5.5mm;
  }

  body.print-multi .a5-single-logo {
    left: 20.8mm;
    bottom: 16.2mm;
    width: 42.3mm;
    height: 6.9mm;
  }

  body.print-multi .a5-price-area {
    right: 20.8mm;
    bottom: 12.3mm;
    min-width: 79.4mm;
    gap: 1.4mm;
  }

  @page small-pop-sheet {
    size: A4 portrait;
    margin: 0;
  }

  @page a5-pop-sheet {
    size: A4 landscape;
    margin: 0;
  }

  * {
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }
}
