:root {
  --bg: #f4f0e9;
  --panel: rgba(255, 252, 247, 0.94);
  --panel-strong: #fffaf3;
  --ink: #201b18;
  --muted: #5a524b;
  --line: #d8cec3;
  --line-strong: #504640;
  --orange: #f2aa2f;
  --orange-deep: #df8d14;
  --orange-border: #8d5607;
  --cta-ink: #fff;
  --gold: #f5c146;
  --teal: #31c5be;
  --teal-deep: #179b95;
  --good: #31c5be;
  --good-deep: #179b95;
  --danger: #d85d62;
  --danger-deep: #bb4048;
  --danger-border: #8d2f37;
  --danger-ink: #fff9f9;
  --neutral-btn: #eee5da;
  --neutral-btn-strong: #fffdf9;
  --neutral-btn-hover: #e4d8ca;
  --support-ink: #f7fffe;
  --shadow: 0 18px 44px rgba(46, 42, 40, 0.08);
  --font-brand: "Nunito", "Avenir Next", "Segoe UI", sans-serif;
  --status-sticky-top: 164px;
  --nav-card-sticky-top: 188px;
}

/* UX simplification refresh */
:root {
  --panel: rgba(255, 252, 247, 0.98);
  --panel-strong: #fffaf4;
  --line: #d7cdc0;
  --line-strong: #594d44;
  --orange: #ff7a00;
  --orange-deep: #e06700;
  --orange-border: #934500;
  --danger: #df5c63;
  --danger-deep: #c84750;
  --danger-border: #8f3138;
  --shadow: 0 10px 24px rgba(33, 27, 22, 0.08);
}

body {
  background:
    radial-gradient(circle at top left, rgba(255, 122, 0, 0.08), transparent 28%),
    radial-gradient(circle at top right, rgba(24, 184, 175, 0.1), transparent 32%),
    linear-gradient(180deg, #faf7f2 0%, #f1ebe2 100%);
}

.panel {
  border-radius: 16px;
  box-shadow: var(--shadow);
  backdrop-filter: none;
}

.app-navbar,
.flow-nav-card,
.controls-panel,
.generate-stage-panel,
.preview-section,
.output,
.instructions,
.finish-panel {
  border-radius: 16px;
}

.controls-panel > .panel-heading,
#previewSectionPanel > .panel-heading,
#summarySectionPanel > .panel-heading,
#exportSectionPanel > .preview-header,
.setup-inline-editor-header {
  display: none;
}

.controls-panel {
  padding-top: 20px;
}

.setup-workspace,
.controls {
  gap: 18px;
}

.setup-block,
.size-crop-control,
.setup-advanced,
.generate-summary-panel,
.preview-panel,
.export-option,
.pickabrick-limit-banner,
.setup-inline-editor-frame {
  border: 1px solid rgba(89, 77, 68, 0.14);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.78);
  box-shadow: none;
}

.setup-block,
.size-crop-control {
  padding: 16px;
}

.size-crop-control {
  width: min(100%, 360px);
}

.setup-advanced {
  padding: 16px;
}

.setup-advanced summary {
  display: none;
}

.setup-advanced-grid {
  margin-top: 0;
}

.controls-panel[data-flow-card="setup-dimensions"] {
  grid-template-columns: minmax(280px, 340px) minmax(0, 1fr) !important;
  align-items: start;
  column-gap: 20px;
}

.controls-panel[data-flow-card="setup-dimensions"] .controls {
  grid-column: 1;
}

.controls-panel[data-flow-card="setup-dimensions"] #setupEnhancePanel {
  grid-column: 2;
  grid-row: 1 / span 2;
  margin-top: 0;
}

.controls-panel[data-flow-card="setup-dimensions"] .setup-inline-editor-frame {
  padding: 0;
  border: 0;
  background: transparent;
}

.controls-panel[data-flow-card="setup-dimensions"] .image-editor-shell {
  grid-template-columns: minmax(0, 1fr);
}

.controls-panel[data-flow-card="setup-dimensions"] #editorCropSidebar {
  display: none;
}

.flow-card-actions,
.sticky-export-cue,
.flow-nav-badge,
#flowNavPrimaryBtn {
  display: none !important;
}

.flow-nav-card {
  top: 172px;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 18px;
}

.flow-nav-copy {
  gap: 6px;
}

.flow-nav-copy h2 {
  font-size: clamp(1.6rem, 2.4vw, 2.2rem);
}

.flow-nav-intro {
  margin: 0;
  color: #4d443d;
  font-size: 1rem;
  line-height: 1.4;
}

.flow-nav-actions {
  align-items: center;
  gap: 10px;
}

button.mini-btn,
.mini-btn-link,
.flow-prev-btn,
.flow-next-btn,
.app-substep-pill,
.app-stepper-step,
.navbar-total-card,
.export-option,
.pickabrick-limit-choice,
.pickabrick-guide-card {
  border-radius: 12px !important;
}

button.mini-btn,
.mini-btn-link {
  min-height: 44px;
  padding: 10px 16px;
  box-shadow: none;
}

.flow-prev-btn,
.flow-next-btn {
  min-height: 48px;
  box-shadow: 0 6px 14px rgba(147, 69, 0, 0.16);
}

.flow-prev-btn,
.flow-next-btn,
button.cta-btn,
.mini-btn-link.cta-btn,
.primary-generate-btn,
.primary-export-btn {
  background: linear-gradient(180deg, #ff8a1a 0%, var(--orange) 58%, var(--orange-deep) 100%);
}

.app-stepper-step,
.app-substep-pill,
.navbar-total-card {
  box-shadow: none;
}

.app-stepper-step {
  border-radius: 14px 14px 0 0 !important;
}

.app-substep-pill {
  min-height: 48px;
  border-radius: 12px !important;
}

.app-substep-pill.active {
  background: rgba(255, 122, 0, 0.12);
  border-color: rgba(255, 122, 0, 0.44);
  color: #7b4304;
}

.app-substep-pill.complete {
  background: #e7e1d7;
  border-color: #b6aba0;
  color: #4f4943;
}

.app-substep-pill.pending,
.app-substep-pill.upcoming {
  background: #f3efe9;
  border-color: rgba(89, 77, 68, 0.12);
  color: #7a7168;
}

.app-substep-pill:not(:last-child)::after {
  background: rgba(89, 77, 68, 0.18);
}

.info-btn {
  border-radius: 999px;
  background: rgba(24, 184, 175, 0.1);
  border-color: rgba(24, 184, 175, 0.62);
  color: #0d7770;
  position: relative;
}

.info-btn:hover,
.info-btn:focus-visible {
  transform: scale(1.06);
}

.info-popover,
.floating-popover {
  border: 1px solid rgba(32, 27, 24, 0.18);
  background: rgba(28, 26, 25, 0.97);
  color: #fff7ef;
  box-shadow: 0 18px 40px rgba(21, 18, 17, 0.32);
  transform-origin: bottom center;
  transition: transform 120ms ease;
}

.floating-popover:hover,
.floating-popover:focus-within {
  transform: scale(1.02);
}

.floating-popover::after {
  display: none;
}

#boardPreset {
  display: none;
}

.board-preset-list {
  display: grid;
  gap: 10px;
  width: min(100%, 340px);
}

.board-preset-pill {
  display: block;
  width: 100%;
  text-align: left;
  padding: 12px 14px;
  border: 1px solid rgba(89, 77, 68, 0.18);
  border-radius: 12px;
  background: #fffdf9;
  color: var(--ink);
  font: inherit;
  font-weight: 800;
}

.board-preset-pill.active {
  border-color: rgba(255, 122, 0, 0.56);
  background: rgba(255, 122, 0, 0.12);
  color: #7b4304;
  box-shadow: inset 0 0 0 1px rgba(255, 122, 0, 0.22);
}

.size-crop-actions {
  margin-top: 8px;
}

.setup-inline-editor-frame {
  padding: 18px;
  background: transparent;
  border-color: rgba(89, 77, 68, 0.1);
}

.image-editor-shell {
  grid-template-columns: minmax(250px, 320px) minmax(0, 1fr);
  gap: 20px;
}

.image-editor-sidebar,
.editor-sidebar-panel,
.image-editor-stage,
.editor-stage-panel {
  gap: 16px;
}

.crop-preview-stage {
  grid-template-columns: 1fr;
}

.cropper-shell {
  width: 100%;
  max-width: 880px;
  min-height: 460px;
  margin-inline: auto;
  border-radius: 14px;
  background: #f8f5ef;
}

.controls-panel[data-flow-card="setup-dimensions"] .cropper-shell {
  max-width: none;
  min-height: clamp(320px, 42vw, 520px);
}

.image-settings-heading {
  align-items: center;
}

.image-toggle-grid {
  display: grid;
  gap: 12px;
}

.image-setting-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 12px;
  align-items: center;
  padding: 12px 14px;
  border: 1px solid rgba(89, 77, 68, 0.12);
  border-radius: 12px;
  background: #fffdf9;
}

.setting-label {
  font-weight: 800;
}

.setting-stepper {
  display: inline-grid;
  grid-template-columns: 40px 60px 82px 40px;
  gap: 8px;
  align-items: center;
}

.setting-toggle-chip {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  padding: 0 10px;
  border: 1px solid rgba(89, 77, 68, 0.24);
  border-radius: 10px;
  background: #fff;
  color: #6d655d;
  font-size: 0.86rem;
  font-weight: 800;
  cursor: pointer;
}

