/* =====================================================================
   Nextperience QR Test — guest app
   Mobile first. No external fonts, no CDN, no framework.
   ===================================================================== */

/* ---- Tokens -------------------------------------------------------- */
:root {
  --bg:          #FAFAF8;
  --surface:     #FFFFFF;
  --surface-2:   #F1F3F1;
  --text:        #0F1419;
  --muted:       #5B6670;
  --accent:      #0B8F63;
  --accent-solid:#3DE0A0;
  --accent-on:   #0F1419;
  --border:      #E3E6E3;
  --danger:      #B3261E;
  --shadow-sm:   0 1px 2px rgba(15,20,25,.06), 0 1px 3px rgba(15,20,25,.05);
  --shadow-md:   0 4px 12px rgba(15,20,25,.08);
  --radius:      14px;
  --radius-lg:   20px;
  --banner-h:    84px;
  --maxw:        560px;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg:          #0F1419;
    --surface:     #171E24;
    --surface-2:   #1E262D;
    --text:        #F2F5F4;
    --muted:       #9AA6AE;
    --accent:      #3DE0A0;
    --accent-solid:#3DE0A0;
    --accent-on:   #0F1419;
    --border:      #2A343B;
    --danger:      #FF8A80;
    --shadow-sm:   0 1px 2px rgba(0,0,0,.4);
    --shadow-md:   0 4px 14px rgba(0,0,0,.45);
    color-scheme: dark;
  }
}

/* ---- Reset --------------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }

/* Any element given a `display` below would otherwise ignore [hidden]. */
[hidden] { display: none !important; }

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

body {
  margin: 0;
  /* --banner-h is measured by app.js and already includes the safe-area inset */
  padding-top: var(--banner-h);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
               "Helvetica Neue", Arial, sans-serif;
  font-size: 17px;
  line-height: 1.5;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

img { max-width: 100%; display: block; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--accent); }

h1, h2, h3 { margin: 0; line-height: 1.22; letter-spacing: -0.015em; }
p { margin: 0; }

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

/* ---- Preview banner (fixed, never dismissable) ---------------------- */
.preview-banner {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 100;
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding: 10px 16px;
  padding-top: calc(10px + env(safe-area-inset-top, 0px));
  background: #0F1419;
  color: #EDF2F0;
  border-bottom: 1px solid rgba(61,224,160,.35);
}

.preview-badge {
  flex: none;
  display: inline-block;
  padding: 3px 8px;
  border-radius: 999px;
  background: var(--accent-solid);
  color: #0F1419;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .08em;
  margin-top: 1px;
}

.preview-text {
  font-size: 12.5px;
  line-height: 1.38;
  max-width: 44em;
}

/* ---- Translation hint ---------------------------------------------- */
.translate-hint {
  display: flex;
  align-items: center;
  gap: 8px;
  max-width: var(--maxw);
  margin: 10px auto 0;
  padding: 7px 10px 7px 14px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--muted);
  font-size: 13px;
  width: calc(100% - 32px);
}
.translate-hint span { flex: 1; }
.hint-close {
  flex: none;
  width: 28px; height: 28px;
  border: 0; border-radius: 50%;
  background: transparent;
  color: var(--muted);
  font-size: 20px; line-height: 1;
  cursor: pointer;
}

/* ---- Layout -------------------------------------------------------- */
.app {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 0 16px 48px;
  outline: none;
}

.site-footer {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 24px 16px calc(32px + env(safe-area-inset-bottom, 0px));
  border-top: 1px solid var(--border);
  color: var(--muted);
  font-size: 13px;
  text-align: center;
}
.site-footer p { margin: 0 0 6px; }

.boot { padding: 80px 0; text-align: center; color: var(--muted); }
.boot-spinner {
  width: 28px; height: 28px; margin: 0 auto 14px;
  border: 3px solid var(--border);
  border-top-color: var(--accent-solid);
  border-radius: 50%;
  animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) {
  .boot-spinner { animation-duration: 3s; }
  * { scroll-behavior: auto !important; }
}

