/* ============================================================
   app.css — Calm Wave Studio
   ============================================================ */
:root {
  --ink: #eef6f8;
  --muted: rgba(230, 242, 246, 0.68);
  --glass: rgba(10, 22, 38, 0.55);
  --glass-strong: rgba(10, 22, 38, 0.82);
  --line: rgba(255, 255, 255, 0.12);
  --teal: #3fd0e0;
  --teal-dark: #0ea5b8;
  --gold: #f3c77a;
  --radius: 18px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
  color-scheme: dark;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { min-height: 100%; }
body {
  font-family: 'Inter', system-ui, sans-serif; color: var(--ink); background: #0b1a2e;
  -webkit-font-smoothing: antialiased; -webkit-tap-highlight-color: transparent;
  padding-bottom: calc(150px + var(--safe-b));
}
#bg { position: fixed; inset: 0; width: 100%; height: 100%; z-index: -1; }
h1, h2 { font-family: 'Fraunces', Georgia, serif; font-weight: 600; letter-spacing: -0.01em; }
h1 { font-size: 1.7rem; margin-bottom: 6px; }
h2 { font-size: 1.2rem; margin-bottom: 8px; }
a { color: var(--teal); }
.muted { color: var(--muted); }
.small { font-size: 0.82rem; }
.center { text-align: center; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
button { font: inherit; color: inherit; cursor: pointer; }
button:disabled { opacity: 0.45; cursor: default; }
:focus-visible { outline: 2px solid var(--teal); outline-offset: 2px; }

/* Barre du haut */
.topbar {
  position: sticky; top: 0; z-index: 5; display: flex; align-items: center; justify-content: space-between;
  padding: calc(10px + var(--safe-t)) 18px 10px; background: linear-gradient(rgba(6, 14, 26, 0.75), rgba(6, 14, 26, 0));
}
.brand { font-family: 'Fraunces', serif; font-size: 1.15rem; color: var(--ink); text-decoration: none; font-weight: 600; }
.brand-wave { color: var(--teal); }
.top-actions { display: flex; gap: 6px; }
.icon-btn {
  background: var(--glass); border: 1px solid var(--line); border-radius: 50%; width: 40px; height: 40px;
  display: inline-flex; align-items: center; justify-content: center; font-size: 1.05rem; backdrop-filter: blur(10px);
}
.offline { margin: 0 18px 8px; padding: 8px 12px; border-radius: 10px; background: rgba(243, 199, 122, 0.18); font-size: 0.85rem; }

/* Vues */
main { max-width: 860px; margin: 0 auto; padding: 4px 16px 0; }
.view-head { margin: 12px 4px 16px; text-shadow: 0 1px 12px rgba(0, 0, 0, 0.55); }
.view-head h2 { margin-top: 18px; }

/* Mixeur */
.cat { margin-bottom: 18px; }
.cat-title { font-family: 'Inter', sans-serif; font-size: 0.78rem; letter-spacing: 0.12em; text-transform: uppercase; color: var(--muted); font-weight: 600; margin: 0 4px 8px; }
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.tile { background: var(--glass); border: 1px solid var(--line); border-radius: var(--radius); backdrop-filter: blur(12px); transition: border-color 0.2s, background 0.2s; }
.tile.on { border-color: rgba(63, 208, 224, 0.7); background: rgba(14, 90, 110, 0.5); }
.tile.locked { opacity: 0.72; }
.tile-btn { width: 100%; background: none; border: 0; padding: 14px 12px 12px; display: flex; flex-direction: column; align-items: flex-start; gap: 6px; position: relative; text-align: left; }
.tile-icon { font-size: 1.6rem; }
.tile-name { font-weight: 500; font-size: 0.92rem; }
.lock { position: absolute; top: 10px; right: 10px; font-size: 0.8rem; }
.tile-vol { display: flex; align-items: center; gap: 8px; padding: 0 12px 12px; }
.tile-vol output { font-size: 0.75rem; color: var(--muted); min-width: 34px; text-align: right; }
input[type='range'] { -webkit-appearance: none; appearance: none; width: 100%; height: 26px; background: transparent; }
input[type='range']::-webkit-slider-runnable-track { height: 5px; border-radius: 3px; background: rgba(255, 255, 255, 0.22); }
input[type='range']::-moz-range-track { height: 5px; border-radius: 3px; background: rgba(255, 255, 255, 0.22); }
input[type='range']::-webkit-slider-thumb { -webkit-appearance: none; width: 20px; height: 20px; border-radius: 50%; background: var(--teal); margin-top: -7.5px; box-shadow: 0 0 0 4px rgba(63, 208, 224, 0.2); }
input[type='range']::-moz-range-thumb { width: 20px; height: 20px; border: 0; border-radius: 50%; background: var(--teal); }
.mixer-actions { display: flex; gap: 8px; flex-wrap: wrap; margin: 6px 0 14px; }
.master { display: flex; align-items: center; gap: 12px; background: var(--glass); border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 16px; font-size: 0.88rem; backdrop-filter: blur(12px); }
.master span { white-space: nowrap; color: var(--muted); }
.tip { margin: 16px 4px; font-size: 0.85rem; }

/* Boutons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 11px 16px; border-radius: 12px; border: 1px solid var(--line); background: var(--glass); color: var(--ink); text-decoration: none; font-weight: 500; font-size: 0.92rem; backdrop-filter: blur(10px); }
.btn-primary { background: linear-gradient(135deg, var(--teal-dark), #2b8fd6); border-color: transparent; color: #fff; }
.btn-ghost { background: transparent; }
.btn-block { width: 100%; margin-top: 10px; }

/* Cartes (ambiances, voyages) */
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; }
.card { text-align: left; display: flex; flex-direction: column; gap: 6px; padding: 16px; border-radius: var(--radius); border: 1px solid var(--line); background: var(--glass); backdrop-filter: blur(12px); position: relative; min-height: 130px; }
.card strong { font-size: 1.02rem; }
.card .muted { font-size: 0.85rem; }
.card-icons { font-size: 1.3rem; letter-spacing: 3px; }
.card-icons.big { font-size: 2rem; }
.card.locked { opacity: 0.78; }
.badge { position: absolute; top: 12px; right: 12px; font-size: 0.7rem; background: rgba(243, 199, 122, 0.2); color: var(--gold); padding: 3px 8px; border-radius: 20px; }
.scene-night { background-image: linear-gradient(160deg, rgba(27, 42, 85, 0.75), rgba(6, 11, 29, 0.6)); }
.scene-ocean { background-image: linear-gradient(160deg, rgba(29, 122, 146, 0.6), rgba(6, 35, 58, 0.6)); }
.scene-forest { background-image: linear-gradient(160deg, rgba(29, 63, 43, 0.75), rgba(7, 21, 15, 0.6)); }
.scene-dawn { background-image: linear-gradient(160deg, rgba(176, 87, 122, 0.55), rgba(43, 35, 80, 0.6)); }
.scene-aurora { background-image: linear-gradient(160deg, rgba(11, 59, 74, 0.7), rgba(62, 240, 177, 0.18)); }
.scene-rain { background-image: linear-gradient(160deg, rgba(47, 67, 82, 0.75), rgba(15, 26, 36, 0.6)); }
.journey .btn { margin-top: auto; }
.steps { list-style: none; font-size: 0.8rem; color: var(--muted); margin: 6px 0 10px; display: grid; gap: 3px; }
.steps span { display: inline-block; min-width: 30px; color: var(--teal); }
.journey-now { background: var(--glass-strong); border: 1px solid rgba(63, 208, 224, 0.5); border-radius: var(--radius); padding: 16px; margin-bottom: 16px; display: grid; gap: 8px; }
.progress { height: 6px; border-radius: 3px; background: rgba(255, 255, 255, 0.15); overflow: hidden; }
.progress div { height: 100%; background: linear-gradient(90deg, var(--teal), var(--gold)); transition: width 1s linear; }
.journey-step { font-size: 0.9rem; }

/* Mes mixes */
.mix-list { list-style: none; display: grid; gap: 8px; }
.mix-list li { display: flex; gap: 8px; align-items: center; }
.mix-play { flex: 1; display: flex; gap: 12px; align-items: center; text-align: left; background: var(--glass); border: 1px solid var(--line); border-radius: 14px; padding: 12px 14px; backdrop-filter: blur(10px); }

/* Puces de choix */
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 10px 0; align-items: center; }
.chip { background: var(--glass); border: 1px solid var(--line); border-radius: 14px; padding: 10px 14px; display: flex; flex-direction: column; text-align: left; backdrop-filter: blur(10px); font-size: 0.9rem; }
.chip small { color: var(--muted); font-size: 0.75rem; }
.chip.on { border-color: var(--teal); background: rgba(14, 90, 110, 0.55); }
.small-chips .chip { padding: 7px 12px; }

