/* ═══════════════ Djouney v3 — le carnet d'un duo (module E) ═══════════════
   Pages de porcelaine, fil rouge, lettres manuscrites, ligne d'écriture ;
   le tempo (phase 2), le mystère (phase 3 : objets précieux, surprises)
   et le corps et la musique (phase 4 : souffle, battement, Salon).
   Classes préfixées .cn- (voir ARCHITECTURE.md § 8, § 11, § 13, § 14 et § 15). */

.cn {
  /* Encre adoucie qui garde un contraste ≥ 4,5:1 sur la porcelaine comme sur le lait. */
  --cn-soft: rgba(var(--ink-rgb),  .84);
  /* Marge du fil rouge (à gauche des pages) et marge de droite. */
  --cn-margin: 34px;
  --cn-right: 12px;
  --cn-thread-x: -18px;
  --cn-line: 28px;
  height: 100%;
  overflow: hidden;
}

/* ─── En-tête ─── */
.cn-head {
  position: relative;
  z-index: 3;
  flex: none;
  display: flex;
  align-items: center;
  gap: 2px;
  min-height: 56px;
  padding: calc(6px + var(--safe-top)) 8px 6px 4px;
  background: var(--porcelain);
  transition: box-shadow var(--mid) var(--ease);
}
.cn-head.is-raised { box-shadow: 0 8px 16px -12px rgba(var(--shadow-rgb),  .55); }
.cn-back { color: var(--stem); }

