:root {
  --bg: #f6f0e7;
  --ink: #241914;
  --muted: #5c514a;
  --card: #fffbf7;
  --accent: #a33b28;
  --line: #e4d5c6;
  --serif: "Fraunces", "Iowan Old Style", Palatino, "Palatino Linotype", Georgia, serif;
  --sans: "Outfit", "Avenir Next", "Segoe UI", sans-serif;
  color-scheme: light;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 17px;
  line-height: 1.4;
}

body {
  min-height: 100dvh;
  background-image:
    radial-gradient(ellipse 90% 40% at 0% -10%, rgba(255, 255, 255, 0.9), transparent 55%),
    radial-gradient(ellipse 70% 36% at 110% 0%, rgba(163, 59, 40, 0.08), transparent 50%);
}

button,
textarea {
  font: inherit;
  color: inherit;
}

button {
  cursor: pointer;
}

img {
  max-width: 100%;
}

.app {
  width: min(480px, 100%);
  margin: 0 auto;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  padding-bottom: env(safe-area-inset-bottom);
}

.top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 18px 20px 6px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.logo {
  width: 48px;
  height: 48px;
  border-radius: 16px;
  background: var(--accent);
  color: #fffaf7;
  display: grid;
  place-items: center;
  font-family: var(--serif);
  font-size: 24px;
  font-weight: 640;
  flex: none;
  overflow: hidden;
}

.logo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.brand-name {
  margin: 0;
  font-family: var(--serif);
  font-size: 22px;
  font-weight: 640;
  line-height: 1.1;
  letter-spacing: -0.02em;
}

.demo-pill {
  margin: 0;
  flex: none;
  background: var(--ink);
  color: #fffaf7;
  border-radius: 999px;
  padding: 6px 10px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.steps {
  list-style: none;
  display: flex;
  gap: 8px;
  margin: 8px 20px 4px;
  padding: 0;
}

.steps li {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 36px;
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  font-size: 14px;
  font-weight: 600;
}

.steps li span {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: #efe4d6;
  color: var(--muted);
  font-size: 12px;
}

.steps li.is-current {
  background: #fff;
  color: var(--ink);
  box-shadow: 0 1px 0 rgba(60, 30, 20, 0.04);
}

.steps li.is-current span,
.steps li.is-done span {
  background: var(--accent);
  color: white;
}

.steps li.is-done {
  color: var(--ink);
}

main {
  flex: 1 0 auto;
  padding: 8px 20px 12px;
}

h1 {
  font-family: var(--serif);
  font-weight: 640;
  font-size: 34px;
  line-height: 1.05;
  letter-spacing: -0.03em;
  margin: 12px 0 8px;
}

.lede,
.loading-detail,
.stylist-note,
.slider-help,
.dock-hint,
.powered,
.site-footer {
  color: var(--muted);
}

.lede {
  margin: 0 0 18px;
  font-size: 17px;
}

.choices {
  display: grid;
  gap: 12px;
  margin-bottom: 16px;
}

.choice {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 14px;
  text-align: left;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 20px;
  min-height: 84px;
  padding: 14px 16px;
  box-shadow: 0 10px 28px rgba(60, 30, 20, 0.05);
}

.choice-icon {
  width: 52px;
  height: 52px;
  border-radius: 16px;
  background: #f8e6e1;
  background: color-mix(in srgb, var(--accent) 14%, white);
  color: var(--accent);
  display: grid;
  place-items: center;
  flex: none;
}

.choice-title {
  display: block;
  font-size: 18px;
  font-weight: 650;
}

.choice-sub {
  display: block;
  margin-top: 2px;
  color: var(--muted);
  font-size: 14px;
}

.preview-wrap {
  display: grid;
  gap: 12px;
  margin-bottom: 16px;
}

.hero-photo {
  width: 100%;
  max-height: 320px;
  object-fit: cover;
  border-radius: 24px;
  background: #efe4d6;
}

.btn {
  width: 100%;
  min-height: 56px;
  border-radius: 16px;
  border: 2px solid transparent;
  padding: 14px 18px;
  font-size: 18px;
  font-weight: 650;
}

.btn-primary {
  background: var(--accent);
  color: #fffaf7;
}

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

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

.btn-text {
  background: transparent;
  border: 0;
  color: var(--accent);
  font-weight: 650;
  font-size: 16px;
  min-height: 44px;
  padding: 8px 4px;
  width: auto;
}

.note {
  margin: 8px 0 4px;
  background: rgba(255, 255, 255, 0.55);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 14px 16px;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.45;
}

.note strong {
  color: var(--ink);
  font-weight: 650;
}

.using {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 8px;
}

.using img {
  width: 72px;
  height: 72px;
  object-fit: cover;
  border-radius: 18px;
  background: #efe4d6;
}

.using-label {
  margin: 0;
  font-weight: 650;
}

#panel-styles h1,
#panel-result h1 {
  font-size: 30px;
  margin: 8px 0 10px;
}

