:root {
  --color-bg: #fafafa;
  --color-surface: #ffffff;
  --color-border: #e6e6e6;
  --color-text-primary: #111111;
  --color-text-secondary: #6b6b6b;
  --color-text-tertiary: #a3a3a3;
  --color-accent: #2f6fed;
  --color-success: #1f9d55;
  --color-error: #c9432f;
  --color-surface-hover: #f2f2f2;

  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 24px;
  --space-6: 40px;
  --space-7: 64px;

  --radius-md: 8px;
  --radius-lg: 12px;
  --radius-xl: 16px;

  --shadow-subtle: 0 1px 2px rgba(0, 0, 0, 0.04), 0 8px 24px rgba(0, 0, 0, 0.04);

  --rail-width: 268px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--color-bg);
  color: var(--color-text-primary);
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", sans-serif;
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

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

@keyframes pulseBg {
  0%, 100% {
    background-color: #f4f4f4;
  }
  50% {
    background-color: #eaeaea;
  }
}

@keyframes pulseGlyph {
  0%, 100% {
    opacity: 0.35;
    transform: scale(0.97);
  }
  50% {
    opacity: 0.9;
    transform: scale(1);
  }
}

@keyframes pulseDot {
  0%, 100% {
    opacity: 1;
  }
  50% {
    opacity: 0.45;
  }
}

@keyframes dotFade {
  0%, 80%, 100% {
    opacity: 0.2;
  }
  40% {
    opacity: 1;
  }
}

@keyframes slideUp {
  from {
    transform: translateY(100%);
  }
  to {
    transform: translateY(0);
  }
}

@media (prefers-reduced-motion: reduce) {
  .view,
  .model-panel.is-loading,
  .loading-glyph-wrap,
  .step-active::before,
  .loading-dots span,
  .steps-sheet {
    animation: none !important;
  }
}

/* ---------- Header ---------- */

.app-header {
  padding: var(--space-5) var(--space-6);
  border-bottom: 1px solid var(--color-border);
}

.app-title {
  font-size: 18px;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--color-text-secondary);
}

/* ---------- App shell: rail + content ---------- */

.app-shell {
  flex: 1;
  display: flex;
  align-items: flex-start;
  width: 100%;
}

.main-col {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.rail {
  width: var(--rail-width);
  flex: none;
  position: sticky;
  top: 0;
  align-self: flex-start;
  max-height: 100vh;
  overflow-y: auto;
  padding: var(--space-6) var(--space-5) var(--space-5);
  border-right: 1px solid var(--color-border);
}

.rail-brand {
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--color-text-tertiary);
  margin-bottom: var(--space-5);
}

.rail-steps {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
}

.rail-step {
  position: relative;
  padding-bottom: var(--space-4);
}

.rail-step::before {
  content: "";
  position: absolute;
  left: 8px;
  top: 22px;
  bottom: 0;
  width: 1px;
  background: var(--color-border);
}

.rail-step:last-child::before {
  display: none;
}

.rail-step-done::before {
  background: var(--color-text-primary);
}

.rail-step-row {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  width: 100%;
  background: none;
  border: none;
  padding: 0;
  margin: 0;
  font-family: inherit;
  text-align: left;
  cursor: default;
}

button.rail-step-row {
  cursor: pointer;
}

button.rail-step-row:hover .rail-step-label {
  text-decoration: underline;
}

.rail-step-dot {
  flex-shrink: 0;
  width: 17px;
  font-size: 13px;
  line-height: 1;
  color: var(--color-text-tertiary);
  text-align: center;
}

.rail-step-done .rail-step-dot {
  color: var(--color-text-primary);
}

.rail-step-current .rail-step-dot {
  color: var(--color-accent);
}

.rail-step-label {
  font-size: 14px;
  color: var(--color-text-tertiary);
}

.rail-step-done .rail-step-label {
  color: var(--color-text-secondary);
}

.rail-step-current .rail-step-label {
  color: var(--color-text-primary);
  font-weight: 700;
}

.rail-step-context {
  margin: var(--space-1) 0 0 29px;
  font-size: 12px;
  line-height: 1.5;
  color: var(--color-text-secondary);
  max-width: 190px;
}

.rail-nownext {
  margin: var(--space-4) 0;
  padding: var(--space-4) 0;
  border-top: 1px solid var(--color-border);
  border-bottom: 1px solid var(--color-border);
}

.rail-nownext-row {
  margin: 0 0 var(--space-2);
  font-size: 13px;
  display: flex;
  gap: var(--space-2);
}

