:root {
  --bg: #F2EDE2;
  --surface: #FBF7EE;
  --surface-elevated: #F7F0E0;
  --text: #1F1A12;
  --text-muted: #6B5D49;
  --text-faint: #A19378;
  --accent: #B8521A;
  --accent-soft: #EFDCC2;
  --border: #D9CAB1;
  --border-strong: #B5A284;
  --font-display: 'Fraunces', Georgia, serif;
  --font-ui: 'Schibsted Grotesk', sans-serif;
  --font-mono: 'JetBrains Mono', monospace;
  --sidebar-width: 260px;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-ui);
  font-size: 15px;
  line-height: 1.5;
  min-height: 100vh;
}

/* === App shell : grid 2 colonnes === */
.app-shell {
  display: grid;
  grid-template-columns: var(--sidebar-width) 1fr;
  min-height: 100vh;
  transition: grid-template-columns 0.25s ease-out;
}
body:not(.sidebar-open) .app-shell {
  grid-template-columns: 0 1fr;
}

/* === Sidebar === */
.sidebar {
  background: var(--surface-elevated);
  border-right: 0.5px solid var(--border);
  position: sticky;
  top: 0;
  height: 100vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: transform 0.25s ease-out, opacity 0.2s;
}
body:not(.sidebar-open) .sidebar {
  transform: translateX(-100%);
  pointer-events: none;
}
.sidebar-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 22px 18px 16px 56px;
  border-bottom: 0.5px solid var(--border);
}
.sidebar-header h2 {
  font-family: var(--font-display);
  font-weight: 400;
  font-style: italic;
  font-size: 22px;
  margin: 0;
  letter-spacing: -0.01em;
}
.new-song-btn {
  width: 28px;
  height: 28px;
  padding: 0;
  font-size: 22px;
  line-height: 1;
  border-radius: 50%;
  background: transparent;
  border: 1px solid var(--border-strong);
  color: var(--text-muted);
  font-family: var(--font-ui);
  cursor: pointer;
  transition: all 0.15s;
  display: flex;
  align-items: center;
  justify-content: center;
}
.new-song-btn:hover {
  background: var(--accent);
  color: var(--bg);
  border-color: var(--accent);
}
.song-list {
  list-style: none;
  margin: 0;
  padding: 6px 0;
  flex: 1;
  overflow-y: auto;
}
.song-item {
  display: flex;
  align-items: stretch;
  border-left: 2px solid transparent;
  transition: background 0.15s, border-color 0.15s;
  position: relative;
}
.song-item:hover { background: rgba(184, 82, 26, 0.04); }
.song-item.active {
  background: var(--accent-soft);
  border-left-color: var(--accent);
}
.song-item-main {
  flex: 1;
  text-align: left;
  background: transparent;
  border: none;
  padding: 11px 14px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 3px;
  font-family: var(--font-ui);
  min-width: 0;
}
.song-item-main:hover { color: var(--text); border: none; }
.song-item-title {
  font-size: 14px;
  font-weight: 500;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.song-item.active .song-item-title { color: var(--accent); }
.song-item-meta {
  font-family: var(--font-mono);
  font-size: 9.5px;
  color: var(--text-faint);
  letter-spacing: 0.1em;
  text-transform: uppercase;
}
.song-item-delete {
  background: transparent;
  border: none;
  color: var(--text-faint);
  font-size: 14px;
  padding: 0 12px;
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.15s, color 0.15s;
  font-family: var(--font-ui);
}
.song-item:hover .song-item-delete,
.song-item.active .song-item-delete { opacity: 0.5; }
.song-item-delete:hover {
  opacity: 1 !important;
  color: var(--accent);
  border: none;
}
@media (hover: none) {
  /* Écrans tactiles : ✕ toujours visible, sinon il est introuvable */
  .song-item-delete { opacity: 0.45; }
}

/* === Main area === */
.main-area {
  padding: 0 32px 96px;
  min-width: 0; /* permet au grid de respecter la largeur */
  background-image:
    radial-gradient(circle at 20% 10%, rgba(255,255,255,0.5) 0%, transparent 50%),
    radial-gradient(circle at 80% 90%, rgba(184,82,26,0.04) 0%, transparent 60%);
}
.container { max-width: 940px; margin: 0 auto; padding-top: 28px; }

/* === Header principal === */
header.main {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  margin-left: -32px;
  margin-right: -32px;
  padding-top: 10px;
  padding-bottom: 10px;
  padding-left: 32px;
  padding-right: 32px;
  border-bottom: 1px solid var(--border);
  flex-wrap: nowrap;
  gap: 16px;
  position: sticky;
  top: 0;
  z-index: 50;
  background: #F2EDE2;
  transition: box-shadow 0.2s ease;
}
header.main.scrolled {
  box-shadow: 0 4px 12px rgba(42, 32, 26, 0.08);
}
.title-block {
  display: flex;
  align-items: center;
  gap: 20px;
  min-width: 0;
}
.title-block h1 {
  font-family: var(--font-display);
  font-weight: 400;
  font-style: italic;
  font-size: 28px;
  line-height: 1;
  margin: 0;
  letter-spacing: -0.02em;
  white-space: nowrap;
}
.title-block h1::first-letter { color: var(--accent); }
.title-block p {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-faint);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  margin: 0;
  white-space: nowrap;
}
.header-controls { display: flex; gap: 10px; align-items: center; flex-wrap: nowrap; }
.control-group label {
  display: none;
  font-family: var(--font-mono);
  font-size: 9.5px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--text-faint);
  margin-bottom: 6px;
  font-weight: 500;
}
/* Compact controls scoped to sticky header */
header.main select {
  padding: 7px 24px 7px 10px;
  min-width: 110px;
  font-size: 13px;
  background-position: calc(100% - 10px) 50%, calc(100% - 6px) 50%;
}
header.main .seg-group button { padding: 7px 10px; font-size: 13px; }
header.main #print-btn {
  font-size: 0;
  width: 34px;
  padding: 7px;
  line-height: 1;
}
header.main #print-btn::before {
  content: '⎙';
  font-size: 16px;
  font-family: var(--font-ui);
  display: block;
}

