/* Bass Routine — © 2026 FredLatorche (https://github.com/fredlatorche/BassRoutine). Tous droits réservés. */

:root {
  --bg: #181a26;
  --card: #232637;
  --line: #34384f;
  --text: #e8e9f0;
  --muted: #9095b0;
  --accent: #ffaa3c;
  --on-accent: #1a1a1a;     /* texte posé sur l'accent */
  --accent-deep: #b86a00;   /* accent foncé (contours sur la portée) */
  --strong-line: #5a6082;
  /* Chevron des menus déroulants (clair sur les thèmes sombres). */
  --chevron: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 11 7'%3E%3Cpath d='M1 1l4.5 4.5L10 1' fill='none' stroke='%23d6d8e2' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  color-scheme: dark;
}

/* ---------- Thèmes de couleurs (choix dans la roue crantée) ---------- */

:root[data-theme="noir"] {
  --bg: #000; --card: #111214; --line: #26282e; --text: #ececec; --muted: #8a8d96;
  --accent: #ffaa3c; --on-accent: #1a1a1a; --accent-deep: #b86a00; --strong-line: #4a4d57;
}
:root[data-theme="bois"] {
  --bg: #1e1712; --card: #2a211a; --line: #3d3127; --text: #f1e6d8; --muted: #b3a08a;
  --accent: #e8a24a; --on-accent: #241604; --accent-deep: #9c5f14; --strong-line: #6b5440;
}
:root[data-theme="ocean"] {
  --bg: #0f1d24; --card: #16303a; --line: #24444f; --text: #e3f1f4; --muted: #8fb2bb;
  --accent: #3cc6c9; --on-accent: #062a2b; --accent-deep: #137b7d; --strong-line: #3b6874;
}
:root[data-theme="foret"] {
  --bg: #131c16; --card: #1c2a20; --line: #2b3d30; --text: #e4efe6; --muted: #94ad99;
  --accent: #8fd16a; --on-accent: #13240b; --accent-deep: #4a8a2a; --strong-line: #4b6650;
}
:root[data-theme="violet"] {
  --bg: #1b1526; --card: #271d38; --line: #3a2d52; --text: #ece6f6; --muted: #a497bd;
  --accent: #c58cff; --on-accent: #26103d; --accent-deep: #7b45b8; --strong-line: #5d4a80;
}
:root[data-theme="clair"] {
  --bg: #eef0f4; --card: #fff; --line: #d3d7e0; --text: #1e2130; --muted: #646a80;
  --accent: #e07a00; --on-accent: #fff; --accent-deep: #a35800; --strong-line: #9aa1b5;
  --chevron: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 11 7'%3E%3Cpath d='M1 1l4.5 4.5L10 1' fill='none' stroke='%231e2130' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  color-scheme: light;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  padding: env(safe-area-inset-top, 0px) 16px calc(env(safe-area-inset-bottom, 0px) + 24px);
  background: var(--bg);
  color: var(--text);
  font: 15px/1.4 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  max-width: 1100px;
  margin-inline: auto;
}

/* En-tête collé en haut de l'écran : titre + Play à gauche, mesure / temps + réglages à droite. */
header {
  position: sticky;
  top: env(safe-area-inset-top, 0px);
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-inline: -16px;
  padding: 10px 16px;
  margin-bottom: 8px;
  background: var(--bg);
  border-bottom: 1px solid var(--line);
}
.header-left { display: flex; align-items: center; gap: 12px; min-width: 0; }

h1 { margin: 0; font-size: 1.3rem; white-space: nowrap; }

/* Logo : basse détourée à l'horizontale ; crème sur les thèmes foncés, noire sur le thème clair. */
.brand { display: flex; align-items: center; gap: 10px; }
.logo {
  height: 38px;
  width: auto;
  filter: drop-shadow(0 1px 3px rgba(0, 0, 0, 0.45));
}
.logo-on-light { display: none; }
:root[data-theme="clair"] .logo-on-dark { display: none; }
:root[data-theme="clair"] .logo-on-light { display: block; }
@media (max-width: 520px) {
  .logo { height: 30px; }
}
@media (max-width: 900px) {
  .brand-name {   /* écran pas très large : la basse tient lieu de titre, la place va au tempo */
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
  }
}

#position {
  min-width: 3.5em;
  text-align: right;
  font-size: 1.1rem;
  font-variant-numeric: tabular-nums;
  color: var(--accent);
  font-weight: 700;
  white-space: nowrap;
}

.controls {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 14px;
  background: var(--card);
  border-radius: 12px;
  margin-bottom: 16px;
}

.control { display: flex; align-items: center; gap: 8px; }
.control label { color: var(--muted); }
/* ---------- Panneau de réglages : lecture, puis réglages du mode, puis accompagnement ---------- */

.transport {
  display: grid;
  grid-template-columns: minmax(130px, 170px) minmax(0, 1fr);
  gap: 12px 16px;
  align-items: end;
}