.rail-nownext-row:last-child {
  margin-bottom: 0;
}

.rail-eyebrow {
  flex-shrink: 0;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--color-text-tertiary);
  width: 38px;
}

.rail-selections {
  padding-top: var(--space-1);
}

.rail-selections > .rail-eyebrow {
  display: block;
  width: auto;
  margin-bottom: var(--space-3);
}

.rail-selections-list {
  margin: 0;
  display: grid;
  grid-template-columns: auto 1fr;
  gap: var(--space-2) var(--space-3);
}

.rail-selections-list dt {
  font-size: 12px;
  color: var(--color-text-tertiary);
}

.rail-selections-list dd {
  margin: 0;
  font-size: 13px;
  font-weight: 500;
  text-align: right;
  color: var(--color-text-primary);
}

.rail-selection-link {
  background: none;
  border: none;
  padding: 0;
  margin: 0;
  font: inherit;
  font-weight: 500;
  color: var(--color-text-primary);
  cursor: pointer;
  text-decoration: underline;
  text-decoration-color: var(--color-border);
}

.rail-selection-link:hover {
  text-decoration-color: var(--color-accent);
}

/* ---------- Mobile steps header + sheet ---------- */

.mobile-header {
  display: none;
}

@media (max-width: 899px) {
  .rail {
    display: none;
  }

  .mobile-header {
    display: block;
    width: 100%;
    position: sticky;
    top: 0;
    z-index: 20;
    background: var(--color-surface);
    border: none;
    border-bottom: 1px solid var(--color-border);
    padding: var(--space-3) var(--space-4);
    font-family: inherit;
    text-align: left;
    cursor: pointer;
  }
}

.mobile-header-top {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--color-text-tertiary);
}

.mobile-steps-caret {
  color: var(--color-accent);
}

.mobile-header-name {
  display: block;
  margin-top: 2px;
  font-size: 15px;
  font-weight: 700;
  color: var(--color-text-primary);
}

.mobile-progress-track {
  display: block;
  margin-top: var(--space-2);
  height: 3px;
  border-radius: 2px;
  background: var(--color-border);
  overflow: hidden;
}

.mobile-progress-fill {
  display: block;
  height: 100%;
  background: var(--color-accent);
  transition: width 0.2s ease;
}

.mobile-header-next {
  display: block;
  margin-top: var(--space-2);
  font-size: 12px;
  color: var(--color-text-secondary);
}

.steps-sheet-scrim {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.35);
  z-index: 29;
}

.steps-sheet-scrim[hidden] {
  display: none;
}

.steps-sheet {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 30;
  max-height: 80vh;
  overflow-y: auto;
  background: var(--color-surface);
  border-radius: var(--radius-xl) var(--radius-xl) 0 0;
  box-shadow: 0 -8px 32px rgba(0, 0, 0, 0.18);
  padding: var(--space-3) var(--space-5) var(--space-6);
  animation: slideUp 0.2s ease;
}

.steps-sheet[hidden] {
  display: none;
}

.steps-sheet-handle {
  width: 36px;
  height: 4px;
  border-radius: 2px;
  background: var(--color-border);
  margin: 0 auto var(--space-4);
}

.steps-sheet-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 15px;
  font-weight: 700;
  margin-bottom: var(--space-4);
}

.steps-sheet-close {
  background: none;
  border: none;
  font-size: 16px;
  color: var(--color-text-secondary);
  cursor: pointer;
  padding: var(--space-1);
}

.steps-sheet-list {
  list-style: none;
  margin: 0 0 var(--space-4);
  padding: 0;
}

.steps-sheet-selections {
  margin: 0;
  padding-top: var(--space-4);
  border-top: 1px solid var(--color-border);
  display: grid;
  grid-template-columns: auto 1fr;
  gap: var(--space-2) var(--space-3);
}

.steps-sheet-selections dt {
  font-size: 12px;
  color: var(--color-text-tertiary);
}

.steps-sheet-selections dd {
  margin: 0;
  font-size: 13px;
  font-weight: 500;
  text-align: right;
  color: var(--color-text-primary);
}

/* ---------- Save your design (#save-design-modal reuses .steps-sheet/
   .steps-sheet-scrim itself - see index.html - only these few rules are
   specific to its own content). ---------- */

#save-design-modal {
  max-width: 480px;
  margin: 0 auto;
  left: 0;
  right: 0;
}