#panel-result h1 {
  font-size: 28px;
}

.chips {
  display: flex;
  gap: 8px;
  margin-bottom: 14px;
}

.chip {
  flex: 1;
  min-height: 44px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--card);
  font-weight: 650;
  font-size: 15px;
}

.chip[aria-pressed="true"] {
  background: var(--ink);
  color: #fffaf7;
  border-color: var(--ink);
}

.custom {
  display: block;
  font-weight: 650;
  margin-bottom: 14px;
}

.optional {
  display: inline-block;
  margin-left: 6px;
  font-weight: 500;
  color: var(--muted);
  font-size: 13px;
}

textarea {
  display: block;
  width: 100%;
  margin-top: 8px;
  border: 1px solid var(--line);
  background: var(--card);
  border-radius: 16px;
  padding: 12px 14px;
  min-height: 72px;
  resize: vertical;
  font-size: 16px;
}

.style-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

#panel-styles {
  padding-bottom: 168px;
}

.style-card {
  position: relative;
  text-align: center;
  background: var(--card);
  border: 2px solid transparent;
  border-radius: 18px;
  box-shadow: 0 8px 24px rgba(60, 30, 20, 0.05);
  padding: 10px 8px 12px;
  min-height: 138px;
}

.style-card[aria-pressed="true"] {
  border-color: var(--accent);
}

.style-card[aria-pressed="true"]::after {
  content: "✓";
  position: absolute;
  top: 8px;
  right: 8px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--accent);
  color: white;
  font-size: 13px;
  line-height: 22px;
}

.style-icon {
  display: block;
  width: 76px;
  height: 68px;
  margin: 0 auto 2px;
  color: #3b241c;
}

.style-icon svg {
  width: 100%;
  height: 100%;
}

.style-name {
  display: block;
  font-weight: 650;
  font-size: 15px;
  line-height: 1.2;
}

.style-blurb {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.3;
  margin-top: 3px;
}

.swatch {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  display: block;
  margin: 6px auto 8px;
  box-shadow:
    inset 0 0 0 1px rgba(36, 25, 20, 0.14),
    0 8px 16px rgba(60, 30, 20, 0.12);
}

.dock {
  position: fixed;
  left: 50%;
  transform: translateX(-50%);
  bottom: 0;
  width: min(480px, 100%);
  z-index: 5;
}

.dock::before {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: -28px;
  height: 28px;
  background: linear-gradient(to bottom, rgb(from var(--bg) r g b / 0), var(--bg));
  pointer-events: none;
}

.dock {
  padding: 10px 20px calc(12px + env(safe-area-inset-bottom));
  background: rgba(246, 240, 231, 0.94);
  border-top: 1px solid var(--line);
  backdrop-filter: blur(10px);
}

