:root {
  --bg: #f4f1ec;
  --card: #ffffff;
  --ink: #1d1b19;
  --muted: #77716a;
  --line: #e4ded5;
  --chord: #b4441c;
  --accent: #1d1b19;
  --accent-ink: #ffffff;
  --soft: #ece7df;
  --sec: #8a6d3b;
  --fs: 20px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #16161a; --card: #202026; --ink: #ecebe8; --muted: #9a978f; --line: #2f2f37;
    --chord: #f2b25c; --accent: #ecebe8; --accent-ink: #16161a; --soft: #2a2a31; --sec: #c9a96e;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #16161a; --card: #202026; --ink: #ecebe8; --muted: #9a978f; --line: #2f2f37;
  --chord: #f2b25c; --accent: #ecebe8; --accent-ink: #16161a; --soft: #2a2a31; --sec: #c9a96e;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 17px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  padding-bottom: env(safe-area-inset-bottom);
}
button, input, textarea, select { font: inherit; color: inherit; }
a { color: inherit; }

/* Bovenbalk */
.top {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: calc(10px + env(safe-area-inset-top)) max(16px, env(safe-area-inset-right)) 10px max(16px, env(safe-area-inset-left));
  background: color-mix(in srgb, var(--bg) 92%, transparent);
  backdrop-filter: saturate(1.4) blur(10px); -webkit-backdrop-filter: saturate(1.4) blur(10px);
  border-bottom: 1px solid var(--line);
}
.brand { font-weight: 700; text-decoration: none; font-size: 18px; letter-spacing: -.01em; }
.modes { display: inline-flex; background: var(--soft); border-radius: 999px; padding: 3px; }
.modes button {
  border: 0; background: transparent; padding: 7px 16px; border-radius: 999px; cursor: pointer; font-weight: 600; font-size: 15px; color: var(--muted);
}
.modes button[aria-pressed="true"] { background: var(--card); color: var(--ink); box-shadow: 0 1px 3px rgba(0,0,0,.12); }

main { max-width: 1100px; margin: 0 auto; padding: 20px max(16px, env(safe-area-inset-right)) 60px max(16px, env(safe-area-inset-left)); }

/* Knoppen */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 44px; padding: 0 16px; border-radius: 12px; border: 1px solid var(--line);
  background: var(--card); cursor: pointer; text-decoration: none; font-weight: 600; font-size: 16px;
}
.btn.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.btn.danger { color: #c0392b; }
.btn:disabled { opacity: .4; cursor: default; }
.btn.small { min-height: 36px; padding: 0 12px; font-size: 15px; border-radius: 10px; }
.row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }

