:root {
  --accent: #7c5a66;
  --dusky-pink: #cfadaf;
  --grouped-bg: #f2f2f7;
  --row-bg: #ffffff;
  --label: #000000;
  --secondary: rgba(60, 60, 67, 0.6);
  --separator: rgba(60, 60, 67, 0.29);
  --mild: #ffcc00;
  --moderate: #ff9500;
  --severe: #ff3b30;
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Helvetica Neue", Helvetica, Roboto, Arial, sans-serif;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
[hidden] { display: none !important; }
html, body { margin: 0; min-height: 100%; }
body {
  font-family: var(--font);
  font-size: 17px;
  line-height: 1.3;
  color: var(--label);
  background: var(--dusky-pink);
  -webkit-font-smoothing: antialiased;
  -webkit-text-size-adjust: 100%;
}
.backdrop {
  position: fixed;
  inset: 0;
  background: var(--dusky-pink) url("../img/bg-phone.jpg") center top / cover no-repeat;
  z-index: 0;
}
button { font: inherit; color: inherit; }

/* ---------- Sheet ---------- */
.sheet {
  position: relative;
  z-index: 1;
  margin-top: calc(var(--safe-top) + 52px);
  min-height: calc(100vh - var(--safe-top) - 52px);
  background: var(--grouped-bg);
  border-radius: 14px 14px 0 0;
  box-shadow: 0 -2px 24px rgba(0, 0, 0, 0.18);
  overflow: hidden;
}
.sheet::before {
  /* grabber */
  content: "";
  position: absolute;
  top: 6px;
  left: 50%;
  width: 36px;
  height: 5px;
  margin-left: -18px;
  border-radius: 3px;
  background: rgba(60, 60, 67, 0.3);
  z-index: 3;
}
.navbar {
  position: sticky;
  top: 0;
  z-index: 2;
  display: grid;
  /* The buttons always keep their full width; a long title (French, German) shortens instead. */
  grid-template-columns: minmax(max-content, 1fr) minmax(0, auto) minmax(max-content, 1fr);
  align-items: center;
  gap: 8px;
  padding: 18px 16px 10px;
  background: rgba(249, 249, 249, 0.94);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  backdrop-filter: saturate(180%) blur(20px);
  border-bottom: 0.5px solid var(--separator);
}
.navbar h1, .navbar .nav-title {
  margin: 0;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  font-size: 17px;
  font-weight: 600;
  text-align: center;
  white-space: nowrap;
}
@media (max-width: 400px) { .navbar h1, .navbar .nav-title { font-size: 16px; } }
.navbar .pill:last-child { justify-self: end; }
.pill {
  white-space: nowrap;
  touch-action: manipulation;
  appearance: none;
  border: 0;
  padding: 6px 8px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.3);
  color: var(--accent);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}
.pill:active { opacity: 0.6; }
.pill.busy { opacity: 0.5; pointer-events: none; }

.list { padding: 8px 16px calc(40px + var(--safe-bottom)); }

/* Info card (InfoSheetCard) */
.info-card {
  background: var(--row-bg);
  border-radius: 10px;
  padding: 11px 16px;
  margin: 8px 0 22px;
}
.info-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
  width: 100%;
  padding: 0;
  border: 0;
  background: none;
  text-align: left;
  cursor: pointer;
}
.info-title { font-size: 17px; font-weight: 600; }
.info-icons { display: inline-flex; gap: 6px; align-items: center; color: rgba(0, 0, 0, 0.75); padding-top: 2px; }
.info-icons .tap { color: rgba(0, 0, 0, 0.35); transition: transform 0.25s ease; }
.info-card.open .info-icons .tap { transform: rotate(90deg); }
.info-body { display: none; margin-top: 10px; }
.info-card.open .info-body { display: block; }
.info-body p { margin: 0 0 10px; font-size: 17px; line-height: 1.35; }
.info-body p:last-child { margin-bottom: 2px; }