.cn-title {
  flex: 1;
  min-width: 0;
  margin: 0;
  font-size: inherit;
  font-weight: inherit;
}
.cn-name {
  display: block;
  max-width: 100%;
  min-height: 44px;
  margin: 0;
  padding: 0 6px;
  border: 0;
  border-radius: 12px;
  background: none;
  color: var(--ink);
  text-align: left;
  font-family: var(--font-hand);
  font-weight: 500;
  font-size: 31px;
  line-height: 44px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.cn-name:disabled { cursor: default; }
.cn-name__text {
  /* L'ellipse se pose sur le texte lui-même : sur un <button>, elle n'est pas rendue partout. */
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  text-decoration: underline;
  text-decoration-color: transparent;
  text-decoration-thickness: 1.5px;
  text-underline-offset: .14em;
  transition: text-decoration-color var(--mid) var(--ease);
}
.cn-name:not(:disabled):active .cn-name__text { text-decoration-color: var(--relief); }
@media (hover: hover) {
  .cn-name:not(:disabled):hover .cn-name__text { text-decoration-color: var(--relief); }
}

.cn-presence,
.cn-seal {
  flex: none;
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
}
.cn-presence { transition: opacity var(--slow) var(--ease); }
.cn-presence[data-online="false"] { opacity: .42; }

/* ─── Zone défilante ─── */
.cn-scroll {
  position: relative;
  flex: 1;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior-y: contain;
  overflow-anchor: none; /* la position est tenue à la main (pagination, rejeu) */
  -webkit-overflow-scrolling: touch;
  padding: 0 var(--cn-right) 0 var(--cn-margin);
}

.cn-note {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  min-height: 100%;
  padding: 40px 8px;
  text-align: center;
}
.cn-note__text {
  margin: 0;
  max-width: 30ch;
  font-family: var(--font-serif);
  font-style: italic;
  font-size: 16px;
  line-height: 1.5;
  color: var(--cn-soft);
}
.cn-note__retry { min-height: 44px; }

/* Le paquet de pages, et le fil rouge qui le traverse de haut en bas. */
.cn-sheaf {
  position: relative;
  display: flex;
  flex-direction: column;
  min-height: 100%;
  padding-top: 14px;
  /* L'appui long appartient à l'Effleurement : rien ne se sélectionne dans le carnet. */
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
}
.cn-sheaf::before {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  left: var(--cn-thread-x);
  width: 1.5px;
  border-radius: 1px;
  background: var(--thread);
  opacity: .9;
  pointer-events: none;
}

.cn-leaves {
  margin-top: auto; /* peu de pages : elles se posent en bas, contre la ligne d'écriture */
  display: flex;
  flex-direction: column;
  gap: 22px;
}

/* ─── Pages précédentes ─── */
.cn-older {
  display: flex;
  justify-content: center;
  padding-bottom: 10px;
}
.cn-older:empty { display: none; }
.cn-older__btn {
  min-height: 44px;
  font-size: 13.5px;
  color: var(--cn-soft);
}
.cn-older__btn[aria-disabled="true"] { opacity: .62; cursor: progress; text-decoration: none; }
.cn-origin {
  margin: 2px 0 6px;
  font-family: var(--font-serif);
  font-style: italic;
  font-size: 14px;
  color: var(--cn-soft);
  text-align: center;
}

/* ─── Les pages ─── */
.cn-page {
  position: relative;
  padding: 14px 16px 20px;
  border-radius: var(--radius);
  background: var(--milk);
  box-shadow:
    var(--emboss-sm),
    inset 1px 1px 0 rgba(var(--light-rgb), calc(.95 * var(--hl-a))),
    inset -1px -1px 0 rgba(var(--hollow-rgb),  .3);
}
/* La dernière page se prolonge dans la ligne d'écriture, juste en dessous. */
.cn-page--last {
  padding-bottom: 10px;
  border-bottom-left-radius: 0;
  border-bottom-right-radius: 0;
}
.cn-day {
  margin: 0 0 14px;
  text-align: center;
  font-family: var(--font-serif);
  font-style: italic;
  font-weight: 400;
  font-size: 13px;
  line-height: 1.4;
  letter-spacing: .2px;
  color: var(--cn-soft);
}
.cn-letters {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.cn-page--empty {
  padding-top: 30px;
  text-align: center;
}
.cn-empty {
  margin: 0;
  font-family: var(--font-hand);
  font-weight: 500;
  font-size: 28px;
  line-height: 1.15;
  color: var(--ink);
}
.cn-empty--soft {
  margin: 6px 0 4px;
  font-family: var(--font-serif);
  font-style: italic;
  font-weight: 400;
  font-size: 15.5px;
  line-height: 1.45;
  color: var(--cn-soft);
}

/* ─── Les lettres : de l'encre, sans bulles ─── */
.cn-letter {
  position: relative;
  min-width: 0;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none; /* l'appui long reste libre pour l'Effleurement */
  transition: opacity 900ms var(--ease), filter 900ms var(--ease);
}
.cn-letter--mine { margin-left: 18%; color: var(--ink); }
.cn-letter--theirs { margin-right: 8%; color: var(--sepia); }

.cn-text {
  position: relative;
  z-index: 1;
  margin: 0;
  font-family: var(--font-hand);
  font-weight: 500;
  font-size: 24px;
  line-height: 1.15;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.cn-letter.is-veiled .cn-text { cursor: pointer; }
.cn-veil { visibility: hidden; }
/* Une lettre qui attend son tour : seulement la réglure où l'encre va se poser. */
.cn-letter.is-veiled .cn-text::before {
  content: "";
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(to bottom, transparent 0, transparent calc(1.15em - 1px), rgba(var(--hollow-rgb),  .45) calc(1.15em - 1px), rgba(var(--hollow-rgb),  .45) 1.15em);
  pointer-events: none;
}

.cn-foot {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0 8px;
  min-height: 18px;
  margin-top: 3px;
  font-family: var(--font-ui);
  font-size: 11px;
  line-height: 1.4;
  color: var(--ink-faint);
}
.cn-letter--mine .cn-foot { justify-content: flex-end; }
.cn-time { font-variant-numeric: tabular-nums; letter-spacing: .2px; }
.cn-state { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 0 6px; }
.cn-state:empty,
.cn-seen:empty { display: none; }
/* Effacer une de mes lettres : une gomme discrète, à gauche du pied (cible de 44 px, sans grandir le pied). */
.cn-erase {
  order: -1;
  width: 44px;
  height: 36px;
  margin: -9px auto -9px -12px;
  color: var(--ink-faint);
  opacity: .6;
  transition: opacity var(--mid) var(--ease), color var(--mid) var(--ease);
}
.cn-erase svg { width: 17px; height: 17px; }
.cn-erase:hover,
.cn-erase:focus-visible { opacity: 1; color: var(--carmine); }
.cn-state__failed { color: var(--cn-soft, rgba(var(--ink-rgb),  .84)); }
.cn-state__btn {
  min-width: 44px;
  min-height: 44px;
  margin: -12px 0;
  padding: 0 6px;
  border: 0;
  border-radius: 10px;
  background: none;
  color: var(--ink);
  font-family: var(--font-ui);
  font-size: 12px;
  font-weight: 600;
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}
.cn-state__btn:active { background: var(--porcelain); box-shadow: var(--deboss); }
.cn-letter--failed .cn-text { opacity: .72; }

/* La paupière sous ma dernière lettre. */
.cn-seen { display: inline-flex; }
.cn-eye {
  display: inline-flex;
  align-items: center;
  height: 16px;
  opacity: .88;
}

/* Tache d'encre d'une réponse longtemps attendue, posée derrière le début de la lettre. */
.cn-stain {
  position: absolute;
  z-index: 0;
  top: 0;
  left: 0;
  line-height: 0;
  transform: translate(-34%, -30%);
  pointer-events: none;
}
.cn-stain .pc-ink { color: inherit; }
.cn-stain.is-fresh { animation: cn-stain 1.4s var(--ease) both; }
@keyframes cn-stain {
  from { opacity: 0; transform: translate(-34%, -30%) scale(.35); }
}

/* Une lettre qui arrive se pose. */
.cn-letter.is-new { animation: cn-land 640ms var(--ease) both; }
@keyframes cn-land {
  from { opacity: 0; transform: translateY(8px); }
}

/* Encre humide : la lettre n'est pas encore partie, un reflet passe lentement. */
.cn-letter--wet .cn-text {
  background-image: linear-gradient(105deg, currentColor 40%, #C9A46A 50%, currentColor 60%);
  background-size: 260% 100%;
  background-position: 100% 0;
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  animation: cn-wet 2.8s ease-in-out infinite;
}
@keyframes cn-wet {
  from { background-position: 100% 0; }
  to { background-position: 0 0; }
}
/* … puis l'encre sèche. */
.cn-letter--drying .cn-text { animation: cn-dry 900ms var(--ease) both; }
@keyframes cn-dry {
  from { filter: brightness(1.45) saturate(1.2); }
}

/* ─── La goutte du fil rouge ─── */
.cn-drop {
  position: absolute;
  z-index: 2;
  top: 0;
  left: calc(var(--cn-thread-x) + .75px - 5px);
  line-height: 0;
  pointer-events: none;
  transition: opacity 700ms var(--ease);
}
.cn-drop.is-gone { opacity: 0; }
.cn-drop.is-fresh .pc-drop { animation: cn-drip 900ms var(--ease) both, pc-breathe 3.6s ease-in-out 900ms infinite; }
@keyframes cn-drip {
  from { opacity: 0; transform: translateY(-22px) scale(.7); }
  55% { opacity: 1; }
}

/* ─── Fin de la dernière page : brouillon de l'autre, cartes de consentement ─── */
.cn-tail { display: flex; flex-direction: column; }
.cn-tail > .ty-live { margin: 16px 8% 0 0; }
.cn-consent {
  margin-top: 18px;
  transition: opacity 500ms var(--ease), transform 500ms var(--ease);
}
.cn-consent.is-new { animation: cn-land 640ms var(--ease) both; }
.cn-consent.is-leaving { opacity: 0; transform: translateY(4px); }

/* ─── La ligne d'écriture ─── */
.cn-write {
  position: relative;
  z-index: 2;
  flex: none;
  display: flex;
  align-items: flex-end;
  gap: 6px;
  margin: 0 var(--cn-right) calc(10px + var(--safe-bottom)) var(--cn-margin);
  padding: 2px 6px 8px 16px;
  border-radius: 0 0 var(--radius) var(--radius);
  background: var(--milk);
  box-shadow: 4px 6px 10px rgba(var(--shadow-rgb),  .3), inset -1px -1px 0 rgba(var(--hollow-rgb),  .3);
  transition: border-radius var(--mid) var(--ease), box-shadow var(--mid) var(--ease);
}
/* Le fil continue sous la ligne d'écriture, jusqu'au bas de l'écran. */
.cn-write::before {
  content: "";
  position: absolute;
  top: 0;
  bottom: calc(-10px - var(--safe-bottom));
  left: var(--cn-thread-x);
  width: 1.5px;
  background: var(--thread);
  opacity: .9;
  pointer-events: none;
}
/* En lisant plus haut, la ligne devient un feuillet posé sur le carnet. */
.cn-write.is-floating {
  border-radius: var(--radius);
  box-shadow: var(--emboss-sm), inset 1px 1px 0 rgba(var(--light-rgb), calc(.95 * var(--hl-a)));
}

.cn-input {
  --cn-rule: var(--relief);
  flex: 1;
  min-width: 0;
  height: calc(var(--cn-line) + 8px);
  max-height: calc(var(--cn-line) * 6 + 8px);
  margin: 0;
  padding: 6px 2px 2px 0;
  border: 0;
  border-radius: 0;
  outline: none;
  resize: none;
  overflow-y: hidden;
  background-color: transparent;
  /* Réglure fine : une ligne sous chaque ligne d'écriture, qui défile avec le texte. */
  background-image: linear-gradient(to bottom, transparent calc(var(--cn-line) - 1px), var(--cn-rule) calc(var(--cn-line) - 1px), var(--cn-rule) var(--cn-line));
  background-size: 100% var(--cn-line);
  background-position: 0 6px;
  background-attachment: local;
  background-repeat: repeat-y;
  color: var(--ink);
  caret-color: var(--ink);
  font-family: var(--font-hand);
  font-weight: 500;
  font-size: 24px;
  line-height: var(--cn-line);
}
/* Encre adoucie, mais lisible : ≥ 3:1 sur le lait pour ce grand texte manuscrit. */
.cn-input::placeholder { color: var(--ink-soft); opacity: 1; }
/* Le focus se lit dans la réglure, qui s'affirme nettement à l'encre. */
.cn-input:focus { --cn-rule: var(--ink-soft); }
.cn-input:focus-visible { outline: none; }

.cn-send {
  margin-bottom: 1px;
  color: var(--ink);
  transition: opacity var(--mid) var(--ease), transform var(--mid) var(--ease), box-shadow .25s var(--ease);
}
.cn-send svg { width: 22px; height: 22px; }
.cn-send:disabled {
  opacity: 0;
  transform: translateX(6px) scale(.86);
  pointer-events: none;
  cursor: default;
}

/* ─── Feuilles : « Votre carnet », proposition d'Effleurement ─── */
.cn-settings,
.cn-ask { --cn-soft: rgba(var(--ink-rgb),  .84); }
.cn-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.cn-sec { margin-top: 24px; }
.cn-sec__title {
  margin: 0 0 12px;
  font-family: var(--font-ui);
  font-size: 12.5px;
  font-weight: 600;
  letter-spacing: .4px;
  color: var(--cn-soft);
}
.cn-sec__hint {
  margin: 10px 2px 0;
  font-family: var(--font-serif);
  font-style: italic;
  font-size: 14px;
  line-height: 1.45;
  color: var(--cn-soft);
}
.cn-sec--end {
  margin-top: 30px;
  display: flex;
  justify-content: center;
}

.cn-flowers {
  display: grid;
  grid-template-columns: repeat(5, minmax(44px, 1fr));
  gap: 6px;
}
.cn-flower {
  display: grid;
  place-items: center;
  min-height: 60px;
  padding: 0;
  border: 0;
  border-radius: 18px;
  background: transparent;
  transition: background-color var(--mid) var(--ease), box-shadow var(--mid) var(--ease);
}
.cn-flower[aria-checked="true"] {
  background: var(--porcelain);
  box-shadow: var(--deboss);
}
.cn-flower-name {
  margin: 10px 0 0;
  text-align: center;
  font-family: var(--font-hand);
  font-weight: 500;
  font-size: 24px;
  line-height: 1.1;
  color: var(--ink);
}

.cn-tones {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  padding: 5px;
  border-radius: 999px;
  background: var(--porcelain);
  box-shadow: var(--deboss);
}
.cn-tone {
  min-height: 44px;
  padding: 0 12px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--cn-soft);
  font-family: var(--font-ui);
  font-size: 14.5px;
  font-weight: 500;
  transition: background-color var(--mid) var(--ease), box-shadow var(--mid) var(--ease), color var(--mid) var(--ease);
}
.cn-tone[aria-pressed="true"] {
  background: var(--milk);
  color: var(--ink);
  box-shadow: var(--emboss-sm);
}

.cn-consents { display: flex; flex-direction: column; }
.cn-cs { padding: 12px 2px 14px; }
.cn-cs + .cn-cs { border-top: 1px solid rgba(var(--hollow-rgb),  .6); }
.cn-cs__name {
  margin: 0;
  font-family: var(--font-hand);
  font-weight: 500;
  font-size: 24px;
  line-height: 1.15;
  color: var(--ink);
}
.cn-cs__state {
  margin: 2px 0 0;
  font-family: var(--font-serif);
  font-style: italic;
  font-size: 14.5px;
  line-height: 1.4;
  color: var(--cn-soft);
}
.cn-cs[data-state="on"] .cn-cs__state,
.cn-cs[data-state="theirs"] .cn-cs__state { color: var(--ink); }
.cn-cs__desc {
  margin: 6px 0 0;
  font-family: var(--font-ui);
  font-size: 13px;
  line-height: 1.45;
  color: var(--cn-soft);
}
.cn-cs__actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-top: 10px;
}
.cn-cs__btn { min-height: 44px; padding: 0 18px; font-size: 14px; }
.cn-cs__btn.btn--quiet { padding: 0 10px; color: var(--cn-soft); }

.cn-leave {
  min-height: 44px;
  color: var(--carmine);
  font-size: 14.5px;
}

/* ═══════════════ Le tempo (phase 2) ═══════════════ */

/* ─── Retenir : le sablier à côté de la plume, l'appui long sur la plume ─── */
.cn-hold {
  width: 44px;
  margin-bottom: 1px;
  overflow: hidden;
  color: var(--ink);
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  user-select: none;
  transition: width var(--mid) var(--ease), margin var(--mid) var(--ease), opacity var(--mid) var(--ease), transform var(--mid) var(--ease);
}
.cn-hold svg { width: 21px; height: 21px; }
/* Sans texte, le sablier se replie : la ligne d'écriture garde toute sa largeur. */
.cn-hold:disabled {
  width: 0;
  margin-right: -6px;
  opacity: 0;
  transform: scale(.86);
  pointer-events: none;
  cursor: default;
}
.cn-send {
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  user-select: none;
  touch-action: manipulation;
}
/* Pendant l'appui long, la plume s'enfonce doucement dans le papier. */
.cn-send.is-pressing {
  box-shadow: var(--deboss);
  transform: translateY(1px);
  transition: box-shadow 500ms var(--ease), transform 500ms var(--ease);
}

/* ─── Feuille « Retenir cette lettre » ─── */
.cn-hold-sheet { --cn-soft: rgba(var(--ink-rgb),  .84); }
.cn-hold-opts {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.cn-hold-opt {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  gap: 1px;
  width: 100%;
  min-height: 54px;
  padding: 8px 18px;
  border: 0;
  border-radius: 18px;
  background: var(--milk);
  color: var(--ink);
  box-shadow: var(--emboss-sm);
  text-align: left;
  font-family: var(--font-ui);
  font-size: 15px;
  font-weight: 500;
  line-height: 1.3;
  transition: transform .15s var(--ease), box-shadow .25s var(--ease), background-color var(--mid) var(--ease);
}
.cn-hold-opt:active { transform: translateY(1px); box-shadow: var(--deboss); }
.cn-hold-opt[aria-expanded="true"] { background: var(--porcelain); box-shadow: var(--deboss); }
.cn-hold-opt__hint {
  font-family: var(--font-serif);
  font-style: italic;
  font-weight: 400;
  font-size: 13.5px;
  color: var(--cn-soft);
}
.cn-hold-pick {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 6px 2px 2px;
}
.cn-hold-pick .field-label { margin: 0; color: var(--cn-soft); }
.cn-hold-pick__field { min-height: 50px; }
.cn-hold-pick__msg {
  margin: 0;
  font-family: var(--font-serif);
  font-style: italic;
  font-size: 14px;
  line-height: 1.4;
  color: var(--ink);
}
.cn-hold-pick__msg:empty { display: none; }
.cn-hold-cancel {
  display: flex;
  min-height: 44px;
  margin: 10px auto 0;
  color: var(--cn-soft);
}

/* ─── Mes lettres retenues : voilées, scellées d'un peu de cire dans la marge ─── */
.cn-held-slot,
.cn-env-slot {
  display: flex;
  flex-direction: column;
  gap: 18px;
}
.cn-held-slot:not(:empty) { margin-top: 18px; }
.cn-env-slot:not(:empty) { margin-top: 22px; }
.cn-letter--held .cn-text { opacity: .62; } /* manuscrit de 24 px : ≥ 3:1, lisible pour soi */
.cn-held__seal {
  position: absolute;
  z-index: 1;
  top: 4px;
  left: -27px;
  line-height: 0;
  pointer-events: none;
}
.cn-held__status {
  font-family: var(--font-serif);
  font-style: italic;
  font-size: 12.5px;
  line-height: 1.35;
  letter-spacing: 0;
  color: var(--cn-soft);
}
.cn-held__actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  align-items: center;
  gap: 0 4px;
  min-height: 22px;
  margin-top: 2px;
  font-family: var(--font-ui);
  font-size: 11px;
  color: var(--ink-faint);
}
.cn-held__btn[aria-disabled="true"] { opacity: .5; cursor: progress; }
.cn-letter--held.is-sealing { animation: cn-land 640ms var(--ease) both; }
.cn-letter--held.is-sealing .cn-held__seal { animation: cn-seal-press 760ms var(--ease) both; }
@keyframes cn-seal-press {
  from { opacity: 0; transform: scale(1.7) rotate(-14deg); }
  60% { opacity: 1; transform: scale(.94) rotate(2deg); }
}
/* La lettre partie prend la place de sa retenue : le voile se lève, sans saut. */
.cn-letter.is-unveiled .cn-text { animation: cn-unveil 800ms var(--ease) both; }
@keyframes cn-unveil {
  from { opacity: .62; }
}

/* ─── Les enveloppes de l'autre ─── */
.cn-env {
  display: flex;
  justify-content: center;
  min-width: 0;
  transition: opacity 600ms var(--ease), transform 600ms var(--ease);
}
.cn-env.is-new { animation: cn-land 640ms var(--ease) both; }
.cn-env.is-leaving { opacity: 0; transform: translateY(-6px); pointer-events: none; }

/* ─── Rituels : l'aube derrière la lettre, la bougie près de l'heure ─── */
.cn-dawn {
  position: absolute;
  z-index: 0;
  inset: -10px -12px -4px;
  overflow: hidden;
  border-radius: 18px;
  pointer-events: none;
  transition: opacity 600ms var(--ease);
}
.cn-dawn > * {
  width: 100%;
  height: 100%;
}
/* Une lettre qui attend son rejeu garde sa lumière pour le moment où elle s'écrit. */
.cn-letter.is-veiled .cn-dawn { opacity: 0; }
.cn-letter--aube .cn-foot,
.cn-letter--bougie .cn-foot { position: relative; z-index: 1; }
.cn-rite {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-family: var(--font-serif);
  font-style: italic;
  font-weight: 400;
  font-size: 12.5px;
  line-height: 1.3;
  letter-spacing: 0;
  color: var(--cn-soft);
}
.cn-rite__candle {
  display: inline-flex;
  align-items: flex-end;
  line-height: 0;
  margin: -3px 0;
}

/* ═══════════════ Le mystère (phase 3) ═══════════════ */

/* ─── Glisser quelque chose : un petit sceau en trait fin, et les cachets de cire qui restent ─── */
.cn-slip {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  margin: 0 0 1px -10px;
  padding: 3px 0 0;
  color: var(--ink);
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  user-select: none;
  touch-action: manipulation;
}
.cn-slip .cn-slip__seal { width: 22px; height: 22px; }
.cn-slip__wax {
  display: flex;
  line-height: 0;
}
.cn-slip__wax .ob-tokens { --ob-token: 5px; }

/* ─── Les objets précieux, posés sur la page comme une lettre ─── */
.cn-letter--object.cn-letter--mine { margin-left: 8%; }
.cn-object {
  position: relative;
  z-index: 1;
  min-width: 0;
}
.cn-object__lost {
  margin: 0;
  font-family: var(--font-serif);
  font-style: italic;
  font-size: 14px;
  line-height: 1.45;
  color: var(--cn-soft);
}
.cn-letter--mine .cn-object__lost { text-align: right; }
.cn-letter--object .cn-foot { margin-top: 6px; }

/* ─── Surprises : le pétale glissé dans la marge ─── */
.cn-petal {
  position: absolute;
  z-index: 2;
  top: 0;
  left: -22px;
  line-height: 0;
  pointer-events: none;
}
.cn-petal.is-waiting { visibility: hidden; } /* les pétales n'ont pas encore fini de tomber ici : celui-ci se posera ensuite */

/* Le ciel de la nuit blanche, gravé sous les lettres de sa page ; pas encore vu ici, il attend d'être sous les yeux. */
.cn-page--sky { isolation: isolate; }
.cn-page--sky-hold > .ms-sky { visibility: hidden; }

/* L'empreinte du premier Effleurement, en tête de la toute première page. */
.cn-thumb {
  display: flex;
  justify-content: center;
  margin: -2px 0 6px;
  line-height: 0;
}
.cn-thumb.is-waiting { visibility: hidden; }
.cn-thumb.is-fresh { animation: cn-imprint 1300ms var(--ease) both; }
@keyframes cn-imprint {
  from { opacity: 0; transform: scale(.94); }
}

/* Le nœud du centième jour : sur le fil, en haut du carnet, toujours à portée en lisant. */
.cn-knot {
  position: sticky;
  top: 0;
  z-index: 3;
  flex: none;
  height: 0;
}
.cn-knot__pin {
  position: absolute;
  top: 4px;
  left: calc(var(--cn-thread-x) + .75px - 22px); /* le fil passe au milieu du nœud */
  width: 44px;
  height: 56px;
  line-height: 0;
}
/* Le fil court à 15-17 px du bord : le bord gauche du bouton est rogné par la zone défilante ;
   sa cible s'allonge d'autant vers la droite (44 px de large au moins). */
.cn-knot .ms-knot::after {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  left: 100%;
  width: 8px;
}

/* ─── Feuille « Votre toute première lettre » ─── */
.cn-first {
  --cn-soft: rgba(var(--ink-rgb),  .84);
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.cn-first__date {
  margin: 0;
  text-align: center;
  font-family: var(--font-serif);
  font-style: italic;
  font-weight: 400;
  font-size: 15px;
  line-height: 1.45;
  color: var(--cn-soft);
}
.cn-first__paper {
  position: relative;
  padding: 18px 18px 14px 28px;
  border-radius: 18px;
  background: var(--milk);
  box-shadow: var(--emboss-sm), inset 1px 1px 0 rgba(var(--light-rgb), calc(.95 * var(--hl-a)));
}
/* Le fil rouge court aussi dans sa marge. */
.cn-first__paper::before {
  content: "";
  position: absolute;
  top: 14px;
  bottom: 14px;
  left: 13px;
  width: 1.5px;
  border-radius: 1px;
  background: var(--thread);
  opacity: .9;
  pointer-events: none;
}
.cn-first__text {
  margin: 0;
  min-height: 1.15em;
  font-family: var(--font-hand);
  font-weight: 500;
  font-size: 24px;
  line-height: 1.15;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  color: var(--sepia);
}
.cn-first__text--mine { color: var(--ink); }
.cn-first__sign {
  margin: 8px 0 0;
  text-align: right;
  font-family: var(--font-hand);
  font-weight: 500;
  font-size: 22px;
  line-height: 1.1;
  color: var(--sepia);
}
.cn-first__text--mine + .cn-first__sign { color: var(--ink); }
.cn-first__object {
  font-family: var(--font-serif);
  font-style: italic;
  font-weight: 400;
  font-size: 15px;
  color: var(--cn-soft);
}
.cn-first__close {
  align-self: center;
  min-height: 44px;
  color: var(--cn-soft);
}

/* ═══════════════ Le corps et la musique (phase 4) ═══════════════ */

/* ─── En-tête : le Salon puis le souffle, entre le prénom et la paupière ─── */
.cn-head > .sl-btn,
.cn-head > .br-btn { flex: none; }
.cn-head > .sl-btn { transition: opacity var(--mid) var(--ease); }
.cn-head > .sl-btn:disabled { opacity: .42; cursor: default; } /* le carnet s'ouvre encore */

/* ─── Le double du fil rouge : invisible, posé sur le fil, c'est lui que le battement fait luire ─── */
.cn-thread-beat {
  position: absolute;
  top: 0;
  bottom: 0;
  left: var(--cn-thread-x);
  width: 1.5px;
  border-radius: 1px;
  pointer-events: none;
}

/* ─── Feuilles de proposition (effleurer, souffle, cœurs) : ce que l'effet fait, en une phrase ─── */
.cn-ask__desc {
  margin: -8px 0 18px;
  font-family: var(--font-ui);
  font-size: 13.5px;
  line-height: 1.45;
  color: var(--cn-soft);
}

/* ─── L'invitation au Salon, en fin de page (avant les cartes de consentement) ─── */
.cn-salon-slot {
  display: flex;
  flex-direction: column;
}
.cn-salon {
  margin-top: 18px;
  min-width: 0;
  transition: opacity 500ms var(--ease), transform 500ms var(--ease);
}
.cn-salon.is-leaving { opacity: 0; transform: translateY(4px); pointer-events: none; }

/* ─── La fenêtre d'écoute du Salon (ARCHITECTURE § 15.3), dans un coin du bas : à 84 px du bas, 261 px de haut
   (vidéo 200 × 200, marges, barre), soit jusqu'à 345 px au-dessus de la zone sûre ───
   La dernière page garde sous elle de quoi passer au-dessus de la fenêtre (345 − 65 px de ligne d'écriture + 13) ;
   dans un coin du haut, rien n'est réservé. La ligne d'écriture ne monte jamais jusqu'à elle (deux lignes, le
   reste défile dans le champ). Déjà pendant la vue pleine (qui couvre le carnet ; son coin n'y est pas dit) :
   en se repliant dans un coin du bas, rien ne saute.
   Écran bas (clavier ouvert, téléphone en paysage) : la fenêtre couvre presque toute la hauteur du carnet, qui
   reste calé en bas ; la marge ne dépasse pas la zone qui défile (en-tête 56 + ligne 65) moins 100 px, pour
   qu'une bande de lettres reste lisible, à côté de la fenêtre. Sur écran tactile, pendant qu'on écrit (clavier
   ouvert, que 100dvh ignore sur iPhone), la marge revient à 96 px : les dernières lettres restent à côté d'elle. */
html[data-salon="open"] .cn-page--last,
html[data-salon="dock"]:not([data-salon-coin^="haut"]) .cn-page--last { padding-bottom: 293px; }
@supports (height: 1dvh) {
  html[data-salon="open"] .cn-page--last,
  html[data-salon="dock"]:not([data-salon-coin^="haut"]) .cn-page--last {
    padding-bottom: clamp(96px, calc(100dvh - 221px - var(--safe-top) - var(--safe-bottom)), 293px);
  }
}
@media (pointer: coarse) {
  html[data-salon="dock"]:not([data-salon-coin^="haut"]) .cn:has(.cn-input:focus) .cn-page--last { padding-bottom: 96px; }
}
html[data-salon="open"] .cn-input,
html[data-salon="dock"] .cn-input { max-height: calc(var(--cn-line) * 2 + 8px); }

/* ─── Petits écrans ─── */
@media (max-width: 380px) {
  .cn { --cn-margin: 30px; --cn-right: 10px; --cn-thread-x: -16px; }
  .cn-page { padding-left: 13px; padding-right: 13px; }
  .cn-letter--mine { margin-left: 14%; }
  .cn-letter--object.cn-letter--mine { margin-left: 6%; }
  .cn-name { font-size: 28px; }
  .cn-held__seal { left: -24px; }
  .cn-petal { left: -19px; }
  /* Six éléments dans l'en-tête : le prénom garde la place (ellipse), les boutons leurs 44 px ;
     la paupière et le sceau, qui ne se touchent pas, se resserrent. */
  .cn-head { gap: 0; padding-right: 6px; }
  .cn-presence { width: 34px; }
  .cn-seal { width: 38px; }
}

/* ─── Mouvement réduit : plus de mise en scène, seulement des fondus ─── */
@media (prefers-reduced-motion: reduce) {
  .cn-letter.is-new,
  .cn-consent.is-new,
  .cn-stain.is-fresh,
  .cn-letter--drying .cn-text { animation: none; }
  .cn-drop.is-fresh .pc-drop { animation: none; }
  .cn-letter--wet .cn-text {
    animation: none;
    background-position: 50% 0;
  }
  .cn-letter,
  .cn-write,
  .cn-head { transition: none; }
  .cn-letter--held.is-sealing,
  .cn-letter--held.is-sealing .cn-held__seal,
  .cn-letter.is-unveiled .cn-text,
  .cn-env.is-new { animation: none; }
  .cn-env.is-leaving,
  .cn-salon.is-leaving { transform: none; }
  .cn-send.is-pressing { transform: none; }
  /* L'empreinte qui reste apparaît en simple fondu (porcelaine.css ramène les durées à presque rien). */
  .cn-thumb.is-fresh { animation: cn-fade 900ms ease both !important; }
}
@keyframes cn-fade {
  from { opacity: 0; }
}