/* Un réglage = un petit libellé au-dessus de son menu, tous de la même largeur. */
.field { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.field > label:not(.toggle):not(.file-btn), .field > .label {
  display: flex;
  justify-content: space-between;
  font-size: 0.75rem;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: var(--muted);
}
.field select, .field > button, .field .file-btn { width: 100%; min-height: 36px; }
.field.check { justify-content: flex-end; }
.field .toggle { min-height: 22px; }
.toggle-line { display: flex; gap: 14px; }
.field.check .toggle { min-height: 36px; }

.fields {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 10px 14px;
  align-items: end;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}
.field.wide { grid-column: span 2; }
.field-set { display: contents; }
.fields-title { grid-column: 1 / -1; margin-top: 2px; font-size: 0.8rem; font-weight: 600; color: var(--muted); }

@media (max-width: 560px) {
  .transport { grid-template-columns: minmax(0, 1fr); }
}


button, select {
  font: inherit;
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 6px 10px;
}

/* Menus : chevron dessiné (couleur du thème), un peu plus éloigné du bord droit que le natif. */
select {
  -webkit-appearance: none;
  appearance: none;
  padding-right: 26px;
  background-image: var(--chevron);
  background-position: right 8px center;
  background-size: 11px 7px;
  background-repeat: no-repeat;
}

button { cursor: pointer; }
button.small { width: 34px; padding: 6px 0; }

/* Lecture : deux boutons ronds, retour au début (plus petit) puis Play / Stop. */
.transport { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
button.round {
  display: grid;
  place-items: center;
  padding: 0;
  border-radius: 50%;
  border: none;
  background: var(--accent);
  color: var(--on-accent);
}
button.round svg { fill: currentColor; }
button.play { width: 44px; height: 44px; }
button.play svg { width: 24px; height: 24px; }
button.rewind { width: 34px; height: 34px; }
button.rewind svg { width: 18px; height: 18px; }

@media (max-width: 380px) {
  h1 { font-size: 1.1rem; }
}
/* Téléphone étroit en portrait : en-tête resserré pour que Play, le 🎯, l'accordeur, ⚙️ et 👤 tiennent. */
@media (max-width: 430px) and (orientation: portrait) {
  header { gap: 5px; }
  .header-left { gap: 6px; }
  .logo { height: 18px; }
  .header-right { gap: 3px; }
  button.gear { padding: 4px 3px; }
  #position { min-width: 0; font-size: 1rem; }
  body.gaming #position { display: none; }   /* partie en cours : la note prend la place du compteur */
}

/* En-tête étroit (téléphone, petit paysage) : bouton métronome à la place de la réglette de tempo.
   Glisser le doigt sur le bouton change le tempo (réglette affichée). En portrait, il prend aussi
   la place du compteur de mesures. */
.tempo-btn, .tempo-pop { display: none; }
@media (max-width: 520px) and (orientation: portrait) {
  #position { display: none !important; }
}
@media (max-width: 640px) {
  .head-tempo { display: none !important; }
  .tempo-btn {
    display: grid; place-items: center; padding: 4px 5px; border-radius: 7px;
    touch-action: none; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none;
  }
  .tempo-btn .metronome { display: block; width: 1.05rem; height: 1.05rem; fill: none; stroke: var(--text); stroke-width: 1.4; stroke-linejoin: round; stroke-linecap: round; }
  .tempo-btn[aria-expanded="true"] { border-color: var(--accent); }
  .tempo-pop:not([hidden]) {
    position: fixed; left: 12px; right: 12px; z-index: 30;
    display: flex; align-items: center; gap: 8px; padding: 12px;
    background: var(--card); border: 1px solid var(--accent); border-radius: 12px;
    box-shadow: 0 8px 28px rgba(0, 0, 0, 0.45);
    animation: settings-in 0.15s ease-out;
  }
  .tempo-pop input { flex: 1; min-width: 0; accent-color: var(--accent); }
  .tempo-pop output { min-width: 4.6em; text-align: right; font-weight: 700; color: var(--accent); font-variant-numeric: tabular-nums; }
}

/* Tempo dans l'en-tête, entre Play et les boutons de droite (sauf en-tête étroit, ci-dessus). */
.head-tempo { display: flex; align-items: center; gap: 8px; flex: 1; max-width: 320px; min-width: 0; margin-inline: 10px; }
.head-tempo .metronome { width: 22px; height: 22px; flex-shrink: 0; fill: none; stroke: var(--text); stroke-width: 1.2; stroke-linejoin: round; stroke-linecap: round; }
.head-tempo input { flex: 1; min-width: 0; accent-color: var(--accent); }
.head-tempo output { min-width: 2.2em; font-size: 0.9rem; font-variant-numeric: tabular-nums; color: var(--accent); font-weight: 700; }
@media (orientation: landscape) and (max-height: 500px) {
  /* Rien que l'en-tête et la tab (avec la portée) : les réglages restent en portrait. */
  body > :not(header, #tuner, #mixer, #message, #tabPanel, .game-result, .finger-tip, .confetti-canvas) { display: none !important; }
  /* La tab occupe tout l'écran sous l'en-tête (plus de bande vide entre les deux). */
  body { display: flex; flex-direction: column; height: 100dvh; padding-bottom: 0; box-sizing: border-box; overflow: hidden; }
  header { margin-bottom: 0; }
  body > #tabPanel { position: relative; flex: 1; align-items: flex-start; margin-inline: -16px; }
  /* Réglages et accordeur passent au-dessus de la tab, sur toute la hauteur disponible. */
  #mixer, #tuner { max-height: calc(100dvh - 80px); }
}

#grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 12px;
}

.bar {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px;
}

.bar-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
  color: var(--muted);
}

.steps {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
}

.steps select {
  width: 100%;
  padding: 8px 2px;
  text-align: center;
  /* Cases étroites de la grille : flèche native, sans place réservée. */
  -webkit-appearance: menulist;
  appearance: auto;
  background-image: none;
}

.steps select:first-child { border-color: var(--strong-line); }
.steps select.rest { color: var(--muted); }
.steps select.playing { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent); }

[hidden] { display: none !important; }

.toggle { display: flex; align-items: center; gap: 6px; cursor: pointer; }

.file-btn {
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  border: 1px dashed var(--muted);
  border-radius: 8px;
  padding: 6px 10px;
}
.file-btn input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }

/* ---------- Grille d'accords du morceau ---------- */

#songInfo { color: var(--muted); margin: 0 0 10px; }

#chart {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
}

.chart-bar {
  position: relative;
  min-height: 58px;
  padding: 20px 8px 10px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 8px;
  font-weight: 600;
  font-size: 1.05rem;
}
.chart-bar .sec { position: absolute; top: 3px; left: 7px; font-size: 0.75rem; color: var(--accent); }
.chart-bar .num { position: absolute; top: 4px; right: 7px; font-size: 0.7rem; color: var(--muted); font-weight: 400; }
.chart-bar .bar-del { position: absolute; top: 1px; left: 2px; min-width: 0; min-height: 0; padding: 0 6px; font-size: 0.8rem; font-weight: 400; line-height: 1.6; color: var(--muted); background: none; border: none; }
.chart-bar .bar-del:hover { color: #e5534b; }
.chart-bar.playing { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent); }

