/* Standardized Buttons (Primary, Ghost, Icon) */
.btn-primary, .btn-ghost, .btn-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: var(--control-height-md);
  padding: 0 var(--spacing-md);
  border: 0;
  border-radius: var(--radius-sm);
  font-size: 14px;
  line-height: 1;
  font-family: var(--font-family-ui);
  font-weight: 600;
  cursor: pointer;
  transition: opacity 0.15s, background 0.15s, border-color 0.15s;
}

.btn-primary:focus-visible, .btn-ghost:focus-visible, .btn-icon:focus-visible {
  outline: 2px solid var(--color-primary-base);
  outline-offset: 2px;
}

.btn-primary:disabled, .btn-ghost:disabled, .btn-icon:disabled,
.btn-primary.loading, .btn-ghost.loading, .btn-icon.loading {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn-primary {
  height: var(--control-height-lg);
  background: var(--color-primary-base);
  color: var(--color-primary-text);
  width: 100%;
}
.btn-primary:hover:not(:disabled):not(.loading) {
  background: var(--color-primary-hover);
}

.btn-ghost {
  background: var(--color-ghost-base);
  color: var(--color-text-base);
  width: 100%;
}
.btn-ghost:hover:not(:disabled):not(.loading) {
  background: var(--color-ghost-hover);
}

.btn-icon {
  height: var(--control-height-sm);
  padding: 0 var(--spacing-sm);
  background: transparent;
  color: var(--color-text-muted);
}
.btn-icon:hover:not(:disabled):not(.loading) {
  color: var(--color-text-base);
}


/* 입력 사진 미리보기 크기 제한 */
#product-source {
  max-width: 100%;
  max-height: 320px;
  width: auto;
  height: auto;
  display: block;
  margin: 0 auto;
  margin-inline: auto;
  object-fit: contain;
  border-radius: 8px;
}

.dropzone {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  margin-top: 16px;
  padding: 24px;
  overflow: hidden;
  word-break: break-word;
  border: 1px dashed var(--color-border-base);
  border-radius: var(--radius-lg);
  background: transparent;
  color: var(--color-text-muted);
  cursor: pointer;
  text-align: center;
}

.dropzone strong { color: var(--color-text-base); font-size: 13px; font-weight: 600; }
.dropzone:hover, .dropzone.dragging { background: var(--color-ghost-base); }

.preview-img {
  display: block;
  width: 100%;
  margin: 0 0 12px;
  margin-inline: auto;
  object-fit: contain;
  border-radius: var(--radius-md);
  image-rendering: pixelated;
  background: repeating-conic-gradient(var(--color-checker-a) 0 25%, var(--color-checker-b) 0 50%) 0 0 / 16px 16px;
}

.result-preview img {
  display: block;
  max-width: 100%;
  margin: 0 0 12px;
  border-radius: var(--radius-md);
  image-rendering: pixelated;
  background: repeating-conic-gradient(var(--color-checker-a) 0 25%, var(--color-checker-b) 0 50%) 0 0 / 16px 16px;
}

.actions { display: flex; flex-direction: column; gap: 10px; margin-top: 12px; }

.style-lock-badge {
  align-self: center;
  width: fit-content;
  padding: 4px 10px;
  border: 1px solid var(--color-border-base);
  border-radius: 999px;
  color: var(--color-text-muted);
  font-size: 12px;
  font-weight: 600;
}

.style-lock-badge.style-lock-active {
  border-color: var(--color-primary-base);
  color: var(--color-primary-base);
}

#product-status { margin: 0; color: var(--color-text-muted); font-size: 13px; text-align: center; }

.badge {
  display: inline-block;
  background: #f2f9ff;
  color: #097fe8;
  border-radius: 999px;
  padding: 3px 8px;
  font-size: 12px;
  font-weight: 600;
  width: fit-content;
}
[data-theme="dark"] .badge {
  background: rgba(9,127,232,0.2);
  color: #4fa5f5;
}

