:root {
  --bg: #14101a;
  --surface: #211a2b;
  --surface2: #2e2540;
  --line: #3b3050;
  --text: #f4eef8;
  --muted: #a99bb8;
  --accent: #ff5c7a;
  --accent2: #ff9a4d;
  --unseen: #8d8399;
  --learning: #ffb347;
  --practicing: #5cc8ff;
  --mastered: #5fe0a0;
  --grad: linear-gradient(135deg, var(--accent), var(--accent2));
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; background: var(--bg); color: var(--text); }
/* iOS 26, appli installée : sans cette marge, les éléments fixés en bas remontent de la hauteur de l'encoche quand la page est courte */
html { min-height: calc(100% + env(safe-area-inset-top)); }
body {
  font: 16px/1.4 -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  touch-action: manipulation;
  -webkit-user-select: none; user-select: none;
  overscroll-behavior: none;
}
[hidden] { display: none !important; }
button, input, select, textarea { font: inherit; color: inherit; }
button { border: 0; background: none; cursor: pointer; padding: 0; }
input, textarea { -webkit-user-select: text; user-select: text; }

.view {
  min-height: 100vh;
  max-width: 640px; margin: 0 auto;
  padding: calc(env(safe-area-inset-top) + 12px) 16px calc(env(safe-area-inset-bottom) + 24px);
}

