/* ---------- Brand tokens ---------- */
:root {
  --cream: #FDFAF5;
  --rose: #C47A8A;
  --yellow: #F5D06A;
  --ink: #241318;           /* dark plum, passes contrast on cream */
  --ink-soft: #5A4650;      /* muted body text */
  --line: rgba(36, 19, 24, 0.12);
  --shadow: 0 12px 30px rgba(36, 19, 24, 0.12);

  --font-head: "Playfair Display", Georgia, serif;
  --font-body: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;

  color-scheme: light;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--cream);
  color: var(--ink);
  font-family: var(--font-body);
  -webkit-font-smoothing: antialiased;
  height: 100%;
}

body {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}

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

button {
  font-family: inherit;
  cursor: pointer;
}

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

/* ---------- Progress bar ---------- */
.progress-wrap {
  position: sticky;
  top: 0;
  z-index: 20;
  background: var(--cream);
  padding: 14px 20px 8px;
}

.progress-track {
  width: 100%;
  height: 4px;
  background: var(--line);
  border-radius: 4px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  width: 0%;
  background: var(--rose);
  transition: width 0.35s ease;
}

.progress-label {
  margin: 8px 0 0;
  font-size: 12px;
  letter-spacing: 0.02em;
  color: var(--ink-soft);
  text-transform: uppercase;
}

/* ---------- App / screens ---------- */
#app {
  flex: 1;
  position: relative;
}

.screen {
  display: none;
  min-height: calc(100dvh - 0px);
  align-items: center;
  padding: 32px 20px 56px;
}

.screen.active {
  display: flex;
  animation: fadeIn 0.28s ease;
}

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

.screen-inner {
  max-width: 480px;
  margin: 0 auto;
  width: 100%;
}