/* ---- Top bar ------------------------------------------------------- */
.topbar {
  position: sticky;
  top: var(--banner-h);
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 -16px 12px;
  padding: 8px 8px;
  background: var(--bg);
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}
.topbar h2 {
  flex: 1;
  font-size: 16px;
  font-weight: 600;
  text-align: center;
  padding-right: 44px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.icon-btn {
  flex: none;
  width: 44px; height: 44px;
  display: grid; place-items: center;
  border: 0; border-radius: 12px;
  background: transparent;
  color: var(--text);
  cursor: pointer;
}
.icon-btn:active { background: var(--surface-2); }
.icon-btn svg { width: 22px; height: 22px; }

/* ---- Hero ---------------------------------------------------------- */
.hero { padding: 20px 0 4px; }
.hero .eyebrow {
  font-size: 12px; font-weight: 700; letter-spacing: .1em;
  text-transform: uppercase; color: var(--accent);
  margin-bottom: 8px;
}
.hero h1 { font-size: 27px; font-weight: 700; margin-bottom: 8px; }
.hero p { color: var(--muted); font-size: 15.5px; }

/* ---- Search -------------------------------------------------------- */
.search-wrap { position: relative; margin: 18px 0 8px; }
.search-wrap svg {
  position: absolute; left: 14px; top: 50%; transform: translateY(-50%);
  width: 19px; height: 19px; color: var(--muted); pointer-events: none;
}
.search-input {
  width: 100%;
  height: 50px;
  padding: 0 44px 0 42px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}
.search-input::placeholder { color: var(--muted); }
.search-clear {
  position: absolute; right: 6px; top: 50%; transform: translateY(-50%);
  width: 38px; height: 38px; border: 0; border-radius: 50%;
  background: transparent; color: var(--muted); font-size: 20px; cursor: pointer;
}

/* ---- Section headers ----------------------------------------------- */
.section-head {
  display: flex; align-items: baseline; justify-content: space-between;
  margin: 26px 0 12px;
}
.section-head h2 {
  font-size: 12px; font-weight: 700; letter-spacing: .1em;
  text-transform: uppercase; color: var(--muted);
}
.section-head .count { font-size: 12px; color: var(--muted); }

/* ---- Featured rail ------------------------------------------------- */
.rail {
  display: flex; gap: 12px;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch;
  margin: 0 -16px; padding: 2px 16px 10px;
  scrollbar-width: none;
}
.rail::-webkit-scrollbar { display: none; }

.rail-card {
  flex: 0 0 150px;
  scroll-snap-align: start;
  display: flex; flex-direction: column;
  text-align: left;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  padding: 0; overflow: hidden; cursor: pointer;
}
.rail-thumb { height: 74px; }
.rail-body { padding: 10px 12px 12px; display: flex; flex-direction: column; gap: 6px; flex: 1; }
.rail-title { font-size: 14px; font-weight: 600; line-height: 1.3; flex: 1; }
.rail-price { font-size: 13px; font-weight: 700; color: var(--accent); }

/* ---- Category grid ------------------------------------------------- */
.cat-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}
.cat-card {
  display: flex; flex-direction: column; gap: 10px;
  padding: 14px;
  min-height: 116px;
  text-align: left;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  cursor: pointer;
}
.cat-card:active { transform: scale(.985); }
.cat-icon {
  width: 40px; height: 40px; border-radius: 11px;
  display: grid; place-items: center; color: #fff;
}
.cat-icon svg { width: 21px; height: 21px; }
.cat-name { font-size: 15px; font-weight: 600; line-height: 1.25; flex: 1; }
.cat-count { font-size: 12.5px; color: var(--muted); }

.cat-card.wide {
  grid-column: 1 / -1;
  flex-direction: row; align-items: center; gap: 14px;
  min-height: 0;
}
.cat-card.wide .cat-name { flex: 1; }
.cat-pill {
  font-size: 11px; font-weight: 700; letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--accent-on); background: var(--accent-solid);
  padding: 3px 9px; border-radius: 999px;
}

/* ---- Service rows -------------------------------------------------- */
.service-list { display: flex; flex-direction: column; gap: 10px; }

.service-row {
  display: flex; align-items: center; gap: 13px;
  width: 100%; min-height: 76px;
  padding: 12px 12px 12px 12px;
  text-align: left;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  cursor: pointer;
}
.service-row:active { transform: scale(.99); }
.service-thumb { flex: none; width: 52px; height: 52px; border-radius: 12px; }
.service-main { flex: 1; min-width: 0; }
.service-title { font-size: 15.5px; font-weight: 600; line-height: 1.28; }
.service-sub {
  font-size: 13px; color: var(--muted); margin-top: 2px;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
  overflow: hidden;
}
.service-meta {
  display: flex; align-items: baseline; gap: 7px; margin-top: 6px;
  font-size: 13px;
}
.service-price { font-weight: 700; color: var(--accent); }
.service-unit { color: var(--muted); font-size: 12.5px; }
.chev { flex: none; color: var(--muted); }
.chev svg { width: 18px; height: 18px; }

