:root {
  color-scheme: light;
  --paper: #fffdfc;
  --paper-soft: #fbf5f4;
  --paper-deep: #f5ecea;
  --ink: #282021;
  --muted: #746667;
  --line: rgba(56, 42, 43, 0.15);
  --line-strong: rgba(56, 42, 43, 0.32);
  --button: #2f2526;
  --button-hover: #493b3c;
  --accent: #833f50;
  --success: #476756;
  --danger: #9a3d4d;
  --shadow: 0 20px 55px rgba(56, 42, 43, 0.10);
  --display: Didot, "Bodoni 72", "Bodoni MT", Georgia, serif;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html {
  min-height: 100%;
  overflow-x: hidden;
  background: var(--paper);
}

body {
  min-width: 320px;
  min-height: 100dvh;
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(circle at 10% 0%, rgba(205, 149, 164, 0.13), transparent 34%),
    var(--paper);
  font-family: var(--sans);
  -webkit-font-smoothing: antialiased;
}

button { font: inherit; }
button:focus-visible { outline: 3px solid rgba(131, 63, 80, 0.35); outline-offset: 3px; }
button,
input { touch-action: manipulation; }

.skip-link {
  position: fixed;
  z-index: 30;
  top: 8px;
  left: 8px;
  padding: 10px 14px;
  border-radius: 999px;
  color: var(--paper);
  background: var(--ink);
  transform: translateY(-160%);
}

.skip-link:focus-visible { transform: translateY(0); }

:focus { scroll-margin-bottom: 120px; }

.app-shell {
  width: min(100%, 680px);
  min-height: 100dvh;
  margin: 0 auto;
  padding: max(14px, env(safe-area-inset-top)) 18px calc(116px + env(safe-area-inset-bottom));
}

.brand-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 4px 0 18px;
}

.wordmark {
  display: flex;
  flex-direction: column;
  font-family: var(--display);
  font-size: 21px;
  line-height: 0.82;
  letter-spacing: -0.04em;
}

.test-pill {
  padding: 6px 9px 5px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 750;
  letter-spacing: 0.16em;
}

.loading-state,
.processing-screen,
.result-screen {
  min-height: 65dvh;
  display: grid;
  place-content: center;
  justify-items: center;
  text-align: center;
}

.loading-state p,
.processing-screen p,
.result-screen > p {
  max-width: 420px;
  margin: 14px auto 0;
  color: var(--muted);
  line-height: 1.6;
}

.spinner {
  width: 24px;
  height: 24px;
  border: 2px solid var(--line);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.75s linear infinite;
}

.spinner-large { width: 46px; height: 46px; margin-bottom: 26px; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .spinner { animation: none; } }

.hero-card {
  height: clamp(130px, 33vw, 205px);
  margin-bottom: 22px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 24px;
  background: linear-gradient(145deg, #f9eeee, #f4e3e7);
  box-shadow: var(--shadow);
}

.hero-card img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
}

.step-row {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 11px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 720;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

h1 {
  margin: 0;
  font-family: var(--display);
  font-size: clamp(38px, 12vw, 64px);
  font-weight: 500;
  line-height: 0.96;
  letter-spacing: -0.05em;
  text-wrap: balance;
}

.lead {
  margin: 14px 0 24px;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.55;
}

.plans-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.plan-card {
  position: relative;
  min-height: 150px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 18px;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.74);
  text-align: left;
  cursor: pointer;
  transition: border-color 160ms ease, background 160ms ease, transform 160ms ease;
}

.plan-card:hover { transform: translateY(-2px); border-color: var(--line-strong); }
.plan-card[aria-checked="true"] {
  border-color: var(--accent);
  background: var(--paper-deep);
  box-shadow: inset 0 0 0 1px var(--accent);
}

.plan-card[aria-checked="true"]::after {
  content: "✓";
  position: absolute;
  top: 13px;
  right: 13px;
  display: grid;
  width: 24px;
  height: 24px;
  place-items: center;
  border-radius: 50%;
  color: white;
  background: var(--accent);
  font-size: 13px;
  font-weight: 800;
}

.plan-period { display: block; padding-right: 28px; font-size: 14px; font-weight: 720; }
.plan-price { display: block; margin-top: 20px; font-family: var(--display); font-size: 29px; font-variant-numeric: tabular-nums; line-height: 1; }
.plan-monthly { display: block; margin-top: 8px; color: var(--muted); font-size: 12px; line-height: 1.35; }
.plan-saving { display: block; margin-top: 8px; color: var(--accent); font-size: 11px; font-weight: 760; }

.trust-note {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-top: 18px;
  padding: 14px 15px;
  border-radius: 14px;
  color: var(--muted);
  background: var(--paper-soft);
  font-size: 12px;
  line-height: 1.5;
}

.trust-note p { margin: 0; }
.trust-note span { color: var(--accent); }

.back-link {
  margin: 2px 0 24px;
  padding: 6px 0;
  border: 0;
  color: var(--muted);
  background: transparent;
  cursor: pointer;
}
.back-link:hover { color: var(--ink); }

.order-card,
.included-card,
.result-card {
  margin-top: 22px;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.78);
  box-shadow: var(--shadow);
}

.order-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; }
.eyebrow { color: var(--accent); font-size: 10px; font-weight: 800; letter-spacing: 0.15em; text-transform: uppercase; }
.order-heading h2 { margin: 7px 0 0; font-size: 18px; }
.order-heading strong { white-space: nowrap; font-family: var(--display); font-size: 28px; font-weight: 500; }

