:root {
  /* Concept : papier de courrier par avion. Liseré rouge et bleu, très grandes cibles tactiles,
     la lettre traduite en serif sur une page blanche, l'interface en sans-serif lisible pour tous les âges. */
  --bg: #F4F6FA;
  --surface: #FFFFFF;
  --ink: #16213A;
  --muted: #515C75;
  --line: #CFD6E3;
  --blue: #1F4E9C;
  --on-blue: #FFFFFF;
  --red: #C8372D;
  --soft: #E6ECF8;
  --ok: #17673F;
  --f-ui: 'Be Vietnam Pro', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --f-letter: 'Source Serif 4', Georgia, 'Times New Roman', serif;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0F1524; --surface: #18203A; --ink: #EEF1F8; --muted: #A3AEC6; --line: #2C3656;
    --blue: #7FA6EE; --on-blue: #0F1524; --red: #E5645A; --soft: #22305A; --ok: #6FD3A0;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0F1524; --surface: #18203A; --ink: #EEF1F8; --muted: #A3AEC6; --line: #2C3656;
  --blue: #7FA6EE; --on-blue: #0F1524; --red: #E5645A; --soft: #22305A; --ok: #6FD3A0;
  color-scheme: dark;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--f-ui);
  font-size: 18px;
  line-height: 1.55;
  padding-inline: 16px;
  padding-block: 0 48px;
}
.wrap { max-width: 720px; margin-inline: auto; display: flex; flex-direction: column; gap: 20px; }

.air {
  height: 10px;
  background: repeating-linear-gradient(135deg,
    var(--red) 0 14px, var(--surface) 14px 22px, var(--blue) 22px 36px, var(--surface) 36px 44px);
}
.top { padding-top: 20px; display: flex; flex-direction: column; gap: 10px; }
h1 { font-size: 2rem; line-height: 1.15; margin: 8px 0 0; letter-spacing: -0.01em; text-wrap: balance; }
.tag { margin: 0; color: var(--muted); max-width: 52ch; }
h2 { font-size: 1.4rem; line-height: 1.25; margin: 0; text-wrap: balance; }
h3 { font-size: 1.05rem; margin: 0; }
p { margin: 0; }

.proto {
  background: var(--soft);
  border-radius: 10px;
  padding: 12px 16px;
  font-size: 0.9rem;
  color: var(--ink);
}

.paths { display: flex; flex-direction: column; gap: 14px; }
.path {
  font: inherit;
  text-align: left;
  color: var(--ink);
  background: var(--surface);
  border: 2px solid var(--line);
  border-radius: 12px;
  padding: 20px;
  min-height: 96px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  cursor: pointer;
}
.path:hover { border-color: var(--blue); }
.path-t { font-weight: 700; font-size: 1.15rem; }
.path-s { color: var(--muted); font-size: 0.95rem; }

.back {
  align-self: flex-start;
  font: inherit;
  background: none;
  border: 0;
  color: var(--blue);
  font-weight: 600;
  padding: 10px 4px;
  min-height: 48px;
  cursor: pointer;
}

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}
.hint { color: var(--muted); font-size: 0.92rem; }

fieldset { border: 0; padding: 0; margin: 0; min-width: 0; display: flex; flex-direction: column; gap: 10px; }
legend { font-weight: 600; padding: 0; margin-bottom: 10px; }
.choices { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; }
.choices input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.choices label {
  display: flex; align-items: center; justify-content: center; text-align: center;
  min-height: 56px; padding: 8px 12px;
  border: 2px solid var(--line); border-radius: 10px;
  background: var(--surface); cursor: pointer; font-weight: 500;
}
.choices label:hover { border-color: var(--blue); }
.choices input:checked + label { background: var(--blue); border-color: var(--blue); color: var(--on-blue); font-weight: 600; }
.choices input:focus-visible + label { outline: 3px solid var(--blue); outline-offset: 2px; }

details.sib { border: 1px solid var(--line); border-radius: 10px; padding: 0 16px; }
details.sib summary { min-height: 52px; display: flex; align-items: center; cursor: pointer; font-weight: 600; }
details.sib[open] summary { border-bottom: 1px solid var(--line); margin-bottom: 14px; }
.sib-body { display: flex; flex-direction: column; gap: 14px; padding-bottom: 16px; }
.sib-row { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; padding-bottom: 14px; border-bottom: 1px dashed var(--line); }
.sib-row .full { grid-column: 1 / -1; }
.sib-row .rm { grid-column: 1 / -1; justify-self: start; }

label.field { display: flex; flex-direction: column; gap: 6px; font-weight: 600; }
input[type="text"], input[type="email"], textarea, select {
  font: inherit; color: var(--ink); background: var(--surface);
  border: 2px solid var(--line); border-radius: 10px;
  padding: 12px 14px; min-height: 52px; width: 100%; min-width: 0;
}
textarea { min-height: 220px; resize: vertical; line-height: 1.6; }
input:focus-visible, textarea:focus-visible, select:focus-visible, .btn:focus-visible, .path:focus-visible, .back:focus-visible, summary:focus-visible, .linkbtn:focus-visible {
  outline: 3px solid var(--blue); outline-offset: 2px;
}
.fields { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 16px; }

