/* Disposition « téléphone » (classe .m sur le body, posée à 700 px) : barre des entrées non collante, résumé collant,
   barre de commandes en bas, panneau de réglages. */
.msum, .mbar, .scrim, .sheet { display: none; }
#orientRow, #notationRow { display: none; }

body.m { padding-block: 0 calc(84px + env(safe-area-inset-bottom, 0px)); }
body.m::before { content: ""; position: fixed; inset: 0 0 auto; height: env(safe-area-inset-top, 0px); z-index: 10; background: var(--fond); }
body.m .wrap, body.m #vue-gammes { gap: 12px; }
body.m .stage-head, body.m footer { display: none; }
body.m #orientRow, body.m #notationRow { display: flex; }

/* Barre des entrées : fine, en haut, qui défile avec la page */
body.m .top { margin: 0 -16px; padding: 0 12px; border-bottom: 1px solid var(--bord); gap: 0; }
/* La marque reste, sans son sous-titre : une ligne de 44 px au-dessus des entrées, avec « À propos » à droite (apropos.css) */
body.m .brand { order: 0; gap: 8px; min-height: 44px; }
body.m .brand svg { width: 26px; height: 26px; }
body.m .brand h1 { font-size: 16px; }
body.m .brand p { display: none; }
body.m .entrees { order: 2; width: 100%; margin: 0; }
body.m .entrees a { flex: 1; justify-content: center; padding: 0 6px; }
/* « Cycle des quintes » devient « Quintes » : cinq entrées tiennent dans 390 px, et dans 360 px en resserrant les marges et le corps du texte */
body.m .entrees .long { display: none; }
body.m .entrees .court { display: inline; }
@media (max-width: 380px) {
  body.m .top { padding: 0 6px; }
  body.m .entrees a { padding: 0 3px; font-size: 13px; }
}

/* Résumé : collant sous le bord haut de l'écran */
body.m .msum { display: flex; position: sticky; top: env(safe-area-inset-top, 0px); z-index: 6; align-items: center; gap: 12px; width: 100%;
  margin: 0; padding: 12px 2px 10px; border: 0; border-bottom: 1px solid var(--bord); background: var(--fond); color: var(--encre); text-align: left; cursor: pointer; }
