/* Tattle Phone — Pierre Laé
   Site public (index.html). Le ciel et les lumières suivent l'heure : html[data-ciel] (voir js/tp-ciel.js). */

:root {
  --nuit: #1f2a5a;
  --jaune: #f4b63f;
  --jaune-clair: #ffd77a;
  --jaune-fonce: #c98a1c;
  --blanc: #ffffff;
  --rouge: #e5484d;
  --rouge-fonce: #c2353a;
  --ciel-clair: #e9f5ff;
  --ombre: 0 18px 50px rgba(18, 52, 110, .22), 0 2px 8px rgba(18, 52, 110, .12);
  --rayon: 28px;
  --titre: "Fraunces", Georgia, "Times New Roman", serif;
  --texte: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --ressort: cubic-bezier(.2, 1.35, .35, 1);
  --doux: cubic-bezier(.22, .8, .25, 1);
  /* ambiance (jour par défaut) */
  --nuages: none;
  --tel: none;
  --lumiere: none;
  --lumiere-op: 0;
  --veille: 0;
  --voile: radial-gradient(circle at 50% 45%, #fff 0%, #f3f9ff 55%, #d9ecff 100%);
  --ombre-tel: rgba(40, 70, 130, .42);
  --fond: #2f8fdb;
  color-scheme: light;
}

/* ---------- Six ambiances selon la hauteur du soleil ---------- */
html[data-ciel="aube"] {
  --nuages: sepia(.45) saturate(1.9) hue-rotate(-32deg) brightness(1.02);
  --tel: saturate(1.04) brightness(.97);
  --lumiere: linear-gradient(250deg, rgba(255, 150, 165, .9), rgba(255, 196, 170, .35) 45%, rgba(140, 130, 230, .45));
  --lumiere-op: .75;
  --voile: radial-gradient(circle at 50% 45%, #fff 0%, #ffe9ee 55%, #f3cfe0 100%);
  --ombre-tel: rgba(120, 70, 130, .35);
  --fond: #e9a6a0;
}
html[data-ciel="aprem"] {
  --nuages: sepia(.55) saturate(1.7) hue-rotate(-10deg) brightness(1.03);
  --tel: sepia(.12) saturate(1.12) brightness(1.02);
  --lumiere: linear-gradient(215deg, rgba(255, 205, 110, .95), rgba(255, 175, 80, .3) 50%, rgba(70, 80, 160, .4));
  --lumiere-op: .8;
  --voile: radial-gradient(circle at 50% 45%, #fff 0%, #fff4dd 55%, #f7dfb0 100%);
  --ombre-tel: rgba(110, 80, 60, .38);
  --fond: #d9a24e;
}
html[data-ciel="coucher"] {
  --nuages: sepia(.75) saturate(2.8) hue-rotate(-34deg) brightness(.8) contrast(1.06);
  --tel: brightness(.84) saturate(1.12) sepia(.22) hue-rotate(-8deg);
  --lumiere: linear-gradient(255deg, rgba(255, 105, 40, 1), rgba(255, 70, 90, .45) 42%, rgba(60, 30, 120, .75));
  --lumiere-op: .95;
  --voile: radial-gradient(circle at 50% 45%, #ffe3c9 0%, #f6a37f 55%, #7a3a6a 100%);
  --ombre-tel: rgba(60, 20, 60, .5);
  --fond: #c8566a;
}
html[data-ciel="crepuscule"] {
  --nuages: brightness(.72) sepia(.4) hue-rotate(208deg) saturate(1.7);
  --tel: brightness(.78) saturate(.9) hue-rotate(-4deg);
  --lumiere: linear-gradient(240deg, rgba(255, 140, 175, .7), rgba(120, 95, 210, .5) 50%, rgba(25, 25, 90, .8));
  --lumiere-op: .9;
  --veille: .22;
  --voile: radial-gradient(circle at 50% 45%, #d9d3ff 0%, #8f86d6 55%, #2e2f6e 100%);
  --ombre-tel: rgba(15, 15, 50, .5);
  --fond: #2e2f6e;
}
html[data-ciel="nuit"] {
  --nuages: brightness(.42) sepia(.5) hue-rotate(182deg) saturate(1.9) contrast(1.1);
  --tel: brightness(.68) saturate(.95) contrast(1.06);
  --lumiere: linear-gradient(210deg, rgba(200, 222, 255, 1), rgba(120, 150, 235, .35) 42%, rgba(5, 15, 55, .7));
  --lumiere-op: 1;
  --veille: .42;
  --voile: radial-gradient(circle at 50% 45%, #2a3a72 0%, #142152 55%, #070f2e 100%);
  --ombre-tel: rgba(0, 5, 25, .6);
  --fond: #0b1736;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
html { overflow: hidden; }
body {
  font-family: var(--texte); color: var(--nuit); background: var(--fond); overflow: hidden;
  -webkit-font-smoothing: antialiased; -webkit-tap-highlight-color: transparent; overscroll-behavior: none;
  transition: background-color 2.4s;
}
button, input { font: inherit; color: inherit; }
button { cursor: pointer; border: 0; background: none; padding: 0; }
img { display: block; max-width: none; user-select: none; -webkit-user-drag: none; }
svg.ic { width: 1.25em; height: 1.25em; flex: none; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
:focus-visible { outline: 3px solid var(--jaune); outline-offset: 3px; border-radius: 12px; }

/* ---------- Ciel ---------- */
.ciel { position: fixed; inset: 0; overflow: hidden; z-index: 0; }
.ciel-fond { position: absolute; inset: -3%; background: var(--fond) center / cover no-repeat; transition: opacity 2.4s ease; }
.ciel-fond.arrive { opacity: 0; }
.ciel-fond[data-c="aube"] { background-image: url(../img/ciel-aube-1920.webp); }
.ciel-fond[data-c="jour"] { background-image: url(../img/ciel-jour-1920.webp); }
.ciel-fond[data-c="aprem"] { background-image: url(../img/ciel-aprem-1920.webp); }
.ciel-fond[data-c="coucher"] { background-image: url(../img/ciel-coucher-1920.webp); }
.ciel-fond[data-c="crepuscule"] { background-image: url(../img/ciel-crepuscule-1920.webp); }
.ciel-fond[data-c="nuit"] { background-image: url(../img/ciel-nuit-1920.webp); }
@media (min-width: 2000px), (min-width: 1300px) and (min-resolution: 2dppx) {
  .ciel-fond[data-c="aube"] { background-image: url(../img/ciel-aube-4k.webp); }
  .ciel-fond[data-c="jour"] { background-image: url(../img/ciel-jour-4k.webp); }
  .ciel-fond[data-c="aprem"] { background-image: url(../img/ciel-aprem-4k.webp); }
  .ciel-fond[data-c="coucher"] { background-image: url(../img/ciel-coucher-4k.webp); }
  .ciel-fond[data-c="crepuscule"] { background-image: url(../img/ciel-crepuscule-4k.webp); }
  .ciel-fond[data-c="nuit"] { background-image: url(../img/ciel-nuit-4k.webp); }
}
@media (max-aspect-ratio: 3/4) {
  .ciel-fond[data-c="aube"] { background-image: url(../img/ciel-aube-mobile.webp); }
  .ciel-fond[data-c="jour"] { background-image: url(../img/ciel-jour-mobile.webp); }
  .ciel-fond[data-c="aprem"] { background-image: url(../img/ciel-aprem-mobile.webp); }
  .ciel-fond[data-c="coucher"] { background-image: url(../img/ciel-coucher-mobile.webp); }
  .ciel-fond[data-c="crepuscule"] { background-image: url(../img/ciel-crepuscule-mobile.webp); }
  .ciel-fond[data-c="nuit"] { background-image: url(../img/ciel-nuit-mobile.webp); }
}
.ciel-plan { position: absolute; inset: 0; will-change: transform; filter: var(--nuages); transition: filter 2.4s; }
.nuage { position: absolute; pointer-events: none; }
.nuage.n1 { width: 34vw; min-width: 260px; left: -6vw; top: 14vh; opacity: .92; animation: derive 70s ease-in-out infinite alternate; }
.nuage.n2 { width: 22vw; min-width: 170px; right: 6vw; top: 9vh; opacity: .85; animation: derive 55s ease-in-out -20s infinite alternate-reverse; }
.nuage.n3 { width: 14vw; min-width: 120px; left: 30vw; top: 4vh; opacity: .7; animation: derive 80s ease-in-out -35s infinite alternate; }
.nuage.n4 { width: 48vw; min-width: 380px; right: -14vw; bottom: -6vh; animation: derive 90s ease-in-out -10s infinite alternate-reverse; }
.nuage.n5 { width: 44vw; min-width: 360px; left: -16vw; bottom: -10vh; transform: scaleX(-1); animation: derive 75s ease-in-out -50s infinite alternate; }
@keyframes derive { from { translate: -3vw 0; } to { translate: 3vw 0; } }
html[data-ciel="nuit"] .nuage.n1, html[data-ciel="nuit"] .nuage.n2, html[data-ciel="nuit"] .nuage.n3 { opacity: .55; }

/* étoiles */
.etoiles { position: absolute; inset: 0; opacity: 0; transition: opacity 2.4s; pointer-events: none; }
html[data-ciel="nuit"] .etoiles { opacity: 1; }
html[data-ciel="crepuscule"] .etoiles { opacity: .55; }
.etoiles i { position: absolute; width: var(--t); height: var(--t); border-radius: 50%; background: #fff; box-shadow: 0 0 6px 1px rgba(255, 255, 255, .8); animation: scintille var(--d) ease-in-out var(--r) infinite alternate; }
@keyframes scintille { from { opacity: .15; transform: scale(.7); } to { opacity: 1; transform: scale(1.15); } }
.filante { position: absolute; width: 140px; height: 2px; border-radius: 2px; opacity: 0; transform: rotate(18deg); background: linear-gradient(90deg, rgba(255, 255, 255, 0), #fff); }
.filante.part { animation: file 1.1s ease-out forwards; }
@keyframes file { 0% { opacity: 0; translate: 0 0; } 15% { opacity: 1; } 100% { opacity: 0; translate: 260px 85px; } }

/* rideau de nuages à l'arrivée */
.rideau { position: fixed; inset: 0; z-index: 30; pointer-events: none; overflow: hidden; }
.rideau img { position: absolute; width: 95vmax; top: 50%; translate: 0 -50%; transition: transform 1.5s var(--doux), opacity 1.2s ease; filter: var(--nuages); }
.rideau .r-g { right: 38%; }
.rideau .r-d { left: 32%; }
.rideau .voile { position: absolute; inset: 0; background: var(--voile); transition: opacity 1.1s ease .15s; }
body.ouvert .rideau .r-g { transform: translateX(-75vw) scale(1.15); opacity: 0; }
body.ouvert .rideau .r-d { transform: translateX(75vw) scale(1.15); opacity: 0; }
body.ouvert .rideau .voile { opacity: 0; }
body.ouvert .rideau { visibility: hidden; transition: visibility 0s 1.6s; }

/* ---------- Haut de page ---------- */
.haut {
  position: fixed; top: 0; left: 0; right: 0; z-index: 20; display: flex; align-items: center; justify-content: space-between;
  padding: max(14px, env(safe-area-inset-top)) max(18px, env(safe-area-inset-right)) 0 max(18px, env(safe-area-inset-left)); color: var(--blanc);
}
.marque { font-family: var(--titre); font-style: italic; font-weight: 600; font-size: 22px; color: var(--blanc); text-decoration: none; text-shadow: 0 1px 12px rgba(10, 40, 90, .35); }
.haut-droite { display: flex; gap: 6px; align-items: center; position: relative; }
.liens { display: flex; gap: 6px; }
.haut-droite .plus-haut { display: none; }
@media (max-width: 520px) {
  .rond { width: 38px; height: 38px; }
  .haut-droite .plus-haut { display: grid; }
  .liens { display: none; position: absolute; top: calc(100% + 8px); right: 0; flex-direction: column; padding: 8px; border-radius: 22px; background: rgba(20, 35, 80, .82); -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px); box-shadow: 0 12px 30px rgba(5, 15, 50, .35); }
  .liens.ouvert { display: flex; animation: entre .25s var(--doux); }
}
.rond { width: 42px; height: 42px; border-radius: 50%; display: grid; place-items: center; color: var(--blanc); background: rgba(255, 255, 255, .16); border: 1px solid rgba(255, 255, 255, .35); transition: background .2s, transform .15s; }
.rond:hover { background: rgba(255, 255, 255, .3); }
.rond:active { transform: scale(.92); }
.rond svg.ic { width: 20px; height: 20px; }

/* ---------- Scène ---------- */
.scene {
  position: relative; z-index: 5; height: 100%; height: 100dvh; overflow: hidden; overflow: clip; display: grid; grid-template-rows: auto 1fr auto; justify-items: center;
  padding: calc(max(14px, env(safe-area-inset-top)) + 58px) 16px calc(max(14px, env(safe-area-inset-bottom)) + 8px);
}
.accroche { text-align: center; color: var(--blanc); transition: opacity .5s var(--doux), transform .6s var(--doux), translate .85s var(--doux), scale .85s var(--doux); position: relative; z-index: 8; }
.devise { margin: 0 0 4px; font-size: 13px; font-weight: 700; letter-spacing: .22em; text-transform: uppercase; text-shadow: 0 1px 10px rgba(10, 40, 90, .35); }
h1 { margin: 0; font-family: var(--titre); font-weight: 800; font-size: clamp(34px, min(8vw, 9.5vh), 88px); line-height: .95; letter-spacing: -.02em; text-shadow: 0 3px 30px rgba(8, 40, 100, .35); }
h1 .l { display: inline-block; opacity: 0; transform: translateY(.45em) rotate(4deg); }
body.ouvert h1 .l { animation: lettre .8s var(--ressort) forwards; animation-delay: calc(.95s + var(--i) * 45ms); }
@keyframes lettre { to { opacity: 1; transform: none; } }
.question { position: relative; margin: clamp(8px, 1.8vh, 16px) auto 0; max-width: min(540px, calc(100vw - 32px)); padding: clamp(8px, 1.4vh, 13px) 20px clamp(9px, 1.5vh, 14px); border-radius: 22px; background: var(--blanc); color: var(--nuit); box-shadow: var(--ombre); opacity: 0; transform: translateY(14px) scale(.96); }
body.ouvert .question { animation: pop .7s var(--ressort) 1.45s forwards; }
@keyframes pop { to { opacity: 1; transform: none; } }
.question::after { content: ""; position: absolute; left: 50%; bottom: -9px; width: 20px; height: 20px; background: var(--blanc); transform: translateX(-50%) rotate(45deg); border-radius: 0 0 5px 0; }
.q-tete { display: flex; align-items: center; justify-content: center; gap: 8px; font-size: 12px; font-weight: 800; letter-spacing: .14em; text-transform: uppercase; color: var(--jaune-fonce); }
.q-texte { margin: 4px 0 0; font-family: var(--titre); font-weight: 600; font-size: clamp(16px, min(2.4vw, 3vh), 25px); line-height: 1.2; min-height: 1.2em; }
.q-fleche { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; color: var(--nuit); background: var(--ciel-clair); }
.q-fleche[hidden] { display: none; }
.q-points { display: flex; gap: 5px; }
.q-points i { width: 6px; height: 6px; border-radius: 50%; background: #cfe3f5; }
.q-points i.on { background: var(--jaune-fonce); }
body[data-etat="enreg"] .q-fleche { visibility: hidden; }

/* ---------- Combiné levé : les titres laissent la place ---------- */
/* grand écran : ils glissent là où le panneau arrivera (--ax, --ay, --as) ; écran étroit : le titre s'efface et la question monte (--qy) */
.devise, h1 { transition: opacity .35s ease; }
.question { transition: translate .7s var(--doux); }
body.decale:not(.etroit) .accroche { translate: var(--ax, 0px) var(--ay, 0px); scale: var(--as, 1); }
body.decale.etroit .devise, body.decale.etroit h1 { opacity: 0; }
body.decale.etroit .question { translate: 0 var(--qy, 0px); }
body.decale .zone-tel { z-index: 9; }
body.decale .bas { z-index: 10; }
body.decale:not(.etroit) .bas { translate: var(--bx, 0px) 0; }
/* bec de la bulle : vers le bas quand le téléphone est dessous, vers la gauche quand il est à côté */
.question::after { transition: opacity .25s ease .45s; }
.question::before { content: ""; position: absolute; left: -9px; top: 50%; width: 20px; height: 20px; background: var(--blanc); transform: translateY(-50%) rotate(45deg); border-radius: 0 0 0 5px; opacity: 0; transition: opacity .2s ease; }
body.decale:not(.etroit) .question::after { opacity: 0; transition-delay: 0s; }
body.decale:not(.etroit) .question::before { opacity: 1; transition: opacity .3s ease .6s; }

/* ---------- Le téléphone ---------- */
.zone-tel { position: relative; align-self: center; width: min(540px, 84vw, 45vh); aspect-ratio: 3791 / 3553; margin-top: 10px; transition: transform .9s var(--doux); }
body:not([data-etat="pose"]) .zone-tel { transform: translate(var(--tx, 0px), var(--ty, 0px)) scale(var(--sc, 1)); }
.atterrit { position: absolute; inset: 0; transform: translateY(-130vh); }
body.ouvert .atterrit { animation: chute 1.25s var(--ressort) .35s forwards; }
@keyframes chute { 0% { transform: translateY(-130vh) rotate(-6deg); } 70% { transform: translateY(2%) rotate(1deg); } 100% { transform: none; } }
.coussin { position: absolute; width: 175%; left: -37.5%; top: 70%; pointer-events: none; filter: var(--nuages); transition: filter 2.4s; }
body.ouvert .coussin { animation: tasse .7s var(--ressort) 1.05s; transform-origin: 50% 30%; }
@keyframes tasse { 35% { transform: scale(1.04, .9); } }
.devant { position: absolute; pointer-events: none; z-index: 6; filter: var(--nuages); transition: filter 2.4s; }
.devant.d1 { width: 46%; left: -24%; top: 78%; }
.devant.d2 { width: 36%; right: -20%; top: 83%; transform: scaleX(-1); }
.flotte { position: absolute; inset: 0; animation: flotte 6s ease-in-out infinite; }
@keyframes flotte { 50% { transform: translateY(-1.6%); } }
.tel-3d { position: absolute; inset: 0; transform-style: preserve-3d; transform: perspective(1400px) rotateX(var(--rx, 0deg)) rotateY(var(--ry, 0deg)); }
.ombre-tel { position: absolute; left: 14%; right: 14%; bottom: -4%; height: 12%; border-radius: 50%; background: radial-gradient(closest-side, var(--ombre-tel), transparent); }
canvas.cordon { position: absolute; z-index: 1; pointer-events: none; filter: var(--tel); transition: filter 2.4s; }

.bloc-socle { position: absolute; inset: 0; z-index: 2; }
.socle { position: absolute; left: 10.683%; top: 1.492%; width: 78.607%; height: auto; filter: var(--tel); transition: filter 2.4s; cursor: pointer; }
.combine { position: absolute; left: 0; top: 0; width: 100%; z-index: 4; display: block; transform-origin: 50% 50%; cursor: grab; touch-action: none; border-radius: 30%; }
.combine:active { cursor: grabbing; }
.combine:focus-visible { outline-offset: -10px; }
.combine img { width: 100%; height: auto; filter: var(--tel); transition: filter 2.4s; }
.lumiere { position: absolute; pointer-events: none; mix-blend-mode: soft-light; background: var(--lumiere); opacity: var(--lumiere-op); transition: opacity 2.4s; -webkit-mask-size: 100% 100%; mask-size: 100% 100%; -webkit-mask-repeat: no-repeat; mask-repeat: no-repeat; }
.l-socle { left: 10.683%; top: 1.492%; width: 78.607%; aspect-ratio: 2980 / 3500; -webkit-mask-image: url(../img/socle-800.webp); mask-image: url(../img/socle-800.webp); }
.l-combine { inset: 0; -webkit-mask-image: url(../img/combine-800.webp); mask-image: url(../img/combine-800.webp); }

/* les touches du cadran s'allument */
.cadran { position: absolute; inset: 0; pointer-events: none; }
.touche {
  position: absolute; width: 6.2%; aspect-ratio: 1; transform: translate(-50%, -50%) scale(1.15); border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 236, 170, .32) 0 37%, rgba(255, 228, 135, 1) 45%, rgba(255, 196, 70, .5) 56%, rgba(255, 190, 60, 0) 72%);
  mix-blend-mode: screen; opacity: var(--veille); transition: opacity .1s linear;
}
html[data-ciel="nuit"] body[data-etat="pose"] .touche, html[data-ciel="crepuscule"] body[data-etat="pose"] .touche { animation: veille 3.2s ease-in-out infinite alternate; }
@keyframes veille { from { opacity: calc(var(--veille) * .5); } to { opacity: var(--veille); } }
.touche.on { opacity: 1 !important; animation: none !important; }

/* l'écran au centre du cadran : REC, chrono, lecture */
.etiquette {
  position: absolute; left: 50.13%; top: 54.07%; width: 20.4%; aspect-ratio: 818 / 761; border-radius: 50%;
  display: block; color: var(--nuit); background: radial-gradient(circle at 50% 35%, #ffffff, #eceef6);
  box-shadow: inset 0 2px 7px rgba(10, 20, 60, .22), 0 0 0 2px rgba(255, 255, 255, .5);
  font-size: calc(var(--tw, 450) * .031px); opacity: 0; transform: translate(-50%, -50%) scale(.8); pointer-events: none;
  transition: opacity .35s ease, transform .5s var(--ressort);
}
body:not([data-etat="pose"]) .etiquette { opacity: 1; transform: translate(-50%, -50%) scale(1); }
body[data-etat="ecoute"] .etiquette { pointer-events: auto; cursor: pointer; }
body[data-etat="ecoute"] .etiquette:hover { transform: translate(-50%, -50%) scale(1.05); }
html[data-ciel="nuit"] .etiquette, html[data-ciel="crepuscule"] .etiquette { box-shadow: inset 0 2px 7px rgba(10, 20, 60, .22), 0 0 24px 6px rgba(255, 236, 190, .45); }
.anneau { position: absolute; inset: -5%; width: 110%; height: 110%; transform: rotate(-90deg); pointer-events: none; }
.anneau circle { fill: none; stroke: var(--jaune); stroke-width: 5; stroke-dasharray: 1; stroke-dashoffset: 1; stroke-linecap: round; }
body:not([data-etat="ecoute"]) .anneau circle { stroke-dashoffset: 1 !important; }
.e-in { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .15em; line-height: 1; white-space: nowrap; }
.e-in b { font-size: 1.5em; font-weight: 800; font-variant-numeric: tabular-nums; }
.rec { display: flex; align-items: center; gap: .3em; font-weight: 900; font-size: .78em; letter-spacing: .1em; color: var(--rouge); }
.rec i { width: .65em; height: .65em; border-radius: 50%; background: var(--rouge); animation: clign 1s steps(2, start) infinite; }
@keyframes clign { to { visibility: hidden; } }
.e-ic { width: 2em; height: 2em; fill: currentColor; stroke: none; }
.e-merci .e-ic { fill: none; stroke: #1a8a4a; stroke-width: 3.2; width: 2.6em; height: 2.6em; stroke-dasharray: 40; stroke-dashoffset: 40; animation: trace .6s ease .1s forwards; }
@keyframes trace { to { stroke-dashoffset: 0; } }
.attente { display: flex; gap: .25em; }
.attente i { width: .45em; height: .45em; border-radius: 50%; background: var(--nuit); animation: rebond .9s ease-in-out infinite; }
.attente i:nth-child(2) { animation-delay: .15s; } .attente i:nth-child(3) { animation-delay: .3s; }
@keyframes rebond { 50% { transform: translateY(-.35em); opacity: .5; } }
.etiquette.calcul::after { content: ""; position: absolute; inset: 0; border-radius: 50%; background: linear-gradient(100deg, transparent 25%, rgba(255, 255, 255, .85) 50%, transparent 75%) -200% 0 / 200% 100%; animation: reflet 1s linear infinite; }
@keyframes reflet { to { background-position: 200% 0; } }

/* ---------- Consigne sous le téléphone ---------- */
.bas { display: flex; justify-content: center; position: relative; z-index: 8; transition: opacity .4s, transform .5s var(--doux), translate .9s var(--doux); }
.consigne {
  display: inline-flex; align-items: center; gap: 10px; min-height: 48px; padding: 10px 20px 10px 14px; border-radius: 999px;
  background: rgba(255, 255, 255, .92); color: var(--nuit); font-weight: 800; font-size: 16px; box-shadow: var(--ombre);
  opacity: 0; transform: translateY(20px); max-width: calc(100vw - 32px); text-align: left;
}
body.ouvert .consigne { animation: pop .7s var(--ressort) 1.75s forwards; }
.consigne svg.ic { width: 22px; height: 22px; flex: none; }
.c-main { width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; background: var(--jaune); animation: invite 2.2s ease-in-out infinite; }
.c-main svg.ic { width: 18px; height: 18px; }
@keyframes invite { 0%, 60%, 100% { transform: translateY(0); } 30% { transform: translateY(-5px); } }
.consigne b { font-variant-numeric: tabular-nums; min-width: 2.6em; }
.point-rec { width: 12px; height: 12px; border-radius: 50%; background: var(--rouge); flex: none; animation: clign 1s steps(2, start) infinite; margin-left: 4px; }
.consigne .onde { display: inline-flex; gap: 3px; align-items: center; height: 16px; margin-left: 4px; }
.consigne .onde i { width: 3px; border-radius: 2px; background: var(--nuit); height: 40%; animation: onde .9s ease-in-out infinite; }
.consigne .onde i:nth-child(2) { animation-delay: -.3s; } .consigne .onde i:nth-child(3) { animation-delay: -.6s; }
@keyframes onde { 50% { height: 100%; } }
body[data-etat="ecoute"] .bas, body[data-etat="merci"] .bas, body[data-etat="calcul"] .bas { opacity: 0; transform: translateY(30px); pointer-events: none; }
body[data-etat="ecoute"] .accroche, body[data-etat="merci"] .accroche { opacity: 0; transform: translateY(-30px); pointer-events: none; }

/* ---------- Panneau : ton message, les options, l'envoi ---------- */
.panneau { position: fixed; z-index: 15; background: var(--blanc); color: var(--nuit); box-shadow: var(--ombre); display: flex; flex-direction: column; overflow: hidden; visibility: hidden; opacity: 0; transition: transform .6s var(--ressort), opacity .35s ease, visibility 0s .6s; }
body[data-etat="ecoute"] .panneau, body[data-etat="merci"] .panneau { visibility: visible; opacity: 1; transition: transform .7s var(--ressort) .15s, opacity .35s ease .15s, visibility 0s; }
.p-tete { flex: none; display: flex; align-items: flex-start; gap: 10px; padding: 20px 16px 0 22px; }
.p-question { flex: 1; min-width: 0; }
.p-etiquette { font-size: 11px; font-weight: 800; letter-spacing: .14em; text-transform: uppercase; color: var(--jaune-fonce); }
.p-etiquette span { font-variant-numeric: tabular-nums; }
.p-question p { margin: 3px 0 0; font-family: var(--titre); font-weight: 650; font-size: 21px; line-height: 1.18; }
.b-effacer { width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center; flex: none; color: var(--nuit); background: var(--ciel-clair); }
.b-effacer:hover { background: #ffe8e8; color: var(--rouge-fonce); }
.p-corps { flex: 1; overflow-y: auto; overscroll-behavior: contain; padding: 12px 22px max(18px, env(safe-area-inset-bottom)); }
.etape { display: none; flex-direction: column; gap: 12px; }
body[data-etat="ecoute"] .e-ecoute, body[data-etat="merci"] .e-merci { display: flex; animation: entre .45s var(--doux); }
@keyframes entre { from { opacity: 0; transform: translateY(10px); } }
body[data-etat="merci"] .p-tete { display: none; }
.astuce { margin: 0; display: flex; flex-wrap: wrap; gap: 6px; font-size: 13px; font-weight: 700; }
.astuce span { display: inline-flex; align-items: center; gap: 6px; padding: 6px 10px; border-radius: 999px; background: #fff5da; }
.astuce svg.ic { width: 15px; height: 15px; }
.pastilles { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; }
.pastille { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-width: 0; white-space: nowrap; padding: 10px 6px; border-radius: 999px; font-size: clamp(13px, 3.6vw, 15px) !important; background: var(--ciel-clair); color: var(--nuit); font-weight: 700; font-size: 15px; transition: background .15s, color .15s, transform .12s; }
.pastille:active { transform: scale(.95); }
.pastille[aria-pressed="true"] { background: var(--nuit); color: var(--blanc); }
.pastille .compte { min-width: 20px; height: 20px; padding: 0 6px; border-radius: 10px; background: var(--jaune); color: var(--nuit); font-size: 12px; display: grid; place-items: center; }
.pastille .compte:empty { display: none; }
.volet { display: none; flex-direction: column; gap: 10px; padding: 12px; border-radius: 20px; background: #f6faff; border: 1px solid #dcebf8; }
.volet.ouvert { display: flex; animation: entre .35s var(--doux); }
.voix { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.voix button { display: flex; align-items: center; justify-content: center; gap: 6px; height: 46px; padding: 0 6px; border-radius: 14px; background: var(--blanc); border: 2px solid #dcebf8; font-weight: 700; font-size: 14px; }
.voix button svg.ic { width: 20px; height: 20px; }
.voix button[aria-pressed="true"] { border-color: var(--nuit); background: var(--nuit); color: var(--blanc); }
.photos { display: flex; gap: 8px; flex-wrap: wrap; }
.photos .vignette { position: relative; width: 64px; height: 64px; border-radius: 14px; overflow: hidden; background: #dcebf8; }
.photos .vignette img { width: 100%; height: 100%; object-fit: cover; }
.photos .vignette button { position: absolute; top: 4px; right: 4px; width: 24px; height: 24px; border-radius: 50%; background: rgba(31, 42, 90, .85); color: var(--blanc); display: grid; place-items: center; }
.photos .vignette button svg.ic { width: 14px; height: 14px; stroke-width: 3; }
.photos .ajout { width: 64px; height: 64px; border-radius: 14px; border: 2px dashed #9cc3e6; display: grid; place-items: center; color: var(--nuit); background: var(--blanc); }
.champ { display: flex; align-items: center; gap: 10px; padding: 0 14px; height: 48px; border-radius: 16px; background: var(--blanc); border: 2px solid #dcebf8; }
.champ:focus-within { border-color: var(--nuit); }
.champ input { flex: 1; min-width: 0; border: 0; outline: 0; background: none; font-size: 16px; font-weight: 600; }
.champ input::placeholder { color: #5a6aa3; font-weight: 500; }
.accord { display: flex; gap: 12px; align-items: flex-start; font-size: 14px; font-weight: 600; line-height: 1.35; cursor: pointer; padding: 2px; }
.accord a { color: var(--nuit); font-weight: 800; }
.accord input { position: absolute; opacity: 0; pointer-events: none; }
.case { width: 26px; height: 26px; flex: none; border-radius: 8px; border: 2px solid var(--nuit); display: grid; place-items: center; background: var(--blanc); transition: background .15s; }
.case svg.ic { width: 18px; height: 18px; stroke-width: 3.2; opacity: 0; color: var(--blanc); }
.accord input:checked + .case { background: var(--nuit); }
.accord input:checked + .case svg.ic { opacity: 1; }
.accord input:focus-visible + .case { outline: 3px solid var(--jaune); outline-offset: 2px; }
.accord.secoue { animation: secoue .4s; }
.accord.secoue .case { border-color: var(--rouge); }
@keyframes secoue { 25% { transform: translateX(-6px); } 50% { transform: translateX(5px); } 75% { transform: translateX(-3px); } }
.envoyer { position: relative; overflow: hidden; display: flex; align-items: center; justify-content: center; gap: 10px; width: 100%; height: 56px; border-radius: 999px; background: var(--nuit); color: var(--blanc); font-weight: 800; font-size: 18px; box-shadow: 0 10px 26px rgba(31, 42, 90, .3); transition: transform .12s; flex: none; }
.envoyer:active { transform: scale(.98); }
.envoyer .jauge { position: absolute; left: 0; top: 0; bottom: 0; width: 0; background: rgba(255, 255, 255, .18); }
.envoyer.envoi { pointer-events: none; }
.envoyer.envoi .jauge { animation: jauge 1.1s var(--doux) forwards; }
@keyframes jauge { to { width: 100%; } }
.e-merci { align-items: center; text-align: center; padding: 24px 6px 6px; }
.coche { width: 80px; height: 80px; border-radius: 50%; background: #e8f8ee; color: #1a8a4a; display: grid; place-items: center; }
.coche svg.ic { width: 42px; height: 42px; stroke-width: 3; stroke-dasharray: 40; stroke-dashoffset: 40; }
body[data-etat="merci"] .coche svg.ic { animation: trace .6s ease .2s forwards; }
.e-merci h2 { margin: 4px 0 0; font-family: var(--titre); font-size: 34px; }
.e-merci p { margin: 0; font-size: 16px; font-weight: 600; line-height: 1.4; max-width: 300px; }
.encore { margin-top: 6px; display: inline-flex; align-items: center; gap: 10px; padding: 14px 24px; border-radius: 999px; background: var(--jaune); color: var(--nuit); font-weight: 800; font-size: 17px; box-shadow: 0 7px 0 var(--jaune-fonce); }
.encore:active { transform: translateY(4px); box-shadow: 0 3px 0 var(--jaune-fonce); }
.fermer { padding: 8px 18px; border-radius: 999px; font-weight: 700; color: var(--nuit); text-decoration: underline; text-underline-offset: 3px; }
.suivre { display: flex; gap: 10px; }
.consigne svg.raccroche { transform: rotate(135deg); color: var(--rouge); }
.suivre a { display: inline-flex; align-items: center; justify-content: center; gap: 7px; width: 46px; height: 46px; padding: 0; border-radius: 999px; background: var(--ciel-clair); color: var(--nuit); font-weight: 700; text-decoration: none; font-size: 14px; }

/* ---------- Tuto de la première visite ---------- */
.tuto-main { position: fixed; z-index: 40; left: 0; top: 0; width: 58px; height: 58px; pointer-events: none; opacity: 0; transform: translate(50vw, 110vh); transition: opacity .35s ease; filter: drop-shadow(0 8px 14px rgba(10, 30, 80, .4)); }
.tuto-main.vu { opacity: 1; }
.tuto-main svg.ic { width: 100%; height: 100%; fill: #fff; stroke: var(--nuit); stroke-width: 1.4; }
.tuto-main::before { content: ""; position: absolute; left: 18%; top: -4%; width: 34px; height: 34px; margin: -17px 0 0 -17px; border-radius: 50%; border: 3px solid #fff; opacity: 0; }
.tuto-main.appuie svg.ic { animation: appui .45s ease; }
.tuto-main.appuie::before { animation: onde-appui .7s ease-out; }
@keyframes appui { 40% { transform: scale(.82) translateY(4px); } }
@keyframes onde-appui { 0% { opacity: .9; transform: scale(.4); } 100% { opacity: 0; transform: scale(2.2); } }
.tuto { position: fixed; z-index: 41; left: 50%; bottom: max(16px, env(safe-area-inset-bottom)); width: min(460px, calc(100vw - 32px)); display: flex; align-items: center; gap: 12px; padding: 12px 12px 12px 14px; border-radius: 24px; background: var(--nuit); color: var(--blanc); box-shadow: 0 16px 40px rgba(10, 20, 60, .4); transform: translate(-50%, 160%); transition: transform .55s var(--ressort); }
.tuto.vu { transform: translate(-50%, 0); }
.tuto .num { width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center; flex: none; background: var(--jaune); color: var(--nuit); font-weight: 900; font-size: 18px; }
.tuto p { margin: 0; flex: 1; font-weight: 800; font-size: 16px; line-height: 1.25; }
.tuto .passer { flex: none; padding: 9px 12px; border-radius: 999px; color: var(--blanc); font-weight: 700; font-size: 14px; text-decoration: underline; text-underline-offset: 3px; }
.tuto .passer.go { background: var(--jaune); color: var(--nuit); text-decoration: none; font-weight: 800; padding: 10px 16px; }
body.tuto-en-cours .bas { opacity: 0; pointer-events: none; }
body.tuto-en-cours .panneau { visibility: hidden !important; opacity: 0 !important; }

/* ---------- Bulle d'annulation ---------- */
.toast { position: fixed; left: 50%; bottom: max(22px, env(safe-area-inset-bottom)); z-index: 60; display: flex; align-items: center; gap: 14px; padding: 10px 10px 10px 18px; border-radius: 999px; background: var(--nuit); color: var(--blanc); font-weight: 700; box-shadow: 0 12px 30px rgba(10, 20, 60, .35); transform: translate(-50%, 160%); transition: transform .45s var(--ressort); max-width: calc(100vw - 32px); }
.toast.vu { transform: translate(-50%, 0); }
.toast button { padding: 8px 14px; border-radius: 999px; background: var(--jaune); color: var(--nuit); font-weight: 800; }
.toast button[hidden] { display: none; }

/* ---------- À propos (référencement, non affiché) ---------- */
.a-propos { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; border: 0; }

/* ---------- Ordinateur, iPad et téléphone à l'horizontale : le panneau à droite ---------- */
@media (min-width: 900px), (min-width: 600px) and (orientation: landscape) {
  .panneau { top: 50%; right: max(4vw, calc(50vw - 600px)); width: 420px; max-height: calc(100dvh - 110px); border-radius: var(--rayon); transform: translate(60px, -50%); }
  body[data-etat="ecoute"] .panneau, body[data-etat="merci"] .panneau { transform: translate(0, -50%); }
}
@media (max-width: 1150px) and (min-width: 600px) and (orientation: landscape), (min-width: 900px) and (max-width: 1150px) { .panneau { right: 3vw; width: min(390px, 46vw); } }
@media (max-height: 520px) and (orientation: landscape) { .devise, h1 { display: none; } .panneau { max-height: calc(100dvh - 24px); } }
@media (max-height: 420px) {
  .devise, h1, .q-tete { display: none; }
  .question { margin-top: 4px; padding: 7px 14px; }
  .q-texte { margin: 0; font-size: 15px; }
  .consigne { min-height: 36px; padding: 4px 14px 4px 8px; font-size: 14px; }
  .c-main { width: 26px; height: 26px; }
  .scene { padding-top: calc(max(8px, env(safe-area-inset-top)) + 50px); padding-bottom: 6px; }
}

/* ---------- Téléphone et iPad debout : le panneau monte du bas ---------- */
@media (max-width: 899.98px) and (orientation: portrait), (max-width: 599.98px) {
  .panneau { left: 0; right: 0; bottom: 0; max-height: min(58dvh, calc(100dvh - 290px)); min-height: 0; border-radius: var(--rayon) var(--rayon) 0 0; transform: translateY(105%); }
  body[data-etat="ecoute"] .panneau, body[data-etat="merci"] .panneau { transform: none; }
  .p-tete { padding-top: 22px; }
  .p-tete::before { content: ""; position: absolute; top: 8px; left: 50%; width: 42px; height: 5px; border-radius: 3px; background: #d6e4f2; transform: translateX(-50%); }
  .p-question p { font-size: 19px; }
  .e-merci { padding-top: 12px; }
}
@media (min-width: 600px) and (max-width: 899.98px) and (orientation: portrait) {
  .panneau { left: 50%; right: auto; width: 580px; transform: translate(-50%, 105%); max-height: min(52dvh, calc(100dvh - 320px)); }
  body[data-etat="ecoute"] .panneau, body[data-etat="merci"] .panneau { transform: translate(-50%, 0); }
}
@media (max-height: 640px) { .devise { display: none; } .consigne { min-height: 42px; padding-top: 6px; padding-bottom: 6px; } }
@media (max-height: 700px) and (max-width: 899.98px) {
  .devise { display: none; }
  .question { margin-top: 10px; padding: 10px 16px; }
  .astuce { display: none; }
}

@media (max-width: 340px) {
  .q-tete { font-size: 11px; letter-spacing: .07em; gap: 5px; white-space: nowrap; }
  .q-points { display: none; }
  .marque { font-size: 18px; }
  .rond { width: 34px; height: 34px; }
  .rond svg.ic { width: 17px; height: 17px; }
  .haut-droite { gap: 4px; }
}

/* ---------- Mouvements réduits ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-delay: 0s !important; transition-duration: .01ms !important; }
  .nuage, .flotte { animation: none !important; }
}