/* === Champ titre du morceau === */
.song-title-bar {
  margin-bottom: 40px;
}
.song-title-input {
  width: 100%;
  background: transparent;
  border: none;
  font-family: var(--font-display);
  font-style: italic;
  font-weight: 400;
  font-size: 44px;
  line-height: 1.3;
  color: var(--text);
  letter-spacing: -0.02em;
  padding: 8px 8px 18px 8px;
  margin-left: -4px;
  border-bottom: 1px dashed transparent;
  transition: border-color 0.15s;
  outline: none;
}
.song-title-input:hover { border-bottom-color: var(--border); }
.song-title-input:focus { border-bottom-color: var(--accent); }
.song-title-input::placeholder { color: var(--text-faint); font-style: italic; }

/* === Form controls === */
select {
  font-family: var(--font-ui);
  font-size: 14px;
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border-strong);
  border-radius: 2px;
  padding: 9px 14px;
  cursor: pointer;
  min-width: 130px;
  transition: border-color 0.15s;
  appearance: none;
  background-image:
    linear-gradient(45deg, transparent 50%, var(--text-muted) 50%),
    linear-gradient(135deg, var(--text-muted) 50%, transparent 50%);
  background-position: calc(100% - 14px) 50%, calc(100% - 10px) 50%;
  background-size: 4px 4px;
  background-repeat: no-repeat;
  padding-right: 28px;
}
select:hover { border-color: var(--accent); }
select:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(184,82,26,0.15); }
button {
  font-family: var(--font-ui);
  font-size: 14px;
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border-strong);
  border-radius: 2px;
  padding: 9px 14px;
  cursor: pointer;
  transition: all 0.15s;
}
button:hover { border-color: var(--accent); color: var(--accent); }

/* === Segmented controls (mode, pentatonique) === */
.seg-group { display: inline-flex; }
.seg-group button {
  border-radius: 0;
  background: var(--surface);
  border-right: 0;
  padding: 9px 14px;
}
.seg-group button:first-child { border-radius: 2px 0 0 2px; }
.seg-group button:last-child { border-radius: 0 2px 2px 0; border-right: 1px solid var(--border-strong); }
.seg-group button.active {
  background: var(--text);
  color: var(--bg);
  border-color: var(--text);
}
.seg-group button:not(.active):hover { background: var(--accent-soft); color: var(--text); border-color: var(--border-strong); }