.setting-toggle-chip input {
  position: absolute;
  inset: 0;
  opacity: 0;
  width: 100%;
  height: 100%;
  cursor: pointer;
}

.setting-toggle-chip:has(input:checked) {
  background: rgba(49, 197, 190, 0.14);
  border-color: rgba(23, 155, 149, 0.5);
  color: #117d77;
}

.setting-stepper input {
  width: 82px;
  min-height: 42px;
  text-align: center;
  border: 1px solid rgba(89, 77, 68, 0.24);
  border-radius: 10px;
  background: #fff;
  color: var(--ink);
  font: inherit;
  font-weight: 800;
}

.stepper-btn {
  min-width: 40px;
  padding-inline: 0;
}

.image-settings-actions,
.crop-tools-row,
.crop-action-row {
  justify-content: flex-start;
  flex-wrap: wrap;
}

#setupPreviewCanvas,
#generateSummaryCanvas,
#imageControlsPreviewCanvas,
#originalCanvas,
#mosaicCanvas,
#exportSafeCanvas {
  aspect-ratio: auto !important;
  height: auto;
}

#setupPreviewCanvas {
  display: block;
  width: 100%;
  height: auto;
  max-width: 220px;
}

.generate-stage-panel {
  padding: 24px;
}

.generate-summary-panel {
  grid-template-columns: 1fr;
  justify-items: center;
  gap: 18px;
}

#generateSummaryCanvas {
  width: min(100%, 560px);
  max-width: 560px;
}

.generate-summary-copy {
  width: min(100%, 840px);
  justify-items: stretch;
}

.generate-summary-title-row {
  justify-content: center;
  margin-bottom: 10px;
}

.generate-summary-title-row .info-btn {
  display: none;
}

.generate-summary-band {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 18px;
  justify-content: center;
  padding: 14px 18px;
  border: 1px solid rgba(89, 77, 68, 0.14);
  border-radius: 14px;
  background: #fffdf9;
  font-weight: 700;
}

.primary-action-wrap {
  width: auto;
  margin-inline: auto;
}

#reviewGenerateCard > .control-actions {
  display: flex !important;
  justify-content: center;
  margin-top: 18px;
}

#reviewGenerateCard .primary-action-wrap {
  width: auto;
}

.primary-generate-btn {
  width: auto;
  min-width: 240px;
}

.preview-layout {
  grid-template-columns: 1fr;
}

.preview-layout > .preview-panel:first-child {
  display: none;
}

.lego-plan-panel {
  padding: 18px;
}

.plan-preview-stack {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.plan-preview-block {
  display: grid;
  gap: 12px;
}

.preview-panel canvas,
.plan-preview-block canvas,
#imageControlsPreviewCanvas {
  width: 100%;
  border-radius: 14px;
  border: 1px solid rgba(89, 77, 68, 0.12);
  background: #fff;
}

#imageControlsPreviewCanvas {
  max-width: 980px;
  margin-inline: auto;
}

.export-options {
  grid-template-columns: 1fr;
}

.export-option {
  padding: 18px;
  width: min(100%, 560px);
}

.finish-panel {
  display: grid;
  justify-items: center;
  gap: 18px;
  padding: 36px 24px;
  text-align: center;
}

.finish-copy h2,
.finish-copy p {
  margin: 0;
}

.finish-copy {
  display: grid;
  gap: 8px;
}

.legacy-image-controls {
  display: none !important;
}

.sticky-export-cue {
  display: none !important;
}

@media (max-width: 900px) {
  .controls-panel[data-flow-card="setup-dimensions"] {
    grid-template-columns: 1fr;
  }

  .controls-panel[data-flow-card="setup-dimensions"] #setupEnhancePanel {
    grid-column: 1;
    grid-row: auto;
  }

  .image-editor-shell {
    grid-template-columns: 1fr;
  }

  .cropper-shell {
    min-height: 380px;
  }

  .plan-preview-stack {
    grid-template-columns: 1fr;
  }

  .image-setting-row {
    grid-template-columns: 1fr;
  }

  .setting-stepper {
    justify-content: start;
  }
}

* {
  box-sizing: border-box;
}

.hidden {
  display: none !important;
}

body {
  margin: 0;
  font-family: var(--font-brand);
  color: var(--ink);
  background:
    radial-gradient(circle at top left, rgba(242, 170, 47, 0.1), transparent 28%),
    radial-gradient(circle at top right, rgba(24, 184, 175, 0.12), transparent 32%),
    linear-gradient(180deg, #faf7f1 0%, var(--bg) 100%);
  overflow-x: hidden;
}

.app {
  max-width: 1180px;
  margin: 0 auto;
  padding: 28px 24px 40px;
  display: grid;
  gap: 18px;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 20px;
  box-shadow: var(--shadow);
  padding: 22px;
  backdrop-filter: blur(10px);
}

.section-kicker,
.overlay-eyebrow {
  margin: 0;
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--teal-deep);
}

.panel-heading h2,
.preview-header h2,
.preview-header h3,
.preview-panel h3,
.plan-preview-block h4 {
  margin: 0;
  font-family: var(--font-brand);
}

.status-banner {
  position: sticky;
  top: var(--status-sticky-top);
  z-index: 20;
  border: 1px solid #d0c4b8;
  border-radius: 16px;
  background: rgba(255, 249, 240, 0.96);
  color: #473f39;
  padding: 12px 16px;
  backdrop-filter: blur(10px);
  box-shadow: 0 16px 30px rgba(46, 42, 40, 0.08);
}

.status-banner.error {
  border-color: #d8938a;
  background: rgba(255, 241, 239, 0.98);
  color: #7a221a;
}

.status-banner.success {
  border-color: rgba(43, 182, 172, 0.4);
  background: rgba(238, 250, 248, 0.98);
  color: #145f58;
}

.app-navbar {
  position: sticky;
  top: 12px;
  z-index: 18;
  display: grid;
  grid-template-columns: minmax(190px, 240px) minmax(0, 1fr) minmax(150px, 190px);
  gap: 14px;
  align-items: center;
  padding: 14px 16px;
  background: rgba(255, 252, 247, 0.92);
  backdrop-filter: blur(12px);
  transition: grid-template-columns 180ms ease, padding 180ms ease, box-shadow 180ms ease;
}

.app-navbar.navbar-compact {
  grid-template-columns: minmax(190px, 240px) minmax(0, 1fr) minmax(150px, 190px);
  box-shadow: 0 16px 44px rgba(46, 42, 40, 0.12);
}

.app-navbar-brand {
  min-width: 0;
  height: 64px;
  overflow: hidden;
  display: flex;
  align-items: center;
}

.app-navbar.navbar-compact .app-navbar-brand {
  height: 64px;
}

.app-navbar-logo {
  width: 220px;
  max-width: none;
  display: block;
  margin-left: -10px;
  margin-top: -18px;
  margin-bottom: -24px;
}

.app-navbar.navbar-compact .app-navbar-logo {
  width: 220px;
  margin-left: -10px;
  margin-top: -18px;
  margin-bottom: -24px;
}

.app-navbar-timeline {
  min-width: 0;
  display: grid;
  gap: 0;
}

.app-stepper {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  position: relative;
  align-items: stretch;
  border-bottom: 1px solid rgba(73, 67, 63, 0.12);
}

.app-stepper::before {
  display: none;
}

.app-stepper-step {
  position: relative;
  z-index: 1;
  min-width: 0;
  min-height: 78px;
  height: 100%;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  text-align: left;
  padding: 14px 14px 16px;
  border: 1px solid rgba(73, 67, 63, 0.18);
  border-bottom: none;
  border-radius: 18px 18px 0 0;
  background: rgba(245, 241, 235, 0.94);
  color: var(--ink);
  box-shadow: none;
}

.app-navbar.navbar-compact .app-stepper-step {
  min-height: 72px;
  padding: 11px 12px 14px;
}

.app-stepper-step.active {
  border-color: rgba(73, 67, 63, 0.22);
  background: linear-gradient(180deg, rgba(255, 252, 247, 1), rgba(255, 255, 255, 0.98));
  box-shadow: 0 -8px 18px rgba(46, 42, 40, 0.05);
}

.app-stepper-step.complete {
  border-color: rgba(73, 67, 63, 0.16);
  background: rgba(236, 230, 222, 0.94);
  color: #4d4945;
}

.app-stepper-step.complete .app-stepper-index {
  background: #77716a;
  border-radius: 8px;
  color: #fff;
}

.app-stepper-step.future {
  border-color: rgba(73, 67, 63, 0.1);
  background: rgba(243, 239, 233, 0.7);
  color: #6e6660;
  box-shadow: none;
}

.app-stepper-step:disabled {
  cursor: not-allowed;
}

.app-stepper-index {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 999px;
  background: var(--orange);
  color: var(--cta-ink);
  font-weight: 900;
  box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.62);
}

.app-stepper-copy {
  min-width: 0;
  display: grid;
  gap: 2px;
}

.app-stepper-copy strong,
.app-stepper-copy small {
  min-width: 0;
  overflow-wrap: anywhere;
}

.app-stepper-copy strong {
  font-size: 0.9rem;
  line-height: 1.2;
}

.app-substep-rail {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 24px;
  padding: 14px 0 0;
  min-width: 0;
}