.hint { color: var(--muted); font-size: 0.85rem; margin-top: 20px; margin-bottom: 0; }
.guide { margin-top: 14px; font-size: 0.9rem; line-height: 1.5; }
.guide summary { cursor: pointer; color: var(--accent); font-weight: 600; }
.guide h3 { font-size: 1rem; margin: 16px 0 6px; }
.guide h4 { font-size: 0.95rem; margin: 12px 0 4px; }
.guide p, .guide ul { margin: 4px 0; }
.guide ul { padding-left: 20px; }
.guide li { margin: 4px 0; }
.copyright { color: var(--muted); font-size: 0.8rem; margin: 10px 0 0; }
.copyright a { color: var(--accent); }

/* Les deux basses : têtes en haut au centre, corps écartés vers le bas (pivot sur la tête). */
.bass-duo { position: relative; height: 265px; max-width: 420px; margin: 16px auto 200px; pointer-events: none; }
.bass-duo img { position: absolute; top: 0; width: 240px; height: auto; transform-origin: right center; filter: drop-shadow(0 6px 8px rgba(0, 0, 0, 0.35)); }
.bass-duo .bass-noire { right: calc(50% + 24px); transform: rotate(-74deg); }
.bass-duo .bass-creme { right: calc(50% - 24px); transform: rotate(-106deg); }
:root:not([data-theme="clair"]) .bass-duo .bass-noire { filter: drop-shadow(0 0 1px rgba(255, 255, 255, 0.45)) drop-shadow(0 6px 8px rgba(0, 0, 0, 0.35)); }

/* ---------- Tablature (fixée en bas) ---------- */

#tabPanel {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  padding: 6px 16px calc(env(safe-area-inset-bottom, 0px) + 6px);
  background: var(--card);
  border-top: 1px solid var(--line);
  box-shadow: 0 -10px 30px rgba(0, 0, 0, 0.65);   /* ombre portée vers le haut : la bande flotte au-dessus */
  font: 600 14px/1 ui-monospace, Menlo, monospace;
  user-select: none;            /* un clic place le repère, sans sélectionner de texte */
  -webkit-user-select: none;
}

/* Avancement dans le morceau, sous la tab : barre fine qui se remplit, avec un point au bout. */
#tabPanel { padding-bottom: calc(env(safe-area-inset-bottom, 0px) + 16px); }
.progress { position: absolute; left: 16px; right: 16px; bottom: calc(env(safe-area-inset-bottom, 0px) + 5px); height: 12px; cursor: pointer; --p: 0; }
.progress::before { content: ''; position: absolute; left: 0; right: 0; top: 5px; height: 2px; border-radius: 1px; background: var(--line); }
.progress-fill { position: absolute; left: 0; top: 5px; height: 2px; border-radius: 1px; width: calc(var(--p) * 100%); background: var(--accent); }
.progress-dot { position: absolute; top: 2px; left: calc(var(--p) * 100% - 4px); width: 8px; height: 8px; border-radius: 50%; background: var(--accent); }

/* Cordes à 30, 54, 78 et 102 px du haut (décalées sous la portée si elle est affichée). */
.tab-labels { position: relative; width: 20px; height: calc(140px + var(--off, 0px)); color: var(--muted); flex-shrink: 0; }
.tab-labels.with-staff { width: 36px; }
.tab-labels.fr { width: 30px; }   /* « Sol », « Ré »… plus larges que G, D */
.tab-labels span { position: absolute; left: 0; transform: translateY(-50%); }
.tab-labels span:nth-of-type(1) { top: calc(30px + var(--off, 0px)); }
.tab-labels span:nth-of-type(2) { top: calc(54px + var(--off, 0px)); }
.tab-labels span:nth-of-type(3) { top: calc(78px + var(--off, 0px)); }
.tab-labels span:nth-of-type(4) { top: calc(102px + var(--off, 0px)); }
.tab-labels .staff-clef { position: absolute; top: 0; left: 0; }

/* Pas de barre de défilement : la barre d'avancement en dessous la remplace (on fait toujours défiler
   la tab au doigt, à la molette ou au pavé tactile). */
.tab-scroll { position: relative; flex: 1; overflow-x: auto; scrollbar-width: none; cursor: pointer; }
.tab-scroll::-webkit-scrollbar { display: none; }
.tab-track { position: relative; padding-right: 70vw; box-sizing: content-box; }

.tab-line { position: absolute; left: 0; right: 0; height: 1px; background: var(--line); }

.tab-bar {
  position: absolute;
  bottom: 26px;
  border-left: 2px solid var(--muted);
  padding-left: 3px;
  color: var(--muted);
  font-size: 11px;
}

.tab-note {
  position: absolute;
  transform: translateY(-50%);
  padding: 0 3px;
  border-radius: 4px;
  background: var(--card);
  line-height: 18px;
}
.tab-note.playing { background: var(--accent); color: var(--on-accent); }
/* Mode Jeu : note parfaite (le chiffre gonfle, une étincelle s'envole). */
.tab-note.g-pop { animation: g-pop 0.45s ease-out; }
.g-burst { position: absolute; z-index: 6; width: 0; height: 0; pointer-events: none; }
.g-burst i {
  position: absolute; left: -7px; top: -10px; font-style: normal; font-size: 17px; line-height: 20px;
  color: #ffd75e; text-shadow: 0 0 6px rgba(255, 215, 94, 0.9), 0 0 2px #fff;
  opacity: 0; animation: g-star 1.1s ease-out forwards;
}
@keyframes g-pop { 40% { transform: translateY(-50%) scale(1.45); box-shadow: 0 0 0 3px rgba(63, 185, 80, 0.45); } }
@keyframes g-star {
  0% { transform: translate(0, 0) scale(0.4) rotate(0); opacity: 1; }
  60% { opacity: 1; }
  100% { transform: translate(var(--dx), var(--dy)) scale(1.2) rotate(140deg); opacity: 0; }
}
@media (prefers-reduced-motion: reduce) { .tab-note.g-pop { animation: none; } .g-burst { display: none; } }

.tab-name {
  position: absolute;
  color: var(--muted);
  font: 500 11px/1 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}
.tab-name.playing { color: var(--accent); }

.tab-playhead {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 2px;
  background: var(--accent);
  opacity: 0.6;
}

