:root {
  --paper: #f4eee2;
  --paper-2: #ece3d1;
  --ink: #2e2620;
  --ink-soft: rgba(46, 38, 32, 0.74);
  --ink-faint: rgba(46, 38, 32, 0.48);
  --line: rgba(46, 38, 32, 0.2);
  --accent: #b5442c;
  --serif: "Cormorant Garamond", Georgia, serif;
  --sans: "Inter", system-ui, sans-serif;
  --hand: "Caveat", "Segoe Print", cursive;
  --grain: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='220' height='220'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='.8' numOctaves='3' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 .3  0 0 0 0 .22  0 0 0 0 .14  0 0 0 .1 0'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>");
  /* Bordure « tracée à la main » */
  --hand-radius: 255px 14px 225px 14px / 14px 225px 14px 255px;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; background: var(--paper); color: var(--ink); font-family: var(--sans); -webkit-font-smoothing: antialiased; }
/* Pas de rebond de page qui laisserait voir le fond (Mac, iPhone) */
html, body { overscroll-behavior: none; }
/* Le fond de la page (et les barres du navigateur) suit la couleur du ciel image par image : voir updateChromeColor */
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
a { color: inherit; }

#scene { position: fixed; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; -webkit-touch-callout: none; user-select: none; -webkit-user-select: none; }