.order-lines { margin: 22px 0 0; }
.order-lines div { display: flex; justify-content: space-between; gap: 20px; padding: 12px 0; border-top: 1px solid var(--line); }
.order-lines dt { color: var(--muted); }
.order-lines dd { margin: 0; text-align: right; font-weight: 650; }

.included-card { box-shadow: none; background: var(--paper-soft); }
.included-card h2 { margin: 0; font-family: var(--display); font-size: 24px; font-weight: 500; }
.included-card ul { margin: 14px 0 0; padding-left: 20px; color: var(--muted); line-height: 1.7; }

.checkout-fields {
  display: grid;
  gap: 8px;
  margin-top: 14px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: var(--paper-soft);
}

.checkout-fields label { margin-top: 4px; font-size: 13px; font-weight: 720; }
.checkout-fields label span { color: var(--muted); font-weight: 500; }
.checkout-fields input {
  width: 100%;
  min-height: 50px;
  padding: 0 14px;
  border: 1px solid var(--line-strong);
  border-radius: 13px;
  color: var(--ink);
  background: var(--paper);
  font: inherit;
}
.checkout-fields input:focus { outline: 3px solid rgba(131, 63, 80, 0.18); border-color: var(--accent); }
.field-note { margin: 4px 0 0; color: var(--muted); font-size: 11px; line-height: 1.45; }
.field-error { margin: -2px 0 4px; color: var(--danger); font-size: 12px; font-weight: 650; }

.sticky-action {
  position: fixed;
  z-index: 10;
  right: 0;
  bottom: 0;
  left: 0;
  padding: 12px max(18px, calc((100vw - 644px) / 2)) max(12px, env(safe-area-inset-bottom));
  border-top: 1px solid var(--line);
  background: var(--paper);
  background: color-mix(in srgb, var(--paper) 92%, transparent);
  -webkit-backdrop-filter: blur(18px);
  backdrop-filter: blur(18px);
}

.sticky-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 9px;
  color: var(--muted);
  font-size: 12px;
}
.sticky-summary strong { color: var(--ink); }

.primary-button,
.secondary-button {
  width: 100%;
  min-height: 54px;
  border-radius: 999px;
  font-weight: 720;
  cursor: pointer;
}

.primary-button { border: 0; color: white; background: var(--button); }
.primary-button:hover { background: var(--button-hover); }
.primary-button:active { transform: translateY(1px); }
.primary-button:disabled { cursor: not-allowed; opacity: 0.45; }
.secondary-button { margin-top: 24px; border: 1px solid var(--line-strong); color: var(--ink); background: transparent; }
.secondary-button:hover { background: var(--paper-soft); }

.processing-screen h1,
.result-screen h1 { max-width: 540px; margin-top: 12px; }
.result-icon { display: grid; width: 70px; height: 70px; margin-bottom: 24px; place-items: center; border-radius: 50%; color: white; background: var(--success); font-size: 32px; }
.error-icon { background: var(--danger); }
.result-card { width: min(100%, 390px); display: flex; justify-content: space-between; gap: 20px; box-shadow: none; }
.result-card span { color: var(--muted); }

@media (max-width: 370px) {
  .app-shell { padding-right: 14px; padding-left: 14px; }
  .plans-grid { grid-template-columns: 1fr; }
  .plan-card { min-height: 126px; }
  h1 { font-size: 38px; }
}

@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
    --paper: #211b1c;
    --paper-soft: #2a2223;
    --paper-deep: #3a2a2f;
    --ink: #fff8f7;
    --muted: #c4b4b6;
    --line: rgba(255, 242, 242, 0.13);
    --line-strong: rgba(255, 242, 242, 0.3);
    --button: #f6e9e9;
    --button-hover: #ffffff;
    --accent: #e7a4b5;
    --shadow: 0 24px 70px rgba(0, 0, 0, 0.26);
  }
}

[data-theme="light"] {
  color-scheme: light;
  --paper: #fffdfc;
  --paper-soft: #fbf5f4;
  --paper-deep: #f5ecea;
  --ink: #282021;
  --muted: #746667;
  --line: rgba(56, 42, 43, 0.15);
  --line-strong: rgba(56, 42, 43, 0.32);
  --button: #2f2526;
  --button-hover: #493b3c;
  --accent: #833f50;
  --shadow: 0 20px 55px rgba(56, 42, 43, 0.10);
}

[data-theme="light"] .plan-card,
[data-theme="light"] .order-card,
[data-theme="light"] .result-card {
  background: rgba(255, 255, 255, 0.78);
}

[data-theme="light"] .primary-button { color: white; }

[data-theme="dark"] {
  color-scheme: dark;
  --paper: #211b1c;
  --paper-soft: #2a2223;
  --paper-deep: #3a2a2f;
  --ink: #fff8f7;
  --muted: #c4b4b6;
  --line: rgba(255, 242, 242, 0.13);
  --line-strong: rgba(255, 242, 242, 0.3);
  --button: #f6e9e9;
  --button-hover: #ffffff;
  --accent: #e7a4b5;
  --shadow: 0 24px 70px rgba(0, 0, 0, 0.26);
}

[data-theme="dark"] .primary-button { color: #241d1e; }
[data-theme="dark"] .plan-card,
[data-theme="dark"] .order-card,
[data-theme="dark"] .result-card {
  background: rgba(48, 38, 40, 0.84);
}