.save-design-intro {
  margin-top: 0;
}

.save-design-consent-row {
  margin-top: var(--space-4);
}

.save-design-consent-note {
  margin-top: var(--space-1);
}

.save-design-actions {
  justify-content: flex-end;
}

/* ---------- Shared view/card primitives ---------- */

.view {
  flex: 1;
  animation: fadeIn 0.25s ease;
}

/* !important: several views (#display-view, #loading-view, #review-view,
   etc.) set their own `display` via an ID selector, which outranks this
   class+attribute selector on specificity alone - without !important,
   "hidden" views stay laid out (just visually last-painted), so every
   step ends up stacked in the page at once. */
.view[hidden] {
  display: none !important;
}

.field-label {
  display: block;
  margin-top: var(--space-5);
  margin-bottom: var(--space-2);
  font-size: 13px;
  color: var(--color-text-secondary);
}

.field-label-compact {
  margin-top: 0;
}

input[type="text"],
input[type="email"] {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-surface);
  color: var(--color-text-primary);
  font-family: inherit;
  font-size: 15px;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

input[type="text"]:focus,
input[type="email"]:focus {
  outline: none;
  border-color: var(--color-accent);
  box-shadow: 0 0 0 3px rgba(47, 111, 237, 0.12);
}

.feedback-text {
  min-height: 16px;
  margin: var(--space-2) 0 0;
  font-size: 13px;
  color: var(--color-text-secondary);
}

.feedback-text.error {
  color: var(--color-error);
}

.feedback-text.success {
  color: var(--color-success);
}

.feedback-text[hidden] {
  display: none;
}

/* ---------- Buttons ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 12px 24px;
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  font-family: inherit;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: background-color 0.15s ease, border-color 0.15s ease, opacity 0.15s ease;
  text-decoration: none;
}

.btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.btn-primary {
  background: var(--color-text-primary);
  color: #ffffff;
}

.btn-primary:hover:not(:disabled) {
  background: #2a2a2a;
}

.btn-primary:active:not(:disabled) {
  opacity: 0.85;
}

.btn-secondary {
  background: transparent;
  border-color: var(--color-border);
  color: var(--color-text-primary);
}

.btn-secondary:hover {
  background: var(--color-surface-hover);
}

.btn-block {
  width: 100%;
  margin-top: var(--space-4);
}

.btn-large {
  padding: 16px 36px;
  font-size: 16px;
}

.btn-link {
  background: none;
  border: none;
  padding: 0;
  font-family: inherit;
  font-size: 13px;
  color: var(--color-text-secondary);
  cursor: pointer;
}

.btn-link:hover {
  color: var(--color-text-primary);
}

.back-link {
  display: inline-block;
  margin-bottom: var(--space-4);
}

.center-link {
  display: block;
  margin: var(--space-3) auto 0;
}

.center-text {
  text-align: center;
}

.actions-row {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-3);
  min-height: 42px;
  margin-top: var(--space-5);
}

.actions-row-center {
  justify-content: center;
}

/* ---------- Step screens (Select Display / Choose Place / Personalize) ---------- */

.step-card {
  max-width: 420px;
  width: 100%;
  margin: 0 auto;
  padding: var(--space-6) var(--space-5);
}

.step-card-wide {
  max-width: 760px;
}

.step-heading {
  margin: 0 0 var(--space-1);
  font-size: 26px;
  font-weight: 600;
  letter-spacing: -0.01em;
  outline: none;
}

.step-subheading {
  margin: 0 0 var(--space-5);
  font-size: 15px;
  color: var(--color-text-secondary);
}

.step-label-row {
  margin: 0 0 var(--space-3);
  font-size: 13px;
  font-weight: 600;
  color: var(--color-text-secondary);
}

.step-helper {
  margin: var(--space-3) 0 0;
  font-size: 13px;
  color: var(--color-text-secondary);
}

#display-view,
#place-view,
#personalize-view {
  display: flex;
  padding: var(--space-6);
}

.search-row {
  display: flex;
  gap: var(--space-2);
  margin-bottom: var(--space-4);
}

.search-row input {
  flex: 1;
}

/* ---------- Compact display-shape selector (map screen) ---------- */

.shape-selector {
  margin-bottom: var(--space-3);
}

.shape-selector-label {
  margin: 0 0 var(--space-2);
  font-size: 13px;
  font-weight: 600;
  color: var(--color-text-secondary);
}

.shape-selector-grid {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  max-width: 100%;
}

