@font-face {
  font-family: "Pretendard";
  src: url("../fonts/PretendardVariable.woff2") format("woff2-variations");
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
}

:root {
  --ink: #17191f;
  --muted: #666b75;
  --line: #e2e4e9;
  --surface: #fff;
  --soft: #f5f6f8;
  --accent: #315efb;
  --accent-hover: #244bd6;
  --accent-soft: #eef2ff;
  --success: #16795a;
  --danger: #b4233f;
  --radius: 18px;
  color-scheme: light;
  font-family: Pretendard, -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo", sans-serif;
}

* { box-sizing: border-box; }
html { background: var(--soft); }
body { min-width: 320px; margin: 0; color: var(--ink); background: var(--soft); font-weight: 400; }
button, input { font: inherit; }
button { -webkit-tap-highlight-color: transparent; }
button:focus-visible, input:focus-visible, [draggable]:focus-visible { outline: 3px solid rgba(49,94,251,.28); outline-offset: 2px; }

.site-header { width: min(1120px, calc(100% - 48px)); margin: auto; padding: 30px 0 18px; }
.brand { display: flex; align-items: center; gap: 10px; }
.brand-logo { width: 38px; height: 38px; object-fit: contain; }
.brand-title { display: block; font-size: 28px; line-height: 1; letter-spacing: -.04em; font-weight: 700; }
.brand-copy { display: flex; flex-direction: column; line-height: 1.05; }
.brand-subtitle { display: block; margin-top: 7px; color: var(--muted); font-size: 13px; font-weight: 500; }

