:root {
  --bg: #0f0e13;
  --bg-2: #16141c;
  --panel: #1c1a23;
  --panel-2: #24212c;
  --line: #2d2a36;
  --text: #f3ede2;
  --muted: #a39dae;
  --brass: #e8b45f;
  --brass-deep: #b3833a;
  --on-brass: #1b140a;
  --low: #7fa8ff;
  --high: #ff8a5c;
  --ok: #5ef0b0;
  --danger: #ff6b6b;
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", Georgia, "Noto Serif", serif;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --tab-h: 62px;
  color-scheme: dark;
}
[data-theme="clair"] {
  --bg: #f7f3ea; --bg-2: #efe9dc; --panel: #ffffff; --panel-2: #f1ece2; --line: #ddd4c3; --text: #1f1a14; --muted: #6b6255;
  --brass: #a8701f; --brass-deep: #7f5313; --on-brass: #fff; --low: #2f5fd0; --high: #c4481b; --ok: #0e8a58; --danger: #c62828;
  color-scheme: light;
}
[data-theme="scene"] {
  --bg: #000; --bg-2: #050505; --panel: #0b0b0b; --panel-2: #111; --line: #1d1d1d; --text: #b9b3a8; --muted: #6f6a63;
  --brass: #a07a3c; --brass-deep: #6d5227; --on-brass: #000; --low: #5d7fc4; --high: #c26a45; --ok: #3fb584;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text); }
body { font-family: var(--sans); font-variant-numeric: tabular-nums; overscroll-behavior: none; touch-action: manipulation; font-size: 1rem; }
body.in-app { overflow: hidden; }
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
:focus-visible { outline: 2px solid var(--brass); outline-offset: 2px; }
a { color: var(--brass); }
input[type=range] { accent-color: var(--brass); }
select, input[type=text], input[type=number], input[type=search] { min-height: 44px; border-radius: 12px; border: 1px solid var(--line); background: var(--bg); padding: 0 12px; }
input[type=number] { width: 4.2em; padding: 0 6px; text-align: center; }

/* ---------- Accueil ---------- */
.intro { min-height: 100%; display: flex; justify-content: center;
  background:
    repeating-radial-gradient(circle at 50% 118px, transparent 0 34px, rgba(232,180,95,.045) 35px 36px),
    radial-gradient(90% 60% at 50% 0%, #241f2c 0%, var(--bg) 70%); }
[data-theme="clair"] .intro { background: radial-gradient(90% 60% at 50% 0%, #fff 0%, var(--bg) 70%); }
.intro-inner { max-width: 460px; width: 100%; padding: calc(env(safe-area-inset-top) + 36px) 22px 40px; text-align: center; }
.intro-logo { width: 88px; height: 88px; filter: drop-shadow(0 10px 30px rgba(232,180,95,.3)); }
.intro h1 { font-family: var(--serif); font-size: 3.6rem; font-weight: 600; margin: 8px 0 2px; letter-spacing: -1px; }
.intro h1 span, .brand b { color: var(--brass); font-family: var(--sans); font-weight: 800; letter-spacing: -2px; }
.intro h1 span { font-size: .8em; margin-left: 2px; }
.tagline { color: var(--muted); margin: 0 0 26px; font-size: 1.06rem; font-style: italic; font-family: var(--serif); }
.intro-h2 { font-size: .75rem; text-transform: uppercase; letter-spacing: .12em; color: var(--muted); margin: 22px 0 10px; }
.btn-primary { display: block; width: 100%; min-height: 60px; border: 0; border-radius: 30px;
  background: linear-gradient(180deg, #f3c979, var(--brass)); color: var(--on-brass); font-weight: 800; font-size: 1.18rem;
  box-shadow: 0 5px 0 var(--brass-deep), 0 12px 30px rgba(232,180,95,.22); transition: transform .08s, box-shadow .08s; }
[data-theme="clair"] .btn-primary { background: var(--brass); }
.btn-primary:active { transform: translateY(4px); box-shadow: 0 1px 0 var(--brass-deep); }
.btn-primary.small { display: inline-flex; align-items: center; justify-content: center; width: auto; min-height: 50px; padding: 0 26px; font-size: 1rem; box-shadow: 0 3px 0 var(--brass-deep); }
.btn-primary:disabled { opacity: .6; }
.btn-link { background: none; border: 0; color: var(--muted); text-decoration: underline; padding: 14px; font-size: .95rem; min-height: 48px; }
.btn-ghost { min-height: 50px; padding: 0 18px; border-radius: 25px; border: 1px solid var(--line); background: var(--panel); font-weight: 700; }
.btn-wide { width: 100%; min-height: 52px; margin-top: 10px; border-radius: 14px; border: 1px solid var(--brass-deep); background: var(--panel-2); color: var(--brass); font-weight: 800; font-size: 1rem; }
.btn-wide[aria-pressed="true"], .btn-wide.is-on { background: var(--brass); color: var(--on-brass); }
.intro-msg { text-align: left; margin: 6px 0 12px; padding: 14px 16px; border-radius: 14px; background: rgba(255,138,92,.1);
  border: 1px solid rgba(255,138,92,.45); font-size: .95rem; line-height: 1.45; }
.intro-msg strong { color: var(--high); }
.quick { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.quick button { min-height: 72px; border-radius: 16px; border: 1px solid var(--line); background: var(--panel); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; font-size: 1.5rem; }
.quick button span { font-size: .82rem; font-weight: 700; }
.quick button.is-on { border-color: var(--brass); box-shadow: inset 0 0 0 1px var(--brass); }
.intro-features { text-align: left; padding: 0; list-style: none; margin: 22px 0; }
.intro-features li { padding: 11px 0 11px 30px; border-top: 1px solid var(--line); position: relative; color: var(--muted); font-size: .95rem; line-height: 1.4; }
.intro-features li::before { content: "♪"; color: var(--brass); position: absolute; left: 6px; top: 10px; }
.intro-features strong { color: var(--text); }
.intro-foot { color: var(--muted); font-size: .82rem; line-height: 1.5; }
.intro-links { display: flex; flex-wrap: wrap; justify-content: center; gap: 4px 12px; margin-top: 18px; font-size: .85rem; }
.intro-links a { color: var(--muted); padding: 6px 2px; }
.desk-qr { display: none; }
@media (hover: hover) and (pointer: fine) and (min-width: 900px) {
  .desk-qr { display: flex; align-items: center; justify-content: center; gap: 14px; margin: 18px auto 0; color: var(--muted); font-size: .9rem; }
  .desk-qr img { background: #fff; padding: 6px; border-radius: 10px; }
}

/* ---------- Application ---------- */
.app { position: fixed; inset: 0; display: flex; flex-direction: column; max-width: 1100px; margin: 0 auto; }
.topbar { display: flex; align-items: center; gap: 8px; padding: calc(env(safe-area-inset-top) + 6px) 12px 4px; }
.brand { font-family: var(--serif); font-weight: 600; font-size: 1.35rem; margin-right: auto; }
.brand b { font-size: 1.15rem; }
.icon-btn { width: 44px; height: 44px; flex: none; border-radius: 22px; border: 1px solid var(--line); background: var(--panel); display: grid; place-items: center; font-weight: 800; font-size: 1.05rem; }
.mic-pill { display: inline-flex; align-items: center; gap: 6px; min-height: 36px; padding: 0 12px; border-radius: 18px; border: 1px solid var(--line); background: var(--panel); font-size: .8rem; font-weight: 700; color: var(--muted); }
.mic-pill i { width: 8px; height: 8px; border-radius: 50%; background: var(--muted); }
.mic-pill[data-state="mic"] i { background: var(--high); box-shadow: 0 0 8px var(--high); animation: pulse 2s infinite; }
.mic-pill[data-state="demo"] i { background: var(--brass); }
@keyframes pulse { 50% { opacity: .35; } }

.panels { flex: 1; min-height: 0; position: relative; }
.panel { position: absolute; inset: 0; display: flex; flex-direction: column; }
.panel.scroll { overflow-y: auto; padding: 4px 12px 24px; display: block; }
.tabbar { display: grid; grid-template-columns: repeat(4, 1fr); border-top: 1px solid var(--line); background: var(--bg-2); padding-bottom: env(safe-area-inset-bottom); }
.tabbar button { min-height: var(--tab-h); border: 0; background: none; color: var(--muted); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; font-size: .74rem; font-weight: 700; }
.tabbar svg { width: 24px; height: 24px; }
.tabbar button[aria-selected="true"] { color: var(--brass); }

/* Accordeur */
.tuner-top { display: flex; gap: 8px; align-items: center; padding: 2px 12px; flex-wrap: wrap; }
.modes { display: grid; grid-template-columns: repeat(3, 1fr); flex: 1 1 260px; padding: 3px; border-radius: 99px; background: var(--bg-2); border: 1px solid var(--line); }
.modes button { min-height: 38px; border: 0; border-radius: 99px; background: none; color: var(--muted); font-weight: 700; font-size: .9rem; }
.modes button.is-on { background: var(--panel); color: var(--text); box-shadow: inset 0 0 0 1px var(--brass-deep); }
.tuning-btn { flex: 1 1 200px; min-height: 44px; padding: 0 14px; border-radius: 22px; border: 1px solid var(--line); background: var(--panel); display: inline-flex; align-items: center; justify-content: space-between; gap: 8px; font-weight: 700; font-size: .95rem; min-width: 0; }
.tuning-btn span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tuning-btn i { font-style: normal; color: var(--brass); }
.panel[data-tab="tuner"] { overflow-y: auto; overflow-x: hidden; }
.tuner-body { flex: 1 0 auto; display: flex; flex-direction: column; }
.display-col { flex: 1 0 auto; min-height: 330px; display: flex; flex-direction: column; }
.control-col { flex: none; }

.alerts { position: relative; z-index: 2; padding: 0 12px; }
.alert { margin: 4px 0; padding: 8px 12px; border-radius: 12px; font-size: .88rem; font-weight: 700; display: flex; gap: 8px; align-items: center; border: 1px solid var(--line); background: var(--panel); }
.alert.danger { border-color: var(--danger); color: var(--danger); background: color-mix(in srgb, var(--danger) 12%, var(--panel)); animation: shake .4s; }
.alert.info { border-color: var(--brass-deep); }
.alert button { margin-left: auto; min-height: 34px; padding: 0 10px; border-radius: 10px; border: 1px solid var(--line); background: var(--bg); font-weight: 700; font-size: .8rem; }
@keyframes shake { 25% { transform: translateX(-4px); } 75% { transform: translateX(4px); } }

.stage { position: relative; flex: 1; min-height: 230px; }
#dial, #strobe, #wheel { position: absolute; inset: 0; width: 100%; height: 100%; }
.note { position: absolute; left: 0; right: 0; top: var(--note-y, 55%); transform: translateY(-58%); display: flex; justify-content: center; align-items: flex-start;
  font-family: var(--serif); line-height: 1; pointer-events: none; transition: color .25s; }
.note-name { font-size: var(--note-size, 96px); font-weight: 600; letter-spacing: -2px; }
.note-oct { font-family: var(--sans); font-size: clamp(20px, 6vw, 32px); font-weight: 700; color: var(--muted); margin: .35em 0 0 4px; }
.real-note { position: absolute; left: 0; right: 0; top: calc(var(--note-y, 55%) + var(--note-size, 96px) * .42); margin: 0; text-align: center; font-size: .85rem; color: var(--muted); }
.stage.is-stale .note { opacity: .5; }
.stage[data-state="juste"] .note-name { color: var(--ok); text-shadow: 0 0 40px rgba(94,240,176,.35); }
.verdict { position: absolute; left: 0; right: 0; top: var(--verdict-y, 88%); margin: 0; text-align: center; font-weight: 800; font-size: 1.06rem; letter-spacing: .02em; color: var(--muted); }
.verdict[data-state="juste"] { color: var(--ok); }
.verdict[data-state="bas"] { color: var(--low); }
.verdict[data-state="haut"] { color: var(--high); }
.big-cents { display: none; }
/* Grand chiffre */
.stage[data-display="chiffre"] #dial { display: none; }
.stage[data-display="chiffre"] .note { top: 38%; }
.stage[data-display="chiffre"] .note-name { font-size: min(34vw, 30vh, 220px); }
.stage[data-display="chiffre"] .big-cents { display: block; position: absolute; left: 0; right: 0; top: 66%; text-align: center; font-weight: 800; font-size: min(14vw, 11vh, 84px); line-height: 1; }
.stage[data-display="chiffre"] .verdict { top: auto; bottom: 4px; }
.big-cents[data-state="bas"] { color: var(--low); } .big-cents[data-state="haut"] { color: var(--high); } .big-cents[data-state="juste"] { color: var(--ok); }
/* LED */
.stage[data-display="led"] #dial { display: none; }
.stage[data-display="led"] .note { top: 34%; }
.led { position: absolute; left: 12px; right: 12px; top: 62%; display: grid; grid-template-columns: repeat(21, 1fr); gap: 3px; height: 44px; }
.led i { border-radius: 4px; background: var(--panel-2); border: 1px solid var(--line); }
.led i.c { height: 100%; } .led i:not(.c) { height: 76%; align-self: center; }
.led i.on-low { background: var(--low); box-shadow: 0 0 12px var(--low); }
.led i.on-high { background: var(--high); box-shadow: 0 0 12px var(--high); }
.led i.on-ok { background: var(--ok); box-shadow: 0 0 14px var(--ok); }
.stage[data-display="led"] .verdict { top: auto; bottom: 6px; }
/* Roue des notes */
.stage[data-display="roue"] #dial { display: none; }
.stage[data-display="roue"] .note { top: 50%; transform: translateY(-50%); }
.stage[data-display="roue"] .note-name { font-size: min(11vw, 7vh, 60px); }
.stage[data-display="roue"] .note-oct { font-size: .9rem; }
.stage[data-display="roue"] .verdict { top: auto; bottom: 2px; }
/* Stroboscope */
.stage[data-display="strobe"] #dial { display: none; }
.stage[data-display="strobe"] .note { top: 26%; }
.stage[data-display="strobe"] .verdict { top: auto; bottom: 6px; }

.readouts { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; padding: 0 16px; color: var(--muted); font-size: .92rem; }
.readouts > span:first-child { text-align: left; }
.readouts > span:last-child { text-align: right; }
.readouts b { color: var(--text); font-size: 1.2rem; }
.a4-chip { font-size: .78rem; min-height: 32px; padding: 0 10px; border-radius: 99px; border: 1px solid var(--line); background: var(--panel); color: var(--muted); }
.a4-chip b { font-size: .82rem; color: var(--brass); }
.beginner-mode .cents-read { visibility: hidden; }
.meter-row { display: grid; grid-template-columns: 1fr 90px 1fr; align-items: center; gap: 8px; padding: 2px 16px; font-size: .72rem; color: var(--muted); min-height: 20px; }
.stab[data-s="tres-stable"] { color: var(--ok); } .stab[data-s="stable"] { color: var(--brass); }
.vu { height: 6px; border-radius: 3px; background: var(--panel-2); overflow: hidden; }
.vu i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--low), var(--ok) 60%, var(--high)); transition: width .08s; }
.level-msg { text-align: right; }
.trace { display: block; width: calc(100% - 24px); height: 40px; margin: 4px 12px; border-radius: 10px; background: var(--bg-2); }
.disp-switch { display: grid; grid-template-columns: repeat(auto-fit, minmax(52px, 1fr)); gap: 4px; margin: 2px 12px 4px; }
.disp-switch button { min-height: 32px; border-radius: 10px; border: 1px solid var(--line); background: none; color: var(--muted); font-size: .78rem; font-weight: 700; }
.disp-switch button[aria-checked="true"] { color: var(--brass); border-color: var(--brass-deep); }

.inst-bar { padding: 2px 10px 6px; }
.strings { display: flex; gap: 5px; justify-content: center; margin: 4px 0 6px; overflow-x: auto; scrollbar-width: none; }
.strings::-webkit-scrollbar { display: none; }
.string { position: relative; flex: 1 0 44px; max-width: 72px; min-height: 58px; border-radius: 14px; border: 1px solid var(--line); background: var(--panel);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px; padding: 4px 2px; transition: border-color .2s, background .2s; }
.string b { font-family: var(--serif); font-size: 1.15rem; font-weight: 600; line-height: 1; }
.string small { font-size: .68rem; color: var(--muted); }
.string .pair { font-size: .62rem; color: var(--brass); }
.string.harp-do b { color: #ff6b6b; }
.string.harp-fa b { color: var(--low, #7fa8ff); }
.string.harp-do, .string.harp-fa { border-bottom-width: 3px; }
.string.harp-do { border-bottom-color: #ff6b6b; }
.string.harp-fa { border-bottom-color: var(--low, #7fa8ff); }
.string::after { content: ""; position: absolute; top: 5px; right: 5px; width: 7px; height: 7px; border-radius: 50%; background: var(--line); }
.string.is-current { border-color: var(--brass); box-shadow: inset 0 0 0 1px var(--brass); }
.string.is-locked { background: var(--panel-2); }
.string.is-locked small::before { content: "🔒 "; font-size: .55rem; }
.string.is-done::after { background: var(--ok); box-shadow: 0 0 8px var(--ok); }
.string.is-next { border-style: dashed; border-color: var(--brass); }
.string.is-flash { animation: sflash .7s ease-out; }
@keyframes sflash { 0% { background: rgba(94,240,176,.5); } 100% { background: var(--panel); } }
.strings.many .string { flex: 0 0 46px; }

.row-actions { display: flex; gap: 6px; justify-content: center; flex-wrap: wrap; align-items: center; }
.row-actions.wrap { justify-content: flex-start; }
.chroma-bar, .piano-bar { padding: 4px 10px 8px; }
.chip { min-height: 44px; padding: 0 14px; border-radius: 22px; border: 1px solid var(--line); background: var(--panel);
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; font-size: .9rem; font-weight: 700; }
.chip small { font-size: .65rem; color: var(--brass); font-weight: 700; }
.chip.is-on, .chip[aria-pressed="true"] { border-color: var(--brass); color: var(--brass); }
.chip-accent { background: var(--brass); border-color: var(--brass); color: var(--on-brass); }
.chip-accent.is-playing { background: var(--ok); border-color: var(--ok); color: #06140e; }
.chip.danger { color: var(--danger); }
.chip.file { cursor: pointer; }

.beginner { margin: 6px 2px 0; border: 1px solid var(--line); border-radius: 14px; background: var(--bg-2); padding: 0 12px; }
.beginner summary { min-height: 44px; display: flex; align-items: center; font-weight: 700; font-size: .9rem; cursor: pointer; color: var(--brass); }
.rule { font-weight: 700; margin: 2px 0 8px; font-size: .9rem; }
.head-wrap { display: flex; gap: 10px; align-items: flex-start; }
.head-svg { flex: 0 0 120px; }
.head-svg svg { width: 120px; height: auto; display: block; }
.head-side { flex: 1; min-width: 0; }
.seg.small button { min-height: 38px; font-size: .78rem; border-radius: 10px; }
#head-types { display: flex; flex-wrap: wrap; }
#head-types button { flex: 1 1 40%; padding: 2px 6px; }
.rot-msg { min-height: 1.4em; font-weight: 800; margin: 6px 0 10px; }
.rot-msg[data-v="bon"] { color: var(--ok); } .rot-msg[data-v="mauvais"] { color: var(--high); } .rot-msg[data-v="depasse"] { color: var(--brass); }
.peg-arrow { transform-origin: center; transform-box: fill-box; animation: spin 1.6s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.peg.is-active { fill: var(--brass); }

.warn-soft { margin: 0 4px 6px; font-size: .75rem; color: var(--muted); text-align: center; }
.piano-info { display: grid; grid-template-columns: repeat(4, 1fr); font-size: .72rem; color: var(--muted); text-align: center; gap: 4px; }
.piano-info b { display: block; color: var(--text); font-size: .95rem; }
.keyboard-wrap { overflow-x: auto; margin: 6px 0; scrollbar-width: thin; }
.keyboard { position: relative; height: 96px; display: flex; }
.key { position: relative; flex: 0 0 26px; height: 96px; border: 1px solid #555; border-radius: 0 0 5px 5px; background: #f4f0e8; color: #555; font-size: 8px; display: flex; align-items: flex-end; justify-content: center; padding-bottom: 3px; }
.key.black { flex: 0 0 18px; margin: 0 -9px; height: 58px; background: #1a1820; color: #bbb; z-index: 2; border-color: #000; }
.key.is-sel { background: var(--brass); color: var(--on-brass); }
.key.black.is-sel { background: var(--brass-deep); }
.key[data-dev="ok"]::before, .key[data-dev="bas"]::before, .key[data-dev="haut"]::before { content: ""; position: absolute; top: 4px; left: 50%; width: 6px; height: 6px; margin-left: -3px; border-radius: 50%; }
.key[data-dev="ok"]::before { background: var(--ok); } .key[data-dev="bas"]::before { background: var(--low); } .key[data-dev="haut"]::before { background: var(--high); }

.demo { margin: 0 10px 6px; padding: 6px 10px 8px; border-radius: 16px; border: 1px dashed var(--brass-deep); background: var(--bg-2); }
.demo-head { display: flex; align-items: center; gap: 8px; font-size: .88rem; }
.demo-head strong { color: var(--brass); }
#demo-val { white-space: nowrap; font-size: .8rem; overflow: hidden; text-overflow: ellipsis; }
.demo-listen { margin-left: auto; display: flex; align-items: center; gap: 6px; color: var(--muted); white-space: nowrap; }
.demo-head .chip { min-height: 34px; padding: 0 10px; }
.demo input[type=range] { width: 100%; margin: 4px 0 6px; }
.demo-row { display: flex; gap: 4px; justify-content: center; }
.demo-row .chip { flex: 1; min-height: 36px; padding: 0 2px; font-size: .74rem; }

/* Cartes (Sons, Métronome) */
.card { background: var(--panel); border: 1px solid var(--line); border-radius: 18px; padding: 12px 14px 14px; margin: 10px 0; }
.card h2 { font-family: var(--serif); font-weight: 600; font-size: 1.25rem; margin: 2px 0 8px; }
.field { display: flex; align-items: center; gap: 10px; margin: 8px 0; flex-wrap: wrap; }
.field > span:first-child { min-width: 88px; color: var(--muted); font-size: .88rem; }
.field select, .field input[type=range], .field .seg { flex: 1; min-width: 150px; max-width: 100%; }
.field .seg button { font-size: .8rem; overflow-wrap: anywhere; }
#set-transpo, #set-temp { width: 100%; }
.field.three { gap: 6px; font-size: .88rem; color: var(--muted); }
.field.three > span:first-child { min-width: 0; }
.seg { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); gap: 6px; }
.seg.col { grid-auto-flow: row; }
.seg button { min-height: 46px; border-radius: 12px; border: 1px solid var(--line); background: var(--bg); font-weight: 700; font-size: .9rem;
  display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 2px 4px; }
.seg small { font-weight: 500; font-size: .68rem; color: var(--muted); }
.seg button.is-on { border-color: var(--brass); box-shadow: inset 0 0 0 1px var(--brass); color: var(--brass); }
.note-pick { display: flex; align-items: center; gap: 8px; margin: 4px 0; }
.note-pick button.np-main { flex: 1; min-height: 56px; border-radius: 14px; border: 1px solid var(--line); background: var(--bg); font-family: var(--serif); font-size: 1.6rem; font-weight: 600; }
.note-pick .np-hz { color: var(--muted); font-size: .85rem; min-width: 72px; text-align: right; }
.fork-btn { width: 100%; min-height: 120px; border-radius: 22px; border: 1px solid var(--brass-deep); background: radial-gradient(circle at 50% 30%, var(--panel-2), var(--bg)); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; }
.fork-note { font-family: var(--serif); font-size: 2.6rem; font-weight: 600; color: var(--brass); line-height: 1; }
.fork-btn small { color: var(--muted); font-size: .75rem; }
.fork-btn[aria-pressed="true"] { border-color: var(--ok); box-shadow: 0 0 30px rgba(94,240,176,.2); }
.fork-btn[aria-pressed="true"] .fork-note { color: var(--ok); }

.metro-main { text-align: center; padding: 6px 0; }
.metro-main.scene { position: fixed; inset: 0; z-index: 30; background: #000; display: flex; flex-direction: column; justify-content: center; padding: 20px; }
.beats { display: flex; justify-content: center; gap: 8px; margin: 8px 0 12px; min-height: 30px; flex-wrap: wrap; }
.beats i { width: 26px; height: 26px; border-radius: 50%; border: 2px solid var(--line); background: var(--panel); transition: background .05s; }
.beats i.acc { border-color: var(--brass-deep); }
.beats i.on { background: var(--brass); border-color: var(--brass); }
.beats i.on.acc { background: var(--ok); border-color: var(--ok); }
.bpm-row { display: flex; align-items: center; justify-content: center; gap: 8px; }
.bpm { min-width: 128px; display: flex; flex-direction: column; }
.bpm output { font-family: var(--serif); font-size: 4rem; font-weight: 600; line-height: 1; }
.bpm small { color: var(--muted); font-style: italic; font-family: var(--serif); }
.round { width: 50px; height: 50px; border-radius: 25px; border: 1px solid var(--line); background: var(--panel); font-size: 1rem; font-weight: 800; flex: none; }
#bpm-range { width: 100%; margin: 14px 0; }
.metro-actions { display: flex; gap: 8px; justify-content: center; align-items: center; }
.accents { display: flex; gap: 6px; flex-wrap: wrap; }
.accents button { width: 40px; height: 44px; border-radius: 10px; border: 1px solid var(--line); background: var(--bg); font-weight: 800; }
.accents button[data-l="2"] { background: var(--brass); color: var(--on-brass); }
.accents button[data-l="1.5"] { border-color: var(--brass); color: var(--brass); }
.accents button[data-l="0"] { opacity: .4; }
.list { list-style: none; padding: 0; margin: 6px 0; }
.list li { display: flex; align-items: center; gap: 8px; padding: 6px 0; border-top: 1px solid var(--line); font-size: .9rem; }
.list li button { min-height: 38px; }
.list li .grow { flex: 1; }

/* Justesse */
.vocal-top { display: flex; gap: 6px; padding: 4px 12px; align-items: center; }
.vocal-top .seg { flex: 0 0 170px; }
.curve-wrap { position: relative; flex: 1; min-height: 180px; margin: 4px 12px; border-radius: 16px; background: var(--bg-2); border: 1px solid var(--line); overflow: hidden; }
#curve { position: absolute; inset: 0; width: 100%; height: 100%; }
.curve-note { position: absolute; top: 8px; right: 12px; text-align: right; pointer-events: none; }
.curve-note b { font-family: var(--serif); font-size: 2rem; font-weight: 600; display: block; line-height: 1; }
.curve-note span { color: var(--muted); font-size: .85rem; }
.exercise { flex: none; padding: 4px 12px 8px; max-height: 46%; overflow-y: auto; }
.ex-result { font-size: .95rem; }
.ex-result .score { font-family: var(--serif); font-size: 2rem; color: var(--brass); }
.history summary { min-height: 40px; display: flex; align-items: center; color: var(--muted); font-size: .88rem; }

/* Feuilles */
.sheet { position: fixed; inset: 0; background: rgba(5,4,8,.6); display: flex; align-items: flex-end; justify-content: center; z-index: 40;
  backdrop-filter: blur(3px); -webkit-backdrop-filter: blur(3px); }
.sheet-card { width: 100%; max-width: 600px; max-height: 92vh; max-height: 92dvh; overflow-y: auto; background: var(--panel); border-top: 1px solid var(--line);
  border-radius: 24px 24px 0 0; padding: 16px 16px calc(env(safe-area-inset-bottom) + 24px); }
.sheet-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; position: sticky; top: -16px; background: var(--panel); padding: 6px 0; z-index: 1; }
.sheet-head h2 { margin: 0; font-size: 1.35rem; font-family: var(--serif); font-weight: 600; }
.sheet-head h2 small { font-family: var(--sans); font-size: .7rem; color: var(--brass); }
.close { width: 44px; height: 44px; flex: none; border-radius: 22px; border: 1px solid var(--line); background: var(--bg); font-size: 1.1rem; }
.sheet h3 { margin: 20px 0 8px; font-size: .74rem; text-transform: uppercase; letter-spacing: .1em; color: var(--muted); }
.hint { color: var(--muted); font-size: .88rem; line-height: 1.45; margin: 6px 0; }
.hint.small { font-size: .75rem; margin-top: 18px; }
.hint.list { padding-left: 18px; }
.hint.list li { margin: 5px 0; }
.a4-row { display: flex; align-items: center; justify-content: center; gap: 18px; }
.a4-out { font-family: var(--serif); font-size: 2.3rem; min-width: 160px; text-align: center; color: var(--brass); }
#a4-range { width: 100%; margin: 10px 0; }
.presets { display: flex; flex-wrap: wrap; gap: 6px; margin: 6px 0; }
.presets button { min-height: 44px; padding: 4px 10px; border-radius: 12px; border: 1px solid var(--line); background: var(--bg); text-align: left; display: flex; flex-direction: column; font-weight: 700; font-size: .85rem; }
.presets button small { color: var(--muted); font-weight: 500; font-size: .68rem; max-width: 150px; }
.presets button.is-on { border-color: var(--brass); color: var(--brass); }
.check { display: flex; align-items: center; gap: 10px; min-height: 48px; font-size: .92rem; line-height: 1.3; }
.check input { width: 22px; height: 22px; flex: none; accent-color: var(--brass); }
.check.strong { font-weight: 700; }
.search { width: 100%; margin: 8px 0 4px; }
.picker-list { display: grid; gap: 14px; margin-top: 8px; }
.picker-group h4 { margin: 0 0 6px; font-size: .88rem; color: var(--muted); font-weight: 700; display: flex; justify-content: space-between; align-items: center; }
.picker-group .opts { display: grid; gap: 6px; }
.opt-row { display: flex; gap: 6px; }
.opt { flex: 1; min-height: 50px; text-align: left; padding: 6px 12px; border-radius: 12px; border: 1px solid var(--line); background: var(--bg);
  display: flex; justify-content: space-between; align-items: center; gap: 10px; font-weight: 600; font-size: .92rem; min-width: 0; }
.opt small { color: var(--muted); font-weight: 500; font-size: .74rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.opt.is-on { border-color: var(--brass); box-shadow: inset 0 0 0 1px var(--brass); }
.star { width: 44px; flex: none; border-radius: 12px; border: 1px solid var(--line); background: var(--bg); color: var(--muted); font-size: 1.1rem; }
.star[aria-pressed="true"] { color: var(--brass); }
.ed-strings { padding: 0; margin: 10px 0; list-style: none; display: grid; gap: 6px; }
.ed-strings li { display: flex; align-items: center; gap: 6px; }
.ed-strings li .idx { width: 22px; color: var(--muted); font-size: .8rem; }
.ed-strings li .nm { flex: 1; font-family: var(--serif); font-size: 1.2rem; font-weight: 600; }
.ed-strings li button { min-width: 40px; min-height: 40px; border-radius: 10px; border: 1px solid var(--line); background: var(--bg); font-weight: 700; }
.ed-strings li input { width: 3.6em; }
.alert-box { border: 1px solid var(--danger); color: var(--danger); border-radius: 12px; padding: 8px 12px; font-size: .88rem; margin: 8px 0; }
.wheel { position: relative; width: min(280px, 80vw); aspect-ratio: 1; margin: 12px auto; }
.wheel button { position: absolute; width: 56px; height: 56px; margin: -28px 0 0 -28px; border-radius: 50%; border: 1px solid var(--line); background: var(--bg); font-weight: 800; font-size: .95rem; }
.wheel button.is-on { background: var(--brass); color: var(--on-brass); border-color: var(--brass); }
.wheel button.is-live { box-shadow: 0 0 0 3px var(--ok); }
.glossary dt { font-weight: 800; margin-top: 8px; }
.glossary dd { margin: 2px 0 0; color: var(--muted); font-size: .88rem; }
.fiche { border-top: 1px solid var(--line); }
.fiche summary { min-height: 44px; display: flex; align-items: center; font-weight: 700; }
.fiche ol { margin: 0 0 10px; padding-left: 20px; color: var(--muted); font-size: .9rem; line-height: 1.45; }
.diag { white-space: pre-wrap; font-size: .78rem; background: var(--bg); border-radius: 12px; padding: 10px; border: 1px solid var(--line); }
.strum-res { display: grid; grid-template-columns: repeat(auto-fill, minmax(78px, 1fr)); gap: 6px; margin: 10px 0; }
.strum-res button { min-height: 70px; border-radius: 14px; border: 2px solid var(--line); background: var(--bg); display: flex; flex-direction: column; align-items: center; justify-content: center; font-weight: 700; }
.strum-res button b { font-family: var(--serif); font-size: 1.2rem; }
.strum-res [data-c="vert"] { border-color: var(--ok); } .strum-res [data-c="orange"] { border-color: var(--brass); } .strum-res [data-c="rouge"] { border-color: var(--danger); }
.report-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(64px, 1fr)); gap: 5px; margin: 10px 0; }
.report-grid div { border-radius: 10px; padding: 6px 2px; text-align: center; border: 1px solid var(--line); font-size: .78rem; }
.report-grid div b { display: block; font-family: var(--serif); font-size: 1rem; }
.report-grid [data-c="ok"] { border-color: var(--ok); } .report-grid [data-c="bas"] { border-color: var(--low); color: var(--low); } .report-grid [data-c="haut"] { border-color: var(--high); color: var(--high); }

.onboard { position: fixed; inset: 0; z-index: 50; background: var(--bg); display: flex; align-items: center; justify-content: center; padding: 20px; overflow-y: auto; }
.onboard-card { max-width: 460px; width: 100%; text-align: center; }
.onboard-card h2 { font-family: var(--serif); font-weight: 600; font-size: 1.8rem; margin: 6px 0 14px; }
.ob-step { color: var(--brass); font-weight: 800; letter-spacing: .1em; font-size: .8rem; }
.onboard-card .row-actions { justify-content: space-between; margin-top: 18px; }
.ob-list { text-align: left; color: var(--muted); line-height: 1.5; }

.paused { position: fixed; inset: 0; z-index: 35; display: flex; align-items: center; justify-content: center; background: rgba(5,4,8,.72); }
.resume { min-width: 240px; min-height: 140px; border-radius: 24px; border: 1px solid var(--brass-deep); background: var(--panel); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; }
.resume span { font-family: var(--serif); font-size: 1.5rem; }
.resume small { color: var(--muted); }
.flash { position: fixed; inset: 0; z-index: 25; pointer-events: none; opacity: 0; background: var(--ok); transition: opacity .12s; }
.flash.on { opacity: .35; }
.flash.metro { background: var(--brass); }
.toast { position: fixed; left: 50%; bottom: calc(env(safe-area-inset-bottom) + var(--tab-h) + 60px); transform: translate(-50%, 20px);
  max-width: calc(100% - 32px); padding: 10px 16px; border-radius: 12px; background: var(--text); color: var(--bg);
  font-weight: 700; font-size: .9rem; opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s; z-index: 60; text-align: center; }
.toast.is-on { opacity: 1; transform: translate(-50%, 0); }
.update { position: fixed; top: calc(env(safe-area-inset-top) + 8px); left: 50%; transform: translateX(-50%); z-index: 70; display: flex; gap: 10px; align-items: center; background: var(--panel); border: 1px solid var(--brass); border-radius: 16px; padding: 6px 8px 6px 14px; font-size: .88rem; font-weight: 700; }

/* Mode malvoyant : contraste renforcé */
.low-vision .note-name { color: var(--text); }
.low-vision .verdict { font-size: 1.5rem; }

/* Petits écrans en hauteur */
@media (max-height: 700px) {
  .trace { height: 28px; }
  .string { min-height: 50px; }
  .modes button { min-height: 34px; }
  .disp-switch button { min-height: 28px; }
  :root { --tab-h: 54px; }
}
/* Paysage / tablette / ordinateur : mise en page « pupitre » */
@media (orientation: landscape) and (min-width: 640px), (min-width: 900px) {
  .tuner-body { flex-direction: row; }
  .panel[data-tab="tuner"] { overflow: hidden; }
  .tuner-body { flex: 1; min-height: 0; }
  .display-col { flex: 1.25; min-height: 0; }
  .control-col { flex: 1; overflow-y: auto; padding-top: 8px; display: flex; flex-direction: column; justify-content: center; }
  .panel.scroll { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 0 12px; align-content: start; }
  .panel.scroll .metro-main { grid-column: 1 / -1; }
  #tab-vocal { flex-direction: row; flex-wrap: wrap; }
  #tab-vocal .vocal-top { width: 100%; }
  #tab-vocal .curve-wrap { flex: 1.3; height: calc(100% - 60px); }
  #tab-vocal .exercise { flex: 1; max-height: calc(100% - 60px); }
}
@media (orientation: landscape) and (max-height: 500px) {
  .tabbar { position: fixed; left: 0; top: 0; bottom: 0; width: 72px; grid-template-columns: 1fr; grid-auto-rows: 1fr; border-top: 0; border-right: 1px solid var(--line); }
  .app { padding-left: 72px; }
  .topbar { padding-top: 4px; }
  .trace, .meter-row { display: none; }
}
@media (prefers-reduced-motion: reduce) { *, *::before { transition: none !important; animation: none !important; } }

.intro-lang { margin: .6rem 0 0; font-size: .9rem; }
.intro-lang a { color: var(--brass); }
a.chip { text-decoration: none; display: inline-flex; align-items: center; }