.shape-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  flex: 0 0 auto;
  min-width: 68px;
  min-height: 44px;
  padding: var(--space-2) var(--space-3);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-surface);
  cursor: pointer;
  font-family: inherit;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, background-color 0.15s ease;
}

.shape-btn:hover {
  border-color: var(--color-accent);
  background: var(--color-surface-hover);
}

.shape-btn:focus-visible {
  outline: none;
  border-color: var(--color-accent);
  box-shadow: 0 0 0 3px rgba(47, 111, 237, 0.12);
}

.shape-btn.is-selected {
  border-color: var(--color-accent);
  background: rgba(47, 111, 237, 0.06);
  box-shadow: 0 0 0 2px var(--color-accent);
}

.shape-btn-outline {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 26px;
}

.shape-btn-outline-box {
  border: 1.5px solid var(--color-text-tertiary);
  border-radius: 2px;
  background: var(--color-bg);
}

.shape-btn.is-selected .shape-btn-outline-box {
  border-color: var(--color-accent);
  background: #ffffff;
}

.shape-btn-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--color-text-primary);
  white-space: nowrap;
}

.shape-selector-hint {
  margin: var(--space-2) 0 0;
  font-size: 12px;
  color: var(--color-text-tertiary);
}

.map-panel {
  position: relative;
  height: 420px;
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-subtle);
  border: 1px solid var(--color-border);
}

#map {
  width: 100%;
  height: 100%;
}

.print-frame {
  position: absolute;
  left: 50%;
  top: 50%;
  z-index: 500;
  transform: translate(-50%, -50%);
  border: 3px solid #ffffff;
  border-radius: 3px;
  box-shadow: 0 0 0 2px rgba(17, 17, 17, 0.9), 0 0 0 9999px rgba(17, 17, 17, 0.3);
  pointer-events: none;
  transition: width 320ms cubic-bezier(0.4, 0, 0.2, 1), height 320ms cubic-bezier(0.4, 0, 0.2, 1);
}

.print-frame.print-frame-enter {
  animation: printFrameEnter 320ms cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes printFrameEnter {
  from {
    opacity: 0;
    transform: translate(-50%, -50%) scale(0.92);
  }
  to {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
  }
}

@media (prefers-reduced-motion: reduce) {
  .print-frame {
    transition: none;
  }

  .print-frame.print-frame-enter {
    animation: none;
  }
}

.print-frame::before,
.print-frame::after {
  content: "";
  position: absolute;
  background: rgba(255, 255, 255, 0.85);
}

.print-frame::before {
  left: 50%;
  top: -8px;
  bottom: -8px;
  width: 1px;
}

.print-frame::after {
  top: 50%;
  left: -8px;
  right: -8px;
  height: 1px;
}

.print-frame-label {
  position: absolute;
  left: 50%;
  top: -34px;
  transform: translateX(-50%);
  max-width: calc(100% - 12px);
  padding: 5px 9px;
  border-radius: 999px;
  background: rgba(17, 17, 17, 0.9);
  color: #ffffff;
  font-size: 11px;
  font-weight: 700;
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.map-actions {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  margin-top: var(--space-3);
}

.btn-compact {
  min-height: 40px;
  padding: 8px 14px;
  font-size: 13px;
}

.selection-summary {
  display: grid;
  gap: 2px;
  margin-top: var(--space-3);
  padding: var(--space-3) var(--space-4);
  border: 1px solid #cfe7d8;
  border-radius: var(--radius-md);
  background: #f3fbf6;
  color: var(--color-text-primary);
}

.selection-summary-label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--color-success);
}

.selection-summary strong {
  font-size: 15px;
}

.selection-summary span:last-child {
  font-size: 13px;
  color: var(--color-text-secondary);
}

.selection-summary.is-too-large {
  border-color: #f0cbc5;
  background: #fff7f5;
}

.selection-summary.is-too-large .selection-summary-label,
.selection-summary.is-too-large span:last-child {
  color: var(--color-error);
}

.place-continue-bar {
  margin-top: var(--space-5);
}

.place-continue-bar .btn-block {
  margin-top: 0;
}

.place-continue-bar .feedback-text {
  margin-bottom: 0;
}

.leaflet-control-zoom a {
  width: 40px;
  height: 40px;
  line-height: 40px;
}

.leaflet-control-layers-expanded {
  padding: 7px 10px;
  font: 13px/1.5 "Inter", sans-serif;
}

