.chord-shell { width:min(1410px,calc(100% - 2rem)); padding-block:1rem 2rem; }
.chord-header, .chart-section-bar, .chart-preview-bar, .chart-section-tools {
  display:flex; flex-wrap:wrap; align-items:center; justify-content:space-between; gap:.55rem;
}
.chord-shell .chord-header h1 { font-size:clamp(1.48rem,3vw,2.05rem); text-align:left; margin:.28rem 0; }
.chord-shell h2 { font-size:1.18rem; margin:0; }
.chart-actions, .chart-keys, .chart-chord-entry, .chart-mode-buttons, .chart-view-buttons {
  display:flex; flex-wrap:wrap; gap:.35rem; align-items:center;
}
.chord-shell button {
  cursor:pointer; min-height:2.34rem; margin:0; padding:.36rem .64rem;
  background:var(--theme-soft); color:var(--theme-text); border:1px solid var(--theme-border);
  border-radius:.42rem; font:inherit; font-size:.89rem; font-weight:650;
}
.chord-shell button:hover:not(:disabled), .chord-shell button[aria-pressed="true"], .chart-sections button[aria-current="true"] {
  background:var(--theme-selected); border-color:var(--theme-focus); color:var(--theme-selected-text);
}
.chord-shell button.primary { background:var(--theme-button); color:var(--theme-on-button); }
.chord-shell button:disabled { cursor:default; }
.chord-shell :focus-visible { outline:2px solid var(--theme-focus); outline-offset:2px; }
.chord-shell label { font-size:.85rem; font-weight:650; }
.chord-shell :is(input:not([type=checkbox]),select,textarea) { background:var(--theme-soft); color:var(--theme-text); }
.chart-document-bar {
  display:flex; align-items:end; flex-wrap:wrap; gap:.55rem .85rem; margin-top:.6rem; padding:.6rem .75rem;
  background:var(--theme-surface); border:1px solid var(--theme-border); border-radius:.6rem;
}
.chart-title-field { flex:1 1 12rem; }
.chart-title-field input { font-size:1.14rem !important; font-weight:700; }
.chart-keys { align-items:end; }
.chart-keys input { width:7ch; box-sizing:content-box; }
.chart-status { margin:.35rem 0; color:var(--theme-muted); min-height:1.25rem; font-size:.85rem; }
.chart-spread { display:grid; grid-template-columns:minmax(0,1.03fr) minmax(0,1fr); gap:.7rem; align-items:start; }
.chord-pane { min-width:0; padding:clamp(.65rem,1.4vw,1rem); background:var(--card); border:1px solid var(--border); border-radius:.6rem; }
.chart-sections { margin:.52rem 0; padding:0; list-style:none; display:flex; flex-wrap:wrap; gap:.35rem; }
.chart-sections li { min-width:0; max-width:100%; }
.chart-sections button { max-width:100%; overflow-wrap:anywhere; text-align:left; }
.chart-section-edit { border-top:1px solid var(--border); padding-top:.65rem; }
.chart-section-tools { align-items:end; }
.chart-section-tools label { min-width:0; flex:1; }
.chart-mode-buttons { margin:.55rem 0; }
.chord-shell textarea { height:auto; min-height:4rem; resize:vertical; line-height:1.45; padding:.45rem .55rem; }
@supports (field-sizing: content) {
  .chord-shell textarea { field-sizing:content; max-height:15rem; }
}
.chord-shell #lyric-text { font-family:inherit; font-weight:400; }
.chart-hint { margin:.35rem 0; font-size:.84rem; color:var(--theme-muted); }
.chart-chord-entry { align-items:end; }
.chart-chord-entry label { min-width:0; flex:0 1 13rem; }
.chart-chord-lines { display:grid; gap:.28rem; margin:.45rem 0; }
.chart-chord-line { display:flex; flex-wrap:wrap; align-items:end; white-space:pre-wrap; overflow-wrap:anywhere; font-size:.94rem; }
.chart-chord-piece { display:grid; grid-template-rows:auto auto; align-items:end; min-width:0; }
.chart-chord-piece button { justify-self:start; min-height:1.7rem; padding:.14rem .32rem; color:var(--theme-link); font-size:.78rem; }
.chart-chord-piece span { grid-row:2; }
.chord-shell details { margin-top:.65rem; border-top:1px solid var(--border); padding-top:.55rem; }
.chord-shell summary { cursor:pointer; font-size:.87rem; }
#section-options label { margin:.5rem 0; max-width:18rem; }
.chart-preview-bar .chart-actions { font-size:.84rem; }
.chord-shell .chart-zoom { display:flex !important; align-items:center; gap:.3rem; }
.chart-empty { border:1px dashed var(--border); padding:clamp(.8rem,2vw,1.6rem); margin:.6rem 0; background:var(--theme-soft); border-radius:.5rem; }
.chart-empty :is(h3,p) { margin:0 0 .6rem; }
.chord-shell :is(a:not(.back-link),.chart-footer a) { color:var(--theme-link); }
.chart-view-buttons { display:none; }
.chart-spread.is-expanded { grid-template-columns:minmax(0,1fr); }
.chart-spread.is-expanded #chart-edit-pane { display:none; }
.chart-footer { margin-top:.75rem; font-size:.83rem; color:var(--theme-muted); }
.chord-shell .chart-dialog {
  width:min(37rem,calc(100% - 1.5rem)); max-height:calc(100dvh - 1.5rem); overflow:auto;
  border:1px solid var(--theme-border); border-radius:.65rem; background:var(--theme-surface);
  color:var(--theme-text); padding:1rem; box-shadow:var(--theme-shadow);
}
.chart-dialog::backdrop { background:rgb(0 0 0 / .48); }
.chart-dialog .chart-actions, .chart-dialog > label, .chart-dialog .work-fields { margin-top:.65rem; }
.chart-dialog p { color:var(--theme-muted); }
.chart-dialog .chart-checkbox { display:flex; gap:.4rem; align-items:start; }
.chart-dialog .chart-actions { row-gap:.5rem; }
.chord-shell [hidden] { display:none !important; }
@media screen {
  .chord-shell .chart-pages { display:block; overflow-x:auto; padding:.2rem; }
  .chart-paper[data-inactive="true"] { display:none; }
  .chord-shell .chart-paper { margin:auto; width:min(100%,max(14rem,calc((100svh - 18rem) * .75))); aspect-ratio:612 / 792; }
  .chord-shell .chart-a4 { aspect-ratio:595.28 / 841.89; }
  .chart-pages[data-zoom="width"] .chart-paper { width:100%; }
  .chart-pages[data-zoom="125"] .chart-paper { width:125%; }
  .chart-pages[data-zoom="150"] .chart-paper { width:150%; }
}
@media screen and (max-width: 760px) {
  .chord-shell { width:calc(100% - 1rem); padding-top:.55rem; }
  .chart-spread { grid-template-columns:minmax(0,1fr); }
  .chart-view-buttons { display:flex; margin:.5rem 0 0; }
  .chart-spread[data-view="edit"] .chart-preview,
  .chart-spread[data-view="preview"] #chart-edit-pane { display:none; }
  .chart-spread.is-expanded[data-view="preview"] .chart-preview { display:block; }
  .chart-preview-bar #expand-preview { display:none; }
  .chord-shell button { min-height:2.6rem; }
  .chord-header .chart-actions { width:100%; display:grid; grid-template-columns:repeat(6,minmax(0,1fr)); }
  .chord-header .chart-actions button { padding-inline:.2rem; font-size:.83rem; }
  .chart-document-bar { align-items:start; }
  .chart-preview-bar { align-items:start; }
}
@media print {
  main.chord-shell > #chart-spread { display:block !important; width:100%; margin:0; }
  #chart-spread > :not(.chart-preview) { display:none !important; }
  .chord-shell .chart-preview { padding:0; border:0; background:none; }
  .chord-shell .chart-paper { display:block; }
}
.chart-start-hint { display:flex; flex-wrap:wrap; gap:.4rem; align-items:center; margin:.4rem 0; }