/* === Sections === */
section.part { margin-bottom: 48px; }
section.part > header {
  display: flex;
  align-items: baseline;
  gap: 16px;
  margin-bottom: 20px;
  padding-bottom: 12px;
  border-bottom: 0.5px solid var(--border);
  flex-wrap: wrap;
}
.part-collapse {
  flex: 0 0 auto;
  width: 26px;
  height: 26px;
  padding: 0;
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
  transition: transform 0.2s, color 0.15s;
  align-self: center;
  border-radius: 3px;
}
.part-collapse:hover { color: var(--accent); border: none; }
section.part.is-collapsed .part-collapse { transform: rotate(-90deg); }
section.part.is-collapsed > header {
  border-bottom-style: dashed;
  margin-bottom: 0;
  padding-bottom: 16px;
}
section.part.is-collapsed { margin-bottom: 24px; }
section.part.is-collapsed .part-content { display: none; }
section.part h2 {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: 30px;
  margin: 0;
  letter-spacing: -0.015em;
  display: flex;
  align-items: baseline;
  gap: 12px;
}
.roman-numeral {
  font-family: var(--font-display);
  font-style: italic;
  font-weight: 400;
  font-size: 18px;
  color: var(--accent);
  letter-spacing: 0.08em;
}
.part-meta {
  flex: 1;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  min-width: 280px;
}
.part-progression {
  font-family: var(--font-mono);
  font-size: 12.5px;
  color: var(--text-muted);
  letter-spacing: 0.1em;
}
.part-actions { display: flex; gap: 8px; align-items: center; }
.part-actions select, .part-actions button {
  font-size: 12.5px;
  padding: 6px 12px;
  min-width: auto;
}
.part-actions select { padding-right: 24px; min-width: 140px; }
.part-actions button { background: transparent; }

/* === Chord cards === */
.chord-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
}
.chord-card {
  background: var(--surface);
  border: 0.5px solid var(--border);
  border-radius: 3px;
  padding: 14px 8px 10px;
  text-align: center;
  transition: transform 0.2s, border-color 0.2s;
  animation: chordIn 0.3s ease-out backwards;
  display: flex;
  flex-direction: column;
}
.chord-card:hover { border-color: var(--accent); transform: translateY(-2px); }
.chord-card:nth-child(1) { animation-delay: 0ms; }
.chord-card:nth-child(2) { animation-delay: 45ms; }
.chord-card:nth-child(3) { animation-delay: 90ms; }
.chord-card:nth-child(4) { animation-delay: 135ms; }
@keyframes chordIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}
.chord-degree {
  font-family: var(--font-mono);
  font-size: 9.5px;
  color: var(--accent);
  letter-spacing: 0.18em;
  margin-bottom: 4px;
  font-weight: 500;
  text-transform: uppercase;
}
.chord-name {
  font-family: var(--font-display);
  font-style: italic;
  font-weight: 400;
  font-size: 22px;
  margin-bottom: 8px;
  line-height: 1;
  letter-spacing: -0.01em;
}
.chord-card svg { width: 100%; max-width: 108px; height: auto; color: var(--text); display: block; margin: 0 auto; }
.chord-card svg text { font-family: var(--font-ui); }
.chord-card svg text.fret-num { font-family: var(--font-mono); }

/* === Variante piano : SVG plus large, chevrons plus courts === */
.chord-card-piano .chord-diagram svg { max-width: 190px; }
.chord-card-piano .voicing-nav { height: 60px; }
.chord-card-piano .voicing-nav-spacer { height: 60px; }

/* === Voicing nav === */
.voicing-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 2px;
  margin-top: 2px;
}
.chord-diagram { flex: 0 1 auto; min-width: 0; }
.chord-diagram svg { max-width: 100px; }
.voicing-nav {
  flex: 0 0 auto;
  width: 16px;
  height: 100px;
  padding: 0;
  background: transparent;
  border: none;
  color: var(--text-faint);
  font-family: var(--font-display);
  font-size: 24px;
  line-height: 1;
  cursor: pointer;
  opacity: 0.4;
  transition: opacity 0.15s, color 0.15s, transform 0.15s;
  display: flex;
  align-items: center;
  justify-content: center;
}
.voicing-nav:hover {
  color: var(--accent);
  opacity: 1;
  transform: scale(1.25);
  border: none;
}
.voicing-nav-spacer { flex: 0 0 auto; width: 16px; }
.voicing-counter {
  font-family: var(--font-mono);
  font-size: 9px;
  color: var(--text-faint);
  letter-spacing: 0.15em;
  margin-top: 4px;
  text-align: center;
  opacity: 0.65;
}