/* ---- Service detail ------------------------------------------------ */
.detail-hero {
  height: 168px;
  border-radius: var(--radius-lg);
  margin-bottom: 18px;
  position: relative;
  display: grid; place-items: center;
}
.detail-hero svg { width: 54px; height: 54px; color: rgba(255,255,255,.92); }

.detail h1 { font-size: 24px; font-weight: 700; margin-bottom: 6px; }
.detail .lede { color: var(--muted); font-size: 15.5px; margin-bottom: 16px; }

.price-block {
  display: flex; align-items: baseline; gap: 9px;
  padding: 14px 16px; margin-bottom: 18px;
  background: var(--surface-2);
  border-radius: var(--radius);
}
.price-block .amount { font-size: 26px; font-weight: 700; letter-spacing: -.02em; }
.price-block .unit { color: var(--muted); font-size: 14px; }

.detail .body-text { font-size: 15.5px; margin-bottom: 20px; }

.includes { list-style: none; margin: 0 0 24px; padding: 0; display: flex; flex-direction: column; gap: 11px; }
.includes li { display: flex; gap: 11px; font-size: 15px; align-items: flex-start; }
.includes svg { flex: none; width: 19px; height: 19px; color: var(--accent); margin-top: 1px; }

/* ---- Buttons ------------------------------------------------------- */
.btn {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  width: 100%; min-height: 54px;
  padding: 0 20px;
  border: 0; border-radius: var(--radius);
  background: var(--accent-solid); color: var(--accent-on);
  font-size: 17px; font-weight: 650;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
}
.btn:active { transform: scale(.99); }
.btn[disabled] { opacity: .42; cursor: not-allowed; transform: none; }

.btn-secondary {
  background: var(--surface); color: var(--text);
  border: 1px solid var(--border);
}
.btn-ghost {
  background: transparent; color: var(--accent);
  box-shadow: none; min-height: 48px; font-size: 15px; font-weight: 600;
}

/* The button sits on a solid band so body text scrolls cleanly underneath;
   the fade lives above the band, never behind the button itself. */
.sticky-cta {
  position: sticky; bottom: 0; z-index: 5;
  margin: 0 -16px; padding: 10px 16px calc(14px + env(safe-area-inset-bottom, 0px));
  background: var(--bg);
}
.sticky-cta::before {
  content: "";
  position: absolute; left: 0; right: 0; bottom: 100%;
  height: 30px; pointer-events: none;
  background: linear-gradient(to top, var(--bg), transparent);
}

.micro-label {
  margin-top: 9px;
  font-size: 12.5px; color: var(--muted); text-align: center;
}

/* ---- Steps / forms ------------------------------------------------- */
.steps {
  display: flex; align-items: center; gap: 6px;
  font-size: 12px; color: var(--muted); font-weight: 600;
}
.dots { display: flex; gap: 4px; }
.dot { width: 7px; height: 7px; border-radius: 50%; background: var(--border); }
.dot.on { background: var(--accent-solid); }

.form-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: var(--shadow-sm);
  margin-bottom: 16px;
}

.field { margin-bottom: 16px; }
.field:last-child { margin-bottom: 0; }
.field label {
  display: block;
  font-size: 13px; font-weight: 600; color: var(--muted);
  margin-bottom: 7px;
}
.field .optional { font-weight: 400; }

.input, .textarea, select.input {
  width: 100%;
  min-height: 50px;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--bg);
}
.textarea { min-height: 88px; resize: vertical; }
.input:focus, .textarea:focus { border-color: var(--accent-solid); }
.input.invalid { border-color: var(--danger); }

.field-error { font-size: 13px; color: var(--danger); margin-top: 6px; }

/* Stepper */
.stepper { display: flex; align-items: center; gap: 14px; }
.stepper button {
  width: 48px; height: 48px; flex: none;
  border: 1px solid var(--border); border-radius: 12px;
  background: var(--bg); font-size: 22px; line-height: 1; cursor: pointer;
}
.stepper button[disabled] { opacity: .35; }
.stepper .value { font-size: 19px; font-weight: 700; min-width: 2.2em; text-align: center; }
.stepper .qty-label { color: var(--muted); font-size: 14px; }