.app-substep-pill {
  appearance: none;
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 34px;
  padding: 7px 10px;
  border: 1px solid rgba(73, 67, 63, 0.12);
  border-radius: 999px;
  background: rgba(238, 236, 232, 0.76);
  color: #665f58;
  font-size: 0.84rem;
  font-weight: 800;
  font-family: inherit;
  white-space: nowrap;
  box-shadow: none;
}

.app-navbar.navbar-compact .app-substep-pill {
  min-height: 28px;
  padding: 5px 9px;
  font-size: 0.78rem;
}

.app-navbar-side {
  min-width: 0;
  display: grid;
  gap: 8px;
}

.app-navbar-totals {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
  margin-top: 10px;
}

.navbar-total-card {
  min-width: 0;
  display: grid;
  gap: 2px;
  padding: 8px 10px;
  border: 1px solid rgba(73, 67, 63, 0.12);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.78);
}

.app-navbar.navbar-compact .navbar-total-card {
  padding: 6px 10px;
}

.navbar-new-project {
  width: 100%;
  justify-content: center;
  box-shadow: none !important;
  background: rgba(216, 93, 98, 0.1) !important;
  color: #962e35 !important;
  border-color: rgba(141, 47, 55, 0.28) !important;
}

.navbar-new-project:hover:not(:disabled) {
  background: rgba(216, 93, 98, 0.16) !important;
  box-shadow: none !important;
}

.navbar-total-card span {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 900;
  letter-spacing: 0.08em;
  line-height: 1;
  text-transform: uppercase;
}

.navbar-total-card strong {
  min-width: 0;
  color: var(--ink);
  font-size: 1.08rem;
  font-weight: 900;
  line-height: 1.15;
  overflow-wrap: anywhere;
}

.app-substep-pill:not(:last-child)::after {
  content: "";
  position: absolute;
  right: -25px;
  top: 50%;
  width: 24px;
  height: 2px;
  background: rgba(73, 67, 63, 0.18);
  transform: translateY(-50%);
}

.substep-status {
  position: relative;
  display: inline-grid;
  place-items: center;
  width: 14px;
  height: 14px;
  flex: 0 0 auto;
  border: 2px solid rgba(73, 67, 63, 0.24);
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.7);
}

.app-substep-pill.active {
  border-color: rgba(251, 134, 0, 0.44);
  background: rgba(251, 134, 0, 0.14);
  color: #6b3d06;
  box-shadow: 0 8px 22px rgba(225, 111, 0, 0.14);
}

.app-substep-pill.active .substep-status {
  border-color: var(--orange);
  background: var(--orange);
  box-shadow: inset 0 0 0 3px #fff;
}

.app-substep-pill.complete {
  border-color: rgba(73, 67, 63, 0.16);
  background: rgba(218, 215, 210, 0.9);
  color: #4d4945;
}

.app-substep-pill.complete .substep-status {
  border-color: #716b64;
  background: #716b64;
}

.app-substep-pill.complete .substep-status::after {
  content: "";
  width: 6px;
  height: 3px;
  border-left: 2px solid #fff;
  border-bottom: 2px solid #fff;
  transform: rotate(-45deg) translateY(-1px);
}

.app-substep-pill.upcoming {
  background: rgba(244, 242, 238, 0.86);
  color: #756f68;
}

.app-substep-pill.pending {
  background: rgba(241, 239, 235, 0.5);
  color: #7c746d;
}

.app-substep-pill:disabled {
  cursor: not-allowed;
}

.app-stage-panel {
  display: grid;
  gap: 18px;
}

.flow-nav-card {
  position: sticky;
  top: var(--nav-card-sticky-top);
  z-index: 17;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 18px;
  align-items: center;
  padding: 16px 20px;
  background: rgba(255, 252, 247, 0.94);
}

.flow-nav-copy {
  min-width: 0;
  display: grid;
  gap: 6px;
}

.flow-nav-heading-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.flow-nav-heading-row h2 {
  margin: 0;
  font-size: clamp(1.3rem, 2vw, 1.7rem);
  line-height: 1.08;
}

.flow-nav-intro {
  margin: 0;
  color: var(--muted);
}

.flow-nav-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: fit-content;
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(24, 184, 175, 0.12);
  color: var(--teal-deep);
  font-size: 0.74rem;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  white-space: nowrap;
}

.flow-nav-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 10px;
  align-items: center;
}

.flow-nav-actions .mini-btn,
.flow-nav-actions .flow-prev-btn,
.flow-nav-actions .flow-next-btn {
  min-height: 50px;
}

.panel-heading {
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: 16px;
  margin-bottom: 18px;
}

.home-panel {
  display: grid;
  gap: 18px;
}

.home-panel-header {
  display: flex;
  justify-content: flex-start;
  align-items: end;
  gap: 16px;
}

.home-panel-header h1 {
  margin: 0;
  font-size: clamp(2.2rem, 5vw, 3.25rem);
  line-height: 1;
}

.home-panel-header p {
  margin: 8px 0 0;
}

.home-gallery {
  display: grid;
  gap: 18px;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
}

.home-gallery-empty {
  margin: 0;
}

.home-card {
  display: grid;
  gap: 10px;
  align-content: start;
  padding: 14px;
  border: 1px solid rgba(73, 67, 63, 0.12);
  border-radius: 26px;
  background: linear-gradient(180deg, rgba(255,255,255,0.96), rgba(255,249,242,0.94));
  box-shadow: 0 14px 36px rgba(61, 52, 46, 0.08);
  min-height: 220px;
  text-align: left;
}

.home-card:hover {
  transform: translateY(-2px);
}

.home-card-thumb {
  width: 100%;
  aspect-ratio: 4 / 5;
  object-fit: cover;
  border-radius: 20px;
  border: 1px solid rgba(73, 67, 63, 0.12);
  background: #f7f2eb;
}

.home-card-name {
  display: block;
  font-weight: 800;
  word-break: break-word;
}

.home-card-upload {
  place-items: center;
  justify-items: center;
  border-style: dashed;
  background: linear-gradient(180deg, rgba(255,250,244,0.98), rgba(242,250,248,0.92));
  text-align: center;
}

.home-card-plus {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 72px;
  height: 72px;
  border-radius: 24px;
  background: rgba(255,255,255,0.92);
  font-size: 2rem;
  font-weight: 900;
  color: var(--orange-deep);
  box-shadow: inset 0 0 0 1px rgba(73, 67, 63, 0.1);
}

.section-intro {
  margin: 6px 0 0;
}

.controls-panel {
  display: grid;
  gap: 14px;
  grid-template-columns: minmax(0, 1fr) !important;
}

.controls {
  display: grid;
  gap: 14px;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  align-items: start;
}

.setup-upload-summary {
  display: grid;
  grid-template-columns: minmax(132px, 220px) minmax(0, 1fr);
  gap: 14px;
  align-items: center;
  padding: 14px;
  border: 1px solid rgba(73, 67, 63, 0.1);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.78);
}

.setup-upload-summary canvas {
  display: block;
  width: 100%;
  height: auto;
  justify-self: start;
}

.setup-upload-meta {
  min-width: 0;
  display: grid;
  gap: 4px;
}

.setup-upload-meta strong,
.setup-upload-meta p {
  min-width: 0;
  margin: 0;
}

#setupUploadSummaryName {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.setup-advanced {
  border: 1px solid rgba(73, 67, 63, 0.14);
  border-radius: 18px;
  background: #fffdfa;
  padding: 2px 0;
}

.setup-advanced summary {
  cursor: pointer;
  list-style: none;
  padding: 14px 16px;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: linear-gradient(180deg, rgba(255,250,244,0.98), rgba(255,245,236,0.98));
}

.setup-advanced summary::-webkit-details-marker {
  display: none;
}

.setup-advanced summary::after {
  content: "▾";
  color: var(--orange-deep);
  font-size: 1rem;
  transition: transform 120ms ease;
}

.setup-advanced[open] summary::after {
  transform: rotate(180deg);
}

.setup-advanced-grid {
  padding: 0 16px 14px;
  display: grid;
  gap: 14px;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.setup-advanced-grid label,
.setup-advanced-grid .toggle-group {
  justify-items: start;
}

.piece-settings-tools .mini-btn {
  width: min(100%, 260px);
}

#applyBoardRecommendation {
  justify-self: start;
}

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

.size-crop-control {
  padding: 14px;
  border: 1px solid rgba(73, 67, 63, 0.12);
  border-radius: 18px;
  background: linear-gradient(180deg, rgba(255, 251, 246, 0.98), rgba(255, 255, 255, 0.94));
}

.dimensions-hidden-select {
  display: none;
}

.size-crop-summary {
  display: grid;
  gap: 6px;
  padding: 12px 14px;
  border: 1px solid rgba(73, 67, 63, 0.1);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.82);
}

.size-crop-summary strong,
.size-crop-summary p {
  margin: 0;
}

.size-crop-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

label,
.static-control {
  display: grid;
  gap: 8px;
  font-weight: 700;
}

input,
select,
button {
  font: inherit;
  border-radius: 14px;
}

input,
select {
  width: 100%;
  padding: 12px 13px;
  border: 1px solid #c8c0b5;
  background: #fffefb;
  color: var(--ink);
}

#buildStyle,
#baseboardColor,
#mosaicType {
  width: min(100%, 320px);
}