/* Grouped sections */
.group { margin: 0 0 26px; }
.group-title {
  margin: 0 0 7px;
  padding: 0 0 0 0;
  font-size: 17px;
  font-weight: 600;
  color: var(--accent);
}
.rows {
  list-style: none;
  margin: 0;
  padding: 0;
  background: var(--row-bg);
  border-radius: 10px;
  overflow: hidden;
}
.row {
  touch-action: manipulation;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 44px;
  padding: 11px 16px;
  cursor: pointer;
  user-select: none;
  -webkit-user-select: none;
}
.row + .row { border-top: 0.5px solid var(--separator); }
.row + .row { margin-left: 16px; padding-left: 0; }
.row:active { background: rgba(0, 0, 0, 0.05); }
.row .name { flex: 1 1 auto; }
.row .state { display: inline-flex; align-items: center; gap: 6px; flex: 0 0 auto; }
.row .sev { display: none; align-items: center; gap: 6px; font-size: 13px; color: var(--secondary); }
.row .dot { width: 10px; height: 10px; border-radius: 50%; background: transparent; }
.row[data-severity="1"] .sev, .row[data-severity="2"] .sev, .row[data-severity="3"] .sev { display: inline-flex; }
.row[data-severity="1"] .dot { background: var(--mild); }
.row[data-severity="2"] .dot { background: var(--moderate); }
.row[data-severity="3"] .dot { background: var(--severe); }
.row .check { display: none; color: var(--accent); }
.row.all-good.selected .check { display: block; }

.footnote { margin: 0; text-align: center; font-size: 13px; color: var(--secondary); }

