:root {
  --bg: #111318; --panel: #1b1e26; --panel2: #232733; --line: #2f3442; --text: #eef0f4; --muted: #9aa1b2;
  --accent: #f5b942; --accent-ink: #111318; --doubt: #e8893a; --ok: #4cc38a; --danger: #ef5b5b;
  --chord: #ffffff; --radius: 12px;
  color-scheme: dark;
}
:root[data-theme="light"] {
  --bg: #f6f6f3; --panel: #ffffff; --panel2: #eeeee9; --line: #d9d9d2; --text: #16181d; --muted: #6b7080;
  --accent: #b7791f; --accent-ink: #ffffff; --doubt: #d9731f; --ok: #1f9d63; --danger: #d63c3c; --chord: #111318;
  color-scheme: light;
}
:root[data-theme="light"] .top { background: rgba(246,246,243,.94); }
:root[data-theme="light"] .banner { background: #fff1dc; color: #7a4a0c; }
.btn.spotify { background: #1db954; border-color: #1db954; color: #fff; font-weight: 650; }
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); font: 16px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; }
body { padding: env(safe-area-inset-top) 0 env(safe-area-inset-bottom); -webkit-text-size-adjust: 100%; }
a { color: var(--accent); text-decoration: none; }
button, select, input, textarea { font: inherit; color: inherit; }
.loading { padding: 40px 16px; color: var(--muted); text-align: center; }

.top { position: sticky; top: 0; z-index: 10; display: flex; align-items: center; gap: 10px; padding: 10px 16px;
  background: rgba(17,19,24,.94); backdrop-filter: blur(10px); border-bottom: 1px solid var(--line); }
.top h1 { flex: 1; margin: 0; font-size: 17px; font-weight: 650; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.brand { font-weight: 800; letter-spacing: .2px; color: var(--accent); }
.back { font-size: 22px; line-height: 1; padding: 4px 8px 4px 0; color: var(--text); }
.wrap { max-width: 860px; margin: 0 auto; padding: 14px 16px 90px; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 42px; padding: 0 14px;
  border: 1px solid var(--line); border-radius: 10px; background: var(--panel2); cursor: pointer; }
.btn.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); font-weight: 650; }
.btn.small { min-height: 34px; padding: 0 10px; font-size: 14px; }
.btn.ghost { background: transparent; }
.btn.danger { color: var(--danger); }
.btn:disabled { opacity: .5; }
.field { display: block; margin: 0 0 14px; }
.field span { display: block; margin-bottom: 6px; color: var(--muted); font-size: 14px; }
.field input, .field select, .field textarea, select.sel { width: 100%; min-height: 44px; padding: 10px 12px; border-radius: 10px;
  border: 1px solid var(--line); background: var(--panel); }
textarea { resize: vertical; }
.err { color: var(--danger); min-height: 1.4em; }
.muted { color: var(--muted); }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; }
.join { max-width: 420px; margin: 8vh auto 0; padding: 0 16px; }
.join h2 { margin: 0 0 4px; font-size: 26px; }
.logo { font-size: 30px; font-weight: 800; color: var(--accent); margin-bottom: 18px; }

.songs { list-style: none; margin: 0; padding: 0; }
.songs li a { display: flex; align-items: center; gap: 14px; padding: 14px; margin-bottom: 8px; border-radius: var(--radius);
  background: var(--panel); border: 1px solid var(--line); color: var(--text); }