/* ---- Summary ------------------------------------------------------- */
.summary-card {
  border: 1px solid var(--border); border-radius: var(--radius);
  background: var(--surface); box-shadow: var(--shadow-sm);
  overflow: hidden; margin-bottom: 18px;
}
.summary-row {
  display: flex; justify-content: space-between; gap: 16px;
  padding: 13px 16px;
  border-bottom: 1px solid var(--border);
  font-size: 15px;
}
.summary-row .k { color: var(--muted); flex: none; }
.summary-row .v { text-align: right; font-weight: 550; }
.summary-total {
  display: flex; justify-content: space-between; align-items: baseline;
  padding: 16px; background: var(--surface-2);
  font-size: 15px;
}
.summary-total .amount { font-size: 22px; font-weight: 700; }
.summary-total .calc { display: block; font-size: 12.5px; color: var(--muted); font-weight: 400; }

/* ---- Reveal / survey ----------------------------------------------- */
.reveal-head { text-align: center; padding: 28px 0 6px; }
.reveal-mark {
  width: 62px; height: 62px; margin: 0 auto 18px;
  border-radius: 50%;
  display: grid; place-items: center;
  background: var(--accent-solid); color: var(--accent-on);
}
.reveal-mark svg { width: 30px; height: 30px; }
.reveal-head h1 { font-size: 25px; font-weight: 700; margin-bottom: 12px; }
.reveal-head p { color: var(--muted); font-size: 15.5px; margin-bottom: 10px; }

.survey-q { margin-bottom: 22px; }
.survey-q .q-label {
  display: block; font-size: 15.5px; font-weight: 600; margin-bottom: 11px;
}
.survey-q .q-label .req { color: var(--accent); }
.choices { display: flex; flex-direction: column; gap: 8px; }
.choice {
  display: flex; align-items: center; gap: 12px;
  padding: 13px 15px;
  border: 1px solid var(--border); border-radius: 12px;
  background: var(--surface); cursor: pointer;
  font-size: 15px;
}
.choice input { flex: none; width: 20px; height: 20px; accent-color: var(--accent-solid); margin: 0; }
.choice.on {
  border-color: var(--accent-solid);
  background: var(--surface-2);
  background: color-mix(in srgb, var(--accent-solid) 10%, var(--surface));
}

/* ---- Practical ----------------------------------------------------- */
.info-card {
  border: 1px solid var(--border); border-radius: var(--radius);
  background: var(--surface); box-shadow: var(--shadow-sm);
  padding: 16px; margin-bottom: 12px;
}
.info-card h3 { font-size: 16px; font-weight: 650; margin-bottom: 8px; }
.info-card p { font-size: 14px; color: var(--muted); margin-bottom: 12px; }
.info-card p:last-child { margin-bottom: 0; }
.emergency-list { list-style: none; margin: 0 0 12px; padding: 0; }
.emergency-list li {
  display: flex; justify-content: space-between; gap: 12px;
  padding: 9px 0; border-bottom: 1px solid var(--border);
  font-size: 14.5px;
}
.emergency-list li:last-child { border-bottom: 0; }
.emergency-list a { font-weight: 700; text-decoration: none; }

/* ---- Misc ---------------------------------------------------------- */
.empty {
  text-align: center; color: var(--muted);
  padding: 44px 20px; font-size: 15px;
}
.notice {
  display: flex; gap: 10px; align-items: flex-start;
  padding: 12px 14px; border-radius: 12px;
  background: var(--surface-2); color: var(--muted);
  font-size: 13.5px; margin-bottom: 16px;
}
.notice svg { flex: none; width: 17px; height: 17px; margin-top: 2px; }

.free-tag {
  font-size: 11px; font-weight: 700; letter-spacing: .06em;
  text-transform: uppercase; color: var(--accent-on);
  background: var(--accent-solid); padding: 2px 7px; border-radius: 999px;
}

.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;
}

/* ---- Wider screens ------------------------------------------------- */
@media (min-width: 640px) {
  .hero h1 { font-size: 31px; }
  .cat-grid { grid-template-columns: repeat(3, 1fr); }
  .cat-card.wide { grid-column: 1 / -1; }
  .detail-hero { height: 210px; }
}