.screen-inner.center {
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

/* ---------- Typography ---------- */
.headline {
  font-family: var(--font-head);
  font-weight: 700;
  font-size: clamp(28px, 7vw, 40px);
  line-height: 1.15;
  margin: 4px 0 12px;
}

.subhead {
  font-size: 17px;
  line-height: 1.5;
  color: var(--ink-soft);
  margin: 0 0 28px;
  max-width: 38ch;
}

.q-text {
  font-family: var(--font-head);
  font-weight: 600;
  font-size: clamp(22px, 6vw, 28px);
  line-height: 1.3;
  margin: 12px 0 28px;
}

.body-copy {
  font-size: 16px;
  line-height: 1.6;
  color: var(--ink-soft);
  margin: 0 0 16px;
  max-width: 40ch;
}

.micro {
  font-size: 13px;
  color: var(--ink-soft);
  margin: 14px 0 0;
}

.logo { margin-bottom: 28px; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-block;
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 16px;
  padding: 16px 28px;
  border-radius: 999px;
  border: none;
  text-decoration: none;
  text-align: center;
  width: 100%;
  max-width: 340px;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.btn:active { transform: scale(0.97); }

.btn-primary {
  background: var(--rose);
  color: var(--cream);
  box-shadow: var(--shadow);
}

.btn-secondary {
  background: transparent;
  color: var(--ink);
  border: 1.5px solid var(--line);
  margin-top: 12px;
}

/* ---------- Question options ---------- */
.options {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.option {
  background: #fff;
  border: 1.5px solid var(--line);
  border-radius: 16px;
  padding: 16px 18px;
  font-size: 16px;
  text-align: left;
  color: var(--ink);
  transition: border-color 0.15s ease, background 0.15s ease;
}

.option:active,
.option:focus-visible {
  border-color: var(--rose);
  background: #fff6f2;
  outline: none;
}

/* ---------- Q4 guess input ---------- */
.guess-input-wrap {
  margin-bottom: 28px;
}

.guess-input {
  width: 100%;
  font-family: var(--font-head);
  font-size: 32px;
  font-weight: 700;
  padding: 12px 0;
  border: none;
  border-bottom: 2px solid var(--line);
  background: transparent;
  color: var(--ink);
  margin-bottom: 20px;
}

.guess-input:focus { outline: none; border-bottom-color: var(--rose); }

.guess-slider {
  width: 100%;
  accent-color: var(--rose);
}

/* ---------- Interrupt: fake iOS notification ---------- */
.interrupt-stage {
  position: relative;
  min-height: 60vh;
  justify-content: center;
}

.interrupt-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(20, 10, 14, 0.55);
  backdrop-filter: blur(2px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
  z-index: 30;
}

.interrupt-backdrop.visible { opacity: 1; }

.ios-notification {
  position: fixed;
  top: 54px;
  left: 12px;
  right: 12px;
  max-width: 420px;
  margin: 0 auto;
  background: rgba(250, 250, 250, 0.92);
  backdrop-filter: blur(20px) saturate(180%);
  border-radius: 20px;
  box-shadow: 0 10px 40px rgba(0,0,0,0.25);
  padding: 12px 14px 10px;
  z-index: 40;
  transform: translateY(-140%);
  transition: transform 0.4s cubic-bezier(0.34, 1.2, 0.4, 1);
  font-family: var(--font-body);
}

.ios-notification.visible {
  transform: translateY(0);
}

.ios-notification-row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
}

.ios-notification-icon {
  width: 36px;
  height: 36px;
  border-radius: 9px;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.ios-notification-icon img { width: 100%; height: 100%; }

.ios-notification-body {
  flex: 1;
  min-width: 0;
}

.ios-notification-title {
  font-weight: 700;
  font-size: 14.5px;
  color: #1c1c1e;
  margin: 0 0 2px;
}

.ios-notification-subtitle {
  font-size: 13px;
  color: #6b6b70;
  margin: 0;
  line-height: 1.35;
}

.ios-notification-dismiss {
  align-self: center;
  background: rgba(120,120,128,0.16);
  color: #1c1c1e;
  border: none;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  padding: 6px 12px;
  flex-shrink: 0;
  transition: opacity 0.2s ease;
}

.ios-notification-dismiss:disabled {
  opacity: 0.4;
  pointer-events: none;
}

/* Subtle Instagram-Story-style countdown bar, native to the notification chrome */
.ios-notification-timer {
  margin-top: 9px;
  height: 3px;
  border-radius: 3px;
  background: rgba(120, 120, 128, 0.2);
  overflow: hidden;
}

.ios-notification-timer-fill {
  height: 100%;
  width: 100%;
  background: rgba(120, 120, 128, 0.55);
}

.interrupt-reveal {
  position: relative;
  z-index: 35;
  text-align: center;
  opacity: 0;
  transition: opacity 0.4s ease;
}

.interrupt-reveal.visible { opacity: 1; }

.interrupt-reveal[hidden] { display: none; }

/* Pivot copy: three stacked blocks, "Petal fixes this." is the visual peak */
.pivot-headline {
  font-family: var(--font-head);
  font-weight: 700;
  font-size: clamp(20px, 5.5vw, 26px);
  line-height: 1.2;
  margin: 0 0 4px;
  color: var(--ink);
}

.pivot-punchline {
  font-family: var(--font-head);
  font-weight: 700;
  font-size: clamp(34px, 10vw, 52px);
  line-height: 1.1;
  color: var(--rose);
  margin: 20px 0;
}

.pivot-body {
  font-family: var(--font-body);
  font-weight: 400;
  font-size: clamp(14px, 3.8vw, 16px);
  line-height: 1.5;
  color: var(--ink-soft);
  max-width: 34ch;
  margin: 0 auto 24px;
}

/* ---------- Result screen ---------- */
.result-gotcha {
  font-size: 15px;
  color: var(--ink-soft);
  margin: 0 0 22px;
  line-height: 1.6;
}

.result-score-block { margin-bottom: 8px; }

.result-score {
  font-family: var(--font-head);
  font-weight: 700;
  font-size: clamp(36px, 10vw, 52px);
  margin: 0;
  color: var(--rose);
}

.result-percentile {
  font-size: 14px;
  color: var(--ink-soft);
  margin: 4px 0 24px;
}

.result-closing { font-style: italic; }

.result-cta-line { margin-top: 8px; }

#btn-get-petal { margin-top: 8px; }

/* ---------- Motion preference ---------- */
@media (prefers-reduced-motion: reduce) {
  .screen.active,
  .ios-notification,
  .ios-notification-timer-fill,
  .interrupt-backdrop,
  .interrupt-reveal,
  .progress-fill {
    transition: none;
    animation: none;
  }
}

/* ---------- Larger screens ---------- */
@media (min-width: 640px) {
  .screen { padding: 48px 24px 72px; }
  .options { gap: 14px; }
}

/* ---------- Short viewports (e.g. iPhone SE): keep pivot copy + CTA on-screen ---------- */
@media (max-height: 700px) {
  #screen-interrupt { padding: 18px 20px 24px; }
  .interrupt-stage { min-height: 48vh; }
  .pivot-headline { font-size: clamp(18px, 5vw, 22px); }
  .pivot-punchline { margin: 12px 0; font-size: clamp(28px, 8.5vw, 38px); }
  .pivot-body { margin-bottom: 16px; }
  #btn-continue-test { padding: 13px 24px; }
}