.result {
  display: flex;
  flex-direction: column;
  gap: 20px;
  margin-top: 20px;
}
.result-preview { min-width: 0; }
.result-meta {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.result-meta p { margin: 0; }
.result-meta-header {
  display: none;
}
.result-eyebrow {
  display: none;
}
.result-spec {
  flex: 1;
  margin: 0 !important;
  padding: 8px 10px;
  border: 1px solid var(--color-border-base);
  border-radius: 7px;
  background: var(--color-bg-panel);
  color: var(--color-text-muted);
  font-size: 11px;
  line-height: 1.45;
}
.result-actions-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}
.result-action-group {
  display: grid;
  grid-template-rows: auto auto 1fr;
  gap: 8px;
  padding: 12px;
  border: 1px solid var(--color-border-base);
  border-radius: 9px;
  background: var(--color-bg-panel);
}
.sheet-action-row {
  display: flex;
  align-items: center;
  gap: 8px;
}
.sheet-action-row .result-action {
  flex: 1;
}
.sheet-custom-actions {
  display: grid;
  gap: 8px;
  padding: 10px;
  border: 1px solid var(--color-border-base);
  border-radius: 8px;
  background: var(--color-bg-card);
}
.sheet-custom-label,
.sheet-fixed-frames {
  margin: 0;
  color: var(--color-text-muted);
  font-size: 11px;
  line-height: 1.4;
}
.sheet-custom-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.sheet-custom-credit {
  flex: none;
  color: var(--color-accent-strong);
  font-weight: 800;
}
.sheet-custom-row {
  display: flex;
  gap: 6px;
}
.sheet-custom-input-wrap {
  position: relative;
  min-width: 0;
  flex: 1;
}
.sheet-custom-input {
  width: 100%;
  min-width: 0;
  height: 36px;
  padding: 0 54px 0 10px;
  border: 2px solid var(--color-border-base);
  border-radius: 8px;
  background: var(--color-bg-panel);
  color: var(--color-text-base);
}
.sheet-custom-count {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--color-text-muted);
  font-size: 10px;
  font-weight: 700;
  pointer-events: none;
}
.sheet-custom-add-btn { flex: none; height: 36px; align-self: center; }
.sheet-actions-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.sheet-action-chip {
  padding: 6px 9px;
  border: 2px solid var(--color-border-base);
  border-radius: 999px;
  background: var(--color-bg-panel);
  color: var(--color-text-base);
  font: inherit;
  font-size: 11px;
  font-weight: 800;
  cursor: pointer;
}
.sheet-action-chip.active {
  border-color: var(--color-accent-strong);
  background: var(--color-accent-soft);
}
.sheet-action-chip.custom {
  max-width: min(100%, 360px);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.sheet-frames-label {
  display: inline-flex;
  align-items: center;
}
.sheet-frames-select {
  height: 36px;
  padding: 0 8px;
  border: 2px solid var(--color-border-base);
  border-radius: 8px;
  background: var(--color-bg-panel);
  color: var(--color-text-base);
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}
.generation-mode-picker {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  min-width: 0;
  margin: 4px 0 0;
  padding: 0;
  border: 0;
}
.generation-mode-picker legend {
  grid-column: 1 / -1;
  padding: 0;
  color: var(--color-text-muted);
  font-size: 11px;
  font-weight: 800;
}
.generation-mode-card {
  display: flex;
  gap: 9px;
  min-width: 0;
  padding: 10px;
  border: 1px solid var(--color-border-base);
  border-radius: 8px;
  background: var(--color-bg-panel);
  cursor: pointer;
}
.generation-mode-card:has(input:checked) {
  border-color: var(--color-accent-strong);
  background: var(--color-accent-soft);
  box-shadow: inset 3px 0 0 var(--color-accent-strong);
}
.generation-mode-card input {
  flex: none;
  margin: 2px 0 0;
  accent-color: var(--color-accent-strong);
}
.generation-mode-card span { min-width: 0; }
.generation-mode-card strong,
.generation-mode-card small { display: block; }
.generation-mode-card strong { font-size: 12px; line-height: 1.3; }
.generation-mode-card small {
  margin-top: 3px;
  color: var(--color-text-muted);
  font-size: 10px;
  line-height: 1.4;
}
.generation-disclaimer {
  margin: 2px 0 0;
  color: var(--color-text-muted);
  font-size: 10px;
  line-height: 1.45;
}
.sheet-spinner {
  display: inline-block;
  width: 12px;
  height: 12px;
  margin-right: 6px;
  border: 2px solid var(--color-border-base);
  border-top-color: var(--color-accent-base);
  border-radius: 50%;
  animation: sheet-spin 0.7s linear infinite;
  vertical-align: middle;
}
@keyframes sheet-spin {
  to { transform: rotate(360deg); }
}
.result-action {
  width: 100%;
  box-sizing: border-box;
  gap: 8px;
  text-decoration: none;
}
.result-action svg {
  width: 18px;
  height: 18px;
  flex: none;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: square;
  stroke-linejoin: miter;
}
.result-action-note {
  color: var(--color-text-muted);
  font-size: 12px;
  line-height: 1.45;
}
#make-sheet { margin-top: 0; }
.result-links {
  display: flex;
  flex-direction: column;
  gap: 8px;
  font-size: 12px;
  font-weight: 700;
}
.result-links a { text-decoration: underline; text-underline-offset: 3px; }
.sheet-result {
  grid-column: 1 / -1;
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--color-border-base);
}
.sheet-result img { max-width: 100%; image-rendering: pixelated; }