/* ---------- Accueil ---------- */
.hero { text-align: center; margin: 18px 0 22px; }
.hero h1, .bar h2 {
  margin: 0; font-weight: 800; letter-spacing: -.02em;
  background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent;
}
.hero h1 { font-size: 32px; }
.bar h2 { font-size: 26px; flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Le couple : il guide, elle tourne */
.couple { font-size: 64px; line-height: 1.2; display: inline-flex; align-items: flex-end; }
.couple span { display: inline-block; transform-origin: 50% 90%; }
.couple .him { margin-left: -6px; animation: lead 3.6s ease-in-out infinite; }
.couple .her { animation: follow 3.6s ease-in-out infinite; }
@keyframes lead {
  0%, 100% { transform: translateX(0) rotate(-2.5deg); }
  50% { transform: translateX(2px) rotate(2.5deg); }
}
@keyframes follow {
  0%, 100% { transform: translateX(0) rotate(2.5deg); }
  50% { transform: translateX(-2px) rotate(-2.5deg); }
}
@media (prefers-reduced-motion: reduce) { .couple span { animation: none !important; } }

input[type=search], input[type=text], textarea, select {
  width: 100%; padding: 12px 14px; border-radius: 12px;
  background: var(--surface); border: 1px solid var(--line); outline: none;
  -webkit-appearance: none; appearance: none;
}
input:focus, textarea:focus, select:focus { border-color: var(--accent); }

.chips { display: flex; gap: 8px; overflow-x: auto; padding: 12px 0 0; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip {
  flex: none; padding: 7px 13px; border-radius: 999px; font-size: 14px; white-space: nowrap;
  background: var(--surface); border: 1px solid var(--line); color: var(--muted);
}
.chip.on { background: var(--grad); border-color: transparent; color: #1a0f14; font-weight: 600; }
.chip.add { border-style: dashed; }
.chip.dim { opacity: .6; }

/* ---------- Styles de danse ---------- */
#styles { display: flex; flex-direction: column; gap: 12px; }
.style-card {
  position: relative; text-align: left; width: 100%; padding: 18px 44px 18px 18px; border-radius: 18px;
  background: var(--surface); border: 1px solid var(--line); display: flex; flex-direction: column; gap: 4px;
}
.style-card .sname { font-size: 22px; font-weight: 700; }
.style-card .ssub { font-size: 14px; color: var(--muted); }
.style-card .chev { position: absolute; right: 18px; top: 50%; transform: translateY(-50%); font-size: 26px; color: var(--muted); }
.style-card.add { border-style: dashed; background: transparent; color: var(--muted); text-align: center; padding: 18px; font-weight: 600; }

/* ---------- Liste des fiches ---------- */
#kinds { margin-bottom: 12px; }
#kinds small { color: var(--muted); font-weight: 400; }
#list { display: flex; flex-direction: column; gap: 10px; margin-top: 14px; padding-bottom: 96px; }
.item { display: flex; align-items: center; gap: 12px; width: 100%; text-align: left; padding: 8px; border-radius: 16px; background: var(--surface); }
.ithumb {
  position: relative; flex: none; width: 58px; height: 58px; border-radius: 12px; font-size: 28px;
  background: var(--surface2) center / cover no-repeat; display: grid; place-items: center;
}
.ithumb .vid {
  position: absolute; right: -4px; bottom: -4px; width: 20px; height: 20px; border-radius: 50%; font-size: 9px; font-style: normal;
  display: grid; place-items: center; background: var(--grad); color: #1a0f14; padding-left: 1px;
}
.itext { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.item .name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.item .sub { font-size: 13px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.item .st { flex: none; width: 12px; height: 12px; border-radius: 50%; margin-right: 8px; }
.st.unseen, .seg .on.unseen { background: var(--unseen); }
.st.learning, .seg .on.learning { background: var(--learning); }
.st.practicing, .seg .on.practicing { background: var(--practicing); }
.st.mastered, .seg .on.mastered { background: var(--mastered); }

#empty { text-align: center; padding: 50px 0; color: var(--muted); }

/* ---------- Chorégraphie ---------- */
.blocs { display: flex; flex-direction: column; gap: 12px; }
.bloc { background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 12px; display: flex; flex-direction: column; gap: 10px; }
.bloc input[type=text] { background: var(--bg); }
.bloc .num { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; background: var(--grad); color: #1a0f14; font-weight: 800; }
.bloc-actions { display: flex; gap: 6px; align-items: center; }
.bloc-actions button { padding: 6px 11px; border-radius: 9px; background: var(--surface2); font-size: 13px; color: var(--muted); }
.bloc-actions .spacer { flex: 1; }
.bloc summary { color: var(--muted); font-size: 13px; padding: 4px 0; }
.counts { display: flex; flex-direction: column; gap: 6px; margin-top: 8px; }
.count { display: flex; align-items: center; gap: 8px; }
.count span { flex: none; width: 26px; text-align: center; font-weight: 800; color: var(--muted); }
.count.strong span { color: var(--accent2); }
.count input { padding: 8px 12px !important; }
.picklist { display: flex; flex-direction: column; gap: 8px; max-height: 50vh; overflow-y: auto; }
.picklist .btn { text-align: left; }

.fab {
  position: fixed; right: max(20px, calc(50% - 300px)); bottom: calc(env(safe-area-inset-bottom) + 22px);
  width: 60px; height: 60px; border-radius: 50%; font-size: 30px; color: #1a0f14;
  background: var(--grad); box-shadow: 0 8px 24px rgba(255, 92, 122, .45);
}

.btn { padding: 12px 18px; border-radius: 12px; font-weight: 600; background: var(--surface2); }
.btn.primary { background: var(--grad); color: #1a0f14; }
.btn.ghost { background: transparent; color: var(--muted); }
.btn.danger { background: transparent; color: #ff6b6b; border: 1px solid #5a2a35; width: 100%; }
.btn.wide { width: 100%; }

/* ---------- Lecteur ---------- */
#fiche { padding-left: 0; padding-right: 0; }
#fiche > .bar, #fiche > #panel, #media > :not(#stage) { margin-left: 16px; margin-right: 16px; }
.bar { display: flex; align-items: center; gap: 6px; margin-bottom: 8px; }
.icon { width: 44px; height: 44px; font-size: 30px; line-height: 1; border-radius: 50%; flex: none; }
.icon.small { font-size: 22px; color: var(--muted); }
.icon.round { background: var(--grad); color: #1a0f14; font-size: 18px; }
#ptitle { font-weight: 700; font-size: 18px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

#stage { background: #000; display: flex; justify-content: center; }
#frame { position: relative; }
#v { width: 100%; height: 100%; display: block; object-fit: contain; }
#cv { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
#cv.draw { pointer-events: auto; touch-action: none; cursor: crosshair; }
#beat {
  position: absolute; left: 12px; top: 12px; min-width: 56px; height: 56px; padding: 0 10px;
  display: grid; place-items: center; border-radius: 16px; font-size: 34px; font-weight: 800;
  background: rgba(20, 16, 26, .7); color: #fff; pointer-events: none;
}
#beat.pulse { animation: pulse .18s ease-out; }
#beat.strong { background: var(--grad); color: #1a0f14; }
@keyframes pulse { from { transform: scale(1.35); } to { transform: scale(1); } }

.transport { display: flex; align-items: center; gap: 12px; margin-top: 12px; }
#track { position: relative; flex: 1; height: 44px; touch-action: none; }
#track::before, #fill {
  content: ""; position: absolute; left: 0; top: 19px; height: 6px; border-radius: 3px;
}
#track::before { right: 0; background: var(--surface2); }
#fill { background: var(--grad); width: 0; }
#knob {
  position: absolute; top: 12px; width: 20px; height: 20px; margin-left: -10px; border-radius: 50%;
  background: #fff; box-shadow: 0 2px 6px rgba(0, 0, 0, .5);
}
#marks i { position: absolute; }
#marks .tick { top: 8px; width: 2px; height: 8px; margin-left: -1px; background: var(--muted); border-radius: 1px; }
#marks .dot { top: 31px; width: 8px; height: 8px; margin-left: -4px; border-radius: 50%; background: var(--practicing); }
#marks .reg { top: 15px; height: 14px; border-radius: 4px; }
#marks .reg.loop { background: rgba(92, 200, 255, .35); border: 1px solid var(--practicing); }
#marks .reg.trim { background: rgba(95, 224, 160, .25); border: 1px solid var(--mastered); }
#time { font-variant-numeric: tabular-nums; font-size: 14px; color: var(--muted); min-width: 44px; text-align: right; }

.tools { display: flex; gap: 10px; align-items: center; margin-top: 8px; }
.seg { display: flex; flex: 1; background: var(--surface); border-radius: 12px; padding: 3px; }
.seg button { flex: 1; padding: 8px 2px; border-radius: 9px; font-size: 13px; color: var(--muted); white-space: nowrap; }
.seg button.on { background: var(--surface2); color: var(--text); font-weight: 600; }
.seg button.on.unseen, .seg button.on.learning, .seg button.on.practicing, .seg button.on.mastered { color: #14101a; }
.loop { display: flex; gap: 6px; }
.loop .chip { min-width: 38px; padding: 7px 0; text-align: center; }

#tabs { display: flex; margin-top: 16px; border-bottom: 1px solid var(--line); }
#tabs button { flex: 1; padding: 10px 0; color: var(--muted); font-size: 15px; border-bottom: 2px solid transparent; margin-bottom: -1px; }
#tabs button.on { color: var(--text); font-weight: 600; border-color: var(--accent); }

#panel { padding-top: 16px; display: flex; flex-direction: column; gap: 14px; }
#panel label { font-size: 13px; color: var(--muted); display: block; margin-bottom: 6px; }
.row { display: flex; gap: 10px; align-items: center; }
.row > * { flex: 1; }
.row > .fix { flex: none; }
.emoji { width: 58px !important; text-align: center; font-size: 22px; padding: 8px 4px !important; }
.tags { display: flex; flex-wrap: wrap; gap: 8px; }
textarea { min-height: 52px; resize: none; overflow: hidden; display: block; }
.info { color: var(--muted); font-size: 14px; text-align: center; }

.tap {
  height: 120px; border-radius: 24px; font-size: 28px; font-weight: 800; color: #1a0f14;
  background: var(--grad); width: 100%;
}
.tap:active { transform: scale(.97); filter: brightness(1.15); }
.swatch { width: 34px; height: 34px; border-radius: 50%; flex: none !important; border: 3px solid transparent; }
.swatch.on { border-color: #fff; }

/* ---------- Feuilles ---------- */
.backdrop { position: fixed; inset: 0; background: rgba(0, 0, 0, .55); display: flex; align-items: flex-end; justify-content: center; z-index: 10; }
.sheet {
  width: 100%; max-width: 640px; background: var(--surface); border-radius: 22px 22px 0 0;
  padding: 20px 16px calc(env(safe-area-inset-bottom) + 20px); display: flex; flex-direction: column; gap: 12px;
  animation: up .2s ease-out;
}
.sheet h3 { margin: 0 0 4px; font-size: 18px; }
.sheet .btn { text-align: center; }
@keyframes up { from { transform: translateY(40px); opacity: 0; } }

#toast {
  position: fixed; left: 50%; bottom: calc(env(safe-area-inset-bottom) + 100px); transform: translateX(-50%);
  background: var(--surface2); padding: 10px 18px; border-radius: 999px; font-size: 14px; z-index: 20;
  box-shadow: 0 6px 20px rgba(0, 0, 0, .5);
}

/* ---------- Schémas de pas ---------- */
.steps { display: flex; flex-direction: column; gap: 10px; }
.seg button.on.lead { background: #2f74e0; color: #fff; }
.seg button.on.follow { background: #e0304f; color: #fff; }
.diagram { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.diagram.fig { grid-template-columns: repeat(2, 1fr); }
.dcell {
  display: flex; flex-direction: column; align-items: stretch; gap: 2px; padding: 6px 4px 8px; text-align: center;
  background: var(--surface); border: 1px solid var(--line); border-radius: 12px; min-width: 0;
}
.dcell svg { width: 100%; display: block; }
.dnum { font-weight: 800; font-size: 18px; color: var(--muted); line-height: 1; }
.dcell.strong .dnum { color: var(--accent2); }
.dtxt { font-size: 11px; line-height: 1.25; color: var(--text); overflow-wrap: anywhere; }
.dtxt.tl { color: #8fd0ff; }
.dtxt.tf { color: #ffa3b1; }
.dtxt.ta { color: #ffd84d; }
.diagram.fig .dtxt { font-size: 12px; text-align: left; padding: 0 4px; }

.sheet { max-height: 88vh; overflow-y: auto; }
.part { display: flex; flex-direction: column; gap: 8px; padding: 10px; border-radius: 14px; border: 1px solid var(--line); }
.part label { font-weight: 700; font-size: 14px; }
.part.lead label { color: #8fd0ff; }
.part.follow label { color: #ffa3b1; }
.part.arms label { color: #ffd84d; }
.part input[type=text] { background: var(--bg); }

/* ---------- Animation ---------- */
.player {
  position: fixed; inset: 0; z-index: 9; background: var(--bg); display: flex; flex-direction: column; gap: 8px;
  padding: calc(env(safe-area-inset-top) + 12px) 16px calc(env(safe-area-inset-bottom) + 16px);
}
.player .bar { margin: 0; }
.ptitle { font-weight: 700; font-size: 18px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.phead {
  align-self: center; max-width: 100%; padding: 8px 18px; border-radius: 999px; text-align: center;
  font-size: 21px; font-weight: 800; line-height: 1.2; background: var(--grad); color: #1a0f14;
}
.pstage { flex: 1; min-height: 0; background: var(--surface); border-radius: 18px; display: flex; justify-content: center; }
.pstage svg { height: 100%; max-width: 100%; }
.pfoot { transition: transform .3s ease, opacity .3s; }
.pfoot text { fill: #14101a; }
.pfoot.tap path { fill: transparent; stroke-dasharray: .2 .14; }
.pfoot.tap text { fill: #f4eef8; }
.pfoot:not(.tap) path { stroke-width: 0; }
.ptexts { display: flex; gap: 14px; align-items: center; min-height: 86px; }
.pnum {
  flex: none; width: 64px; height: 64px; border-radius: 18px; display: grid; place-items: center;
  font-size: 38px; font-weight: 800; background: var(--surface2);
}
.pnum.strong { background: var(--grad); color: #1a0f14; }
.plines { display: flex; flex-direction: column; gap: 3px; }
.plines .dtxt { font-size: 14px; }
.player .tools { justify-content: center; }
.player .tools .seg { flex: none; }
.player .tools .seg button { padding: 8px 12px; }
/* Couleur du niveau sur les vignettes de la liste */
.ithumb.unseen { box-shadow: inset 0 0 0 2px var(--unseen); background-color: rgba(141, 131, 153, .22); }
.ithumb.learning { box-shadow: inset 0 0 0 2px var(--learning); background-color: rgba(255, 179, 71, .22); }
.ithumb.practicing { box-shadow: inset 0 0 0 2px var(--practicing); background-color: rgba(92, 200, 255, .22); }
.ithumb.mastered { box-shadow: inset 0 0 0 2px var(--mastered); background-color: rgba(95, 224, 160, .22); }
#panel > .seg button { font-size: 12px; }

/* Éditeur d'un temps : le sol */
.floor { background: var(--bg); border: 1px solid var(--line); border-radius: 14px; touch-action: none; cursor: grab; }
.floor svg { display: block; width: 100%; max-height: 38vh; }
.part.hands label { color: #ffd84d; }
.hint { color: var(--muted); font-size: 14px; }
.part .btn { padding: 10px 14px; }

/* Animation : ligne chapitrée */
.ptl { position: relative; display: flex; gap: 3px; padding: 10px 0 22px; touch-action: none; cursor: pointer; }
.pseg { position: relative; height: 8px; border-radius: 4px; background: var(--surface2); min-width: 0; }
.pseg i { position: absolute; left: 0; top: 0; bottom: 0; width: 0; border-radius: 4px; background: var(--grad); }
.pseg b { position: absolute; left: 0; right: 0; top: 13px; text-align: center; font-size: 12px; color: var(--muted); }
.pseg.on b { color: var(--accent2); }
.pknob { position: absolute; top: 5px; width: 18px; height: 18px; margin-left: -9px; border-radius: 50%; background: #fff; box-shadow: 0 2px 6px rgba(0, 0, 0, .5); }
.pstage svg { transition: opacity .2s; }
/* ---------- Plusieurs vidéos ---------- */
#vids { padding: 0 0 10px; }
.gap-top { margin-top: 8px; }

/* ---------- Repères : préparation, transition, stylisme ---------- */
.tags-line { display: flex; flex-wrap: wrap; gap: 4px; justify-content: center; min-height: 0; }
.tags-line:empty { display: none; }
.tag { font-size: 10px; font-weight: 800; letter-spacing: .03em; text-transform: uppercase; padding: 2px 7px; border-radius: 999px; color: #14101a; }
.tag.prep { background: #ffd84d; }
.tag.trans { background: #c9a6ff; }
.tags-line.big { justify-content: flex-start; }
.tags-line.big .tag { font-size: 12px; padding: 3px 10px; }
.dcell.prep { border-color: #ffd84d; box-shadow: inset 0 0 0 1px #ffd84d; }
.dcell.trans { border-color: #c9a6ff; }
.dtxt.ts { color: #c9a6ff; }
.part.marks label, .part.hands > div > label { color: var(--muted); font-weight: 400; font-size: 13px; }
.part .seg button { font-size: 12px; padding: 8px 1px; }
.floor.bad { border-color: #ff6b6b; }

/* ---------- Animation : vidéo, temps de la phrase ---------- */
.pvideo { align-self: center; max-width: 100%; max-height: 26vh; border-radius: 14px; background: #000; }
.pdots { display: flex; justify-content: center; gap: 8px; }
.pdot {
  width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; font-size: 13px; font-weight: 800;
  background: var(--surface2); color: var(--muted); border: 2px solid transparent;
}
.pdot.acc { border-color: #ffd84d; color: #ffd84d; }
.pdot.on { background: var(--grad); color: #1a0f14; transform: scale(1.15); }
.player .plines { min-height: 84px; }
/* Schéma d'une figure : un temps par ligne, dessin à gauche, texte à droite */
.dleft, .dright { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.diagram.fig { grid-template-columns: 1fr; }
.diagram.fig .dcell { flex-direction: row; align-items: center; gap: 10px; padding: 8px; }
.diagram.fig .dleft { flex: 0 0 56%; }
.diagram.fig .dright { flex: 1; gap: 6px; }
.diagram.fig .dtxt { font-size: 13px; padding: 0; }
.diagram.fig .tags-line { justify-content: flex-start; }
.diagram.fig .dnum { text-align: left; padding-left: 4px; }
/* ---------- Genres, notes par temps ---------- */
.bar h2 small { font-size: 15px; font-weight: 600; -webkit-text-fill-color: var(--muted); color: var(--muted); letter-spacing: 0; }
.dtxt.tnote { color: #d8d0e2; }
.dtxt.tnote.question { color: #8fd0ff; }
.dtxt.tnote.corriger { color: #ff8a8a; }
.dtxt.tnote.prep { color: #ffd84d; }
.note { display: flex; flex-direction: column; gap: 6px; padding: 8px; border: 1px solid var(--line); border-radius: 12px; margin-bottom: 8px; }
.note .chip { padding: 4px 10px; font-size: 12px; }
.pnotes { display: flex; flex-direction: column; gap: 2px; }
.steps > .seg button { font-size: 13px; }
.player > .seg { align-self: center; flex: none; }
.player > .seg button { padding: 6px 14px; font-size: 13px; }
/* ---------- Embrassade : picto dans le coin ---------- */
.dleft { position: relative; }
.embrace { position: absolute; top: 0; right: 2px; font-size: 22px; line-height: 1; z-index: 1; }
.pstage { position: relative; }
.pstage .embrace { top: 10px; right: 12px; font-size: 30px; }
.pstage .taptag { position: absolute; top: 12px; left: 14px; z-index: 1; font-size: 15px; font-weight: 800; letter-spacing: .08em; color: #ffb52e; }
.bloc .tags .chip { padding: 5px 11px; font-size: 13px; }
/* ---------- Modifier un mouvement ---------- */
.dcell { position: relative; }
.dedit { position: absolute; right: 6px; bottom: 4px; font-size: 13px; color: var(--muted); }
.countnav h3 { flex: 1; text-align: center; margin: 0; }
.countnav .btn { font-size: 22px; padding: 6px 16px; }
/* ---------- Animation intégrée à la fiche ---------- */
.anim { display: flex; flex-direction: column; gap: 8px; }
.anim .pstage { flex: none; width: 100%; height: min(92vw, 46vh); }
.anim .pstage svg { width: 100%; height: 100%; }
.anim .phead { font-size: 18px; padding: 6px 16px; }
.anim .pdots { flex-wrap: wrap; row-gap: 6px; }
button.pdot { cursor: pointer; }
/* le texte a une hauteur fixe : sa longueur ne déplace ni ne déforme le cadre */
.anim .plines { height: 104px; min-height: 0; overflow-y: auto; }
.anim .plines .dtxt { font-size: 13px; }
.anim .tools { justify-content: center; flex-wrap: wrap; margin-top: 0; }
.anim .tools .seg { flex: none; }
.anim .tools .seg button { flex: none; padding: 8px 12px; max-width: 150px; overflow: hidden; text-overflow: ellipsis; }
.anim > .seg button { font-size: 13px; padding: 7px 2px; }
.pchap { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; }
.pchap .chip { min-width: 34px; padding: 5px 0; text-align: center; }
.picklist .row .btn:first-child { text-align: left; }
.anim.with-video .pstage { height: min(80vw, 30vh); }
.anim.with-video .plines { height: 64px; }

/* ---------- Boucle, son et recadrage de la vidéo ---------- */
.looplabel { font-size: 12px; color: var(--muted); align-self: center; }
.tools { flex-wrap: wrap; }
.soundrow { margin-top: 8px; }
.soundrow .seg button { font-size: 13px; overflow: hidden; text-overflow: ellipsis; }
#frame { overflow: hidden; }
#v { transform-origin: 50% 50%; }
input[type=range] { width: 100%; accent-color: var(--accent); }
/* ---------- Accueil : danses, cours, sorties ---------- */
h2.sec { margin: 26px 0 10px; font-size: 15px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }
.hero + h2.sec { margin-top: 0; }
.alist { display: flex; flex-direction: column; gap: 12px; }
.alist .style-card .sname { font-size: 18px; }
.style-card.past { opacity: .5; }
#agendaBody { display: flex; flex-direction: column; gap: 14px; padding-bottom: 30px; }
#agendaBody label { font-size: 13px; color: var(--muted); display: block; margin-bottom: 6px; }
#agendaBody h3.sub { margin: 12px 0 0; font-size: 18px; }
input[type=date], input[type=time], input[type=url], input[type=number] {
  width: 100%; padding: 12px 14px; border-radius: 12px; background: var(--surface); border: 1px solid var(--line);
  outline: none; -webkit-appearance: none; appearance: none; min-height: 46px; color-scheme: dark;
}
.session { gap: 12px; }
.session input, .session textarea { background: var(--bg); }
.svids { display: flex; flex-direction: column; gap: 10px; }
.svids:empty { display: none; }
.svid { display: flex; flex-direction: column; gap: 6px; }
.svid video { width: 100%; max-height: 46vh; border-radius: 12px; background: #000; }

/* ---------- Mouvements : difficulté, genre du style, réorganisation ---------- */
#ptitle { display: flex; align-items: center; gap: 8px; flex: 1; min-width: 0; }
#ptitle .ptext { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tag.level { flex: none; background: var(--surface2); color: var(--text); text-transform: none; letter-spacing: 0; font-weight: 600; }
.tag.level.deb { background: #5fe0a0; color: #14101a; }
.tag.level.int { background: #ffb347; color: #14101a; }
.tag.level.av { background: #ff6b6b; color: #14101a; }
.item .name { display: flex; align-items: center; gap: 8px; }
.item .name .tag { font-size: 10px; }
#styleGenre { flex: none; }
.item .ithumb { touch-action: none; -webkit-touch-callout: none; }
.item.dragging { opacity: .85; outline: 2px solid var(--accent); transform: scale(1.02); position: relative; z-index: 2; }
.loop { display: none; }
/* ---------- Trois points sur la vignette, socials ---------- */
.ithumb .dots {
  position: absolute; left: -6px; top: -6px; width: 24px; height: 24px; border-radius: 50%; font-style: normal;
  display: grid; place-items: center; font-size: 14px; line-height: 1; font-weight: 800;
  background: var(--surface2); color: var(--text); border: 1px solid var(--line);
}
.item { padding-left: 12px; }
.sheet label { font-size: 13px; color: var(--muted); display: block; margin-bottom: 6px; }
.sheet .seg button { font-size: 12px; }
.style-card.social { border-color: var(--accent2); }
.alist .row > .style-card { flex: 1; }
#home { padding-bottom: calc(env(safe-area-inset-bottom) + 40px); }

/* ---------- Cours, sorties, socials : fiche en lecture ---------- */
.rcard { background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 14px 16px; display: flex; flex-direction: column; gap: 10px; }
.rcard:empty { display: none; }
.rline { display: flex; flex-direction: column; gap: 2px; }
.rlabel { font-size: 12px; color: var(--muted); }
.rvalue { white-space: pre-wrap; overflow-wrap: anywhere; }
.rbig { font-size: 20px; font-weight: 800; flex: 1; }
.session .rline { padding: 0 2px; }
/* ---------- Liste : encart de maîtrise, tri, glisser pour retirer ---------- */
.mast { flex: none; padding: 7px 10px; border-radius: 10px; font-size: 12px; font-weight: 700; color: #14101a; min-width: 74px; text-align: center; }
.mast.unseen { background: var(--unseen); }
.mast.learning { background: var(--learning); }
.mast.practicing { background: var(--practicing); }
.mast.mastered { background: var(--mastered); }
.item { touch-action: pan-y; transition: transform .15s; padding-left: 8px; }
.item.swiping { transition: none; }
.item.will-remove { outline: 2px solid #ff6b6b; opacity: .6; }
.item .sub { display: flex; align-items: center; gap: 6px; }
.item .sub .tag { font-size: 10px; flex: none; }
.chip.sort { border-color: var(--accent2); color: var(--text); }
#home { padding-bottom: calc(env(safe-area-inset-bottom) + 100px); }
.libitem { display: flex; align-items: center; gap: 10px; text-align: left; }
.libitem img { width: 44px; height: 44px; border-radius: 8px; object-fit: cover; flex: none; }
/* ---------- Questionnaire de première ouverture ---------- */
.onboard {
  position: fixed; inset: 0; z-index: 8; background: var(--bg); overflow-y: auto;
  padding: calc(env(safe-area-inset-top) + 24px) 20px calc(env(safe-area-inset-bottom) + 28px);
}
.onboard .obody { max-width: 560px; margin: 0 auto; display: flex; flex-direction: column; gap: 16px; }
.onboard h2 { margin: 6px 0 4px; font-size: 26px; line-height: 1.2; font-weight: 800; }
.onboard label { font-size: 13px; color: var(--muted); display: block; margin-bottom: 6px; }
.onboard .info { text-align: left; margin: 0; }
.onboard .tags .chip { padding: 10px 16px; font-size: 16px; }
.onboard .couple { align-self: center; margin: 30px 0; font-size: 80px; }
.ostyles { display: flex; flex-direction: column; gap: 16px; }
.odots { display: flex; gap: 6px; max-width: 560px; margin: 0 auto 22px; }
.odots i { flex: 1; height: 4px; border-radius: 2px; background: var(--surface2); }
.odots i.on { background: var(--grad); }
.obtns { margin-top: 10px; }

/* Pastilles de maîtrise de la liste : couleur de la maîtrise quand elles sont actives */
.chip.on.unseen { background: var(--unseen); }
.chip.on.learning { background: var(--learning); }
.chip.on.practicing { background: var(--practicing); }
.chip.on.mastered { background: var(--mastered); }
/* ================= Refonte : onglets, accueil, liste, lecture, thème ================= */

/* ---------- Barre d'onglets ---------- */
#tabbar {
  display: none; position: fixed; left: 0; right: 0; bottom: 0; z-index: 5;
  background: var(--surface); border-top: 1px solid var(--line);
  padding: 6px 8px calc(env(safe-area-inset-bottom) + 6px);
}
body.tabs #tabbar { display: flex; }
#tabbar button { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 6px 0; font-size: 12px; color: var(--muted); border-radius: 12px; }
#tabbar button i { font-style: normal; font-size: 20px; line-height: 1; filter: grayscale(1); opacity: .7; }
#tabbar button.on { color: var(--text); font-weight: 700; }
#tabbar button.on i { filter: none; opacity: 1; }
body.tabs .view { padding-bottom: calc(env(safe-area-inset-bottom) + 150px); }
.tabfab { bottom: calc(env(safe-area-inset-bottom) + 84px); }
.tabtitle {
  margin: 8px 0 18px; font-size: 30px; font-weight: 800; letter-spacing: -.02em;
  background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent;
}

/* ---------- Accueil ---------- */
.hero { position: relative; margin: 6px 0 14px; }
.hero .couple { font-size: 46px; }
.hero h1 { font-size: 26px; }
#settingsBtn { position: absolute; right: -6px; top: -4px; }
.swhen { font-size: 13px; font-weight: 700; color: var(--accent2); }
.pbar { display: flex; height: 8px; border-radius: 4px; overflow: hidden; background: var(--surface2); margin: 4px 0; }
.pbar i { display: block; height: 100%; }
.pbar .mastered { background: var(--mastered); }
.pbar .practicing { background: var(--practicing); }
.pbar .learning { background: var(--learning); }
.alist .swipe { width: 100%; }
#dash .item { width: 100%; }

/* ---------- Style : onglets Pas / Figures / Chorégraphies plus visibles ---------- */
#kinds { padding: 4px; }
#kinds button { padding: 13px 4px; font-size: 15px; font-weight: 600; }
#kinds button.on { background: var(--grad); color: #1a0f14; }
#kinds button.on small { color: #1a0f14; opacity: .7; }
/* quatre types : deux lignes de deux */
#kinds { display: grid; grid-template-columns: 1fr 1fr; gap: 3px; }
#kinds button { padding: 11px 4px; }

/* ---------- Variantes d'un mouvement ---------- */
.seg.vars { margin-bottom: 10px; flex-wrap: wrap; }
.seg.vars button { flex: 1 0 auto; padding: 8px 10px; }
.variants { display: flex; flex-direction: column; gap: 8px; }
.variant { display: flex; flex-direction: column; gap: 8px; padding: 8px; border-radius: 12px; background: var(--surface); border: 1px solid var(--line); }
.variant.on { border-color: var(--accent2); }
.variant .row { align-items: center; }
.variant .row input { flex: 1; min-width: 0; }
.variant .chip { flex: none; }

/* ---------- Vignette : nom sur deux lignes, oriflamme de maîtrise, « Supprimer » sous la vignette ---------- */
.swipe { position: relative; border-radius: 16px; background: #c7384a; }
.swipe-del { position: absolute; right: 16px; top: 0; bottom: 0; display: grid; place-items: center; color: #fff; font-weight: 800; font-size: 14px; }
.swipe .item { position: relative; overflow: hidden; padding: 8px 0 8px 8px; align-items: stretch; gap: 10px; }
.item .ithumb { align-self: center; }
.item .itext { justify-content: center; padding: 2px 0; }
.item .name { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; white-space: normal; line-height: 1.2; overflow: hidden; }
.aka { font-weight: 400; color: var(--muted); }
.ptext .aka { font-size: .8em; }
/* Chorégraphie : vignette teintée, liseré dégradé et miniature arrondie, pour la distinguer des pas */
.item.choreo { background: linear-gradient(100deg, rgba(255, 92, 122, .16), rgba(255, 154, 77, .07) 60%, transparent), var(--surface); }
.item.choreo::before { content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 4px; background: var(--grad); }
.item.choreo .ithumb { border-radius: 50%; }
.mast {
  align-self: stretch; margin: -8px 0; border-radius: 0; min-width: 0; width: 88px; flex: none;
  display: grid; place-items: center; padding: 0 8px 0 20px; font-size: 12px; line-height: 1.15;
  clip-path: polygon(0 0, 100% 0, 100% 100%, 0 100%, 13px 50%);   /* queue-de-pie */
}

/* ---------- Fiche en lecture ---------- */
#panel.read .editonly { display: none; }
#panel .rcard { gap: 12px; }

/* ---------- Trois familles de commandes : filtres d'affichage (discrets), réglages (segments), actions (boutons) ---------- */
.pfilters { display: flex; flex-direction: column; gap: 6px; align-items: center; }
.seg.filter { background: none; padding: 0; gap: 6px; flex: none; justify-content: center; }
.seg.filter button { flex: none; padding: 5px 12px; border-radius: 999px; font-size: 12px; border: 1px solid var(--line); color: var(--muted); background: none; }
.seg.filter button.on { border-color: var(--accent2); color: var(--accent2); background: none; font-weight: 600; }

/* ---------- Feuilles : poignée ; éditeur d'un temps en plein écran ---------- */
.grip { align-self: center; width: 44px; height: 5px; border-radius: 3px; background: var(--line); margin: -8px 0 4px; touch-action: none; padding: 0; flex: none; box-sizing: content-box; border: 10px solid transparent; background-clip: padding-box; }
.sheet.full { height: 100dvh; max-height: 100dvh; border-radius: 0; padding-top: calc(env(safe-area-inset-top) + 16px); }
.sheet.full .floor svg { max-height: 50vh; }

/* ---------- Messages : annulation ---------- */
#toast { display: flex; align-items: center; gap: 14px; }
#toast[hidden] { display: none !important; }
#toast .undo { color: var(--accent2); font-weight: 800; }
body.tabs #toast { bottom: calc(env(safe-area-inset-bottom) + 150px); }

/* ---------- Questionnaire : choix du rôle ---------- */
.orole .btn { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 22px 8px; font-size: 17px; }
.orole .big { font-size: 54px; line-height: 1; }

/* ---------- Thème clair : seules les scènes de danse restent sombres ---------- */
:root[data-theme=light] {
  --bg: #f6f1f7; --surface: #ffffff; --surface2: #ece4f0; --line: #d9cfe0; --text: #1d1524; --muted: #6c5f7a;
}
:root[data-theme=light] .pstage, :root[data-theme=light] .dcell svg, :root[data-theme=light] .floor { background: #211a2b; }
:root[data-theme=light] .dcell svg { border-radius: 10px; }
:root[data-theme=light] .dtxt.tl { color: #1f5fc4; }
:root[data-theme=light] .dtxt.tf { color: #c2243f; }
:root[data-theme=light] .dtxt.ta { color: #94700a; }
:root[data-theme=light] .dtxt.ts { color: #6d3fb5; }
:root[data-theme=light] .dtxt.tnote { color: #4a3f57; }
:root[data-theme=light] .part.lead label { color: #1f5fc4; }
:root[data-theme=light] .part.follow label { color: #c2243f; }
:root[data-theme=light] .part.arms label, :root[data-theme=light] .part.hands label { color: #94700a; }
:root[data-theme=light] .pdot.acc { border-color: #c79a12; color: #94700a; }
:root[data-theme=light] .backdrop { background: rgba(40, 25, 50, .35); }
:root[data-theme=light] .btn.danger { border-color: #f0b8c0; color: #c2243f; }
:root[data-theme=light] input[type=date], :root[data-theme=light] input[type=time], :root[data-theme=light] input[type=url], :root[data-theme=light] input[type=number] { color-scheme: light; }
:root[data-theme=light] #stage { background: #000; }
/* ---------- « ＋ » au centre de la barre du bas ---------- */
#tabbar { align-items: center; }
#tabbar #tabAdd {
  flex: none; width: 54px; height: 54px; margin: -22px 6px 0; border-radius: 50%; padding: 0;
  display: grid; place-items: center; font-size: 28px; line-height: 1; color: #1a0f14;
  background: var(--grad); box-shadow: 0 6px 18px rgba(255, 92, 122, .4); border: 4px solid var(--bg);
}
#list { padding-bottom: 20px; }
/* ---------- Corrections d'affichage ---------- */
/* la barre d'état de l'iPhone garde un fond : le contenu qui défile ne passe plus dessous */
body::before {
  content: ''; position: fixed; top: 0; left: 0; right: 0; height: env(safe-area-inset-top); z-index: 7;
  background: var(--bg); pointer-events: none;
}
/* le bandeau « Préparation » ne se superpose plus au texte du temps */
.anim .plines > * { flex-shrink: 0; }

/* ---------- Temps : discrets (le 4 et le 8 en salsa) ---------- */
.pdot.quiet { width: 24px; height: 24px; font-size: 11px; opacity: .55; align-self: center; }
.pdot.quiet.on { opacity: 1; }
.dcell.quiet .dnum { font-size: 14px; opacity: .5; }
#beat.quiet { min-width: 40px; height: 40px; font-size: 22px; opacity: .6; }
.count.quiet span { opacity: .45; }

/* ---------- Barre de lecture : numéros des temps, poignées de découpe ---------- */
#marks .tick.num {
  top: -3px; width: 22px; height: 22px; margin-left: -11px; border-radius: 50%; font-style: normal;
  display: grid; place-items: center; font-size: 11px; font-weight: 800; line-height: 1;
  background: var(--surface2); color: var(--text); border: 2px solid var(--line); cursor: grab; z-index: 2;
}
#marks .tick.num.acc { border-color: #ffd84d; color: #ffd84d; }
#marks .tick.num.quiet { width: 16px; height: 16px; margin-left: -8px; top: 0; font-size: 9px; opacity: .6; }
#marks .handle {
  top: 6px; width: 16px; height: 32px; margin-left: -8px; border-radius: 6px; z-index: 2; cursor: ew-resize;
  background: var(--mastered); box-shadow: 0 2px 6px rgba(0, 0, 0, .4);
}
#marks .handle::after { content: ''; position: absolute; left: 6px; top: 8px; bottom: 8px; width: 4px; border-left: 1px solid #14101a; border-right: 1px solid #14101a; }
#track { touch-action: none; }

/* ---------- Chorégraphie : vidéos dans la succession, lecture enchaînée ---------- */
.vbloc { padding: 8px 12px; }
.vbloc .vname { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cvideo { width: 100%; max-height: 55vh; border-radius: 14px; background: #000; }
.player .pchap { justify-content: flex-start; }
.player .pchap .chip { min-width: 0; padding: 6px 12px; }
.player .pchap .chip.on { background: var(--grad); color: #1a0f14; border-color: transparent; }