/* Polices locales (outils/src/polices, licences OFL dans CREDITS.md). */
@font-face { font-family: "Space Grotesk"; font-weight: 500; font-style: normal; font-display: block; src: url(/v/858c8cdacc06/polices/space-grotesk-500.woff2) format("woff2"); }
@font-face { font-family: "Space Grotesk"; font-weight: 700; font-style: normal; font-display: block; src: url(/v/858c8cdacc06/polices/space-grotesk-700.woff2) format("woff2"); }
@font-face { font-family: "IBM Plex Sans"; font-weight: 400; font-style: normal; font-display: block; src: url(/v/858c8cdacc06/polices/ibm-plex-sans-400.woff2) format("woff2"); }
@font-face { font-family: "IBM Plex Sans"; font-weight: 500; font-style: normal; font-display: block; src: url(/v/858c8cdacc06/polices/ibm-plex-sans-500.woff2) format("woff2"); }
@font-face { font-family: "IBM Plex Sans"; font-weight: 600; font-style: normal; font-display: block; src: url(/v/858c8cdacc06/polices/ibm-plex-sans-600.woff2) format("woff2"); }
@font-face { font-family: "IBM Plex Mono"; font-weight: 500; font-style: normal; font-display: block; src: url(/v/858c8cdacc06/polices/ibm-plex-mono-500.woff2) format("woff2"); }
@font-face { font-family: "IBM Plex Mono"; font-weight: 700; font-style: normal; font-display: block; src: url(/v/858c8cdacc06/polices/ibm-plex-mono-700.woff2) format("woff2"); }

/*
  Variables de zone : les composants (boutons segmentés, champs, interrupteurs) lisent --z-*, pas les jetons.
  La zone claire est celle de la page ; la scène (manche, métronome) et la feuille de réglages du téléphone
  redéfinissent les --z-* pour réutiliser les mêmes composants sur fond sapin.
*/
:root {
    --z-texte: var(--encre);
    --z-doux: var(--doux);
    --z-carte: var(--carte);
    --z-piste: var(--sauge-pale);
    --z-trait: var(--bord);
    --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);
    --z-survol: var(--accent);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { color-scheme: light; }

body {
    margin: 0;
    background: var(--fond);
    color: var(--encre);
    font-family: var(--corps);
    font-size: 15px;
    line-height: 1.5;
    padding-left: max(16px, env(safe-area-inset-left, 0px));
    padding-right: max(16px, env(safe-area-inset-right, 0px));
    padding-block: 20px 40px;
}

