/* Freaky Tuner — feuille de style.
   Fond blanc cassé comme les autres outils Freaky Tools (palette de Patch), thème sombre qui suit le système
   (ou choisi à la main dans les réglages), vert de marque #008d36 livré par Bruno. */

@font-face {
  font-family: "Jost";
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url("../assets/fonts/jost-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA,
                 U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193,
                 U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Jost";
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url("../assets/fonts/jost-latin-ext.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF,
                 U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113,
                 U+2C60-2C7F, U+A720-A7FF;
}

/* ---------- Thèmes ----------
   Clair par défaut. Sombre : quand le système est en sombre (sauf si on a forcé « clair »),
   ou quand on a forcé « sombre » (attribut data-theme sur <html>, posé par js/theme-init.js).
   Vert de marque : 4,3 de contraste sur blanc → réservé aux grands éléments (note, barre, boutons) ;
   nuance un peu plus foncée pour le petit texte ; éclairci en thème sombre. */
:root {
  color-scheme: light;
  --bg: #f2efe6;
  --panel: #fffdf8;
  --soft: #ebe5d4;
  --ink: #221f18;
  --muted: #6d6656;
  --line: #ddd5c3;
  --shadow: rgba(40, 32, 20, 0.16);
  --brand: #008d36;
  --brand-text: #007a2f;
  --on-brand: #ffffff;
  --ok: var(--brand);
  --ok-text: var(--brand-text);
  --danger: #b3261e;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #0d1014;
    --panel: #161a21;
    --soft: #1f2530;
    --ink: #e6e8ec;
    --muted: #98a1ae;
    --line: #2a2f3a;
    --shadow: rgba(0, 0, 0, 0.5);
    --brand: #26b862;
    --brand-text: #26b862;
    --on-brand: #0b0b0b;
    --danger: #ff8a80;
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0d1014;
  --panel: #161a21;
  --soft: #1f2530;
  --ink: #e6e8ec;
  --muted: #98a1ae;
  --line: #2a2f3a;
  --shadow: rgba(0, 0, 0, 0.5);
  --brand: #26b862;
  --brand-text: #26b862;
  --on-brand: #0b0b0b;
  --danger: #ff8a80;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: "Jost", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  -webkit-text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
}
button, select, input { font: inherit; color: inherit; }

.tuner {
  min-height: 100dvh;
  max-width: 640px;
  margin: 0 auto;
  padding: max(16px, env(safe-area-inset-top)) max(20px, env(safe-area-inset-right))
           max(20px, env(safe-area-inset-bottom)) max(20px, env(safe-area-inset-left));
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* ---------- Haut : logo, retour à Freaky Tools, notation, réglages, choix de l'instrument ---------- */
.top { display: flex; flex-direction: column; gap: 10px; }
.top-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.brand { display: flex; align-items: flex-start; gap: 3px; min-width: 0; }
.beta { margin-top: 1px; font-size: 10px; font-weight: 500; line-height: 1; letter-spacing: 0.03em; color: var(--brand-text); cursor: help; }
.logo { display: block; height: 24px; width: auto; max-width: 100%; min-width: 0; }
/* Le vert du logo suit le vert de l'appli : le même en thème clair (#008d36, celui du dessin), éclairci comme le reste en thème sombre. */
.logo [fill="#008d36"] { fill: var(--brand); }
.logo [stroke="#008d36"] { stroke: var(--brand); }
/* Aiguille du logo = VU-mètre : tourne autour de son moyeu selon le niveau du son (js/app.js, setVu). Au repos : à gauche, comme dessinée. */
.logo-needle { transform: rotate(0deg); transition: transform var(--vu-ms, 90ms) ease-out; }
.pills { display: flex; align-items: center; gap: 8px; }
.selectors { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 8px 12px; }
.selectors .field { flex: 1 1 calc(50% - 6px); } /* Instrument | Mes instruments : deux menus côte à côte… */
.selectors #tuningField { flex-basis: 100%; }    /* …et l'accordage en dessous (instruments à cordes) */

.pill {
  appearance: none;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 8px 16px;
  min-height: 38px;
  font-size: 14px;
  white-space: nowrap;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
}
.pill.icon { padding: 0; width: 38px; justify-content: center; }

/* Pastille de retour vers la suite Freaky Tools (comme sur Patch et Musician) */
.portal { gap: 6px; color: var(--muted); font-size: 13px; }
.portal::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--brand); flex: none; }
.portal:hover { color: var(--ink); border-color: var(--brand); }
@media (max-width: 559px) { .portal { display: none; } } /* sur téléphone, le lien est en bas de page */

.field { display: flex; flex-direction: column; gap: 2px; font-size: 12px; color: var(--muted); text-align: left; min-width: 0; position: relative; }
.field[hidden] { display: none; }
.pill:focus-visible, .toggle:focus-visible, .string:focus-visible, .menu-button:focus-visible,
.segmented button:focus-visible, .linklike:focus-visible, .portal-foot:focus-visible, .legal-link:focus-visible {
  outline: 3px solid var(--brand);
  outline-offset: 2px;
}

/* ---------- Écran principal : portrait = tout empilé ---------- */
.display {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  text-align: center;
}
.reading, .meter { width: 100%; display: flex; flex-direction: column; align-items: center; }

.note {
  margin: 0;
  font-size: clamp(88px, 30vw, 168px);
  font-weight: 500;
  line-height: 1;
  letter-spacing: -0.01em;
  transition: color 120ms;
}
.octave {
  font-size: 0.3em;
  font-weight: 400;
  color: var(--muted);
  margin-left: 0.08em;
}
.alt { display: none; margin: 6px 0 0; min-height: 1.4em; font-size: 16px; color: var(--muted); }
.tuner[data-alt="1"] .alt { display: block; } /* petite ligne sous la grande note : « Réel : Si♭4 » (vents) ou « Joué : Mi3 » (cordes) */
.hz { margin: 8px 0 0; min-height: 1.4em; font-size: 15px; color: var(--muted); font-variant-numeric: tabular-nums; }
/* L'écart en cents a son propre cadre de largeur fixe, et « Hz · dB » aussi : la phrase au-dessus ne bouge plus quand les chiffres changent,
   et l'ensemble reste centré (chaque cadre centre son texte). Au repos (pas de cents), « Hz · dB » reste centré tout seul. */
.hz { display: flex; justify-content: center; align-items: baseline; gap: 0.25em; }
.cents { flex: none; width: 5.9em; text-align: center; }
.cents::after { content: " ·"; }
.cents[hidden] { display: none; }
.cents:not([hidden]) + #hzText { flex: none; width: 9em; text-align: center; }

.bar { flex: none; width: 100%; max-width: 480px; height: auto; aspect-ratio: 240 / 64; overflow: visible; } /* flex: none : Safari ne doit pas écraser le dessin quand la place manque */
.bar .tick { stroke: var(--muted); }
.marker {
  stroke: var(--ink);
  stroke-width: 5;
  stroke-linecap: round;
  transition: transform var(--needle-ms, 110ms) linear, opacity 200ms; /* vitesse de l'aiguille : réglable */
  opacity: 0.25;
}
/* Bêta : encadré d'erreur (js/beta-debug.js) */
.beta-error { position: fixed; left: 8px; right: 8px; bottom: 8px; z-index: 2000; padding: 8px 10px; font-size: 12px; line-height: 1.35; color: #fff; background: #b3261e; border-radius: 8px; overflow-wrap: anywhere; cursor: pointer; }
.beta-error[hidden] { display: none; }
.status { margin: 4px 0 0; min-height: 1.5em; font-size: 17px; color: var(--muted); }

/* États */
.tuner[data-state="active"] .marker { opacity: 1; }
.tuner[data-state="active"][data-tune="ok"] .note { color: var(--ok); }
.tuner[data-state="active"][data-tune="ok"] .status { color: var(--ok-text); }
.tuner[data-state="active"][data-tune="ok"] .marker { stroke: var(--ok); }
.tuner[data-state="idle"] .note,
.tuner[data-state="listening"] .note { color: var(--muted); font-weight: 300; }
.tuner[data-target="1"] .note { font-weight: 500; } /* corde verrouillée : on montre la note visée, en gris */
.tuner[data-state="error"] .status { color: var(--danger); }
.tuner[data-state="tone"] .note { color: var(--ink); font-weight: 500; }
.tuner[data-state="tone"] .marker { opacity: 0.25; }

/* ---------- Mode par instrument : les cordes ---------- */
.instrument { display: flex; flex-direction: column; align-items: center; gap: 12px; }
.instrument[hidden] { display: none; }
/* Une colonne par corde (deux rangées à partir de 8 cordes) : la rangée tient toujours en largeur. */
.strings { display: grid; grid-template-columns: repeat(var(--cols, 6), minmax(0, 1fr)); gap: 6px; width: 100%; max-width: 480px; align-items: stretch; }
.string {
  appearance: none;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 8px 2px 6px;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1px;
  line-height: 1.2;
  cursor: pointer;
}
.string.separate { border-style: dashed; } /* corde à part (5ᵉ corde du banjo) */
.strings[data-dense="1"] .sname { font-size: 14px; }
.strings[data-dense="1"] .soct { font-size: 10px; }
.string .thick { display: block; width: 56%; background: var(--muted); border-radius: 2px; margin-bottom: 6px; }
.no-thick .string .thick { visibility: hidden; } /* on garde la place : l'accordeur ne doit pas bouger */
.string .sname { font-size: 17px; font-weight: 500; white-space: nowrap; }
.string .soct { font-size: 11px; font-weight: 400; color: var(--muted); margin-left: 1px; }
.string .snum { font-size: 11px; color: var(--muted); }
.string .spair { font-size: 11px; color: var(--muted); white-space: nowrap; }
.string.is-active { border-color: var(--ink); background: var(--soft); }
.string.is-locked { border: 2px solid var(--ink); padding: 7px 1px 5px; background: var(--soft); }
.tuner[data-tune="ok"] .string.is-active { border-color: var(--brand); }

.tools { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px 12px; }
.toggle {
  appearance: none;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 7px 14px;
  min-height: 38px;
  font-size: 14px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
}
.tools .toggle { font-size: 13px; padding: 6px 11px; gap: 6px; } /* deux rangées de boutons seulement sur un téléphone étroit */
.switch {
  position: relative;
  width: 28px;
  height: 16px;
  border-radius: 999px;
  background: var(--line);
  flex: none;
}
.switch::after {
  content: "";
  position: absolute;
  top: 2px; left: 2px;
  width: 12px; height: 12px;
  border-radius: 50%;
  background: #fff;
  transition: transform 120ms;
}
.toggle[aria-pressed="true"] .switch { background: var(--brand); }
.toggle[aria-pressed="true"] .switch::after { transform: translateX(12px); }
.lock .lock-icon { display: none; }
.lock[aria-pressed="true"] { border-color: var(--ink); background: var(--soft); }
.lock[aria-pressed="true"] .lock-icon { display: inline; }

/* ---------- Mode vent : Instrument | Réel ---------- */
.wind-view { display: flex; justify-content: center; }
.wind-view[hidden] { display: none; }
.wind-view .segmented { flex-wrap: nowrap; width: min(100%, 320px); }

/* ---------- Son de référence ---------- */
.reference { display: flex; flex-wrap: wrap; justify-content: center; align-items: flex-end; gap: 8px 12px; }
.reference[hidden] { display: none; }
.reference .field { flex: 0 1 130px; }
.play-icon { width: 0; height: 0; border-left: 9px solid currentColor; border-top: 6px solid transparent; border-bottom: 6px solid transparent; flex: none; }
.play[aria-pressed="true"] { border-color: var(--ink); background: var(--soft); }
.play[aria-pressed="true"] .play-icon { width: 10px; height: 10px; border: 0; background: currentColor; border-radius: 2px; }

/* ---------- Bas de page ---------- */
.bottom { display: flex; flex-direction: column; align-items: center; gap: 10px; }
.linklike {
  appearance: none;
  background: none;
  border: 0;
  padding: 4px 8px;
  font-size: 14px;
  color: var(--muted);
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
}
.input { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px 16px; width: 100%; }
.input .field { flex: 1 1 160px; max-width: 300px; }
.start {
  appearance: none;
  border: 2px solid var(--brand);
  border-radius: 999px;
  background: var(--brand);
  color: var(--on-brand);
  font-size: 19px;
  font-weight: 500;
  min-width: 220px;
  min-height: 56px;
  padding: 0 40px;
  cursor: pointer;
}
/* En écoute : le bouton devient « Arrêter », discret (contour seul). */
.tuner:not([data-state="idle"]):not([data-state="error"]) .start { background: transparent; color: var(--ink); border-color: var(--ink); }
.start:focus-visible { outline: 3px solid var(--ink); outline-offset: 3px; }
.start:disabled { opacity: 0.5; cursor: default; }
.foot-links { display: flex; flex-wrap: wrap; justify-content: center; gap: 4px 14px; font-size: 13px; }
.foot-links a { color: var(--muted); text-underline-offset: 3px; }
.foot-links a:hover { color: var(--ink); }
@media (min-width: 560px) { .portal-foot { display: none; } } /* le lien est déjà dans la barre du haut */
/* Ouverte depuis l'écran d'accueil (sans barre d'adresse), l'appli n'a aucun bouton « retour » : le lien vers freaky.tools y enfermerait la personne. On le cache (js/theme-init.js). */
html[data-standalone] .portal, html[data-standalone] .portal-foot { display: none; }

/* ---------- Réglages (fenêtre) ---------- */
.settings {
  border: 1px solid var(--line);
  border-radius: 20px;
  background: var(--panel);
  color: var(--ink);
  padding: 0;
  width: min(92vw, 440px);
  max-height: 90vh;
}
.settings::backdrop { background: rgba(0, 0, 0, 0.45); }
.sheet { display: flex; flex-direction: column; gap: 18px; padding: 16px 18px 22px; max-height: 90vh; overflow-y: auto; margin: 0; }
.sheet-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.sheet h2 { margin: 0; font-size: 22px; font-weight: 500; }
.sheet h3 { margin: 0 0 8px; font-size: 14px; font-weight: 500; color: var(--muted); }
.segmented { display: flex; flex-wrap: wrap; gap: 6px; }
.segmented button {
  appearance: none;
  flex: 1 1 0;
  min-height: 40px;
  padding: 0 10px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 10px;
  font-size: 15px;
  cursor: pointer;
}
.segmented button[aria-pressed="true"] { border-color: var(--ink); background: var(--soft); font-weight: 500; }
.segmented button.two-line { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px; padding: 6px 8px; line-height: 1.2; }
.segmented button.two-line small { font-size: 12px; font-weight: 400; color: var(--muted); }
.a4-row { display: flex; align-items: center; justify-content: center; gap: 10px; margin-bottom: 10px; }
.a4-row input {
  width: 6em;
  min-height: 44px;
  text-align: center;
  font-size: 24px;
  font-weight: 500;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 10px;
  font-variant-numeric: tabular-nums;
}
.a4-row .unit { color: var(--muted); }
.a4-row .step {
  appearance: none;
  width: 44px;
  height: 44px;
  font-size: 24px;
  line-height: 1;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 50%;
  cursor: pointer;
}
.sheet input[type="range"] { width: 100%; accent-color: var(--brand); }
.a4-row input:focus-visible, .a4-row .step:focus-visible, .sheet input[type="range"]:focus-visible {
  outline: 3px solid var(--brand);
  outline-offset: 2px;
}
.sheet .hint { margin: 8px 0 0; font-size: 13px; line-height: 1.4; color: var(--muted); }
.sheet .hint[hidden] { display: none; }
.sheet .legal-link { color: var(--muted); font-size: 14px; text-underline-offset: 3px; }

/* ---------- Mes instruments (fenêtre) ---------- */
.mine .sheet { gap: 14px; }
.mine p { margin: 0; }
#mineListView { display: flex; flex-direction: column; gap: 12px; }
#mineListView[hidden], .mine-form[hidden], .mine-empty[hidden], .mine #mineClose[hidden] { display: none; }
.mine-intro, .mine-hint { font-size: 14px; line-height: 1.45; color: var(--muted); }
.mine-empty { font-size: 15px; padding: 4px 0; }
.mine-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.mine-card { display: flex; flex-direction: column; gap: 4px; padding: 12px; background: var(--bg); border: 1px solid var(--line); border-radius: 12px; }
.mine-card[data-current="true"] { border-color: var(--brand); }
.mine-card-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.mine-card-name { font-size: 17px; font-weight: 500; overflow-wrap: anywhere; }
.mine-badge { flex: none; padding: 1px 9px; font-size: 12px; color: var(--brand-text); border: 1px solid var(--brand); border-radius: 999px; white-space: nowrap; }
.mine-line { font-size: 14px; color: var(--muted); overflow-wrap: anywhere; }
.mine-note { font-size: 14px; white-space: pre-wrap; overflow-wrap: anywhere; }
.mine-card-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 6px; }
.mine-add { align-self: flex-start; }
.mine-io { display: flex; flex-wrap: wrap; gap: 8px; }
.mine-filename { margin-top: 2px; }
.mine-status { min-height: 1.4em; font-size: 14px; color: var(--ok-text); }
.mine-form { display: flex; flex-direction: column; gap: 12px; }
.mine-field { display: flex; flex-direction: column; gap: 2px; font-size: 12px; color: var(--muted); text-align: left; }
.mine-field input, .mine-field textarea {
  width: 100%;
  min-height: 40px;
  padding: 7px 10px;
  font: inherit;
  font-size: 16px; /* 16 px : l'iPhone ne zoome pas la page quand on touche un champ */
  color: var(--ink);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 10px;
}
.mine-field input[type="text"], .mine-field textarea { appearance: none; }
.mine-field textarea { min-height: 76px; resize: vertical; }
.mine-form .menu-button { color: var(--ink); } /* valeurs des menus aussi lisibles que celles des champs de texte */
.mine-field input:focus, .mine-field textarea:focus { outline: 2px solid var(--brand); outline-offset: 0; border-color: transparent; }
.mine-error { min-height: 1.3em; font-size: 14px; color: var(--danger); }
.mine-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.pill.primary { background: var(--brand); border-color: var(--brand); color: var(--on-brand); font-weight: 500; }
.pill.danger { color: var(--danger); border-color: var(--danger); }

/* ---------- Fenêtre « Installer sur l'écran d'accueil » ---------- */
.install .sheet h2 { font-size: 20px; line-height: 1.25; }
.install p { margin: 0; font-size: 15px; line-height: 1.5; }
.install ol { margin: 0; padding-left: 22px; }
.install li { margin: 8px 0; font-size: 15px; line-height: 1.5; padding-left: 4px; }
.install li::marker { color: var(--brand-text); font-weight: 500; }
.install section[hidden] { display: none; }
.install .inline-icon { width: 1.15em; height: 1.15em; vertical-align: -0.22em; margin: 0 1px; }
.install .linklike { align-self: flex-start; padding-left: 0; }
.install-outro { color: var(--muted); font-size: 14px; }
.install #installNever { align-self: flex-start; }
/* Ordre d'affichage : en-tête et intro, puis l'étape du téléphone détecté (order 1) avant l'autre (order 2), puis la fin. */
.install .linklike, .install .install-outro, .install #installNever { order: 3; }

/* ---------- Menus déroulants à l'allure de l'appli (js/menu.js) ----------
   Le <select> d'origine reste caché dans la page : il garde la valeur et les événements. */
.menu { position: relative; }
.menu-button {
  appearance: none;
  width: 100%;
  min-height: 40px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 7px 10px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 10px;
  font-size: 15px;
  text-align: left;
  cursor: pointer;
}
.menu-button[aria-expanded="true"] { border-color: var(--ink); }
.menu-button:disabled { opacity: 0.55; cursor: default; }
.menu-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.menu-chevron { flex: none; color: var(--muted); }
.menu-pop {
  position: fixed;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  background: var(--panel);
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: 0 12px 32px var(--shadow);
  overflow: hidden;
  outline: none;
}
.menu-pop[hidden] { display: none; }
.menu-list {
  flex: 1 1 auto;
  min-height: 0;
  margin: 0;
  padding: 6px;
  list-style: none;
  overflow-y: auto;
  overscroll-behavior: contain;
  outline: none;
}
/* Champ de recherche en haut de la liste (menu Instrument) */
.menu-search-wrap { flex: none; padding: 8px 8px 6px; border-bottom: 1px solid var(--line); }
.menu-search {
  appearance: none;
  display: block;
  width: 100%;
  min-height: 38px;
  padding: 6px 10px;
  font-size: 16px; /* 16 px : l'iPhone ne zoome pas la page quand on touche le champ */
  color: var(--ink);
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 8px;
}
.menu-search:focus { outline: 2px solid var(--brand); outline-offset: 0; border-color: transparent; }
.menu-empty { padding: 12px 10px; font-size: 14px; color: var(--muted); }
.menu-group[hidden], .menu-option[hidden], .menu-empty[hidden] { display: none; }
.menu-group { padding: 10px 10px 3px; font-size: 12px; color: var(--muted); }
.menu-group:first-child { padding-top: 4px; }
.menu-option {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 9px 10px;
  border-radius: 8px;
  font-size: 15px;
  cursor: pointer;
}
.menu-option[data-active="true"] { background: var(--soft); }
.menu-option[aria-selected="true"] { font-weight: 500; }
.menu-option[aria-selected="true"]::after { content: "✓"; color: var(--brand-text); }
.menu-option[aria-disabled="true"] { opacity: 0.45; cursor: default; }

/* ---------- Paysage sur téléphone : peu de hauteur ---------- */
@media (orientation: landscape) and (max-height: 540px) {
  .tuner { gap: 4px; max-width: none; padding-top: max(6px, env(safe-area-inset-top)); padding-bottom: max(6px, env(safe-area-inset-bottom)); }
  .bar { max-width: 300px; }
  .hz { margin-top: 2px; }
  .alt { margin-top: 2px; }
  .status { margin-top: 0; font-size: 15px; } /* paysage : la ligne « Presque ! · trop bas · −5 cents » doit tenir sur une ligne */
  .top { flex-direction: row; align-items: flex-end; gap: 12px; }
  .top-row { order: 2; flex: 0 1 auto; min-width: 0; } /* peut se serrer : le logo rétrécit un peu plutôt que de faire déborder la ligne */
  .logo { height: 20px; }
  .top-row .pill { padding: 5px 11px; min-height: 34px; } /* pastilles resserrées : plus de place pour le logo et les menus */
  .top-row .pill.icon { width: 34px; padding: 0; }
  .selectors { flex: 1; flex-wrap: nowrap; } /* paysage : une seule rangée */
  .selectors .field, .selectors #tuningField { flex: 1 1 0; }
  .selectors .field:first-child { flex-grow: 2; } /* le nom de l'instrument est le plus long */
  .reference { flex-wrap: nowrap; justify-content: center; }
  .display { flex-direction: row; justify-content: space-around; gap: 24px; }
  .reading, .meter { width: auto; flex: 1; }
  .note { font-size: clamp(56px, 21vh, 120px); }
  .instrument { flex-direction: row; justify-content: center; gap: 16px; }
  .instrument .strings { flex: 1; }
  .instrument .tools { display: grid; grid-template-columns: repeat(2, auto); gap: 6px 8px; flex: none; }
  .string { padding: 5px 2px 4px; }
  .string .thick { margin-bottom: 3px; }
  .string .sname { font-size: 15px; }
  .bottom { flex-direction: row; justify-content: center; align-items: flex-end; gap: 16px; flex-wrap: wrap; }
  .start { min-height: 44px; min-width: 160px; padding: 0 28px; font-size: 17px; }
  .foot-links { flex: none; font-size: 12px; }
}

@media (prefers-reduced-motion: reduce) {
  .marker, .note, .switch::after, .logo-needle { transition: none; }
}