/* ---------- Code screen ---------- */
.done {
  position: relative;
  z-index: 1;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: calc(var(--safe-top) + 24px) 18px calc(var(--safe-bottom) + 24px);
}
.done-card {
  width: 100%;
  max-width: 420px;
  padding: 26px 22px 20px;
  border-radius: 26px;
  background: rgba(68, 35, 69, 0.34); /* aubergine glass: white text on it passes AA */
  border: 1px solid rgba(255, 255, 255, 0.25);
  box-shadow: 0 10px 18px rgba(0, 0, 0, 0.16);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
  color: #fff;
  text-align: center;
}
.app-icon { display: block; margin: 0 auto 14px; border-radius: 16px; box-shadow: 0 6px 14px rgba(0, 0, 0, 0.18); }
.done h1, .done .done-title { margin: 0 0 6px; font-size: 28px; font-weight: 300; letter-spacing: 0.02em; text-transform: uppercase; }
.done .lead { margin: 0 0 22px; font-size: 17px; }
.code-label { margin: 0 0 6px; font-size: 13px; font-weight: 600; letter-spacing: 1.5px; text-transform: uppercase; opacity: 0.9; }
.code {
  margin: 0 auto 10px;
  padding: 14px 10px;
  max-width: 300px;
  border-radius: 18px;
  background: rgba(86, 41, 56, 0.35);
  font-size: 44px;
  font-weight: 600;
  letter-spacing: 0.22em;
  text-indent: 0.22em;
  font-variant-numeric: tabular-nums;
}
.hint { margin: 0 0 6px; font-size: 15px; font-weight: 600; }
.note { margin: 0 0 22px; font-size: 14px; line-height: 1.4; opacity: 0.92; }
.btn {
  display: block;
  width: 100%;
  padding: 14px 16px;
  margin: 0 0 10px;
  border-radius: 999px;
  font-size: 17px;
  font-weight: 600;
  text-decoration: none;
  text-align: center;
}
.btn.primary { background: var(--accent); color: #fff; }
.btn.secondary { background: rgba(255, 255, 255, 0.3); color: #fff; }
.btn:active { opacity: 0.7; }
.privacy { margin: 14px 0 6px; font-size: 12px; opacity: 0.8; }
.link { appearance: none; border: 0; background: none; padding: 8px; font-size: 13px; color: #fff; text-decoration: underline; opacity: 0.85; cursor: pointer; }

/* ---------- Toast ---------- */
.toast {
  position: fixed;
  left: 50%;
  bottom: calc(var(--safe-bottom) + 28px);
  transform: translateX(-50%);
  z-index: 10;
  max-width: 86vw;
  padding: 12px 18px;
  border-radius: 999px;
  background: rgba(30, 20, 26, 0.9);
  color: #fff;
  font-size: 15px;
  text-align: center;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.25);
}

@media (min-width: 600px) {
  .sheet { max-width: 520px; margin-left: auto; margin-right: auto; }
}

/* Brand block at the top of the thank-you card */
.wordmark { margin: 0; font-size: 30px; font-weight: 300; letter-spacing: 0.32em; text-indent: 0.32em; line-height: 1.1; }
.tagline { margin: 2px 0 20px; font-size: 13px; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; opacity: 0.85; }
.done h1, .done .done-title { font-size: 22px; text-transform: none; letter-spacing: 0; font-weight: 600; }
.cta-note { margin: 16px 0 8px; font-size: 14px; line-height: 1.4; opacity: 0.95; }
.note { margin-bottom: 4px; }

/* Logo replaces the text wordmark on the thank-you and checker cards */
.logo { display: block; width: 176px; height: auto; margin: 4px auto 0; }
.tagline { margin-top: 8px; }

/* ---------- About you: the age range row (required) ---------- */
.age-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 44px; padding: 6px 16px; cursor: pointer; }
.age-row .name { flex: 1 1 auto; }
.age-value { position: relative; display: inline-flex; align-items: center; gap: 6px; color: var(--secondary); }
.age-row.chosen .age-value { color: var(--accent); font-weight: 600; }
.age-value select {
  appearance: none; -webkit-appearance: none; border: 0; background: transparent; color: inherit;
  font: inherit; font-size: 17px; text-align: right; text-align-last: right; padding: 8px 0; cursor: pointer; max-width: 60vw;
}
.age-value select:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 6px; }
.age-row.needs { box-shadow: 0 0 0 2px var(--severe); animation: nudge 0.5s ease 2; }
.age-help { margin: 7px 2px 0; font-size: 13px; color: var(--severe); }
@keyframes nudge { 0%, 100% { transform: translateX(0); } 25% { transform: translateX(-4px); } 75% { transform: translateX(4px); } }
@media (prefers-reduced-motion: reduce) { .age-row.needs { animation: none; } }

.tester-badge { margin: 8px 0 0; padding: 8px 12px; border-radius: 10px; background: #fff4d6; color: #7a5a00; font-size: 13px; font-weight: 600; text-align: center; }
.done-bottom { margin: 22px 0 0; }
.btn.busy { opacity: 0.5; pointer-events: none; }

/* ---------- Language chips (EN DE FR IT ES) ---------- */
.lang-chips { display: flex; flex-wrap: wrap; gap: 4px; }
.lang-chip {
  display: inline-block;
  min-width: 34px;
  padding: 6px 7px;
  border: 1px solid rgba(255, 255, 255, 0.28);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  font: 600 12px/1.1 var(--font);
  letter-spacing: 0.04em;
  text-align: center;
  text-decoration: none;
  touch-action: manipulation;
}
.lang-chip:hover { background: rgba(255, 255, 255, 0.22); }
.lang-chip:focus-visible { outline: 2px solid #e0dad2; outline-offset: 2px; }
.lang-chip.on { background: #e0dad2; border-color: #e0dad2; color: #442345; }
/* A show's phone page: the chips sit in the band above the card (and above the thank-you card). */
.stand-langs { position: absolute; z-index: 2; top: calc(var(--safe-top) + 10px); left: 0; right: 0; display: flex; justify-content: center; }
.stand-langs ~ .done { padding-top: calc(var(--safe-top) + 56px); }