@media (max-width: 760px) {
  .result-meta-header { display: block; }
  .result-spec { margin-top: 7px !important; }
  .result-actions-grid { grid-template-columns: 1fr; }
  .generation-mode-picker { grid-template-columns: 1fr; }
  .generation-mode-picker legend { grid-column: auto; }
}


.hint { color: var(--color-text-muted); font-size: 12px; }
.pixel-canvas {
  display: block;
  width: 100%;
  height: auto;
  max-width: 100%;
  margin: 0 0 12px;
  border-radius: 8px;
  image-rendering: pixelated;
  cursor: crosshair;
  touch-action: none;
  user-select: none;
  background: repeating-conic-gradient(var(--color-checker-a) 0 25%, var(--color-checker-b) 0 50%) 0 0 / 16px 16px;
}
.pixel-editor-surface {
  width: 100%;
  margin: 0 0 14px;
}
.pixel-editor-heading {
  display: flex;
  align-items: baseline;
  gap: 10px;
  margin-bottom: 10px;
}
.pixel-editor-heading h3 { margin: 0; font-size: 15px; font-weight: 800; }
.pixel-editor-heading .hint { margin: 0; }
.pixel-editor-toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  width: fit-content;
  max-width: 100%;
  margin-bottom: 12px;
  padding: 7px;
  overflow-x: auto;
  border: 2px solid var(--color-ink-base);
  border-radius: 10px;
  background: var(--color-bg-panel, var(--color-bg-card));
  box-shadow: 3px 3px 0 var(--color-ink-base);
}
.pixel-editor-history, .pixel-editor-tools {
  display: flex;
  flex: none;
  align-items: center;
  gap: 6px;
}
.pixel-editor-divider {
  align-self: stretch;
  width: 1px;
  min-height: 28px;
  background: var(--color-border-base);
}
.pixel-editor-control {
  min-width: 0;
  height: 34px;
  padding: 0 10px;
  gap: 6px;
  border-width: 1px;
  box-shadow: none;
  white-space: nowrap;
}
.pixel-editor-control .material-symbols-rounded {
  width: 20px;
  height: 20px;
  flex: none;
}
.pixel-editor-control.active {
  border-color: var(--color-ink-base);
  background: var(--color-primary-base);
  color: var(--color-primary-text);
  box-shadow: 2px 2px 0 var(--color-ink-base);
}
.pixel-editor-control:disabled { opacity: 0.38; }
.unified-editor-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 10px;
}
.unified-editor-group { display: flex; flex-wrap: wrap; gap: 6px; }
.unified-editor-bar .btn { min-height: 34px; padding: 6px 10px; }
.unified-editor-bar .btn.active {
  border-color: var(--color-ink-base);
  background: var(--color-primary-base);
  color: var(--color-primary-text);
}
.pixel-editor-workspace {
  display: grid;
  grid-template-columns: minmax(480px, 720px) minmax(160px, 200px);
  align-items: stretch;
  justify-content: start;
  gap: 14px;
}
.pixel-editor-viewport {
  display: grid;
  place-items: center;
  width: 100%;
  height: clamp(520px, 54vw, 720px);
  min-height: 520px;
  overflow: hidden;
  border: 2px solid var(--color-ink-base);
  border-radius: 10px;
  background: repeating-conic-gradient(var(--color-checker-a) 0 25%, var(--color-checker-b) 0 50%) 0 0 / 16px 16px;
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--color-ink-base) 10%, transparent);
}
.pixel-editor-canvas-stack {
  position: relative;
  flex: none;
  max-width: 100%;
  max-height: 100%;
  transform-origin: center;
}
.unified-pixel-grid {
  position: absolute;
  inset: 0;
  z-index: 2;
  pointer-events: none;
  background-image:
    linear-gradient(to right, color-mix(in srgb, var(--color-ink-base) 28%, transparent) 1px, transparent 1px),
    linear-gradient(to bottom, color-mix(in srgb, var(--color-ink-base) 28%, transparent) 1px, transparent 1px);
}
.pixel-editor-canvas, .pixel-editor-lasso {
  display: block;
  width: 100%;
  height: 100%;
}
.pixel-editor-canvas { image-rendering: pixelated; }
.pixel-editor-lasso {
  position: absolute;
  inset: 0;
  pointer-events: none;
}
.pixel-editor-palette-panel {
  min-width: 0;
  padding: 14px;
  border: 2px solid var(--color-ink-base);
  border-radius: 10px;
  background: var(--color-bg-card);
  box-shadow: 3px 3px 0 var(--color-ink-base);
}
.pixel-editor-palette-panel > strong {
  display: block;
  margin-bottom: 10px;
  font-size: 13px;
}
.pixel-editor-palette {
  display: grid;
  grid-template-columns: repeat(auto-fill, 30px);
  align-content: start;
  gap: 7px;
  max-height: 360px;
  overflow: auto;
}
.pixel-editor-swatch {
  width: 30px;
  height: 30px;
  border: 2px solid var(--color-border-base);
  border-radius: 5px;
  cursor: pointer;
}
.pixel-editor-swatch.selected {
  border-color: var(--color-ink-base);
  outline: 2px solid var(--color-bg-card);
  outline-offset: -4px;
  box-shadow: 2px 2px 0 var(--color-ink-base);
  transform: translate(-1px, -1px);
}
.pixel-editor-add-color {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid var(--color-border-base);
  color: var(--color-text-muted);
  font-size: 12px;
  font-weight: 700;
}
.pixel-editor-add-color input { width: 34px; height: 28px; padding: 0; border: 0; background: transparent; cursor: pointer; }
.pixel-editor-wand-options {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 0 4px;
}
.pixel-editor-wand-options input[type="range"] {
  width: 72px;
  accent-color: var(--color-accent-base);
  cursor: pointer;
}
.pixel-editor-wand-options output {
  min-width: 22px;
  font-size: 11px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  color: var(--color-text-muted);
}
.pixel-editor-shortcuts {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 16px;
  margin-top: 12px;
  color: var(--color-text-muted);
  font-size: 11px;
  line-height: 1.4;
}
.pixel-editor-shortcuts > span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.pixel-editor-shortcuts kbd {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  padding: 1px 7px;
  border: 1px solid var(--color-border-base);
  border-bottom: 2px solid var(--color-ink-base);
  border-radius: 5px;
  background: var(--color-bg-card);
  color: var(--color-text-base);
  font: 700 10px/1 var(--font-family-base);
  white-space: nowrap;
}