.leaflet-control-layers-selector {
  width: 16px;
  height: 16px;
  margin-right: 5px;
  vertical-align: -3px;
}

/* ---------- Display grid ---------- */

.display-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--space-4);
}

.display-card {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: var(--space-2);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-subtle);
  padding: var(--space-5) var(--space-3);
  cursor: pointer;
  font-family: inherit;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, transform 0.15s ease;
}

.display-badge {
  position: absolute;
  top: var(--space-3);
  right: var(--space-3);
  padding: 4px 8px;
  border-radius: 999px;
  background: var(--color-accent);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.04em;
  line-height: 1;
  text-transform: uppercase;
}

.display-card:hover {
  border-color: var(--color-accent);
  transform: translateY(-2px);
}

.display-card.is-selected {
  border-color: var(--color-accent);
  box-shadow: 0 0 0 3px rgba(47, 111, 237, 0.12);
}

.display-card.is-selected .display-name::after {
  content: "✓";
  margin-left: var(--space-2);
  color: var(--color-accent);
  font-weight: 700;
}

.display-proportion {
  display: flex;
  align-items: flex-end;
  justify-content: center;
  height: 100px;
  margin-bottom: var(--space-2);
}

.display-proportion-box {
  background: var(--color-bg);
  border: 1.5px solid var(--color-text-tertiary);
  border-radius: 3px;
}

.display-name {
  margin: 0;
  font-size: 16px;
  font-weight: 600;
}

.display-format {
  margin: calc(-1 * var(--space-1)) 0 0;
  font-size: 12px;
  font-weight: 600;
  color: var(--color-accent);
}

.display-comparison {
  margin: 0;
  font-size: 13px;
  color: var(--color-text-secondary);
}

.display-best-for {
  margin: 0;
  font-size: 12px;
  color: var(--color-text-tertiary);
  min-height: 30px;
}

.display-includes {
  margin: var(--space-1) 0 0;
  font-size: 12px;
  color: var(--color-text-secondary);
}

.display-price {
  margin: var(--space-1) 0 0;
  font-size: 15px;
  font-weight: 700;
}

/* ---------- Theme picker + Frame Text ---------- */

.theme-picker {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  margin-bottom: var(--space-5);
}

.theme-swatch-button {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: var(--space-2) var(--space-3);
  padding: var(--space-3);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-surface);
  cursor: pointer;
  text-align: left;
  font-family: inherit;
  font-size: 14px;
  color: var(--color-text-primary);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.theme-swatch-button:hover {
  background: var(--color-surface-hover);
}

.theme-swatch-button:focus-visible {
  outline: none;
  border-color: var(--color-accent);
  box-shadow: 0 0 0 3px rgba(47, 111, 237, 0.12);
}

.theme-swatch-button.is-selected {
  border-color: var(--color-accent);
  box-shadow: 0 0 0 3px rgba(47, 111, 237, 0.12);
}

.theme-swatch-button.is-selected .theme-swatch-name::after {
  content: "✓";
  margin-left: var(--space-2);
  color: var(--color-accent);
  font-weight: 700;
}

.theme-swatch-dots {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  flex-shrink: 0;
}

.color-dot {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 1px solid rgba(0, 0, 0, 0.12);
  flex-shrink: 0;
}

.theme-swatch-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.theme-swatch-name {
  font-weight: 500;
}

.theme-swatch-description {
  font-size: 12px;
  color: var(--color-text-secondary);
}

.theme-palette-preview {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  margin-top: var(--space-3);
  font-size: 13px;
  color: var(--color-text-secondary);
}

.theme-palette-preview .color-dot {
  width: 16px;
  height: 16px;
}

.frame-details-picker {
  display: flex;
  gap: var(--space-3);
  margin-bottom: var(--space-2);
}

.frame-detail-button {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
  padding: var(--space-4);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-surface);
  cursor: pointer;
  text-align: left;
  font-family: inherit;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.frame-detail-button:hover {
  background: var(--color-surface-hover);
}

.frame-detail-button.is-selected {
  border-color: var(--color-accent);
  box-shadow: 0 0 0 3px rgba(47, 111, 237, 0.12);
}

.frame-detail-name {
  font-size: 15px;
  font-weight: 600;
  color: var(--color-text-primary);
}

.frame-detail-name::before {
  content: "○ ";
  color: var(--color-text-tertiary);
}

.frame-detail-button.is-selected .frame-detail-name::before {
  content: "● ";
  color: var(--color-accent);
}

.frame-detail-description {
  font-size: 13px;
  color: var(--color-text-secondary);
}

