/* =====================================================================
   Clavier Numérique Piano — Design system
   ===================================================================== */

:root {
    /* Couleurs */
    --ink: #0d0e13;
    --ink-2: #14161f;
    --surface: #1b1e2a;
    --surface-2: #232736;
    --line: #2f3446;
    --ivory: #f6f3ec;
    --muted: #9aa0b5;
    --muted-2: #6f7691;
    --accent: #f2b544;
    --accent-dark: #d69a25;
    --accent-soft: rgba(242, 181, 68, 0.14);
    --teal: #4ec9b0;
    --rose: #e8687f;
    --white-key: #fbfaf7;
    --black-key: #15171f;

    /* Typo */
    --font: "Inter", "Segoe UI", system-ui, -apple-system, "Helvetica Neue", sans-serif;
    --font-display: "Fraunces", "Georgia", serif;

    /* Divers */
    --radius: 16px;
    --radius-sm: 10px;
    --radius-lg: 26px;
    --shadow: 0 18px 40px rgba(0, 0, 0, 0.45);
    --shadow-sm: 0 6px 18px rgba(0, 0, 0, 0.3);
    --nav-h: 66px;
    --header-h: 62px;
    --max: 1180px;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

[hidden] {
    display: none !important;
}

html {
    -webkit-text-size-adjust: 100%;
    scroll-behavior: smooth;
}

body {
    font-family: var(--font);
    background: var(--ink);
    color: var(--ivory);
    line-height: 1.6;
    font-size: 16px;
    min-height: 100vh;
    overflow-x: hidden;
    padding-bottom: calc(var(--nav-h) + env(safe-area-inset-bottom, 0px));
}

body.no-nav {
    padding-bottom: 0;
}

img {
    max-width: 100%;
    display: block;
}

a {
    color: inherit;
    text-decoration: none;
}

button,
input,
textarea,
select {
    font-family: inherit;
    font-size: inherit;
    color: inherit;
}

h1,
h2,
h3,
h4 {
    font-family: var(--font-display);
    font-weight: 600;
    line-height: 1.2;
    letter-spacing: -0.01em;
}

/* ---------------------------------------------------------------------
   Layout
   --------------------------------------------------------------------- */

.wrap {
    width: 100%;
    max-width: var(--max);
    margin: 0 auto;
    padding: 0 18px;
}

.section {
    padding: 54px 0;
}

.section-head {
    margin-bottom: 26px;
}

.section-head .eyebrow {
    display: inline-block;
    font-size: 0.72rem;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: var(--accent);
    font-weight: 600;
    margin-bottom: 8px;
}

.section-head h2 {
    font-size: 1.75rem;
}

.section-head p {
    color: var(--muted);
    margin-top: 8px;
    max-width: 620px;
}

.mt-0 { margin-top: 0; }
.mt-1 { margin-top: 10px; }
.mt-2 { margin-top: 20px; }
.mt-3 { margin-top: 32px; }
.mb-2 { margin-bottom: 14px; }
.center { text-align: center; }

/* ---------------------------------------------------------------------
   Header
   --------------------------------------------------------------------- */

.app-header {
    position: sticky;
    top: 0;
    z-index: 60;
    background: rgba(13, 14, 19, 0.92);
    backdrop-filter: blur(14px);
    border-bottom: 1px solid var(--line);
    padding-top: env(safe-area-inset-top, 0px);
}

.app-header .bar {
    height: var(--header-h);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.brand {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}

.brand-mark {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    background: linear-gradient(145deg, var(--accent), var(--accent-dark));
    display: grid;
    place-items: center;
    flex-shrink: 0;
}

.brand-name {
    font-family: var(--font-display);
    font-size: 1.02rem;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.brand-sub {
    font-size: 0.68rem;
    color: var(--muted-2);
    letter-spacing: 0.1em;
    text-transform: uppercase;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

/* ---------------------------------------------------------------------
   Boutons
   --------------------------------------------------------------------- */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 20px;
    border-radius: 999px;
    border: 1px solid transparent;
    background: var(--accent);
    color: #201703;
    font-weight: 600;
    font-size: 0.94rem;
    cursor: pointer;
    transition: transform 0.15s ease, background 0.2s ease, border-color 0.2s ease, opacity 0.2s ease;
    white-space: nowrap;
    -webkit-tap-highlight-color: transparent;
}

.btn:hover { background: var(--accent-dark); }
.btn:active { transform: scale(0.97); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-ghost {
    background: transparent;
    border-color: var(--line);
    color: var(--ivory);
}

.btn-ghost:hover {
    background: var(--surface-2);
    border-color: var(--muted-2);
}

.btn-soft {
    background: var(--surface-2);
    color: var(--ivory);
}

.btn-soft:hover { background: var(--line); }

.btn-danger {
    background: transparent;
    border-color: rgba(232, 104, 127, 0.5);
    color: var(--rose);
}

.btn-danger:hover { background: rgba(232, 104, 127, 0.12); }

.btn-sm { padding: 8px 14px; font-size: 0.84rem; }
.btn-lg { padding: 15px 28px; font-size: 1rem; }
.btn-block { width: 100%; }

.icon-btn {
    width: 40px;
    height: 40px;
    border-radius: 12px;
    border: 1px solid var(--line);
    background: var(--surface);
    display: grid;
    place-items: center;
    cursor: pointer;
    transition: background 0.2s;
}

.icon-btn:hover { background: var(--surface-2); }

/* ---------------------------------------------------------------------
   Bottom navigation (mobile app bar)
   --------------------------------------------------------------------- */

.bottom-nav {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 70;
    background: rgba(20, 22, 31, 0.97);
    backdrop-filter: blur(16px);
    border-top: 1px solid var(--line);
    display: flex;
    padding: 6px 4px calc(6px + env(safe-area-inset-bottom, 0px));
}

.bottom-nav a {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;
    padding: 7px 2px;
    border-radius: 12px;
    color: var(--muted-2);
    font-size: 0.68rem;
    font-weight: 500;
    transition: color 0.2s, background 0.2s;
    -webkit-tap-highlight-color: transparent;
}

.bottom-nav a svg { width: 22px; height: 22px; }
.bottom-nav a.active { color: var(--accent); background: var(--accent-soft); }
.bottom-nav a:active { background: var(--surface-2); }

/* Décalage pour les pages sans header sticky */
.page-pad { padding-top: env(safe-area-inset-top, 0px); }

/* ---------------------------------------------------------------------
   Cartes
   --------------------------------------------------------------------- */

.card {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 20px;
}

.card-tight { padding: 14px; }

.grid {
    display: grid;
    gap: 16px;
    grid-template-columns: 1fr;
}

.grid-2,
.grid-3,
.grid-4 {
    display: grid;
    gap: 16px;
    grid-template-columns: 1fr;
}

/* ---------------------------------------------------------------------
   Hero
   --------------------------------------------------------------------- */

.hero {
    position: relative;
    padding: 40px 0 34px;
    overflow: hidden;
}

.hero-bg {
    position: absolute;
    inset: 0;
    z-index: 0;
    opacity: 0.28;
}

.hero-bg img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.hero-bg::after {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, rgba(13, 14, 19, 0.55), var(--ink) 78%);
}

.hero .wrap { position: relative; z-index: 1; }

.hero h1 {
    font-size: 2.1rem;
    margin-bottom: 14px;
}

.hero h1 em {
    font-style: normal;
    color: var(--accent);
}

.hero p.lead {
    color: var(--muted);
    font-size: 1.02rem;
    max-width: 560px;
}

.hero-cta {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 22px;
}

.hero-visual {
    margin-top: 28px;
    border-radius: var(--radius-lg);
    overflow: hidden;
    border: 1px solid var(--line);
    background: var(--surface);
    box-shadow: var(--shadow);
}

.hero-visual img {
    width: 100%;
    height: 210px;
    object-fit: cover;
}

/* ---------------------------------------------------------------------
   Statistiques
   --------------------------------------------------------------------- */

.stats {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
}

.stat {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    padding: 14px;
}

.stat b {
    display: block;
    font-family: var(--font-display);
    font-size: 1.6rem;
    color: var(--accent);
    line-height: 1.1;
}

.stat span {
    font-size: 0.76rem;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

/* ---------------------------------------------------------------------
   Étapes / features
   --------------------------------------------------------------------- */

.step {
    display: flex;
    gap: 14px;
    align-items: flex-start;
}

.step-num {
    width: 38px;
    height: 38px;
    border-radius: 12px;
    background: var(--accent-soft);
    color: var(--accent);
    display: grid;
    place-items: center;
    font-weight: 700;
    flex-shrink: 0;
}

.step h3 { font-size: 1.05rem; margin-bottom: 4px; }
.step p { color: var(--muted); font-size: 0.92rem; }

/* ---------------------------------------------------------------------
   Morceaux
   --------------------------------------------------------------------- */

.songs {
    display: grid;
    gap: 16px;
    grid-template-columns: 1fr;
}

.song-card {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    transition: border-color 0.2s, transform 0.2s;
}

.song-card:hover { border-color: var(--muted-2); transform: translateY(-2px); }

.song-thumb {
    position: relative;
    aspect-ratio: 16 / 10;
    overflow: hidden;
    background: var(--surface-2);
}

.song-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.5s ease;
}

.song-card:hover .song-thumb img { transform: scale(1.05); }

.song-body { padding: 16px; display: flex; flex-direction: column; gap: 8px; flex: 1; }

.song-body h3 { font-size: 1.08rem; }

.song-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.song-body p {
    color: var(--muted);
    font-size: 0.88rem;
    flex: 1;
}

.song-foot {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-top: 4px;
}

/* Badges */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 4px 10px;
    border-radius: 999px;
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 0.03em;
    background: var(--surface-2);
    color: var(--muted);
    border: 1px solid var(--line);
}

.badge-accent { background: var(--accent-soft); color: var(--accent); border-color: rgba(242, 181, 68, 0.3); }
.badge-teal { background: rgba(78, 201, 176, 0.14); color: var(--teal); border-color: rgba(78, 201, 176, 0.3); }
.badge-rose { background: rgba(232, 104, 127, 0.14); color: var(--rose); border-color: rgba(232, 104, 127, 0.3); }

/* ---------------------------------------------------------------------
   Clavier piano
   --------------------------------------------------------------------- */

.piano-stage {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 18px;
}

.piano-scroll {
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
    padding-bottom: 8px;
}

.piano {
    position: relative;
    height: 158px;
    display: flex;
    gap: 0;
    min-width: max-content;
    padding-bottom: 4px;
    touch-action: manipulation;
}

.key:not(.black) { border-right: 1px solid #d5d1c6; }

.key {
    position: relative;
    width: 46px;
    height: 100%;
    border-radius: 0 0 8px 8px;
    background: linear-gradient(180deg, #ffffff, #e8e5dd);
    box-shadow: inset 0 -6px 10px rgba(0, 0, 0, 0.12);
    display: flex;
    align-items: flex-end;
    justify-content: center;
    padding-bottom: 8px;
    transition: background 0.12s, transform 0.08s;
    flex-shrink: 0;
}

.key.black {
    background: linear-gradient(180deg, #2c2f3a, #0b0c11);
    height: 62%;
    width: 30px;
    margin: 0 -15px;
    z-index: 2;
    box-shadow: inset 0 -5px 8px rgba(0, 0, 0, 0.6);
}

.key .lbl {
    font-size: 0.62rem;
    color: #7a7788;
    font-weight: 600;
    pointer-events: none;
}

.key.black .lbl { color: #8c8fa3; }

.key.active {
    background: linear-gradient(180deg, var(--accent), var(--accent-dark));
    transform: translateY(3px);
    box-shadow: 0 0 22px rgba(242, 181, 68, 0.55), inset 0 -4px 8px rgba(0, 0, 0, 0.25);
}

.key.black.active {
    background: linear-gradient(180deg, var(--accent-dark), #8d6213);
}

.key.next {
    outline: 2px solid var(--teal);
    outline-offset: -2px;
}

/* ---------------------------------------------------------------------
   Clavier complet (les deux mains visibles en même temps)
   --------------------------------------------------------------------- */

.piano-scroll.no-scroll {
    overflow: visible;
    padding-bottom: 0;
}

/* Les touches sont placées en pourcentage de la largeur : tout le clavier
   tient à l'écran, sans défilement ni perte de repère. */
.piano.piano-fit {
    display: block;
    position: relative;
    width: 100%;
    min-width: 0;
    height: 128px;
    padding-bottom: 0;
}

.piano.piano-fit .key {
    position: absolute;
    top: 0;
    height: 100%;
    margin: 0;
    padding-bottom: 6px;
}

.piano.piano-fit .key.black {
    height: 62%;
    padding-bottom: 4px;
    z-index: 2;
    border-radius: 0 0 5px 5px;
}

.piano.piano-fit .key .lbl {
    font-size: 0.55rem;
    letter-spacing: -0.02em;
}

/* Repère à chaque Do : on s'oriente d'un coup d'œil */
.piano.piano-fit .key.octave .lbl {
    font-size: 0.62rem;
    font-weight: 700;
    color: #55525f;
}

/* La césure entre les deux mains */
.piano.piano-fit .key.split::before {
    content: "";
    position: absolute;
    left: -1px;
    top: 0;
    bottom: 0;
    width: 2px;
    background: rgba(78, 201, 176, 0.65);
    z-index: 3;
}

/* Main gauche (accompagnement) : repère bleu discret */
.piano.piano-fit .key.left .lbl { color: #2f7d6f; }

/* Une touche jouée par la main gauche s'allume en bleu, la droite en or :
   on distingue donc immédiatement quelle main doit jouer. */
.key.left.active {
    background: linear-gradient(180deg, var(--teal), #2f8f7c);
    color: #05241f;
}

.piano.piano-fit .key.left.active .lbl,
.key.left.active .lbl { color: #05241f; }

.piano-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 16px;
    margin-top: 10px;
    font-size: 0.78rem;
    color: var(--muted);
}

.piano-legend span {
    display: inline-flex;
    align-items: center;
    gap: 7px;
}

.piano-legend i {
    width: 13px;
    height: 13px;
    border-radius: 4px;
    display: inline-block;
    flex-shrink: 0;
}

.piano-legend i.g { background: var(--teal); }
.piano-legend i.d { background: var(--accent); }
.piano-legend i.c { background: #55525f; }

/* Défilement des notes */
.notes-strip {
    position: relative;
    height: 74px;
    margin-bottom: 14px;
    border-radius: var(--radius-sm);
    background: var(--ink-2);
    border: 1px solid var(--line);
    overflow: hidden;
}

.notes-track {
    position: absolute;
    top: 0;
    bottom: 0;
    left: 0;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 0 50%;
    will-change: transform;
}

.note-pill {
    min-width: 54px;
    height: 46px;
    border-radius: 12px;
    background: var(--surface-2);
    border: 1px solid var(--line);
    display: grid;
    place-items: center;
    font-weight: 700;
    font-size: 1rem;
    color: var(--muted);
    transition: background 0.2s, color 0.2s, transform 0.2s;
    flex-shrink: 0;
}

.note-pill.played { background: rgba(78, 201, 176, 0.16); color: var(--teal); border-color: rgba(78, 201, 176, 0.35); }
.note-pill.current {
    background: var(--accent);
    color: #201703;
    border-color: var(--accent);
    transform: scale(1.12);
}

/* Une case de la bande = un accord (les deux mains ensemble) */
.note-pill.chord {
    min-width: 62px;
    padding: 0 10px;
    font-size: 0.95rem;
    letter-spacing: 0.02em;
    white-space: nowrap;
}

/* Accord avec main gauche : liseré bleu, on sait qu'il y a un accompagnement */
.note-pill.chord.has-left { border-color: rgba(78, 201, 176, 0.5); }

/* Les deux mains dans le même accord : liseré des deux couleurs */
.note-pill.chord.both-hands {
    border-color: var(--accent);
    box-shadow: inset 0 -3px 0 var(--teal);
}

/* Barre d'outils de la vue clavier */
.piano-view-bar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-top: 14px;
}

.hand-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.notes-cursor {
    position: absolute;
    left: 50%;
    top: 0;
    bottom: 0;
    width: 2px;
    background: var(--accent);
    opacity: 0.7;
    transform: translateX(-1px);
    z-index: 3;
}

/* ---------------------------------------------------------------------
   Zone de dépôt
   --------------------------------------------------------------------- */

.dropzone {
    display: block;
    border: 2px dashed var(--line);
    border-radius: var(--radius);
    background: var(--surface);
    padding: 34px 20px;
    text-align: center;
    cursor: pointer;
    transition: border-color 0.2s, background 0.2s, transform 0.2s;
    -webkit-tap-highlight-color: transparent;
}

.dropzone:hover,
.dropzone:focus-visible,
.dropzone.over {
    border-color: var(--accent);
    background: var(--accent-soft);
    outline: none;
}

.dropzone.over { transform: scale(1.01); }

.dropzone-ico svg { margin: 0 auto 12px; display: block; }
.dropzone-title { display: block; font-size: 1.06rem; font-weight: 600; margin-bottom: 6px; }
.dropzone-text { display: block; color: var(--muted); font-size: 0.88rem; }
.dropzone-hint { display: block; margin-top: 10px; color: var(--muted-2); font-size: 0.76rem; }

.dropzone-file {
    display: block;
    margin-top: 12px;
    padding: 7px 12px;
    border-radius: 8px;
    background: var(--accent-soft);
    color: var(--accent);
    font-size: 0.82rem;
    font-weight: 600;
    word-break: break-all;
}

/* L'input reste cliquable (le <label for> l'ouvre) mais invisible.
   Surtout PAS display:none : Safari et Chrome mobiles refusent alors
   d'ouvrir le sélecteur de fichier. */
#dropState { position: relative; }

.dropzone-input {
    position: absolute;
    top: 0;
    left: 0;
    width: 1px;
    height: 1px;
    opacity: 0;
    pointer-events: none;
    overflow: hidden;
}

.dropzone-error {
    margin-top: 12px;
    padding: 12px 14px;
    border-radius: 12px;
    border: 1px solid rgba(232, 104, 127, 0.4);
    background: rgba(232, 104, 127, 0.1);
    color: #ffb8c5;
    font-size: 0.86rem;
    line-height: 1.55;
}

/* ---------------------------------------------------------------------
   Formulaires
   --------------------------------------------------------------------- */

.field { margin-bottom: 16px; }

.field label {
    display: block;
    font-size: 0.82rem;
    font-weight: 600;
    margin-bottom: 6px;
    color: var(--muted);
    letter-spacing: 0.02em;
}

.field input,
.field textarea,
.field select {
    width: 100%;
    padding: 12px 14px;
    border-radius: 12px;
    border: 1px solid var(--line);
    background: var(--ink-2);
    color: var(--ivory);
    transition: border-color 0.2s, box-shadow 0.2s;
}

.field input:focus,
.field textarea:focus,
.field select:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-soft);
}

.field textarea { resize: vertical; min-height: 110px; }

.field-row {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0;
}

.hint {
    font-size: 0.78rem;
    color: var(--muted-2);
    margin-top: 6px;
}

.form-error {
    background: rgba(232, 104, 127, 0.12);
    border: 1px solid rgba(232, 104, 127, 0.4);
    color: #ffb8c5;
    padding: 10px 14px;
    border-radius: 10px;
    font-size: 0.86rem;
    margin-bottom: 16px;
}

.auth-shell {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 32px 18px calc(32px + env(safe-area-inset-bottom, 0px));
    background:
        radial-gradient(circle at 15% 0%, rgba(242, 181, 68, 0.14), transparent 55%),
        radial-gradient(circle at 90% 100%, rgba(78, 201, 176, 0.1), transparent 50%),
        var(--ink);
}

.auth-card {
    width: 100%;
    max-width: 430px;
    margin: 0 auto;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    padding: 26px 20px;
    box-shadow: var(--shadow);
}

.auth-logo {
    width: 56px;
    height: 56px;
    border-radius: 16px;
    background: linear-gradient(145deg, var(--accent), var(--accent-dark));
    display: grid;
    place-items: center;
    margin: 0 auto 16px;
}

.auth-card h1 { font-size: 1.4rem; text-align: center; }
.auth-card .sub { text-align: center; color: var(--muted); font-size: 0.9rem; margin: 6px 0 22px; }

/* ---------------------------------------------------------------------
   Tableaux (admin)
   --------------------------------------------------------------------- */

.table-wrap {
    overflow-x: auto;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--surface);
    -webkit-overflow-scrolling: touch;
}

table.data {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.88rem;
    min-width: 620px;
}

table.data th {
    text-align: left;
    padding: 12px 14px;
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--muted-2);
    background: var(--ink-2);
    border-bottom: 1px solid var(--line);
    white-space: nowrap;
}

table.data td {
    padding: 13px 14px;
    border-bottom: 1px solid var(--line);
    vertical-align: middle;
}

table.data tr:last-child td { border-bottom: none; }
table.data tr:hover td { background: rgba(255, 255, 255, 0.02); }

.row-actions { display: flex; gap: 6px; flex-wrap: wrap; }

/* ---------------------------------------------------------------------
   Admin : onglets
   --------------------------------------------------------------------- */

.tabs {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding-bottom: 6px;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
}

.tabs::-webkit-scrollbar { display: none; }

.tab {
    padding: 9px 16px;
    border-radius: 999px;
    border: 1px solid var(--line);
    background: var(--surface);
    color: var(--muted);
    font-size: 0.88rem;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.2s;
}

.tab.active {
    background: var(--accent);
    border-color: var(--accent);
    color: #201703;
}

/* Panneaux */
.panel-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 18px;
}

.panel-head h2 { font-size: 1.3rem; }

.toolbar {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin-bottom: 16px;
}

.toolbar input,
.toolbar select {
    padding: 10px 14px;
    border-radius: 999px;
    border: 1px solid var(--line);
    background: var(--ink-2);
    color: var(--ivory);
    flex: 1;
    min-width: 150px;
}

/* ---------------------------------------------------------------------
   Graphiques
   --------------------------------------------------------------------- */

.chart-box {
    position: relative;
    height: 260px;
    width: 100%;
}

/* ---------------------------------------------------------------------
   Modal
   --------------------------------------------------------------------- */

.modal {
    position: fixed;
    inset: 0;
    z-index: 200;
    background: rgba(6, 7, 10, 0.78);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: flex-end;
    justify-content: center;
    padding: 0;
}

.modal-card {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    width: 100%;
    max-width: 560px;
    max-height: 92vh;
    overflow-y: auto;
    padding: 22px 20px calc(22px + env(safe-area-inset-bottom, 0px));
    box-shadow: var(--shadow);
}

.modal-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 18px;
}

.modal-head h3 { font-size: 1.16rem; }

/* ---------------------------------------------------------------------
   Toasts
   --------------------------------------------------------------------- */

.toasts {
    position: fixed;
    left: 0;
    right: 0;
    bottom: calc(var(--nav-h) + env(safe-area-inset-bottom, 0px) + 12px);
    z-index: 300;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    pointer-events: none;
    padding: 0 16px;
}

.toast {
    background: var(--surface-2);
    border: 1px solid var(--line);
    color: var(--ivory);
    padding: 11px 18px;
    border-radius: 999px;
    font-size: 0.88rem;
    box-shadow: var(--shadow-sm);
    animation: toast-in 0.25s ease;
    max-width: 92%;
    text-align: center;
}

.toast.ok { border-color: rgba(78, 201, 176, 0.5); color: var(--teal); }
.toast.err { border-color: rgba(232, 104, 127, 0.5); color: #ffb8c5; }

@keyframes toast-in {
    from { opacity: 0; transform: translateY(14px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ---------------------------------------------------------------------
   Footer
   --------------------------------------------------------------------- */

.site-footer {
    border-top: 1px solid var(--line);
    background: var(--ink-2);
    padding: 34px 0 30px;
    margin-top: 20px;
}

.footer-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 24px;
}

.site-footer h4 {
    font-family: var(--font);
    font-size: 0.76rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--muted-2);
    margin-bottom: 10px;
}

.site-footer p,
.site-footer li {
    color: var(--muted);
    font-size: 0.88rem;
}

.site-footer ul { list-style: none; }
.site-footer li { margin-bottom: 7px; }
.site-footer a:hover { color: var(--accent); }

.footer-bottom {
    margin-top: 26px;
    padding-top: 18px;
    border-top: 1px solid var(--line);
    font-size: 0.78rem;
    color: var(--muted-2);
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: space-between;
}

/* ---------------------------------------------------------------------
   PWA install card
   --------------------------------------------------------------------- */

.install-card {
    display: flex;
    align-items: center;
    gap: 14px;
    flex-wrap: wrap;
    background: linear-gradient(135deg, rgba(242, 181, 68, 0.14), rgba(78, 201, 176, 0.08));
    border: 1px solid rgba(242, 181, 68, 0.3);
    border-radius: var(--radius);
    padding: 16px;
}

.install-card .txt { flex: 1 1 180px; min-width: 0; }
.install-card .btn { flex: 1 1 100%; }
.install-card strong { display: block; font-size: 0.95rem; }
.install-card span { font-size: 0.82rem; color: var(--muted); }

@media (min-width: 560px) {
    .install-card .btn { flex: 0 0 auto; }
}

/* ---------------------------------------------------------------------
   Divers
   --------------------------------------------------------------------- */

.empty {
    text-align: center;
    padding: 40px 20px;
    color: var(--muted);
}

.empty svg { margin: 0 auto 12px; display: block; opacity: 0.5; }

.loader {
    width: 22px;
    height: 22px;
    border: 2px solid var(--line);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
    margin: 0 auto;
}

@keyframes spin { to { transform: rotate(360deg); } }

.divider { height: 1px; background: var(--line); margin: 22px 0; }

.progress-bar {
    height: 8px;
    border-radius: 999px;
    background: var(--surface-2);
    overflow: hidden;
}

.progress-bar i {
    display: block;
    height: 100%;
    background: linear-gradient(90deg, var(--accent), var(--teal));
    border-radius: 999px;
    transition: width 0.4s ease;
}

.reveal {
    opacity: 0;
    transform: translateY(18px);
    transition: opacity 0.6s ease, transform 0.6s ease;
}

.reveal.in {
    opacity: 1;
    transform: none;
}

@media (prefers-reduced-motion: reduce) {
    .reveal { opacity: 1; transform: none; transition: none; }
    html { scroll-behavior: auto; }
}

.text-muted { color: var(--muted); }
.text-small { font-size: 0.84rem; }
.flex-between { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; }
.flex-wrap { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }

/* ---------------------------------------------------------------------
   Responsive ≥ 768px
   --------------------------------------------------------------------- */

@media (min-width: 768px) {
    body { font-size: 16.5px; padding-bottom: calc(var(--nav-h) + env(safe-area-inset-bottom, 0px) + 20px); }

    .wrap { padding: 0 28px; }
    .section { padding: 74px 0; }

    .hero { padding: 66px 0 54px; }
    .hero h1 { font-size: 3rem; }
    .hero p.lead { font-size: 1.12rem; }
    .hero-visual img { height: 330px; }

    .grid-2 { grid-template-columns: repeat(2, 1fr); }
    .grid-3 { grid-template-columns: repeat(3, 1fr); }
    .grid-4 { grid-template-columns: repeat(4, 1fr); }

    .songs { grid-template-columns: repeat(2, 1fr); }
    .stats { grid-template-columns: repeat(4, 1fr); }
    .field-row { grid-template-columns: repeat(2, 1fr); gap: 16px; }

    .footer-grid { grid-template-columns: 2fr 1fr 1fr; }

    .section-head h2 { font-size: 2.2rem; }

    .modal { align-items: center; }
    .modal-card { border-radius: var(--radius-lg); }

    .toasts { bottom: 26px; }

    .piano { height: 186px; }
    .key { width: 54px; }
    .key.black { width: 34px; margin: 0 -17px; }

    .piano.piano-fit { height: 172px; }
    .piano.piano-fit .key .lbl { font-size: 0.62rem; }
    .piano.piano-fit .key.octave .lbl { font-size: 0.72rem; }

    .bottom-nav {
        justify-content: center;
        gap: 4px;
        padding: 8px 20px calc(8px + env(safe-area-inset-bottom, 0px));
    }

    .bottom-nav a { flex: 0 1 132px; flex-direction: row; gap: 8px; font-size: 0.82rem; padding: 10px 12px; }
}

@media (min-width: 1024px) {
    .songs { grid-template-columns: repeat(3, 1fr); }
    .hero-layout { display: grid; grid-template-columns: 1.1fr 0.9fr; gap: 44px; align-items: center; }
    .hero-visual { margin-top: 0; }
}
