:root {
  --bg: #1a1410;
  --bg-card: #241c16;
  --bg-inset: #160f0b;
  --fg: #f4ece2;
  --muted: #b3a594;
  --accent: #ff8c42;
  --accent-2: #ffd27f;
  --chord: #ffb454;
  --line: #3a2f26;
  --danger: #ff8080;
  --ok: #9be29b;
  --radius: 14px;
  --song-scale: 1;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  line-height: 1.4;
}

a { color: var(--accent-2); text-decoration: none; }
a:hover { text-decoration: underline; }
code { background: var(--bg-inset); padding: .05rem .35rem; border-radius: 6px; font-size: .85em; }

.topbar {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  padding: .7rem 1rem;
  background: #160f0b;
  border-bottom: 1px solid var(--line);
}
.brand { font-weight: 700; font-size: 1.1rem; color: var(--accent); }
.topnav a { color: var(--accent-2); font-size: .95rem; font-weight: 600; }
.sitefoot { text-align: center; padding: 1.5rem 1rem; color: var(--muted); font-size: .85rem; }
.sitefoot a { color: var(--muted); }
.diffview { background: var(--bg-inset); border: 1px solid var(--line); border-radius: 8px; padding: .6rem; overflow-x: auto; white-space: pre; font-size: .8rem; line-height: 1.45; }
.diff-add { color: var(--ok); }
.diff-del { color: var(--danger); }

.container { max-width: 1100px; margin: 0 auto; padding: 1rem; }

.card {
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1rem 1.1rem;
  margin-bottom: 1rem;
}

h1 { margin: .2rem 0 .6rem; font-size: 1.5rem; }
h2 { margin: .2rem 0 .6rem; font-size: 1.2rem; }
h3 { margin: .8rem 0 .4rem; font-size: 1rem; }
.muted { color: var(--muted); }
.error { color: var(--danger); }
.ok { color: var(--ok); }

