/* Participant app, built to the smartphone mockups of the PDF (slides 01, 03–05).
   Every size is in mockup units: --u is 1/206.6 of the phone screen width (the
   mockup screen is 206.6 × 354.3 pt), so a real phone shows the same proportions,
   line breaks and spacing as the slides. Colours are the PDF's own. */
:root {
  --bg: #f5f6fa;
  --card: #ffffff;
  --ink: #20223f;
  --muted: #65677c;
  --line: #dde0ea;
  --field: #f5f6fa;
  --mava: #6750ad;
  --afic: #167f98;
  --stable: #24775d;
  --danger: #b3261e;
  --accent: var(--mava);
  font-family: "Poll Sans", Arial, Helvetica, sans-serif;
  color: var(--ink);
  background: var(--bg);
  -webkit-text-size-adjust: 100%;
}

* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); }
body { min-height: 100dvh; display: flex; justify-content: center; }
h1, h2, h3, p, ul { margin: 0; }
button, input { font: inherit; color: inherit; margin: 0; }

/* ---------- Device ---------- */
/* Phone: the app fills the screen. */
.device {
  --u: calc(min(100vw, 480px) / 206.6);
  width: 100%;
  max-width: 480px;
  background: var(--card);
}
.phone { display: flex; flex-direction: column; min-height: 100dvh; background: var(--card); }

/* Desktop: the same screen inside the mockup's phone frame. */
@media (min-width: 560px) and (min-height: 600px) {
  body { align-items: center; padding: 16px; }
  .device {
    --u: min(calc(390px / 206.6), calc((100dvh - 32px) / 367.3));
    position: relative;
    flex: none;
    width: calc(221 * var(--u));
    max-width: none;
    padding: calc(6.5 * var(--u)) calc(7.2 * var(--u));
    border-radius: calc(19.56 * var(--u));
    background: var(--ink);
  }
  .device::before {
    content: "";
    position: absolute;
    z-index: 1;
    top: calc(13 * var(--u));
    left: 50%;
    width: calc(64.1 * var(--u));
    height: calc(5.1 * var(--u));
    transform: translateX(-50%);
    border-radius: 999px;
    background: var(--ink);
  }
  .phone {
    height: calc(354.3 * var(--u));
    min-height: 0;
    border-radius: calc(15 * var(--u));
    overflow-y: auto;
    scrollbar-width: none;
  }
  .phone::-webkit-scrollbar { display: none; }
}

.theme-mava { --accent: var(--mava); }
.theme-afic { --accent: var(--afic); }

/* ---------- Screen ---------- */
.screen {
  flex: 1 0 auto;
  display: flex;
  flex-direction: column;
  padding:
    calc(29.38 * var(--u))
    max(calc(11.7 * var(--u)), env(safe-area-inset-right))
    max(calc(20.9 * var(--u)), env(safe-area-inset-bottom))
    max(calc(11.7 * var(--u)), env(safe-area-inset-left));
}
/* Decision screen: "Rivedi il percorso" sits below the buttons (slide 05). */
.screen.tight { padding-bottom: max(calc(2.72 * var(--u)), env(safe-area-inset-bottom)); }
.screen > form { display: contents; }

.kicker {
  font-size: calc(7.92 * var(--u));
  line-height: calc(9.5 * var(--u));
  font-weight: 700;
  letter-spacing: .0214em;
  text-transform: uppercase;
  color: var(--muted);
}
h1 {
  margin-top: calc(8.42 * var(--u));
  font-size: calc(18.02 * var(--u));
  line-height: calc(21 * var(--u));
  font-weight: 700;
  color: var(--accent);
}
h1.teal { color: var(--afic); }
/* Two lines high; a one-line question sits in the middle, as in the mockups. */
h2 {
  margin-top: calc(9.7 * var(--u));
  min-height: calc(36.06 * var(--u));
  display: flex;
  flex-direction: column;
  justify-content: center;
  font-size: calc(15.15 * var(--u));
  line-height: calc(18.03 * var(--u));
  font-weight: 700;
  letter-spacing: -.0053em;
  color: var(--ink);
}
.sub {
  margin-top: calc(12.33 * var(--u));
  font-size: calc(12.98 * var(--u));
  line-height: calc(15 * var(--u));
  font-weight: 700;
  letter-spacing: -.008em;
  color: var(--accent);
}
.sub.ok {
  margin-top: calc(13.86 * var(--u));
  font-size: calc(13.7 * var(--u));
  letter-spacing: -.0065em;
  color: var(--stable);
}

/* Welcome: the case (slide 03) */
.case {
  list-style: none;
  margin-top: calc(22.33 * var(--u));
  padding: 0;
  display: grid;
  gap: calc(15.6 * var(--u));
  font-size: calc(12.98 * var(--u));
  line-height: calc(15.14 * var(--u));
  letter-spacing: -.0065em;
}
/* Decision text (slide 05) */
.para {
  margin-top: calc(27.34 * var(--u));
  font-size: calc(14.43 * var(--u));
  line-height: calc(17.2 * var(--u));
  letter-spacing: -.0065em;
}
/* Informative text on screens the PDF does not show */
.note {
  margin-top: calc(22.33 * var(--u));
  font-size: calc(12.98 * var(--u));
  line-height: calc(15.14 * var(--u));
  color: var(--muted);
}