/* === Lyrics === */
.lyrics-container { margin-top: 18px; }
.add-lyrics {
  width: 100%;
  padding: 14px;
  border: 1px dashed var(--border-strong);
  border-radius: 3px;
  background: transparent;
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 10.5px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  cursor: pointer;
}
.add-lyrics:hover { border-color: var(--accent); color: var(--accent); background: transparent; }
.lyrics-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 12px;
  align-items: start;
}
.lyric-block {
  background: var(--surface);
  border: 0.5px solid var(--border);
  border-radius: 3px;
  padding: 10px 14px 12px;
  display: flex;
  flex-direction: column;
  transition: opacity 0.2s, border-color 0.15s, box-shadow 0.15s;
}
.lyric-block.dragging {
  opacity: 0.4;
  cursor: grabbing;
}
.lyric-block.drag-over {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent-soft);
}
.lyric-drag-handle {
  color: var(--text-faint);
  font-family: var(--font-mono);
  font-size: 11px;
  cursor: grab;
  user-select: none;
  letter-spacing: -0.25em;
  padding-right: 8px;
  opacity: 0.5;
  transition: opacity 0.15s, color 0.15s;
}
.lyric-drag-handle:hover {
  opacity: 1;
  color: var(--accent);
}
.lyric-block:hover .lyric-drag-handle { opacity: 0.8; }
.lyric-block.dragging .lyric-drag-handle { cursor: grabbing; }
.lyric-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
  padding-bottom: 8px;
  border-bottom: 0.5px solid var(--border);
}
.lyric-label {
  font-family: var(--font-mono);
  font-size: 9.5px;
  color: var(--text-faint);
  letter-spacing: 0.2em;
  text-transform: uppercase;
}
.lyric-actions { display: flex; gap: 4px; }
.lyric-actions button {
  font-size: 10.5px;
  padding: 4px 9px;
  background: transparent;
  border: 0.5px solid var(--border);
  font-family: var(--font-mono);
  letter-spacing: 0.1em;
  text-transform: uppercase;
}
.lyric-actions button.active { background: var(--text); color: var(--bg); border-color: var(--text); }
.lyric-edit {
  width: 100%;
  min-height: 130px;
  font-family: var(--font-mono);
  font-size: 13px;
  line-height: 1.7;
  background: transparent;
  border: none;
  color: var(--text);
  resize: vertical;
  padding: 4px 0;
  outline: none;
}
.lyric-edit::placeholder { color: var(--text-faint); font-style: italic; }
.lyric-preview {
  min-height: 130px;
  font-family: var(--font-display);
  font-size: 15px;
  line-height: 2.4;
  padding: 4px 0;
}
.lyric-preview:empty::before {
  content: 'Aperçu vide — bascule en édition pour écrire';
  color: var(--text-faint);
  font-style: italic;
  font-size: 13px;
  font-family: var(--font-ui);
}
.cp-line { display: block; margin-bottom: 0.2em; }
.cp-line:empty { height: 1.5em; }
.cp-seg { display: inline-block; vertical-align: top; }
.cp-chord {
  display: block;
  color: var(--accent);
  font-family: var(--font-mono);
  font-size: 0.7em;
  font-weight: 500;
  letter-spacing: 0.04em;
  line-height: 1.3em;
  height: 1.3em;
  min-width: 0.5em;
}
.cp-lyric { display: block; white-space: pre; }
.add-lyric-col {
  border: 1px dashed var(--border-strong);
  background: transparent;
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 10.5px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  border-radius: 3px;
  min-height: 100px;
  cursor: pointer;
  transition: all 0.15s;
}
.add-lyric-col:hover { color: var(--accent); border-color: var(--accent); }