/* ---------- Étiquettes ---------- */
#labels { position: fixed; inset: 0; pointer-events: none; overflow: hidden; transition: opacity 1.2s; }
#labels.intro { opacity: 0; }
.label {
  position: absolute; left: 0; top: 0; white-space: nowrap; text-align: center;
  font-family: var(--serif); font-style: italic; font-size: 17px; color: var(--ink);
  transition: opacity 1.4s ease-in-out, color 0.3s; will-change: transform;
  text-shadow: 0 0 6px var(--paper), 0 0 3px var(--paper);
}
.label.planet { color: var(--label, var(--ink)); }
.label.on { color: var(--accent); }
/* Au survol, le nom est entouré au crayon rouge, comme une annotation */
.label.planet::before {
  content: ''; position: absolute; inset: 3px 2px; /* ajusté au texte, à l'intérieur de la zone cliquable */ border: 1.4px solid var(--accent); border-radius: var(--hand-radius);
  opacity: 0; transform: rotate(-3deg) scale(0.85); transition: opacity 0.25s, transform 0.35s;
}
.label.planet.on::before { opacity: 0.85; transform: rotate(-3deg) scale(1); }
.label.sun { font-size: 21px; color: #8a4a1c; }
.label.moon { transition: color 0.3s; font-family: var(--hand); font-style: normal; font-size: 18px; color: var(--ink-soft); }
.label.moon.on { color: var(--accent); }
.label.hidden { opacity: 0; pointer-events: none; }
/* Les noms se touchent comme les astres : une zone plus large autour du texte */
.label.planet, .label.moon { pointer-events: auto; cursor: pointer; padding: 8px 12px; margin-top: -8px; -webkit-touch-callout: none; user-select: none; -webkit-user-select: none; }
.label.planet:hover { color: var(--accent); }
.label.planet:hover::before { opacity: 0.85; transform: rotate(-3deg) scale(1); }
.label.moon:hover, .label.moon.hl { color: var(--accent); }
.label.planet.hl { color: var(--accent); }
.label.planet.hl::before { opacity: 0.85; transform: rotate(-3deg) scale(1); }
body.night .label.hl { color: #f6c768; }

/* ---------- Barre du haut ---------- */
.topbar {
  position: fixed; top: 0; left: 0; right: 0; display: flex; justify-content: space-between; align-items: flex-start;
  padding: max(18px, env(safe-area-inset-top)) 24px 30px;
  pointer-events: none; z-index: 5;
}
.topbar > * { pointer-events: auto; }
.brand { text-align: left; display: flex; flex-direction: column; gap: 3px; }
.brand-name { font-family: var(--serif); font-size: 28px; line-height: 1; }
.brand-col { display: flex; flex-direction: column; align-items: flex-start; gap: 10px; }
/* Revenir au système : clair mais discret, sous le nom */
.to-system { font-family: var(--hand); font-size: 19px; color: var(--ink-soft); padding: 2px 0; opacity: 0; transform: translateY(-4px); transition: opacity 0.6s, transform 0.6s, color 0.2s; }
.to-system.on { opacity: 1; transform: none; }
.to-system[hidden] { display: none; }
.to-system:hover { color: var(--accent); }
body.night .to-system { color: rgba(244, 238, 226, 0.8); }
body.voyaging .to-system { display: none; }
.topnav { display: flex; gap: 10px; }
.pill {
  border: 1.4px solid var(--ink); border-radius: var(--hand-radius); padding: 7px 16px; font-size: 12px; letter-spacing: 0.04em;
  background: rgba(244, 238, 226, 0.7); transition: background 0.2s, color 0.2s, transform 0.2s;
}
.pill:hover { transform: rotate(-1deg); background: rgba(181, 68, 44, 0.07); }
.pill.active { color: var(--accent); border-color: var(--accent); }

/* ---------- Panneau projet : une feuille posée sur la table ---------- */
#panel {
  position: fixed; top: 72px; right: 14px; bottom: 14px; width: min(420px, 36vw); z-index: 6; /* sous les boutons du haut */
  background: var(--grain), linear-gradient(170deg, #f8f3ea 35%, var(--album-light, var(--paper-2)));
  box-shadow: 0 1px 2px rgba(60, 40, 20, 0.12), 0 18px 50px rgba(60, 40, 20, 0.16);
  border-radius: 3px;
  padding: 30px 32px 40px; overflow-y: auto;
  transform: translateX(125%) rotate(2deg); transition: transform 1.4s cubic-bezier(0.65, 0, 0.35, 1); /* glisse avec douceur, au départ comme à l'arrivée */
}
#panel.open { transform: rotate(0.4deg); }
.grabber { display: none; }
.back { font-family: var(--hand); font-size: 20px; color: var(--ink-soft); margin-bottom: 18px; padding: 0; }
.back:hover { color: var(--accent); }

.cover {
  aspect-ratio: 1; position: relative; overflow: hidden; margin-bottom: 22px; border-radius: 2px;
  background: var(--grain), #f9f5ec;
  box-shadow: inset 0 0 0 1px var(--line), 0 6px 18px rgba(60, 40, 20, 0.1);
  display: grid; place-items: center;
}
.cover .orb { width: 82%; }
.cover .cover-title { position: absolute; left: 18px; bottom: 12px; right: 18px; font-family: var(--hand); font-size: 26px; color: var(--ink); }
.cover .cover-kind { position: absolute; top: 14px; left: 18px; font-size: 9px; letter-spacing: 0.24em; text-transform: uppercase; color: var(--ink-faint); }

/* Vraie pochette : une photo collée au ruban de masquage */
.cover.photo { aspect-ratio: auto; overflow: visible; background: none; box-shadow: none; padding: 10px 6px 4px; }
.cover.photo img {
  display: block; width: 100%; aspect-ratio: 1; object-fit: cover; transform: rotate(-1.2deg);
  border: 6px solid #fbf8f1; box-shadow: 0 1px 2px rgba(60, 40, 20, 0.2), 0 10px 26px rgba(60, 40, 20, 0.18);
}
.photo-frame { position: relative; display: block; width: 100%; }
.photo-frame::before, .photo-frame::after {
  content: ''; position: absolute; width: 74px; height: 22px; z-index: 1;
  background: rgba(236, 222, 190, 0.78); box-shadow: 0 1px 2px rgba(60, 40, 20, 0.12);
  -webkit-mask-image: linear-gradient(90deg, transparent 0 2px, #000 2px calc(100% - 2px), transparent 0);
}
.photo-frame::before { top: -8px; left: -14px; transform: rotate(-28deg); }
.photo-frame::after { top: -10px; right: -12px; transform: rotate(22deg); }
.subtitle { font-family: var(--hand); font-size: 22px; color: var(--ink-soft); margin: -4px 0 10px; }
.card .thumb { width: 70px; height: 70px; flex: none; object-fit: cover; border: 3px solid #fbf8f1; box-shadow: 0 2px 6px rgba(60, 40, 20, 0.2); transform: rotate(-3deg); }

.orb { display: block; aspect-ratio: 1; animation: float 7s ease-in-out infinite; }
@keyframes float { 50% { transform: translateY(-4px) rotate(-1.5deg); } }

.eyebrow { font-size: 10.5px; letter-spacing: 0.22em; text-transform: uppercase; color: var(--accent); margin: 0 0 8px; }
#panel h2 { font-family: var(--serif); font-weight: 400; font-size: 40px; line-height: 1; margin: 0 0 10px; }
.credits { font-size: 12.5px; color: var(--ink-faint); margin: 0 0 16px; }
.desc { font-family: var(--serif); font-size: 18px; line-height: 1.5; color: var(--ink-soft); margin: 0 0 26px; }
#panel h3 { font-family: var(--hand); font-weight: 500; font-size: 22px; color: var(--ink); margin: 0 0 6px; }

.tracks { list-style: none; padding: 0; margin: 0 0 26px; }
.tracks [data-track] {
  width: 100%; display: grid; grid-template-columns: 28px 1fr auto; align-items: center; gap: 10px;
  padding: 11px 2px; text-align: left; font-size: 14px; color: var(--ink-soft);
  background-image: linear-gradient(to right, var(--line) 60%, transparent 0); background-size: 7px 1px; background-repeat: repeat-x; background-position: bottom;
  transition: color 0.2s;
}
.tracks [data-track]:hover { color: var(--ink); }
.tracks .ic { width: 22px; height: 22px; border: 1.2px solid var(--ink-soft); border-radius: 48% 52% 45% 55%; display: grid; place-items: center; font-size: 7px; }
.tracks .dur { font-size: 12px; color: var(--ink-faint); font-variant-numeric: tabular-nums; }
.tracks [data-track].playing {
  color: var(--accent);
  background-image: linear-gradient(var(--accent), var(--accent)), linear-gradient(to right, var(--line) 60%, transparent 0);
  background-size: var(--prog, 0%) 1.5px, 7px 1px;
  background-repeat: no-repeat, repeat-x;
  background-position: left bottom, bottom;
}
.tracks [data-track].playing .ic { border-color: var(--accent); background: rgba(181, 68, 44, 0.1); }

.chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 26px; }
.chip { font-size: 12px; text-decoration: none; border: 1.2px solid var(--ink-soft); border-radius: var(--hand-radius); padding: 6px 13px; color: var(--ink-soft); }
.chip:hover { color: var(--accent); border-color: var(--accent); }
/* Les liens d'écoute, juste sous la pochette de l'album */
.chips.listen { margin: -8px 0 22px; justify-content: center; }
.share-under { display: none; } /* le bouton de partage sous la pochette : seulement sur téléphone */

.video {
  aspect-ratio: 16 / 9; margin-bottom: 26px; border: 1.2px solid var(--ink-soft); border-radius: var(--hand-radius);
  display: grid; place-items: center; font-family: var(--hand); font-size: 20px; color: var(--ink-soft);
  background: repeating-linear-gradient(-55deg, rgba(46, 38, 32, 0.07) 0 1px, transparent 1px 7px);
}
.prevnext { display: flex; justify-content: space-between; gap: 12px; }
.prevnext button { font-family: var(--hand); font-size: 19px; color: var(--ink-soft); padding: 6px 0; }
.prevnext button:hover { color: var(--accent); }

/* ---------- Liste (vue 2D, accessible) ---------- */
/* La liste des albums : une fenêtre flottante, comme « à propos » (voir plus bas) */
.about-card.list-card { width: min(780px, 100%); }
.list-card h2 { margin-bottom: 22px; }
.list-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 14px; }
.card {
  text-align: left; padding: 14px 16px; display: flex; gap: 12px; align-items: center;
  background: var(--grain), #f9f5ec; border-radius: 2px;
  box-shadow: 0 1px 2px rgba(60, 40, 20, 0.12), 0 8px 20px rgba(60, 40, 20, 0.07);
  transition: transform 0.25s;
}
.card:nth-child(odd) { transform: rotate(-0.6deg); }
.card:nth-child(even) { transform: rotate(0.5deg); }
.card:hover { transform: rotate(0) translateY(-3px); }
.card .orb { width: 70px; flex: none; animation: none; }
.card strong { display: block; font-family: var(--serif); font-weight: 500; font-size: 21px; line-height: 1.05; }
.card span { font-size: 10px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--ink-faint); }

/* ---------- Mini-lecteur ---------- */
#player {
  position: fixed; left: 20px; bottom: 44px; z-index: 5; display: flex; align-items: center; gap: 4px;
  max-width: min(340px, calc(100vw - 40px)); padding: 8px 8px 10px 10px;
  background: var(--grain), linear-gradient(120deg, #f9f5ec 40%, var(--album-light, #f9f5ec)); border-radius: 2px; transform: rotate(-0.8deg);
  box-shadow: 0 1px 2px rgba(60, 40, 20, 0.14), 0 10px 26px rgba(60, 40, 20, 0.14);
}
#player[hidden] { display: none; }
#pPlay { width: 34px; height: 34px; flex: none; border: 1.3px solid var(--ink); border-radius: 48% 52% 45% 55%; font-size: 10px; }
#pPlay:hover { color: var(--accent); border-color: var(--accent); }
.p-info { flex: 1; min-width: 0; text-align: left; padding: 0 8px; display: flex; flex-direction: column; }
.p-info strong { font-family: var(--serif); font-weight: 500; font-size: 17px; line-height: 1.1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.p-info span { font-size: 9.5px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--ink-faint); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#pStop { width: 28px; height: 28px; flex: none; font-size: 20px; color: var(--ink-soft); }
#pStop:hover { color: var(--accent); }
#player { flex-wrap: wrap; width: min(380px, calc(100vw - 40px)); max-width: none; padding-bottom: 6px; }

/* ---------- Forme d'onde : on clique ou on glisse pour se déplacer dans le morceau ---------- */
.wave { display: flex; align-items: center; gap: 8px; }
#player .wave { flex-basis: 100%; padding: 2px 4px 0; }
/* Sous le lecteur : la liste de lecture de l'album, compacte, comme dans un lecteur de musique (sur ordinateur) */
#player .p-tracks { position: relative; flex-basis: 100%; margin: 6px 2px 0; padding-top: 4px; border-top: 1px dashed var(--line); max-height: 132px; overflow-y: auto; scrollbar-width: thin; scrollbar-color: var(--line) transparent; }
#player .p-tracks[hidden] { display: none; }
#player .p-tracks button { display: grid; grid-template-columns: 20px 1fr auto; align-items: baseline; gap: 6px; width: 100%; padding: 2px 6px; border-radius: 2px; text-align: left; font-size: 12px; line-height: 18px; color: var(--ink-soft); transition: background 0.2s, color 0.2s; }
#player .p-tracks button:nth-child(even) { background: rgba(60, 40, 20, 0.025); }
#player .p-tracks button:hover { background: rgba(60, 40, 20, 0.06); color: var(--ink); }
#player .p-tracks .n { font-size: 10px; color: var(--ink-faint); text-align: right; font-variant-numeric: tabular-nums; }
#player .p-tracks .t { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#player .p-tracks .d { font-size: 10px; color: var(--ink-faint); font-variant-numeric: tabular-nums; }
#player .p-tracks button.on, #player .p-tracks button.on .n { color: var(--accent); }
#player .p-tracks .on { background: rgba(60, 40, 20, 0.06); font-weight: 500; }
@media (max-width: 820px) { #player .p-tracks { display: none; } }
.wave canvas { flex: 1; min-width: 0; height: 34px; cursor: pointer; touch-action: none; display: block; }
.wave span { font-size: 10px; letter-spacing: 0.04em; font-variant-numeric: tabular-nums; color: var(--ink-faint); min-width: 28px; }
.wave .w-dur { text-align: right; }
#voyage .wave { width: min(460px, 88vw); margin: -4px auto 12px; pointer-events: auto; }
#voyage .wave canvas { height: 38px; }
body.night #voyage .wave span { color: rgba(244, 238, 226, 0.55); }

/* ---------- Favoris ---------- */
.tracks li { display: flex; align-items: center; }
.tracks li > [data-track] { flex: 1; min-width: 0; }
.fav, .star { flex: none; width: 34px; height: 34px; font-size: 17px; line-height: 1; color: var(--ink-faint); transition: color 0.2s, transform 0.25s; }
.fav:hover, .star:hover { color: var(--accent); transform: scale(1.15) rotate(-8deg); }
/* Partager un morceau (son lien ouvre l'album et le prépare) */
.share-track { flex: none; width: 30px; height: 34px; font-size: 15px; line-height: 1; color: var(--ink-faint); transition: color 0.2s, transform 0.25s; }
.share-track:hover { color: var(--accent); transform: translateY(-2px); }
/* Le morceau arrivé par son lien, qui attend le premier appui */
.tracks [data-track].armed { color: var(--accent); }
.tracks [data-track].armed .ic { animation: armed-pulse 1.6s ease-in-out infinite; }
@keyframes armed-pulse { 50% { opacity: 0.35; } }
@media (prefers-reduced-motion: reduce) { .tracks [data-track].armed .ic { animation: none; } }
.fav.on, .star.on, .star-pill.on { color: var(--accent); }
.star-pill.on { border-color: var(--accent); }
.label.moon.is-fav::before { content: '★ '; color: var(--accent); }
.fav-pill { color: var(--accent); border-color: var(--accent); }
.fav-pill[hidden], #pFav[hidden], #vFav[hidden] { display: none; }

#favs {
  position: fixed; top: 64px; right: 20px; z-index: 7; width: min(340px, calc(100vw - 32px));
  max-height: calc(100vh - 100px); overflow-y: auto; padding: 18px 20px 20px;
  background: var(--grain), #f9f5ec; border-radius: 2px; transform: rotate(0.6deg);
  box-shadow: 0 1px 2px rgba(60, 40, 20, 0.14), 0 16px 40px rgba(60, 40, 20, 0.18);
}
#favs[hidden] { display: none; }
.favs-head { display: flex; justify-content: space-between; align-items: center; }
.favs-head h2 { font-family: var(--hand); font-weight: 500; font-size: 28px; margin: 0; }
.favs-close { font-size: 22px; color: var(--ink-soft); width: 30px; height: 30px; }
#favList { list-style: none; padding: 0; margin: 8px 0 18px; }
#favList li {
  display: flex; align-items: center; gap: 10px; padding: 9px 0;
  background-image: linear-gradient(to right, var(--line) 60%, transparent 0); background-size: 7px 1px; background-repeat: repeat-x; background-position: bottom;
}
.fav-num { font-family: var(--hand); font-size: 20px; color: var(--accent); width: 18px; text-align: center; }
.fav-txt { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.fav-txt strong { font-family: var(--serif); font-weight: 500; font-size: 18px; line-height: 1.1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fav-txt em { font-family: var(--hand); font-style: normal; font-size: 16px; color: var(--ink-soft); }
.fav-x { font-size: 18px; color: var(--ink-faint); width: 28px; height: 28px; }
.fav-x:hover { color: var(--accent); }
#favs .enter { width: 100%; }
.favs-note { font-family: var(--hand); font-size: 16px; color: var(--ink-soft); text-align: center; margin: 12px 0 0; }

#toast {
  position: fixed; top: 74px; left: 50%; z-index: 9; margin: 0; padding: 7px 16px; pointer-events: none;
  font-family: var(--hand); font-size: 21px; color: var(--accent);
  background: var(--grain), #f9f5ec; border-radius: 2px; box-shadow: 0 1px 2px rgba(60, 40, 20, 0.14), 0 8px 20px rgba(60, 40, 20, 0.12);
  opacity: 0; transform: translate(-50%, -6px) rotate(-1deg); transition: opacity 0.4s, transform 0.4s;
}
#toast.show { opacity: 1; transform: translate(-50%, 0) rotate(-1deg); }
@media (max-width: 820px) { #toast { top: 108px; font-size: 18px; white-space: nowrap; } }

/* ---------- Voyage cosmique ---------- */
#voyage {
  position: fixed; left: 50%; bottom: max(24px, env(safe-area-inset-bottom)); transform: translateX(-50%); z-index: 5;
  width: min(600px, calc(100vw - 32px)); text-align: center; pointer-events: none;
}
#voyage[hidden] { display: none; }
#voyage .v-step { font-size: 10px; letter-spacing: 0.24em; text-transform: uppercase; color: var(--accent); margin: 0 0 6px; }
#voyage .v-title {
  font-family: var(--serif); font-style: italic; font-size: clamp(30px, 4.2vw, 48px); line-height: 1.05; margin: 0;
  text-shadow: 0 0 14px var(--paper), 0 0 5px var(--paper);
}
#voyage .v-album { font-family: var(--hand); font-size: 22px; color: var(--ink-soft); margin: 2px 0 14px; text-shadow: 0 0 8px var(--paper); }
#voyage .v-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; pointer-events: auto; }
#voyage .v-actions .pill { font-size: 11px; padding: 6px 13px; }
#voyage.fresh .v-title, #voyage.fresh .v-album { animation: vfade 2.6s ease both; }
#voyage.fresh .v-album { animation-delay: 0.6s; }
@keyframes vfade { from { opacity: 0; transform: translateY(8px); filter: blur(3px); } to { opacity: 1; transform: none; filter: none; } }
body.voyaging .hint { display: none; }
.intro-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 12px; }
.enter.voyage { border-color: var(--accent); color: var(--accent); }

