/* ═══════════════════════════════════════════════════════════════
   BULLE RESPIRE — couche immersive (12/10/2026), espace utilisateur.
   Tout est scopé sur body[data-space="user"].immersive : Organisation
   et Pilotage gardent leur thème ; les modales (.modal, hors #app)
   restent blanches, comme avant.
   Palette : navy/or de la charte + bleus d'eau (océan, azur, turquoise
   retenu, nacre). Jamais de violet/rose. La sphère d'eau est la
   signature (décision du 12/10/2026, PRODUCT.md).
   Chargé après styles.css, qui garde les règles communes.
   ═══════════════════════════════════════════════════════════════ */
:root { --rb-deep: #0b1a36; --rb-ocean: #123b5e; --rb-turq: #7fd3cc; --rb-nacre: #f2f6fb; --rb-champagne: #e3cd8a; }

/* ── l'océan (canvas) et son repli CSS, derrière #app (z-index 1) ── */
#rb-sea, #rb-sea-css, #rb-sphere-css, #rb-veil { display: none; }
body.immersive #rb-sea { display: block; position: fixed; inset: 0; width: 100%; height: 100%; z-index: 0; }
body.immersive[data-rb-render="css"] #rb-sea { display: none; }
body.immersive[data-rb-render="css"] #rb-sea-css { display: block; position: fixed; inset: 0; z-index: 0;
  background: radial-gradient(120% 80% at 50% 110%, #0a2745 0%, var(--rb-deep) 60%), linear-gradient(180deg, #0f2d4d, var(--rb-deep)); }
body.immersive[data-rb-render="css"] #rb-sphere-css { display: block; position: fixed; z-index: 0; border-radius: 50%; pointer-events: none;
  background: radial-gradient(circle at 50% 42%, #2d6a8e 0%, #17496e 55%, #0f3252 100%);
  box-shadow: inset 0 -18px 40px rgba(5,20,40,.55), inset 0 6px 24px rgba(127,211,204,.22), 0 20px 60px rgba(0,0,0,.35); transition: opacity .6s; }
body.immersive[data-rb-render="css"] #rb-sphere-css::after { content: ""; position: absolute; left: 12%; right: 12%; top: 38%; height: 3px; border-radius: 3px; background: rgba(127,211,204,.45); }
body.immersive #rb-veil { display: block; position: fixed; inset: 0; z-index: 85; background: var(--rb-deep); opacity: 0; pointer-events: none; transition: opacity .9s cubic-bezier(.16,1,.3,1); }
body.immersive #rb-veil.on { opacity: 1; }
/* pendant le compagnon, l'océan (opaque) passe devant la page, le compagnon devant l'océan */
body.immersive.rb-breathe-open #rb-sea, body.immersive.rb-breathe-open #rb-sea-css, body.immersive.rb-breathe-open #rb-sphere-css { z-index: 86; }
.sphere-slot { pointer-events: none; }
.rb-corner { position: fixed; right: 26px; top: 76px; width: 92px; height: 92px; z-index: 0; }

/* ── thème sombre de verre : jetons redéfinis sur #app seulement ── */
body[data-space="user"].immersive { background: var(--rb-deep); }
body[data-space="user"].immersive #app {
  --cream: rgba(255,255,255,.04); --card: rgba(255,255,255,.065); --ink: var(--rb-nacre);
  /* 30/10/2026 : texte secondaire remonté (.74 → .84, .55 → .68), il passait sous le contraste lisible sur le fond océan */
  --ink-soft: rgba(242,246,251,.84); --ink-mute: rgba(242,246,251,.68); --line: rgba(255,255,255,.16);
  --accent: var(--rb-turq); --accent-soft: rgba(127,211,204,.14); --gold-ink: var(--rb-champagne); --steel-dark: var(--sky);
  --shadow: 0 20px 60px rgba(0,0,0,.28); --shadow-soft: 0 10px 30px rgba(0,0,0,.22);
  color: var(--ink);
}
body[data-space="user"].immersive #app :is(.card h3, h2.sec, .sess .t, .prog-card h4, .today-step-head b, .rituel-tip b, .stat .n, .mandala-name,
  .tpl-card-label, .badge-tile .nm, .brand h1, .l-h1, .l-h2, .l-step h3, .l-fam h3, .l-aud-card h3, .topbar .logo, .mobile-drawer-head .txt, .l-brand,
  .l-footer-brand, .btn.ghost, .tpl-card-btn-print, .quiz-opt, .empty .t) { color: var(--ink); }