.msum .t { flex: 1; min-width: 0; }
.msum b { display: block; font-family: var(--titre); font-weight: 700; font-size: 20px; line-height: 1.15; text-wrap: balance; }
.msum b .k { color: var(--degre-1); }
.msum small { display: block; font-family: var(--mono); font-size: 11.5px; color: var(--doux); margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.msum .gear { width: 44px; height: 44px; border-radius: 999px; border: 1px solid var(--bord); background: var(--carte); display: grid; place-items: center; flex: none; }
body.m .stage { border-radius: 14px; padding: 8px 0 6px; gap: 6px; }
body.m .neck-wrap { padding: 2px 6px 4px; }
body.m.vert .scroll-hint { display: none; }
/* Zoom sur une position : le glisser horizontal change de position (ui/glisser.js), le vertical fait défiler la page */
body.m.zoom .neck-wrap { touch-action: pan-y; }
body.m .lower { gap: 12px; }
body.m .card { padding: 14px 16px; }

/* Barre de commandes du bas */
body.m .mbar { --z-anneau: var(--anneau-scene); display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 7; align-items: center; gap: 8px;
  padding: 10px max(12px, env(safe-area-inset-right, 0px)) calc(10px + env(safe-area-inset-bottom, 0px)) max(12px, env(safe-area-inset-left, 0px));
  background: var(--scene-profond); color: var(--scene-texte); border-top: 1px solid var(--scene-trait-fin); box-shadow: var(--ombre-barre); }
.mbar button { border: 1px solid var(--scene-trait); background: transparent; color: var(--scene-texte); border-radius: 999px; display: grid; place-items: center; flex: none; min-width: 44px; height: 44px; }
.mbar button:active { background: var(--scene-voile); }
.mb-pos { flex: 1; min-width: 0; text-align: center; line-height: 1.2; }
.mb-pos b { display: block; font-family: var(--mono); font-size: 13px; white-space: nowrap; }
.mb-pos span { font-family: var(--mono); font-size: 11px; color: var(--scene-doux); white-space: nowrap; }
.mbar .mb-met { display: flex; gap: 6px; padding: 0 12px; font-family: var(--mono); font-size: 13px; font-weight: 700; font-variant-numeric: tabular-nums; }
/* « En cours » : le métronome en marche et l'écoute sont en accent */
.mbar .mb-met[aria-pressed="true"] { background: var(--etat-actif); border-color: var(--etat-actif); color: var(--etat-actif-encre); }
.mbar .mb-play { width: 50px; height: 50px; border: 0; background: var(--action-fond); color: var(--action-encre); }
/* Sous le doigt, le rond du sapin s'éclaircit à peine : le voile de `.mbar button:active` effacerait son icône claire */
.mbar .mb-play:active { background: var(--sapin-2); }
@media (hover: hover) { .mbar .mb-met[aria-pressed="true"]:hover { background: var(--etat-actif); filter: brightness(.92); } }
.mbar .mb-play[data-on="true"] { background: var(--etat-actif); color: var(--etat-actif-encre); }

/* Panneau de réglages : une feuille qui monte du bas ; ses composants lisent les variables de zone de la scène */
body.m .scrim { display: block; position: fixed; inset: 0; z-index: 20; background: var(--voile-ecran); opacity: 0; transition: opacity .22s; }
body.m .scrim.open { opacity: 1; }
body.m .sheet {
    --z-texte: var(--scene-texte);
    --z-doux: var(--scene-doux);
    --z-carte: var(--scene-2);
    --z-piste: var(--sauge-pale);
    --z-trait: var(--scene-3);
    --z-choix-fond: var(--choix-clair-fond);
    --z-choix-encre: var(--choix-clair-encre);
    --z-choix-filet: var(--choix-clair-filet);
    --z-ombre: var(--ombre-bouton);
    --z-actif-fond: var(--accent);
    --z-actif-encre: var(--carte);
    --z-anneau: var(--anneau-scene);
    --z-survol: var(--accent);
    display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 21; max-height: 88vh; flex-direction: column;
    border-radius: 20px 20px 0 0; transform: translateY(100%); transition: transform .26s cubic-bezier(.2, .8, .2, 1);
    background: var(--scene); color: var(--scene-texte); box-shadow: var(--ombre-feuille);
}
body.m .sheet.open { transform: none; }
.sheet-top { padding: 8px max(16px, env(safe-area-inset-right, 0px)) 6px max(16px, env(safe-area-inset-left, 0px)); touch-action: none; }
.grab { width: 40px; height: 5px; border-radius: 3px; background: var(--scene-3); margin: 0 auto 8px; }
.sheet-head { display: flex; align-items: center; justify-content: space-between; }
.sheet-head h2 { margin: 0; font-family: var(--titre); font-weight: 700; font-size: 20px; }
/* « OK » est une action : sapin, comme « Écouter » */
.sheet-ok { border: 0; background: var(--action-fond); color: var(--action-encre); font-weight: 700; border-radius: 999px; padding: 0 20px; height: 40px; }
.sheet-body { overflow-y: auto; overscroll-behavior: contain; padding: 6px max(16px, env(safe-area-inset-right, 0px)) calc(24px + env(safe-area-inset-bottom, 0px)) max(16px, env(safe-area-inset-left, 0px)); display: flex; flex-direction: column; gap: 22px; }
.sh-sec { display: flex; flex-direction: column; gap: 12px; }
.sh-sec > h3 { margin: 0; font-family: var(--titre); font-weight: 700; font-size: 16px; padding-top: 14px; border-top: 1px solid var(--scene-3); }
.sheet .deck { grid-template-columns: 1fr; gap: 16px; }
.sheet .deck .inst-field { grid-column: auto; }
.sheet .roots { grid-template-columns: repeat(6, minmax(0, 1fr)); }
.sheet .roots button { min-height: 44px; }
.sheet .select { min-height: 46px; font-size: 15px; }
.sheet .seg button { min-height: 40px; }
body.m .sheet .card { border: 0; padding: 0; background: transparent; gap: 14px; }
.sheet .card > h3 { display: none; }
.sheet .metro { border: 0; margin: 0; padding: 0; flex-direction: column; align-items: stretch; gap: 14px; }
.sheet .metro .tempo { justify-content: space-between; }
.sheet .tempo-track { flex: 0 0 auto; min-width: 0; }
.sheet .metro-go { justify-content: center; }
.sheet .metro-opts { justify-content: flex-start; flex-basis: auto; }
.sheet .metro .icon-btn, .sheet .tap { width: 44px; height: 44px; color: var(--scene-texte); border-color: var(--scene-3); }
.sheet .tap { width: auto; }
.sheet #system { display: flex; }
.sheet #system button { flex: 1; }
.sheet .legend i.r-blue { border-color: var(--scene-doux); }

/* L'Accordeur, le Métronome, le Cycle des quintes et les Accords n'ont ni barre de commandes ni panneau de réglages */
body[data-vue="metronome"] .mbar, body[data-vue="metronome"] .scrim, body[data-vue="metronome"] .sheet,
body[data-vue="accordeur"] .mbar, body[data-vue="accordeur"] .scrim, body[data-vue="accordeur"] .sheet,
body[data-vue="quintes"] .mbar, body[data-vue="quintes"] .scrim, body[data-vue="quintes"] .sheet,
body[data-vue="accords"] .mbar, body[data-vue="accords"] .scrim, body[data-vue="accords"] .sheet { display: none !important; }

@media (prefers-reduced-motion: reduce) {
    body.m .scrim, body.m .sheet { transition: none; }
}