/* ---------- Loading view ---------- */

#loading-view {
  display: flex;
  justify-content: center;
  padding: var(--space-6);
}

.loading-card {
  width: 100%;
  max-width: 480px;
  text-align: center;
  background: var(--color-surface);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-subtle);
  padding: var(--space-6) var(--space-5);
}

.loading-heading {
  margin: 0 0 var(--space-1);
  font-size: 24px;
  font-weight: 600;
  letter-spacing: -0.01em;
  outline: none;
}

.loading-subheading {
  margin: 0 0 var(--space-5);
  font-size: 14px;
  color: var(--color-text-secondary);
}

.loading-glyph-wrap {
  display: flex;
  justify-content: center;
  margin-bottom: var(--space-5);
  color: var(--color-text-tertiary);
  animation: pulseGlyph 2.6s ease-in-out infinite;
}

.stepper {
  list-style: none;
  margin: 0 auto var(--space-5);
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  max-width: 280px;
  text-align: left;
}

.step {
  display: flex;
  align-items: baseline;
  gap: var(--space-3);
}

.step::before {
  content: "○";
  flex-shrink: 0;
  width: 1.2em;
  font-size: 14px;
  color: var(--color-text-tertiary);
}

.step-label {
  font-size: 14px;
  color: var(--color-text-tertiary);
}

.step-done .step-label {
  color: var(--color-text-secondary);
}

.step-done::before {
  content: "✓";
  color: var(--color-text-primary);
}

.step-active .step-label {
  color: var(--color-text-primary);
  font-weight: 600;
}

.step-active::before {
  content: "●";
  color: var(--color-accent);
  animation: pulseDot 1.6s ease-in-out infinite;
}

.loading-footnote {
  margin: 0;
  font-size: 13px;
  line-height: 1.6;
  color: var(--color-text-tertiary);
}

.loading-dots span {
  display: inline-block;
  animation: dotFade 1.4s ease-in-out infinite;
}

.loading-dots span:nth-child(2) {
  animation-delay: 0.2s;
}

.loading-dots span:nth-child(3) {
  animation-delay: 0.4s;
}

.error-card {
  margin-top: var(--space-5);
  padding-top: var(--space-5);
  border-top: 1px solid var(--color-border);
  text-align: left;
}

.error-heading {
  margin: 0 0 var(--space-2);
  font-size: 16px;
  font-weight: 600;
  color: var(--color-error);
}

.error-message {
  margin: 0 0 var(--space-4);
  font-size: 14px;
  color: var(--color-text-secondary);
}

.error-card .actions-row {
  justify-content: flex-start;
  margin-top: 0;
}

/* ---------- Reveal + Review (absorbs the former Checkout) ---------- */

#review-view {
  display: flex;
  flex-direction: column;
  max-width: 900px;
  width: 100%;
  margin: 0 auto;
  padding: var(--space-6);
}

.review-heading {
  margin: 0 0 var(--space-1);
  font-size: 28px;
  font-weight: 600;
  letter-spacing: -0.01em;
  outline: none;
  text-align: center;
}

.review-subheading {
  margin: 0 0 var(--space-5);
  font-size: 15px;
  color: var(--color-text-secondary);
  text-align: center;
}

/* Prominent primary CTA - customization is the clearest next action
   once a preview is ready (see index.html's own comment on this block
   and app.js's open-customize-button listener). Placed before
   .model-and-customize-row deliberately, so it renders above the model
   panel and stays visible without scrolling on a 375px viewport. */
.review-primary-cta {
  text-align: center;
  margin-bottom: var(--space-5);
}

/* ---------- Post-generation customization (Frame details/Color style) ---------- */

.model-and-customize-row {
  display: flex;
  align-items: flex-start;
  gap: var(--space-5);
  margin-bottom: var(--space-5);
}

.model-and-customize-row .model-panel {
  flex: 1;
  min-width: 0;
  margin-bottom: 0;
}

.model-panel {
  background: var(--color-surface);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-subtle);
  padding: var(--space-5);
  height: 560px;
  display: flex;
  margin-bottom: var(--space-5);
  position: relative;
}

/* Live-update feedback while a customize request is in flight - dims
   the preview without the "still generating" pulseBg treatment
   (.is-loading), since the model is already there and just updating. */
.model-panel.is-updating .model-viewer-el {
  opacity: 0.55;
  transition: opacity 0.15s ease;
}

