/* Dark stage, iPad mini first; the phone layout is at the bottom. */
:root {
  --bg: #000;
  --text: #f4f1ea;
  --quiet: #a39d92;
  --line: #2b2825;
  --chord: #ffb84d;
  --key: #1d1b19;
  --lyric-size: 1.75rem;
}

* { box-sizing: border-box; margin: 0; }
[hidden] { display: none !important; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, system-ui, sans-serif;
  padding: max(1rem, env(safe-area-inset-top)) max(1.25rem, env(safe-area-inset-right))
           calc(6rem + env(safe-area-inset-bottom)) max(1.25rem, env(safe-area-inset-left));
  -webkit-text-size-adjust: 100%;
}

header {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: .25rem 1rem;
  align-items: center;
  padding-bottom: .75rem;
}
h1 { font-size: 1.5rem; line-height: 1.2; }
#artist, #notes { color: var(--quiet); font-size: 1.05rem; }
#offline { color: #7fd69b; font-size: .85rem; }
#offline:empty { display: none; }
#notes, #warnings { grid-column: 1 / -1; }
#notes { color: var(--chord); }
#warnings { color: #ff8f7a; }
#notes:empty, #warnings:empty { display: none; }
#position { color: var(--quiet); }
#position:empty { display: none; }
#file { position: absolute; opacity: 0; width: 1px; height: 1px; }
.extras:has(#file:focus-visible) .button { outline: 2px solid var(--chord); }

/* Setlists and song lists */
.list { list-style: none; padding: 0; margin-bottom: 1.5rem; }
.list li { border-top: 1px solid var(--line); }
ol.list { counter-reset: song; }
ol.list li { counter-increment: song; }
ol.list .main::before { content: counter(song) ". "; color: var(--quiet); }
.list button {
  width: 100%; min-height: 4rem; padding: .5rem .25rem; border: 0; border-radius: 0; background: none;
  flex-wrap: wrap; justify-content: space-between; gap: .1rem 1rem; text-align: left;
}
.list .main { font-size: 1.5rem; }
.list .small { color: var(--quiet); }
#setlists .small { color: #7fd69b; }
form { display: grid; gap: .75rem; max-width: 26rem; padding: 1rem 0 1.5rem; border-top: 1px solid var(--line); }
form h2 { line-height: 1.3; }
form label { display: grid; gap: .25rem; color: var(--quiet); }
form button { justify-self: start; }
#add-message { color: #ff8f7a; }
#add-message:empty { display: none; }
input { font: inherit; color: var(--text); background: var(--key); border: 1px solid var(--line); border-radius: .6rem; min-height: 3rem; padding: 0 .8rem; }
input:focus-visible { outline: 2px solid var(--chord); }
.extras { display: flex; gap: .5rem; }

/* Sections: label on the left, words on the right. */
section {
  display: grid;
  grid-template-columns: 6.5rem 1fr;
  gap: 1rem;
  padding: .85rem .25rem;
  border-top: 1px solid var(--line);
  cursor: pointer;
  touch-action: pan-y; /* up and down scrolls; sideways is ours */
  user-select: none;
  -webkit-user-select: none;
  -webkit-tap-highlight-color: transparent;
}
section:focus { outline: none; }
section:focus-visible { outline: 2px solid var(--chord); }
h2 {
  font-size: 1.05rem;
  font-weight: 600;
  line-height: calc(var(--lyric-size) * 1.3);
  color: var(--quiet);
  overflow-wrap: anywhere;
}
section.own h2::after { content: " •"; color: var(--chord); } /* changed on its own */

.lines { min-width: 0; }
.line { font-size: var(--lyric-size); line-height: 1.3; }
.line.with-chords { margin-bottom: .2em; }
.word { white-space: nowrap; }
.unit { display: inline-flex; flex-direction: column; justify-content: flex-end; vertical-align: bottom; }
.text { white-space: pre; min-height: 1.3em; }
.chords-alone .text { min-height: 0; height: 0; overflow: hidden; }
.chords-alone .chord { font-size: .9em; }
.chord { color: var(--chord); font-size: .72em; font-weight: 700; line-height: 1.25; padding-right: .45em; }
.comment { color: var(--quiet); font-style: italic; font-size: 1.1rem; white-space: pre-wrap; }

/* Controls along the bottom. */
nav {
  position: fixed;
  inset: auto 0 0 0;
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: .5rem;
  padding: .6rem max(1rem, env(safe-area-inset-right)) max(.6rem, env(safe-area-inset-bottom))
           max(1rem, env(safe-area-inset-left));
  background: var(--bg);
  border-top: 1px solid var(--line);
}
.level, .moves { display: flex; gap: .5rem; align-items: center; }
output { min-width: 6.2rem; text-align: center; font-variant-numeric: tabular-nums; }
button, .button {
  font: inherit;
  color: var(--text);
  background: var(--key);
  border: 1px solid var(--line);
  border-radius: .6rem;
  min-height: 3rem;
  padding: 0 1rem;
  display: inline-flex;
  align-items: center;
  cursor: pointer;
  touch-action: manipulation;
}
button:disabled { opacity: .35; }
.unused { visibility: hidden; }
.moves button { min-width: 3.25rem; justify-content: center; }
#previous, #next { font-size: 1.6rem; line-height: 1; }
button[aria-pressed="true"] { color: #000; background: var(--chord); border-color: var(--chord); }
button:focus-visible { outline: 2px solid var(--text); }

@media (max-width: 600px) {
  :root { --lyric-size: 1.35rem; }
  body { padding-bottom: calc(9.5rem + env(safe-area-inset-bottom)); }
  section { grid-template-columns: 1fr; gap: .15rem; }
  h2 { line-height: 1.3; }
  .level { width: 100%; }
  .level button { flex: 1; justify-content: center; }
  button, .button { padding: 0 .8rem; }
  .moves button { min-width: 2.9rem; }
  nav > button, .moves button { padding: 0 .7rem; }
  output { min-width: 5.6rem; font-size: .95rem; }
}