/* Setlijst */
.list-head { display: flex; justify-content: space-between; align-items: end; gap: 12px; flex-wrap: wrap; margin: 4px 0 16px; }
.list-head h1 { margin: 0; font-size: 28px; letter-spacing: -.02em; }
.list-head p { margin: 2px 0 0; color: var(--muted); font-size: 15px; }
.setlist { list-style: none; margin: 0; padding: 0; background: var(--card); border-radius: 16px; border: 1px solid var(--line); }
.setlist li:first-child { border-radius: 16px 16px 0 0; }
.setlist li:last-child { border-radius: 0 0 16px 16px; }
.setlist li { border-top: 1px solid var(--line); display: flex; align-items: center; }
.setlist li:first-child { border-top: 0; }
.setlist a.item { flex: 1; display: grid; grid-template-columns: 2.2em 1fr auto; align-items: center; gap: 10px; padding: 14px 16px; text-decoration: none; min-width: 0; }
.setlist a.item:active { background: var(--soft); }
.num { color: var(--muted); font-variant-numeric: tabular-nums; font-size: 15px; }
.t { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.a { color: var(--muted); font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.keytag { font-weight: 700; color: var(--chord); font-size: 15px; text-align: right; white-space: nowrap; }
.keytag small { display: block; color: var(--muted); font-weight: 500; font-size: 12px; }
.setlist.reordering li { touch-action: none; user-select: none; -webkit-user-select: none; cursor: grab; background: var(--card); position: relative; }
.setlist.reordering a.item { pointer-events: none; }
.setlist.reordering .keytag { display: none; }
.handle { padding: 0 18px; font-size: 24px; color: var(--muted); line-height: 1; }
.setlist li.dragging { z-index: 5; box-shadow: 0 8px 24px rgba(0,0,0,.18); cursor: grabbing; border-radius: 10px; }
.list-foot { margin-top: 18px; }

/* Lied */
.song-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.song-head h1 { margin: 0; font-size: 30px; line-height: 1.15; letter-spacing: -.02em; }
.song-head .by { color: var(--muted); margin-top: 4px; }
.nav-arrows { display: flex; gap: 8px; }

.controls {
  display: flex; flex-wrap: wrap; gap: 10px 18px; align-items: center;
  background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 8px 12px; margin-bottom: 18px;
}
.ctl { display: flex; align-items: center; gap: 6px; }
.ctl .lbl { color: var(--muted); font-size: 14px; margin-right: 2px; }
.ctl button { width: 40px; height: 40px; border-radius: 10px; border: 1px solid var(--line); background: var(--bg); cursor: pointer; font-size: 20px; line-height: 1; font-weight: 600; }
.ctl .val { min-width: 2.6em; text-align: center; font-weight: 700; font-variant-numeric: tabular-nums; }
.ctl .val.key { color: var(--chord); }
.shape { font-size: 14px; color: var(--muted); }
.shape b { color: var(--chord); }
.ctl.reset button { width: auto; padding: 0 12px; font-size: 14px; }
.spacer { flex: 1; }

.extra { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 14px 16px; margin-bottom: 18px; display: flex; flex-wrap: wrap; gap: 10px 20px; align-items: center; }
.extra .meta { color: var(--muted); font-size: 15px; }
.extra .notes { flex-basis: 100%; margin: 0; font-size: 15px; }
.yt { background: #e62117; color: #fff; border-color: #e62117; }

.sheet { background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 22px 22px 26px; font-size: var(--fs); line-height: 1.3; }
.sheet.cols2 { column-count: 2; column-gap: 40px; column-rule: 1px solid var(--line); }
.blk { break-inside: avoid; margin-bottom: .9em; }
.blk:last-child { margin-bottom: 0; }
.sec { font-size: .72em; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; color: var(--sec); margin: 0 0 .25em; }
.ln { display: flex; flex-wrap: wrap; align-items: flex-end; margin: 0 0 .15em; }
.g { display: inline-flex; align-items: flex-end; }
.s { display: inline-flex; flex-direction: column; }
.c { color: var(--chord); font-weight: 700; white-space: pre; padding-right: .45em; min-height: 1.25em; font-size: .95em; }
.w { white-space: pre; }
.ln.nochords .c { display: none; }
.chordrow { color: var(--chord); font-weight: 700; white-space: pre-wrap; margin: 0 0 .15em; font-size: .95em; }
.lyr { margin: 0 0 .15em; white-space: pre-wrap; }
pre.tab { font: .7em/1.25 ui-monospace, Menlo, Consolas, monospace; margin: .3em 0 .6em; overflow-x: auto; color: var(--ink); }

.bottom-nav { display: flex; justify-content: space-between; gap: 10px; margin-top: 18px; }
.bottom-nav .btn { flex: 1; max-width: 48%; overflow: hidden; }
.bottom-nav .btn span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Bewerken */
.form { display: grid; gap: 14px; }
.form .two { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 14px; }
.form label { display: grid; gap: 5px; font-size: 14px; font-weight: 600; color: var(--muted); }
.form input, .form textarea, .form select {
  width: 100%; border: 1px solid var(--line); border-radius: 10px; background: var(--card); padding: 10px 12px; font-size: 16px; color: var(--ink); font-weight: 400;
}
.form textarea.text { font: 15px/1.35 ui-monospace, Menlo, Consolas, monospace; min-height: 50vh; white-space: pre; overflow-wrap: normal; overflow-x: auto; tab-size: 4; }
.hint { font-size: 14px; color: var(--muted); margin: 0; }
.preview-title { margin: 24px 0 10px; font-size: 14px; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .06em; }
.panel { background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 18px; margin-bottom: 16px; }
.panel h2 { margin: 0 0 8px; font-size: 18px; }
.panel p { margin: 0 0 12px; color: var(--muted); font-size: 15px; }
.toast { position: fixed; left: 50%; bottom: calc(20px + env(safe-area-inset-bottom)); transform: translateX(-50%); background: var(--accent); color: var(--accent-ink); padding: 10px 18px; border-radius: 999px; font-weight: 600; z-index: 50; }

@media (min-width: 700px) {
  .controls { position: sticky; top: calc(58px + env(safe-area-inset-top)); z-index: 10; }
}
@media (max-width: 640px) {
  .sheet { padding: 16px 14px 20px; }
  .song-head h1 { font-size: 24px; }
  .setlist a.item { grid-template-columns: 1.8em 1fr auto; padding: 12px 12px; }
  .controls { gap: 8px 12px; }
}
@media print {
  .top, .controls, .extra, .bottom-nav, .nav-arrows { display: none !important; }
  .sheet { border: 0; padding: 0; }
}

/* Sets, bibliotheek, secties */
.top .spacer { flex: 1; }
.status { font-size: 13px; color: var(--muted); background: var(--soft); padding: 3px 10px; border-radius: 999px; white-space: nowrap; }
.crumbs { display: flex; justify-content: space-between; gap: 10px; margin: -4px 0 10px; font-size: 15px; color: var(--muted); }
.crumbs a { text-decoration: none; color: var(--chord); font-weight: 600; }
.setlist li.sechead { background: var(--soft); padding: 9px 16px; font-size: 13px; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; color: var(--sec); justify-content: space-between; }
.setlist.reordering li.sechead .secname { cursor: pointer; text-decoration: underline dotted; text-underline-offset: 3px; }
.setlist .x { border: 0; background: transparent; color: var(--muted); font-size: 22px; width: 40px; height: 40px; cursor: pointer; flex: none; }
.setlist a.item.two { grid-template-columns: 1fr auto; }
.chev { color: var(--muted); font-size: 22px; }
.item.empty { display: block; padding: 16px; color: var(--muted); }
.pickbar { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 14px; }
.pickbar input, .pickbar select { flex: 1 1 220px; min-height: 44px; border: 1px solid var(--line); border-radius: 12px; background: var(--card); padding: 0 14px; font-size: 16px; }
.pickbar select { flex: 0 1 220px; }
label.item.pick { display: grid; grid-template-columns: 28px 1fr auto; align-items: center; gap: 10px; padding: 12px 16px; cursor: pointer; flex: 1; min-width: 0; }
label.item.pick input { width: 22px; height: 22px; accent-color: var(--chord); }
.login { max-width: 420px; margin: 40px auto; }
.login h1 { margin: 0 0 6px; font-size: 24px; }