/* ---------- Divers ---------- */
.hint {
  position: fixed; left: 50%; bottom: max(44px, env(safe-area-inset-bottom)); transform: translateX(-50%); margin: 0; /* au-dessus du pied de page */
  font-family: var(--hand); font-size: 19px; color: var(--ink-soft); white-space: nowrap; transition: opacity 0.8s; pointer-events: none;
}
.hint.gone { opacity: 0; }
/* Pied de page : plateformes et réseaux, en petit, en bas à droite */
.site-foot { position: fixed; right: 24px; bottom: 20px; z-index: 4; display: flex; align-items: center; gap: 8px; font-size: 9.5px; letter-spacing: 0.16em; text-transform: uppercase; transition: opacity 0.6s; }
.site-foot a { color: var(--ink-faint); text-decoration: none; transition: color 0.2s; }
.site-foot a:hover { color: var(--accent); }
.site-foot span { color: var(--ink-faint); opacity: 0.6; }
body.night .site-foot a, body.night .site-foot span { color: rgba(244, 238, 226, 0.55); }
body.night .site-foot a:hover { color: #f6c768; }
.badge { position: fixed; left: 24px; bottom: 20px; margin: 0; font-size: 9.5px; letter-spacing: 0.16em; text-transform: uppercase; color: var(--ink-faint); }

#intro {
  position: fixed; inset: 0; z-index: 10; display: grid; place-items: center; text-align: center; padding: 16px;
  background: var(--grain), radial-gradient(ellipse at center, rgba(244, 238, 226, 0.55), rgba(244, 238, 226, 0.97) 70%);
  transition: opacity 1.4s ease;
}
#intro.gone { opacity: 0; pointer-events: none; }
#intro[hidden] { display: none; }
.intro-inner { position: relative; }
#intro h1 { font-family: var(--serif); font-weight: 400; font-size: clamp(60px, 11vw, 150px); line-height: 0.88; margin: 10px 0 34px; }
.enter {
  border: 1.6px solid var(--ink); border-radius: var(--hand-radius); padding: 13px 30px;
  font-size: 12px; letter-spacing: 0.16em; text-transform: uppercase; background: rgba(244, 238, 226, 0.6);
  transition: transform 0.2s, color 0.2s, border-color 0.2s;
}
.enter:hover { transform: rotate(-1.5deg); color: var(--accent); border-color: var(--accent); }
.intro-note { font-family: var(--hand); font-size: 19px; color: var(--ink-soft); margin-top: 16px; }
/* Contact, dans le bas de la page d'accueil */
.intro-contact { position: absolute; left: 50%; bottom: max(9vh, calc(env(safe-area-inset-bottom) + 28px)); transform: translateX(-50%);
  font-size: 11px; letter-spacing: 0.24em; text-transform: uppercase; color: var(--ink-soft);
  padding: 9px 22px; border: 1.2px solid var(--line); border-radius: var(--hand-radius); background: rgba(244, 238, 226, 0.6);
  transition: color 0.25s, border-color 0.25s; }