body[data-space="user"].immersive #app :is(.l-h1 span, .brand h1 em) { color: var(--rb-turq); }
body[data-space="user"].immersive #app :is(.l-brand svg, .l-brand svg:last-child, .l-footer-brand svg, .l-lead b) { color: var(--ink); }
body[data-space="user"].immersive #app :is(.eyebrow, .l-proof-item b) { color: var(--rb-champagne); }
body[data-space="user"].immersive #app :is(.card, .sess, .stat, .auth-card, .l-step, .l-fam, .l-aud-card, .tpl-card, .mandala-card, .badge-tile, .quiz-opt) {
  background: var(--card); border: 1px solid var(--line); backdrop-filter: blur(14px); box-shadow: 0 20px 60px rgba(0,0,0,.22), inset 0 1px 0 rgba(255,255,255,.07); }
body[data-space="user"].immersive #app .l-aud-card--gold { border-color: rgba(201,168,76,.45); background: var(--card); }
body[data-space="user"].immersive #app .badge-tile.won { background: rgba(201,168,76,.12); border-color: rgba(201,168,76,.45); }
body[data-space="user"].immersive #app .hero { background: linear-gradient(135deg, rgba(23,60,97,.55), rgba(11,26,54,.55)); border: 1px solid var(--line); backdrop-filter: blur(14px); box-shadow: none; }
body[data-space="user"].immersive #app .hero::after { display: none; }
body[data-space="user"].immersive #app .topbar { background: rgba(8,20,40,.6); border-bottom-color: var(--line); }
body[data-space="user"].immersive #app :is(.nav a.on, .nav-more-panel a.on, .mobile-drawer-links a.on) { background: rgba(127,211,204,.16); color: var(--rb-turq); }
body[data-space="user"].immersive #app .nav-more-panel { background: #0f2340; border-color: var(--line); }
body[data-space="user"].immersive #app .mobile-drawer-panel { background: var(--rb-deep); }
body[data-space="user"].immersive #app .mobile-drawer-links a { color: var(--ink); }
body[data-space="user"].immersive #app .mobile-drawer-close { background: var(--card); color: var(--ink-soft); border-color: var(--line); }
body[data-space="user"].immersive #app .menu-toggle { background: var(--card); border-color: var(--line); }
body[data-space="user"].immersive #app .menu-toggle span { background: var(--ink); }
body[data-space="user"].immersive #app .avatar { background: linear-gradient(135deg, var(--steel), var(--rb-ocean)); }
body[data-space="user"].immersive #app .breath-fab { background: var(--card); color: var(--ink-soft); border-color: var(--line); }
body[data-space="user"].immersive #app .breath-fab:hover { color: var(--rb-turq); border-color: rgba(127,211,204,.5); background: var(--accent-soft); }
body[data-space="user"].immersive #app .viewswitch button.on { background: var(--rb-turq); color: #06182b; }
body[data-space="user"].immersive #app :is(.chip.n, .pbar, .skel) { background: rgba(255,255,255,.12); }
body[data-space="user"].immersive #app .skel { background-image: linear-gradient(90deg, rgba(255,255,255,.08) 25%, rgba(255,255,255,.16) 50%, rgba(255,255,255,.08) 75%); }
body[data-space="user"].immersive #app :is(input[type=text], input[type=email], input[type=password], input[type=number], input[type=date], input[type=datetime-local], input[type=url], select, textarea) {
  background: rgba(5,15,30,.45); color: var(--ink); border-color: var(--line); }