.model-panel.is-updating::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 28px;
  height: 28px;
  margin: -14px 0 0 -14px;
  border-radius: 50%;
  border: 3px solid var(--color-border);
  border-top-color: var(--color-accent);
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* Desktop: a permanently-visible side panel - the mobile-only drawer
   toggle/scrim stay hidden entirely. */
.review-customize-panel {
  width: 300px;
  flex-shrink: 0;
  background: var(--color-surface);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-subtle);
  padding: var(--space-5);
  max-height: 560px;
  overflow-y: auto;
}

.customize-panel-toggle {
  display: none;
}

/* #customize-panel-scrim reuses .steps-sheet-scrim's own rules
   (position/background/z-index, plus [hidden] { display: none }) - it
   only ever needs to actually show on mobile, and only when JS clears
   its hidden attribute (see openCustomizePanel/closeCustomizePanel in
   app.js), so no ID-selector override is added here that would fight
   that attribute at higher specificity. */

.customize-section + .customize-section {
  margin-top: var(--space-5);
  padding-top: var(--space-5);
  border-top: 1px solid var(--color-border);
}

.customize-section-title {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  margin: 0 0 var(--space-3);
  font-size: 15px;
  font-weight: 700;
}

.recommended-badge {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: var(--color-accent);
  background: rgba(47, 111, 237, 0.1);
  border-radius: 999px;
  padding: 2px 8px;
}

.customize-subsection-label {
  margin: var(--space-3) 0 var(--space-2);
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--color-text-tertiary);
}

.frame-toggle-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
}

.switch-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  padding: var(--space-2) 0;
  cursor: pointer;
}

.switch-label {
  font-size: 14px;
  color: var(--color-text-primary);
}

.switch-input {
  position: absolute;
  opacity: 0;
  width: 1px;
  height: 1px;
}

.switch-track {
  position: relative;
  flex-shrink: 0;
  width: 38px;
  height: 22px;
  border-radius: 999px;
  background: var(--color-border);
  transition: background-color 0.15s ease;
}

.switch-thumb {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #ffffff;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.25);
  transition: transform 0.15s ease;
}

.switch-input:checked + .switch-track {
  background: var(--color-accent);
}

.switch-input:checked + .switch-track .switch-thumb {
  transform: translateX(16px);
}

.switch-input:focus-visible + .switch-track {
  outline: 2px solid var(--color-accent);
  outline-offset: 2px;
}

.customize-actions-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2) var(--space-4);
  margin-top: var(--space-3);
}

.customize-undo-redo-row {
  gap: var(--space-2);
}

.btn-secondary-sm {
  flex: 1;
  padding: 6px 10px;
  border-radius: var(--radius-md);
  border: 1px solid var(--color-border);
  background: transparent;
  color: var(--color-text-primary);
  font-family: inherit;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}

.btn-secondary-sm:hover:not(:disabled) {
  background: var(--color-surface-hover);
}

.btn-secondary-sm:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.theme-picker-compact .theme-swatch-button {
  padding: var(--space-2) var(--space-3);
}

.theme-picker-compact .theme-swatch-description {
  display: none;
}

.customize-status-message {
  min-height: 16px;
  margin: var(--space-3) 0 0;
  font-size: 12px;
  color: var(--color-text-secondary);
}

.customize-status-message.error {
  color: var(--color-error);
}

.underside-name-field {
  margin: var(--space-2) 0 var(--space-3);
}

.underside-name-field input[type="text"] {
  padding: 10px 12px;
  font-size: 14px;
}

.underside-status-text {
  min-height: 14px;
  margin: var(--space-1) 0 0;
  font-size: 12px;
  color: var(--color-text-tertiary);
}

.underside-status-text.error {
  color: var(--color-error);
}

.underside-status-text.good {
  color: var(--color-success, #2f9e5b);
}

.underside-maker-preview {
  margin: var(--space-1) 0 var(--space-3);
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-md);
  background: var(--color-surface-hover);
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  font-size: 12px;
  line-height: 1.5;
  color: var(--color-text-secondary);
  white-space: pre-line;
}

.maker-mark-included-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  margin-top: var(--space-3);
}

.maker-mark-included-row strong,
.maker-mark-included-row small {
  display: block;
}

.maker-mark-included-row small {
  margin-top: 2px;
  color: var(--color-text-tertiary);
  font-size: 12px;
}