button {
  background: var(--accent); color: #1a1410;
  border: 0; border-radius: 10px;
  padding: .55rem .85rem; font-weight: 600; font-size: 1rem;
  cursor: pointer;
}
button:hover { filter: brightness(1.08); }
button.secondary, .secondary { background: #3a2f26; color: var(--fg); }
button:disabled { opacity: .4; cursor: not-allowed; }
.btn-danger { background: var(--danger); color: #1a1410; }
a.danger { color: var(--danger); }

input, textarea, select {
  background: var(--bg-inset); border: 1px solid var(--line); color: var(--fg);
  border-radius: 10px; padding: .55rem .7rem; font-size: 1rem; width: 100%;
}
textarea { font-family: ui-monospace, Menlo, Consolas, monospace; }

.row { display: flex; gap: .5rem; margin: .5rem 0; flex-wrap: wrap; }
.row input { flex: 1; min-width: 140px; }
.row-between { display: flex; justify-content: space-between; align-items: center; gap: 1rem; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: .6rem; margin: .5rem 0; }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: .6rem; margin: .5rem 0; }
@media (max-width: 720px) { .grid-4 { grid-template-columns: 1fr 1fr; } }
label { display: block; font-size: .85rem; color: var(--muted); margin-bottom: .5rem; }
label.inline { display: inline-flex; align-items: center; gap: .45rem; color: var(--fg); font-size: .95rem; margin: .5rem 0; }
label.inline input { margin: 0; width: auto; }
label input, label textarea { margin-top: .25rem; }
hr { border: 0; border-top: 1px solid var(--line); margin: .8rem 0; }

/* --- Salon --- */
.room { display: block; }
.room-head { display: flex; justify-content: space-between; align-items: center; gap: 1rem; flex-wrap: wrap; }
.room-controls { display: flex; gap: .5rem; align-items: center; flex-wrap: wrap; }
.transpose, .fontsize {
  display: flex; gap: .25rem; align-items: center;
  background: var(--bg-inset); border: 1px solid var(--line); border-radius: 10px; padding: .25rem;
}
.transpose button, .fontsize button { padding: .35rem .65rem; background: #3a2f26; color: var(--fg); }

.autoscroll { display: flex; gap: .4rem; align-items: center; background: var(--bg-inset); border: 1px solid var(--line); border-radius: 10px; padding: .25rem .4rem; }
.autoscroll button { padding: .35rem .6rem; background: #3a2f26; color: var(--fg); white-space: nowrap; }
.autoscroll.on #as-toggle { background: var(--accent); color: #1a1410; }
.autoscroll #as-level { min-width: 1.8ch; text-align: center; font-weight: 700; color: var(--accent-2); }

/* Contrôle flottant (salon uniquement), toujours visible en haut à droite */
.autoscroll--float {
  position: fixed; top: .6rem; right: .6rem; z-index: 60;
  box-shadow: 0 6px 18px rgba(0, 0, 0, .45);
  flex-wrap: wrap; justify-content: flex-end; max-width: 92vw; gap: .45rem;
}
.autoscroll--float button { min-width: 2.8rem; font-size: 1.2rem; padding: .55rem .65rem; }
.as-div { width: 1px; align-self: stretch; background: var(--line); margin: 0 .1rem; }
.lf-chord { min-width: 2.4ch; text-align: center; font-weight: 700; color: var(--accent-2); white-space: nowrap; font-size: .95rem; }
#lf-mic.on, #lf-follow.on { background: var(--accent); color: #1a1410; }
/* Replier/déplier la barre flottante (mobile : trop large). Repliée = seule la poignée reste. */
.as-collapse { font-weight: 700; line-height: 1; }
.autoscroll--collapsed { gap: 0; }
.autoscroll--collapsed > :not(.as-collapse) { display: none; }
.qr-box { display: flex; justify-content: center; margin: .6rem 0; }
.qr-box svg { width: 260px; max-width: 72vw; height: auto; border-radius: 8px; }
.qr-url { word-break: break-all; text-align: center; font-size: .85rem; }
#t-label { min-width: 2.4ch; text-align: center; font-weight: 700; color: var(--accent-2); }
.now-playing { min-height: 45vh; }
.sidebar { display: flex; flex-direction: column; }

/* Onglets du salon */
.tabs { display: flex; gap: .2rem; margin-bottom: 1rem; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.tab { background: var(--bg-inset); color: var(--muted); border: 0; border-radius: 8px 8px 0 0; padding: .6rem 1rem; font-weight: 600; font-size: 1rem; }
.tab:hover { color: var(--fg); }
.tab.active { background: var(--accent); color: #1a1410; }
.tab.active .tab-badge { background: #1a1410; color: var(--accent-2); }
.tab-badge { background: var(--accent); color: #1a1410; border-radius: 999px; padding: 0 .45rem; font-size: .75rem; font-weight: 700; }

/* Sous-onglets (Ajouter une chanson) */
.subtabs { display: flex; gap: .2rem; margin: .2rem 0 .9rem; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.subtab { background: transparent; color: var(--muted); border: 0; border-bottom: 2px solid transparent; border-radius: 0; padding: .4rem .7rem; font-weight: 600; font-size: .9rem; }
.subtab:hover { color: var(--fg); }
.subtab.active { color: var(--accent-2); border-bottom-color: var(--accent-2); }

.add-msg { min-height: 1.2em; margin: .7rem 0 0; font-size: .9rem; }
.add-msg.ok { color: var(--ok); }
.add-msg.error { color: var(--danger); }
.queue--readonly li { padding: .4rem 0; }

/* « En attente » repliable */
.queue-box summary { cursor: pointer; font-weight: 700; font-size: 1.05rem; list-style: none; display: flex; align-items: center; gap: .5rem; }
.queue-box summary::-webkit-details-marker { display: none; }
.queue-box summary::before { content: '▸'; color: var(--accent); }
.queue-box[open] summary::before { content: '▾'; }
.queue-box .queue { margin-top: .6rem; }

/* Bannière feu inactif + mode lecture seule */
.banner { background: #3a2a18; border-color: var(--accent); color: var(--accent-2); }
.banner { padding: .7rem .9rem; border: 1px solid var(--accent); border-radius: 10px; }

/* 2FA */
.recovery-codes { list-style: none; padding: 0; margin: .5rem 0 0; display: grid; grid-template-columns: 1fr 1fr; gap: .35rem; }
.recovery-codes code { font-size: 1.05rem; letter-spacing: .06em; }
.twofa-steps { margin: .3rem 0; padding-left: 1.3rem; }
.twofa-steps > li { margin-bottom: .9rem; }

/* Notifications */
.notif-bell { position: relative; margin-right: .4rem; }
.notif-dot {
  position: absolute; top: -.4rem; right: -.55rem;
  background: var(--danger); color: #fff; font-size: .65rem; font-weight: 700;
  min-width: 1.05rem; height: 1.05rem; padding: 0 .2rem;
  border-radius: 999px; display: inline-flex; align-items: center; justify-content: center;
}
.notif-list { list-style: none; padding: 0; margin: .5rem 0 0; }
.notif-list li { display: flex; gap: 1rem; justify-content: space-between; align-items: flex-start; padding: .7rem 0; border-bottom: 1px solid var(--line); }
.notif--unread { background: rgba(255, 140, 66, .07); border-left: 3px solid var(--accent); padding-left: .6rem; margin-left: -.6rem; }
.notif-actions { display: flex; gap: .5rem; align-items: center; white-space: nowrap; }

/* Items du tableau de modération (signalements, notes) */
.mod-item { padding: .8rem 0; border-bottom: 1px solid var(--line); }
.mod-item:last-child { border-bottom: 0; }
.room--inactive #btn-claim,
.room--inactive .musician-only,
.room--inactive .qa,
.room--inactive #song-search,
.room--inactive #search-results,
.room--inactive #link-form,
.room--inactive #text-form { display: none !important; }

@media (max-width: 820px) {
  .room { grid-template-columns: 1fr; }
}

/* --- Listes --- */
.queue { list-style: none; margin: 0; padding: 0; }
.queue li { display: flex; align-items: center; gap: .5rem; padding: .5rem 0; border-bottom: 1px solid var(--line); }
.queue li:last-child { border-bottom: 0; }
.queue .qa { margin-left: auto; display: flex; gap: .3rem; }
.queue .qa button { padding: .3rem .55rem; }
.queue .by { font-size: .75rem; color: var(--muted); }

.song-list { list-style: none; margin: .3rem 0; padding: 0; }
.song-list li { display: flex; align-items: center; gap: .5rem; padding: .4rem 0; border-bottom: 1px solid var(--line); }
.song-list li button { margin-left: auto; padding: .2rem .6rem; }
.add-plus { font-size: 1.25rem; padding: .25rem .95rem; line-height: 1; }
.add-plus:disabled { opacity: 1; background: var(--ok); color: #1a1410; }

.feu-list { list-style: none; margin: .3rem 0; padding: 0; }
.feu-list li { display: flex; align-items: center; gap: .5rem; padding: .55rem 0; border-bottom: 1px solid var(--line); }
.feu-list li:last-child { border-bottom: 0; }
.feu-list li .badge { margin-left: auto; }

.people { list-style: none; display: flex; flex-wrap: wrap; gap: .4rem; padding: 0; margin: 0; }
.people li { background: var(--bg-inset); border: 1px solid var(--line); border-radius: 999px; padding: .2rem .65rem; font-size: .85rem; }

.history { list-style: none; margin: 0; padding: 0; }
.history li { display: flex; justify-content: space-between; align-items: baseline; gap: .6rem; padding: .35rem 0; border-bottom: 1px solid var(--line); font-size: .9rem; }
.history li:last-child { border-bottom: 0; }
.history .h-meta { white-space: nowrap; font-size: .72rem; }

/* --- Affichage chanson (le plus important) --- */
.song-head h2 { margin: 0; font-size: 1.5rem; }
.song-head .artist { margin: .1rem 0 .5rem; color: var(--muted); }
.badges { display: flex; gap: .4rem; flex-wrap: wrap; margin-bottom: .7rem; }
.badge { background: var(--bg-inset); border: 1px solid var(--line); border-radius: 999px; padding: .15rem .65rem; font-size: .85rem; color: var(--accent-2); }
.badge--capo { color: var(--accent); font-weight: 700; }

.song-body { font-size: calc(1.05rem * var(--song-scale)); line-height: 1.25; }
.line { display: flex; flex-wrap: wrap; align-items: flex-end; margin: .05rem 0; }
.line--blank { height: 2em; }
.line--chords { margin-top: .55em; }
.section { font-weight: 700; color: var(--accent); margin: .9em 0 .15em; text-transform: uppercase; font-size: .8em; letter-spacing: .06em; }

.chunk { display: flex; flex-direction: column; justify-content: flex-end; }
.chord {
  color: var(--chord); font-weight: 700;
  font-family: ui-monospace, Consolas, monospace;
  white-space: pre; line-height: 1; height: 1.25em; padding-right: .6ch;
}
.annot { color: var(--accent-2); font-style: italic; font-weight: 400; font-family: system-ui, sans-serif; white-space: pre; line-height: 1; height: 1.2em; padding-right: .6ch; }
.lyric { white-space: pre-wrap; }

/* Ligne en cours (suivi synchronisé / écoute micro) */
.line--current { background: rgba(255, 140, 66, .16); border-radius: 6px; box-shadow: 0 0 0 1px rgba(255, 140, 66, .35); }
@media (prefers-reduced-motion: no-preference) { .line--current { transition: background .2s ease; } }
.now-playing [data-line] { cursor: default; }
.room--musician .now-playing [data-line] { cursor: pointer; } /* musicien : taper une ligne pour resync */

/* Mode « paroles seules » (bouton 🎸 de la barre d'outils) : masque la couche musicien. */
body.chords-off .chord,
body.chords-off .annot,
body.chords-off .chord-diagram,
body.chords-off .strum,
body.chords-off .tab { display: none; }
body.chords-off .line--chords { margin-top: 0; }
#as-chords.is-off { opacity: .45; }

.song-viewer .toolbar {
  display: flex; justify-content: space-between; gap: .5rem; flex-wrap: wrap;
  position: sticky; top: 52px; z-index: 5;
  background: var(--bg-card); padding: .4rem 0; margin-bottom: .6rem;
}
.song-viewer .toolbar .export { display: flex; gap: .3rem; align-items: center; }

.btn-link { display: inline-block; background: var(--accent); color: #1a1410; padding: .65rem 1.1rem; border-radius: 10px; font-weight: 700; }

/* --- Admin --- */
.table { width: 100%; border-collapse: collapse; }
.table th, .table td { text-align: left; padding: .45rem .35rem; border-bottom: 1px solid var(--line); }
.table .actions { display: flex; gap: .7rem; }
.preview { background: var(--bg-inset); border: 1px solid var(--line); border-radius: 10px; padding: .9rem; margin-top: .5rem; }

/* Tablature, commentaire, strumming, mesure (rendu ChordPro) */
.tab { background: var(--bg-inset); border: 1px solid var(--line); border-radius: 8px; padding: .6rem .8rem; margin: .3rem 0; overflow-x: auto; font-family: ui-monospace, Consolas, monospace; font-size: .85rem; line-height: 1.3; white-space: pre; color: var(--fg); }
.comment { color: var(--muted); font-style: italic; font-size: .85rem; border-left: 2px solid var(--line); padding: .15rem .6rem; margin: .25rem 0; }
.comment-inline { color: var(--muted); font-style: italic; font-size: .8rem; opacity: .9; }
.chorus-block { padding-left: 1.4rem; border-left: 2px solid var(--line); margin: .2rem 0; }
.strum { display: flex; flex-wrap: wrap; gap: .7rem; font-size: 1.15rem; color: var(--accent-2); margin: .35rem 0; }
.strum .beat { letter-spacing: .08em; }
.meta-line { font-size: .8rem; color: var(--muted); margin: .2rem 0; }
.tag { display: inline-block; font-size: .72rem; color: var(--accent-2); background: var(--bg-inset); border: 1px solid var(--line); border-radius: 999px; padding: .05rem .5rem; margin: .1rem .25rem .1rem 0; }

.chord-diagram { display: inline-block; margin: .2rem .5rem .2rem 0; vertical-align: top; }
.cd-name { fill: var(--accent-2); font: 700 11px ui-monospace, Consolas, monospace; }
.cd-line { stroke: var(--muted); stroke-width: 1; }
.cd-nut { stroke: var(--fg); stroke-width: 3; }
.cd-dot { fill: var(--chord); }
.cd-mark { fill: var(--muted); font: 10px sans-serif; }
.cd-fret { fill: var(--muted); font: 9px sans-serif; }

/* Éditeur de chanson (admin) */
.song-editor { border: 0.5px solid var(--line); border-radius: 10px; overflow: hidden; margin: .4rem 0; }
.ed-toolbar { display: flex; flex-wrap: wrap; gap: .25rem; align-items: center; padding: .45rem .5rem; background: var(--bg-inset); border-bottom: 1px solid var(--line); }
/* Boutons-icônes (variante compacte) : carré sombre, icône SVG thémable par color */
.ed-toolbar .ed-ic {
  position: relative; display: inline-flex; align-items: center; justify-content: center;
  width: 38px; height: 34px; padding: 0;
  background: #3a2f26; color: var(--fg); border: 0; border-radius: 9px; cursor: pointer;
}
.ed-toolbar .ed-ic svg { width: 22px; height: 22px; display: block; }
.ed-toolbar .ed-ic--accent { color: var(--accent); }    /* outils « musicaux » en orange */
.ed-toolbar .ed-ic:hover { background: #4a3d31; }
.ed-toolbar .ed-ic:disabled { opacity: .4; cursor: not-allowed; }
.ed-toolbar .ed-ic:focus-visible { outline: 2px solid var(--accent-2); outline-offset: 1px; }
.ed-sep { width: 1px; align-self: stretch; min-height: 24px; background: var(--line); margin: 0 .25rem; }

/* Infobulle instantanée (libellé du rôle de l'outil), sous le bouton */
.ed-toolbar .ed-ic[data-tip]:hover::after,
.ed-toolbar .ed-ic[data-tip]:focus-visible::after {
  content: attr(data-tip);
  position: absolute; top: calc(100% + 8px); left: 50%; transform: translateX(-50%);
  background: var(--bg-card); color: var(--fg); border: 1px solid var(--line); border-radius: 8px;
  padding: .4rem .6rem; font-size: .78rem; font-weight: 400; line-height: 1.35;
  width: max-content; max-width: 240px; white-space: normal; text-align: center;
  z-index: 30; pointer-events: none; box-shadow: 0 6px 18px rgba(0, 0, 0, .45);
}
.ed-tabs { display: flex; gap: .2rem; padding: 0 .5rem; border-bottom: 1px solid var(--line); }
.ed-tab { background: none; border: 0; border-bottom: 2px solid transparent; border-radius: 0; color: var(--muted); padding: .5rem .8rem; font-size: .9rem; cursor: pointer; }
.ed-tab.active { color: var(--accent); border-bottom-color: var(--accent); }
[data-edpanel] { padding: .7rem; max-height: 60vh; overflow: auto; }
.ed-visual { min-height: 8rem; }
.ed-visual .ed-chord { background: none; border: 0; padding: 0 .6ch 0 0; font: inherit; color: var(--chord); font-weight: 700; font-family: ui-monospace, Consolas, monospace; cursor: pointer; line-height: 1; }
.ed-visual .ed-chord.on { outline: 2px solid var(--accent); outline-offset: 1px; border-radius: 4px; }
#song-editor #body { width: 100%; height: 52vh; min-height: 16rem; }
#chord-fr { color: var(--accent-2); font-size: 1.05rem; min-height: 1.4em; margin: .4rem 0 .6rem; }
#chord-dialog input { width: 16rem; max-width: 70vw; font-size: 1.1rem; }
#define-dialog input { width: 14rem; max-width: 70vw; font-size: 1.1rem; }
.define-preview { min-height: 4.5rem; display: flex; justify-content: center; align-items: center; margin: .4rem 0 .2rem; }
.inspect-list { list-style: none; padding: 0; margin: .5rem 0 0; display: flex; flex-direction: column; gap: .6rem; }
.inspect-list > li { background: var(--bg-inset); border-radius: 6px; padding: .6rem .7rem; }
.inspect-head { display: flex; gap: .5rem; align-items: baseline; flex-wrap: wrap; }
.inspect-diff { display: flex; align-items: center; gap: .5rem; margin: .4rem 0; flex-wrap: wrap; }
.inspect-diff pre { margin: 0; padding: .3rem .5rem; border-radius: 4px; background: var(--bg); font-size: .8rem; white-space: pre-wrap; overflow: auto; max-width: 100%; max-height: 11rem; }
.inspect-before { color: var(--muted); }
.inspect-after { color: var(--accent-2); }
.inspect-arrow { color: var(--accent); }
.inline-form { display: inline; }
.render-wrap { margin-top: .8rem; }
.render-label { font-size: .8rem; color: var(--muted); margin-bottom: .25rem; }
.render-preview { height: 52vh; min-height: 16rem; overflow: auto; background: var(--bg-inset); border: 1px solid var(--line); border-radius: 8px; padding: .6rem .8rem; }
.import-form .grid-2 { margin-bottom: .6rem; }

/* Barre latérale d'administration en sections (+ tiroir mobile sans JS) */
.admin-shell { display: grid; grid-template-columns: 230px minmax(0, 1fr); gap: 1rem; align-items: start; }
.admin-side { display: flex; flex-direction: column; gap: .05rem; padding: .6rem; position: sticky; top: 70px; max-height: calc(100vh - 86px); overflow: auto; }
.admin-side-head { display: flex; align-items: center; gap: .5rem; padding: .15rem .25rem .55rem; border-bottom: 1px solid var(--line); margin-bottom: .35rem; }
.admin-brand { font-weight: 800; color: var(--accent); }
.admin-role { margin-left: auto; font-size: .66rem; text-transform: uppercase; letter-spacing: .04em; color: var(--accent-2); background: var(--bg-inset); border: 1px solid var(--line); border-radius: 999px; padding: .12rem .5rem; }
.admin-sec { font-size: .7rem; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); margin: .75rem .35rem .2rem; }
.admin-link { display: flex; align-items: center; gap: .55rem; padding: .5rem .6rem; border-radius: 9px; color: var(--fg); font-weight: 600; font-size: .95rem; }
.admin-link:hover { background: var(--bg-inset); text-decoration: none; }
.admin-link.active { background: var(--accent); color: #1a1410; }
.admin-link .ic { width: 1.35em; text-align: center; flex: 0 0 auto; }
.admin-link .lbl { flex: 1; min-width: 0; }
.admin-badge { background: var(--accent); color: #1a1410; font-size: .72rem; font-weight: 800; border-radius: 999px; padding: 0 .42rem; min-width: 1.25em; text-align: center; }
.admin-link.active .admin-badge { background: #1a1410; color: var(--accent-2); }
.admin-side-foot { margin-top: .55rem; padding-top: .45rem; border-top: 1px solid var(--line); display: flex; flex-direction: column; gap: .05rem; }
.admin-side-foot .admin-link { color: var(--muted); }
.admin-logout { margin: 0; }
.admin-side-foot button.admin-link { width: 100%; background: transparent; text-align: left; cursor: pointer; }
.admin-content { min-width: 0; }
.admin-burger, .admin-x, .admin-backdrop { display: none; }

@media (max-width: 860px) {
  .admin-shell { grid-template-columns: 1fr; }
  .admin-burger {
    display: inline-flex; align-items: center; gap: .4rem; cursor: pointer;
    background: var(--bg-card); border: 1px solid var(--line); border-radius: 10px;
    padding: .5rem .8rem; font-weight: 700; margin-bottom: .8rem;
  }
  .admin-x { display: inline; margin-left: auto; cursor: pointer; font-size: 1.05rem; color: var(--muted); }
  .admin-side {
    position: fixed; top: 0; left: 0; bottom: 0; width: 82%; max-width: 310px; z-index: 80;
    border-radius: 0; max-height: none;
    transform: translateX(-100%); transition: transform .22s ease;
    box-shadow: 0 0 28px rgba(0, 0, 0, .55);
  }
  .admin-drawer-cb:checked ~ .admin-shell .admin-side { transform: translateX(0); }
  .admin-drawer-cb:checked ~ .admin-shell .admin-backdrop {
    display: block; position: fixed; inset: 0; background: rgba(0, 0, 0, .5); z-index: 70;
  }
}
@media (prefers-reduced-motion: reduce) { .admin-side { transition: none; } }

.btn-min { display: inline-block; padding: .4rem .75rem; border-radius: 8px; background: var(--accent); color: #1a1410; font-weight: 600; }
.btn-min.secondary { background: #3a2f26; color: var(--fg); }

.table.sortable th a { color: var(--accent-2); white-space: nowrap; }
.pager { display: flex; gap: 1.2rem; align-items: center; flex-wrap: wrap; margin-top: .9rem; }
.pager .per a { padding: 0 .25rem; }
.pager .pages { margin-left: auto; display: flex; gap: .8rem; align-items: center; }
.live { color: #7CFC98; font-weight: 700; }

.note-bar { margin: .6rem 0; }

.rating-bar { display: flex; align-items: center; gap: .6rem; flex-wrap: wrap; }
.stars { display: inline-flex; gap: .1rem; }
.stars .star { background: none; border: 0; padding: 0 .05rem; font-size: 1.6rem; line-height: 1; color: var(--line); cursor: pointer; }
.stars .star.on, .stars .star:hover { color: var(--accent-2); }
.badge--rating { color: var(--accent-2); }
.note-list { background: #2a2418; border: 1px solid var(--accent); border-radius: 10px; padding: .7rem .9rem; margin: 0 0 .8rem; }
.note-list ul { margin: .3rem 0 0; padding-left: 1.1rem; }
.note-list li { margin: .25rem 0; }

dialog { background: var(--bg-card); color: var(--fg); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.3rem; max-width: 90vw; }
dialog::backdrop { background: rgba(0, 0, 0, .6); }
dialog input { margin: .6rem 0; }

/* === Compte — tableau de bord (onglets sur une page) === */
.account { display: grid; grid-template-columns: 250px minmax(0, 1fr); gap: 1rem; align-items: start; }
.account-side { display: flex; flex-direction: column; gap: 1rem; position: sticky; top: 70px; }
.account-side .card { margin-bottom: 0; }
.account-id { display: flex; gap: .7rem; align-items: center; }
.avatar { width: 46px; height: 46px; flex: 0 0 auto; border-radius: 999px; background: var(--accent); color: #1a1410; font-weight: 800; font-size: 1.05rem; display: grid; place-items: center; }
.account-id-txt { min-width: 0; }
.account-id-txt strong { display: block; word-break: break-word; }
.account-id-txt .muted { font-size: .82rem; word-break: break-word; }
.account-id-txt .badge { margin-top: .35rem; display: inline-block; }

.account-tabs { display: flex; flex-direction: column; gap: .15rem; padding: .5rem; }
.acc-tab { display: flex; align-items: center; gap: .6rem; padding: .55rem .7rem; border-radius: 10px; color: var(--fg); font-weight: 600; }
.acc-tab:hover { background: var(--bg-inset); text-decoration: none; }
.acc-tab.active { background: var(--accent); color: #1a1410; }
.acc-tab .ic { width: 1.2em; text-align: center; }

.account-side-foot { display: flex; flex-direction: column; gap: .5rem; }
.account-side-foot form { margin: 0; }
.account-side-foot .btn-min,
.account-side-foot button { width: 100%; text-align: center; }

.account-main { min-width: 0; }
/* Amélioration progressive : avec JS, seul le panneau actif s'affiche ; sans JS, tout reste visible. */
.account.has-js .account-panel { display: none; }
.account.has-js .account-panel.is-active { display: block; }

.dash-head h1 { margin-bottom: .1rem; }
.stat-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: .8rem; margin: 1rem 0; }
.stat-card { background: var(--bg-card); border: 1px solid var(--line); border-radius: var(--radius); padding: .85rem 1rem; }
.stat-label { display: block; font-size: .85rem; color: var(--muted); }
.stat-num { display: block; font-size: 2rem; line-height: 1.1; color: var(--accent); margin: .15rem 0; }
.stat-sub { font-size: .8rem; color: var(--muted); min-height: 1em; }
.stat-sub .dot { color: var(--ok); }

.dash-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; align-items: start; }
.dash-col { display: flex; flex-direction: column; gap: 1rem; }
.dash-col .card { margin-bottom: 0; }
.dash-links { margin: .7rem 0 0; }
.dash-empty { color: var(--muted); }
.dash-feed { list-style: none; margin: .4rem 0 0; padding: 0; }
.dash-feed li { padding: .55rem 0; border-bottom: 1px solid var(--line); }
.dash-feed li:last-child { border-bottom: 0; }
.dash-feed .dot { color: var(--accent); margin-right: .3rem; }
.badge--live { color: var(--ok); border-color: var(--ok); }
.badge.muted { color: var(--muted); }

.account-bottombar { display: none; }

@media (max-width: 860px) {
  .account { grid-template-columns: 1fr; padding-bottom: 4.8rem; }
  .account-side { position: static; }
  .account-tabs { display: none; }            /* remplacé par la barre du bas */
  .stat-grid { grid-template-columns: 1fr 1fr; }
  .dash-cols { grid-template-columns: 1fr; }
  .account-bottombar {
    display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 50;
    justify-content: space-around; gap: .15rem;
    background: #160f0b; border-top: 1px solid var(--line);
    padding: .3rem .25rem; padding-bottom: calc(.3rem + env(safe-area-inset-bottom, 0px));
  }
  .account-bottombar .acc-tab {
    flex: 1; flex-direction: column; gap: .12rem; align-items: center;
    padding: .3rem .25rem; border-radius: 10px; color: var(--muted); font-size: .7rem; font-weight: 600;
  }
  .account-bottombar .acc-tab .ic { font-size: 1.2rem; width: auto; }
  .account-bottombar .acc-tab.active { background: transparent; color: var(--accent); }
}

/* Admin : container large pour l'éditeur côte à côte (uniquement là où la coquille admin est présente). */
.container:has(.admin-shell) { max-width: 1900px; }

/* === Éditeur côte à côte + cloud de catégories (admin) === */
.editor-split { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; align-items: end; margin: .5rem 0; }
.editor-pane, .preview-pane { min-width: 0; }
.preview-pane .render-label { display: flex; align-items: center; justify-content: space-between; gap: .5rem; }
/* Aperçu = MÊME hauteur que la zone d'édition ; bas alignés (align-items:end) -> hauts alignés aussi. */
.editor-split #song-editor #body { height: 62vh; }
.editor-split [data-edpanel] { max-height: none; }
.editor-split .preview-pane .render-preview { height: 62vh; min-height: 0; max-height: none; }
.editor-help { margin: .5rem 0 0; }
@media (max-width: 980px) {
  .editor-split { grid-template-columns: 1fr; align-items: stretch; }
  .editor-split #song-editor #body,
  .editor-split .preview-pane .render-preview { height: 50vh; }
}

/* Catégories : cloud de pastilles cliquables (la case reste la vérité du formulaire) */
.cat-cloud { display: flex; flex-wrap: wrap; gap: .4rem; margin: .2rem 0 .6rem; }
.cat-pill { display: inline-flex; align-items: center; cursor: pointer; user-select: none;
  border: 1px solid var(--line); background: var(--bg-inset); color: var(--fg);
  border-radius: 999px; padding: .25rem .7rem; font-size: .85rem; }
.cat-pill input { opacity: 0; width: 0; height: 0; margin: 0; }
.cat-pill:hover { border-color: var(--accent); }
.cat-pill:focus-within { outline: 2px solid var(--accent-2); outline-offset: 1px; }
.cat-pill.on, .cat-pill:has(input:checked) { background: var(--accent); color: #1a1410; border-color: var(--accent); font-weight: 600; }
.cat-add { background: transparent; border: 1px dashed var(--line); color: var(--accent-2);
  border-radius: 999px; padding: .25rem .7rem; font-size: .85rem; font-weight: 600; cursor: pointer; }
.cat-add:hover { border-color: var(--accent); background: var(--bg-inset); filter: none; }
.cat-new { margin: 0 0 .6rem; }
.cat-new label { max-width: 28rem; }

/* =================================================================================
   Accueil-vitrine + pages d'aide/contact/rejoindre + nav responsive (refonte accueil)
   ================================================================================= */

/* Helpers génériques */
.lead { color: var(--fg); font-size: 1.02rem; margin: .2rem 0 .9rem; }
.small { font-size: .85rem; }
.stack { display: grid; gap: .6rem; margin: .4rem 0; }
.prose { line-height: 1.55; }
.hp { position: absolute !important; left: -9999px; width: 1px; height: 1px; overflow: hidden; } /* pot de miel anti-spam */

/* Hero d'accueil */
.hero { padding: .6rem .2rem 1.2rem; }
.hero h1 { font-size: 1.9rem; margin-bottom: .4rem; }
.hero-lead { color: var(--muted); max-width: 62ch; font-size: 1.05rem; margin: 0; }

/* Bloc répertoire : recherche + contrôles */
.lib-search { margin: .3rem 0 .8rem; }
.lib-search input { width: 100%; }
.lib-controls { display: flex; flex-wrap: wrap; gap: .7rem 1.1rem; align-items: center; margin-bottom: .8rem; }

/* Slider segmenté Titre / Artiste */
.seg-group { display: inline-flex; background: var(--bg-inset); border: 1px solid var(--line); border-radius: 999px; padding: 3px; }
.seg-group .seg { padding: .35rem .95rem; border-radius: 999px; color: var(--muted); font-weight: 600; font-size: .9rem; white-space: nowrap; }
.seg-group .seg:hover { text-decoration: none; color: var(--fg); }
.seg-group .seg.is-active { background: var(--accent); color: #1a1410; }

/* Barre alphabétique */
.lib-alpha { display: flex; flex-wrap: wrap; gap: .25rem; }
.lib-alpha .alpha { min-width: 1.7rem; text-align: center; padding: .2rem .4rem; border-radius: 7px;
  color: var(--accent-2); font-weight: 600; font-size: .85rem; line-height: 1.25; }
.lib-alpha .alpha:hover { background: var(--bg-inset); text-decoration: none; }
.lib-alpha .alpha.is-active { background: var(--accent); color: #1a1410; }

/* Centre d'aide : cartes de guide + étapes */
.guide-cards { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; margin-top: 1rem; }
.guide-card { display: flex; flex-direction: column; gap: .35rem; background: var(--bg-inset);
  border: 1px solid var(--line); border-radius: var(--radius); padding: 1.1rem; color: var(--fg); }
.guide-card:hover { border-color: var(--accent); text-decoration: none; }
.guide-card .guide-ic { font-size: 1.8rem; }
.guide-card strong { font-size: 1.1rem; }
.guide-card .guide-go { color: var(--accent-2); font-weight: 600; margin-top: .2rem; }
@media (max-width: 620px) { .guide-cards { grid-template-columns: 1fr; } }
.steps { margin: .6rem 0; padding-left: 1.4rem; }
.steps > li { margin-bottom: 1rem; }
.steps > li h2 { margin: 0 0 .2rem; font-size: 1.05rem; }
.steps > li p { margin: 0; color: var(--muted); }

/* Navigation responsive : tiroir mobile pur CSS (checkbox + label), accessible clavier/lecteur d'écran */
.nav-toggle { display: none; } /* desktop : tiroir inactif (pas de point de tabulation parasite) */
.nav-burger, .nav-backdrop { display: none; }
.topnav { display: flex; align-items: center; gap: 1rem; }
.topnav a { white-space: nowrap; }

@media (max-width: 860px) {
  /* La checkbox est le contrôle OPÉRABLE (focusable + nommé via aria-label) ; masquée visuellement (1×1, pas display:none). */
  .nav-toggle { display: block; position: absolute; width: 1px; height: 1px; opacity: 0; margin: 0; }
  .nav-toggle:focus-visible + .nav-burger { outline: 2px solid var(--accent-2); outline-offset: 2px; }
  .nav-burger { display: inline-flex; flex-direction: column; justify-content: center; gap: 4px;
    cursor: pointer; padding: .45rem; margin: 0; border-radius: 8px; }
  .nav-burger span { width: 22px; height: 2px; background: var(--accent-2); border-radius: 2px; }
  .topnav {
    position: fixed; top: 0; right: 0; z-index: 40; height: 100vh; width: min(80vw, 290px);
    flex-direction: column; align-items: stretch; gap: 0;
    background: var(--bg-card); border-left: 1px solid var(--line);
    padding: 4.2rem 1.2rem 1.2rem; overflow-y: auto;
    transform: translateX(100%); visibility: hidden;            /* fermé : hors écran ET hors ordre de focus */
    transition: transform .22s ease, visibility 0s linear .22s;
  }
  .topnav a { display: block; width: 100%; padding: .75rem .2rem; font-size: 1.05rem; border-bottom: 1px solid var(--line); }
  .topnav .notif-bell { margin-right: 0; }
  .nav-toggle:checked ~ .topnav { transform: translateX(0); visibility: visible; transition: transform .22s ease, visibility 0s; }
  .nav-toggle:checked ~ .nav-backdrop { display: block; position: fixed; inset: 0; z-index: 30; background: rgba(0, 0, 0, .5); }
}
@media (prefers-reduced-motion: reduce) { .topnav { transition: none; } }