/* === Scale === */
.scale-toggle { text-align: center; margin: 56px 0 24px; }
.scale-toggle button {
  font-family: var(--font-mono);
  font-size: 10.5px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  background: transparent;
  border: none;
  color: var(--text-muted);
  padding: 10px 20px;
  cursor: pointer;
  border-bottom: 1px solid var(--border-strong);
  border-radius: 0;
  transition: all 0.15s;
}
.scale-toggle button:hover { color: var(--accent); border-bottom-color: var(--accent); }
.scale-section {
  background: var(--surface);
  border: 0.5px solid var(--border);
  padding: 28px 32px 32px;
  border-radius: 3px;
  animation: scaleIn 0.3s ease-out;
}
.scale-section[hidden] { display: none; }
@keyframes scaleIn {
  from { opacity: 0; transform: translateY(-8px); }
  to { opacity: 1; transform: translateY(0); }
}
.scale-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 16px;
  padding-bottom: 14px;
  border-bottom: 0.5px solid var(--border);
  flex-wrap: wrap;
  gap: 12px;
}
.scale-header h3 {
  font-family: var(--font-display);
  font-style: italic;
  font-weight: 400;
  font-size: 26px;
  margin: 0;
}
.scale-notes {
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--text-muted);
  letter-spacing: 0.08em;
}
.penta-toggle { margin-bottom: 18px; }
.penta-toggle .seg-group button { font-size: 11.5px; padding: 7px 12px; }
.scale-legend {
  display: flex;
  gap: 18px;
  font-family: var(--font-mono);
  font-size: 9.5px;
  color: var(--text-faint);
  letter-spacing: 0.18em;
  text-transform: uppercase;
  margin-bottom: 18px;
}
.legend-item { display: inline-flex; align-items: center; gap: 7px; }
.legend-dot { width: 11px; height: 11px; border-radius: 50%; display: inline-block; }
.legend-dot.root { background: var(--accent); }
.legend-dot.scale { background: var(--accent-soft); border: 0.5px solid var(--border-strong); }
#fretboard svg { width: 100%; height: auto; color: var(--text); display: block; }
#fretboard svg text { font-family: var(--font-ui); }
#fretboard svg text.fret-label { font-family: var(--font-mono); }

/* === Footer === */
footer {
  text-align: center;
  margin-top: 64px;
  padding-top: 24px;
  border-top: 0.5px solid var(--border);
  font-family: var(--font-mono);
  font-size: 10.5px;
  color: var(--text-faint);
  letter-spacing: 0.2em;
  text-transform: uppercase;
}

/* === État "armed" du bouton suppression (1er clic = arme, 2e clic = confirme) === */
.song-item.delete-armed {
  background: rgba(184, 82, 26, 0.08);
}
.song-item.delete-armed .song-item-main { color: var(--text); }
.song-item.delete-armed .song-item-meta {
  color: var(--accent);
  font-weight: 500;
  text-transform: none;
  letter-spacing: 0.05em;
  font-style: italic;
}
.song-item-delete.is-armed {
  opacity: 1 !important;
  color: var(--bg) !important;
  background: var(--accent);
  border-radius: 3px;
  margin: 6px 8px 6px 0;
  width: 24px;
  padding: 0;
  font-weight: 500;
}
.song-item-delete.is-armed:hover {
  background: var(--text);
  color: var(--bg) !important;
}

/* === Bouton hamburger (toujours visible) === */
.menu-toggle {
  display: flex;
  position: fixed;
  top: 14px;
  left: 14px;
  z-index: 200;
  width: 38px;
  height: 38px;
  padding: 0;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: 3px;
  cursor: pointer;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 4px;
}
.menu-toggle span {
  display: block;
  width: 16px;
  height: 1.5px;
  background: var(--text);
  transition: transform 0.2s, opacity 0.2s;
}
/* Animation burger → croix quand sidebar ouverte */
body.sidebar-open .menu-toggle span:nth-child(1) { transform: translateY(5.5px) rotate(45deg); }
body.sidebar-open .menu-toggle span:nth-child(2) { opacity: 0; }
body.sidebar-open .menu-toggle span:nth-child(3) { transform: translateY(-5.5px) rotate(-45deg); }

.sidebar-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(31, 26, 18, 0.4);
  z-index: 99;
  opacity: 0;
  transition: opacity 0.25s;
}

/* === Responsive tablette (721–1023px) === */
@media (max-width: 1023px) {
  header.main { flex-wrap: wrap; gap: 12px; padding-top: 12px; padding-bottom: 12px; }
  .title-block { flex: 0 0 100%; }
  .header-controls { flex-wrap: wrap; }
  .control-group label { display: block; }
  header.main #print-btn { font-size: 14px; width: auto; padding: 7px 12px; }
  header.main #print-btn::before { content: none; }
}

