:root {
  --bg: #f0f8ff;
  --card: #ffffff;
  --border: #c4a35a;
  --text: #1a2744;
  --muted: #4a5568;
  --accent: #1a2744;
  --warn: #9a3412;
  --warn-bg: #fff7ed;
  --success: #166534;
  --success-bg: #dcfce7;
}

* { box-sizing: border-box; }

html {
  -webkit-text-size-adjust: 100%;
  overflow-x: hidden;
}

body {
  margin: 0;
  font-family: Georgia, "Times New Roman", serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  overflow-x: hidden;
  max-width: 100vw;
}

img {
  max-width: 100%;
  height: auto;
}

.wrap { max-width: 820px; margin: 0 auto; padding: 0 1.25rem; width: 100%; }

.site-header {
  background: var(--accent);
  color: #fff;
  padding: 1.25rem 0;
  border-bottom: 3px solid var(--border);
}

.site-header h1 { margin: 0 0 0.35rem; font-size: 1.45rem; line-height: 1.3; }

.site-title {
  margin: 0 0 0.2rem;
  font-size: 1.55rem;
  line-height: 1.25;
  font-weight: bold;
}

.site-byline {
  margin: 0 0 0.5rem;
  font-size: 0.88rem;
  opacity: 0.85;
  font-weight: normal;
}

.tagline { margin: 0; opacity: 0.9; font-size: 0.9rem; }

.wizard-wrap {
  padding: 2rem 0 3rem;
  min-width: 0;
  overflow-x: hidden;
}

.wizard-nav {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.75rem;
  margin-top: 1.25rem;
  margin-bottom: 2rem;
}

@media (max-width: 640px) {
  .wrap { padding: 0 1rem; }

  .site-header { padding: 1rem 0; }

  .site-title { font-size: 1.35rem; }

  .site-byline { font-size: 0.82rem; margin-bottom: 0.4rem; }

  .tagline { font-size: 0.8rem; line-height: 1.45; }

  .wizard-wrap { padding: 1.25rem 0 2rem; }

  .wizard-nav {
    grid-template-columns: 1fr;
    gap: 0.75rem;
    margin-top: 0.75rem;
    margin-bottom: 1.75rem;
  }

  .wizard-tab {
    width: 100%;
    padding: 0.85rem 1rem;
  }

  .panel {
    padding: 1rem;
    border-radius: 10px;
  }

  .panel h2 { font-size: 1.05rem; }

  .step-lead { font-size: 0.9rem; }

  .card-block { padding: 0.85rem; }

  .ref-toolbar {
    flex-direction: column;
    align-items: stretch;
    gap: 0.65rem;
  }

  .ref-toolbar-actions {
    flex-direction: column;
  }

  .ref-toolbar-actions .btn {
    width: 100%;
    text-align: center;
  }

  .ref-gallery {
    grid-template-columns: 1fr;
    gap: 0.85rem;
  }

  .ref-card {
    padding: 0.75rem;
  }

  .ref-thumb {
    height: auto;
    max-height: 220px;
    aspect-ratio: 4 / 3;
    object-fit: cover;
  }

  .ref-actions .btn {
    display: block;
    width: 100%;
    text-align: center;
  }

  .wizard-actions {
    flex-direction: column;
    align-items: stretch;
    margin-top: 1.25rem;
    padding-top: 1rem;
    padding-bottom: 0.5rem;
  }

  .wizard-actions .btn {
    width: 100%;
    text-align: center;
  }

  .wizard-actions > span:empty {
    display: none;
  }

  .hero-btn {
    max-width: none;
    font-size: 1rem;
    padding: 0.9rem 1rem;
  }

  .hero-btn-secondary,
  .hero-btn-tertiary {
    max-width: none;
    font-size: 0.95rem;
    padding: 0.85rem 1rem;
  }

  .mobile-save-panel {
    max-width: none;
  }

  .code-out {
    max-height: 200px;
    font-size: 0.7rem;
  }

  .copy-toast {
    width: calc(100vw - 2rem);
    max-width: none;
    padding: 0.85rem 1rem;
  }
}

.wizard-tab {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.75rem 1rem;
  border: 2px solid #cbd5e1;
  border-radius: 10px;
  background: #fff;
  cursor: pointer;
  font: inherit;
  text-align: left;
  color: var(--text);
}

