/* Stage Pads: its colours over the web iOS kit (src/ioskit/ios.css), the tab bar, and its own pieces: the twelve keys, the
   sound chips, the swell fader, the click, the setlists and the stage chart. A dark stage look by default (Settings › Look);
   stage amber on near-black, so a lit key reads from across a dark room. */
:root {
  --canvas: #F4F1EC; --grouped: #F4F1EC; --row: #FFFFFF; --card: #FFFFFF;
  --amber: #B5650B; --tint: var(--amber); --forest: var(--amber); --coral: var(--amber);
  --violet: #5B4BC4; --key: #FFFFFF; --key-edge: rgba(30, 20, 10, 0.1); --key-text: #1C1814; --lit: #F2A93B; --lit-text: #1E1302;
  --text2: rgba(40, 30, 20, 0.62); --text3: rgba(40, 30, 20, 0.34); --sep: rgba(40, 30, 20, 0.15);
  --fill: rgba(110, 90, 70, 0.13); --fill2: rgba(110, 90, 70, 0.09);
  --glass: rgba(255, 253, 250, 0.86); --glass-edge: rgba(40, 20, 0, 0.07);
  --tabbar-space: calc(var(--sab) + 108px);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --canvas: #0B0C10; --grouped: #0B0C10; --row: #17181E; --card: #17181E;
    --amber: #FFB547; --violet: #9D8CFF; --key: #1B1C23; --key-edge: rgba(255, 255, 255, 0.07); --key-text: #F3EEE6; --lit: #FFB547; --lit-text: #241500;
    --text: #F3EEE6; --text2: rgba(243, 238, 230, 0.62); --text3: rgba(243, 238, 230, 0.3); --sep: rgba(243, 238, 230, 0.12);
    --fill: rgba(240, 225, 210, 0.13); --fill2: rgba(240, 225, 210, 0.09);
    --glass: rgba(30, 31, 38, 0.84); --glass-edge: rgba(255, 245, 230, 0.08);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --canvas: #0B0C10; --grouped: #0B0C10; --row: #17181E; --card: #17181E;
  --amber: #FFB547; --violet: #9D8CFF; --key: #1B1C23; --key-edge: rgba(255, 255, 255, 0.07); --key-text: #F3EEE6; --lit: #FFB547; --lit-text: #241500;
  --text: #F3EEE6; --text2: rgba(243, 238, 230, 0.62); --text3: rgba(243, 238, 230, 0.3); --sep: rgba(243, 238, 230, 0.12);
  --fill: rgba(240, 225, 210, 0.13); --fill2: rgba(240, 225, 210, 0.09);
  --glass: rgba(30, 31, 38, 0.84); --glass-edge: rgba(255, 245, 230, 0.08);
  color-scheme: dark;
}
.btn-primary { --btn: var(--amber); }
:root[data-theme="dark"] .btn-primary { color: #241500; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .btn-primary { color: #241500; } }

/* ---------- tabs ---------- */
#stack .tab-pane { position: absolute; inset: 0; }
#stack .screen-body { padding-bottom: var(--tabbar-space); }
.tabbar { position: absolute; z-index: 10; left: 50%; bottom: calc(var(--sab) + 18px); transform: translateX(-50%); display: grid; grid-template-columns: repeat(3, 92px); padding: 4px; border-radius: 34px;
  background: var(--glass); -webkit-backdrop-filter: blur(20px) saturate(1.8); backdrop-filter: blur(20px) saturate(1.8); box-shadow: 0 0 0 0.5px var(--glass-edge), 0 8px 30px rgba(0, 0, 0, 0.18); --i: 0; }
.tab-pill { position: absolute; top: 4px; bottom: 4px; left: 4px; width: 92px; border-radius: 30px; background: var(--fill); transform: translateX(calc(var(--i) * 100%)); transition: transform 0.38s var(--ease); }
.tab-item { position: relative; z-index: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; height: 54px; border-radius: 30px; color: var(--text); }
.tab-item.on { color: var(--amber); }
.tab-icon { width: 26px; height: 26px; display: grid; place-items: center; }
.tab-icon svg { width: 26px; height: 26px; }
.tab-label { font-size: 10px; line-height: 12px; font-weight: 600; letter-spacing: 0.01em; }
.tab-item:active .tab-icon { transform: scale(0.92); }
body.has-sheet .tabbar, body.on-stage .tabbar { visibility: hidden; }
@media (min-width: 700px) {
  .tabbar { bottom: auto; top: calc(var(--sat) + 8px); grid-template-columns: repeat(3, 118px); padding: 3px; border-radius: 26px; }
  .tab-pill { top: 3px; bottom: 3px; left: 3px; width: 118px; border-radius: 22px; }
  .tab-item { flex-direction: row; gap: 6px; height: 44px; border-radius: 22px; }
  .tab-icon, .tab-icon svg { width: 20px; height: 20px; }
  .tab-label { font-size: 15px; line-height: 20px; }
  #stack .screen.tab-root .nav-title { visibility: hidden; }
  #stack .screen-body { padding-bottom: calc(var(--sab) + 32px); }
}

/* ---------- shared ---------- */
.wrap { max-width: 980px; margin: 0 auto; padding: 0 16px; width: 100%; }
.big-title { font: 800 32px/38px var(--sys); letter-spacing: -0.02em; padding: 4px 4px 2px; }
.lede { color: var(--text2); font-size: 15px; line-height: 21px; padding: 0 4px 6px; }
.sec-h { font: 700 13px/18px var(--sys); letter-spacing: 0.06em; text-transform: uppercase; color: var(--text2); padding: 20px 4px 8px; display: flex; align-items: center; gap: 8px; }
.sec-h .grow { flex: 1; }
.sec-h .text-btn { font: 600 15px var(--sys); text-transform: none; letter-spacing: 0; color: var(--amber); min-height: 44px; padding: 0 4px; }
.pro-tag { display: inline-flex; align-items: center; height: 17px; padding: 0 6px; border-radius: 9px; font: 700 10px/17px var(--sys); letter-spacing: 0.06em; color: #241500; background: var(--lit); vertical-align: middle; }
.row .grow { flex: 1 1 auto; min-width: 0; }
.row .r-title { font-weight: 600; }
.row .r-sub { color: var(--text2); font-size: 14px; line-height: 19px; margin-top: 1px; }
.row .r-end { color: var(--text2); font-size: 15px; white-space: nowrap; font-variant-numeric: tabular-nums; }
.chip-scroll { display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; padding: 2px 4px 6px; margin: 0 -4px; scroll-snap-type: x proximity; }
.chip-scroll::-webkit-scrollbar { display: none; }
.empty { color: var(--text2); text-align: center; padding: 22px 12px; font-size: 15px; }
.mono { font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; }

/* the slider rows (from the kit's page.css) */
.slider-row { flex-direction: column; align-items: stretch; gap: 10px; padding-top: 14px; padding-bottom: 16px; }
.slider-top { display: flex; justify-content: space-between; align-items: baseline; }
.slider-top .v { color: var(--text2); font-variant-numeric: tabular-nums; }
.ios-range { -webkit-appearance: none; appearance: none; width: 100%; height: 44px; background: transparent; margin: 0; cursor: pointer; }
.ios-range::-webkit-slider-runnable-track { height: 4px; border-radius: 2px; background: linear-gradient(to right, var(--tint) var(--p, 50%), var(--fill) var(--p, 50%)); }
.ios-range::-webkit-slider-thumb { -webkit-appearance: none; width: 28px; height: 28px; margin-top: -12px; border-radius: 50%; background: #fff; box-shadow: 0 0.5px 4px rgba(0,0,0,.12), 0 6px 13px rgba(0,0,0,.12), 0 0 0 .5px rgba(0,0,0,.04); }
.ios-range::-moz-range-track { height: 4px; border-radius: 2px; background: var(--fill); }
.ios-range::-moz-range-progress { height: 4px; border-radius: 2px; background: var(--tint); }
.ios-range::-moz-range-thumb { width: 28px; height: 28px; border: 0; border-radius: 50%; background: #fff; box-shadow: 0 2px 8px rgba(0,0,0,.2); }
.slider-ends { display: flex; justify-content: space-between; font-size: 13px; color: var(--text2); margin-top: -8px; }

/* ---------- Play ---------- */
.now-card { display: flex; align-items: center; gap: 14px; padding: 6px 4px 10px; min-height: 84px; }
.now-key { font: 800 64px/1 var(--sys); letter-spacing: -0.04em; min-width: 1.6ch; color: var(--text3); font-variant-numeric: tabular-nums; transition: color 0.4s; }
.now-card.on .now-key { color: var(--amber); text-shadow: 0 0 28px color-mix(in srgb, var(--amber) 45%, transparent); }
.now-txt { flex: 1; min-width: 0; }
.now-sound { font: 700 19px/24px var(--sys); }
.now-state { color: var(--text2); font-size: 15px; line-height: 20px; }
.now-stop { flex: none; min-width: 92px; min-height: 48px; border-radius: 24px; background: var(--fill); font-weight: 700; display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 0 16px; }
.now-stop:disabled { opacity: 0.4; }
.mode-row { display: flex; gap: 10px; align-items: center; padding: 0 0 10px; }
.mode-row .segmented { flex: 1; max-width: 320px; }
.keys { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; touch-action: manipulation; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; }
@media (min-width: 620px) { .keys { grid-template-columns: repeat(6, 1fr); } }
.key { position: relative; aspect-ratio: 1 / 0.9; min-height: 64px; border-radius: 20px; background: var(--key); box-shadow: 0 0 0 1px var(--key-edge), 0 1px 2px rgba(0,0,0,0.08); color: var(--key-text);
  display: flex; align-items: center; justify-content: center; font: 750 clamp(22px, 6vw, 34px)/1 var(--sys); letter-spacing: -0.02em; transition: background 0.35s, color 0.35s, transform 0.12s, box-shadow 0.35s; overflow: hidden; }
.key small { font-size: 0.55em; font-weight: 700; margin-left: 1px; opacity: 0.8; }
.key:active { transform: scale(0.96); }
.key.lit { background: var(--lit); color: var(--lit-text); box-shadow: 0 0 0 1px var(--lit), 0 6px 28px color-mix(in srgb, var(--lit) 45%, transparent); }
.key.lit.fading::after { content: ""; position: absolute; inset: 0; background: linear-gradient(90deg, transparent, rgba(255,255,255,0.35), transparent); animation: sweep 1.2s linear infinite; }
.key.going { background: color-mix(in srgb, var(--lit) 30%, var(--key)); }
.key .hold { position: absolute; inset: auto 0 0 0; height: 4px; background: var(--key-text); opacity: 0.35; transform-origin: left; transform: scaleX(0); }
.key.holding .hold { transition: transform 0.6s linear; transform: scaleX(1); }
@keyframes sweep { from { transform: translateX(-100%); } to { transform: translateX(100%); } }
.sounds { padding-top: 4px; }
.snd { flex: none; scroll-snap-align: start; min-width: 108px; min-height: 64px; padding: 10px 12px; border-radius: 16px; background: var(--row); box-shadow: 0 0 0 1px var(--key-edge); text-align: left; display: flex; flex-direction: column; justify-content: center; gap: 2px; }
.snd b { font-size: 16px; display: flex; align-items: center; gap: 6px; }
.snd span { font-size: 12px; color: var(--text2); line-height: 15px; }
.snd[aria-pressed="true"] { background: color-mix(in srgb, var(--amber) 18%, var(--row)); box-shadow: 0 0 0 2px var(--amber); }
.snd.layer[aria-pressed="true"] { box-shadow: 0 0 0 2px var(--violet); background: color-mix(in srgb, var(--violet) 16%, var(--row)); }
.swell { display: flex; align-items: center; gap: 14px; padding: 14px 16px; border-radius: 22px; background: var(--row); margin-top: 8px; }
.swell label { font-weight: 700; font-size: 15px; min-width: 52px; }
.swell .v { font-variant-numeric: tabular-nums; color: var(--text2); min-width: 40px; text-align: right; font-size: 15px; }
.fader { -webkit-appearance: none; appearance: none; flex: 1; height: 56px; background: transparent; margin: 0; cursor: pointer; touch-action: none; }
.fader::-webkit-slider-runnable-track { height: 14px; border-radius: 7px; background: linear-gradient(to right, var(--amber) var(--p, 80%), var(--fill) var(--p, 80%)); }
.fader::-webkit-slider-thumb { -webkit-appearance: none; width: 30px; height: 46px; margin-top: -16px; border-radius: 10px; background: #fff; box-shadow: 0 1px 6px rgba(0,0,0,.25), 0 0 0 .5px rgba(0,0,0,.06); }
.fader::-moz-range-track { height: 14px; border-radius: 7px; background: var(--fill); }
.fader::-moz-range-progress { height: 14px; border-radius: 7px; background: var(--amber); }
.fader::-moz-range-thumb { width: 30px; height: 46px; border: 0; border-radius: 10px; background: #fff; box-shadow: 0 1px 6px rgba(0,0,0,.25); }
.knobs { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; }
@media (max-width: 520px) { .knobs { grid-template-columns: 1fr; } }
/* the click */
.click-card { margin-top: 8px; padding: 14px 16px 16px; border-radius: 22px; background: var(--row); }
.click-top { display: flex; align-items: center; gap: 10px; }
.bpm { display: flex; align-items: baseline; gap: 4px; flex: 1; min-width: 0; }
.bpm b { font: 800 44px/1 var(--sys); font-variant-numeric: tabular-nums; letter-spacing: -0.03em; }
.bpm span { color: var(--text2); font-weight: 600; }
.round { width: 48px; height: 48px; border-radius: 24px; background: var(--fill); display: inline-grid; place-items: center; font-size: 24px; font-weight: 600; flex: none; }
.round svg { width: 22px; height: 22px; }
.pill-btn { min-height: 48px; padding: 0 18px; border-radius: 24px; background: var(--fill); font-weight: 700; display: inline-flex; align-items: center; justify-content: center; gap: 6px; }
.pill-btn.go { background: var(--amber); color: var(--lit-text); }
.pill-btn.go.on { background: var(--text); color: var(--canvas); }
.beats { display: flex; gap: 6px; padding: 14px 0 4px; }
.beats i { flex: 1; height: 10px; border-radius: 5px; background: var(--fill); transition: background 0.06s; }
.beats i.acc { background: color-mix(in srgb, var(--amber) 30%, var(--fill)); }
.beats i.now { background: var(--amber); }
.click-row { display: flex; flex-wrap: wrap; gap: 8px; padding-top: 10px; }
.click-row select, .sel { min-height: 44px; border-radius: 22px; background: var(--fill); border: 0; padding: 0 14px; font-weight: 600; color: var(--text); -webkit-appearance: none; appearance: none; }
.meter { margin-top: 10px; height: 6px; border-radius: 3px; background: var(--fill); overflow: hidden; }
.meter i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--amber), #ff7a45); border-radius: 3px; transition: width 0.08s; }
/* ---------- setlists ---------- */
.set-head { display: flex; gap: 10px; align-items: center; padding: 6px 4px 12px; flex-wrap: wrap; }
.set-head .grow { flex: 1; min-width: 160px; }
.set-head h2 { font: 800 26px/30px var(--sys); letter-spacing: -0.02em; margin: 0; }
.set-head .sub { color: var(--text2); font-size: 15px; }
.song-key { display: inline-grid; place-items: center; min-width: 44px; height: 44px; border-radius: 12px; background: var(--fill); font: 800 17px var(--sys); color: var(--amber); flex: none; }
.song-num { width: 22px; color: var(--text3); font-variant-numeric: tabular-nums; font-weight: 600; text-align: right; flex: none; }
.row.dragging { opacity: 0.6; }
.drag-h { width: 44px; height: 44px; display: grid; place-items: center; color: var(--text3); touch-action: none; flex: none; cursor: grab; }
.search { display: flex; align-items: center; gap: 8px; margin: 0 0 10px; padding: 0 12px; min-height: 44px; border-radius: 12px; background: var(--fill); }
.search input { flex: 1; border: 0; background: none; outline: none; font-size: 17px; min-height: 44px; }
.struct { display: flex; flex-wrap: wrap; gap: 6px; }
.struct span { padding: 4px 9px; border-radius: 9px; background: var(--fill); font-size: 13px; font-weight: 600; }
.chart-edit { width: 100%; min-height: 280px; border: 0; background: var(--row); color: var(--text); border-radius: 14px; padding: 14px; font: 15px/1.5 ui-monospace, "SF Mono", Menlo, monospace; resize: vertical; }
/* ---------- the stage ---------- */
.stage-body { padding: 0 !important; display: flex; flex-direction: column; height: 100%; overflow: hidden !important; }
.stage-bar { display: flex; align-items: center; gap: 10px; padding: 6px 14px 8px; flex-wrap: wrap; border-bottom: 1px solid var(--sep); }
.stage-bar .grow { flex: 1; min-width: 0; }
.stage-title { font: 800 20px/24px var(--sys); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stage-meta { color: var(--text2); font-size: 14px; display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.stage-meta b { color: var(--amber); }
.sect { font-weight: 700; color: var(--text); }
.chart { flex: 1; overflow-y: auto; padding: 18px 20px 40vh; -webkit-overflow-scrolling: touch; overscroll-behavior: contain; --fs: 22px; }
.chart .sec { margin: 0 0 1.1em; }
.chart .sec-label { font: 800 calc(var(--fs) * 0.62)/1.2 var(--sys); letter-spacing: 0.08em; text-transform: uppercase; color: var(--violet); margin-bottom: 0.35em; }
.chart .sec.now .sec-label { color: var(--amber); }
.chart .ln { font: 500 var(--fs)/1.3 var(--sys); margin-bottom: 0.35em; }
.chart .ln .c { color: var(--amber); font-weight: 800; display: block; white-space: pre; font-size: 0.9em; }
.chart .ln.segs { display: flex; flex-wrap: wrap; align-items: flex-end; }
.chart .ln .sg { display: inline-flex; flex-direction: column; }
.chart .ln.segs .w { white-space: pre; display: block; }
.chart .ln.chords-only { display: flex; flex-wrap: wrap; gap: 0.3em 1.1em; }
.chart .ln.chords-only .c { font-size: 1em; }
.chart .note { font-style: italic; color: var(--text2); font-family: var(--sys); white-space: normal; }
.chart .ref { color: var(--text2); font: 600 calc(var(--fs) * 0.8) var(--sys); }
.stage-foot { display: flex; align-items: center; gap: 10px; padding: 10px 14px calc(var(--sab) + 10px); border-top: 1px solid var(--sep); background: var(--canvas); justify-content: space-between; }
.stage-foot .mid { display: flex; gap: 10px; align-items: center; }
.big-go { min-width: 120px; min-height: 56px; border-radius: 28px; background: var(--amber); color: var(--lit-text); font: 800 18px var(--sys); display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 0 22px; }
.big-go.on { background: var(--text); color: var(--canvas); }
.next-up { color: var(--text2); font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 2px; }
.bar-dots { display: inline-flex; gap: 4px; }
.bar-dots i { width: 9px; height: 9px; border-radius: 5px; background: var(--fill); }
.bar-dots i.now { background: var(--amber); }
.toolbar-row { display: flex; gap: 8px; padding: 8px 14px; overflow-x: auto; scrollbar-width: none; border-bottom: 1px solid var(--sep); }
.toolbar-row::-webkit-scrollbar { display: none; }
.tb { flex: none; min-height: 40px; min-width: 44px; padding: 0 12px; border-radius: 20px; background: var(--fill); font-weight: 650; font-size: 15px; display: inline-flex; align-items: center; justify-content: center; gap: 6px; }
.tb[aria-pressed="true"] { background: var(--amber); color: var(--lit-text); }
/* print: the set sheet only */
#print { display: none; }
@media print {
  body > *:not(#print) { display: none !important; }
  #print { display: block; color: #000; font: 13pt/1.4 -apple-system, system-ui, sans-serif; padding: 0; }
  #print h1 { font-size: 22pt; margin: 0 0 4pt; }
  #print table { width: 100%; border-collapse: collapse; margin-top: 12pt; }
  #print td, #print th { text-align: left; padding: 6pt 4pt; border-bottom: 0.5pt solid #999; vertical-align: top; }
  #print .k { font-weight: 800; font-size: 16pt; }
  html, body { height: auto; overflow: visible; background: #fff; }
}
@media (max-width: 520px) { .set-head .big-go { flex: 1 1 100%; } }
/* mobile.js sets a 40 px floor on buttons; ours are 44 px or more (ADDING-APPS.md: tap targets) */
:root:root .now-stop, :root:root .pill-btn, :root:root .sel, :root:root .round, :root:root .tb, :root:root .big-go { min-height: 48px; }
:root:root .tb { min-height: 44px; }