/* Point de départ choisi sur la tab. */
.tab-cue {
  position: absolute;
  top: 0;
  bottom: 0;
  border-left: 2px dashed var(--accent);
}
.tab-cue::before {
  content: '▶';
  position: absolute;
  top: 2px;
  left: 2px;
  color: var(--accent);
  font-size: 10px;
}

.chart-bar { cursor: pointer; }

/* ---------- Gammes ---------- */

#scaleList { display: flex; flex-direction: column; gap: 8px; }

.scale-row {
  padding: 10px 12px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 10px;
  cursor: pointer;
}
.scale-row.playing { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent); }
.scale-title { font-weight: 600; margin-bottom: 6px; }
.scale-notes { display: flex; flex-wrap: wrap; gap: 4px; }
.scale-notes span {
  padding: 2px 6px;
  border-radius: 6px;
  background: var(--bg);
  color: var(--muted);
  font-size: 0.85rem;
}

/* Numéro de doigt (gammes) : 1 index … 4 auriculaire, 0 corde à vide. */
.tab-note sup {
  margin-left: 1px;
  font-size: 9px;
  font-weight: 500;
  color: var(--accent);
  vertical-align: 5px;
}
.tab-note.playing sup { color: var(--on-accent); }

/* ---------- Mode aléatoire (Boucle) ---------- */

#invent { font-weight: 600; }
#loopInfo { color: var(--accent); margin: 0 0 10px; font-weight: 600; }

/* ---------- Table de mixage (roue crantée) ---------- */

.header-right { display: flex; align-items: center; gap: 6px; flex-shrink: 0; }
/* Boutons 🎯, accordeur et ⚙️ : compacts, juste autour du pictogramme. */
button.gear { font-size: 1.05rem; line-height: 1; padding: 4px 5px; border-radius: 7px; }
#position { margin-right: 4px; }
#gameBtn[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); }
/* Pictogramme de l'accordeur : un diapason, à la taille de la roue crantée. */
button.gear .fork { width: 1.05rem; height: 1.05rem; display: block; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }

/* ---------- Accordeur ---------- */
.tuner { width: min(420px, calc(100vw - 32px)); text-align: center; }
.tuner-modes { display: flex; gap: 4px; }
.tuner-modes button, .tuner-strings button { font-size: 0.85rem; padding: 4px 10px; color: var(--muted); }
.tuner-modes button.on, .tuner-strings button.on { background: var(--accent); color: var(--on-accent); border-color: var(--accent); }
.tuner-dial { width: 100%; max-width: 340px; display: block; margin: 4px auto 0; overflow: visible; }
.dial-track { fill: none; stroke: var(--line); stroke-width: 10; stroke-linecap: round; }
.dial-zone { fill: none; stroke: #3fb950; stroke-width: 10; }
.dial-tick { stroke: var(--muted); stroke-width: 1.5; }
.dial-tick.major { stroke-width: 2.5; }
.dial-label { fill: var(--muted); font: 11px -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; text-anchor: middle; }
.dial-needle { transform-origin: 150px 150px; transition: transform 0.12s ease-out; }
.dial-needle line { stroke: var(--text); stroke-width: 3; stroke-linecap: round; }
.dial-needle circle { fill: var(--text); }
.tuner.in-tune .dial-needle line { stroke: #3fb950; }
.tuner.in-tune .dial-needle circle { fill: #3fb950; }
.tuner.idle .dial-needle { opacity: 0.35; }
.tuner-note { font-size: 2.6rem; font-weight: 700; line-height: 1.1; margin-top: 4px; }
.tuner.idle .tuner-note, .tuner.idle .tuner-detail { color: var(--muted); }
.tuner-detail { color: var(--muted); font-variant-numeric: tabular-nums; min-height: 1.3em; }
.tuner-status { font-weight: 600; margin: 6px 0 12px; min-height: 1.3em; }
.tuner.in-tune .tuner-status { color: #3fb950; }
.tuner-strings { display: flex; justify-content: center; gap: 8px; margin-bottom: 12px; }
.tuner-strings button { min-width: 3.6em; padding: 8px 10px; font-size: 1rem; border-radius: 999px; }
.tuner-ref { display: flex; justify-content: center; align-items: center; gap: 10px; color: var(--muted); font-size: 0.85rem; }

/* Fenêtre des réglages, ancrée sous l'en-tête (top réglé à l'ouverture), au-dessus de la page. */
.mixer {
  position: fixed;
  right: max(16px, calc((100vw - 1100px) / 2 + 16px));
  z-index: 40;
  width: min(560px, calc(100vw - 32px));
  max-height: calc(100dvh - 240px);
  overflow-y: auto;
  padding: 14px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.45);
}
.mixer-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
#mixerChannels {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 8px 24px;
}
.mix-row { display: grid; grid-template-columns: 9em 1fr 3.5em; align-items: center; gap: 10px; }
.mix-row span { color: var(--muted); }
.mix-row input { width: 100%; accent-color: var(--accent); }
.mix-row output { text-align: right; font-variant-numeric: tabular-nums; }

/* Instruments MIDI : une ligne par piste (sortie + canal), puis le décalage. */
.midi-head { margin-top: 18px; }
.midi-note { color: var(--muted); font-size: 0.85rem; margin: 0 0 10px; }
.midi-note a { color: var(--accent); }

/* Compte (réglages 👤) : adresse e-mail et boutons de connexion. */
/* 👤 : compte connecté, signalé par une petite pastille verte dans le coin (le bouton garde son aspect). */
#accountBtn { position: relative; }
#accountBtn.signed-in::after {
  content: ''; position: absolute; right: -3px; top: -3px; width: 9px; height: 9px; border-radius: 50%;
  background: #3fbf6a; border: 2px solid var(--bg);
}
#accountBtn.pro::after {
  content: '★'; right: -6px; top: -7px; width: auto; height: auto; border: 0; border-radius: 0; background: none;
  color: #f5b301; font-size: 13px; line-height: 1; text-shadow: 0 0 2px var(--bg), 0 0 2px var(--bg);
}
/* 👤 ouvre le panneau sur le compte seul, sans les onglets des réglages. */
.mixer.account-only .settings-tabs { display: none; }
.account-row { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 10px; }
.account-row input { flex: 1 1 200px; min-width: 0; font: inherit; color: var(--text); background: var(--bg); border: 1px solid var(--line); border-radius: 8px; padding: 6px 10px; }
.account-status { font-size: 0.85rem; margin: 0 0 10px; }
.account-status.error { color: #e0703a; }
.midi-row { display: grid; grid-template-columns: 9em 1fr 7.5em; align-items: center; gap: 10px; margin-bottom: 8px; }
.midi-row span { color: var(--muted); }
.midi-row select, .midi-row input { width: 100%; min-width: 0; }
/* Menu sans indication à droite : il prend aussi la 3e colonne (sinon le texte est coupé). */
.midi-row > span:empty:last-child { display: none; }
.midi-row:has(> span:empty:last-child) > select { grid-column: 2 / -1; }
.midi-row input {
  font: inherit;
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 6px 10px;
}

/* ---------- Portée en clé de fa (même fond que la tablature, couleurs du thème) ---------- */

.staff { position: absolute; top: 0; left: 0; }
.staff-bg { fill: var(--card); }
.staff-line { stroke: var(--text); stroke-width: 1; opacity: 0.45; }
.staff-bar { stroke: var(--text); stroke-width: 1.2; opacity: 0.7; }
.staff-bar.strong { opacity: 1; }
.staff-bar.double { stroke: var(--accent); stroke-width: 2; opacity: 1; }
.staff-ink { fill: var(--text); }
.staff-head { fill: var(--text); stroke: var(--text); stroke-width: 1.2; }
.staff-head.hollow { fill: var(--card); stroke-width: 1.6; }
.staff-stem { fill: none; stroke: var(--text); stroke-width: 1.3; }
.staff-tie { fill: none; stroke: var(--text); stroke-width: 1.2; }
.staff-rest { fill: none; stroke: var(--text); stroke-width: 2.2; stroke-linejoin: round; stroke-linecap: round; }
.staff-note.playing .staff-tie { stroke: var(--accent); }
.staff-tuplet { font: italic 600 11px/1 Georgia, 'Times New Roman', serif; fill: var(--text); text-anchor: middle; }
.staff-time { font: 700 19px/1 Georgia, 'Times New Roman', serif; fill: var(--text); text-anchor: middle; }
.staff-acc { font: 16px/1 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; fill: var(--text); }
.staff-note.playing .staff-head { fill: var(--accent); stroke: var(--accent); }
.staff-note.playing .staff-head.hollow { fill: var(--card); stroke: var(--accent); stroke-width: 2.4; }
.staff-note.playing .staff-stem { stroke: var(--accent); }
.staff-note.playing .staff-acc { fill: var(--accent); }

.mixer-option { margin-bottom: 14px; }
body.with-staff .bass-duo { margin-bottom: 310px; }

/* Double trait : fin d'un passage de la boucle et début du suivant. */
.tab-bar.double { border-left: 6px double var(--accent); }
.tab-bar.repeat { border-left-color: transparent; padding-left: 11px; }
/* Signes de reprise de la boucle : trait fin, trait épais, trait fin (ou épais + fin au début), points. */
.tab-repeat {
  position: absolute; bottom: 26px; width: 12px;
  background: linear-gradient(to right, var(--muted) 0 1.5px, transparent 1.5px 4px, var(--muted) 4px 8px, transparent 8px 10.5px, var(--muted) 10.5px 12px);
}
.tab-repeat.start { width: 8.5px; background: linear-gradient(to right, var(--muted) 0 4px, transparent 4px 7px, var(--muted) 7px 8.5px); }
.tab-repeat i { position: absolute; width: 4px; height: 4px; border-radius: 50%; background: var(--muted); }
.tab-bar.final {   /* barre de fin : trait fin, espace, trait épais (calée sur celle de la portée) */
  width: 8px; padding: 0; border-left: 0;
  background: linear-gradient(to right, var(--muted) 0 1.5px, transparent 1.5px 4px, var(--muted) 4px 8px);
}   /* barre de fin */

/* Bouton pour afficher / masquer le détail des mesures. */
.detail-toggle {
  display: block;
  margin-bottom: 12px;
  background: transparent;
  border: 1px dashed var(--line);
  color: var(--muted);
}
.detail-toggle:hover { color: var(--text); border-color: var(--muted); }

/* ---------- Sélection de mesures à travailler en boucle ---------- */

.tab-tools {
  position: absolute;
  top: 4px;
  right: 16px;
  z-index: 5;
  display: flex;
  gap: 4px;
  font: 600 12px/1 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}
.now-playing { display: none; }
@media (orientation: landscape) and (max-height: 500px) {
  .now-playing {
    position: absolute; top: 4px; left: 16px; right: 170px; z-index: 5;
    display: flex; align-items: center; gap: 8px;
    font: 600 12px/22px -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    color: var(--accent); white-space: nowrap;
  }
  .now-playing span { overflow: hidden; text-overflow: ellipsis; }
  .now-playing b { flex-shrink: 0; padding: 0 8px; border-radius: 6px; background: var(--accent); color: var(--on-accent); font-size: 13px; }
  .wait-status:not([hidden]) ~ .now-playing { display: none; }   /* la note attendue prend la place */
}
.tab-tools button { padding: 4px 8px; font-size: 12px; border-radius: 6px; background: var(--bg); color: var(--muted); }
/* Mode « Attendre ma note » : note attendue et note entendue, au-dessus de la tab. */
.wait-status {
  position: absolute;
  top: 4px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 5;
  padding: 3px 10px;
  border-radius: 6px;
  background: var(--bg);
  border: 1px solid var(--line);
  font: 600 13px/1.2 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  white-space: nowrap;
}
.wait-status .wrong { color: #e5534b; }
.wait-status .off { color: #d29922; }
.wait-status.ok { border-color: #3fb950; box-shadow: 0 0 0 2px #3fb950; }
.input-meter { height: 8px; border-radius: 4px; background: var(--bg); border: 1px solid var(--line); overflow: hidden; }
.input-meter div { height: 100%; width: 0; background: var(--accent); transition: width 0.05s linear; }
.tab-tools button.on { background: var(--accent); color: var(--on-accent); border-color: var(--accent); }

.tab-range {
  position: absolute;
  top: 0;
  bottom: 0;
  background: color-mix(in srgb, var(--accent) 14%, transparent);
  border-right: 2px dashed var(--accent);
  pointer-events: none;
}

/* Message temporaire (son bloqué, erreur…), au-dessus de la tab. */
/* ---------- Mode 🎯 Jeu ---------- */
.game-live { font-weight: 700; color: var(--accent); font-variant-numeric: tabular-nums; white-space: nowrap; }
.game-measure { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-top: 6px; }
.game-measure .midi-note { margin: 0; }
.tab-note.g-hit, .tab-name.g-hit { color: #3fb950; }
.tab-note.g-near, .tab-name.g-near { color: #d29922; }
.tab-note.g-miss, .tab-name.g-miss { color: #e5534b; }
.staff-note.g-hit .staff-head, .staff-note.g-hit .staff-stem { fill: #3fb950; stroke: #3fb950; }
.staff-note.g-near .staff-head, .staff-note.g-near .staff-stem { fill: #d29922; stroke: #d29922; }
.staff-note.g-miss .staff-head, .staff-note.g-miss .staff-stem { fill: #e5534b; stroke: #e5534b; }
.staff-note.g-hit .staff-head.hollow, .staff-note.g-near .staff-head.hollow, .staff-note.g-miss .staff-head.hollow { fill: var(--card); }

.game-result {
  position: fixed; inset: 0; z-index: 50;
  display: flex; align-items: center; justify-content: center; padding: 16px;
  background: rgba(0, 0, 0, 0.55); overflow: hidden;
  animation: game-fade 0.3s ease-out;
}
.game-card {
  position: relative; z-index: 1;
  width: min(360px, 100%); max-height: calc(100dvh - 32px); overflow-y: auto;
  padding: 20px 20px 16px; border-radius: 16px; text-align: center;
  background: var(--card); color: var(--text); border: 1px solid var(--line);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.45);
  animation: game-pop 0.5s cubic-bezier(0.2, 1.4, 0.4, 1);
}
.game-emoji { font-size: 52px; line-height: 1; animation: game-bounce 1.2s ease-in-out 0.4s 2; }
.game-result.low .game-emoji { animation: game-wobble 0.9s ease-in-out 0.4s 2; }
.game-title { margin: 8px 0 0; color: var(--muted); font-weight: 600; }
.game-score { margin: 4px 0; font-size: 56px; font-weight: 800; color: var(--accent); font-variant-numeric: tabular-nums; line-height: 1.1; }
.game-score small { font-size: 22px; color: var(--muted); font-weight: 700; }
.game-result.done .game-score { animation: game-pulse 0.4s ease-out; }
.game-text { margin: 6px 0 12px; font-size: 17px; font-weight: 600; line-height: 1.35; }
.game-tip { margin: -4px 0 10px; font-size: 14px; line-height: 1.4; color: var(--muted); }
.game-details { list-style: none; margin: 0 0 14px; padding: 10px 12px; border-radius: 10px; background: var(--bg); text-align: left; font-size: 14px; line-height: 1.6; }
.game-actions { display: flex; gap: 8px; justify-content: center; }
.game-actions button { min-width: 110px; }
.game-confetti { position: absolute; top: -40px; pointer-events: none; animation: game-fall linear forwards; }
@keyframes game-fade { from { opacity: 0; } }
@keyframes game-pop { from { transform: scale(0.6); opacity: 0; } }
@keyframes game-bounce { 0%, 100% { transform: translateY(0) rotate(0); } 30% { transform: translateY(-14px) rotate(-8deg); } 60% { transform: translateY(0) rotate(6deg); } }
@keyframes game-wobble { 0%, 100% { transform: rotate(0); } 25% { transform: rotate(-12deg); } 75% { transform: rotate(12deg); } }
@keyframes game-pulse { 50% { transform: scale(1.12); } }
@keyframes game-fall { to { transform: translateY(calc(100dvh + 80px)) rotate(540deg); opacity: 0.2; } }
/* Téléphone en paysage : la note à gauche, le détail à droite, le tout sans défiler. */
@media (orientation: landscape) and (max-height: 500px) {
  .game-result { padding: 8px 16px; }
  .game-card {
    width: min(720px, 100%); max-height: calc(100dvh - 16px); padding: 12px 16px;
    display: grid; grid-template-columns: minmax(180px, 0.8fr) 1.2fr; gap: 16px; align-items: center;
  }
  .game-emoji { font-size: 38px; }
  .game-score { font-size: 46px; }
  .game-text { font-size: 15px; margin-bottom: 0; }
  .game-side { text-align: left; }
  .game-tip { margin: 0 0 6px; font-size: 13px; }
  .game-details { margin-bottom: 10px; padding: 8px 10px; font-size: 13px; line-height: 1.5; }
  .game-actions { justify-content: flex-end; }
}
@media (prefers-reduced-motion: reduce) {
  .game-result, .game-card, .game-emoji, .game-score, .game-confetti { animation: none !important; }
  .game-confetti { display: none; }
}

.message {
  position: fixed;
  left: 50%;
  bottom: 190px;
  transform: translateX(-50%);
  z-index: 30;
  max-width: calc(100% - 32px);
  padding: 10px 14px;
  border-radius: 10px;
  background: var(--accent);
  color: var(--on-accent);
  font-weight: 600;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.35);
}

/* ---------- Saisie au clavier MIDI (mode Morceau) ---------- */

.recorder { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; margin-bottom: 14px; }
.recorder .mixer-head { gap: 10px; flex-wrap: wrap; }
.recorder .mixer-head strong { margin-right: auto; }
.rec-ports { color: var(--muted); font-size: 0.85rem; margin: 0 0 10px; }
.rec-ports button { margin-left: 6px; }
.rec-ports button.on { background: var(--accent); color: var(--on-accent); border-color: var(--accent); }
.rec-keyboard { position: relative; isolation: isolate; display: flex; height: 120px; margin-bottom: 10px; touch-action: none; user-select: none; -webkit-user-select: none; }
.rec-key { position: relative; flex: 1; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; gap: 2px; padding-bottom: 6px; background: #f4f4f0; border: 1px solid #888; border-radius: 0 0 5px 5px; color: #555; font-size: 0.7rem; cursor: pointer; }
.rec-key + .rec-key { margin-left: -1px; }
.rec-key.black { position: absolute; top: 0; z-index: 1; width: 4.2%; height: 62%; margin-left: -2.1%; background: #222; border-color: #000; color: #bbb; }
.rec-key.on { background: var(--accent); color: var(--on-accent); }
.rec-key kbd { font: inherit; opacity: 0.7; }
.rec-key-name { font-weight: 600; }
.rec-fields, .rec-step, .rec-live, .rec-actions { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-bottom: 10px; }
.rec-fields input { flex: 1 1 12em; min-height: 36px; padding: 0 10px; font: inherit; color: var(--text); background: var(--bg); border: 1px solid var(--line); border-radius: 8px; }
.rec-step button { min-width: 42px; font-size: 1.05rem; }
.rec-step button.on, .rec-btn.on, #recordBtn.on { background: var(--accent); color: var(--on-accent); border-color: var(--accent); }
.rec-btn.on { background: #e5534b; border-color: #e5534b; color: #fff; }
.rec-count { font-variant-numeric: tabular-nums; color: var(--muted); min-width: 7em; }
.rec-line { display: flex; flex-wrap: wrap; gap: 4px; align-items: center; min-height: 44px; padding: 6px; border: 1px dashed var(--line); border-radius: 8px; }
.rec-note { display: inline-flex; align-items: baseline; gap: 3px; padding: 3px 7px; border-radius: 6px; background: var(--bg); border: 1px solid var(--line); font-size: 0.9rem; }
.rec-note small { color: var(--muted); }
.rec-note.rest { color: var(--muted); }
.rec-note .rec-del { min-width: 0; min-height: 0; margin-left: 2px; padding: 0 2px; font-size: 0.75rem; line-height: 1; color: var(--muted); background: none; border: none; cursor: pointer; }
.rec-note .rec-del:hover { color: #e5534b; }
.rec-bar { width: 2px; align-self: stretch; background: var(--muted); margin: 0 3px; border-radius: 1px; }
.rec-empty { color: var(--muted); font-size: 0.85rem; }
.rec-summary { color: var(--muted); font-size: 0.85rem; margin: 6px 0 10px; min-height: 1em; }
.rec-actions { justify-content: flex-end; margin-bottom: 0; }
.rec-actions .primary { background: var(--accent); color: var(--on-accent); border-color: var(--accent); }
.rec-actions button.on { background: var(--accent); color: var(--on-accent); border-color: var(--accent); }
.rec-actions .primary:disabled { opacity: 0.5; cursor: default; }
.rec-latency { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 10px; font-size: 0.85rem; color: var(--muted); }
.rec-latency input[type="range"] { flex: 1 1 8em; accent-color: var(--accent); }
.rec-offset { min-width: 4.5em; font-variant-numeric: tabular-nums; }

/* ---------- Déliateur : popup explicative ---------- */
.finger-pick { display: flex; gap: 6px; }
.finger-pick select { flex: 1; min-width: 0; }
.finger-tip {
  position: fixed; inset: 0; z-index: 50;
  display: flex; align-items: center; justify-content: center; padding: 16px;
  background: rgba(0, 0, 0, 0.55);
  animation: game-fade 0.25s ease-out;
}
.finger-card {
  width: min(420px, 100%); max-height: calc(100dvh - 32px); overflow-y: auto;
  padding: 18px 20px 16px; border-radius: 16px;
  background: var(--card); color: var(--text); border: 1px solid var(--line);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.45);
  animation: game-pop 0.4s cubic-bezier(0.2, 1.4, 0.4, 1);
}
.finger-card:focus { outline: none; }
.finger-card h2 { margin: 0 0 10px; font-size: 1.15rem; }
.finger-card h2 span { color: var(--accent); }
.finger-shape { display: block; width: 100%; max-width: 320px; margin: 0 auto; }
.fs-fret { stroke: var(--strong-line); stroke-width: 2; }
.fs-string { stroke: var(--muted); }
.fs-name, .fs-num { fill: var(--muted); font-size: 11px; }
.fs-dot { stroke-width: 2; }
.fs-dot.held { fill: var(--accent); stroke: var(--accent); }
.fs-dot.play { fill: var(--card); stroke: var(--accent); stroke-width: 3; }
.fs-dot.ready { fill: var(--card); stroke: var(--muted); stroke-dasharray: 3 2; }
.fs-finger { font-size: 13px; font-weight: 700; fill: var(--text); }
.fs-finger.held { fill: var(--on-accent); }
.fs-legend { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 6px; margin: 4px 0 10px; font-size: 12px; color: var(--muted); }
.fs-key { display: inline-block; width: 12px; height: 12px; border-radius: 50%; border: 2px solid var(--accent); box-sizing: border-box; margin-left: 6px; }
.fs-key:first-child { margin-left: 0; }
.fs-key.held { background: var(--accent); }
.fs-key.ready { border-color: var(--muted); border-style: dashed; }
.finger-hold { margin: 0 0 8px; padding: 10px 12px; border-left: 3px solid var(--accent); background: var(--bg); border-radius: 6px; font-weight: 600; line-height: 1.4; }
.finger-card ul { margin: 0 0 8px; padding-left: 20px; line-height: 1.45; }
.finger-card li { margin-bottom: 4px; }
.finger-num { margin: 0 0 12px; font-size: 13px; color: var(--muted); }
.finger-actions { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; }
.finger-actions .toggle { font-size: 13px; color: var(--muted); }
@media (orientation: landscape) and (max-height: 500px) {
  .finger-tip { padding: 8px 16px; }
  .finger-card { width: min(720px, 100%); max-height: calc(100dvh - 16px); padding: 12px 16px; columns: 2; column-gap: 20px; }
  .finger-card h2, .finger-shape, .fs-legend, .finger-hold { break-inside: avoid; }
}
@media (prefers-reduced-motion: reduce) {
  .finger-tip, .finger-card { animation: none !important; }
}
.finger-actions .primary { background: var(--accent); color: var(--on-accent); border-color: var(--accent); font-weight: 700; }
.finger-slow { margin: 0 0 8px; font-size: 14px; line-height: 1.4; color: var(--accent); }

/* ---------- Réglages : onglets (contrôle segmenté, collé en haut du panneau) ---------- */
#mixer { padding-top: 0; }
.settings-tabs {
  position: sticky; top: 0; z-index: 1;
  display: grid; grid-template-columns: repeat(6, 1fr); gap: 3px;
  margin: 0 -14px 14px; padding: 12px 10px 10px;
  background: var(--card);
  border-bottom: 1px solid var(--line);
}
.settings-tabs button {
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  min-width: 0; padding: 6px 2px 5px;
  font-size: 0.74rem; font-weight: 600; line-height: 1.1; letter-spacing: -0.01em; color: var(--muted);
  background: transparent; border: 1px solid transparent; border-radius: 10px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  transition: background 0.15s, color 0.15s;
}
.settings-tabs button span { font-size: 1.15rem; line-height: 1.2; filter: grayscale(0.6); opacity: 0.75; transition: filter 0.15s, opacity 0.15s; }
.settings-tabs button:hover { color: var(--text); background: var(--bg); }
.settings-tabs button[aria-selected="true"] {
  color: var(--accent); background: var(--bg); border-color: var(--accent);
}
.settings-tabs button[aria-selected="true"] span { filter: none; opacity: 1; }
.settings-page { animation: settings-in 0.18s ease-out; }
@keyframes settings-in { from { opacity: 0; transform: translateY(4px); } }
.settings-sub {
  margin: 4px 0 10px; font-size: 0.75rem; font-weight: 700; letter-spacing: 0.06em;
  text-transform: uppercase; color: var(--muted);
}
.settings-sub.mixer-head { margin-top: 18px; }
@media (prefers-reduced-motion: reduce) { .settings-page { animation: none; } }

/* ---------- Objectifs et trophées ---------- */
.goal-progress { margin: 0 0 10px; }
.goal-progress-head { display: flex; justify-content: space-between; gap: 8px; font-size: 0.85rem; color: var(--muted); margin-bottom: 4px; font-variant-numeric: tabular-nums; }
.goal-bar { height: 8px; border-radius: 4px; background: var(--bg); border: 1px solid var(--line); overflow: hidden; }
.goal-bar > div { height: 100%; background: var(--accent); border-radius: 4px; transition: width 0.6s ease-out; }
.goal-bar > div.done { background: #3fb950; }
.trophy-grid { list-style: none; margin: 4px 0 12px; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 6px; }
.trophy-grid li { display: flex; align-items: center; gap: 8px; padding: 6px 8px; border-radius: 8px; background: var(--bg); font-size: 0.8rem; line-height: 1.25; color: var(--muted); opacity: 0.6; }
.trophy-grid li.won { opacity: 1; color: var(--text); border: 1px solid var(--accent); }
.trophy-icon { font-size: 1.3rem; }
.goal-title { margin: 8px 0 0; font-size: 26px; font-weight: 800; color: var(--accent); line-height: 1.15; }
.goal-result .game-side { text-align: left; }
.goal-result .game-actions { margin-top: 10px; }
.confetti-canvas { position: fixed; inset: 0; width: 100vw; height: 100dvh; z-index: 60; pointer-events: none; }

/* ---------- Mode : onglets à pictogramme, comme ceux des réglages ---------- */
.mode-tabs { display: grid; grid-template-columns: repeat(4, minmax(0, 120px)); gap: 4px; }
.mode-tabs button {
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  min-width: 0; padding: 7px 2px 6px;
  font-size: 0.8rem; font-weight: 600; line-height: 1.1; color: var(--muted);
  background: transparent; border: 1px solid transparent; border-radius: 10px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  transition: background 0.15s, color 0.15s;
}
.mode-tabs button span { font-size: 1.25rem; line-height: 1.2; filter: grayscale(0.6); opacity: 0.75; transition: filter 0.15s, opacity 0.15s; }
.mode-tabs button:hover { color: var(--text); background: var(--bg); }
.mode-tabs button[aria-selected="true"] { color: var(--accent); background: var(--bg); border-color: var(--accent); }
.mode-tabs button[aria-selected="true"] span { filter: none; opacity: 1; }
@media (max-width: 560px) { .mode-tabs { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
/* 🎼 est dessiné à l'encre noire : sur les thèmes sombres, on l'éclaircit pour qu'il se voie. */
:root:not([data-theme="clair"]) .mode-tabs button span.ink { filter: invert(0.9) grayscale(0.6); }
:root:not([data-theme="clair"]) .mode-tabs button[aria-selected="true"] span.ink { filter: invert(0.9); }
/* Très petit téléphone (320 px) : basse et boutons un peu resserrés pour que tout tienne. */
@media (max-width: 350px) {
  header { gap: 4px; padding-inline: 12px; }
  .header-left { gap: 5px; }
  .header-left .transport { gap: 5px; }
  .logo { height: 15px; }
  .header-right { gap: 3px; }
}
:root[data-theme="clair"] #tabPanel { box-shadow: 0 -6px 18px rgba(30, 33, 48, 0.14); }
/* Bande détachée : la page n'a plus à lui réserver de place ; dans la fenêtre flottante, elle la remplit. */
body.tab-detached .bass-duo { margin-bottom: 16px; }
body.pip { margin: 0; padding: 0; max-width: none; height: 100vh; overflow: hidden; background: var(--card); }
body.pip #tabPanel { position: static; width: 100vw; height: 100vh; border-top: none; box-shadow: none; }
body.pip #bigTab { background: var(--accent); color: var(--on-accent); border-color: var(--accent); }

/* Fonctions ⭐ Pro sur un compte gratuit : atténuées (et une ⭐ sur les onglets), pour qu'on voie avant de cliquer
   qu'elles sont inactives (un clic dit quand même comment passer Pro). */
.sub-option { margin-left: 26px; margin-top: -6px; }
body.free [data-pro] { opacity: 0.45; }
body.free [role="tab"][data-pro] { position: relative; }
body.free [role="tab"][data-pro]::after { content: '⭐'; position: absolute; top: 4px; right: 6px; font-size: 0.7rem; }
body.free .settings-page[data-page="midi"] > * { opacity: 0.45; }