@media (max-width: 860px) {
  .pixel-editor-workspace { grid-template-columns: 1fr; }
  .pixel-editor-viewport {
    height: min(calc(100vw - 84px), 560px);
    min-height: 320px;
  }
  .pixel-editor-palette-panel { max-width: none; }
  .pixel-editor-palette { grid-template-columns: repeat(auto-fill, 30px); max-height: 120px; }
}

@media (max-width: 600px) {
  .pixel-editor-heading { display: block; }
  .pixel-editor-heading h3 { margin-bottom: 4px; }
  .pixel-editor-toolbar { width: calc(100% - 14px); }
  .pixel-editor-control { padding-inline: 9px; }
  .pixel-editor-control span { font-size: 11px; }
  .pixel-editor-viewport {
    height: min(calc(100vw - 56px), calc(100vh - 180px));
    min-height: 0;
  }
}


/* ── Auth / Credits ── */
.user-area { /* layout defined in layout.css */ }

/* 크레딧 칩 */
.credit-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px 3px 6px;
  background: var(--color-bg-panel);
  border: 1px solid var(--color-border-base);
  border-radius: 12px;
  font-size: 12px;
  font-weight: 600;
  color: var(--color-accent-base);
  text-decoration: none;
  cursor: pointer;
  transition: border-color 0.15s;
}
.credit-chip:hover { border-color: var(--color-accent-base); }

