/* MAESTRO — scène de concert, couleurs des notes (avec formes et noms). Polices système. */
:root {
  --bg: #1b1240; --ink: #fbf7ff; --muted: #c3b8ea; --panel: rgba(255, 255, 255, .07); --line: rgba(255, 255, 255, .16); --gold: #ffcf5a; --good: #4ee69a; --bad: #ff7a85;
  --do: #ff5a5f; --re: #ff9f43; --mi: #ffd93d; --fa: #5fd068; --sol: #2ec4b6; --la: #4d96ff; --si: #a66cff; --do2: #ff7eb6;
  --sat: env(safe-area-inset-top, 0px); --sab: env(safe-area-inset-bottom, 0px); --sal: env(safe-area-inset-left, 0px); --sar: env(safe-area-inset-right, 0px);
  --font: system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif; color-scheme: dark;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body { margin: 0; min-height: 100vh; min-height: 100dvh; color: var(--ink); font: 400 1.05rem/1.5 var(--font); overflow-x: hidden;
  background: radial-gradient(900px 520px at 50% -12%, #6a2fa0 0, transparent 62%), radial-gradient(700px 400px at 100% 100%, #10305a 0, transparent 60%), var(--bg); background-attachment: fixed; }
[hidden] { display: none !important; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.muted { color: var(--muted); } .small { font-size: .85rem; } .center { text-align: center; }
:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; border-radius: 10px; }
.shell { max-width: 620px; margin: 0 auto; padding: calc(var(--sat) + 12px) calc(var(--sar) + 16px) calc(var(--sab) + 24px) calc(var(--sal) + 16px); outline: none; }
h1, h2 { margin: 0; line-height: 1.15; }
.hero { text-align: center; padding-top: 8px; }
.hero h1 { font-size: clamp(2.3rem, 11vw, 3.2rem); font-weight: 900; letter-spacing: -.02em; background: linear-gradient(90deg, var(--do), var(--mi), var(--sol), var(--la), var(--si)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.logo { display: block; margin: 0 auto 4px; animation: sway 3.4s ease-in-out infinite; transform-origin: 50% 90%; }
@keyframes sway { 50% { transform: rotate(-6deg); } }
.tag { color: var(--muted); margin: 6px 0 12px; }
.panel { padding: 18px; border-radius: 22px; background: var(--panel); border: 1px solid var(--line); }
.menu { display: grid; gap: 12px; margin: 14px 0; }
.mbtn { display: flex; align-items: center; gap: 14px; width: 100%; min-height: 76px; padding: 12px 16px; border-radius: 20px; border: 1px solid var(--line); background: var(--panel); color: var(--ink); font: inherit; text-align: left; cursor: pointer; }
.mbtn span, .echo-levels .mbtn { display: flex; flex-direction: column; }
.mbtn strong { font-size: 1.2rem; } .mbtn small { color: var(--muted); }
.mbtn .ic { width: 34px; height: 34px; padding: 6px; border-radius: 12px; background: rgba(255, 255, 255, .12); }
.m-free { border-left: 6px solid var(--mi); } .m-songs { border-left: 6px solid var(--sol); } .m-echo { border-left: 6px solid var(--si); }
.mbtn .rec { color: var(--gold); font-weight: 700; }
.echo-levels { display: grid; gap: 10px; } .echo-levels .mbtn { align-items: flex-start; gap: 2px; }
.sub { font-size: 1.1rem; margin: 18px 0 8px; }
.row { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; margin: 10px 0; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 48px; padding: .55rem 1rem; border-radius: 14px; border: 1.5px solid var(--line); background: rgba(255, 255, 255, .06); color: var(--ink); font: 700 1rem var(--font); cursor: pointer; touch-action: manipulation; }
.btn.small { min-height: 44px; padding: .35rem .8rem; font-size: .92rem; }
.btn.primary { background: linear-gradient(135deg, var(--gold), #ff8a5c); color: #2a1240; border-color: transparent; }
.btn.rec.on { background: var(--bad); color: #fff; animation: pulse 1s infinite; }
@keyframes pulse { 50% { opacity: .7; } }
.ic { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.icon-btn { width: 46px; height: 46px; display: grid; place-items: center; border: 0; border-radius: 14px; background: rgba(255, 255, 255, .09); color: var(--ink); cursor: pointer; flex: none; }
.safety { text-align: center; font-size: .88rem; color: var(--muted); }
.foot { text-align: center; font-size: .85rem; margin: 6px 0; }
.linkbtn { display: inline-flex; align-items: center; gap: 6px; min-height: 44px; background: none; border: 0; color: var(--gold); font: 600 .95rem var(--font); cursor: pointer; }
.top { display: grid; grid-template-columns: 46px 1fr auto; gap: 8px; align-items: center; margin-bottom: 6px; }
.top h1 { font-size: 1.1rem; text-align: center; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.top-tools { display: flex; align-items: center; gap: 6px; }
.volbox { display: flex; align-items: center; gap: 4px; color: var(--muted); } .vol { width: 80px; accent-color: var(--gold); }
.select { min-height: 48px; border-radius: 14px; border: 1.5px solid var(--line); background: #2a1d5c; color: var(--ink); font: 600 1rem var(--font); padding: 0 .8rem; }
.text { width: 100%; min-height: 48px; border-radius: 12px; border: 1.5px solid var(--line); background: #2a1d5c; color: var(--ink); font: 500 1rem var(--font); padding: .5rem .8rem; }
.switch { display: flex; gap: 12px; align-items: center; min-height: 44px; margin: 8px 0; cursor: pointer; justify-content: center; }
.switch input { width: 24px; height: 24px; accent-color: var(--gold); flex: none; } .switch span { display: flex; flex-direction: column; }
.settings .switch { justify-content: flex-start; }
.seg { border: 0; padding: 0; margin: 10px 0; display: flex; flex-wrap: wrap; gap: 8px; }
.seg legend { font-weight: 700; margin-bottom: 6px; padding: 0; width: 100%; }
.seg label { position: relative; } .seg input { position: absolute; opacity: 0; inset: 0; }
.seg span { display: inline-flex; align-items: center; min-height: 44px; padding: .35rem .9rem; border-radius: 999px; border: 1.5px solid var(--line); cursor: pointer; font-weight: 600; }
.seg input:checked + span { background: var(--gold); color: #2a1240; border-color: var(--gold); }
.seg input:focus-visible + span { outline: 3px solid var(--gold); outline-offset: 2px; }

/* Scène */
.stage { display: grid; gap: 8px; justify-items: center; margin-top: 4px; }
.svg-wrap { width: 100%; max-width: 560px; }
.stage-svg { width: 100%; display: block; touch-action: none; overflow: visible; }
.stage-arc { fill: none; stroke: rgba(255, 255, 255, .12); stroke-width: 36; stroke-linecap: round; }
.pup { cursor: pointer; }
.pup .pup-hit { fill: transparent; }
.pup .pup-bg { stroke: rgba(255, 255, 255, .55); stroke-width: 2; transition: transform .12s ease; }
.pup .pup-shape { fill: rgba(20, 10, 40, .55); }
.pup .pup-name { fill: var(--ink); font: 700 12px var(--font); }
.pup .pup-dot { fill: var(--ink); }
.pup.grave .pup-bg { opacity: .78; }
.n-do .pup-bg { fill: var(--do); } .n-re .pup-bg { fill: var(--re); } .n-mi .pup-bg { fill: var(--mi); } .n-fa .pup-bg { fill: var(--fa); }
.n-sol .pup-bg { fill: var(--sol); } .n-la .pup-bg { fill: var(--la); } .n-si .pup-bg { fill: var(--si); } .n-do2 .pup-bg { fill: var(--do2); }
.pup.aim .pup-bg { stroke: #fff; stroke-width: 4; filter: drop-shadow(0 0 8px #fff); }
.pup.hit .pup-bg, .pup.lit .pup-bg { filter: brightness(1.35) drop-shadow(0 0 12px #fff); stroke: #fff; stroke-width: 4; }
.pup.good .pup-bg { stroke: var(--good); stroke-width: 6; }
.pup.bad .pup-bg { stroke: var(--bad); stroke-width: 6; }
.pup.next .pup-bg { stroke: var(--gold); stroke-width: 5; stroke-dasharray: 6 4; animation: blink .8s steps(2) infinite; }
.pup.now .pup-bg { stroke: var(--gold); stroke-width: 7; stroke-dasharray: none; filter: drop-shadow(0 0 14px var(--gold)); }
@keyframes blink { 50% { stroke-opacity: .25; } }
.baton { stroke: #f4e6c8; stroke-width: 5; stroke-linecap: round; }
.baton-tip { fill: #fff; filter: drop-shadow(0 0 6px #fff); }
.stage.manual .baton, .stage.manual .baton-tip { display: none; }
.aim-label { margin: 0; font-weight: 800; font-size: 1.3rem; min-height: 1.6em; }
.baguette { width: min(100%, 460px); min-height: 104px; border-radius: 26px; border: 2px solid rgba(255, 255, 255, .3); background: linear-gradient(160deg, #3b2a7a, #24174f); color: var(--ink); font: inherit; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; cursor: pointer; touch-action: none; -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
.baguette:active { transform: scale(.98); background: linear-gradient(160deg, #5a3fae, #2f1e66); }
.baguette.off { opacity: .55; }
.bz-note { font-size: 1.8rem; font-weight: 900; } .bz-hint { color: var(--muted); font-size: .9rem; }
.hint { min-height: 2.6em; margin: 4px 0; text-align: center; font-weight: 700; color: var(--gold); }

/* Airs */
.book { list-style: none; padding: 0; display: grid; gap: 8px; }
.song { width: 100%; display: grid; grid-template-columns: 38px 1fr auto; gap: 10px; align-items: center; min-height: 60px; padding: 8px 12px; border-radius: 16px; border: 1px solid var(--line); background: var(--panel); color: var(--ink); font: inherit; text-align: left; cursor: pointer; }
.song.locked { opacity: .5; cursor: not-allowed; }
.song-n { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; font-weight: 800; background: rgba(255, 255, 255, .12); }
.song-t { display: flex; flex-direction: column; }
.stars { display: inline-flex; gap: 2px; } .stars .ic { width: 20px; height: 20px; fill: rgba(255, 255, 255, .12); stroke: rgba(255, 255, 255, .3); }
.stars .on .ic { fill: var(--gold); stroke: #c99a20; }
.song-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.song-head h2 { font-size: 1.25rem; }
.tabs { display: flex; gap: 6px; overflow-x: auto; margin: 8px 0; padding-bottom: 2px; }
.tab { flex: none; min-height: 44px; padding: .3rem .8rem; border-radius: 999px; border: 1.5px solid var(--line); background: transparent; color: var(--ink); font: 700 .92rem var(--font); cursor: pointer; }
.tab[aria-selected="true"] { background: var(--gold); color: #2a1240; border-color: var(--gold); }
.staff-box { overflow-x: auto; background: rgba(255, 255, 255, .95); border-radius: 16px; padding: 4px 6px; color: #2a1240; }
.staff-box .muted { color: #5b4a86; margin: 0 6px 4px; }
.staff { height: 110px; display: block; min-width: 100%; }
.st-line { stroke: #8a80a8; stroke-width: 1; } .st-stem { stroke: #2a1240; stroke-width: 1.6; } .st-flag { fill: none; stroke: #2a1240; stroke-width: 1.6; } .st-dot { fill: #2a1240; }
.st-head { stroke: #2a1240; stroke-width: 1.4; } .st-head.open { fill: #fff !important; stroke-width: 2.2; }
.st-note.n-do .st-head { fill: var(--do); } .st-note.n-re .st-head { fill: var(--re); } .st-note.n-mi .st-head { fill: var(--mi); } .st-note.n-fa .st-head { fill: var(--fa); }
.st-note.n-sol .st-head { fill: var(--sol); } .st-note.n-la .st-head { fill: var(--la); } .st-note.n-si .st-head { fill: var(--si); } .st-note.n-do2 .st-head { fill: var(--do2); }
.st-name { font: 700 10px var(--font); fill: #2a1240; }
.st-note.cur .st-head { stroke: #e0007a; stroke-width: 3; } .st-note.cur .st-name { fill: #e0007a; }
.st-note.done { opacity: .45; }
.echo-status { text-align: center; font-weight: 800; font-size: 1.25rem; color: var(--gold); min-height: 1.6em; margin: 4px 0; }
.echo-info { text-align: center; color: var(--muted); margin: 0; }
.big-num { font-size: 3rem; font-weight: 900; color: var(--gold); margin: 0; }
.mel-list { list-style: none; padding: 0; display: grid; gap: 8px; } .mel-list li { display: flex; align-items: center; gap: 8px; } .mel-list li > span { flex: 1; }
.steps { padding-left: 1.2rem; } .steps li { margin: 8px 0; } .steps .ic { width: 18px; height: 18px; vertical-align: -3px; }

dialog.modal { width: min(460px, calc(100vw - 24px)); max-height: calc(100dvh - var(--sat) - var(--sab) - 24px); border: 1px solid var(--line); border-radius: 24px; padding: 0; color: var(--ink); background: #2a1d5c; box-shadow: 0 24px 70px rgba(0, 0, 0, .55); overflow: auto; }
dialog.modal::backdrop { background: rgba(10, 4, 30, .7); }
.modal-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 14px 14px 4px 20px; } .modal-head h2 { font-size: 1.2rem; }
.modal-body { padding: 4px 20px 8px; } .modal-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 10px; padding: 8px 20px 20px; }
.calib-art { display: flex; justify-content: center; }
.toast { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(var(--sab) + 18px); z-index: 60; max-width: min(480px, calc(100vw - 32px)); background: #fbf7ff; color: #2a1240; padding: 10px 16px; border-radius: 14px; font-weight: 700; text-align: center; }
@media (max-width: 380px) { .vol { width: 52px; } .top h1 { font-size: 1rem; } }
.svg-wrap { max-width: 480px; }
@media (max-height: 700px) { .baguette { min-height: 84px; } .hero .logo { width: 72px; height: 72px; } }
@media (orientation: landscape) and (max-height: 500px) { .stage { grid-template-columns: 1.4fr 1fr; align-items: center; } .svg-wrap { grid-row: span 2; } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }
