:root {
  /* Palette : rose poudré + marron chocolat / caramel */
  --bg: #f5ebe6;
  --bg-2: #fbf5f1;
  --card: #fffaf7;
  --ink: #4b3229;
  --ink-soft: #8a6d62;
  --rose: #c98a8f;
  --rose-deep: #a65f68;
  --brown: #7a4e3c;
  --brown-deep: #5e3a2c;
  --gold: #c49a6c;
  --line: #ecdcd4;
  --sage: #8fa58b;
  --shadow: 0 6px 24px rgba(94, 58, 44, 0.12);
  --radius: 22px;
  --serif: "Cormorant Garamond", Georgia, serif;
  --sans: "Nunito", system-ui, -apple-system, "Segoe UI", sans-serif;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #1f1614;
    --bg-2: #271c19;
    --card: #2f221f;
    --ink: #f2e4dd;
    --ink-soft: #c4a99f;
    --rose: #dc9ea4;
    --rose-deep: #ecb6bb;
    --brown: #a8735b;
    --brown-deep: #8d5e49;
    --gold: #d6b083;
    --line: #47352f;
    --shadow: 0 6px 24px rgba(0, 0, 0, 0.4);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font-family: var(--sans);
  color: var(--ink);
  background: radial-gradient(1200px 600px at 50% -200px, var(--bg-2), var(--bg)) fixed;
  background-color: var(--bg);
  min-height: 100vh;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  padding-bottom: calc(84px + env(safe-area-inset-bottom));
}

h1, h2, h3 { font-family: var(--serif); font-weight: 600; color: var(--brown); line-height: 1.15; margin: 0 0 .4em; }
h2 { font-size: 1.9rem; }
h3 { font-size: 1.35rem; }
p { margin: 0 0 .8em; }
.muted { color: var(--ink-soft); }
.small { font-size: .88rem; }
.center { text-align: center; }

.topbar {
  position: sticky; top: 0; z-index: 5;
  padding: calc(10px + env(safe-area-inset-top)) 16px 10px;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(10px);
  text-align: center;
}
.brand { font-size: 1.45rem; margin: 0; color: var(--rose-deep); letter-spacing: .02em; }
.brand .heart { color: var(--rose); }

main { max-width: 640px; margin: 0 auto; padding: 8px 16px 24px; outline: none; }
.screen { animation: fade .35s ease; }
@keyframes fade { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px;
  margin: 0 0 16px;
  box-shadow: var(--shadow);
}
.card.soft { background: transparent; box-shadow: none; border-style: dashed; }
.intro { font-family: var(--serif); font-size: 1.2rem; font-style: italic; color: var(--ink-soft); text-align: center; margin: 4px 8px 18px; }

/* Portrait */
.portrait {
  width: 156px; height: 156px; margin: 4px auto 14px; border-radius: 50%;
  background: var(--bg-2) center/cover no-repeat;
  border: 4px solid var(--card); outline: 2px solid var(--rose);
  box-shadow: var(--shadow);
  display: grid; place-items: center; color: var(--rose); font-size: 3rem;
  cursor: pointer;
}
.hero { text-align: center; }
.hero .name { font-family: var(--serif); font-size: 2rem; margin: 0; color: var(--brown); }
.hero .dates { color: var(--ink-soft); font-size: .95rem; }

.pill {
  display: inline-block; padding: 6px 14px; border-radius: 999px;
  background: color-mix(in srgb, var(--rose) 18%, transparent);
  color: var(--rose-deep); font-weight: 600; font-size: .9rem;
}

/* Grille de raccourcis */
.grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 16px; }
.tile {
  display: block; text-decoration: none; color: inherit;
  background: var(--card); border: 1px solid var(--line); border-radius: 18px;
  padding: 16px; box-shadow: var(--shadow);
}
.tile .ico { font-size: 1.5rem; color: var(--rose); }
.tile strong { display: block; font-family: var(--serif); font-size: 1.15rem; margin-top: 4px; }
.tile span.small { color: var(--ink-soft); }

/* Boutons */
button, .btn {
  font: inherit; font-weight: 700; cursor: pointer;
  border: 0; border-radius: 999px; padding: 12px 20px;
  background: var(--brown); color: #fff; text-decoration: none;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  transition: transform .1s ease, background .2s;
}
button:active, .btn:active { transform: scale(.97); }
button:hover, .btn:hover { background: var(--brown-deep); }
.btn.ghost, button.ghost { background: transparent; color: var(--rose-deep); border: 1.5px solid var(--rose); }
.btn.ghost:hover, button.ghost:hover { background: color-mix(in srgb, var(--rose) 12%, transparent); }
button.link { background: none; color: var(--ink-soft); padding: 6px 8px; font-weight: 600; }
button.link:hover { color: var(--rose-deep); background: none; }
.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.row.end { justify-content: flex-end; }
.full { width: 100%; }