.dock-hint {
  margin: 0 0 8px;
  font-size: 14px;
  text-align: center;
}

.powered,
.site-footer {
  margin: 8px 0 0;
  text-align: center;
  font-size: 13px;
}

.site-footer {
  margin-top: auto;
  padding: 18px 20px calc(18px + env(safe-area-inset-bottom));
}

.loading {
  text-align: center;
  padding-top: 12vh;
  min-height: 52dvh;
}

.loader {
  width: 72px;
  height: 72px;
  margin: 0 auto 8px;
  border-radius: 50%;
  border: 3px solid var(--line);
  border-top-color: var(--accent);
  animation: spin 0.9s linear infinite;
}

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

.demo-banner {
  margin: 0 0 10px;
  background: #fff4e8;
  border: 1px solid #efd0a4;
  color: #6a3b12;
  border-radius: 14px;
  padding: 10px 12px;
  font-size: 14px;
  font-weight: 600;
}

.slider-help,
.look-name,
.stylist-note {
  margin: 8px 0;
  font-size: 14px;
  text-align: center;
}

.look-name {
  color: var(--ink);
  font-weight: 650;
  font-size: 16px;
}

.compare {
  position: relative;
  width: 100%;
  height: min(248px, 34dvh);
  margin: 4px auto 0;
  cursor: ew-resize;
  border-radius: 22px;
  overflow: hidden;
  background: #efe4d6;
  box-shadow: 0 16px 40px rgba(60, 30, 20, 0.12);
  touch-action: none;
  user-select: none;
}

.compare .after,
.compare .before {
  position: absolute;
  top: 0;
  left: 0;
  height: 100%;
  object-fit: cover;
  object-position: center 18%;
}

.compare .after {
  width: 100%;
}

.clip {
  position: absolute;
  top: 0;
  left: 0;
  bottom: 0;
  width: 50%;
  overflow: hidden;
  border-right: 2px solid white;
}

.handle {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 50%;
  width: 0;
  z-index: 2;
  pointer-events: none;
}

.knob {
  position: absolute;
  top: 50%;
  left: 0;
  width: 44px;
  height: 44px;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  background: white;
  color: var(--accent);
  display: grid;
  place-items: center;
  box-shadow: 0 6px 16px rgba(36, 25, 20, 0.25);
  border: 3px solid var(--accent);
}

.tag {
  position: absolute;
  top: 12px;
  z-index: 2;
  background: rgba(36, 25, 20, 0.72);
  color: white;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 4px 8px;
  border-radius: 999px;
  pointer-events: none;
}

.tag-before {
  left: 12px;
}

.tag-after {
  right: 12px;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

.result-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin: 4px 0 12px;
}

.result-tile {
  padding: 0;
  border: 2px solid transparent;
  border-radius: 14px;
  overflow: hidden;
  background: var(--card);
  text-align: left;
}

.result-tile img {
  display: block;
  width: 100%;
  height: 92px;
  object-fit: cover;
}

.result-tile span {
  display: block;
  padding: 6px 6px 8px;
  font-size: 12px;
  font-weight: 650;
  line-height: 1.2;
}

.result-tile[aria-pressed="true"] {
  border-color: var(--accent);
}

.result-tile.is-error {
  padding: 8px;
  color: var(--muted);
  font-size: 12px;
  min-height: 92px;
}

.actions {
  display: grid;
  gap: 8px;
  margin-top: 4px;
}

#panel-result .btn {
  min-height: 52px;
}

.alert {
  margin: 8px 0 4px;
  background: #fff1ee;
  border: 1px solid #f0c2b8;
  color: #6e241c;
  border-radius: 14px;
  padding: 12px 14px;
  font-weight: 600;
}

.boot-error {
  margin: 24px;
  font-size: 18px;
}

[hidden] {
  display: none !important;
}

:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 3px;
}

@media (prefers-reduced-motion: reduce) {
  .loader {
    animation: none;
  }
}