main { width: min(1040px, calc(100% - 48px)); margin: 18px auto 72px; }
.progress { display: flex; align-items: center; justify-content: center; margin-bottom: 24px; }
.progress i { width: clamp(18px, 7vw, 82px); height: 1px; background: #d8dbe1; }
.progress-step { display: flex; align-items: center; gap: 8px; min-height: 44px; padding: 6px; color: #858a94; border: 0; background: none; font-size: 13px; }
.progress-step span { display: grid; place-items: center; width: 28px; height: 28px; border: 1px solid #d4d7dd; border-radius: 50%; background: white; font-size: 12px; font-weight: 600; }
.progress-step b { font-weight: 600; white-space: nowrap; }
.progress-step.is-active { color: var(--ink); }
.progress-step.is-active span { color: white; border-color: var(--accent); background: var(--accent); }

.step-panel { padding: clamp(28px, 5vw, 52px); background: var(--surface); border: 1px solid var(--line); border-radius: 24px; }
.step-panel[hidden], [hidden] { display: none !important; }
.section-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; margin-bottom: 30px; }
.eyebrow { color: var(--accent); font-size: 12px; font-weight: 600; }
h1 { margin: 7px 0 8px; font-size: clamp(28px, 5vw, 40px); line-height: 1.12; letter-spacing: -.045em; font-weight: 700; }
h2 { letter-spacing: -.025em; }
.section-heading p { margin: 0; color: var(--muted); line-height: 1.55; }
.file-count { flex: none; padding: 7px 11px; color: var(--accent); background: var(--accent-soft); border-radius: 999px; font-size: 12px; font-weight: 600; }

.drop-zone { padding: clamp(42px, 8vw, 74px) 20px; text-align: center; border: 1.5px dashed #b9bdc7; border-radius: var(--radius); background: #fafbfc; transition: border-color .15s ease, background .15s ease; }
.drop-zone.is-dragging { border-color: var(--accent); background: var(--accent-soft); }
.drop-icon { display: grid; place-items: center; width: 52px; height: 52px; margin: 0 auto 18px; color: var(--accent); background: var(--accent-soft); border-radius: 50%; }
.drop-icon svg { width: 25px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.drop-zone h2 { margin: 0 0 7px; font-size: 21px; }
.drop-zone p { margin: 0 0 21px; color: var(--muted); }
.drop-zone small { display: block; margin-top: 15px; color: #858a94; font-size: 12px; }

.button { min-height: 46px; padding: 0 20px; border: 1px solid transparent; border-radius: 12px; font-weight: 600; cursor: pointer; transition: background .15s ease, border-color .15s ease; }
.button-primary { color: white; background: var(--accent); }
.button-primary:hover:not(:disabled) { background: var(--accent-hover); }
.button-secondary { color: var(--ink); background: white; border-color: #cfd2d9; }
.button-secondary:hover:not(:disabled) { background: var(--soft); }
.button-large { min-width: 210px; min-height: 52px; }
.button:disabled { cursor: not-allowed; opacity: .42; }
.panel-actions { display: flex; justify-content: flex-end; align-items: center; gap: 16px; margin-top: 28px; }
.text-button { min-height: 40px; margin-top: 18px; padding: 5px 0; color: #4d5563; border: 0; background: none; font-weight: 600; cursor: pointer; }

.message { margin-top: 16px; padding: 13px 15px; color: var(--danger); background: #fff4f6; border-radius: 10px; font-size: 14px; }
.mode-picker { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin: 28px 0 0; padding: 0; border: 0; }
.mode-picker legend { grid-column: 1/-1; margin-bottom: 8px; font-size: 15px; font-weight: 600; }
.mode-card { display: flex; align-items: flex-start; gap: 10px; padding: 16px; border: 1px solid var(--line); border-radius: 14px; cursor: pointer; }
.mode-card:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }
.mode-card input { margin-top: 3px; accent-color: var(--accent); }
.mode-card strong, .mode-card small { display: block; }
.mode-card small { margin-top: 4px; color: var(--muted); }

.preview-grid, .uploaded-grid { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: 12px; margin-top: 18px; }
.preview-card, .uploaded-card { position: relative; overflow: hidden; border: 1px solid var(--line); border-radius: 14px; background: var(--soft); }
.preview-card img, .uploaded-card img { display: block; width: 100%; aspect-ratio: 4/5; object-fit: cover; background: #eceef2; }
.preview-card > div { position: absolute; inset: auto 0 0; padding: 20px 10px 9px; color: white; background: linear-gradient(transparent, rgba(0,0,0,.72)); opacity: 0; transition: opacity .15s; }
.preview-card:hover > div, .preview-card:focus-within > div { opacity: 1; }
.preview-card strong, .preview-card span { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 11px; }
.preview-card span { margin-top: 2px; color: #e8e8e8; }
.remove-button { position: absolute; top: 8px; right: 8px; display: grid; place-items: center; width: 34px; height: 34px; color: white; border: 0; border-radius: 50%; background: rgba(20,22,28,.72); font-size: 21px; cursor: pointer; }

.upload-status, .processing-banner { display: flex; align-items: center; gap: 10px; color: var(--accent); font-size: 14px; font-weight: 600; }
.upload-status > span, .processing-banner > span { width: 18px; height: 18px; flex: none; border: 2px solid #cbd5ff; border-top-color: var(--accent); border-radius: 50%; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.processing-banner { margin-bottom: 20px; padding: 16px; background: var(--accent-soft); border-radius: 13px; }
.processing-banner strong, .processing-banner small { display: block; }
.processing-banner small { margin-top: 3px; color: var(--muted); font-weight: 400; }
.uploaded-grid { margin: 0 0 20px; }
.uploaded-card > div { padding: 11px; }
.uploaded-card strong, .uploaded-card span, .uploaded-card em { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.uploaded-card strong { font-size: 12px; }
.uploaded-card span { margin: 4px 0 7px; color: var(--muted); font-size: 11px; }
.uploaded-card em { color: var(--success); font-size: 11px; font-style: normal; font-weight: 600; }
.uploaded-card em.is-error { color: var(--danger); white-space: normal; }
.retry-button { margin: 5px 0 0; }
.quiet-note, .help-text, .carousel-heading { color: var(--muted); font-size: 13px; line-height: 1.55; }

.design-panel { padding-inline: clamp(24px, 4vw, 44px); }
.design-form { display: grid; grid-template-columns: 1fr 1fr auto; gap: 10px; align-items: end; padding: 18px; background: var(--soft); border-radius: 15px; }
.design-form label, .direct-caption, .editor-controls > label { display: grid; gap: 7px; color: #505662; font-size: 13px; font-weight: 600; }
.design-form em { color: #9297a0; font-size: 11px; font-style: normal; font-weight: 400; }
.design-form input, .direct-caption input, #edit-caption { min-width: 0; width: 100%; height: 46px; padding: 0 13px; color: var(--ink); border: 1px solid #d6d9df; border-radius: 10px; background: white; }
.caption-section, .template-section { margin-top: 30px; }
.subheading, .editor-header { display: flex; align-items: center; justify-content: space-between; gap: 14px; }
.subheading h2, .editor-header h2 { margin: 0; font-size: 20px; }
.subheading { margin-bottom: 13px; }
.subheading .text-button { margin: 0; color: var(--accent); }
.caption-options { display: grid; grid-template-columns: repeat(3,1fr); gap: 9px; }
.caption-card { min-height: 66px; padding: 12px; color: var(--ink); border: 1px solid var(--line); border-radius: 12px; background: white; cursor: pointer; }
.caption-card.is-selected { color: var(--accent); border-color: var(--accent); background: var(--accent-soft); font-weight: 600; }
.direct-caption { margin-top: 13px; }

.template-options { display: grid; grid-template-columns: repeat(4,1fr); gap: 10px; }
.template-button { overflow: hidden; padding: 7px; color: var(--ink); border: 1px solid var(--line); border-radius: 12px; background: white; cursor: pointer; }
.template-button canvas { display: block; width: 100%; aspect-ratio: 4/5; border-radius: 7px; background: #e8eaee; }
.template-button span { display: block; padding: 8px 2px 3px; font-size: 12px; font-weight: 600; text-align: left; }
.template-button.is-selected { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.carousel-heading { margin: 22px 0 10px; }
.design-grid, .final-grid { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 12px; }
.design-card, .final-card { position: relative; overflow: hidden; padding: 8px; border: 1px solid var(--line); border-radius: 14px; background: white; }
.design-card canvas, .final-card canvas { display: block; width: 100%; aspect-ratio: 4/5; border-radius: 9px; background: #e9ebef; }
.drag-handle { width: 100%; min-height: 38px; margin-bottom: 7px; padding: 6px; color: var(--muted); border: 0; border-radius: 8px; background: var(--soft); cursor: grab; touch-action: none; }
.representative-badge { position: absolute; z-index: 1; top: 55px; left: 16px; padding: 5px 8px; color: white; background: rgba(20,22,28,.75); border-radius: 999px; font-size: 10px; font-weight: 600; }
.edit-button, .final-card .button { width: 100%; min-height: 40px; margin-top: 8px; }
.final-card strong { display: block; padding: 9px 2px 2px; font-size: 12px; text-align: center; }

.completion-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 26px; }
.drive-status { margin: 12px 0 0; padding: 12px 14px; color: #3f4652; background: var(--soft); border-radius: 10px; font-size: 13px; }
.editor-dialog { width: min(940px, calc(100% - 28px)); max-height: calc(100vh - 28px); padding: 0; border: 0; border-radius: 20px; background: white; box-shadow: 0 24px 70px rgba(20,22,28,.22); }
.editor-dialog::backdrop { background: rgba(20,22,28,.62); }
.editor-shell { padding: 22px; }
.editor-header { margin-bottom: 18px; }
.editor-header .eyebrow { display: block; margin-bottom: 4px; }
.close-button { width: 42px; height: 42px; border: 0; border-radius: 50%; background: var(--soft); font-size: 24px; cursor: pointer; }
.editor-layout { display: grid; grid-template-columns: minmax(320px,1fr) 300px; gap: 24px; }
.editor-canvas-wrap canvas { display: block; width: 100%; max-height: calc(100vh - 170px); aspect-ratio: 4/5; touch-action: auto; border-radius: 12px; background: #e9ebef; }
.editor-canvas-wrap canvas.is-manipulating { touch-action: none; cursor: grabbing; }
.editor-controls input[type="number"] { width: 100%; min-height: 42px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 9px; font: inherit; }
.editor-canvas-wrap small { display: block; margin-top: 8px; color: var(--muted); text-align: center; }
.editor-controls { display: grid; align-content: start; gap: 13px; }
.editor-controls fieldset { display: flex; flex-wrap: wrap; gap: 10px 14px; margin: 0; padding: 12px; border: 1px solid var(--line); border-radius: 11px; }
.editor-controls legend { color: var(--muted); font-size: 12px; font-weight: 600; }
.editor-controls label { font-size: 13px; }
.editor-controls input[type="radio"] { accent-color: var(--accent); }
.editor-actions { display: grid; grid-template-columns: 1fr 1.4fr; gap: 9px; margin-top: 4px; }
footer { padding: 0 20px 28px; color: #8c919b; text-align: center; font-size: 12px; }

@media (max-width: 720px) {
  .site-header { width: calc(100% - 32px); padding: 20px 0 12px; }
  main { width: calc(100% - 24px); margin: 12px auto 48px; }
  .brand-title { font-size: 24px; }
  .brand-subtitle { margin-top: 6px; font-size: 12px; }
  .progress { align-items: flex-start; overflow: hidden; }
  .progress-step { flex: 0 1 auto; flex-direction: column; gap: 4px; min-width: 52px; padding: 3px; font-size: 10px; }
  .progress-step span { width: 26px; height: 26px; }
  .progress i { flex: 1; min-width: 7px; margin-top: 16px; }
  .step-panel { padding: 26px 16px; border-radius: 19px; }
  .section-heading { align-items: flex-start; margin-bottom: 22px; }
  .section-heading p { font-size: 14px; }
  .drop-zone { padding: 42px 14px; }
  .preview-grid, .uploaded-grid { grid-template-columns: repeat(2,minmax(0,1fr)); gap: 9px; }
  .preview-card > div { display: none; }
  .mode-picker { grid-template-columns: 1fr; }
  .panel-actions { align-items: stretch; flex-direction: column; }
  .panel-actions .button { width: 100%; }
  .design-form { grid-template-columns: 1fr; padding: 14px; }
  .caption-options { grid-template-columns: 1fr; }
  .template-options { grid-template-columns: repeat(2,1fr); }
  .design-grid, .final-grid { display: flex; overflow-x: auto; scroll-snap-type: x mandatory; padding-bottom: 8px; }
  .design-card, .final-card { flex: 0 0 76%; scroll-snap-align: start; }
  .completion-actions { align-items: stretch; flex-direction: column; }
  .completion-actions .button { width: 100%; }
  .editor-dialog { max-height: calc(100vh - 12px); overflow: auto; }
  .editor-shell { padding: 16px; }
  .editor-layout { grid-template-columns: 1fr; }
  .editor-canvas-wrap canvas { max-height: none; }
  .editor-actions { position: sticky; bottom: 0; padding-top: 8px; background: white; }
}

@media (max-width: 380px) {
  .progress-step { min-width: 47px; }
  .progress-step b { white-space: normal; text-align: center; }
  .preview-grid, .uploaded-grid { gap: 7px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; animation-duration: .01ms !important; }
}