/* ---------- Dose field (slides 03–05) ---------- */
.field-label {
  display: block;
  margin-top: calc(20.89 * var(--u));
  font-size: calc(11.55 * var(--u));
  line-height: calc(13 * var(--u));
  letter-spacing: -.0111em;
  color: var(--muted);
}
.field {
  display: block;
  width: 100%;
  height: calc(36.7 * var(--u));
  margin-top: calc(6.62 * var(--u));
  padding: 0 calc(7.75 * var(--u));
  border: calc(.75 * var(--u)) solid var(--line);
  border-radius: calc(6 * var(--u));
  background: var(--field);
  font-size: calc(12.98 * var(--u));
  letter-spacing: -.0066em;
  color: var(--ink);
  outline: none;
  -webkit-appearance: none;
  appearance: none;
}
.field::placeholder { color: var(--muted); opacity: 1; }
.field:focus { border-color: var(--accent); }
.field[aria-invalid="true"] { border-color: var(--danger); }
.error {
  margin-top: calc(4 * var(--u));
  font-size: calc(10.5 * var(--u));
  line-height: calc(12.5 * var(--u));
  color: var(--danger);
}
.error:empty { display: none; }
.notice {
  margin-bottom: calc(9.4 * var(--u));
  font-size: calc(11.55 * var(--u));
  line-height: calc(13 * var(--u));
  color: var(--danger);
}

/* ---------- Buttons ---------- */
.spacer { flex: 1; min-height: calc(7 * var(--u)); }
.actions { display: grid; gap: calc(9.4 * var(--u)); }
.btn {
  display: block;
  width: 100%;
  height: calc(29.5 * var(--u));
  padding: calc(1.46 * var(--u)) calc(4 * var(--u)) 0;
  border: 0;
  border-radius: calc(6.81 * var(--u));
  background: var(--accent);
  color: #fff;
  font-size: calc(11.55 * var(--u));
  line-height: calc(28.04 * var(--u));
  font-weight: 700;
  letter-spacing: -.0119em;
  text-align: center;
  white-space: nowrap;
  cursor: pointer;
}
.btn.mava { background: var(--mava); }
.btn.ok { background: var(--stable); }
.btn.nr { background: var(--muted); }
.btn:active:not(:disabled) { filter: brightness(.94); }
.btn:disabled { opacity: .4; cursor: not-allowed; }
.link {
  display: block;
  width: 100%;
  margin-top: calc(1.28 * var(--u));
  padding: 0;
  border: 0;
  background: none;
  font-size: calc(12.27 * var(--u));
  line-height: calc(14 * var(--u));
  letter-spacing: -.0106em;
  color: var(--muted);
  text-align: center;
  cursor: pointer;
}
.btn:focus-visible, .link:focus-visible, .week:focus-visible, .row-edit:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* ---------- Calendar (slide 04) ---------- */
.cal-label { margin-top: calc(12.54 * var(--u)); }
.weeks {
  width: calc(180 * var(--u));
  margin-top: calc(12.4 * var(--u));
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  column-gap: calc(4.22 * var(--u));
  row-gap: calc(4.93 * var(--u));
}
.week {
  height: calc(23.4 * var(--u));
  padding: 0;
  border: 0;
  border-radius: calc(4.5 * var(--u));
  background: var(--field);
  color: var(--ink);
  font-size: calc(11.55 * var(--u));
  letter-spacing: -.0111em;
  cursor: pointer;
}
.week[aria-pressed="true"] { background: var(--accent); color: #fff; }
.week:disabled { color: rgba(101, 103, 124, .35); cursor: not-allowed; }
.selected {
  margin-top: calc(22.35 * var(--u));
  min-height: calc(14 * var(--u));
  font-size: calc(12.27 * var(--u));
  line-height: calc(14 * var(--u));
  font-weight: 700;
  letter-spacing: -.0108em;
  color: var(--accent);
}

/* ---------- Path review and summary ---------- */
.rows {
  list-style: none;
  margin-top: calc(12 * var(--u));
  padding: 0;
  border-top: calc(.75 * var(--u)) solid var(--line);
}
.row {
  display: flex;
  align-items: baseline;
  gap: calc(6 * var(--u));
  padding: calc(7.5 * var(--u)) 0;
  border-bottom: calc(.75 * var(--u)) solid var(--line);
  font-size: calc(11.55 * var(--u));
  line-height: calc(13 * var(--u));
}
.row-label { flex: 1; min-width: 0; }
.row-dose { font-weight: 700; white-space: nowrap; }
.row-edit {
  padding: 0;
  border: 0;
  background: none;
  font-size: calc(11.55 * var(--u));
  color: var(--muted);
  cursor: pointer;
}
.tag { margin-left: calc(4 * var(--u)); font-size: calc(9.5 * var(--u)); color: var(--stable); }
.tag.nr { color: var(--muted); }
.row-editing { padding-bottom: calc(5 * var(--u)); border-bottom: calc(.75 * var(--u)) solid var(--line); }
.row-form {
  display: flex;
  gap: calc(6 * var(--u));
  padding-top: calc(5 * var(--u));
}
.row-form .field { flex: 1; min-width: 0; height: calc(29.5 * var(--u)); margin: 0; }
.row-form .btn { width: auto; padding-inline: calc(10 * var(--u)); }

.drug-block { margin-top: calc(16 * var(--u)); }
.drug-head { display: flex; align-items: baseline; justify-content: space-between; }
.drug-name {
  font-size: calc(12.98 * var(--u));
  line-height: calc(15 * var(--u));
  font-weight: 700;
  color: var(--accent);
}
.drug-block .rows { margin-top: calc(6 * var(--u)); }

.noscript { padding: 24px; }