.songs .num { width: 30px; height: 30px; flex: none; display: grid; place-items: center; border-radius: 8px; background: var(--panel2); color: var(--accent); font-weight: 700; }
.songs .t { flex: 1; min-width: 0; }
.songs .t b { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.songs .t small { color: var(--muted); }
.songs .k { font-weight: 700; color: var(--accent); }

.bar-tools { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 4px 0 12px; }
.bar-tools select { min-height: 40px; padding: 6px 10px; border-radius: 10px; border: 1px solid var(--line); background: var(--panel); }
.keypick { display: flex; align-items: center; gap: 4px; }
.keypick .btn { min-width: 40px; padding: 0; }
.meta { display: flex; flex-wrap: wrap; gap: 6px 14px; color: var(--muted); font-size: 14px; margin-bottom: 10px; }
.meta b { color: var(--text); }
.note { font-size: 14px; color: var(--muted); border-left: 3px solid var(--accent); padding: 4px 10px; margin: 8px 0 14px; }
.yt { position: relative; aspect-ratio: 16/9; border-radius: var(--radius); overflow: hidden; background: #000; margin-bottom: 12px; }
.yt iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }

.tabs { display: flex; gap: 6px; margin: 16px 0 10px; border-bottom: 1px solid var(--line); }
.tabs button { background: none; border: 0; padding: 10px 12px; color: var(--muted); border-bottom: 2px solid transparent; cursor: pointer; }
.tabs button.on { color: var(--text); border-color: var(--accent); }

.sec { margin: 0 0 18px; }
.sec h3 { display: flex; align-items: baseline; gap: 8px; margin: 0 0 6px; font-size: 15px; color: var(--accent); }
.sec h3 small { color: var(--muted); font-weight: 400; }
.sec h3 .ver { margin-left: auto; font-size: 12px; color: var(--ok); font-weight: 600; }
.grid { display: grid; grid-template-columns: repeat(4, 1fr); border-left: 2px solid var(--line); }
.cell { position: relative; min-height: 52px; padding: 8px 6px; border-right: 2px solid var(--line); border-top: 1px solid var(--line); border-bottom: 1px solid var(--line);
  display: flex; align-items: center; justify-content: space-around; gap: 4px; flex-wrap: wrap; font-weight: 700; font-size: 19px; color: var(--chord); }
.cell .n { position: absolute; top: 2px; left: 4px; font-size: 10px; font-weight: 400; color: var(--muted); }
.cell .sl { color: var(--muted); font-weight: 400; }
.cell sup { font-size: .62em; font-weight: 600; }
.cell.doubt { background: rgba(232,137,58,.16); box-shadow: inset 0 0 0 1px var(--doubt); }
.cell.edit { cursor: pointer; }
.cell.edit:hover { background: var(--panel2); }
.cell.add { color: var(--muted); font-size: 24px; font-weight: 400; cursor: pointer; }
@media (min-width: 700px) { .grid { grid-template-columns: repeat(8, 1fr); } .cell { font-size: 18px; } }

.part h4 { margin: 14px 0 4px; font-size: 14px; color: var(--accent); }
.part .txt { white-space: pre-wrap; }
.abc { background: #fff; color: #111; border-radius: 10px; margin: 6px 0; overflow: hidden; }
.abc svg { max-width: 100%; }
.files { list-style: none; padding: 0; }
.files li { display: flex; gap: 8px; align-items: center; padding: 8px 0; border-bottom: 1px solid var(--line); }
.files li a { flex: 1; }
.banner { position: sticky; top: 56px; z-index: 9; margin: 0 0 12px; padding: 10px 12px; border-radius: 10px; background: #3a2a14; color: #ffd9a0; }
.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); background: var(--panel2); border: 1px solid var(--line); padding: 10px 16px; border-radius: 10px; z-index: 50; }

.edit-sec { border: 1px solid var(--line); border-radius: var(--radius); padding: 12px; margin-bottom: 14px; background: var(--panel); }
.edit-sec .row { display: flex; gap: 8px; align-items: center; margin-bottom: 8px; flex-wrap: wrap; }
.edit-sec .row input { flex: 1; min-width: 120px; min-height: 40px; padding: 8px 10px; border-radius: 8px; border: 1px solid var(--line); background: var(--bg); }
.sheet { position: fixed; inset: auto 0 0 0; z-index: 40; background: var(--panel); border-top: 1px solid var(--line); border-radius: 16px 16px 0 0; padding: 16px 16px calc(16px + env(safe-area-inset-bottom)); box-shadow: 0 -10px 30px rgba(0,0,0,.4); }
.sheet .row { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.sheet input { width: 100%; min-height: 48px; font-size: 20px; padding: 8px 12px; border-radius: 10px; border: 1px solid var(--line); background: var(--bg); }
.hist li { list-style: none; padding: 10px 0; border-bottom: 1px solid var(--line); display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.hist li span { flex: 1; min-width: 180px; }
pre.view { white-space: pre-wrap; background: var(--panel); padding: 12px; border-radius: 10px; font-size: 13px; max-height: 50vh; overflow: auto; }

/* Adaptation écrans : petits iPhone, tablettes portrait / paysage */
@media (max-width: 360px) { .top .lbl { display: none; } .cell { font-size: 16px; } }
@media (min-width: 700px) {
  .wrap { max-width: 1100px; padding: 18px 24px 90px; }
  body { font-size: 17px; }
  .top { padding: 12px 24px; }
  .top h1 { font-size: 19px; }
  .cell { min-height: 64px; font-size: 21px; }
  .songs { display: grid; grid-template-columns: 1fr 1fr; gap: 0 10px; }
}
@media (min-width: 1100px) { .cell { font-size: 23px; min-height: 70px; } }
@media (orientation: landscape) and (max-height: 500px) { .top { position: static; } }

.cell .alt { flex-basis: 100%; text-align: center; font-size: 11px; font-weight: 600; color: var(--doubt); line-height: 1.1; }

.road { border-collapse: collapse; font-size: 14px; margin-bottom: 8px; }
.road td { padding: 4px 10px 4px 0; border-bottom: 1px solid var(--line); }
.cond .cell { min-height: 40px; font-size: 16px; }
.cond-row { display: grid; grid-template-columns: 110px 1fr; gap: 8px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.cond-ins { font-weight: 650; font-size: 14px; color: var(--accent); }
@media (max-width: 420px) { .cond-row { grid-template-columns: 1fr; gap: 2px; } }

.lyr-tools { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; position: sticky; top: 56px; z-index: 5; background: var(--bg); padding: 6px 0; }
.lyr-pen { border-color: var(--c); box-shadow: inset 0 -4px 0 var(--c); }
.lyr-text { white-space: pre-wrap; font-size: 18px; line-height: 1.7; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; }
.lyr { background: color-mix(in srgb, var(--c) 35%, transparent); border-bottom: 2px solid var(--c); border-radius: 3px; }
.lyr-text [data-dim] { opacity: .35; }

.tabs { overflow-x: auto; }
.tabs button { white-space: nowrap; padding: 10px 9px; }