input[type="file"] {
  padding: 10px 12px;
  background: #fffdf8;
}

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

.file-input-shell {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  min-width: 0;
  min-height: 48px;
  padding: 8px 10px;
  border: 1px solid #c8c0b5;
  border-radius: 16px;
  background: #fffefb;
  overflow: visible;
}

.file-input-shell .mini-btn {
  flex: 0 0 auto;
}

.image-controls-preview {
  display: grid;
  gap: 10px;
  margin-bottom: 10px;
  justify-items: start;
}

.image-controls-preview canvas {
  width: min(100%, 760px);
  max-width: 100%;
  border: 1px solid rgba(49, 45, 43, 0.24);
  border-radius: 14px;
  background: #fff;
}

.file-input-name {
  display: block;
  flex: 1 1 auto;
  min-width: 0;
  max-width: 100%;
  color: var(--muted);
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.file-input-name.file-name-expanded {
  position: absolute;
  z-index: 30;
  left: var(--file-name-left, 10px);
  right: 10px;
  top: 50%;
  min-height: 38px;
  max-height: 38px;
  display: flex;
  align-items: center;
  padding: 8px 10px;
  transform: translateY(-50%);
  border: 1px solid rgba(73, 67, 63, 0.18);
  border-radius: 12px;
  background: rgba(255, 254, 251, 0.98);
  box-shadow: 0 16px 34px rgba(46, 42, 40, 0.18);
  color: var(--ink);
  white-space: nowrap;
  overflow-x: auto;
  overflow-y: hidden;
  text-overflow: clip;
  scrollbar-width: thin;
}

.helper-text {
  font-weight: 500;
  color: var(--muted);
  line-height: 1.45;
}

.streamlined-note {
  padding: 10px 12px;
  border-radius: 12px;
  background: rgba(24, 184, 175, 0.08);
  color: #3d4f4c;
}

.aspect-ratio-warning {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding: 12px 14px;
  border: 1px solid rgba(141, 47, 55, 0.28);
  border-radius: 14px;
  background: rgba(216, 93, 98, 0.1);
  color: #962e35;
}

.aspect-ratio-warning-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: 999px;
  background: rgba(216, 93, 98, 0.16);
  color: #962e35;
  font-weight: 900;
  line-height: 1;
  flex: 0 0 auto;
}

.aspect-ratio-warning.top-card-warning {
  grid-column: 1 / -1;
  margin-bottom: 4px;
}

.aspect-ratio-warning-copy {
  display: grid;
  gap: 8px;
}

.aspect-ratio-warning-copy p {
  margin: 0;
}

.crop-surface-active {
  cursor: crosshair;
}

.crop-surface-active.crop-surface-moving {
  cursor: move;
}

.section-note {
  margin: 0;
}

.sticky-export-cue {
  display: none !important;
}

.static-control-value {
  display: block;
  padding: 12px 13px;
  border: 1px solid #c8c0b5;
  border-radius: 14px;
  background: #fffefb;
  color: var(--ink);
  font-weight: 700;
}

.control-actions,
.adjust-actions,
.palette-presets,
.instructions-actions,
.customize-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

.export-pair {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

button {
  border: 1px solid transparent;
  background: linear-gradient(180deg, var(--neutral-btn-strong), var(--neutral-btn));
  color: var(--ink);
  border-color: rgba(67, 59, 54, 0.34);
  cursor: pointer;
  font-family: var(--font-brand);
  font-weight: 900;
  letter-spacing: 0;
  padding: 12px 16px;
  box-shadow: 0 2px 0 rgba(67, 59, 54, 0.06);
  transition: transform 120ms ease, filter 120ms ease, box-shadow 120ms ease;
}

.primary-action-wrap {
  width: 100%;
}

.primary-generate-btn {
  width: 100%;
  min-height: 60px;
  font-size: 1.12rem;
  padding-inline: 24px;
}

.setup-continue-btn {
  width: auto;
  min-height: 52px;
}

.control-actions {
  justify-content: space-between;
}

.flow-card-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
  margin-top: 18px;
}

#setupStagePanel > .panel > .control-actions,
#reviewStagePanel > .panel > .control-actions,
.flow-card-actions {
  display: none !important;
}

.flow-prev-btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  min-height: 52px;
  padding: 13px 22px 13px 54px;
  border-radius: 12px;
  background: linear-gradient(180deg, #fffdf8 0%, #f3ece3 100%);
  border-color: rgba(132, 108, 78, 0.3);
  color: #5e5147;
  box-shadow: 0 4px 14px rgba(67, 59, 54, 0.08);
}

.flow-prev-btn::before {
  content: "";
  position: absolute;
  left: 21px;
  width: 12px;
  height: 12px;
  border-top: 3px solid currentColor;
  border-left: 3px solid currentColor;
  transform: rotate(-45deg);
}

.flow-prev-btn:hover:not(:disabled) {
  background: linear-gradient(180deg, #ffffff 0%, #f4ede4 100%);
  border-color: rgba(132, 108, 78, 0.38);
  box-shadow: 0 7px 18px rgba(67, 59, 54, 0.1);
}

.flow-next-btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  min-height: 52px;
  border-radius: 12px;
  background: linear-gradient(180deg, #fffdf8 0%, #f3ece3 100%);
  border-color: rgba(132, 108, 78, 0.3);
  color: #5e5147;
  box-shadow: 0 4px 14px rgba(67, 59, 54, 0.08);
  padding: 13px 54px 13px 22px;
}

.flow-next-btn::before {
  content: "";
  position: absolute;
  right: 21px;
  width: 12px;
  height: 12px;
  border-top: 3px solid currentColor;
  border-right: 3px solid currentColor;
  transform: rotate(45deg);
}

.flow-next-btn:hover:not(:disabled) {
  background: linear-gradient(180deg, #ffffff 0%, #f4ede4 100%);
  border-color: rgba(132, 108, 78, 0.38);
  box-shadow: 0 7px 18px rgba(67, 59, 54, 0.1);
}

.gleam-btn {
  position: relative;
  overflow: hidden;
}

.gleam-btn::after {
  content: "";
  position: absolute;
  top: -18%;
  left: -34%;
  width: 32%;
  height: 140%;
  transform: rotate(18deg);
  background: linear-gradient(90deg, rgba(255,255,255,0) 0%, rgba(255,255,255,0.18) 45%, rgba(255,255,255,0.62) 50%, rgba(255,255,255,0.18) 55%, rgba(255,255,255,0) 100%);
  pointer-events: none;
  opacity: 0;
}

.gleam-btn.gleam-active::after {
  opacity: 1;
  animation: gleamSweep 3.4s linear infinite;
}

@keyframes gleamSweep {
  0% { left: -34%; }
  100% { left: 132%; }
}

button:hover:not(:disabled) {
  transform: translateY(-1px);
  filter: brightness(0.98);
}

button:disabled {
  cursor: not-allowed;
  opacity: 1;
  color: #6a6158 !important;
  background: #e6ddd2 !important;
  border-color: #b7aa9a !important;
  box-shadow: none !important;
  filter: none;
}

button.mini-btn,
.mini-btn-link {
  background: linear-gradient(180deg, var(--neutral-btn-strong), var(--neutral-btn));
  color: var(--ink);
  border-color: rgba(67, 59, 54, 0.34);
  box-shadow: 0 2px 0 rgba(67, 59, 54, 0.08);
  padding: 9px 13px;
  font-weight: 800;
}

button.mini-btn:hover:not(:disabled),
.mini-btn-link:hover {
  background: linear-gradient(180deg, #fffdf8, var(--neutral-btn-hover));
}

button.cta-btn,
.mini-btn-link.cta-btn,
.primary-generate-btn,
.primary-export-btn,
.sticky-export-action {
  background: linear-gradient(135deg, var(--orange) 0%, var(--orange-deep) 100%);
  border-color: var(--orange-border);
  color: var(--cta-ink);
  box-shadow: 0 14px 28px rgba(143, 90, 3, 0.2);
}

button.cta-btn:hover:not(:disabled),
.mini-btn-link.cta-btn:hover,
.primary-generate-btn:hover:not(:disabled),
.primary-export-btn:hover:not(:disabled),
.sticky-export-action:hover:not(:disabled) {
  background: linear-gradient(135deg, var(--orange) 0%, var(--orange-deep) 100%);
  box-shadow: 0 18px 34px rgba(143, 90, 3, 0.24);
}

#clearCropBtn {
  background: rgba(216, 93, 98, 0.1) !important;
  color: #962e35 !important;
  border-color: rgba(141, 47, 55, 0.28) !important;
  box-shadow: none !important;
}

#clearCropBtn:hover:not(:disabled) {
  background: rgba(216, 93, 98, 0.16) !important;
}

button.success-btn,
.mini-btn-link.success-btn {
  background: linear-gradient(135deg, var(--good) 0%, var(--good-deep) 100%);
  border-color: rgba(15, 126, 120, 0.84);
  color: var(--support-ink);
  box-shadow: 0 12px 24px rgba(15, 126, 120, 0.18);
}

button.success-btn:hover:not(:disabled),
.mini-btn-link.success-btn:hover {
  background: linear-gradient(135deg, #347f79 0%, #255f5b 100%);
  box-shadow: 0 16px 30px rgba(31, 95, 91, 0.22);
}

button.danger-btn,
.mini-btn-link.danger-btn,
.sticky-export-dismiss {
  background: rgba(216, 93, 98, 0.1);
  border-color: rgba(141, 47, 55, 0.28);
  color: #962e35;
  box-shadow: none;
}

button.danger-btn:hover:not(:disabled),
.mini-btn-link.danger-btn:hover,
.sticky-export-dismiss:hover:not(:disabled) {
  background: rgba(216, 93, 98, 0.16);
  box-shadow: none;
}

button:focus-visible,
.mini-btn-link:focus-visible {
  outline: 3px solid #1f1a17;
  outline-offset: 3px;
}

.info-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  min-width: 24px;
  min-height: 24px;
  flex: 0 0 24px;
  aspect-ratio: 1 / 1;
  padding: 0;
  border-radius: 999px;
  border: 1px solid rgba(15, 126, 120, 0.5);
  background: rgba(24, 184, 175, 0.12);
  color: var(--teal-deep);
  box-shadow: none;
  font-size: 0.82rem;
  font-weight: 900;
}

.inline-info-control {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.info-popover {
  margin-top: 8px;
  padding: 12px 14px;
  border-radius: 14px;
  border: 1px solid rgba(24, 148, 139, 0.16);
  background: rgba(238, 250, 248, 0.92);
  color: #235853;
  font-size: 0.94rem;
  font-weight: 700;
  line-height: 1.45;
}

.floating-popover {
  position: fixed;
  z-index: 70;
  width: min(320px, calc(100vw - 24px));
  margin-top: 0;
  box-shadow: 0 16px 36px rgba(46, 42, 40, 0.14);
  transform-origin: bottom center;
  background: rgba(238, 250, 248, 0.98);
  color: #1f5f5a;
}

.floating-popover::after {
  display: none;
}

.generate-summary-panel {
  display: grid;
  grid-template-columns: minmax(110px, 150px) minmax(0, 1fr);
  gap: 18px;
  align-items: center;
  padding: 16px 18px;
  border: 1px solid rgba(73, 67, 63, 0.1);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.78);
}

.generate-summary-copy {
  min-width: 0;
  display: grid;
  gap: 12px;
}

.generate-summary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 10px;
}