/* === Responsive mobile (≤ 720px) === */
@media (max-width: 720px) {
  .app-shell {
    grid-template-columns: 1fr;
  }
  body.sidebar-open .app-shell {
    grid-template-columns: 1fr; /* mobile : sidebar reste en overlay */
  }
  .main-area { padding: 0 16px 56px; }
  .container { padding-top: 16px; }
  .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: 82vw;
    max-width: 320px;
    height: 100vh;
    z-index: 100;
    transform: translateX(-100%);
    box-shadow: 4px 0 16px rgba(0,0,0,0.12);
  }
  body.sidebar-open .sidebar { transform: translateX(0); pointer-events: auto; }
  body.sidebar-open .sidebar-backdrop { display: block; opacity: 1; }

  .chord-grid { grid-template-columns: repeat(2, 1fr); }
  header.main { margin-left: -16px; margin-right: -16px; padding-left: 16px; padding-right: 16px; }
  .title-block { display: block; }
  .title-block h1 { font-size: 32px; white-space: normal; }
  .title-block p { margin: 6px 0 0; white-space: normal; letter-spacing: 0.18em; }
  section.part h2 { font-size: 24px; }
  .part-meta { flex-direction: column; align-items: flex-start; gap: 8px; }
  .scale-header { flex-direction: column; align-items: flex-start; }
  .lyrics-grid { grid-template-columns: 1fr; }
  .song-title-input { font-size: 32px; }
}

/* === Print === */
@media print {
  :root {
    --bg: #fff;
    --surface: #fff;
    --surface-elevated: #fff;
    --text: #000;
    --text-muted: #444;
    --text-faint: #666;
    --accent: #000;
    --accent-soft: #ececec;
    --border: #d0d0d0;
    --border-strong: #999;
  }
  body { background: #fff !important; font-size: 11pt; margin: 0.8cm !important; }

  /* Layout : flow block pour Safari iOS print (le grid/flex du shell cause le bug "demi-page") */
  .app-shell,
  body.sidebar-open .app-shell {
    display: block !important;
    width: 100% !important;
    min-height: 0 !important;
  }
  .sidebar, .menu-toggle, .sidebar-backdrop { display: none !important; }
  .main-area {
    display: block !important;
    width: 100% !important;
    max-width: none !important;
    padding: 0 !important;
    background-image: none !important;
  }
  .container {
    display: block !important;
    width: 100% !important;
    max-width: none !important;
    margin: 0 !important;
    padding-top: 0 !important;
  }
  header.main { display: block !important; position: static !important; box-shadow: none !important; margin-left: 0 !important; margin-right: 0 !important; padding-left: 0 !important; padding-right: 0 !important; }
  .title-block { display: block !important; }

  /* Éléments cachés à l'impression */
  .header-controls, .part-actions, .part-collapse, .scale-toggle, .lyric-actions,
  .lyric-drag-handle, .add-lyrics, .add-lyric-col, .lyric-edit, .penta-toggle,
  .voicing-nav, .voicing-counter, .scale-legend, footer { display: none !important; }

  .lyric-preview { display: block !important; min-height: 0; }
  .lyric-block.is-empty { display: none !important; }

  /* Déplier toutes les sections à l'impression */
  section.part.is-collapsed .part-content { display: block !important; }
  section.part.is-collapsed .part-collapse { display: none !important; }

  /* Grille d'accords : toujours 4 colonnes (évite l'héritage 2-col du breakpoint mobile) */
  .chord-grid {
    display: grid !important;
    grid-template-columns: repeat(4, 1fr) !important;
  }
  /* Paroles : une variante par ligne */
  .lyrics-grid { grid-template-columns: 1fr !important; }

  .chord-card { animation: none !important; transform: none !important; padding-bottom: 6px; }
  section.part { page-break-inside: avoid; break-inside: avoid; margin-bottom: 18pt; }

  /* Gamme : layout block pour éviter les bugs flex de Safari iOS print */
  .scale-section { page-break-before: always; }
  .scale-section[hidden] { display: none !important; }
  .scale-header { display: block !important; }
  .scale-notes { display: block !important; white-space: nowrap !important; margin-top: 6pt; }

  .title-block h1 { font-size: 30pt; }
  .title-block h1::first-letter { color: #000; }
  .song-title-input { font-size: 28pt; border-bottom: none !important; }
  .chord-degree, .roman-numeral, .cp-chord { color: #000; }
}