/* Respiration */
.breath { position: relative; display: grid; place-items: center; width: min(320px, 80vw); aspect-ratio: 1; margin: 22px auto; border: 0; background: none; }
.breath-circle {
  position: absolute; inset: 0; border-radius: 50%; transform: scale(0.55); transition: transform 1s ease-in-out;
  background: radial-gradient(circle at 40% 35%, rgba(120, 230, 240, 0.85), rgba(14, 165, 184, 0.35) 60%, rgba(14, 165, 184, 0.05));
  box-shadow: 0 0 80px rgba(63, 208, 224, 0.35);
}
.breath-label { position: relative; font-family: 'Fraunces', serif; font-size: 1.4rem; }
.breath-count { position: relative; font-size: 1rem; color: var(--muted); margin-top: 44px; position: absolute; }

/* Compte */
.account-card { background: var(--glass); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; margin: 12px 0; backdrop-filter: blur(12px); display: grid; gap: 10px; }
.field { display: grid; gap: 6px; font-size: 0.85rem; color: var(--muted); }
.field input, .field select { font: inherit; font-size: 1rem; color: var(--ink); background: rgba(0, 0, 0, 0.3); border: 1px solid var(--line); border-radius: 10px; padding: 12px; }
.form-error { color: #ffb4a8; font-size: 0.88rem; }
.install { display: grid; gap: 6px; }

/* Lecteur + onglets (en bas) */
.player {
  position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(68px + var(--safe-b)); z-index: 6;
  width: min(840px, calc(100% - 24px)); display: flex; align-items: center; gap: 12px; padding: 8px 10px;
  background: var(--glass-strong); border: 1px solid var(--line); border-radius: 22px; backdrop-filter: blur(16px);
}
.play-btn { width: 46px; height: 46px; border-radius: 50%; border: 0; background: linear-gradient(135deg, var(--teal-dark), #2b8fd6); color: #fff; font-size: 1.1rem; flex-shrink: 0; }
.np-label { flex: 1; font-size: 0.92rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.timer-btn { width: auto; border-radius: 20px; padding: 0 12px; font-size: 0.85rem; font-variant-numeric: tabular-nums; }
.tabs {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 6; display: flex; justify-content: space-around;
  padding: 6px 4px calc(6px + var(--safe-b)); background: rgba(5, 12, 22, 0.92); border-top: 1px solid var(--line); backdrop-filter: blur(16px);
}
.tabs button { background: none; border: 0; display: flex; flex-direction: column; align-items: center; gap: 2px; font-size: 1.15rem; padding: 4px 6px; opacity: 0.6; min-width: 60px; }
.tabs button.on { opacity: 1; }
.tabs .tab-label { font-size: 0.68rem; }

/* Fenêtre */
.modal { position: fixed; inset: 0; z-index: 20; background: rgba(0, 0, 0, 0.55); display: grid; place-items: center; padding: 18px; }
.modal[hidden] { display: none; }
.modal-box { position: relative; width: min(420px, 100%); max-height: 88vh; overflow: auto; background: #0f2236; border: 1px solid var(--line); border-radius: 22px; padding: 26px 22px 22px; }
.modal-close { position: absolute; top: 10px; right: 10px; width: 34px; height: 34px; }
.modal-box h2 { margin-bottom: 8px; }
.upsell { text-align: center; display: grid; gap: 10px; }
.upsell-icon { font-size: 2.2rem; }
.big-icons { font-size: 2rem; letter-spacing: 6px; margin: 10px 0; }

/* Écran noir (nuit) */
.night { position: fixed; inset: 0; z-index: 30; background: #000; display: grid; place-items: center; }
.night[hidden] { display: none; }
#night-clock { color: rgba(255, 255, 255, 0.18); font-size: 3rem; font-weight: 300; font-variant-numeric: tabular-nums; }

.toast { position: fixed; left: 50%; bottom: calc(140px + var(--safe-b)); transform: translateX(-50%) translateY(20px); z-index: 40; background: #fff; color: #0b1a2e; padding: 10px 18px; border-radius: 20px; font-size: 0.9rem; opacity: 0; pointer-events: none; transition: opacity 0.25s, transform 0.25s; }
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

@media (min-width: 720px) { h1 { font-size: 2rem; } }
@media (prefers-reduced-motion: reduce) { * { transition-duration: 0.01ms !important; } }

/* ── Musique classique ─────────────────────────────────────── */
.music-now { background: var(--glass-strong); border: 1px solid rgba(243, 199, 122, 0.45); border-radius: var(--radius); padding: 16px; margin-bottom: 14px; display: grid; gap: 8px; backdrop-filter: blur(12px); }
.music-title { display: grid; gap: 2px; }
.music-title strong { font-family: 'Fraunces', serif; font-size: 1.25rem; font-weight: 600; }
.music-times { display: flex; justify-content: space-between; font-variant-numeric: tabular-nums; }
.music-ctl { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.music-vol { display: flex; align-items: center; gap: 6px; flex: 1; min-width: 140px; }
.music-actions { margin: 0 0 12px; display: flex; gap: 8px; }
.infinite { width: 100%; display: grid; grid-template-columns: 74px 1fr; gap: 14px; align-items: center; text-align: left; padding: 14px; margin-bottom: 14px; border-radius: var(--radius); border: 1px solid var(--line); position: relative;
  background: linear-gradient(120deg, rgba(43, 35, 80, 0.75), rgba(14, 60, 80, 0.6)); backdrop-filter: blur(12px); }
.infinite.on { border-color: var(--gold); }
.infinite.locked { opacity: 0.8; }
.infinite > span:nth-child(2) { display: grid; gap: 4px; padding-right: 64px; }
.infinite .muted { font-size: 0.85rem; }
.infinite-keys { height: 52px; border-radius: 8px; border: 1px solid rgba(255, 255, 255, 0.25);
  background:
    linear-gradient(90deg, transparent 0 7px, #10131a 7px 13px, transparent 13px 18px, #10131a 18px 24px, transparent 24px 36px, #10131a 36px 42px, transparent 42px 47px, #10131a 47px 53px, transparent 53px 58px, #10131a 58px 64px, transparent 64px) top / 100% 60% no-repeat,
    repeating-linear-gradient(90deg, #f5f1e6 0 9.5px, #b8b2a4 9.5px 10.5px); }
.pieces { list-style: none; display: grid; gap: 6px; margin-bottom: 18px; }
.piece { width: 100%; display: grid; grid-template-columns: 34px 1fr auto; gap: 10px; align-items: center; text-align: left; padding: 11px 14px; border-radius: 14px; border: 1px solid var(--line); background: var(--glass); backdrop-filter: blur(10px); }
.piece.on { border-color: var(--gold); background: rgba(80, 60, 30, 0.45); }
.piece.locked { opacity: 0.72; }
.piece-play { width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; background: rgba(255, 255, 255, 0.08); font-size: 0.8rem; }
.piece.on .piece-play { background: var(--gold); color: #2a1d10; }
.piece-name { display: grid; gap: 1px; min-width: 0; }
.piece-name strong { font-weight: 500; font-size: 0.95rem; }
.piece-name .muted { font-size: 0.8rem; }
.credits { margin: 8px 4px 18px; }
.credits summary { cursor: pointer; color: var(--muted); font-size: 0.85rem; }
.credits p, .credits ul { margin-top: 6px; }
.credits ul { padding-left: 18px; }

/* ── Promenades 3D ─────────────────────────────────────────── */
.walk-stage { border-radius: var(--radius); overflow: hidden; border: 1px solid var(--line); width: 100%; height: clamp(200px, 46vw, 360px); background: #10261e; }
.walk-stage canvas { width: 100%; height: 100%; display: block; }
.headphones { margin: 10px 4px 14px; font-size: 0.88rem; color: var(--muted); }
.walk-now { background: var(--glass-strong); border: 1px solid rgba(63, 208, 224, 0.5); border-radius: var(--radius); padding: 14px 16px; margin-bottom: 14px; display: grid; gap: 10px; backdrop-filter: blur(12px); }
.walk-now-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.walk-now-top strong { font-family: 'Fraunces', serif; font-size: 1.15rem; font-weight: 600; }
.walk-stats { display: flex; flex-wrap: wrap; gap: 6px 18px; font-size: 0.88rem; color: var(--muted); }
.walk-stats strong { color: var(--ink); font-variant-numeric: tabular-nums; }
.near-list { display: flex; flex-wrap: wrap; gap: 6px; min-height: 30px; }
.near { background: rgba(255, 255, 255, 0.07); border-radius: 20px; padding: 5px 11px; font-size: 0.85rem; }
.seg { display: grid; grid-template-columns: 1fr 1fr; background: rgba(0, 0, 0, 0.3); border-radius: 12px; padding: 3px; gap: 3px; }
.seg button { border: 0; background: none; border-radius: 9px; padding: 9px 8px; font-size: 0.84rem; color: var(--muted); }
.seg button.on { background: rgba(14, 90, 110, 0.85); color: var(--ink); }
.walk-card .btn { margin-top: auto; }
.walk-card.on { border-color: var(--teal); }
.walk-forest { background-image: linear-gradient(160deg, rgba(29, 63, 43, 0.8), rgba(7, 21, 15, 0.6)); }
.walk-beach { background-image: linear-gradient(160deg, rgba(180, 81, 122, 0.55), rgba(42, 29, 76, 0.7)); }
.walk-garden { background-image: linear-gradient(160deg, rgba(95, 148, 114, 0.6), rgba(30, 60, 70, 0.6)); }
@media (max-width: 400px) { .tabs button { min-width: 0; padding: 4px 2px; flex: 1; } .tabs .tab-label { font-size: 0.62rem; } }

/* ── Promenade 3D : scène, plein écran ─────────────────────── */
.walk-stage { position: relative; touch-action: pan-y; -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
.walk-stage.is3d #walk-canvas { display: none; }
.walk3d-canvas { position: absolute; inset: 0; width: 100% !important; height: 100% !important; display: block; cursor: grab; }
.walk3d-canvas:active { cursor: grabbing; }
.stage-loading { position: absolute; inset: 0; display: grid; place-items: center; color: var(--muted); font-size: 0.9rem; background: #0e1f24; }
.stage-loading[hidden] { display: none; }
.stage-btn { position: absolute; top: 10px; right: 10px; z-index: 2; width: 42px; height: 42px; border-radius: 50%; border: 1px solid rgba(255, 255, 255, 0.3); background: rgba(8, 18, 28, 0.55); color: #fff; font-size: 1.15rem; backdrop-filter: blur(8px); }
.stage-exit-btn { display: none; }
.stage-hint { position: absolute; left: 50%; bottom: 12px; transform: translateX(-50%); z-index: 2; margin: 0; padding: 6px 12px; border-radius: 20px; background: rgba(8, 18, 28, 0.5); color: #fff; font-size: 0.78rem; white-space: nowrap; pointer-events: none; animation: hint-out 1s ease 7s forwards; }
@keyframes hint-out { to { opacity: 0; } }
.stage-info { display: none; }
.walk-stage.stage-full { position: fixed; inset: 0; z-index: 70; width: 100vw; height: 100vh; height: 100dvh; border-radius: 0; border: 0; }
.walk-stage.stage-full .stage-full-btn { display: none; }
.walk-stage.stage-full .stage-exit-btn { display: block; top: calc(12px + var(--safe-t)); }
.walk-stage.stage-full .stage-info { display: grid; gap: 2px; position: absolute; left: 14px; bottom: calc(14px + var(--safe-b)); z-index: 2; padding: 10px 14px; border-radius: 14px; background: rgba(8, 18, 28, 0.5); color: #fff; font-size: 0.85rem; backdrop-filter: blur(8px); max-width: calc(100% - 28px); }
.walk-stage.stage-full .stage-info:empty { display: none; }
.walk-stage.stage-full .stage-hint { bottom: auto; top: calc(20px + var(--safe-t)); }
body.no-scroll { overflow: hidden; }
@media (prefers-reduced-motion: reduce) { .stage-hint { animation: none; } }