.generate-summary-chip {
  display: grid;
  gap: 3px;
  padding: 12px 14px;
  border: 1px solid rgba(73, 67, 63, 0.08);
  border-radius: 14px;
  background: rgba(250, 247, 242, 0.88);
}

.generate-summary-chip span {
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.generate-summary-chip strong,
.generate-summary-panel .helper-text {
  margin: 0;
}

.preview-section,
.preview-step-content,
#summaryStepContent,
#exportStepContent {
  display: grid;
  gap: 18px;
}

.step-empty-state {
  padding: 18px;
  border: 1px dashed rgba(73, 67, 63, 0.22);
  border-radius: 20px;
  background: linear-gradient(180deg, rgba(255, 250, 244, 0.88), rgba(255, 255, 255, 0.92));
}

.step-empty-state h3 {
  margin: 0 0 8px;
  font-size: 1.05rem;
}

.step-empty-state p {
  margin: 0;
}

.enhance-panel,
.image-settings-panel {
  display: grid;
  gap: 14px;
  padding: 16px 18px;
  border: 1px solid rgba(73, 67, 63, 0.14);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.84);
}

#setupEnhancePanel {
  width: 100%;
  min-width: 0;
  justify-self: stretch;
}

.enhance-copy h3,
.export-option-title {
  margin: 0;
}

.image-controls-preview h4 {
  margin: 0;
  font-size: 1rem;
}

.enhance-copy p {
  margin: 6px 0 0;
}

.enhance-actions,
.preview-quick-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.preview-quick-actions {
  margin-top: -4px;
}

.image-settings-layout,
.image-settings-controls,
.image-settings-tools,
.image-slider-grid,
.interactive-customization-panel {
  display: grid;
  gap: 14px;
}

.image-settings-launcher {
  display: grid;
  gap: 10px;
}

.image-settings-launcher p {
  margin: 0;
}

.setup-inline-editor-frame {
  display: grid;
  gap: 18px;
  min-width: 0;
}

.setup-inline-editor-header {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 14px;
}

.setup-inline-editor-header h3 {
  margin: 0;
  font-size: 1.2rem;
}

.setup-inline-editor-header p {
  margin: 6px 0 0;
}

.setup-inline-editor-mount {
  display: grid;
  gap: 0;
  min-height: 640px;
  width: 100%;
  min-width: 0;
  padding-top: 14px;
  border-top: 1px solid rgba(73, 67, 63, 0.12);
  overflow: hidden;
}

.setup-inline-editor-mount .image-editor-shell {
  display: grid;
  width: 100%;
  min-width: 0;
  grid-template-columns: minmax(300px, 390px) minmax(0, 1fr);
  align-items: start;
  gap: 20px;
}

.setup-inline-editor-mount .image-editor-stage {
  align-self: start;
  min-width: 0;
}

.setup-editor-layout {
  display: grid;
  gap: 16px;
  grid-template-columns: 1fr;
  align-items: start;
}

.setup-image-preview {
  display: grid;
  gap: 10px;
  min-width: 0;
  justify-items: center;
  padding-top: 4px;
}

.setup-image-preview h4 {
  margin: 0;
  font-size: 1rem;
  width: min(100%, 360px);
}

#setupPreviewCanvas,
#generateSummaryCanvas {
  width: 100%;
  max-width: 100%;
  display: block;
  aspect-ratio: 1 / 1;
  border: 1px solid rgba(49, 45, 43, 0.16);
  border-radius: 16px;
  background: #fff;
}

.setup-image-preview .helper-text {
  width: min(100%, 360px);
  margin: 0;
}

.image-editor-modal {
  width: min(1180px, 96vw);
}

.image-editor-tabs {
  display: grid;
  grid-template-columns: repeat(2, minmax(140px, auto)) 1fr 72px 72px;
  gap: 0;
  align-items: end;
  border-bottom: 1px solid rgba(73, 67, 63, 0.14);
  margin-top: 8px;
}

.image-editor-tab,
.image-editor-tab-ghost {
  min-height: 58px;
  border-radius: 18px 18px 0 0;
  border: 1px solid rgba(73, 67, 63, 0.16);
  border-bottom: none;
  background: rgba(255, 247, 240, 0.92);
}

.image-editor-tab {
  font-weight: 900;
}

.image-editor-tab.active {
  background: #fffaf4;
  box-shadow: 0 -8px 20px rgba(46, 42, 40, 0.06);
}

.image-editor-tab-filler {
  height: 1px;
}

.image-editor-tab-ghost {
  display: block;
  background: rgba(255,255,255,0.72);
}

.image-editor-shell {
  display: grid;
  grid-template-columns: minmax(230px, 290px) minmax(0, 1fr);
  gap: 18px;
  align-items: start;
}

.image-editor-sidebar,
.editor-sidebar-panel,
.image-editor-stage,
.editor-stage-panel {
  display: grid;
  gap: 14px;
}

.quick-changes-panel {
  background: linear-gradient(180deg, rgba(255, 250, 244, 0.98), rgba(255, 255, 255, 0.98));
}

.editor-advanced-tools {
  border: 1px solid rgba(73, 67, 63, 0.14);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.9);
  overflow: hidden;
}

.editor-advanced-tools summary {
  cursor: pointer;
  list-style: none;
  padding: 14px 16px;
  font-weight: 800;
  background: linear-gradient(180deg, rgba(255,250,244,0.98), rgba(255,255,255,0.96));
}

.editor-advanced-tools summary::-webkit-details-marker {
  display: none;
}

.editor-advanced-body {
  display: grid;
  gap: 14px;
  padding: 0 16px 16px;
}

.helper-only-tools .image-tool-card {
  background: rgba(255, 255, 255, 0.72);
}

.editor-sidebar-panel h3 {
  font-size: 1.05rem;
}

.image-editor-stage {
  min-width: 0;
}

.editor-stage-panel {
  min-width: 0;
}

.image-settings-layout {
  grid-template-columns: minmax(240px, 320px) minmax(0, 1fr);
  align-items: start;
}

.image-settings-tools {
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
}

.interactive-customization-panel {
  padding: 14px 16px;
  border: 1px solid rgba(73, 67, 63, 0.1);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.82);
}

.interactive-customization-header h4,
.interactive-customization-input span {
  margin: 0;
  font-size: 1rem;
  font-weight: 800;
}

.interactive-customization-header p {
  margin: 6px 0 0;
}

.interactive-customization-input {
  display: grid;
  gap: 8px;
}

.interactive-customization-input textarea {
  width: 100%;
  min-height: 84px;
  padding: 12px 14px;
  border: 1px solid rgba(73, 67, 63, 0.16);
  border-radius: 14px;
  resize: vertical;
  font: inherit;
  background: rgba(255, 255, 255, 0.92);
  color: var(--ink);
}

.interactive-customization-actions,
.interactive-quick-grid {
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
}

#customizationSummary {
  margin: 0;
}

.image-tool-card {
  display: grid;
  gap: 8px;
  padding: 12px 14px;
  border: 1px solid rgba(73, 67, 63, 0.12);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.86);
}

.image-tool-card p {
  margin: 0;
}

.image-settings-note {
  margin: 0;
}