.maker-mark-included-badge {
  flex: 0 0 auto;
  padding: 4px 8px;
  border-radius: 999px;
  background: rgba(47, 158, 91, 0.12);
  color: var(--color-success, #2f9e5b);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

#view-underside-button[aria-pressed="true"] {
  border-color: var(--color-accent);
  color: var(--color-accent);
  background: rgba(47, 111, 237, 0.08);
}

.model-panel.is-loading {
  animation: pulseBg 1.8s ease-in-out infinite;
}

.model-viewer-el {
  width: 100%;
  height: 100%;
  --poster-color: transparent;
}

.review-summary {
  background: var(--color-surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-subtle);
  padding: var(--space-5);
}

.info-list {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: var(--space-2) var(--space-4);
  margin: 0;
}

.info-list dt {
  font-size: 13px;
  color: var(--color-text-secondary);
}

.info-list dd {
  margin: 0;
  font-size: 14px;
  font-weight: 500;
  text-align: right;
  color: var(--color-text-primary);
}

.info-list .review-price {
  padding-top: var(--space-2);
  border-top: 1px solid var(--color-border);
  color: var(--color-text-primary);
  font-size: 16px;
  font-weight: 700;
}

.trust-line {
  margin: var(--space-4) 0 0;
  text-align: center;
  font-size: 13px;
  color: var(--color-text-secondary);
}

/* ---------- Confirmation (order placed) ---------- */

.confirmation-card {
  max-width: 420px;
  width: 100%;
  margin: 0 auto;
  padding: var(--space-6) var(--space-5);
  text-align: center;
}

/* ---------- Responsive ---------- */

@media (max-width: 900px) {
  .map-panel {
    height: 340px;
  }

  .display-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .frame-details-picker {
    flex-direction: column;
  }

  .model-panel {
    height: 400px;
  }

  /* Mobile: a collapsible bottom drawer instead of a side panel -
     anchored to the viewport bottom, height-animated (not
     translate-animated) so the collapsed state naturally clips away
     everything below the toggle handle via overflow:hidden, which also
     means collapsed content can never intercept a touch - there is
     nothing there to hit. model-viewer's own rotate gesture happens
     well above this short strip regardless of state. */
  .review-customize-panel {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 30;
    width: auto;
    max-height: 52px;
    overflow: hidden;
    border-radius: var(--radius-xl) var(--radius-xl) 0 0;
    box-shadow: 0 -8px 32px rgba(0, 0, 0, 0.18);
    transition: max-height 0.25s ease;
    padding: 0 var(--space-5) max(var(--space-4), env(safe-area-inset-bottom));
  }

  .review-customize-panel.is-open {
    max-height: 75vh;
    overflow-y: auto;
  }

  .customize-panel-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: var(--space-1);
    width: 100%;
    background: none;
    border: none;
    padding: var(--space-2) 0;
    cursor: pointer;
    font-family: inherit;
  }

  .customize-panel-toggle-label {
    font-size: 13px;
    font-weight: 600;
    color: var(--color-text-primary);
  }

}

@media (max-width: 560px) {
  .step-heading {
    font-size: 22px;
  }

  .step-card {
    padding: var(--space-5) var(--space-4);
  }

  .display-grid {
    grid-template-columns: 1fr;
  }

  .actions-row {
    flex-direction: column;
  }

  .actions-row .btn {
    width: 100%;
  }

  .theme-palette-preview {
    flex-wrap: wrap;
  }

  .search-row {
    align-items: stretch;
  }

  .search-row .btn {
    padding-left: 16px;
    padding-right: 16px;
  }

  .map-panel {
    height: 380px;
    margin-left: calc(-1 * var(--space-4));
    margin-right: calc(-1 * var(--space-4));
    border-radius: 0;
  }

  .shape-selector-grid {
    flex-wrap: nowrap;
    overflow-x: auto;
    overflow-y: hidden;
    padding-bottom: 2px;
    -webkit-overflow-scrolling: touch;
    scroll-snap-type: x proximity;
  }

  .shape-btn {
    scroll-snap-align: start;
  }

  .place-continue-bar {
    position: sticky;
    z-index: 800;
    bottom: 0;
    margin-left: calc(-1 * var(--space-4));
    margin-right: calc(-1 * var(--space-4));
    padding: var(--space-3) var(--space-4) max(var(--space-3), env(safe-area-inset-bottom));
    background: rgba(250, 250, 250, 0.96);
    border-top: 1px solid var(--color-border);
    box-shadow: 0 -8px 20px rgba(0, 0, 0, 0.06);
    backdrop-filter: blur(10px);
  }
}