body[data-space="user"].immersive #app :is(input, select, textarea):focus { background: rgba(5,15,30,.6); border-color: var(--rb-turq); box-shadow: 0 0 0 4px var(--accent-soft); }
body[data-space="user"].immersive #app ::placeholder { color: var(--ink-mute); }
body[data-space="user"].immersive #app .today-card { border-top-color: var(--rb-champagne); }
body[data-space="user"].immersive #app .rituel-tip { background: rgba(255,255,255,.05); border-color: rgba(201,168,76,.35); }
body[data-space="user"].immersive #app .l-section--tint { background: rgba(255,255,255,.035); }
body[data-space="user"].immersive #app .l-tab.on { background: rgba(255,255,255,.14); color: var(--ink); }
body[data-space="user"].immersive #app .l-tab { color: var(--ink-soft); }
body[data-space="user"].immersive #app .btn.ghost { border-color: var(--line); }
body[data-space="user"].immersive #app .btn.ghost:hover { color: var(--rb-turq); border-color: rgba(127,211,204,.5); background: var(--accent-soft); }
body[data-space="user"].immersive #app .btn.accent { background: linear-gradient(135deg, var(--rb-turq), var(--steel)); color: #06182b; box-shadow: 0 10px 30px rgba(72,145,181,.35); }
body[data-space="user"].immersive #app .playbtn { background: linear-gradient(135deg, var(--rb-turq), var(--steel)); color: #06182b; box-shadow: 0 12px 36px rgba(72,145,181,.45); }
body[data-space="user"].immersive #app .sess:hover { background: rgba(255,255,255,.1); }
body[data-space="user"].immersive #app .sess .num { background: rgba(255,255,255,.1); color: var(--ink-soft); }
body[data-space="user"].immersive #app table.tbl th { color: var(--ink-mute); }
body[data-space="user"].immersive #app .l-footer { border-top-color: var(--line); }
body[data-space="user"].immersive #app .l-footer a { color: var(--ink-soft); }
body[data-space="user"].immersive #app .linkish { color: var(--rb-turq); }
body[data-space="user"].immersive .toast { background: rgba(127,211,204,.95); color: #06182b; }
body[data-space="user"].immersive .toast.err { background: var(--bad); color: #fff; }

/* ── portail (page d'accueil) ── */
body.immersive .rb-portal { align-items: center; min-height: calc(100vh - 90px); padding: 10px 0 40px; }
body.immersive .rb-portal .l-h1 { font-size: clamp(40px, 5.6vw, 78px); font-weight: 400; letter-spacing: -.01em; }
body.immersive .rb-portal .l-lead { font-size: clamp(16.5px, 1.5vw, 19px); }
body.immersive .rb-portal-slot { aspect-ratio: 1; width: min(42vw, 520px); justify-self: center; }
body.immersive .rb-entry { display: grid; justify-items: center; gap: 10px; padding: 30px 0 50px; }
body.immersive .rb-entry-slot { width: min(36vw, 260px); aspect-ratio: 1; }
body.immersive .rb-entry .l-auth { position: static; margin: 0 auto; max-width: 440px; width: 100%; }

/* ── cartes programme = ambiances ── */
body[data-space="user"].immersive #app .prog-card { background: var(--card); border: 1px solid var(--line); backdrop-filter: blur(14px); }
body[data-space="user"].immersive #app .prog-card .cover { position: relative; overflow: hidden; }
body[data-space="user"].immersive #app .prog-card .cover::before { content: ""; position: absolute; inset: -40% -20% auto; height: 120%; border-radius: 50%;
  background: radial-gradient(circle, var(--amb-glow, rgba(127,211,204,.4)), transparent 62%); opacity: .6; transition: transform .9s cubic-bezier(.16,1,.3,1), opacity .4s; }
body[data-space="user"].immersive #app .prog-card:hover .cover::before, body[data-space="user"].immersive #app .prog-card:focus-visible .cover::before { transform: translate(6%, 10%) scale(1.15); opacity: .9; }
body[data-space="user"].immersive #app .prog-card .cover.catA, body[data-space="user"].immersive #app .prog-card .cover.catB,
body[data-space="user"].immersive #app .prog-card .cover.catC, body[data-space="user"].immersive #app .prog-card .cover.catD { background: var(--amb-bg, linear-gradient(160deg, rgba(23,60,97,.85), rgba(11,26,54,.9))); }
body.immersive .amb-eau { --amb-bg: linear-gradient(160deg, rgba(23,60,97,.85), rgba(11,26,54,.9)); --amb-glow: rgba(123,175,212,.5); }
body.immersive .amb-nuit { --amb-bg: linear-gradient(160deg, rgba(16,28,54,.9), rgba(6,12,28,.95)); --amb-glow: rgba(107,138,179,.4); }
body.immersive .amb-clair { --amb-bg: linear-gradient(160deg, rgba(41,107,153,.85), rgba(18,59,94,.9)); --amb-glow: rgba(163,219,237,.55); }
body.immersive .amb-large { --amb-bg: linear-gradient(160deg, rgba(31,84,128,.85), rgba(14,35,66,.9)); --amb-glow: rgba(227,205,138,.42); }
body.immersive .amb-profond { --amb-bg: linear-gradient(160deg, rgba(15,54,66,.9), rgba(6,23,38,.95)); --amb-glow: rgba(107,194,189,.45); }

/* ── fiche programme ── */
body.immersive .rb-prog-hero { display: grid; grid-template-columns: auto 1fr; gap: 28px; align-items: center; }
body.immersive .rb-detail-slot { width: min(30vw, 240px); aspect-ratio: 1; }
body.immersive .rb-prog-hero .spread { align-items: flex-start; }

/* ── lecteur : la sphère remplace le cercle ── */
body.immersive .rb-player-slot { width: min(64vw, 320px); aspect-ratio: 1; }
/* la sphère est dessinée DERRIÈRE la page : le conteneur qui l'encadre ne doit ni la flouter ni la voiler */
body[data-space="user"].immersive #app :is(.card:has(.rb-player-slot), .hero.rb-prog-hero) { backdrop-filter: none; background: transparent; border-color: transparent; box-shadow: none; }
.rb-phase { font-family: var(--font-display); font-size: clamp(26px, 3.6vw, 40px); font-style: italic; color: var(--ink); min-height: 1.2em; margin-top: 36px; text-align: center; }
.rb-timer { font-variant-numeric: tabular-nums; letter-spacing: .12em; color: var(--ink-soft); font-size: 14px; margin-top: 4px; text-align: center; }

/* ── compagnon respiratoire ── */
.rb-breathe { position: fixed; inset: 0; z-index: 88; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 70px 20px 30px; overflow-y: auto; color: var(--rb-nacre); }
.rb-breathe[hidden] { display: none; }
.rb-breathe .rb-close { position: absolute; top: 18px; right: 18px; width: 42px; height: 42px; border-radius: 50%; border: 1.5px solid rgba(255,255,255,.2); background: rgba(255,255,255,.07); color: var(--rb-nacre); font-size: 16px; cursor: pointer; }
.rb-breathe-stage { position: relative; }
.rb-breathe-slot { width: min(62vw, 320px); aspect-ratio: 1; }
.rb-ring { position: absolute; inset: -6%; pointer-events: none; }
.rb-ring circle { fill: none; stroke-width: 1.2; }
.rb-ring .bg { stroke: rgba(255,255,255,.12); }
.rb-ring .fg { stroke: var(--rb-turq); stroke-linecap: round; transition: stroke-dashoffset .25s linear; }
.rb-breathe-ui { width: 100%; max-width: 560px; text-align: center; }
.rb-breathe .rb-phase { color: var(--rb-nacre); margin-top: 18px; }
.rb-breathe .rb-timer { color: rgba(242,246,251,.74); }
.rb-rhythms { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; margin: 14px 0 6px; }
.rb-rhythms button { border: 1px solid rgba(255,255,255,.16); background: rgba(255,255,255,.07); color: rgba(242,246,251,.8); border-radius: 999px; padding: 8px 14px; font: 500 13px var(--font-ui); cursor: pointer; }
.rb-rhythms button.on { color: var(--rb-turq); border-color: rgba(127,211,204,.6); background: rgba(127,211,204,.12); }
.rb-note { font-size: 12.5px; color: rgba(242,246,251,.6); min-height: 1.4em; max-width: 460px; margin: 10px auto 0; }
.rb-durs { display: flex; gap: 10px; justify-content: center; margin: 10px 0; flex-wrap: wrap; align-items: center; transition: opacity .3s; }
.rb-durs.off { opacity: .45; }
.rb-durs label { font-size: 12px; color: rgba(242,246,251,.6); display: flex; flex-direction: column; gap: 4px; align-items: center; text-transform: none; letter-spacing: 0; }
.rb-durs input, .rb-durs select { width: 72px; text-align: center; padding: 8px; background: rgba(5,15,30,.5); color: var(--rb-nacre); border: 1px solid rgba(255,255,255,.16); border-radius: 9px; font: 14px var(--font-ui); }
.rb-durs select { width: auto; }
.rb-row { display: flex; gap: 10px; justify-content: center; margin-top: 12px; }
.rb-breathe .btn.ghost { color: var(--rb-nacre); border-color: rgba(255,255,255,.22); }
.rb-breathe .btn.accent { background: linear-gradient(135deg, var(--rb-turq), var(--steel)); color: #06182b; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* ── réglages d'immersion (bouton flottant) ── */
.rb-settings { position: fixed; right: 20px; bottom: 20px; z-index: 60; }
.rb-settings[hidden] { display: none; }
.rb-settings-btn { width: 42px; height: 42px; border-radius: 50%; border: 1.5px solid rgba(255,255,255,.2); background: rgba(8,20,40,.7); color: var(--rb-nacre); cursor: pointer; font-size: 16px; backdrop-filter: blur(10px); }
.rb-settings-panel { position: absolute; right: 0; bottom: 54px; width: min(300px, calc(100vw - 40px)); background: rgba(8,20,40,.92); border: 1px solid rgba(255,255,255,.16); border-radius: 18px; padding: 18px; color: var(--rb-nacre); backdrop-filter: blur(16px); box-shadow: 0 20px 60px rgba(0,0,0,.4); text-align: left; }
.rb-settings-panel[hidden] { display: none; }
.rb-settings-panel h4 { font-size: 12px; letter-spacing: .14em; text-transform: uppercase; color: var(--rb-champagne); margin-bottom: 10px; }
.rb-levels { display: grid; gap: 4px; }
.rb-levels label, .rb-toggle { display: flex; gap: 10px; align-items: center; font-size: 14px; cursor: pointer; padding: 6px 8px; border-radius: 8px; color: var(--rb-nacre); text-transform: none; letter-spacing: 0; font-weight: 400; margin: 0; }
.rb-toggle { justify-content: space-between; margin-top: 4px; }
.rb-levels input, .rb-toggle input { accent-color: var(--rb-turq); width: 16px; height: 16px; }
.rb-fps { font-size: 11.5px; color: rgba(242,246,251,.55); margin-top: 8px; font-variant-numeric: tabular-nums; }
.rb-settings-panel .rb-note { margin-top: 8px; font-size: 11.5px; }

@media (max-width: 900px) {
  body.immersive .rb-portal { grid-template-columns: 1fr; text-align: center; padding-top: 10px; }
  body.immersive .rb-portal-slot { width: min(62vw, 280px); order: -1; }
  body.immersive .rb-portal .l-lead { margin-left: auto; margin-right: auto; }
  body.immersive .rb-portal .l-cta-row, body.immersive .rb-portal .l-proof { justify-content: center; }
  body.immersive .rb-prog-hero { grid-template-columns: 1fr; justify-items: center; text-align: center; }
  .rb-corner { right: 14px; top: 66px; width: 64px; height: 64px; }
}
@media (max-width: 640px) {
  /* portail téléphone : sphère plus compacte, texte serré, boutons empilés pleine largeur */
  body.immersive .rb-portal { min-height: 0; gap: 14px; padding: 0 0 26px; }
  body.immersive .rb-portal-slot { width: min(58vw, 230px); }
  body.immersive .rb-portal .eyebrow { font-size: 11px; letter-spacing: .12em; }
  body.immersive .rb-portal .l-h1 { font-size: 38px; margin: 4px 0 12px; }
  body.immersive .rb-portal .l-lead { font-size: 16px; line-height: 1.5; margin-bottom: 18px; }
  body.immersive .rb-portal .l-cta-row { margin-top: 18px; gap: 10px; }
  body.immersive .rb-portal .l-cta-row .btn { flex: 1 1 100%; justify-content: center; }
  body.immersive .rb-portal .l-proof { gap: 14px 22px; margin-top: 22px; }
  body.immersive .rb-portal .l-proof-item b { font-size: 26px; }
  body.immersive .rb-entry { padding: 20px 0 40px; }
  body.immersive .rb-entry-slot { width: min(44vw, 170px); }
  body.immersive .rb-player-slot { width: min(70vw, 280px); }
  .rb-phase { font-size: 28px; margin-top: 26px; }
  body.immersive .rb-detail-slot { width: min(50vw, 190px); }
  .rb-breathe { padding: 64px 14px 24px; justify-content: flex-start; }
  .rb-breathe-slot { width: min(56vw, 230px); }
  .rb-breathe .rb-phase { margin-top: 12px; font-size: 26px; }
  .rb-rhythms button { padding: 7px 11px; font-size: 12.5px; }
  .rb-durs { gap: 6px; }
  .rb-durs input { width: 62px; padding: 7px; }
  .rb-durs select { width: auto; min-width: 84px; padding: 7px; }
  .rb-settings { bottom: 16px; right: 14px; }
  /* catalogue téléphone : recherche empilée, filtres en bande horizontale défilante (pas 39 pastilles empilées) */
  body[data-space="user"].immersive #app #ps-input { flex: 1 1 100%; min-width: 0; }
  body[data-space="user"].immersive #app #ps-go { width: 100%; }
  body[data-space="user"].immersive #app #prog-filters { flex-wrap: nowrap; overflow-x: auto; -webkit-overflow-scrolling: touch; scrollbar-width: none; margin-left: -22px; margin-right: -22px; padding: 2px 22px 8px; scroll-snap-type: x proximity; }
  body[data-space="user"].immersive #app #prog-filters::-webkit-scrollbar { display: none; }
  body[data-space="user"].immersive #app #prog-filters .btn { flex: 0 0 auto; white-space: nowrap; scroll-snap-align: start; }
  body[data-space="user"].immersive #app .prog-card .cover { height: 96px; font-size: 40px; }
  body[data-space="user"].immersive #app .shell { padding-bottom: 80px; }
  /* 01/11/2026 : sans barre d'onglets (accueil, pas connecté), le bouton calé à 80 px
     (espace.css) tombait sur « Entrer dans ma bulle ». Il monte en haut de page et défile avec elle. */
  body[data-space="user"]:not(:has(.tabbar)) .rb-settings { position: absolute; top: calc(76px + env(safe-area-inset-top)); bottom: auto; }
  body[data-space="user"]:not(:has(.tabbar)) .rb-settings-panel { top: 54px; bottom: auto; }
}
@media (prefers-reduced-motion: reduce) {
  body.immersive .rb-prog-hero, body[data-space="user"].immersive #app .prog-card .cover::before { transition: none; }
}
