:root {
  --bg: #0b0c10;
  --bg2: #111319;
  --card: #15171e;
  --raised: #1c1f28;
  --raised2: #242834;
  --line: #2a2e3a;
  --ink: #f4f3f0;
  --ink2: #b3b6c0;
  --ink3: #737887;
  --accent: #ff7a59;
  --accent2: #ff9a6b;
  --accent-ink: #1b0c06;
  --rec: #ff4d5e;
  --good: #6fe0bd;
  --warn: #ffc857;
  --r: 16px;
  --rs: 10px;
  /* row height fits 9 tracks on screen with everything else visible */
  /* the VISIBLE height: on iPad Safari 100vh includes the toolbars and would push the bottom off */
  --vh: 100vh;
  --cell: clamp(40px, calc((var(--vh) - 360px) / 9.9), 64px); /* never under 40 px: a comfortable tap */
  color-scheme: dark;
}
@supports (height: 100dvh) {
  :root { --vh: 100dvh; }
  html, body { height: 100dvh; }
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; height: 100%; }
body {
  background: radial-gradient(1200px 600px at 70% -10%, #1a1420 0%, transparent 60%), radial-gradient(900px 500px at -10% 110%, #10191c 0%, transparent 55%), var(--bg);
  color: var(--ink);
  font: 15px/1.4 "Segoe UI Variable Text", "Segoe UI Variable", "Segoe UI", system-ui, sans-serif;
  -webkit-user-select: none;
  user-select: none;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent; /* no grey flash on every tap in iPad Safari */
  -webkit-text-size-adjust: 100%;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  /* keep clear of the iPad's home bar and rounded corners */
  padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
}
button, select, input, textarea { font: inherit; color: inherit; }
button { cursor: pointer; border: 0; background: none; padding: 0; }
svg { width: 20px; height: 20px; fill: currentColor; flex: none; }
:focus-visible { outline: 3px solid #fff; outline-offset: 2px; border-radius: 10px; }
.card { background: linear-gradient(180deg, rgba(255,255,255,.025), rgba(255,255,255,0)) , var(--card); border: 1px solid rgba(255,255,255,.05); border-radius: var(--r); box-shadow: 0 10px 30px rgba(0,0,0,.25); }

/* ---------- top bar ---------- */
.top { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 16px; padding: 12px 22px; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 650; letter-spacing: .2px; color: var(--ink2); }
.brand img { width: 30px; height: 30px; border-radius: 8px; }
.modes { display: flex; gap: 2px; background: var(--bg2); border: 1px solid var(--line); border-radius: 999px; padding: 4px; }
.modes button { display: flex; align-items: center; gap: 8px; padding: 9px 20px; border-radius: 999px; color: var(--ink2); font-weight: 600; min-height: 42px; transition: background .15s, color .15s; }
.modes button svg { width: 18px; height: 18px; }
.modes button[aria-selected="true"] { background: var(--ink); color: var(--bg); }
.transport { justify-self: end; display: flex; align-items: center; gap: 12px; }
.lcd { display: flex; align-items: center; gap: 16px; background: #07080b; border: 1px solid var(--line); border-radius: 14px; padding: 6px 10px 6px 16px; height: 56px; font-variant-numeric: tabular-nums; }
.lcd > div { display: flex; flex-direction: column; line-height: 1.05; min-width: 30px; }
.lcd small { font-size: 11px; color: var(--ink3); }
.lcd b { font-size: 20px; font-weight: 650; color: var(--good); }
.lcd .tempo { flex-direction: row; align-items: center; gap: 4px; }
.lcd .tempo > div { display: flex; flex-direction: column; line-height: 1.05; min-width: 44px; text-align: center; }
.lcd .tempo b { color: var(--ink); }
.nudge { width: 32px; height: 32px; border-radius: 8px; color: var(--ink2); font-size: 18px; background: var(--raised); }
.nudge:active { background: var(--raised2); }
#vu { width: 8px; height: 40px; border-radius: 4px; background: var(--raised); }
.play { width: 56px; height: 56px; border-radius: 50%; display: grid; place-items: center; background: var(--accent); color: var(--accent-ink); box-shadow: 0 6px 22px rgba(255,122,89,.35); transition: transform .08s; }
.play svg { width: 26px; height: 26px; }
.play:active { transform: scale(.95); }
.play.big { width: 72px; height: 72px; }
.play.big svg { width: 32px; height: 32px; }
.play.on { background: var(--ink); color: var(--bg); box-shadow: none; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 42px; padding: 0 16px; border-radius: 12px; background: var(--raised); color: var(--ink); font-weight: 600; border: 1px solid rgba(255,255,255,.04); transition: background .15s, transform .08s; white-space: nowrap; }
@media (hover: hover) { .btn:hover { background: var(--raised2); } .btn.primary:hover { background: var(--accent2); } }
.btn:active { transform: scale(.97); }
.btn:disabled { opacity: .35; cursor: default; transform: none; }
.btn svg { width: 18px; height: 18px; }
.btn.icon { width: 42px; padding: 0; }
.btn.primary { background: var(--accent); color: var(--accent-ink); border-color: transparent; }
.btn.accent { background: rgba(255,122,89,.14); color: var(--accent2); border-color: rgba(255,122,89,.3); }
.btn.big { min-height: 54px; padding: 0 26px; font-size: 17px; border-radius: 14px; }
.btn.wide { width: 100%; }
.file input { display: none; }

main { flex: 1; min-height: 0; position: relative; }
.mode { position: absolute; inset: 0; padding: 2px 22px 14px; display: none; flex-direction: column; gap: 10px; overflow: auto; }
.mode.on { display: flex; animation: fade .18s ease-out; }
@keyframes fade { from { opacity: 0; transform: translateY(4px); } }

/* ---------- beat ---------- */
.vibes { display: flex; gap: 10px; overflow-x: auto; padding-bottom: 2px; }
.vibe { flex: 1 0 130px; min-height: 50px; border-radius: 14px; padding: 10px 14px; text-align: left; display: flex; flex-direction: column; justify-content: center; gap: 2px; position: relative; overflow: hidden; background: var(--card); border: 1px solid var(--line); transition: border-color .15s, transform .08s; }
.vibe::before { content: ""; position: absolute; inset: 0; background: var(--g); opacity: .18; transition: opacity .15s; }
.vibe b, .vibe small { position: relative; }
.vibe b { font-size: 16px; }
.vibe small { color: var(--ink2); font-size: 12px; }
.vibe[aria-checked="true"] { border-color: var(--ink); }
.vibe[aria-checked="true"]::before { opacity: .55; }
.vibe:active { transform: scale(.98); }
.hint-line { color: var(--ink3); font-size: 13px; }

.grid-wrap { background: var(--card); border: 1px solid rgba(255,255,255,.05); border-radius: var(--r); padding: 12px 14px; }
.steps-head, .row { display: grid; grid-template-columns: 150px repeat(16, minmax(0, 1fr)); column-gap: 5px; align-items: center; }
.row .name .lbl { text-align: left; height: 100%; }
.steps-head { margin-bottom: 6px; }
.steps-head span { text-align: center; font-size: 11px; color: var(--ink3); font-variant-numeric: tabular-nums; border-radius: 6px; padding: 2px 0; }
.steps-head span.bar1 { color: var(--ink2); font-weight: 700; }
.steps-head span.now { background: var(--ink); color: var(--bg); }
.grid { display: flex; flex-direction: column; gap: 5px; }
.steps-head > :nth-child(4n+5), .row > .cell:nth-child(4n+6) { margin-left: 6px; }
.row .name { height: var(--cell); display: flex; align-items: center; gap: 8px; padding: 0 6px 0 10px; border-radius: var(--rs); background: var(--raised); font-weight: 600; font-size: 13.5px; color: var(--ink); text-align: left; }
.row .name i { width: 8px; height: 22px; border-radius: 4px; background: var(--c); flex: none; }
.row .name .lbl { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row .name .m { width: 26px; height: 26px; border-radius: 7px; font-size: 11px; font-weight: 700; color: var(--ink3); background: var(--bg2); display: grid; place-items: center; }
.row .name .m.on { background: var(--warn); color: #241a00; }
.row.muted .cell.on { opacity: .25; }
.row.muted .name .lbl { color: var(--ink3); }
.cell { height: var(--cell); border-radius: var(--rs); background: var(--raised); position: relative; transition: transform .06s, background .1s; }
.cell.alt { background: #191c24; }
/* hover only with a mouse: on touch a tapped cell would otherwise stay "hovered" */
@media (hover: hover) { .cell:not(.on):hover { background: var(--raised2); } }
.cell.on { background: var(--c); box-shadow: 0 0 0 1px rgba(255,255,255,.18) inset, 0 0 16px color-mix(in srgb, var(--c) 40%, transparent); }
.cell.on.soft { background: color-mix(in srgb, var(--c) 55%, var(--raised)); box-shadow: none; }
.cell.head { outline: 2px solid rgba(255,255,255,.85); outline-offset: -2px; }
.cell.on.head { filter: brightness(1.25); }
.cell:active { transform: scale(.92); }

.toolbar { display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.group { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.field { display: flex; align-items: center; gap: 8px; height: 42px; padding: 0 4px 0 12px; border-radius: 12px; background: var(--raised); color: var(--ink3); font-size: 13px; font-weight: 600; border: 1px solid rgba(255,255,255,.04); }
select { background: var(--bg2); border: 1px solid var(--line); border-radius: 9px; padding: 0 10px; height: 34px; color: var(--ink); font-weight: 600; }
select.wide { width: 100%; height: 42px; border-radius: 12px; }

.drawer { background: var(--card); border: 1px solid rgba(255,255,255,.05); border-radius: var(--r); padding: 14px; display: flex; flex-direction: column; gap: 12px; }
.drawer-head { display: flex; align-items: center; gap: 24px; }
.drawer-head .slider { flex: 1; max-width: 420px; }
.mixer { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 8px; }
.strip { background: var(--raised); border-radius: 12px; padding: 10px 12px; display: flex; flex-direction: column; gap: 8px; }
.strip .t { display: flex; align-items: center; gap: 8px; font-weight: 600; font-size: 13px; }
.strip .t i { width: 8px; height: 8px; border-radius: 50%; background: var(--c); }
.strip input { accent-color: var(--c); width: 100%; }
.strip .smute { margin-left: auto; min-height: 40px; min-width: 64px; padding: 0 10px; border-radius: 10px; background: var(--bg2); color: var(--ink2); font-size: 12px; font-weight: 700; }
.strip .smute.on { background: var(--warn); color: #241a00; }

.slider { display: flex; align-items: center; gap: 10px; color: var(--ink2); font-weight: 600; font-size: 14px; min-height: 40px; }
.slider svg { width: 18px; height: 18px; color: var(--ink3); }
.slider input { flex: 1; accent-color: var(--accent); min-width: 60px; }
.slider output { min-width: 50px; text-align: right; color: var(--ink3); font-variant-numeric: tabular-nums; font-size: 13px; }
.toggle { display: flex; align-items: center; gap: 12px; min-height: 42px; color: var(--ink2); font-weight: 600; font-size: 14px; cursor: pointer; }
.toggle input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.toggle span { width: 42px; height: 24px; border-radius: 999px; background: var(--raised2); position: relative; flex: none; transition: background .15s; }
.toggle span::after { content: ""; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: var(--ink2); transition: transform .15s, background .15s; }
.toggle input:checked + span { background: var(--accent); }
.toggle input:checked + span::after { transform: translateX(18px); background: #fff; }
.toggle input:focus-visible + span { outline: 3px solid #fff; outline-offset: 2px; }

/* ---------- vocals ---------- */
.rec-layout, .k-layout { display: grid; grid-template-columns: 1fr 330px; gap: 14px; min-height: 100%; }
.rec-main { display: flex; flex-direction: column; gap: 14px; padding: 18px; }
.rec-top { display: flex; align-items: center; gap: 22px; }
.rec-btn { width: 108px; height: 108px; border-radius: 50%; background: var(--raised); border: 1px solid var(--line); position: relative; flex: none; }
.rec-btn .ring { position: absolute; inset: 18px; border-radius: 50%; background: var(--rec); box-shadow: 0 0 30px rgba(255,77,94,.45); transition: inset .2s, border-radius .2s; }
.rec-btn.live .ring { inset: 34px; border-radius: 10px; animation: pulse 1.2s infinite; }
@keyframes pulse { 50% { box-shadow: 0 0 0 16px rgba(255,77,94,.12); } }
.rec-copy { flex: 1; display: flex; flex-direction: column; gap: 6px; }
.rec-status { font-size: 24px; font-weight: 700; }
.rec-status.count { font-size: 40px; color: var(--warn); }
.rec-status.live { color: var(--rec); }
.rec-sub { color: var(--ink2); }
.meter { height: 6px; border-radius: 99px; background: var(--raised); overflow: hidden; max-width: 420px; }
.meter div { height: 100%; width: 0; background: linear-gradient(90deg, var(--good), var(--warn) 75%, var(--rec)); transition: width .06s; }
.lane { display: flex; flex-direction: column; gap: 6px; }
.lane-label { font-size: 12px; color: var(--ink3); font-weight: 600; }
.wave { width: 100%; height: 120px; border-radius: 12px; background: #0d0f14; border: 1px solid var(--line); }
.tl { display: flex; flex-direction: column; gap: 8px; }
.tl-head { display: flex; align-items: center; gap: 12px; }
.tl-time { font-size: 20px; font-variant-numeric: tabular-nums; color: var(--good); min-width: 80px; }
.tl-hint { flex: 1; }
.timeline { width: 100%; height: 168px; border-radius: 12px; background: #0d0f14; border: 1px solid var(--line); touch-action: none; cursor: pointer; }
.tl-sel { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; background: var(--raised); border-radius: 12px; padding: 8px 12px; }
.tl-sel .slider { flex: 1; min-width: 200px; }
.tl-nudge { display: flex; align-items: center; gap: 8px; }
.tl-off { min-width: 92px; text-align: center; font-variant-numeric: tabular-nums; color: var(--ink2); font-weight: 600; }
.lyrics-pad { flex: 1; min-height: 140px; resize: none; border: 1px solid var(--line); border-radius: 12px; background: #0d0f14; padding: 14px 16px; font-size: 22px; line-height: 1.5; -webkit-user-select: text; user-select: text; }
.lyrics-pad::placeholder { color: var(--ink3); }
.side { padding: 16px; display: flex; flex-direction: column; gap: 8px; align-self: start; }
.side h3 { margin: 8px 0 0; font-size: 12px; color: var(--ink3); font-weight: 650; letter-spacing: .3px; }
.side h3:first-child { margin-top: 0; }
.fine { margin: 0; color: var(--ink3); font-size: 12.5px; }
.takes { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.takes li { display: flex; align-items: center; gap: 10px; background: var(--raised); border-radius: 12px; padding: 6px 6px 6px 10px; min-height: 46px; }
.takes li.empty { background: none; color: var(--ink3); padding: 4px 0; min-height: 0; }
.takes li .nm { flex: 1; font-weight: 600; text-align: left; min-height: 40px; border-radius: 8px; padding: 0 4px; width: auto; height: auto; color: var(--ink); display: block; }
.takes li small { color: var(--ink3); font-variant-numeric: tabular-nums; }
.takes li button { width: 34px; height: 34px; border-radius: 9px; color: var(--ink3); display: grid; place-items: center; }
.takes li button:hover { background: var(--raised2); color: var(--ink); }
.takes li button svg { width: 17px; height: 17px; }
.chk { width: 24px; height: 24px; border-radius: 7px; border: 2px solid var(--ink3); display: grid; place-items: center; flex: none; }
.chk.on { background: var(--accent); border-color: var(--accent); }
.chk.on::after { content: ""; width: 6px; height: 11px; border: solid var(--accent-ink); border-width: 0 2.5px 2.5px 0; transform: translateY(-1px) rotate(45deg); }

/* ---------- karaoke ---------- */
.k-main { display: flex; flex-direction: column; min-height: 460px; }
.k-empty { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; gap: 12px; padding: 30px; }
.k-empty h2 { margin: 6px 0 0; font-size: 30px; }
.k-empty p { margin: 0 0 8px; color: var(--ink2); max-width: 420px; font-size: 16px; }
.k-empty-icon { width: 76px; height: 76px; border-radius: 22px; display: grid; place-items: center; background: rgba(255,122,89,.14); color: var(--accent2); }
.k-empty-icon svg { width: 38px; height: 38px; }
.k-stage { flex: 1; display: flex; flex-direction: column; gap: 12px; padding: 18px; }
.k-title-row { display: flex; align-items: center; gap: 12px; }
.k-title { display: flex; flex-direction: column; flex: 1; min-width: 0; }
.k-title b { font-size: 18px; }
.k-title span { color: var(--ink3); font-size: 13px; }
.lyrics { flex: 1; display: flex; flex-direction: column; justify-content: center; align-items: center; text-align: center; gap: 14px; min-height: 200px; overflow: hidden; }
.lyrics p { margin: 0; font-size: 24px; color: var(--ink3); max-width: 95%; }
.lyrics p.cur { font-size: clamp(30px, 3.3vw, 52px); font-weight: 750; line-height: 1.15; background: linear-gradient(90deg, var(--ink) var(--p, 0%), #5b6070 var(--p, 0%)); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; }
.lyrics p.next { color: var(--ink2); font-size: 26px; }
.lyrics p.wait { color: var(--ink2); font-size: 22px; }
.k-progress { height: 4px; border-radius: 99px; background: var(--raised); overflow: hidden; }
.k-progress div { height: 100%; width: 0; background: var(--accent); }
.pitch { width: 100%; height: 130px; border-radius: 12px; background: #0d0f14; border: 1px solid var(--line); }
.k-bar { display: flex; align-items: center; gap: 22px; }
.score { display: flex; flex-direction: column; min-width: 140px; }
.score b { font-size: 36px; line-height: 1; font-variant-numeric: tabular-nums; }
.score span { color: var(--ink3); font-size: 13px; }
.k-note { margin-left: auto; color: var(--ink3); font-size: 13px; text-align: right; max-width: 360px; }
.k-alt { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; }
.k-alt-note { max-width: 460px; }
.k-sync { display: flex; align-items: center; gap: 10px; }
.k-sync .btn { min-height: 48px; min-width: 104px; }
.k-time { display: flex; flex-direction: column; align-items: center; min-width: 150px; }
.k-time b { font-size: 22px; font-variant-numeric: tabular-nums; }
.k-time small { color: var(--ink3); font-size: 12px; text-align: center; max-width: 320px; }
.k-time small.warn { color: var(--warn); }
.k-meter { width: 160px; height: 5px; margin-top: 4px; }
.lyrics.tappable p { cursor: pointer; border-radius: 12px; padding: 2px 10px; }
.lyrics.tappable p:active { background: var(--raised); }
.ai-box { background: var(--raised); border-radius: 12px; padding: 12px; display: flex; flex-direction: column; gap: 8px; margin-top: 4px; }
.ai-head { display: flex; align-items: center; gap: 8px; }
.ai-head svg { color: var(--warn); width: 18px; height: 18px; }
.ai-status { color: var(--ink2); font-size: 13px; }
.ai-box .bar { height: 6px; border-radius: 99px; background: var(--bg2); overflow: hidden; }
.ai-box .bar div { height: 100%; width: 0; background: linear-gradient(90deg, var(--warn), var(--accent)); transition: width .3s; }
.ai-box.done .bar div { background: var(--good); }
.search { display: flex; align-items: center; gap: 8px; background: var(--raised); border-radius: 12px; padding: 0 12px; height: 42px; }
.search svg { color: var(--ink3); width: 18px; height: 18px; }
.search input { flex: 1; background: none; border: 0; outline: none; -webkit-user-select: text; user-select: text; }
.results { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; max-height: 300px; overflow: auto; }
.results button { width: 100%; text-align: left; padding: 8px 10px; border-radius: 10px; display: flex; flex-direction: column; }
.results button:hover, .results button.on { background: var(--raised); }
.results b { font-weight: 600; font-size: 14px; }
.results small { color: var(--ink3); font-size: 12px; }
.results .msg { color: var(--ink3); font-size: 13px; padding: 4px 2px; }

.toast { position: fixed; left: 50%; bottom: 22px; transform: translate(-50%, 30px); opacity: 0; background: var(--ink); color: var(--bg); padding: 12px 20px; border-radius: 14px; font-weight: 600; transition: .2s; pointer-events: none; max-width: 90vw; box-shadow: 0 10px 30px rgba(0,0,0,.4); z-index: 10; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ---------- quality ---------- */
.q-chip { display: flex; flex-direction: column; align-items: flex-start; justify-content: center; height: 56px; padding: 0 14px; border-radius: 14px; background: #07080b; border: 1px solid var(--line); line-height: 1.1; }
.q-chip small { font-size: 11px; color: var(--ink3); }
.q-chip b { font-size: 14px; color: var(--warn); white-space: nowrap; }
.sheet-back { position: fixed; inset: 0; background: rgba(0,0,0,.55); display: grid; place-items: center; z-index: 20; animation: fade .15s ease-out; padding: 20px; }
.sheet { width: min(620px, 100%); max-height: 100%; overflow: auto; padding: 20px; display: flex; flex-direction: column; gap: 10px; }
.sheet-head { display: flex; align-items: center; justify-content: space-between; }
.sheet h2 { margin: 0; font-size: 22px; }
.sheet h3 { margin: 6px 0 0; font-size: 12px; color: var(--ink3); }
.q-cards { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.q-card { min-height: 76px; border-radius: 14px; padding: 12px 14px; text-align: left; background: var(--raised); border: 2px solid transparent; display: flex; flex-direction: column; gap: 2px; }
.q-card b { font-size: 17px; }
.q-card small { color: var(--ink2); }
.q-card em { font-style: normal; color: var(--ink3); font-size: 12px; }
.q-card[aria-checked="true"] { border-color: var(--warn); background: rgba(255,200,87,.08); }
.q-preview { display: flex; align-items: center; gap: 14px; margin-top: 6px; }
.q-live { color: var(--good); }

/* ---------- touch: pads, paint, sizes ---------- */
.view-bar { display: flex; align-items: center; gap: 14px; min-height: 44px; }
.view-bar .hint-line { flex: 1; }
.seg { display: flex; background: var(--bg2); border: 1px solid var(--line); border-radius: 12px; padding: 3px; }
.seg button { display: flex; align-items: center; gap: 6px; height: 38px; padding: 0 14px; border-radius: 9px; color: var(--ink2); font-weight: 600; }
.seg button svg { width: 17px; height: 17px; }
.seg button[aria-selected="true"] { background: var(--raised2); color: var(--ink); }
/* projector (TV remote): a big, always-visible focus ring so you can see where you are */
.tv :focus, .tv :focus-visible { outline: 4px solid #fff; outline-offset: 3px; box-shadow: 0 0 0 8px rgba(255,122,89,.45); }
.tv .cell:focus { z-index: 2; }

/* the song part being heard right now */
.seg button.live { box-shadow: inset 0 -3px 0 var(--accent); }

/* song name in the header opens My songs */
.song-btn { display: flex; flex-direction: column; align-items: flex-start; justify-content: center; min-height: 44px; padding: 2px 10px; border-radius: 10px; text-align: left; max-width: 220px; }
.song-btn small { font-size: 11px; color: var(--ink3); font-weight: 600; }
.song-btn b { font-size: 15px; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 200px; }
.song-btn b::after { content: " ▾"; color: var(--ink3); font-size: 12px; }
@media (hover: hover) { .song-btn:hover { background: var(--raised); } }
.btn.help { width: 40px; min-height: 40px; border-radius: 50%; font-size: 17px; }

.song-list { list-style: none; margin: 4px 0 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.song-list li { display: flex; align-items: center; gap: 8px; background: var(--raised); border-radius: 12px; padding: 6px; border: 2px solid transparent; }
.song-list li.on { border-color: var(--accent); }
.song-list .nm { flex: 1; display: flex; flex-direction: column; align-items: flex-start; text-align: left; min-height: 48px; justify-content: center; padding: 0 8px; border-radius: 9px; }
.song-list .nm b { font-size: 16px; }
.song-list .nm small { color: var(--ink3); }
.song-list .btn { min-height: 44px; }

.checks { display: flex; gap: 8px; flex-wrap: wrap; }
.checks .btn { flex: 1 1 140px; }
.check-msg { min-height: 2.6em; }

.guide { max-width: 520px; }
.g-steps { margin: 4px 0; padding: 0; list-style: none; counter-reset: g; display: flex; flex-direction: column; gap: 12px; }
.g-steps li { counter-increment: g; display: grid; grid-template-columns: 40px 1fr; column-gap: 12px; align-items: start; }
.g-steps li::before { content: counter(g); grid-row: span 2; width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; background: var(--accent); color: var(--accent-ink); font-weight: 700; }
.g-steps b { font-size: 17px; }
.g-steps span { color: var(--ink2); }
.toggle.small { font-size: 13px; }
.grid, .pads { touch-action: none; }
.pads { flex: 1; min-height: 0; display: grid; grid-template-columns: repeat(3, 1fr); grid-auto-rows: 1fr; gap: 10px; }
.pad { border-radius: 18px; background: linear-gradient(160deg, color-mix(in srgb, var(--c) 32%, var(--raised)), var(--raised)); border: 1px solid color-mix(in srgb, var(--c) 40%, transparent); display: flex; flex-direction: column; justify-content: flex-end; align-items: flex-start; padding: 14px 16px; font-weight: 700; font-size: 18px; position: relative; overflow: hidden; transition: transform .05s; min-height: 80px; }
.pad small { font-weight: 600; font-size: 12px; color: var(--ink2); }
.pad.hit { transform: scale(.97); background: var(--c); color: #111; }
.pad.hit small { color: #222; }
/* touch targets: everything at least 40 px (Windows touch guidance) */
.row .name .m { width: 40px; height: min(40px, var(--cell)); border-radius: 9px; font-size: 12px; }
.nudge { width: 40px; height: 40px; font-size: 20px; }
.seg button { height: 42px; }
.takes li button { width: 40px; height: 40px; }
input[type=range] { -webkit-appearance: none; appearance: none; height: 40px; background: transparent; touch-action: none; }
input[type=range]::-webkit-slider-runnable-track { height: 6px; border-radius: 99px; background: var(--raised2); }
input[type=range]::-webkit-slider-thumb { -webkit-appearance: none; width: 26px; height: 26px; margin-top: -10px; border-radius: 50%; background: var(--ink); border: 4px solid var(--accent); box-shadow: 0 2px 8px rgba(0,0,0,.4); }
.strip input[type=range]::-webkit-slider-thumb { border-color: var(--c); }
select { height: 40px; }

@media (max-width: 1180px) {
  .top { grid-template-columns: auto 1fr; }
  .brand span { display: none; }
  .modes { justify-self: center; }
  .transport { grid-column: 1 / -1; justify-self: stretch; justify-content: space-between; }
  .rec-layout, .k-layout { grid-template-columns: 1fr; }
  .steps-head, .row { grid-template-columns: 112px repeat(16, 1fr); column-gap: 4px; }
  .row .name .m { display: none; } /* mute is in the Mix panel on narrow screens */
}

/* iPad (and other tablets) held upright: more room for the 16 squares, styles in two rows */
@media (max-width: 900px) {
  .mode { padding: 2px 12px 12px; }
  .top { padding: 10px 12px; gap: 10px; }
  .vibes { flex-wrap: wrap; overflow: visible; }
  .vibe { flex: 1 0 30%; min-height: 48px; padding: 8px 12px; }
  .grid-wrap { padding: 8px; }
  .steps-head, .row { grid-template-columns: 66px repeat(16, minmax(0, 1fr)); column-gap: 3px; }
  /* no extra gap between groups of 4 here (the light/dark group shading shows them) so every
     square keeps at least 40 px */
  .steps-head > :nth-child(4n+5), .row > .cell:nth-child(4n+6) { margin-left: 0; }
  .row .name { padding: 0 4px 0 6px; gap: 5px; font-size: 12.5px; }
  .row .name .lbl { white-space: normal; line-height: 1.1; overflow: visible; } /* "Open hat" on two lines */
  .row .name i { width: 5px; height: 18px; }
  :root { --cell: clamp(40px, calc((var(--vh) - 420px) / 9.9), 56px); }
  .toolbar .group { flex-wrap: wrap; }
  .view-bar .hint-line { font-size: 12px; }
}
