:root {
  --bg: #f4f6f9;
  --card: #ffffff;
  --ink: #0f172a;
  --muted: #64748b;
  --line: #e2e8f0;
  --accent: #2563eb;
  --accent-dark: #1d4ed8;
  --accent-tint: #eff6ff;
  --danger: #dc2626;
  --radius: 14px;
  --shadow: 0 10px 30px rgba(15, 23, 42, 0.08);
}

* { box-sizing: border-box; }

html, body { margin: 0; padding: 0; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--ink);
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  padding: 20px 16px calc(20px + env(safe-area-inset-bottom));
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

.app {
  width: 100%;
  max-width: 480px;
  background: var(--card);
  border-radius: 20px;
  box-shadow: var(--shadow);
  padding: 18px 18px 24px;
  margin-top: 8px;
}

/* Top bar: progress + back */
.topbar { margin-bottom: 18px; }

.progress {
  height: 8px;
  background: var(--line);
  border-radius: 999px;
  overflow: hidden;
}
.progress-fill {
  height: 100%;
  width: 0%;
  background: var(--accent);
  border-radius: 999px;
  transition: width 0.35s ease;
}

.back {
  appearance: none;
  border: none;
  background: none;
  color: var(--muted);
  font-size: 0.95rem;
  padding: 10px 2px;
  margin-top: 6px;
  cursor: pointer;
  border-radius: 8px;
}
.back:hover { color: var(--ink); }
.back[hidden] { display: none; }

/* Screens */
.screen { display: none; }
.screen.active {
  display: flex;
  flex-direction: column;
  gap: 14px;
  animation: fade 0.25s ease;
}
@keyframes fade {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

.question {
  font-size: 1.5rem;
  line-height: 1.25;
  font-weight: 700;
  margin: 4px 0 2px;
  letter-spacing: -0.01em;
  outline: none;
}

/* S1 personalized greeting — a muted eyebrow line above the heading.
   Filled by JS only when a ?biz= name is present; the screen's flex `gap`
   provides the space below it. `:empty` removes it from layout entirely, so a
   no-biz visit renders exactly as if the element weren't there. */
.s1-greeting {
  margin: 0;
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 600;
}
.s1-greeting:empty { display: none; }

/* Options */
.options { display: flex; flex-direction: column; gap: 10px; }

.option {
  appearance: none;
  width: 100%;
  text-align: left;
  padding: 16px 18px;
  min-height: 58px;
  font-size: 1rem;
  font-weight: 500;
  color: var(--ink);
  background: var(--card);
  border: 1.5px solid var(--line);
  border-radius: var(--radius);
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease, transform 0.05s ease;
}
.option:hover { border-color: var(--accent); background: var(--accent-tint); }
.option:active { transform: scale(0.99); }
.option.selected {
  border-color: var(--accent);
  background: var(--accent-tint);
  box-shadow: inset 0 0 0 1px var(--accent);
}

/* Buttons */
.btn {
  appearance: none;
  width: 100%;
  padding: 15px 18px;
  min-height: 54px;
  font-size: 1rem;
  font-weight: 600;
  border-radius: var(--radius);
  cursor: pointer;
  border: 1.5px solid transparent;
  transition: background 0.15s ease, border-color 0.15s ease, transform 0.05s ease;
}
.btn:active { transform: scale(0.99); }

.primary { background: var(--accent); color: #fff; }
.primary:hover { background: var(--accent-dark); }

.secondary { background: var(--card); color: var(--accent); border-color: var(--line); }
.secondary:hover { border-color: var(--accent); background: var(--accent-tint); }

.continue { background: var(--accent); color: #fff; margin-top: 2px; }
.continue:hover { background: var(--accent-dark); }

/* Anchor rendered as a button (thank-you booking link) — match .btn layout. */
a.btn { display: flex; align-items: center; justify-content: center; text-decoration: none; }

/* Free text */
.freetext {
  width: 100%;
  padding: 14px;
  font: inherit;
  font-size: 1rem;
  color: var(--ink);
  border: 1.5px solid var(--line);
  border-radius: var(--radius);
  resize: vertical;
  min-height: 120px;
}
.freetext:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-tint);
}

/* Form */
.copy { color: var(--muted); font-size: 1rem; margin: 0; }
.form { display: flex; flex-direction: column; gap: 6px; }
.label { font-weight: 600; font-size: 0.9rem; margin-top: 8px; }
.input {
  width: 100%;
  padding: 13px 14px;
  font-size: 16px; /* prevents iOS zoom on focus */
  color: var(--ink);
  border: 1.5px solid var(--line);
  border-radius: var(--radius);
}
.input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-tint);
}

.hint { color: var(--muted); font-size: 0.85rem; margin: 2px 0 0; }
.error { color: var(--danger); font-size: 0.85rem; margin: 4px 0 0; font-weight: 500; }
.error[hidden] { display: none; }

.form .btn { margin-top: 10px; }
.form .primary { margin-top: 18px; }

/* Booking placeholder (thank-you) */
.booking-placeholder {
  margin-top: 10px;
  padding: 22px;
  border: 1.5px dashed var(--line);
  border-radius: var(--radius);
  text-align: center;
}
.muted { color: var(--muted); font-size: 0.9rem; }

/* Keyboard focus visibility */
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

@media (min-width: 520px) {
  .app { padding: 26px 26px 30px; }
  .question { font-size: 1.6rem; }
}