.intro-contact:hover, .intro-contact:focus-visible { color: var(--accent); border-color: var(--accent); }
/* Les plateformes et réseaux, en petites icônes à l'encre sous les boutons de l'accueil */
.intro-links { display: flex; justify-content: center; gap: 22px; margin-top: 24px; }
.intro-links a { color: var(--ink-soft); display: block; padding: 4px; transition: color 0.25s, transform 0.3s; }
.intro-links a:hover, .intro-links a:focus-visible { color: var(--accent); transform: translateY(-2px) rotate(-4deg); }
.intro-links svg { width: 22px; height: 22px; display: block; fill: none; stroke: currentColor; stroke-width: 1.4; stroke-linecap: round; stroke-linejoin: round; }

/* ---------- Mobile ---------- */
@media (max-width: 820px) {
  .topnav { flex-wrap: wrap; justify-content: flex-end; max-width: 58%; gap: 6px; }
  #favs { top: auto; bottom: 0; right: 0; left: 0; width: auto; transform: none; border-radius: 3px 3px 0 0; max-height: 70vh; padding-bottom: max(20px, env(safe-area-inset-bottom)); }
  .topbar { padding: max(14px, env(safe-area-inset-top)) 16px 24px; }
  .brand-name { font-size: 23px; }
  .pill { padding: 9px 14px; font-size: 13px; min-height: 40px; }
  .intro-actions { flex-direction: column; align-items: center; }
  #voyage .v-album { margin-bottom: 8px; }

  #panel {
    top: auto; left: 8px; right: 8px; bottom: 0; width: auto; height: 58vh; height: 58dvh;
    border-radius: 3px 3px 0 0; padding: 10px 18px max(28px, env(safe-area-inset-bottom));
    transform: translateY(105%);
  }
  #panel.open { transform: none; }
  .grabber { display: block; width: 40px; height: 3px; border-radius: 3px; background: var(--line); margin: 0 auto 10px; }
  .back { margin-bottom: 10px; }
  .cover { aspect-ratio: auto; height: 140px; margin-bottom: 16px; }
  .cover .orb { width: 130px; }
  .cover.photo { height: auto; display: block; }
  .photo-frame { width: 170px; }
  .photo-frame::before, .photo-frame::after { width: 54px; height: 18px; }
  .cover .cover-title { font-size: 22px; }
  /* Sur téléphone, les liens d'écoute se rangent l'un sous l'autre, à droite de la pochette */
  .cover-row { display: grid; grid-template-columns: auto minmax(0, 170px); align-items: center; gap: 10px 18px; margin-bottom: 16px; }
  .cover-row .cover { margin-bottom: 0; }
  .chips.listen { flex-direction: column; align-items: stretch; justify-content: center; margin: 0; }
  .share-under { display: block; grid-column: 1; justify-self: center; }
  .chips.listen .chip { text-align: center; }
  #panel h2 { font-size: 32px; }
  .desc { font-size: 17px; }

  .hint { font-size: 17px; white-space: normal; width: calc(100% - 32px); text-align: center; bottom: max(38px, env(safe-area-inset-bottom)); }
  .badge { left: 16px; bottom: 14px; }
  .label { font-size: 14px; }
  .label.sun { font-size: 17px; }
  .label.moon { font-size: 16px; }
}