.image-slider-grid {
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.image-slider-grid label {
  padding: 12px 14px;
  border: 1px solid rgba(73, 67, 63, 0.12);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.78);
}

.image-settings-actions {
  margin-top: 4px;
}

.preview-layout {
  display: grid;
  gap: 18px;
}

.preview-panel {
  min-width: 0;
}

.preview-panel h3,
.plan-preview-block h4 {
  font-size: 1.08rem;
}

.preview-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}

.lego-plan-panel {
  display: grid;
  gap: 16px;
}

.preview-panel canvas,
canvas {
  width: 100%;
  max-width: 100%;
  display: block;
  height: auto;
  border: 1px solid rgba(49, 45, 43, 0.24);
  border-radius: 18px;
  background: #fff;
}

#originalCanvas,
#planPlaceholderCanvas,
#mosaicCanvas,
#exportSafeCanvas {
  max-width: 100%;
}

.plan-preview-stack {
  display: grid;
  gap: 18px;
}

.plan-preview-block {
  display: grid;
  gap: 10px;
}

.output,
.instructions {
  display: grid;
  gap: 14px;
}

.export-options {
  display: grid;
  gap: 14px;
  grid-template-columns: minmax(0, 460px);
}

.export-option {
  display: grid;
  gap: 8px;
  border: 1px solid rgba(73, 67, 63, 0.14);
  border-radius: 16px;
  padding: 14px 16px;
  background: rgba(255, 255, 255, 0.84);
}

.export-option-primary {
  border-color: rgba(251, 134, 0, 0.2);
  background: linear-gradient(180deg, rgba(255,250,244,0.98), rgba(255,244,232,0.98));
}

.primary-export-btn {
  min-height: 54px;
}

.export-option-inline {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.pickabrick-limit-banner {
  display: grid;
  gap: 14px;
  margin-bottom: 14px;
  padding: 16px 18px;
  border: 1px solid rgba(191, 97, 50, 0.24);
  border-left: 5px solid rgba(191, 97, 50, 0.88);
  border-radius: 18px;
  background: linear-gradient(180deg, rgba(255, 249, 243, 0.98), rgba(255, 240, 229, 0.98));
}

.pickabrick-limit-banner-copy {
  display: grid;
  gap: 6px;
}

.pickabrick-limit-banner-copy h3,
.pickabrick-limit-choice h3 {
  margin: 0;
}

.pickabrick-limit-kicker {
  display: inline-flex;
  width: fit-content;
  padding: 5px 10px;
  border-radius: 999px;
  background: rgba(191, 97, 50, 0.14);
  color: #7b341d;
  font-size: 0.74rem;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.pickabrick-limit-list {
  margin: 0;
  padding-left: 20px;
  display: grid;
  gap: 8px;
  color: #493d36;
}

.pickabrick-limit-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.pickabrick-limit-why {
  margin: 0;
  color: #5a4b42;
}

.pickabrick-limit-modal-card {
  width: min(760px, 96vw);
}

.pickabrick-limit-panel {
  display: grid;
  gap: 16px;
}

.pickabrick-limit-grid {
  display: grid;
  gap: 14px;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
}

.pickabrick-limit-choice {
  display: grid;
  gap: 10px;
  padding: 16px;
  border: 1px solid rgba(73, 67, 63, 0.14);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.9);
}

.pickabrick-limit-choice-badge {
  display: inline-flex;
  width: fit-content;
  padding: 5px 10px;
  border-radius: 999px;
  background: rgba(43, 182, 172, 0.12);
  color: var(--teal-deep);
  font-size: 0.72rem;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.pickabrick-limit-status {
  padding: 12px 14px;
  border-radius: 14px;
  border: 1px solid rgba(73, 67, 63, 0.12);
  background: rgba(255, 255, 255, 0.86);
  color: #413832;
}

.pickabrick-limit-status.success {
  border-color: rgba(28, 115, 102, 0.24);
  background: rgba(234, 248, 245, 0.92);
}

.pickabrick-limit-status.warning {
  border-color: rgba(191, 97, 50, 0.24);
  background: rgba(255, 245, 236, 0.94);
}

.pickabrick-limit-status.error {
  border-color: rgba(126, 51, 43, 0.24);
  background: rgba(255, 241, 239, 0.94);
}

.summary-metrics {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
}

.summary-insights {
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  margin-top: 12px;
}

.insight-pill {
  padding: 12px 14px;
  border-radius: 16px;
  border: 1px solid rgba(73, 67, 63, 0.12);
  background: rgba(255, 255, 255, 0.88);
}

.insight-pill p {
  margin: 0;
}

.insight-label {
  font-size: 0.8rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.insight-value {
  margin-top: 6px !important;
  font-size: 1.1rem;
  font-weight: 900;
  color: var(--ink);
}

.metric-card {
  border: 1px solid rgba(43, 182, 172, 0.18);
  border-radius: 18px;
  padding: 14px 16px;
  background: linear-gradient(180deg, rgba(255,255,255,0.92), rgba(255,247,239,0.9));
}

.metric-card p {
  margin: 0;
}

.metric-label {
  font-size: 0.82rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--teal-deep);
}

.metric-value {
  margin-top: 6px !important;
  font-size: 1.65rem;
  font-weight: 900;
  letter-spacing: -0.03em;
  color: var(--ink);
}

.metric-value-detail {
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: normal;
  color: var(--muted);
}

.summary-details {
  border: 1px solid rgba(73, 67, 63, 0.14);
  border-radius: 18px;
  background: #fffdfa;
  padding: 2px 0;
}

.piece-counts-dropdown {
  margin-top: 2px;
}

.summary-details summary {
  cursor: pointer;
  list-style: none;
  padding: 14px 16px;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: linear-gradient(180deg, rgba(255,250,244,0.98), rgba(255,245,236,0.98));
  border-left: 4px solid rgba(251, 134, 0, 0.26);
}

.summary-details summary::-webkit-details-marker {
  display: none;
}

.summary-details summary::after {
  content: "▾";
  color: var(--orange-deep);
  font-size: 1rem;
  transition: transform 120ms ease;
}

.summary-details[open] summary::after {
  transform: rotate(180deg);
}

.summary-detail-grid {
  padding: 0 16px 14px;
  display: grid;
  gap: 10px;
  min-width: 0;
}

.nested-summary-details {
  margin-top: 4px;
}

.summary-detail-grid p {
  margin: 0;
  color: #48413b;
}

#colorBreakdown {
  display: grid;
  gap: 14px;
}

#buildInstructions {
  margin-top: 4px;
}

.instruction-meta {
  margin: 0 0 8px;
  color: #4e4741;
}

.instruction-legend,
.instruction-card,
.summary-subsection {
  border: 1px solid #ddd6cb;
  border-radius: 18px;
  background: var(--panel-strong);
}

.instruction-legend {
  padding: 12px 14px;
}

.instruction-legend p,
.pickabrick-export-steps li {
  color: #554f49;
}

.instruction-overview-grid,
.instructions-grid {
  display: grid;
  gap: 14px;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
}

.instruction-card {
  padding: 12px;
}

.instruction-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
}

.instruction-card h4,
.summary-subsection h3 {
  margin: 0 0 8px;
}

.instruction-range,
.instruction-step,
.instruction-empty {
  color: #6b645c;
  font-size: 0.93rem;
}

.instruction-canvas {
  width: 100%;
  max-width: none;
  border: 1px solid rgba(49, 45, 43, 0.24);
  border-radius: 12px;
  background: #fff;
}

.summary-subsection {
  padding: 14px 16px;
  min-width: 0;
}

.summary-table-wrap {
  width: 100%;
  max-width: 100%;
  overflow-x: auto;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
}

.summary-table-wrap table {
  min-width: 540px;
  table-layout: fixed;
}

.summary-table-wrap td:last-child {
  overflow-wrap: anywhere;
}