/* 아이콘 버튼 (Sign out) */



.google-signin-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 0 12px 0 10px;
  height: 36px;
  background: #fff;
  color: #3c4043;
  border: 1px solid #dadce0;
  border-radius: 4px;
  font-size: 13px;
  font-weight: 500;
  font-family: "Google Sans", Roboto, sans-serif;
  text-decoration: none;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.1s, box-shadow 0.1s;
}
.google-signin-btn:hover { background: #f8faff; box-shadow: 0 1px 3px rgba(60,64,67,.2); border-color: #c6c6c6; }
[data-theme="dark"] .google-signin-btn { background: #131314; color: #e3e3e3; border-color: #8e918f; }
[data-theme="dark"] .google-signin-btn:hover { background: #1e1e1e; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) .google-signin-btn { background: #131314; color: #e3e3e3; border-color: #8e918f; }
  :root:not([data-theme]) .google-signin-btn:hover { background: #1e1e1e; }
}
.user-credits {
  font-size: 12px;
  color: var(--color-accent-base);
  font-weight: 700;
  white-space: nowrap;
}
.login-btn {
  background: #4285f4;
  color: #fff !important;
  border-color: #4285f4;
}
.login-btn:hover { background: #3367d6; border-color: #3367d6; }
@font-face {
  font-family: "Material Symbols Rounded";
  font-style: normal;
  font-weight: 500;
  font-display: block;
  src: url("../../assets/fonts/material-symbols-rounded.ttf") format("truetype");
}

.material-symbols-rounded {
  display: inline-block;
  overflow: hidden;
  font-family: "Material Symbols Rounded";
  font-size: 20px;
  font-style: normal;
  font-weight: 500;
  line-height: 1;
  letter-spacing: normal;
  text-transform: none;
  white-space: nowrap;
  direction: ltr;
  font-feature-settings: "liga";
  -webkit-font-smoothing: antialiased;
}

/* ── Editor step progress bar (1 → 2 → 3) ── */
.editor-steps-bar {
  display: flex;
  align-items: center;
  gap: var(--spacing-xs);
  padding: var(--spacing-sm) 0 var(--spacing-md);
  border-bottom: 1px solid var(--color-border-base);
  margin-bottom: var(--spacing-md);
}

.editor-step {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: var(--font-size-sm);
  font-weight: 600;
  color: var(--color-text-muted);
  opacity: 0.5;
  transition: opacity 0.2s, color 0.2s;
}

.editor-step[data-active="true"],
.editor-step.active {
  color: var(--color-primary-base);
  opacity: 1;
}

.editor-step[data-done="true"],
.editor-step.done {
  color: var(--color-text-muted);
  opacity: 0.8;
}

.editor-step-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--color-ghost-base);
  font-size: 11px;
  font-weight: 700;
  line-height: 1;
  flex-shrink: 0;
}

.editor-step[data-active="true"] .editor-step-num,
.editor-step.active .editor-step-num {
  background: var(--color-primary-base);
  color: var(--color-primary-text);
}

.editor-step[data-done="true"] .editor-step-num,
.editor-step.done .editor-step-num {
  background: var(--color-text-muted);
  color: var(--color-bg-base);
}

.editor-step-sep {
  color: var(--color-border-base);
  font-size: var(--font-size-sm);
  flex-shrink: 0;
}

/* ── Editor generate button (full-width primary action) ── */
.editor-generate-btn {
  width: 100%;
  min-height: var(--control-height-lg);
}