/* ---------- Nuit étoilée pendant le voyage ---------- */
.label, .brand-name, .pill, #voyage .v-title, #voyage .v-album, #voyage .v-step {
  transition: color 2.5s, text-shadow 2.5s, background-color 2.5s, border-color 2.5s, opacity 1.4s ease-in-out;
}
body.night .label { color: rgba(244, 238, 226, 0.82); text-shadow: 0 0 6px rgba(8, 10, 24, 0.95), 0 0 2px rgba(8, 10, 24, 0.95); }
body.night .label.planet { color: #f4eee2; }
body.night .label.moon.on, body.night .label.moon.is-fav::before { color: #f6c768; }
body.night .brand-name { color: #f4eee2; }
body.night .pill { color: #f4eee2; border-color: rgba(244, 238, 226, 0.65); background-color: rgba(14, 16, 32, 0.45); }
body.night .pill.active, body.night .fav-pill, body.night .star-pill.on { color: #f6c768; border-color: #f6c768; }
body.night #voyage .v-step { color: #f6c768; }
body.night #voyage .v-title { color: #f4eee2; text-shadow: 0 0 16px rgba(8, 10, 24, 0.95), 0 0 4px rgba(8, 10, 24, 0.9); }
body.night #voyage .v-album { color: rgba(244, 238, 226, 0.75); text-shadow: 0 0 8px rgba(8, 10, 24, 0.95); }
body.night .badge { color: rgba(244, 238, 226, 0.35); }

/* ---------- Fenêtre « à propos » ---------- */
.brand { cursor: pointer; transition: opacity 0.3s; }
.brand:hover .brand-name { color: var(--accent); }
.brand-name { transition: color 0.4s; }
#about, #list {
  position: fixed; inset: 0; z-index: 12; display: grid; place-items: center; padding: 16px;
  background: rgba(244, 238, 226, 0.55); backdrop-filter: blur(3px); -webkit-backdrop-filter: blur(3px);
  opacity: 0; transition: opacity 0.8s cubic-bezier(0.65, 0, 0.35, 1);
}
#about[hidden], #list[hidden] { display: none; }
#about.open, #list.open { opacity: 1; }
body.night #about, body.night #list { background: rgba(8, 10, 24, 0.5); }
.about-card {
  position: relative; width: min(520px, 100%); max-height: min(86vh, 720px); overflow-y: auto;
  padding: 40px 38px 34px; border-radius: 2px;
  background: var(--grain), linear-gradient(170deg, #f8f3ea 35%, var(--paper-2));
  box-shadow: 0 1px 2px rgba(60, 40, 20, 0.14), 0 24px 60px rgba(60, 40, 20, 0.22);
  transform: translateY(14px) rotate(-0.6deg); transition: transform 0.9s cubic-bezier(0.65, 0, 0.35, 1);
}
#about.open .about-card, #list.open .about-card { transform: translateY(0) rotate(-0.3deg); }
.about-card h2 { font-family: var(--serif); font-weight: 400; font-size: 42px; line-height: 1; margin: 0 0 10px; }
.about-card h3 { font-family: var(--hand); font-weight: 500; font-size: 22px; color: var(--ink); margin: 0 0 6px; }
.about-card .chips:last-child { margin-bottom: 0; }
.about-close { position: absolute; top: 10px; right: 12px; width: 34px; height: 34px; font-size: 24px; color: var(--ink-soft); }
.about-close:hover { color: var(--accent); }
/* Fenêtre Contact sur ordinateur : la bio à gauche, le formulaire à droite, tout visible sans faire défiler */
@media (min-width: 821px) {
  #about .about-card { width: min(920px, 100%); }
  .bio-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 40px; align-items: start; }
  .bio-cols .contact-form { margin-bottom: 0; }
  .bio-cols .desc { font-size: 17px; }
}
@media (max-width: 820px) {
  .about-card { padding: 32px 22px 26px; }
  .about-card h2 { font-size: 34px; }
}

/* ---------- Téléphone : textes et cibles plus grands ---------- */
@media (max-width: 820px) {
  .label { font-size: 16px; }
  .label.moon { font-size: 18px; }
  .tracks [data-track] { font-size: 16px; padding: 13px 2px; }
  .tracks .dur { font-size: 13px; }
  .fav { width: 44px; height: 44px; font-size: 20px; }
  .share-track { width: 40px; height: 44px; font-size: 18px; }
  .chip { font-size: 14px; padding: 9px 15px; }
  #pPlay { width: 40px; height: 40px; }
  #pStop, #pFav { width: 40px; height: 40px; }
  .p-info strong { font-size: 18px; }
  .wave canvas { height: 40px; }
  .wave span { font-size: 12px; }
  #voyage .v-actions .pill { font-size: 13px; }
}

/* ---------- Écran de chargement ---------- */
#loader {
  position: fixed; inset: 0; z-index: 30; display: grid; place-content: center; justify-items: center; gap: 18px;
  background: var(--grain), var(--paper); transition: opacity 1s ease;
}
#loader.gone { opacity: 0; pointer-events: none; }
#loader p { margin: 0; font-family: var(--hand); font-size: 22px; color: var(--ink-soft); }
.ld { position: relative; width: 110px; height: 110px; }
.ld-orbit { position: absolute; inset: 6px; border-radius: 50%; border: 1.5px dashed rgba(46, 38, 32, 0.45); animation: ld-spin 9s linear infinite; }
.ld-arm { position: absolute; inset: 0; animation: ld-spin 2.6s linear infinite; }
.ld-moon { position: absolute; top: 0; left: 50%; width: 13px; height: 13px; margin-left: -6.5px; border-radius: 50%; background: #c8442f; border: 1.5px solid var(--ink); }
.ld-sun { position: absolute; inset: 36px; border-radius: 50%; background: #f2c25a; border: 2px solid var(--ink); box-shadow: 0 0 0 10px rgba(242, 194, 90, 0.22); animation: ld-breathe 2.6s ease-in-out infinite; }
@keyframes ld-spin { to { transform: rotate(360deg); } }
@keyframes ld-breathe { 50% { transform: scale(1.06); } }

/* ---------- Clavier et lecteurs d'écran ---------- */
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.sr-only.focusable:focus { position: fixed; left: 50%; bottom: 90px; transform: translateX(-50%); width: auto; height: auto; clip: auto; z-index: 9;
  padding: 10px 18px; background: var(--grain), #f9f5ec; border: 1.4px solid var(--ink); border-radius: var(--hand-radius); font-size: 14px; }
:focus-visible { outline: 2px dashed var(--accent); outline-offset: 4px; border-radius: 3px; }
.label:focus-visible { outline-offset: 0; }

/* ---------- Moins d'animations, si l'appareil le demande ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.2s !important; }
  .ld-arm, .ld-orbit, .ld-sun { animation: none !important; }
}

/* ---------- Formulaire de contact ---------- */
.contact-form { margin: 4px 0 26px; display: grid; gap: 10px; }
.cf-intro { font-family: var(--hand); font-size: 19px; color: var(--ink-soft); margin: 0; }
.cf-trap { position: absolute; left: -9999px; }
.cf-field { display: grid; gap: 4px; }
.cf-field span { font-size: 11px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--ink-faint); }
.cf-field input, .cf-field textarea {
  font: inherit; font-family: var(--serif); font-size: 18px; color: var(--ink); background: rgba(255, 255, 255, 0.35);
  border: 0; border-bottom: 1.4px solid var(--line); border-radius: 0; padding: 6px 2px; resize: vertical;
}
.cf-field input:focus, .cf-field textarea:focus { outline: none; border-bottom-color: var(--accent); background: rgba(255, 255, 255, 0.6); }
.cf-send { justify-self: start; color: var(--ink); }
.cf-send:disabled { opacity: 0.5; }
.cf-status { font-family: var(--hand); font-size: 19px; color: var(--accent); margin: 0; min-height: 1em; }
.contact-form.sent .cf-field, .contact-form.sent .cf-send, .contact-form.sent .cf-intro { display: none; }
@media (max-width: 820px) { .cf-field input, .cf-field textarea { font-size: 17px; } }

/* ---------- Lecteur aimanté en pied de page (mobile) ---------- */
/* En voyage (ordinateur comme téléphone), c'est la légende du voyage qui porte la forme d'onde : le lecteur s'efface */
body.voyaging #player { display: none; }
/* Sur mobile, dès qu'une musique joue, le lecteur reste en bas de l'écran : système, fiches, trou noir */
@media (max-width: 820px) {
  :root { --player-h: 104px; }
  #player {
    left: 0; right: 0; bottom: 0; width: auto; max-width: none; transform: none; border-radius: 0; z-index: 7;
    display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px;
    padding: 8px 14px max(8px, env(safe-area-inset-bottom));
    background: var(--grain), linear-gradient(100deg, #f9f5ec 30%, var(--album-light, #f4ecdd));
    box-shadow: 0 -1px 0 var(--line), 0 -10px 30px rgba(60, 40, 20, 0.08);
    animation: player-in 0.7s cubic-bezier(0.65, 0, 0.35, 1);
  }
  #player .p-info { flex: 1 1 0; }
  #player .wave { order: 10; flex: 1 1 100%; padding: 0; min-width: 0; }
  #player #pFav { order: 4; }
  #player #pStop { order: 5; }
  /* Le reste se pose au-dessus du lecteur */
  body.has-player:not(.voyaging) #panel { bottom: var(--player-h); height: calc(58dvh - var(--player-h) * 0.4); }
  body.has-player .hint { display: none; }
  body.has-player:not(.voyaging) #favs { bottom: var(--player-h); max-height: calc(100vh - var(--player-h) - 100px); }
}
@keyframes player-in { from { transform: translateY(100%); } }
@media (prefers-reduced-motion: reduce) { #player { animation: none; } }

/* Mention de la mesure d'audience, dans la fenêtre « à propos » */
.privacy { margin: 26px 0 0; font-size: 12px; color: var(--ink-faint); }
/* Un astre caché derrière le trou noir : son nom s'efface (on ne voit plus que sa lumière courbée) */
.label.behind-bh { opacity: 0; pointer-events: none; }
/* Sur téléphone, les noms des astres se fondent dans les bords de l'écran, comme le dessin (voir uEdge dans app.js) */
@media (max-width: 820px) {
  #labels {
    -webkit-mask-image: linear-gradient(90deg, transparent 0, #000 11vmin, #000 calc(100% - 11vmin), transparent 100%);
    mask-image: linear-gradient(90deg, transparent 0, #000 11vmin, #000 calc(100% - 11vmin), transparent 100%);
  }
}

/* Défilement au doigt (iPhone surtout) : les fenêtres et la fiche défilent d'elles-mêmes, sans entraîner la page,
   et tiennent dans la partie vraiment visible de l'écran (dvh : sans la barre d'adresse de Safari) */
#panel, .about-card, #favs, #player .p-tracks {
  -webkit-overflow-scrolling: touch; overscroll-behavior: contain; touch-action: pan-y;
}
.about-card { max-height: min(86vh, 720px); max-height: min(86dvh, 720px); }
@media (hover: none) {
  /* Sur écran tactile, pas d'effet de survol qui reste « collé » et fait bouger les cartes pendant le défilement */
  .card:hover { transform: none; }
  .card:nth-child(odd) { transform: rotate(-0.6deg); }
  .card:nth-child(even) { transform: rotate(0.5deg); }
}

/* Pied de page sur téléphone : centré tout en bas ; il laisse la place au lecteur, à la fiche et au voyage */
@media (max-width: 820px) {
  .site-foot { left: 0; right: 0; justify-content: center; bottom: max(10px, env(safe-area-inset-bottom)); font-size: 10px; gap: 7px; }
  .hint { bottom: max(38px, calc(env(safe-area-inset-bottom) + 26px)); }
  body.has-player .site-foot, body.voyaging .site-foot, body:has(#panel.open) .site-foot { opacity: 0; pointer-events: none; }
}