/* Formulaires */
label { display: block; font-weight: 600; margin: 12px 0 6px; }
input[type=text], input[type=date], textarea {
  width: 100%; font: inherit; color: var(--ink);
  background: var(--bg-2); border: 1.5px solid var(--line); border-radius: 14px;
  padding: 12px 14px; outline: none;
}
input:focus, textarea:focus { border-color: var(--rose); }
textarea { min-height: 120px; resize: vertical; }

/* Audio */
.audio-card { text-align: center; }
.audio-card .halo {
  width: 92px; height: 92px; margin: 6px auto 12px; border-radius: 50%;
  display: grid; place-items: center; font-size: 2.2rem; color: #fff;
  background: radial-gradient(circle at 30% 30%, var(--gold), var(--rose));
  box-shadow: 0 0 0 10px color-mix(in srgb, var(--rose) 15%, transparent);
}
.audio-card.playing .halo { animation: breathe 6s ease-in-out infinite; }
@keyframes breathe { 50% { box-shadow: 0 0 0 22px color-mix(in srgb, var(--rose) 8%, transparent); transform: scale(1.04); } }
audio { width: 100%; margin-top: 8px; }

/* Questions */
.qlist { list-style: none; padding: 0; margin: 0; }
.qlist li {
  display: flex; gap: 12px; align-items: flex-start;
  padding: 12px 0; border-bottom: 1px solid var(--line);
}
.qlist li:last-child { border-bottom: 0; }
.qlist input[type=checkbox] { margin-top: 5px; width: 20px; height: 20px; accent-color: var(--rose); flex: none; }
.qlist .q { flex: 1; }
.qlist .q.done { color: var(--ink-soft); text-decoration: line-through; }
.qlist .x { background: none; color: var(--ink-soft); padding: 0 6px; font-size: 1.2rem; }

/* Émotions */
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  border: 1.5px solid var(--line); background: var(--bg-2); color: var(--ink);
  padding: 7px 14px; border-radius: 999px; font-weight: 600; font-size: .92rem;
}
.chip:hover { background: var(--bg-2); border-color: var(--rose); }
.chip[aria-pressed=true] { background: var(--rose); border-color: var(--rose); color: #fff; }

/* Journal */
.entry { position: relative; }
.entry .when { font-size: .85rem; color: var(--ink-soft); text-transform: capitalize; }
.entry .kind { font-family: var(--serif); font-size: 1.25rem; margin: 2px 0 8px; color: var(--rose-deep); }
.entry .text { white-space: pre-wrap; }
.entry img { width: 100%; border-radius: 14px; margin-top: 10px; }
.entry .tags { margin-top: 10px; display: flex; flex-wrap: wrap; gap: 6px; }
.entry .tags span { font-size: .8rem; padding: 3px 10px; border-radius: 999px; background: color-mix(in srgb, var(--rose) 14%, transparent); color: var(--rose-deep); }

.prompts { display: grid; gap: 10px; margin-bottom: 16px; }
.prompt {
  text-align: left; justify-content: flex-start; width: 100%;
  background: var(--card); color: var(--ink); border: 1px solid var(--line);
  border-radius: 18px; padding: 14px 16px; box-shadow: var(--shadow); font-weight: 600;
}
.prompt:hover { background: var(--card); border-color: var(--rose); }
.prompt .ico { color: var(--rose); font-size: 1.3rem; width: 28px; }

.photo-drop {
  border: 2px dashed var(--line); border-radius: 16px; padding: 14px; text-align: center;
  color: var(--ink-soft); cursor: pointer; display: block; font-weight: 600;
}
.photo-drop img { max-width: 100%; max-height: 220px; border-radius: 12px; display: block; margin: 0 auto; }

/* Soin */
.progress { height: 10px; border-radius: 999px; background: var(--line); overflow: hidden; margin: 10px 0 6px; }
.progress > i { display: block; height: 100%; background: linear-gradient(90deg, var(--gold), var(--rose)); border-radius: inherit; }
.check {
  display: flex; gap: 10px; align-items: center; font-weight: 600; margin-top: 14px; cursor: pointer;
}
.check input { width: 22px; height: 22px; accent-color: var(--sage); }

/* Ressources */
.pdf { display: flex; gap: 14px; align-items: center; }
.pdf .ico {
  flex: none; width: 54px; height: 64px; border-radius: 10px;
  background: linear-gradient(160deg, var(--rose), var(--gold)); color: #fff;
  display: grid; place-items: center; font-family: var(--serif); font-size: 1.6rem;
}
.pdf .body { flex: 1; min-width: 0; }
.pdf h3 { font-size: 1.2rem; margin-bottom: 2px; }

/* Barre d'onglets */
.tabs {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 10;
  display: grid; grid-template-columns: repeat(5, 1fr);
  background: color-mix(in srgb, var(--card) 94%, transparent);
  backdrop-filter: blur(12px);
  border-top: 1px solid var(--line);
  padding: 6px 4px calc(6px + env(safe-area-inset-bottom));
}
.tabs a {
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  text-decoration: none; color: var(--ink-soft); font-size: .74rem; font-weight: 700;
  padding: 6px 0; border-radius: 14px;
}
.tabs a span { font-size: 1.3rem; line-height: 1; }
.tabs a[aria-current=page] { color: var(--rose-deep); background: color-mix(in srgb, var(--rose) 12%, transparent); }

/* Modale */
dialog {
  border: 0; border-radius: 26px 26px 0 0; padding: 0; width: 100%; max-width: 640px;
  margin: auto auto 0; max-height: 92vh; background: var(--card); color: var(--ink);
  box-shadow: 0 -10px 40px rgba(0,0,0,.2);
}
@media (min-width: 700px) { dialog { border-radius: 26px; margin: auto; } }
dialog::backdrop { background: rgba(60, 40, 45, .45); backdrop-filter: blur(3px); }
dialog .inner { padding: 22px 20px calc(22px + env(safe-area-inset-bottom)); overflow-y: auto; max-height: 92vh; }

#toast {
  position: fixed; left: 50%; bottom: calc(96px + env(safe-area-inset-bottom)); transform: translateX(-50%) translateY(20px);
  background: var(--ink); color: var(--bg); padding: 10px 18px; border-radius: 999px;
  font-weight: 600; opacity: 0; pointer-events: none; transition: .3s; z-index: 20; max-width: calc(100% - 32px); text-align: center;
}
#toast.show { opacity: 1; transform: translateX(-50%); }