.wizard-tab:hover { border-color: var(--border); }

.wizard-tab.active {
  border-color: var(--accent);
  background: #eff6ff;
  font-weight: bold;
}

.tab-num {
  flex-shrink: 0;
  width: 1.75rem;
  height: 1.75rem;
  border-radius: 999px;
  background: var(--accent);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
  font-weight: bold;
}

.wizard-tab:not(.active) .tab-num { background: #94a3b8; }
.tab-label { font-size: 0.88rem; line-height: 1.25; }

.panel {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1.25rem 1.5rem;
  box-shadow: 0 8px 24px rgba(26, 39, 68, 0.08);
  min-width: 0;
  max-width: 100%;
  overflow-x: hidden;
  margin-top: 0.5rem;
}

.panel h2 {
  margin: 0 0 0.75rem;
  font-size: 1.2rem;
  border-bottom: 1px solid #e2e8f0;
  padding-bottom: 0.5rem;
}

.step-lead { margin: 0 0 1rem; font-size: 0.95rem; color: var(--muted); }

fieldset {
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  margin: 0 0 1rem;
  padding: 0.75rem 1rem;
}

legend { font-weight: bold; padding: 0 0.35rem; }
label { display: block; margin: 0.5rem 0 0.25rem; font-size: 0.9rem; }

input[type="text"], select, textarea {
  width: 100%;
  max-width: 100%;
  font: inherit;
  padding: 0.5rem 0.65rem;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  background: #fff;
}

textarea { resize: vertical; min-height: 2.5rem; }
.radio { display: flex; align-items: center; gap: 0.5rem; margin: 0.35rem 0; font-weight: normal; }
.radio input { width: auto; }

.core-identity-panel { margin-top: 0.75rem; }

.core-identity-list {
  margin: 0.5rem 0 0;
  padding-left: 1.25rem;
  font-size: 0.92rem;
  line-height: 1.45;
}

.core-identity-list li { margin: 0.25rem 0; }

.canonical-inventory-root fieldset {
  margin: 1rem 0;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 0.75rem 1rem;
}

.canonical-item {
  border-top: 1px solid #e2e8f0;
  padding: 0.65rem 0;
}

.canonical-item:first-of-type { border-top: none; padding-top: 0.25rem; }

.canonical-item.signature .canonical-item-desc { font-weight: 600; }

.canonical-item-desc {
  margin: 0 0 0.35rem;
  font-size: 0.92rem;
  line-height: 1.4;
}

.canonical-modes {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 1rem;
  margin: 0.25rem 0;
}

.canonical-mode {
  font-size: 0.88rem;
  margin: 0;
}

.canonical-instead {
  margin-top: 0.35rem;
}

.canonical-instead-text {
  width: 100%;
  max-width: 100%;
  margin-bottom: 0.35rem;
}

.canonical-ref-upload {
  display: block;
  margin: 0.25rem 0 0.15rem;
}

.canonical-dep {
  margin: 0 0 0.35rem;
  font-style: italic;
}

.drift-warning {
  background: var(--warn-bg);
  border: 1px solid #fdba74;
  color: var(--warn);
  padding: 0.65rem 0.75rem;
  border-radius: 6px;
  font-size: 0.9rem;
  margin: 0.5rem 0 0;
}

.hidden { display: none !important; }
.hint { font-size: 0.88rem; color: var(--muted); }

.load-error {
  background: var(--warn-bg);
  border: 1px solid #fdba74;
  color: var(--warn);
  padding: 0.85rem 1rem;
  border-radius: 8px;
  font-size: 0.92rem;
  margin-bottom: 1rem;
  line-height: 1.5;
}

.load-error strong { display: block; margin-bottom: 0.35rem; }

.card-block {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 1rem;
  margin-bottom: 1rem;
}

.step-instructions, .copy-instructions {
  background: #eff6ff;
  border-color: #bfdbfe;
}

.prep-callout {
  margin: 0 0 0.85rem;
  padding: 0.75rem 0.9rem;
  background: #fff;
  border: 1px solid #93c5fd;
  border-left: 4px solid #1a2744;
  border-radius: 4px;
  font-size: 0.95rem;
  line-height: 1.45;
}

.steps-list { margin: 0.5rem 0; padding-left: 1.25rem; }
.steps-list li { margin: 0.4rem 0; }

.ref-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
  padding: 0.65rem 0.75rem;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
}