.summary-table-wrap th,
.summary-table-wrap td {
  vertical-align: top;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.summary-breakdown-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.summary-breakdown-pill {
  display: inline-flex;
  align-items: center;
  padding: 4px 8px;
  border-radius: 999px;
  background: rgba(43, 182, 172, 0.1);
  color: #2f4946;
  font-size: 0.82rem;
  line-height: 1.25;
}

.summary-subsection table,
table {
  width: 100%;
  border-collapse: collapse;
}

th,
td {
  text-align: left;
  padding: 9px 8px;
  border-bottom: 1px solid rgba(73, 67, 63, 0.1);
}

th {
  color: var(--muted);
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.swatch {
  display: inline-block;
  width: 14px;
  height: 14px;
  border-radius: 4px;
  margin-right: 8px;
  border: 1px solid rgba(49, 45, 43, 0.45);
  vertical-align: -2px;
}

.modal {
  position: fixed;
  inset: 0;
  background: rgba(30, 26, 23, 0.32);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 50;
}

.modal.hidden {
  display: none;
}

.modal-card {
  background: #fffdfa;
  border-radius: 24px;
  border: 1px solid rgba(73, 67, 63, 0.14);
  width: min(980px, 95vw);
  max-height: 92vh;
  overflow: auto;
  padding: 18px;
  box-shadow: 0 24px 60px rgba(46, 42, 40, 0.16);
}

.pickabrick-export-card {
  width: min(620px, 95vw);
}

.pickabrick-export-steps {
  margin: 10px 0 0 20px;
  padding: 0;
  display: grid;
  gap: 8px;
}

.pickabrick-skipped-panel {
  margin-top: 12px;
  padding: 0.9rem 1rem;
  border: 1px solid rgba(49, 45, 43, 0.16);
  border-radius: 16px;
  background: rgba(251, 134, 0, 0.08);
}

.pickabrick-skipped-panel h3 {
  margin: 0 0 4px;
  font-size: 1rem;
}

.pickabrick-skipped-list {
  margin: 8px 0 0 18px;
  padding: 0;
  display: grid;
  gap: 6px;
}

.pickabrick-export-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 18px;
}

.pickabrick-guide {
  display: grid;
  gap: 14px;
  margin-top: 14px;
}

.pickabrick-guide-card {
  display: grid;
  gap: 12px;
  padding: 16px;
  border: 1px solid rgba(73, 67, 63, 0.12);
  border-radius: 18px;
  background: linear-gradient(180deg, rgba(255,255,255,0.96), rgba(255,249,242,0.94));
}

.pickabrick-guide-header {
  display: grid;
  gap: 6px;
}

.pickabrick-guide-step {
  display: inline-flex;
  width: fit-content;
  padding: 5px 10px;
  border-radius: 999px;
  background: rgba(43, 182, 172, 0.12);
  color: var(--teal-deep);
  font-size: 0.74rem;
  font-weight: 900;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.pickabrick-guide-card h3,
.pickabrick-dropzone-title,
.pickabrick-dropzone-meta {
  margin: 0;
}

.pickabrick-upload-pill-demo {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  min-height: 56px;
  width: fit-content;
  padding: 0 20px;
  border-radius: 999px;
  background: linear-gradient(180deg, #f0f0f0, #e2e2e2);
  color: #1d1d1d;
  font-size: 1.3rem;
  font-weight: 900;
}

.pickabrick-upload-pill-icon {
  font-size: 1.4rem;
  line-height: 1;
}

.pickabrick-dropzone-demo {
  display: grid;
  place-items: center;
  gap: 10px;
  min-height: 220px;
  padding: 22px;
  border: 3px dashed rgba(73, 67, 63, 0.26);
  border-radius: 22px;
  background: #fff;
  text-align: center;
}

.pickabrick-dropzone-icon {
  display: grid;
  place-items: center;
  width: 58px;
  height: 58px;
  border-radius: 999px;
  background: linear-gradient(180deg, #1f73f2, #1556c8);
  color: #fff;
  font-size: 1.5rem;
  font-weight: 900;
}

.pickabrick-dropzone-title {
  font-size: 1.2rem;
  font-weight: 900;
  color: #222;
}

.pickabrick-dropzone-meta {
  color: #706a64;
  font-weight: 700;
}

.mini-btn-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid transparent;
  border-radius: 14px;
  text-decoration: none;
  transition: transform 120ms ease, filter 120ms ease, box-shadow 120ms ease;
}

.modal-card-wide {
  width: min(1080px, 96vw);
}

.crop-modal-card {
  width: min(1120px, 96vw);
}

.modal-panel {
  margin-top: 12px;
  padding: 14px;
  border: 1px solid #e4ddd3;
  border-radius: 18px;
  background: #fffaf4;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.modal-header h2,
.modal-panel h3 {
  margin: 0;
}

.crop-modal-layout {
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  gap: 18px;
  align-items: start;
}

.crop-ratio-sidebar {
  display: grid;
  gap: 12px;
}

.crop-ratio-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.crop-ratio-btn {
  width: 100%;
  min-height: 40px;
  justify-content: center;
  text-align: center;
  line-height: 1.25;
  padding-inline: 10px;
}

.crop-ratio-btn.active {
  background: linear-gradient(135deg, rgba(43, 182, 172, 0.22), rgba(43, 182, 172, 0.34));
  border-color: rgba(24, 148, 139, 0.36);
}

.crop-preview-stage {
  display: grid;
  gap: 16px;
  grid-template-columns: minmax(0, 1fr) minmax(320px, 460px);
  align-items: start;
}

.crop-preview-card {
  display: grid;
  gap: 8px;
  padding: 14px;
  border: 1px solid rgba(73, 67, 63, 0.12);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.9);
  align-self: stretch;
}

.crop-preview-card h4 {
  margin: 0;
}

#cropPreviewCanvas {
  width: 100%;
  max-width: 100%;
  border: 1px solid rgba(49, 45, 43, 0.18);
  border-radius: 14px;
  background: #fff;
}

.cropper-shell {
  width: 100%;
  max-width: 100%;
  min-height: clamp(380px, 44vw, 640px);
  max-height: min(74vh, 820px);
  aspect-ratio: 1 / 1;
  border: 1px solid rgba(49, 45, 43, 0.24);
  border-radius: 16px;
  background: #fff;
  overflow: hidden;
  position: relative;
}

.cropper-shell.ratio-free {
  aspect-ratio: auto;
}

.cropper-shell img {
  display: block;
  max-width: 100%;
}

.cropper-shell::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background-image:
    linear-gradient(to right, rgba(255, 255, 255, 0.14) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(255, 255, 255, 0.14) 1px, transparent 1px);
  background-size: 28px 28px;
  opacity: 0;
  transition: opacity 140ms ease;
}

.cropper-shell.cropper-ready::after {
  opacity: 0.18;
}

.cropper-view-box,
.cropper-face {
  border-radius: 8px;
}

.cropper-view-box {
  box-shadow: 0 0 0 1px rgba(251, 134, 0, 0.68);
  outline: 2px solid rgba(251, 134, 0, 0.24);
}

.cropper-view-box::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background-image:
    linear-gradient(to right, rgba(255, 255, 255, 0.24) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(255, 255, 255, 0.24) 1px, transparent 1px);
  background-size: 18px 18px;
}

.cropper-dashed {
  border-color: rgba(255, 255, 255, 0.35);
}

.cropper-line,
.cropper-point {
  background-color: rgba(251, 134, 0, 0.86);
}

.toggle-group {
  display: grid;
  gap: 8px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(255,255,255,0.76);
}

.checkbox-row {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
}

.checkbox-row input {
  width: auto;
}

.customize-toolbar {
  display: grid;
  gap: 14px;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
}

.pill-list,
.color-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.pill-btn,
.color-btn {
  background: #fff8ee;
  color: var(--ink);
  border: 1px solid #d8d1c7;
  box-shadow: none;
}

.pill-btn {
  padding: 7px 11px;
  border-radius: 999px;
}

.pill-btn.active {
  background: var(--ink);
  color: #fff;
  border-color: var(--ink);
}

.color-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 9px;
  border-radius: 999px;
}

.color-btn.active {
  border-color: var(--teal-deep);
  box-shadow: inset 0 0 0 1px var(--teal-deep);
}

.color-btn .swatch {
  margin-right: 0;
}

#customizeCanvas {
  margin-top: 12px;
  max-width: 100%;
  width: auto;
  image-rendering: pixelated;
}

.overlay {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  z-index: 100;
}

.overlay-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(33, 29, 27, 0.42);
  backdrop-filter: blur(5px);
}

.overlay-card {
  position: relative;
  width: min(440px, calc(100vw - 32px));
  border-radius: 28px;
  border: 1px solid rgba(255,255,255,0.55);
  background: linear-gradient(180deg, rgba(255,250,244,0.98), rgba(255,247,239,0.98));
  padding: 28px 24px;
  text-align: center;
  box-shadow: 0 28px 80px rgba(24, 20, 18, 0.28);
}

.overlay-card h2 {
  margin: 0 0 8px;
  font-size: 1.8rem;
  font-weight: 900;
  letter-spacing: -0.03em;
}

.overlay-card p {
  margin: 0;
  color: var(--muted);
}

.sticky-export-cue {
  position: fixed;
  right: 18px;
  bottom: 16px;
  left: auto;
  transform: none;
  z-index: 60;
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
  width: min(calc(100vw - 28px), 360px);
  border-radius: 24px;
  border: 1px solid rgba(251, 134, 0, 0.32);
  background: linear-gradient(135deg, rgba(255, 250, 244, 0.98), rgba(255, 243, 228, 0.98) 48%, rgba(238, 250, 248, 0.96));
  box-shadow: 0 24px 60px rgba(46, 42, 40, 0.16);
  padding: 14px;
  backdrop-filter: blur(10px);
  overflow: hidden;
  animation: stickyExportRise 180ms ease-out;
  transition: opacity 180ms ease, transform 180ms ease, box-shadow 180ms ease;
}

.sticky-export-copy {
  display: grid;
  gap: 4px;
  min-width: 0;
  position: relative;
  z-index: 1;
}

.sticky-export-kicker {
  font-size: 0.72rem;
  font-weight: 900;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--teal-deep);
}

.sticky-export-copy strong {
  font-size: 1.02rem;
  line-height: 1.2;
  color: #5f3a09;
}

.sticky-export-helper {
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 700;
}

.sticky-export-actions {
  display: grid;
  gap: 8px;
}

.sticky-export-action {
  position: relative;
  z-index: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 52px;
  padding: 0 18px;
  border: 0;
  border-radius: 18px;
  background: linear-gradient(180deg, var(--orange), var(--orange-deep));
  color: #fff;
  font-weight: 900;
  box-shadow: 0 14px 28px rgba(225, 111, 0, 0.28);
  cursor: pointer;
}