.empty { text-align: center; padding: 26px 10px; color: var(--ink-soft); }
.empty .big { font-size: 2.4rem; color: var(--rose); }
.sep { text-align: center; color: var(--rose); letter-spacing: .6em; margin: 6px 0 16px; }

/* Créneau de soin */
a.pill { text-decoration: none; }
.pill.gold { background: color-mix(in srgb, var(--gold) 22%, transparent); color: var(--ink); }
.slot {
  display: flex; gap: 14px; align-items: center; padding: 14px 16px; margin-bottom: 14px;
  border-radius: 16px; background: color-mix(in srgb, var(--gold) 14%, transparent);
}
.slot .ico { font-size: 1.6rem; color: var(--gold); }

/* Carnet imprimé / PDF */
#print { display: none; }
@media print {
  @page { margin: 18mm 16mm; }
  body { background: #fff !important; color: #3a2e31; padding: 0; }
  body > *:not(#print) { display: none !important; }
  #print { display: block; font-family: var(--sans); font-size: 11.5pt; line-height: 1.6; }
  #print h1, #print h2 { font-family: var(--serif); color: #8f4f57; }
  #print h1 { font-size: 30pt; margin: 10px 0 4px; }
  #print h2 { font-size: 16pt; margin: 0 0 6px; }
  #print .p-cover { text-align: center; padding-top: 50mm; page-break-after: always; }
  #print .p-brand { font-family: var(--serif); font-size: 18pt; color: #c98a8f; letter-spacing: .04em; }
  #print .p-photo { width: 60mm; height: 60mm; object-fit: cover; border-radius: 50%; border: 3px solid #c98a8f; margin: 12mm auto 4mm; display: block; }
  #print .p-muted { color: #8a777a; font-size: 10pt; text-transform: none; }
  #print .p-text { white-space: pre-wrap; }
  #print section, #print article { padding: 0 0 8mm; margin-bottom: 8mm; border-bottom: 1px solid #ead9d2; break-inside: avoid-page; }
  #print .p-cover { border-bottom: 0; }
  #print ul { list-style: none; padding: 0; }
  #print article img { max-width: 100%; max-height: 90mm; border-radius: 8px; display: block; margin: 6px 0; }
}

/* Bandeaux photo */
.banner {
  position: relative; overflow: hidden; isolation: isolate;
  border-radius: var(--radius); margin: 4px 0 18px;
  aspect-ratio: 16 / 11; background: var(--brown) center/cover no-repeat;
  display: flex; align-items: flex-end; box-shadow: var(--shadow);
}
.banner.bare { aspect-ratio: 16 / 9; }
/* Voile rose + marron pour harmoniser toutes les photos avec la charte */
.banner::before {
  content: ""; position: absolute; inset: 0; z-index: -1;
  background: linear-gradient(150deg, rgba(201, 138, 143, .35), rgba(122, 78, 60, .30));
  mix-blend-mode: soft-light;
}
.banner::after {
  content: ""; position: absolute; inset: 0; z-index: -1;
  background: linear-gradient(to top, rgba(75, 45, 36, .88) 0%, rgba(75, 45, 36, .35) 45%, rgba(75, 45, 36, 0) 75%);
}
.banner.bare::after { background: linear-gradient(to top, rgba(75, 45, 36, .35), transparent 50%); }
.banner-text { padding: 18px 20px 16px; color: #fff; }
.banner-text h2 { color: #fff; margin: 0 0 2px; font-size: 2rem; text-shadow: 0 2px 12px rgba(0,0,0,.35); }
.banner-text p { margin: 0; font-family: var(--serif); font-style: italic; font-size: 1.12rem; color: #f8e2dd; }
.portrait.lift { margin-top: -96px; position: relative; z-index: 1; }
.tabs a[aria-current=page] { color: var(--rose-deep); }

/* Guide « Avant notre rencontre » */
.guide-card {
  display: flex; gap: 14px; align-items: center; text-decoration: none; color: inherit;
  background: linear-gradient(135deg, color-mix(in srgb, var(--rose) 16%, var(--card)), var(--card));
}
.guide-card .ico {
  flex: none; width: 52px; height: 52px; border-radius: 50%; display: grid; place-items: center;
  background: var(--brown); color: #fff; font-size: 1.5rem;
}
.guide-card .body { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.guide-card .kicker { font-size: .78rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--rose-deep); }
.guide-card strong { font-family: var(--serif); font-size: 1.35rem; color: var(--brown); line-height: 1.2; }
.guide-card .chev { font-size: 2rem; color: var(--rose); }
.back { display: inline-block; margin: 2px 0 10px; color: var(--ink-soft); font-weight: 700; text-decoration: none; }
.back:hover { color: var(--rose-deep); }

.chapter { padding: 0; overflow: hidden; scroll-margin-top: 76px; }
.chapter summary { list-style: none; cursor: pointer; padding: 18px 44px 18px 20px; position: relative; display: flex; flex-direction: column; gap: 2px; }
.chapter summary::-webkit-details-marker { display: none; }
.chapter summary::after { content: "+"; position: absolute; right: 20px; top: 50%; transform: translateY(-50%); font-size: 1.6rem; color: var(--rose); transition: transform .2s; }
.chapter[open] summary::after { transform: translateY(-50%) rotate(45deg); }
.chapter .ch-num { font-size: .78rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--rose-deep); }
.chapter .ch-title { font-family: var(--serif); font-size: 1.35rem; font-weight: 600; color: var(--brown); line-height: 1.2; }
.chapter[open] summary { border-bottom: 1px solid var(--line); }
.chapter > .ghost, .chapter > .btn { margin: 0 20px 20px; width: calc(100% - 40px); }
.reading { padding: 18px 20px 6px; font-size: 1.04rem; line-height: 1.7; }
.reading p { margin: 0 0 1em; }
.reading h4 { font-family: var(--serif); font-size: 1.3rem; color: var(--rose-deep); margin: 1.4em 0 .5em; line-height: 1.2; }
.reading h4:first-child { margin-top: 0; }
.signature, #print .signature { font-family: var(--serif); font-style: italic; font-size: 1.25rem; color: var(--brown); text-align: right; }

.note {
  font-size: .9rem; padding: 10px 14px; border-radius: 14px; margin: 4px 0 6px;
  background: color-mix(in srgb, var(--rose) 12%, transparent); color: var(--ink);
}

@media print {
  #print .p-chapter { break-before: page; border-bottom: 0; }
  #print .p-reading h4 { font-family: var(--serif); font-size: 13.5pt; color: #a65f68; margin: 14px 0 4px; break-after: avoid; }
  #print .p-reading p { margin: 0 0 8px; }
}
.qlist .q.ok { color: var(--ink-soft); }
.qlist label.q { cursor: pointer; }
