/* Ondes — thème sombre apaisant (bleu nuit, turquoise doux, lavande), mobile d'abord, zones de sécurité iPhone. */
:root {
  --bg: #0b1224; --bg2: #101a33; --card: #131d38; --card2: #182444; --line: #26365e; --ink: #eef2ff; --muted: #9aa8cc; --dim: #6f7ea6;
  --turq: #7fe3d3; --turq-d: #3fbfae; --lav: #b7a6ff; --lav-d: #8b78ec; --warn: #ffc978; --err: #ff9b93; --ok: #8ee6a6;
  --r: 20px; --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; background: var(--bg); }
body { margin: 0; min-height: 100vh; font-family: var(--font); color: var(--ink); line-height: 1.45;
  background: radial-gradient(1200px 700px at 85% -10%, #20305e 0%, transparent 60%), radial-gradient(900px 600px at -10% 110%, #123a44 0%, transparent 55%), var(--bg);
  padding: env(safe-area-inset-top) env(safe-area-inset-right) calc(env(safe-area-inset-bottom) + 72px) env(safe-area-inset-left); }
button, input, select { font: inherit; color: inherit; }
a { color: var(--turq); }
:focus-visible { outline: 3px solid var(--lav); outline-offset: 2px; border-radius: 10px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: -999px; top: 8px; } .skip:focus { left: 12px; z-index: 50; background: var(--card); padding: 8px 12px; border-radius: 10px; }
.ic { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex-shrink: 0; }

/* En-tête */
.top { display: flex; align-items: center; gap: 10px; max-width: 1240px; margin: 0 auto; padding: 14px 16px 10px; }
.brand { display: flex; align-items: center; gap: 10px; color: var(--ink); text-decoration: none; font-weight: 800; font-size: 1.6rem; letter-spacing: -.02em; margin-right: auto; }
.brand b { color: var(--turq); } .brand img { border-radius: 12px; }
.chip.local { font-size: .78rem; color: var(--turq); border: 1px solid #2e5c64; background: #0f2a33; padding: 5px 10px; border-radius: 99px; white-space: nowrap; }

/* Boutons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 48px; padding: 10px 18px; border-radius: 14px; border: 1px solid var(--line); background: var(--card2); color: var(--ink); font-weight: 700; cursor: pointer; text-decoration: none; }
.btn:hover { border-color: #3a4f85; } .btn:disabled { opacity: .45; cursor: default; }
.btn.primary { background: linear-gradient(135deg, var(--turq) 0%, #a7efe4 100%); color: #08222a; border-color: transparent; }
.btn.danger { background: #3a1d28; border-color: #6e3346; color: #ffd0d6; }
.btn.ghost { background: transparent; } .btn.small { min-height: 40px; padding: 6px 12px; font-size: .9rem; }
.icon-btn { display: inline-grid; place-items: center; width: 48px; height: 48px; flex-shrink: 0; border-radius: 14px; border: 1px solid var(--line); background: var(--card2); color: var(--ink); cursor: pointer; font-size: 1.4rem; font-weight: 700; }
.icon-btn.sm { width: 36px; height: 36px; border-radius: 10px; } .icon-btn.sm .ic { width: 18px; height: 18px; }
.icon-btn:disabled { opacity: .35; cursor: default; }
.icon-btn.on { color: var(--turq); border-color: #2e5c64; background: #0f2a33; }
.icon-btn.star.on { color: #ffd76e; border-color: #6b5a2a; background: #2c2513; } .icon-btn.star.on .ic { fill: currentColor; }
.linkbtn { display: inline-flex; align-items: center; gap: 6px; min-height: 44px; background: none; border: 0; padding: 6px 0; color: var(--turq); font-weight: 600; cursor: pointer; text-decoration: underline; text-underline-offset: 3px; }
.linkbtn .ic { width: 18px; height: 18px; }

/* Mise en page : lecteur puis catalogue puis réglages sur téléphone ; deux colonnes sur ordinateur */
.layout { display: grid; gap: 14px; max-width: 1240px; margin: 0 auto; padding: 0 12px; grid-template-areas: "player" "catalog" "settings"; }
.player { grid-area: player; } .settings { grid-area: settings; } .catalog { grid-area: catalog; }
@media (min-width: 1000px) {
  .layout { grid-template-columns: minmax(400px, 460px) minmax(0, 1fr); grid-template-areas: "player catalog" "settings catalog"; align-items: start; padding: 0 16px; gap: 18px; }
  .catalog { position: sticky; top: 12px; max-height: calc(100vh - 24px); overflow: auto; overscroll-behavior: contain; }
}
.card { background: linear-gradient(180deg, var(--card) 0%, #111a33 100%); border: 1px solid var(--line); border-radius: var(--r); padding: 16px; box-shadow: 0 20px 50px #02061733; min-width: 0; }
.loading { color: var(--muted); }
h2, h3 { margin: 0; } .note { color: var(--muted); font-size: .88rem; margin: 6px 0; } .note.err, .err { color: var(--err); } .note.warn { color: var(--warn); }
.center { text-align: center; } .kicker { font-size: .7rem; letter-spacing: .14em; text-transform: uppercase; color: var(--dim); font-weight: 700; }
.n { display: inline-grid; place-items: center; min-width: 30px; height: 26px; margin-right: 10px; border-radius: 8px; border: 1px solid var(--line); color: var(--turq); font-size: .75rem; font-weight: 800; }

/* Lecteur */
.phead { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.status { font-size: .88rem; color: var(--muted); display: inline-flex; align-items: center; gap: 8px; } .status::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--dim); }
.status.on { color: var(--turq); } .status.on::before { background: var(--turq); box-shadow: 0 0 10px var(--turq); } .status.warn { color: var(--warn); } .status.warn::before { background: var(--warn); }
.pname { font-size: 1.15rem; margin: 10px 0 0; text-align: center; overflow-wrap: anywhere; }
.orb-stage { display: grid; place-items: center; padding: 14px 0 6px; }
.orb { --in: 4s; --cycle: 10s; position: relative; width: min(58vw, 230px); aspect-ratio: 1; display: grid; place-items: center; }
.orb .ring { position: absolute; inset: 0; border-radius: 50%; border: 1px solid #3a4f85; opacity: .5; } .orb .r2 { inset: -14%; opacity: .25; }
.orb-core { position: relative; width: 78%; aspect-ratio: 1; border-radius: 50%; display: grid; place-content: center; text-align: center;
  background: radial-gradient(circle at 35% 30%, #c9fff5 0%, #7fe3d3 24%, #5b8fd6 58%, #6b5cc8 100%); box-shadow: 0 0 60px #7fe3d355, inset 0 -10px 30px #1b1450aa; transition: transform .6s ease; }
.orb-num { font-size: clamp(2.4rem, 11vw, 3.4rem); font-weight: 800; letter-spacing: -.03em; line-height: 1; color: #fff; text-shadow: 0 2px 12px #0b122466; font-variant-numeric: tabular-nums; }
.orb-unit { font-weight: 700; color: #e9f6ff; font-size: .9rem; }
.orb.live .r1 { animation: ring 4s ease-out infinite; } .orb.live .r2 { animation: ring 4s ease-out 2s infinite; }
@keyframes ring { from { transform: scale(.85); opacity: .55; } to { transform: scale(1.15); opacity: 0; } }
.orb.breathing .orb-core { animation: breathe var(--cycle) ease-in-out infinite; }
.orb.breathing.long-out .orb-core { animation-name: breathe46; }
@keyframes breathe { 0% { transform: scale(.86); } 50% { transform: scale(1.06); } 100% { transform: scale(.86); } }
@keyframes breathe46 { 0% { transform: scale(.86); } 40% { transform: scale(1.06); } 100% { transform: scale(.86); } }
.breath-prompt { min-height: 1.4em; margin: 10px 0 0; color: var(--lav); font-weight: 600; }
.orb-sub { display: block; text-align: center; color: var(--muted); font-size: .92rem; margin-top: 4px; } .orb-sub b { color: var(--ink); }
.pnext { text-align: center; color: var(--muted); font-size: .86rem; margin: 6px 0 0; min-height: 1.2em; }
.timeline { display: flex; gap: 6px; list-style: none; padding: 4px 2px 8px; margin: 10px 0 0; overflow-x: auto; scrollbar-width: thin; }
.tl { min-width: 58px; min-height: 48px; padding: 5px 8px; border-radius: 12px; border: 1px solid var(--line); background: var(--bg2); cursor: pointer; display: grid; text-align: center; }
.tl b { font-size: .95rem; font-variant-numeric: tabular-nums; } .tl small { font-size: .68rem; color: var(--dim); }
.tl.cur { border-color: var(--turq); background: #0f2a33; box-shadow: 0 0 0 1px var(--turq) inset; } .tl.done { opacity: .55; }
.controls { display: flex; justify-content: center; align-items: center; gap: 10px; margin: 14px 0 8px; flex-wrap: wrap; }
.play { min-width: 160px; min-height: 56px; font-size: 1.1rem; border-radius: 16px; } .play .ic { fill: currentColor; stroke: none; }
.controls .icon-btn .ic { fill: currentColor; stroke: none; } .controls .icon-btn[aria-label="Répéter le parcours"] .ic { fill: none; stroke: currentColor; }
.ptrack { display: flex; align-items: center; gap: 12px; } .progress { flex: 1; height: 6px; border-radius: 99px; background: #22305a; overflow: hidden; }
.progress i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--turq), var(--lav)); transition: width .25s linear; }
.ptime { font-variant-numeric: tabular-nums; color: var(--muted); font-size: .88rem; white-space: nowrap; }
.prow { display: flex; flex-wrap: wrap; gap: 4px 18px; justify-content: center; margin-top: 8px; }
.note.phones { display: flex; align-items: center; gap: 8px; color: var(--lav); justify-content: center; }

/* Réglages */
.block { padding: 14px 0; border-top: 1px solid #1f2c52; } .block:first-of-type { border-top: 0; padding-top: 0; }
.block h3 { display: flex; align-items: center; font-size: 1.05rem; margin-bottom: 10px; }
.freq-row { display: flex; gap: 8px; align-items: stretch; }
.freq-box { flex: 1; display: flex; align-items: baseline; justify-content: flex-end; gap: 6px; border: 1px solid #34477a; border-radius: 14px; background: var(--bg2); padding: 6px 14px; min-width: 0; }
.freq-in { width: 100%; min-width: 0; background: none; border: 0; text-align: right; font-size: 2rem; font-weight: 800; font-variant-numeric: tabular-nums; color: #fff; padding: 0; }
.freq-in:focus { outline: none; } .freq-box:focus-within { border-color: var(--turq); } .freq-box span { color: var(--turq); font-weight: 700; }
input[type=range] { width: 100%; accent-color: var(--turq); margin: 12px 0 4px; min-height: 32px; }
.seg { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 4px; padding: 4px; border-radius: 14px; border: 1px solid var(--line); background: var(--bg2); }
.seg.wrap { grid-auto-flow: row; grid-template-columns: repeat(auto-fit, minmax(84px, 1fr)); }
.seg-btn { min-height: 44px; border: 0; border-radius: 11px; background: none; color: var(--muted); font-weight: 700; cursor: pointer; padding: 6px 8px; }
.seg-btn.on { background: linear-gradient(135deg, var(--turq), #a7efe4); color: #08222a; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 10px 0 4px; }
.chip { min-height: 40px; padding: 6px 12px; border-radius: 99px; border: 1px solid var(--line); background: var(--bg2); color: var(--ink); cursor: pointer; font-weight: 600; font-size: .9rem; }
.chip.on { border-color: var(--turq); color: var(--turq); background: #0f2a33; } .chip small { color: var(--dim); }
.beat-row { display: flex; align-items: center; gap: 10px; margin-top: 10px; } .beat-row label { display: flex; align-items: center; gap: 8px; width: 100%; color: var(--muted); }
.beat-in { width: 6.5em; min-height: 44px; border-radius: 12px; border: 1px solid #34477a; background: var(--bg2); padding: 6px 10px; text-align: right; font-weight: 700; color: #fff; }
.waves { display: grid; grid-template-columns: repeat(auto-fit, minmax(96px, 1fr)); gap: 6px; }
.wave-btn { display: grid; justify-items: center; gap: 2px; min-height: 76px; padding: 8px 4px; border-radius: 14px; border: 1px solid var(--line); background: var(--bg2); cursor: pointer; text-align: center; }
.wave-btn b { font-size: .85rem; } .wave-btn small { font-size: .72rem; color: var(--dim); } .wave-btn small.rec { color: #ffd76e; }
.wave-btn.on { border-color: var(--turq); background: #0f2a33; box-shadow: 0 0 0 1px var(--turq) inset; }
.wave-ic { width: 40px; height: 20px; fill: none; stroke: var(--lav); stroke-width: 2.2; stroke-linejoin: round; stroke-linecap: round; } .wave-btn.on .wave-ic { stroke: var(--turq); }
.rec-why b { color: var(--ink); }
.field { margin-top: 12px; } .flabel { display: block; font-weight: 700; margin-bottom: 6px; font-size: .92rem; }
.range-row { display: block; margin-top: 4px; } .range-row > span { font-weight: 700; font-size: .92rem; } output { color: var(--turq); font-variant-numeric: tabular-nums; }

/* Catalogue */
.cat-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 4px 12px; } .cat-head h2 { display: flex; align-items: center; font-size: 1.15rem; }
.search-box { display: flex; align-items: center; gap: 8px; margin: 12px 0 10px; padding: 0 12px; border-radius: 14px; border: 1px solid var(--line); background: var(--bg2); }
.search-box .ic { color: var(--dim); } .search { flex: 1; min-width: 0; min-height: 46px; border: 0; background: none; font-size: 1rem; } .search:focus { outline: none; } .search-box:focus-within { border-color: var(--turq); }
.tabs { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 6px; scrollbar-width: thin; }
.tab { flex-shrink: 0; min-height: 42px; padding: 6px 14px; border-radius: 99px; border: 1px solid var(--line); background: var(--bg2); color: var(--muted); font-weight: 700; cursor: pointer; }
.tab.on { color: var(--turq); border-color: #2e7c74; background: #0f2a33; }
.filters { margin: 4px 0 8px; } .filters .chip { min-height: 36px; font-size: .82rem; }
.cards { display: grid; gap: 8px; grid-template-columns: 1fr; } @media (min-width: 640px) { .cards { grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); } }
.cat-text, .cards > .row, .cards > .empty { grid-column: 1 / -1; } .empty { color: var(--muted); text-align: center; padding: 20px 0; }
.cards > .row { display: flex; flex-wrap: wrap; gap: 8px; }
.pcard { display: flex; gap: 6px; border: 1px solid var(--line); border-radius: 16px; background: var(--bg2); padding: 4px; min-width: 0; }
.pcard.sel { border-color: var(--turq); box-shadow: 0 0 0 1px var(--turq) inset; }
.pmain { flex: 1; min-width: 0; display: grid; gap: 3px; text-align: left; padding: 10px 10px; border: 0; background: none; cursor: pointer; border-radius: 12px; }
.pmain:hover .ptitle { color: var(--turq); } .ptitle { font-size: 1rem; overflow-wrap: anywhere; } .psum { color: var(--lav); font-size: .88rem; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.pmeta { display: flex; flex-wrap: wrap; gap: 4px 6px; align-items: center; color: var(--muted); font-size: .78rem; margin-top: 2px; }
.tag { display: inline-flex; align-items: center; gap: 4px; padding: 2px 8px; border-radius: 99px; background: #1d2a50; color: var(--muted); } .tag.phones { color: var(--lav); } .tag .ic { width: 14px; height: 14px; }
.tag.soft { background: none; border: 1px solid #2a3a66; } .tag.wave { background: #10302f; color: var(--turq); }
.pside { display: flex; flex-direction: column; gap: 4px; justify-content: center; } .pside .icon-btn { width: 44px; height: 44px; }

/* Pied de page, barre compacte, bannière, notifications */
.foot { max-width: 1240px; margin: 18px auto 0; padding: 0 16px 12px; color: var(--muted); font-size: .85rem; } .mute { color: var(--dim); }
.minibar { position: fixed; z-index: 30; left: 8px; right: 8px; bottom: calc(8px + env(safe-area-inset-bottom)); display: flex; align-items: center; gap: 10px; padding: 8px; border-radius: 18px; border: 1px solid #34477a; background: #121c3acc; backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); box-shadow: 0 10px 30px #0008; }
.minibar .icon-btn .ic { fill: currentColor; stroke: none; } .mb-play { background: linear-gradient(135deg, var(--turq), #a7efe4); color: #08222a; border: 0; }
.mb-txt { flex: 1; min-width: 0; display: grid; } .mb-txt b { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; } .mb-txt small { color: var(--muted); font-variant-numeric: tabular-nums; }
@media (min-width: 1000px) { .minibar { left: auto; right: 16px; width: 420px; } }
.update-banner { position: fixed; z-index: 40; top: calc(8px + env(safe-area-inset-top)); left: 50%; transform: translateX(-50%); width: min(560px, calc(100% - 16px)); display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 12px 10px 16px; border-radius: 16px; background: #1b2a52; border: 1px solid #3a4f85; box-shadow: 0 10px 30px #0008; font-size: .92rem; }
.toast { position: fixed; z-index: 60; left: 50%; transform: translateX(-50%); bottom: calc(86px + env(safe-area-inset-bottom)); max-width: calc(100% - 24px); padding: 10px 16px; border-radius: 14px; background: #eef2ff; color: #0b1224; font-weight: 600; box-shadow: 0 10px 30px #0008; }
[hidden] { display: none !important; }
.noscript { padding: 20px; text-align: center; }

/* Modales */
dialog.modal { width: min(520px, calc(100vw - 20px)); max-height: calc(100dvh - 24px); padding: 0; border-radius: 20px; border: 1px solid #34477a; background: var(--card); color: var(--ink); box-shadow: 0 30px 80px #000a; }
dialog.modal.wide { width: min(720px, calc(100vw - 20px)); }
dialog.modal::backdrop { background: #050916cc; backdrop-filter: blur(3px); }
.modal-head { position: sticky; top: 0; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 14px 10px 20px; background: var(--card); border-bottom: 1px solid #1f2c52; z-index: 1; } .modal-head h2 { font-size: 1.15rem; }
.modal-body { padding: 14px 20px; overflow-wrap: anywhere; } .modal-actions { position: sticky; bottom: 0; display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; padding: 12px 20px 16px; background: var(--card); border-top: 1px solid #1f2c52; }
.prose h3 { font-size: 1rem; margin: 16px 0 6px; color: var(--lav); } .prose p, .prose li { color: #d7defa; } .prose ul { padding-left: 20px; } .refs li { margin: 6px 0; }
.steps { padding-left: 20px; } .steps li { margin: 6px 0; }
table.diag { width: 100%; border-collapse: collapse; margin: 10px 0; font-variant-numeric: tabular-nums; } .diag th, .diag td { padding: 8px 6px; border-bottom: 1px solid #1f2c52; text-align: right; } .diag th[scope=row], .diag thead th:first-child { text-align: left; }
.diag td.ok { color: var(--ok); } .diag td.ko { color: var(--err); }

/* Éditeur de parcours */
.ed-row { display: grid; grid-template-columns: 7.5em 1fr; align-items: center; gap: 8px; margin: 6px 0; } .ed-row span { color: var(--muted); font-weight: 600; }
.ed-name, .editor select, .ed-step input { min-height: 44px; border-radius: 12px; border: 1px solid #34477a; background: var(--bg2); padding: 6px 10px; color: #fff; min-width: 0; width: 100%; }
.ed-steps { list-style: none; padding: 0; margin: 10px 0; display: grid; gap: 8px; }
.ed-step { display: grid; grid-template-columns: 26px 1.4fr 1fr 1fr 0.8fr; gap: 6px; align-items: end; padding: 8px; border-radius: 14px; border: 1px solid var(--line); background: var(--bg2); }
.ed-step label { display: grid; gap: 2px; min-width: 0; } .ed-step small { color: var(--dim); font-size: .7rem; } .ed-n { align-self: center; color: var(--turq); font-weight: 800; text-align: center; }
.ed-tools { grid-column: 2 / -1; display: flex; gap: 6px; justify-content: flex-end; } .ed-gap { display: block; }
@media (max-width: 420px) { .ed-step { grid-template-columns: 22px 1fr 1fr; } .ed-step label:nth-of-type(1) { grid-column: 2 / -1; } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .orb.breathing .orb-core { transform: none; }
}
@media (max-width: 380px) { .play { min-width: 130px; } .controls { gap: 6px; } .icon-btn { width: 44px; height: 44px; } }
@media (min-width: 640px) { .tabs { flex-wrap: wrap; overflow: visible; } }
@media (max-width: 480px) {
  .phead .kicker { display: none; }
  .controls { gap: 8px; } .play { min-width: 0; flex: 1 1 auto; max-width: 170px; padding: 10px 12px; }
  .modal-actions .btn { flex: 1 1 auto; }
}
/* Bloc « Son » du lecteur */
.sound { margin-top: 14px; padding-top: 12px; border-top: 1px solid #1f2c52; }
.mix { margin-top: 10px; } .mix .flabel output { font-weight: 600; font-size: .85rem; margin-left: 6px; }
.mix-row { display: flex; align-items: center; gap: 10px; } .mix-row input { flex: 1; margin: 6px 0; } .mix-end { font-size: .78rem; color: var(--dim); font-weight: 700; }
.check { display: flex; align-items: flex-start; gap: 10px; margin-top: 12px; min-height: 44px; cursor: pointer; font-size: .9rem; }
.check input { width: 22px; height: 22px; margin: 1px 0 0; accent-color: var(--turq); flex-shrink: 0; } .check small { color: var(--muted); font-weight: 400; }

/* Très basses fréquences (binaural) */
.phones-box { display: flex; gap: 12px; align-items: flex-start; margin: 12px 0; padding: 12px 14px; border-radius: 16px; border: 1.5px solid rgba(255, 196, 92, .55); background: rgba(255, 196, 92, .1); }
.phones-box > svg { flex: none; width: 30px; height: 30px; margin-top: 2px; }
.phones-box b { display: block; font-size: 1.02rem; }
.phones-box .btn { margin-top: 6px; }
.ears { display: grid; grid-template-columns: 1fr auto 1fr; gap: 8px; align-items: center; margin: 12px 0 6px; }
.ear { display: flex; flex-direction: column; align-items: center; padding: 10px 6px; border-radius: 14px; border: 1.5px solid rgba(127, 227, 211, .45); }
.ear.auto { border-style: dashed; opacity: .9; }
.ear b { font-size: 1.25rem; font-variant-numeric: tabular-nums; }
.ear small { opacity: .8; }
.ears-gap { font-size: .85rem; text-align: center; opacity: .85; }
.note.err { color: #ff9d9d; }
