:root { --fond: #0f1115; --carte: #181b22; --carte2: #20242d; --texte: #e8eaef; --doux: #8b93a3; --accent: #f59e0b; --rouge: #ef4444; --vert: #10b981; --bleu: #3b82f6; }
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; background: var(--fond); color: var(--texte); font: 16px/1.35 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; }
body { padding: env(safe-area-inset-top) env(safe-area-inset-right) 0 env(safe-area-inset-left); overscroll-behavior: none; }
button, input, select { font: inherit; color: inherit; }
button { background: var(--carte2); border: 0; border-radius: 10px; padding: 10px 14px; cursor: pointer; }
button:active { filter: brightness(1.3); }
button:disabled { opacity: .4; }
button.principal { background: var(--accent); color: #111; font-weight: 600; }
button.danger { background: #3a1717; color: #fca5a5; }
button.lien { background: none; padding: 6px; color: var(--accent); }
input[type=text], input[type=password], input[type=number], select { background: var(--carte2); border: 1px solid #2c313c; border-radius: 10px; padding: 10px 12px; width: 100%; }
input[type=range] { width: 100%; accent-color: var(--c, var(--accent)); }
h1 { font-size: 22px; margin: 0; }
h2 { font-size: 18px; margin: 0 0 12px; }
.doux { color: var(--doux); font-size: 14px; }
.ligne { display: flex; gap: 8px; align-items: center; }
.ligne > .etire { flex: 1; min-width: 0; }
.pile > * + * { margin-top: 12px; }
.page { max-width: 720px; margin: 0 auto; padding: 16px; }

/* Connexion & liste */
.connexion { min-height: 80vh; display: flex; flex-direction: column; justify-content: center; gap: 14px; max-width: 360px; margin: 0 auto; padding: 24px; }
.logo { font-size: 44px; text-align: center; }
.erreur { color: #fca5a5; font-size: 14px; }
.carte { background: var(--carte); border-radius: 14px; padding: 14px; }
.projet-item { display: flex; align-items: center; gap: 12px; padding: 14px; background: var(--carte); border-radius: 14px; margin-bottom: 10px; cursor: pointer; }
.projet-item .titre { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.barre-prog { height: 6px; background: var(--carte2); border-radius: 3px; overflow: hidden; }
.barre-prog > div { height: 100%; width: 0; background: var(--accent); transition: width .2s; }

/* Projet */
.entete { position: sticky; top: 0; z-index: 5; background: var(--fond); padding: 10px 12px; display: flex; gap: 6px; align-items: center; border-bottom: 1px solid #1f232b; }
.entete .nom-projet { flex: 1; min-width: 0; font-weight: 700; font-size: 17px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; background: none; text-align: left; padding: 6px 4px; }
.entete button { padding: 8px 9px; }
.entete { gap: 4px; }
.bandeau { margin: 10px 12px 0; padding: 10px 12px; border-radius: 10px; background: var(--carte); font-size: 14px; }
.regle-zone { position: sticky; top: 57px; z-index: 4; background: var(--fond); padding: 6px 12px 4px; }
.regle { position: relative; height: 26px; touch-action: none; }
.regle canvas, .onde canvas { width: 100%; height: 100%; display: block; }
.pistes { padding: 4px 12px 140px; }
.piste { background: var(--carte); border-radius: 12px; padding: 8px 10px 6px; margin-top: 8px; border-left: 4px solid var(--c); }
.piste.silence { opacity: .55; }
.piste .tete { display: flex; align-items: center; gap: 6px; }
.piste .nom { flex: 1; min-width: 0; text-align: left; background: none; padding: 4px 2px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.piste .nom small { font-weight: 400; color: var(--doux); margin-left: 6px; }
.btn-ms { width: 38px; height: 34px; padding: 0; font-weight: 700; font-size: 14px; }
.btn-ms.m.on { background: var(--bleu); color: #fff; }
.btn-ms.s.on { background: var(--accent); color: #111; }
.onde { position: relative; height: 54px; margin: 4px 0 2px; background: #12151b; border-radius: 6px; overflow: hidden; touch-action: pan-y; }
.piste.deplacer .onde { outline: 2px dashed var(--c); touch-action: none; }
.curseur { position: absolute; top: 0; bottom: 0; width: 2px; background: #fff; pointer-events: none; transform: translateX(-1px); }
.regle .curseur { background: var(--accent); }
.chargement { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-size: 13px; color: var(--doux); }
.vol-ligne { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--doux); }
.vol-ligne span { width: 44px; text-align: right; font-variant-numeric: tabular-nums; }
.panneau { border-top: 1px solid #262a33; margin-top: 6px; padding-top: 10px; }
.panneau .titre-ctrl { font-size: 13px; color: var(--doux); margin-bottom: 4px; }
.decal { display: flex; gap: 4px; align-items: center; }
.decal button { padding: 8px 0; flex: 1; font-size: 13px; font-variant-numeric: tabular-nums; }
.decal input { width: 92px; flex: none; text-align: center; padding: 8px 4px; }
.boutons-panneau { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.boutons-panneau button { font-size: 14px; padding: 8px 10px; }
.cachees { margin-top: 18px; }

/* Transport (en bas, à portée de pouce) */
.transport { position: fixed; left: 0; right: 0; bottom: 0; z-index: 6; background: rgba(15,17,21,.96); backdrop-filter: blur(8px); border-top: 1px solid #222731; padding: 8px 12px calc(8px + env(safe-area-inset-bottom)); }
.transport .temps { font-variant-numeric: tabular-nums; font-size: 15px; text-align: center; margin-bottom: 6px; color: var(--doux); }
.transport .temps b { color: var(--texte); font-size: 18px; }
.transport .boutons { display: flex; justify-content: center; align-items: center; gap: 10px; max-width: 520px; margin: 0 auto; }
.transport .boutons button { min-width: 50px; height: 50px; font-size: 20px; border-radius: 25px; }
.transport .lecture { width: 64px; height: 64px !important; border-radius: 32px !important; background: var(--texte); color: #111; font-size: 24px !important; }
.transport .rec { background: #3a1717; color: var(--rouge); }
.transport .rec.on { background: var(--rouge); color: #fff; animation: clignote 1s infinite; }
@keyframes clignote { 50% { opacity: .6; } }

/* Feuille (fenêtre du bas) */
#feuille { position: fixed; inset: 0; z-index: 20; background: rgba(0,0,0,.55); display: flex; align-items: flex-end; justify-content: center; }
#feuille[hidden] { display: none; }
#feuille .contenu { background: var(--carte); width: 100%; max-width: 560px; border-radius: 18px 18px 0 0; padding: 18px 16px calc(18px + env(safe-area-inset-bottom)); max-height: 88vh; overflow: auto; }
#feuille.discrete { background: transparent; pointer-events: none; }
#feuille.discrete .contenu { pointer-events: auto; box-shadow: 0 -8px 30px rgba(0,0,0,.6); }
.choix { display: flex; gap: 6px; }
.choix button { flex: 1; }
.choix button.on { background: var(--accent); color: #111; font-weight: 600; }
.case { display: flex; align-items: center; gap: 10px; padding: 8px 2px; }
.case input { width: 20px; height: 20px; accent-color: var(--accent); }
.niveau { height: 10px; background: var(--carte2); border-radius: 5px; overflow: hidden; }
.niveau > div { height: 100%; width: 0; background: linear-gradient(90deg, var(--vert) 70%, var(--accent) 85%, var(--rouge)); transition: width .05s; }
.rec-gros { font-size: 30px; font-variant-numeric: tabular-nums; text-align: center; color: var(--rouge); font-weight: 700; }
.lien-partage { word-break: break-all; font-size: 14px; background: var(--carte2); padding: 10px; border-radius: 8px; }
#toast { position: fixed; left: 50%; transform: translateX(-50%); bottom: 150px; z-index: 30; background: #2b303b; padding: 10px 16px; border-radius: 20px; font-size: 14px; max-width: 90vw; box-shadow: 0 4px 20px rgba(0,0,0,.5); }

/* Paroles : panneau au-dessus des pistes, visible pendant l'enregistrement */
.entete button.on { background: var(--accent); color: #111; }
.paroles { position: fixed; left: 0; right: 0; top: calc(57px + env(safe-area-inset-top)); bottom: calc(var(--bas-paroles, var(--haut-transport, 120px)) + env(safe-area-inset-bottom)); z-index: 7; background: var(--fond); display: flex; flex-direction: column; border-bottom: 1px solid #222731; }
.paroles[hidden] { display: none; }
.paroles-barre { display: flex; gap: 6px; align-items: center; padding: 6px 12px; border-bottom: 1px solid #1f232b; }
.paroles-barre button { padding: 6px 10px; font-size: 14px; white-space: nowrap; flex: none; }
.paroles-barre span { font-size: 14px; }
.paroles-texte { flex: 1; overflow-y: auto; padding: 16px 18px 40vh; line-height: 1.45; position: relative; }
.ligne-paroles { padding: 3px 0; color: var(--texte); transition: color .2s, transform .2s; }
.paroles-texte:has(.actuelle) .ligne-paroles { color: #5b6272; }
.ligne-paroles.actuelle { color: var(--accent) !important; font-weight: 700; }
.saisie-paroles { width: 100%; min-height: 45vh; background: var(--carte2); color: var(--texte); border: 1px solid #2c313c; border-radius: 10px; padding: 10px; font: 15px/1.4 inherit; }
.ligne-paroles.calee { color: #5b6272; }
.bouton-calage { width: 100%; padding: 22px 12px; font-size: 18px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.poignee { touch-action: none; cursor: grab; padding: 8px 14px 8px 4px; margin: -6px 0 -6px -4px; color: var(--c); font-size: 22px; line-height: 1; user-select: none; -webkit-user-select: none; }
.piste.tri { position: relative; z-index: 3; box-shadow: 0 10px 30px rgba(0,0,0,.6); opacity: .95; }
.piste .tete { -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }

.ligne-temps { display: flex; align-items: center; justify-content: center; gap: 14px; margin-bottom: 6px; }
.ligne-temps .temps { margin-bottom: 0 !important; }
.ligne-temps .histo { width: 44px; height: 36px; font-size: 20px; border-radius: 18px; padding: 0; }
.ligne-temps .histo:disabled { opacity: .3; }

input[type=search] { background: var(--carte2); border: 1px solid #2c313c; border-radius: 10px; padding: 10px 12px; width: 100%; }
#feuille button.on { background: var(--accent); color: #111; font-weight: 600; }
.vol-piste { position: relative; flex: 1; min-width: 0; display: flex; align-items: center; }
.vol-piste::after { content: ''; position: absolute; left: calc(11px + (100% - 22px) / 3); top: 50%; width: 2px; height: 14px; margin-top: -7px; margin-left: -1px; background: #ffffff88; border-radius: 1px; pointer-events: none; }
