@font-face { font-family: Satoshi; font-weight: 400; font-style: normal; font-display: swap; src: url(fonts/Satoshi-Regular.ttf) format('truetype'); }
@font-face { font-family: Satoshi; font-weight: 500; font-style: normal; font-display: swap; src: url(fonts/Satoshi-Medium.ttf) format('truetype'); }
@font-face { font-family: Satoshi; font-weight: 700; font-style: normal; font-display: swap; src: url(fonts/Satoshi-Bold.ttf) format('truetype'); }
@font-face { font-family: Satoshi; font-weight: 900; font-style: normal; font-display: swap; src: url(fonts/Satoshi-Black.ttf) format('truetype'); }
:root { color-scheme: light dark; --bg: #fff; --fg: #000; --dim: #6e6e73; --card: #f2f2f7; --card2: #e5e5ea; --weak: #8e8e93;
  --rose: #e0567a; --violet: #8a6fd8; --bleu: #3d8bd9; --vert: #2f9e8f; --count: var(--rose); }
@media (prefers-color-scheme: dark) { :root { --bg: #000; --fg: #fff; --dim: #8e8e93; --card: #1c1c1e; --card2: #2c2c2e; } }
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--fg); font: 16px/1.4 Satoshi, -apple-system, system-ui, sans-serif; }
#app { max-width: 560px; margin: 0 auto; padding: 12px 20px 28px; height: 100dvh; display: flex; flex-direction: column; gap: 12px; overflow-y: auto; }
header { display: flex; justify-content: space-between; align-items: center; flex: none; }
h1 { font-size: 26px; line-height: 1.1; margin: 0; font-weight: 900; letter-spacing: -.01em; font-family: Satoshi, -apple-system, system-ui, sans-serif; min-width: 0; }
h2 { margin: 0; font-size: 20px; } h3 { margin: 18px 0 6px; font-size: 13px; color: var(--dim); font-weight: 600; text-transform: uppercase; letter-spacing: .06em; }
button, select, input { font: inherit; color: inherit; }
button { background: var(--card2); border: 0; border-radius: 12px; padding: 10px 14px; cursor: pointer; }
button:focus-visible, input:focus-visible, select:focus-visible, .cell:focus-visible { outline: 3px solid var(--bleu); outline-offset: 2px; }
button:disabled, input:disabled { opacity: .45; cursor: default; }
.ghost { background: none; font-size: 24px; padding: 6px 10px; }
.nomeBtn { background: none; width: 48px; height: 48px; padding: 2px; border-radius: 50%; } .nomeImg { width: 100%; height: 100%; display: block; border-radius: 50%; border: 2px solid #C8862E; background: #FFFAF3; object-fit: cover; image-rendering: pixelated; }
.nomeHead { display: flex; align-items: center; gap: 12px; margin-bottom: 10px; } .nomeBig { width: 52px; height: 52px; }
.tempo { text-align: center; flex: none; }
#bpm { width: 100%; background: none; border: 0; text-align: center; font-size: clamp(48px, 18vw, 88px); font-weight: 900; font-variant-numeric: tabular-nums; padding: 0; }
.unit { color: var(--dim); font-size: 13px; text-align: center; }
.row { display: flex; align-items: center; gap: 16px; margin-top: 8px; }
.round { width: 44px; height: 44px; border-radius: 50%; padding: 0; font-size: 24px; flex: none; }
input[type=range] { flex: 1; accent-color: var(--fg); }
.meter { display: flex; flex-direction: column; align-items: center; flex: none; }
.sig { width: 130px; background: none; border: 0; text-align: center; font-weight: 800; font-variant-numeric: tabular-nums; padding: 0; line-height: 1.1; font-size: 52px; }
.bar { width: 160px; height: 3px; background: var(--fg); border-radius: 2px; }
.countStrip { display: flex; gap: 8px; justify-content: center; align-items: center; flex: none; min-height: 18px; flex-wrap: wrap; color: var(--count); font-weight: 700; font-size: 13px; }
.dot { width: 16px; height: 16px; border-radius: 50%; border: 2px solid var(--count); } .dot.on { background: var(--count); }
.chip { align-self: center; background: color-mix(in srgb, var(--bleu) 20%, transparent); font-weight: 700; font-size: 13px; padding: 6px 12px; border-radius: 99px; flex: none; }
.grid { position: relative; overflow-y: auto; overscroll-behavior: contain; touch-action: pan-y; flex: 1 1 140px; min-height: 120px; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; }
.vinner { position: relative; }
.vrow { display: flex; gap: 8px; align-items: center; }
.cell { border-radius: 10px; border: 1px solid color-mix(in srgb, var(--fg) 35%, transparent); background: transparent; padding: 0; flex: none; position: relative; }
.cell.s1 { background: var(--fg); border-color: var(--fg); } .cell.s2 { background: var(--weak); border-color: var(--weak); }
.cell.active { box-shadow: 0 0 0 4px var(--bleu); }
.cell.sel { outline: 3px solid var(--bleu); outline-offset: -1px; }
.cell.out { opacity: .35; }
.cell .n { position: absolute; top: 2px; left: 4px; font-size: 9px; font-weight: 700; color: var(--weak); pointer-events: none; } .cell.s1 .n { color: var(--bg); }
.gap { flex: none; }
/* fichier MIDI : une mesure = un bloc, petite ligne sautée entre deux mesures */
.mcell { border-radius: 4px; background: color-mix(in srgb, var(--fg) 10%, transparent); flex: none; } .mcell.v1 { background: var(--fg); } .mcell.v2 { background: var(--weak); } .mcell.beat { box-shadow: inset 2px 0 0 color-mix(in srgb, var(--fg) 35%, transparent); }
.mcell.active { background: var(--bleu); } .mlabel { position: absolute; left: 0; top: -13px; font-size: 10px; font-weight: 700; color: var(--dim); pointer-events: none; }
.mrow { cursor: pointer; gap: 0; } .mrow.entry .mcell { outline: 0; } .mrow.entry .mlabel { color: var(--vert); } .mrow.inloop { background: color-mix(in srgb, var(--bleu) 14%, transparent); border-radius: 6px; }
.mrow.entry::before { content: ''; position: absolute; left: -6px; top: 0; bottom: 0; width: 3px; background: var(--vert); border-radius: 2px; }
.play { margin-top: auto; height: 76px; border-radius: 24px; background: var(--fg); color: var(--bg); font-size: 32px; flex: none; }
.note { color: var(--dim); font-size: 13px; text-align: center; margin: 0; min-height: 1.2em; flex: none; } .note.left { text-align: left; min-height: 0; margin: 6px 0; } .notice { color: var(--rose); }
.settings { background: var(--card); border-radius: 18px; padding: 18px; flex: none; }
.settings label { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 6px 0; }
.settings .inline { display: flex; gap: 10px; align-items: center; margin: 8px 0; flex-wrap: wrap; }
.settings input[type=text], .settings input[type=number], .settings select { background: var(--card2); border: 0; border-radius: 10px; padding: 9px 12px; }
.settings input[type=text] { flex: 1; min-width: 0; } .settings input[type=number] { width: 80px; }
.fileBtn { background: var(--card2); border-radius: 12px; padding: 10px 14px; cursor: pointer; display: inline-block; }
.presets { list-style: none; padding: 0; margin: 0; }
.presets li { display: flex; align-items: center; gap: 8px; padding: 6px 0; border-bottom: 1px solid var(--card2); }
.presets li button.load { flex: 1; text-align: left; background: none; padding: 6px 0; } .presets .meta { color: var(--dim); font-size: 13px; }
.presets .del { background: none; color: var(--rose); padding: 6px 8px; }
.tag { font-size: 11px; font-weight: 700; color: var(--violet); border: 1px solid var(--violet); border-radius: 99px; padding: 1px 7px; }
.stage { position: fixed; inset: 0; background: var(--bg); z-index: 10; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; padding: 20px; }
.stage[hidden] { display: none; } .stage #stageClose { position: absolute; top: 12px; right: 12px; }
.stageTempo { font-size: clamp(64px, 26vw, 200px); font-weight: 900; font-variant-numeric: tabular-nums; line-height: 1; white-space: nowrap; }
.stageMeter { display: flex; flex-direction: column; align-items: center; font-weight: 800; font-size: clamp(40px, 14vw, 90px); line-height: 1.05; } .stageMeter i { width: 70%; min-width: 120px; height: 5px; background: var(--fg); border-radius: 3px; align-self: stretch; }
.stagePos { font-size: clamp(60px, 22vw, 160px); font-weight: 900; min-height: 1.1em; font-variant-numeric: tabular-nums; } .stagePos.count { color: var(--count); }
.stage .play { width: min(100%, 520px); margin-top: 12px; }
body.drag #app { outline: 3px dashed var(--bleu); outline-offset: -10px; }

.editBar { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; flex: none; }
.chip2 { background: color-mix(in srgb, var(--fg) 9%, transparent); border-radius: 99px; padding: 6px 12px; font-size: 13px; font-weight: 700; } .chip2[aria-pressed=true] { background: var(--bleu); color: #fff; }
.dlg { border: 0; border-radius: 18px; background: var(--card); color: var(--fg); padding: 18px; max-width: min(92vw, 460px); width: 100%; } .dlg::backdrop { background: rgba(0,0,0,.45); }
.dlg label { display: flex; align-items: center; gap: 8px; margin: 8px 0; flex-wrap: wrap; } .dlg input[type=number], .dlg input[type=text] { background: var(--card2); border: 0; border-radius: 10px; padding: 8px 10px; width: 90px; } .dlg input[type=text] { width: 140px; }
.dlg .inline { display: flex; gap: 8px; flex-wrap: wrap; margin: 8px 0; }
.mcell.edit { outline: 1px solid color-mix(in srgb, var(--bleu) 55%, transparent); cursor: pointer; }
.credit { font-size: 11px; }

h1 { display: flex; align-items: center; gap: 8px; } .logoWrap { width: 36px; height: 36px; flex: none; display: inline-block; } .logo { width: 100%; height: 100%; display: block; }
.logo .swing { animation: swing var(--beat, 1s) ease-in-out infinite alternate; animation-play-state: paused; transform: rotate(-18deg); }
@keyframes swing { from { transform: rotate(-18deg); } to { transform: rotate(18deg); } }
.playing .logo .swing { animation-play-state: running; }
.idle .logo .swing { animation: swing 2.4s ease-in-out infinite alternate; animation-play-state: running; opacity: .9; }  /* décorative à l'arrêt, très lente */
@media (prefers-reduced-motion: reduce) { .logo .swing, .idle .logo .swing { animation: none; transform: rotate(-12deg); } }

.follow { align-self: center; background: var(--bleu); color: #fff; flex: none; }
.pitchGrid { display: grid; grid-template-columns: 1fr auto auto; gap: 6px 10px; align-items: center; } .pitchGrid input { width: 78px; background: var(--card2); border: 0; border-radius: 10px; padding: 8px 10px; }
.pitchGrid small { color: var(--dim); font-size: 11px; display: block; }

.sigRow { display: flex; align-items: center; gap: 8px; } .meter .bar { width: 230px; }
#bpm, .sig { touch-action: none; cursor: ns-resize; user-select: none; -webkit-user-select: none; caret-color: transparent; } #bpm[data-editing], .sig[data-editing] { cursor: text; user-select: text; -webkit-user-select: text; caret-color: auto; outline: 3px solid var(--bleu); border-radius: 12px; touch-action: auto; }
.round { touch-action: manipulation; user-select: none; -webkit-user-select: none; }

.workPanel { display: flex; flex-direction: column; gap: 8px; flex: 1 1 auto; min-height: 0; } .workHead { display: flex; flex-direction: column; align-items: center; }
.workBig { text-align: center; font-size: clamp(60px, 22vw, 120px); font-weight: 900; line-height: 1; font-variant-numeric: tabular-nums; } .workBig.count { color: var(--count); }
.workGrid { flex: 1 1 160px; } .workGrid .brow { display: flex; align-items: center; gap: 12px; padding: 0 8px; border-radius: 8px; cursor: pointer; } .brow .lab { width: 64px; text-align: right; font-size: 22px; font-weight: 700; font-variant-numeric: tabular-nums; }
.brow .info { font-size: 12px; font-weight: 700; color: var(--dim); } .brow .flag { color: var(--vert); } .brow.cur { background: color-mix(in srgb, var(--bleu) 16%, transparent); } .brow.cur .lab { color: var(--bleu); } .brow.start { background: color-mix(in srgb, var(--vert) 14%, transparent); }
.brow.seg { border-top: 1px solid color-mix(in srgb, var(--fg) 15%, transparent); }
#workPart { background: var(--card2); border: 0; border-radius: 99px; padding: 6px 12px; font-weight: 700; font-size: 13px; }
body.workMode .tempo, body.workMode .meter, body.workMode #grid, body.workMode #editBar, body.workMode #loopChip, body.workMode #trackNote, body.workMode #countStrip { display: none; }

.bpmView { display: flex; justify-content: center; align-items: baseline; gap: 6px; font-size: clamp(48px, 18vw, 88px); font-weight: 900; font-variant-numeric: tabular-nums; line-height: 1.15; }
.zone { padding: 0 .1em; border-radius: 16px; background: color-mix(in srgb, var(--fg) 6%, transparent); touch-action: none; cursor: ns-resize; user-select: none; -webkit-user-select: none; outline: 3px solid transparent; transition: background .1s; }
.zone.small { font-size: .5em; } .zone.dim { color: var(--dim); } .zone.active { background: color-mix(in srgb, var(--bleu) 22%, transparent); outline-color: var(--bleu); }
.bpmView[hidden], #bpm[hidden] { display: none; }

/* œuvre : tempo et signature en grand, numéro de mesure petit sur le côté, carrés des temps */
.workHead2 { display: flex; align-items: center; justify-content: center; gap: 14px; }
.wBar { width: 70px; display: flex; flex-direction: column; line-height: 1.1; } .wBar b { font-size: 22px; font-variant-numeric: tabular-nums; color: var(--dim); } .wBar b.live { color: var(--bleu); } .wBar small { font-size: 11px; color: var(--dim); }
.wTempo { font-size: clamp(44px, 17vw, 80px); font-weight: 900; font-variant-numeric: tabular-nums; line-height: 1; }
.wSig { display: flex; flex-direction: column; align-items: center; font-size: clamp(28px, 10vw, 44px); font-weight: 900; line-height: 1.05; } .wSig i { align-self: stretch; height: 3px; background: var(--fg); border-radius: 2px; }
.sqs { display: flex; gap: 4px; flex: none; max-width: 55%; overflow: hidden; } .sq { display: block; width: 22px; height: 22px; border-radius: 6px; border: 2px solid transparent; cursor: pointer; flex: none; }
.sq.a1 { background: var(--fg); } .sq.a2 { background: color-mix(in srgb, var(--fg) 45%, transparent); } .sq.a0 { background: transparent; border: 2px dashed color-mix(in srgb, var(--fg) 35%, transparent); }
#speedQuick button[aria-pressed=true] { background: var(--bleu); color: #fff; }
/* libellés texte à côté des pictogrammes (valeur de data-t, ajoutée par applyStrings) */
[data-lt]::after { content: attr(data-lt); margin-left: 6px; font-weight: 700; }
summary[data-lt] { font-size: 17px; } summary[data-lt]::after { font-size: 17px; }

.brand { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.freeNote { display: flex; align-items: center; gap: 10px; flex: none; border-radius: 14px; padding: 8px 8px 8px 12px; background: color-mix(in srgb, var(--violet) 16%, transparent); font-size: 14px; font-weight: 500; line-height: 1.3; }
.freeNote[data-kind=rounded] { background: color-mix(in srgb, var(--count) 16%, transparent); }
.freeNote[hidden] { display: none; } .freeNote > #freeMsg { flex: 1; min-width: 0; }
.freeIcon { font-weight: 900; font-size: 11px; letter-spacing: .06em; color: #fff; background: var(--violet); border-radius: 99px; padding: 2px 8px; flex: none; }
.freeNote.min { align-self: flex-start; background: none; padding: 0; } .freeNote.min #freeMsg, .freeNote.min #freeClose { display: none; }
.workPanel[hidden] { display: none; }
.freeNote[data-kind=rounded] .freeIcon { background: none; color: var(--count); font-size: 20px; padding: 0; }
.freeNote .ghost { font-size: 16px; padding: 4px 10px; flex: none; }
header { gap: 8px; } header > * { flex: none; } header > h1 { flex: 0 1 auto; }

/* tPercussion : équivalents CSP des attributs style= retirés */
.cnt{color:var(--count)}
.logo .swing{transform-origin:256px 387px}