.ref-toolbar-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.ref-link-count { margin: 0; }

.refs-subheading {
  margin: 0 0 0.35rem;
  font-size: 1rem;
}

.refs-subhint { margin: 0 0 0.75rem; }

.custom-refs-panel {
  margin-top: 1.25rem;
  background: #fffbeb;
  border-color: #fde68a;
}

.custom-refs-panel .refs-subheading { margin-top: 0; }

.privacy-note {
  margin: 0 0 0.65rem;
  font-size: 0.88rem;
  color: var(--text);
}

.custom-ref-warning {
  margin: 0 0 0.85rem;
  font-size: 0.88rem;
  line-height: 1.5;
  color: var(--warn);
}

.custom-wardrobe-warning {
  margin: 0 0 0.85rem;
  font-size: 0.88rem;
  line-height: 1.5;
  color: var(--warn);
}

.wardrobe-mode-hint {
  margin: 0.5rem 0 0;
}

#customWardrobe {
  width: 100%;
  font: inherit;
}

.custom-upload-label {
  font-weight: bold;
  margin-bottom: 0.35rem;
}

#customRefInput {
  width: 100%;
  font: inherit;
  margin-bottom: 0.75rem;
}

.custom-ref-gallery { margin-top: 0.5rem; }

.ref-card.tier-user { border-left: 4px solid #7c3aed; }

.ref-card .ref-remove-btn {
  margin-top: 0.35rem;
  padding: 0.3rem 0.55rem;
  font-size: 0.75rem;
  background: #fff;
  color: var(--warn);
  border: 1px solid #fdba74;
  border-radius: 6px;
  cursor: pointer;
  font: inherit;
}

.ref-include {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  margin: 0.15rem 0 0;
  font-size: 0.82rem;
  font-weight: normal;
  color: var(--muted);
}

.ref-include input { width: auto; margin: 0; }

.ref-card.ref-unchecked {
  opacity: 0.72;
}

.copy-warning {
  background: var(--warn-bg);
  border: 1px solid #fdba74;
  color: var(--warn);
  padding: 0.65rem 0.75rem;
  border-radius: 6px;
  font-size: 0.88rem;
  margin: 0.75rem 0 0;
}

.ref-gallery {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.75rem;
  margin-bottom: 1rem;
  width: 100%;
  min-width: 0;
}

.ref-card {
  position: relative;
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 0.65rem;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  min-width: 0;
  max-width: 100%;
  overflow: hidden;
}

.ref-card.tier-critical { border-left: 4px solid #1a2744; }
.ref-card.tier-recommended { border-left: 4px solid #c4a35a; }

.ref-order {
  position: absolute;
  top: 0.5rem;
  left: 0.5rem;
  background: var(--accent);
  color: #fff;
  width: 1.5rem;
  height: 1.5rem;
  border-radius: 999px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: bold;
}

.ref-tier {
  align-self: flex-end;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
  font-weight: bold;
}

.ref-thumb {
  display: block;
  width: 100%;
  max-width: 100%;
  height: 120px;
  object-fit: cover;
  object-position: top center;
  border-radius: 4px;
  background: #e2e8f0;
  margin-top: 0.25rem;
}

.ref-thumb.ref-thumb-failed {
  object-fit: contain;
  padding: 0.5rem;
  font-size: 0.75rem;
}

.ref-card h4 { margin: 0; font-size: 0.9rem; }
.ref-usage { margin: 0; font-size: 0.78rem; color: var(--muted); line-height: 1.35; }
.ref-actions { margin-top: 0.25rem; }

.wizard-actions {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin-top: 1.75rem;
  padding: 1.35rem 0 1rem;
  border-top: 1px solid #e2e8f0;
}

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

.package-delivery-fieldset {
  text-align: left;
  margin: 0 0 1.25rem;
  padding: 0.85rem 1rem;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  background: #f8fafc;
}

.package-delivery-fieldset legend {
  font-weight: bold;
  padding: 0 0.35rem;
}

.package-delivery-option {
  display: block;
  margin: 0.45rem 0;
  cursor: pointer;
}

.package-delivery-option input {
  margin-right: 0.4rem;
}

.hero-btn-step1 {
  margin-top: 0.25rem;
}

.hero-btn-step3 {
  border: 2px solid #1a2744;
}

.hero-btn {
  width: 100%;
  max-width: 420px;
  padding: 1rem 1.5rem;
  font-size: 1.1rem;
  font-weight: bold;
}

.hero-btn-secondary {
  display: block;
  width: 100%;
  max-width: 420px;
  margin: 0.75rem auto 0;
  padding: 0.85rem 1.25rem;
  font-size: 1rem;
  font-weight: bold;
}

.hero-btn-tertiary {
  display: block;
  width: 100%;
  max-width: 420px;
  margin: 0.65rem auto 0;
  padding: 0.7rem 1rem;
  font-size: 0.92rem;
}

.mobile-save-panel {
  margin: 1rem auto 0;
  max-width: 420px;
  padding: 0.85rem 1rem;
  text-align: left;
  background: #fff;
  border: 1px solid #93c5fd;
  border-left: 4px solid #1a2744;
  border-radius: 6px;
}

.mobile-save-lead {
  margin: 0 0 0.65rem;
  font-weight: bold;
}

.mobile-save-link {
  display: block;
  width: 100%;
  text-align: center;
  text-decoration: none;
  margin-bottom: 0.5rem;
}

.copy-save-lead {
  margin-top: 0.85rem;
}

.preview-details { margin-top: 1rem; text-align: left; }
.preview-details summary { cursor: pointer; font-size: 0.9rem; color: var(--accent); font-weight: bold; }

.code-out {
  background: #0f172a;
  color: #e2e8f0;
  padding: 0.75rem;
  border-radius: 6px;
  font-size: 0.75rem;
  line-height: 1.45;
  max-height: 280px;
  overflow: auto;
  white-space: pre-wrap;
  word-break: break-word;
  margin-top: 0.5rem;
}

.hidden-export {
  position: absolute;
  left: -9999px;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

.btn {
  display: inline-block;
  padding: 0.55rem 1rem;
  font: inherit;
  font-size: 0.92rem;
  border: 1px solid var(--accent);
  background: var(--accent);
  color: #fff;
  border-radius: 8px;
  cursor: pointer;
  text-decoration: none;
}

.btn:hover { opacity: 0.92; }
.btn.secondary { background: #fff; color: var(--accent); }
.btn.primary { font-weight: bold; }
.small-btn { padding: 0.35rem 0.65rem; font-size: 0.8rem; }

.advanced-panel {
  margin-top: 1.5rem;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 0.5rem 0.75rem;
  background: #fff;
}

.advanced-panel summary { cursor: pointer; font-weight: bold; padding: 0.35rem 0; color: var(--muted); }
.advanced-inner { padding: 0.75rem 0 0.25rem; }
.tier-block { margin-bottom: 1rem; font-size: 0.9rem; }
.creative-fork-note { font-size: 0.88rem; margin: 0; }

.copy-toast {
  position: fixed;
  bottom: 1.5rem;
  left: 50%;
  transform: translateX(-50%) translateY(120%);
  background: var(--success-bg);
  border: 2px solid #86efac;
  color: var(--success);
  padding: 1rem 1.5rem;
  border-radius: 12px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.18);
  z-index: 9999;
  max-width: 90vw;
  width: 420px;
  text-align: center;
  transition: transform 0.35s ease, opacity 0.35s ease;
  opacity: 0;
}

.copy-toast.visible {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
}

.copy-toast strong { display: block; font-size: 1.05rem; margin-bottom: 0.25rem; }
.copy-toast span { font-size: 0.9rem; }

.site-footer {
  border-top: 1px solid var(--border);
  padding: 1.5rem 0 2rem;
  font-size: 0.88rem;
  color: var(--muted);
  background: #fff;
}

.site-footer a { color: var(--accent); }
.copyright { margin: 0 0 0.5rem; font-size: 0.95rem; color: var(--text); }
.license-note { margin: 0 0 0.75rem; line-height: 1.55; }
.footer-links { margin: 0; font-size: 0.82rem; }