.wrap { max-width: 1320px; margin: 0 auto; display: flex; flex-direction: column; gap: 18px; }
#vue-gammes { display: flex; flex-direction: column; gap: 18px; }
button, select { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid var(--z-anneau); outline-offset: 2px; border-radius: 6px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

.lbl { font-family: var(--mono); font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: var(--z-doux); }

/* En-tête et entrées */
.top { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.brand { display: flex; align-items: center; gap: 12px; }
.brand svg { flex: none; }
.logo-bois { fill: var(--logo-bois); }
.logo-frette { fill: var(--logo-frette); }
.logo-cordes { stroke: var(--logo-cordes); stroke-width: 1; }
.logo-point-1 { fill: var(--logo-point-1); }
.logo-point-3 { fill: var(--logo-point-3); }
h1 { font-family: var(--titre); font-weight: 700; font-size: clamp(22px, 3vw, 30px); line-height: 1.05; margin: 0; letter-spacing: -.01em; }
.brand p { margin: 2px 0 0; color: var(--doux); font-size: 13px; }

.entrees { display: flex; gap: 2px; align-items: stretch; margin: 0 auto 0 28px; }
.entrees a { display: inline-flex; align-items: center; min-height: 44px; padding: 0 14px; color: var(--doux); text-decoration: none; font-weight: 500; font-size: 14px; border-radius: 8px; }
.entrees .court { display: none; }
.entrees a[aria-current="page"] { color: var(--encre); font-weight: 600; border-radius: 0; box-shadow: inset 0 -3px 0 var(--accent); }
@media (hover: hover) {
    .entrees a:hover { color: var(--encre); background: var(--sauge-pale); }
}

/* Boutons segmentés : la pastille choisie est claire, graisse 700, avec un filet --accent en zone claire */
.seg { display: inline-flex; background: var(--z-piste); border-radius: 999px; padding: 3px; gap: 2px; }
.seg button { border: 0; background: transparent; padding: 6px 13px; border-radius: 999px; font-size: 13px; font-weight: 500; color: var(--z-doux); transition: background .18s, color .18s; min-height: 32px; white-space: nowrap; }
.seg button[aria-pressed="true"] { background: var(--z-choix-fond); color: var(--z-choix-encre); font-weight: 700; box-shadow: 0 0 0 2px var(--z-choix-filet), var(--z-ombre); }
.seg button:disabled { opacity: .4; cursor: not-allowed; }

/* Réglages */
.deck { display: grid; grid-template-columns: auto minmax(0, 1fr) 230px 250px; gap: 14px 20px; align-items: end; }
.seg.inst { border-radius: 10px; padding: 3px; }
.seg.inst button { border-radius: 8px; min-height: 34px; padding: 6px 14px; font-size: 13.5px; }
.field { display: flex; flex-direction: column; gap: 7px; min-width: 0; }
.roots { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 5px; }
.roots button { border: 1px solid var(--z-trait); background: var(--z-carte); border-radius: 8px; min-height: 40px; padding: 0 2px;
  font-family: var(--mono); font-size: 13px; font-weight: 500; transition: background .15s, border-color .15s, color .15s; }
/* La tonique choisie est le degré 1 : seul cas où une couleur de degré marque un choix (outils.md) */
.roots button[aria-pressed="true"] { background: var(--degre-1); border-color: var(--degre-1); color: var(--degre-1-encre); font-weight: 700; }
.select { appearance: none; width: 100%; border: 1px solid var(--z-trait); background-color: var(--z-carte); border-radius: 8px; min-height: 40px; padding: 0 34px 0 12px; font-size: 14px; font-weight: 500;
  background-image: linear-gradient(45deg, transparent 50%, var(--z-doux) 50%), linear-gradient(135deg, var(--z-doux) 50%, transparent 50%);
  background-position: calc(100% - 17px) 17px, calc(100% - 12px) 17px; background-size: 5px 5px; background-repeat: no-repeat; cursor: pointer; }
@media (hover: hover) {
    .roots button:hover, .select:hover { border-color: var(--z-survol); }
}

/* Système de positions et son aide */
.sys-bloc { display: flex; flex-direction: column; gap: 4px; align-items: flex-start; }
.sys-aide { font-size: 12px; }

/* Cartes du bas */
.lower { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr); gap: 18px; }
.card { background: var(--carte); border: 1px solid var(--bord); border-radius: 14px; padding: 18px 20px; display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.card h3 { margin: 0; font-family: var(--titre); font-weight: 700; font-size: 18px; }
.notes { display: flex; flex-wrap: wrap; gap: 8px; }
/* Note repérée : contour --accent sur fond --accent-voile (repérage, ni choix ni « en cours ») */
.note { display: flex; flex-direction: column; align-items: center; gap: 2px; min-width: 58px; padding: 8px 10px 7px; border-radius: 10px; border: 1px solid var(--bord); background: var(--fond); transition: border-color .15s, background .15s; }
.note[aria-pressed="true"] { border-color: var(--accent); background: var(--accent-voile); }
.note .sw { width: 10px; height: 10px; border-radius: 50%; border: 1px solid var(--matiere-contour); }
.note b { font-family: var(--mono); font-size: 15px; }
.note small { font-family: var(--mono); font-size: 11.5px; color: var(--doux); }
.facts { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 6px 16px; margin: 0; }
.facts dt { font-family: var(--mono); font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: var(--doux); padding-top: 2px; }
.facts dd { margin: 0; font-family: var(--mono); font-size: 13.5px; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.hint { margin: 0; font-size: 13px; color: var(--z-doux); }
.opt-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.switch { display: flex; align-items: center; justify-content: space-between; gap: 12px; font-size: 14px; cursor: pointer; min-height: 36px; }
.switch input { appearance: none; width: 40px; height: 23px; border-radius: 999px; background: var(--z-piste); border: 1px solid var(--z-trait); position: relative; cursor: pointer; transition: background .18s; flex: none; margin: 0; }
.switch input::after { content: ""; position: absolute; top: 2px; left: 2px; width: 17px; height: 17px; border-radius: 50%; background: var(--carte); box-shadow: var(--ombre-bouton); transition: transform .18s; }
.switch input:checked { background: var(--z-actif-fond); border-color: var(--z-actif-fond); }
.switch input:checked::after { transform: translateX(17px); background: var(--z-actif-encre); }
.legend { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 8px 12px; margin: 0; padding: 0; list-style: none; font-size: 13px; }
.legend li { display: flex; align-items: center; gap: 8px; }
.legend i { width: 14px; height: 14px; border-radius: 50%; flex: none; border: 1px solid var(--matiere-contour); }
.legend i.r-root, .note .sw.r-root { background: var(--degre-1); }
.legend i.r-d2, .note .sw.r-d2 { background: var(--degre-2); }
.legend i.r-third, .note .sw.r-third { background: var(--degre-3); }
.legend i.r-d4, .note .sw.r-d4 { background: var(--degre-4); }
.legend i.r-fifth, .note .sw.r-fifth { background: var(--degre-5); }
.legend i.r-d6, .note .sw.r-d6 { background: var(--degre-6); }
.legend i.r-d7, .note .sw.r-d7 { background: var(--degre-7); }
.legend i.r-blue, .note .sw.r-blue { background: var(--degre-blue); }
.legend i.r-blue { border: 1.5px dashed var(--z-doux); }
.sep { height: 1px; background: var(--z-trait); border: 0; margin: 0; }
footer { font-size: 12.5px; color: var(--doux); display: flex; gap: 6px 16px; flex-wrap: wrap; }
kbd { font-family: var(--mono); font-size: 11px; border: 1px solid var(--bord); border-bottom-width: 2px; border-radius: 4px; padding: 0 5px; background: var(--carte); }

@media (max-width: 1240px) {
    .deck { grid-template-columns: auto minmax(0, 1fr) minmax(0, 1fr); }
    .deck .roots-field { grid-column: 1 / -1; order: 5; }
}
@media (max-width: 760px) {
    .deck { grid-template-columns: 1fr 1fr; }
    .deck .inst-field { grid-column: 1 / -1; }
    .seg.inst { display: flex; }
    .seg.inst button { flex: 1; }
}
@media (max-width: 820px) {
    .lower { grid-template-columns: 1fr; }
}
@media (max-width: 620px) {
    .roots { grid-template-columns: repeat(6, minmax(0, 1fr)); }
    .deck { grid-template-columns: 1fr; }
}
@media (prefers-reduced-motion: reduce) {
    * { transition: none !important; }
}