.btn {
  font: inherit; font-weight: 600;
  min-height: 56px; padding: 0 22px;
  border-radius: 10px; border: 2px solid var(--blue);
  background: var(--blue); color: var(--on-blue);
  cursor: pointer; display: inline-flex; align-items: center; justify-content: center; text-align: center;
}
.btn.ghost { background: var(--surface); color: var(--blue); }
.btn.small { min-height: 44px; padding: 0 14px; font-size: 0.95rem; }
.btn[disabled] { opacity: 0.6; cursor: progress; }
.actions { display: flex; flex-wrap: wrap; gap: 12px; }

.photo-row { display: flex; flex-direction: column; gap: 12px; }
.photo-row input[type="file"] { position: absolute; opacity: 0; width: 1px; height: 1px; }
.photo-row label.btn { align-self: flex-start; }
.photo-row label.is-busy { opacity: 0.6; pointer-events: none; }
.load-row { margin-bottom: 4px; }
.pages { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 12px; }
.pg { display: flex; gap: 14px; align-items: center; border: 1px solid var(--line); border-radius: 10px; padding: 10px; }
.pg img { width: 88px; height: 112px; object-fit: cover; border-radius: 6px; border: 1px solid var(--line); flex: none; background: var(--surface); }
.pg-side { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.pg-acts { display: flex; flex-wrap: wrap; gap: 8px; }
.pg-acts .btn[disabled] { cursor: not-allowed; }

.error { color: var(--red); font-weight: 600; }
.ok { color: var(--ok); font-weight: 600; }
.wait { background: #eef3fb; border-left: 4px solid var(--blue, #1F4E9C); border-radius: 8px; padding: 12px 14px; font-size: 1rem; line-height: 1.45; margin: 0; }
.wait[hidden] { display: none; }
.wait-line { display: flex; justify-content: space-between; gap: 12px; font-weight: 600; }
.bar { height: 10px; background: #d5deee; border-radius: 6px; overflow: hidden; margin: 8px 0; }
.bar i { display: block; height: 100%; width: 0; background: var(--blue, #1F4E9C); border-radius: 6px; transition: width 0.3s linear; }
.wait-n { font-size: 0.92rem; color: var(--muted, #555); }

.result { display: flex; flex-direction: column; gap: 16px; }
.letter {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 0 0 4px;
  overflow: hidden;
}
.letter .air { height: 8px; }
.letter .lbl { font-size: 0.8rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); padding: 16px 22px 0; }
.letter .body {
  font-family: var(--f-letter);
  font-size: 1.2rem;
  line-height: 1.75;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  padding: 10px 22px 22px;
  max-width: 62ch;
}
.note { background: var(--soft); border-radius: 10px; padding: 14px 16px; font-size: 0.95rem; }
.mail { display: grid; grid-template-columns: auto 1fr; gap: 6px 14px; font-size: 0.95rem; }
.mail dt { color: var(--muted); }
.mail dd { margin: 0; overflow-wrap: anywhere; font-weight: 500; }
.linkbtn { font: inherit; background: none; border: 0; padding: 10px 0; min-height: 44px; color: var(--blue); font-weight: 600; text-decoration: underline; cursor: pointer; align-self: flex-start; }
.foot { color: var(--muted); font-size: 0.85rem; padding-top: 8px; }

@media (max-width: 420px) {
  body { font-size: 17px; }
  .sib-row { grid-template-columns: 1fr; }
}
@media (prefers-reduced-motion: reduce) { * { scroll-behavior: auto !important; } }

/* Ajouts de la version réelle */
.notes { display: flex; flex-direction: column; gap: 8px; }
.code-card { max-width: 560px; }
.foot a { color: var(--blue); }
.spin { opacity: 0.7; }

/* Note en étoiles */
.rate { border-top: 1px solid var(--line); margin-top: 8px; padding-top: 16px; display: flex; flex-direction: column; gap: 8px; }
.rate-q { margin: 0; font-weight: 600; }
.stars { display: flex; gap: 2px; }
.star { font-size: 2.4rem; line-height: 1; min-width: 48px; min-height: 48px; padding: 0; background: none; border: 0; cursor: pointer; color: transparent; -webkit-text-stroke: 2px #C99700; transition: transform .1s; }
.star.on { color: #F5B301; }
.star:hover { transform: scale(1.12); }
.star:focus-visible { outline: 3px solid var(--blue); outline-offset: 2px; border-radius: 8px; }
.rate-more { display: flex; flex-direction: column; gap: 8px; }
.rate-more[hidden] { display: none; }
.rate-thanks { margin: 0; color: var(--ok); font-weight: 600; min-height: 1.2em; }
.next { margin-top: 12px; padding-top: 16px; border-top: 1px solid var(--line); }
.why-card { display: grid; grid-template-columns: 1fr auto; gap: 2px 12px; align-items: center; text-decoration: none; color: inherit; background: var(--surface); border: 1.5px solid var(--blue); border-left-width: 6px; border-radius: 12px; padding: 14px 16px; min-height: 64px; }
.why-card:hover { background: var(--soft); }
.why-card:focus-visible { outline: 3px solid var(--blue); outline-offset: 2px; }
.why-t { font-weight: 700; font-size: 1.05rem; color: var(--blue); }
.why-s { grid-column: 1; color: var(--muted); font-size: .92rem; }
.why-a { grid-column: 2; grid-row: 1 / span 2; font-size: 1.6rem; color: var(--blue); }

/* Mai, l'assistante */
.mai { display: grid; grid-template-columns: 1.15fr 1fr; align-items: end; background: #FEFEFE; color: #16213A; border-radius: 18px; overflow: hidden; border: 1px solid var(--line); margin-bottom: 16px; }
.mai-t { padding: 22px 0 22px 20px; align-self: center; display: flex; flex-direction: column; gap: 8px; }
.mai-hello { margin: 0; font-size: 1.5rem; font-weight: 700; color: #1F4E9C; line-height: 1.15; }
.mai-line { margin: 0; font-size: 1.02rem; }
.mai-ia { margin: 4px 0 0; font-size: .8rem; color: #515C75; }
.mai img { width: 100%; height: auto; display: block; margin-top: 8px; }

.check { display: grid; grid-template-columns: 26px 1fr; gap: 12px; align-items: start; cursor: pointer; line-height: 1.45; }
.check input { width: 24px; height: 24px; margin: 1px 0 0; accent-color: var(--blue); }

.sum { gap: 10px; }
.sum-l { margin: 0; font-weight: 700; font-size: 1.05rem; }
.path-set .path-t { font-size: 1.05rem; }
.path-set { background: transparent; }
#setTitle:focus, #flowTitle:focus { outline: none; }

/* Accueil de Mai et assistant du premier lancement */
.hero { border-radius: 22px; overflow: hidden; background: #FEFEFE; height: 215px; border: 1px solid var(--line); }
.hero img { width: 100%; height: 100%; object-fit: cover; object-position: 50% 22%; display: block; }
.say { background: var(--surface); border: 1px solid var(--line); border-radius: 18px; padding: 16px 18px; font-size: 1.08rem; line-height: 1.45; }
.say b { color: var(--blue); }
.big { font-size: 1.15rem; min-height: 56px; }
#welcome .wrap { display: flex; flex-direction: column; gap: 16px; }
.wiz-head { display: flex; flex-direction: column; gap: 12px; }
.dots { display: flex; gap: 8px; justify-content: center; }
.dots i { width: 9px; height: 9px; border-radius: 50%; background: var(--line); }
.dots i.on { background: var(--blue); }
.mini { display: flex; gap: 12px; align-items: center; }
.mini .av { width: 68px; height: 68px; border-radius: 50%; overflow: hidden; background: #FEFEFE; border: 1px solid var(--line); flex: none; }
.mini .av img { width: 100%; display: block; }
.mini .say { flex: 1; padding: 12px 14px; font-size: 1.05rem; font-weight: 600; }
.say:focus { outline: none; }
#settings.wiz #setTitle, #settings.wiz #setIntro { display: none; }
#settings.wiz .card h3 { display: none; }
#settings.wiz[data-step="1"] #cardGod, #settings.wiz[data-step="1"] #cardKid { display: none; }
#settings.wiz[data-step="2"] #cardMe, #settings.wiz[data-step="2"] #cardKid { display: none; }
#settings.wiz #sibDetails, #settings.wiz #godAdd, #settings.wiz #godDel, #settings.wiz #godBar { display: none; }

#welcome { display: flex; flex-direction: column; gap: 12px; }
#welcome .say small { display: block; margin-top: 6px; color: var(--muted); font-size: .95rem; font-weight: 400; }
#welcome .check { font-size: .95rem; }
#welcome .check a { color: var(--blue); font-weight: 600; }

#settings.wiz #setReset { display: none; }
#setReset { color: var(--muted); font-weight: 500; margin-top: 8px; }

/* Ajout de l'icône sur l'écran d'accueil du téléphone */
.install { background: var(--surface); border: 1.5px solid var(--blue); border-left-width: 6px; border-radius: 12px; padding: 16px; margin: 0 0 14px; display: flex; flex-direction: column; gap: 10px; }
.install h2 { font-size: 1.15rem; line-height: 1.3; margin: 0; }
.install-s { margin: 0; color: var(--muted); }
.install .btn.big { width: 100%; min-height: 64px; font-size: 1.1rem; }
.install-steps { margin: 0; padding-left: 1.4em; display: flex; flex-direction: column; gap: 10px; font-size: 1.05rem; }
.install-steps li::marker { font-weight: 700; color: var(--blue); }
.share-ico { vertical-align: middle; color: var(--blue); margin-left: 6px; }
.install-warn { margin: 0; background: var(--soft); border-radius: 10px; padding: 12px 14px; }