.sticky-export-secondary {
  position: relative;
  z-index: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 46px;
  padding: 0 16px;
  border: 1px solid rgba(43, 182, 172, 0.22);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.84);
  color: var(--teal-deep);
  font-weight: 800;
  cursor: pointer;
}

.sticky-export-action:hover {
  transform: translateY(-1px);
  box-shadow: 0 18px 34px rgba(225, 111, 0, 0.32);
}

.sticky-export-secondary:hover {
  transform: translateY(-1px);
  background: rgba(255, 255, 255, 0.96);
}

.sticky-export-action:focus-visible,
.sticky-export-secondary:focus-visible,
.sticky-export-dismiss:focus-visible {
  outline: 3px solid rgba(43, 182, 172, 0.34);
  outline-offset: 2px;
}

.sticky-export-dismiss {
  position: absolute;
  z-index: 1;
  top: 10px;
  right: 10px;
  width: 36px;
  height: 36px;
  border: 1px solid rgba(126, 34, 25, 0.42);
  border-radius: 999px;
  background: linear-gradient(135deg, var(--danger) 0%, var(--danger-deep) 100%);
  color: #fff;
  font-size: 1.4rem;
  line-height: 1;
  cursor: pointer;
  box-shadow: 0 12px 24px rgba(169, 47, 35, 0.22);
}

@keyframes stickyExportRise {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.loading-dots {
  display: inline-flex;
  gap: 10px;
  margin-bottom: 18px;
}

.loading-dots span {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  display: inline-block;
  animation: bounceDots 1.1s infinite ease-in-out both;
}

.loading-dots span:nth-child(1) { background: var(--orange); animation-delay: -0.3s; }
.loading-dots span:nth-child(2) { background: var(--gold); animation-delay: -0.15s; }
.loading-dots span:nth-child(3) { background: var(--teal); animation-delay: 0s; }
.loading-dots span:nth-child(4) { background: var(--orange); animation-delay: 0.15s; }

.success-card {
  background: linear-gradient(135deg, rgba(255,247,239,0.99), rgba(238,250,248,0.98));
}

@keyframes bounceDots {
  0%, 80%, 100% { transform: translateY(0) scale(0.88); opacity: 0.55; }
  40% { transform: translateY(-7px) scale(1); opacity: 1; }
}

@media (min-width: 900px) {
  .preview-layout {
    grid-template-columns: minmax(280px, 0.95fr) minmax(380px, 1.35fr);
  }
}

@media (max-width: 1024px) {
  .app {
    padding: 20px 16px 32px;
  }

  .app-navbar {
    grid-template-columns: minmax(118px, 150px) minmax(0, 1fr);
  }

  .app-navbar-side {
    grid-column: 1 / -1;
  }

  .app-navbar-totals {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .app-stepper-step {
    grid-template-columns: 1fr;
    justify-items: center;
    text-align: center;
  }
}

@media (max-width: 768px) {
  .app {
    padding: 14px 12px 28px;
  }

  .controls,
  .instruction-overview-grid,
  .instructions-grid,
  .pickabrick-limit-grid,
  .summary-metrics,
  .export-options,
  .image-settings-layout,
  .image-slider-grid,
  .preview-layout,
  .customize-toolbar {
    grid-template-columns: 1fr;
  }

  .app-navbar {
    position: static;
    grid-template-columns: 1fr;
  }

  .status-banner {
    top: 12px;
  }

  .app-navbar-brand {
    height: auto;
    justify-content: center;
  }

  .app-navbar-logo {
    width: min(180px, 100%);
    margin: 0;
  }

  .flow-nav-card {
    position: static;
    grid-template-columns: 1fr;
    align-items: start;
  }

  .flow-nav-actions {
    justify-content: stretch;
  }

  .flow-nav-actions .mini-btn,
  .flow-nav-actions .flow-prev-btn,
  .flow-nav-actions .flow-next-btn {
    width: 100%;
  }

  .app-navbar-timeline {
    overflow: hidden;
    padding-bottom: 2px;
  }

  .app-stepper {
    min-width: 0;
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .app-stepper-step {
    min-height: 88px;
    grid-template-columns: 1fr;
    justify-items: center;
    text-align: center;
    padding: 12px 10px 14px;
  }

  .app-stepper-copy strong {
    font-size: 0.82rem;
  }

  .app-substep-rail {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    padding-bottom: 2px;
  }

  .app-substep-pill {
    width: 100%;
    min-width: 0;
    white-space: normal;
    justify-content: flex-start;
    align-items: start;
  }

  .app-substep-pill:not(:last-child)::after {
    display: none;
  }

  .preview-header,
  .panel-heading {
    align-items: start;
    flex-direction: column;
  }

  .generate-summary-panel {
    grid-template-columns: 1fr;
  }

  .setup-upload-summary {
    grid-template-columns: 84px minmax(0, 1fr);
  }

  .setting-stepper {
    grid-template-columns: 40px 56px 72px 40px;
  }

  .sticky-export-cue {
    right: 12px;
    left: auto;
    width: min(calc(100vw - 24px), 320px);
    bottom: 12px;
    padding: 14px;
  }

  .sticky-export-action {
    width: 100%;
  }

  .sticky-export-dismiss {
    top: 8px;
    right: 8px;
  }

  .summary-table-wrap {
    overflow: visible;
  }

  .summary-table-wrap table,
  .summary-table-wrap tbody,
  .summary-table-wrap tr,
  .summary-table-wrap td {
    display: block;
    width: 100%;
  }

  .summary-table-wrap table {
    min-width: 0;
    border-collapse: separate;
    border-spacing: 0;
  }

  .summary-table-wrap thead {
    display: none;
  }

  .summary-table-wrap tr {
    margin-bottom: 10px;
    padding: 10px 12px;
    border: 1px solid rgba(73, 67, 63, 0.1);
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.82);
  }

  .summary-table-wrap td {
    display: grid;
    grid-template-columns: minmax(96px, 112px) minmax(0, 1fr);
    gap: 10px;
    align-items: start;
    padding: 6px 0;
    border-bottom: 0;
  }

  .summary-table-wrap td::before {
    content: attr(data-label);
    display: block;
    margin-bottom: 0;
    font-size: 0.74rem;
    font-weight: 900;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--muted);
  }

  .summary-table-wrap td > * {
    min-width: 0;
  }

  .summary-breakdown-list {
    justify-content: flex-start;
  }

  .summary-breakdown-pill {
    max-width: 100%;
  }

  .interactive-customization-actions,
  .interactive-quick-grid {
    grid-template-columns: 1fr;
  }

  .home-panel-header {
    flex-direction: column;
    align-items: start;
  }

  .home-gallery {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .image-editor-tabs {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
    border-bottom: none;
  }

  .image-editor-tab-filler,
  .image-editor-tab-ghost {
    display: none;
  }

  .image-editor-tab {
    border-bottom: 1px solid rgba(73, 67, 63, 0.16);
    border-radius: 18px;
  }

  .image-editor-shell {
    grid-template-columns: 1fr;
    gap: 14px;
  }

  .setup-inline-editor-mount {
    min-height: 0;
  }

  .setup-inline-editor-mount .image-editor-shell {
    grid-template-columns: 1fr;
  }

  .image-editor-shell[data-editor-tab="crop"] .image-editor-stage,
  .image-editor-shell[data-editor-tab="enhance"] .image-editor-stage {
    order: 1;
  }

  .image-editor-shell[data-editor-tab="crop"] .image-editor-sidebar,
  .image-editor-shell[data-editor-tab="enhance"] .image-editor-sidebar {
    order: 2;
  }

  .crop-preview-stage {
    grid-template-columns: 1fr;
  }

  .crop-modal-layout {
    grid-template-columns: 1fr;
  }

  .crop-ratio-list {
    display: flex;
    flex-wrap: wrap;
  }

  .preview-panel canvas,
  .plan-preview-block canvas,
  .cropper-shell,
  .image-controls-preview canvas,
  .instruction-canvas,
  #customizeCanvas {
    width: 100% !important;
    max-width: 100%;
    height: auto !important;
  }

  .preview-panel,
  .plan-preview-block,
  .crop-preview-stage,
  .image-controls-preview {
    min-width: 0;
    overflow: hidden;
  }

  #cropPreviewCanvas,
  #imageControlsPreviewCanvas {
    min-height: 280px;
  }
}

@media (max-width: 480px) {
  body {
    overflow-x: hidden;
  }

  .panel,
  .modal-card,
  .overlay-card {
    border-radius: 20px;
  }

  button,
  input,
  select {
    min-height: 44px;
  }

  .modal {
    padding: 0;
  }

  .modal-card,
  .modal-card-wide {
    width: 100vw;
    max-height: 100vh;
    border: none;
    border-radius: 0;
  }

  .preview-header .mini-btn,
  .enhance-actions .mini-btn,
  .preview-quick-actions .mini-btn,
  .image-settings-launcher .mini-btn,
  .image-tool-card .mini-btn,
  .image-settings-actions .mini-btn {
    width: 100%;
    justify-content: center;
  }

  .app-substep-rail {
    grid-template-columns: 1fr;
  }

  .setup-upload-summary {
    grid-template-columns: 1fr;
  }

  .setup-upload-summary canvas,
  .generate-summary-panel canvas {
    max-width: 120px;
  }
  .preview-header {
    gap: 10px;
  }
}
