:root {
  color-scheme: dark;
  font-family: 'Segoe UI', Arial, sans-serif;
  --bg: #20242a;
  --panel: #2b3038;
  --raised: #363d47;
  --line: #505965;
  --text: #f4f5f7;
  --muted: #bac2ce;
  --accent: #3979bd;
  --green: #69d292;
  --blue: #89bdff;
  --red: #f89d98;
  --orange: #e8b370;
  --pad-height: 128px;
  --gap: 8px;
}
* { box-sizing: border-box; }
body { margin: 0; padding: 0 14px; height: 100dvh; display: flex; flex-direction: column; overflow: hidden; background: var(--bg); color: var(--text); font-size: 15px; }
button, input, select { color: inherit; font: inherit; }
button, select, input:not([type=range]):not([type=checkbox]) { min-height: 38px; padding: 7px 11px; border: 1px solid #626c7a; border-radius: 5px; background: var(--raised); }
button { display: inline-flex; justify-content: center; align-items: center; gap: 7px; cursor: pointer; font-weight: 600; }
button:hover { background: #454f5d; border-color: #97a3b3; }
button:active { background: #232a34; }
button:disabled { opacity: .46; cursor: default; }
button:focus-visible, input:focus-visible, select:focus-visible, a:focus-visible { outline: 3px solid #99caff; outline-offset: 2px; }
input, select { min-width: 0; }
select { max-width: 100%; }
input::placeholder { color: var(--muted); }
input[type=range] { accent-color: #83b7ef; width: 100%; cursor: pointer; }
input[type=checkbox] { accent-color: #83b7ef; width: 20px; height: 20px; }
svg { width: 19px; height: 19px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.fa-icon { fill: currentColor; stroke: none; }
.music-select-trigger > [data-icon] { display: flex; flex: none; }
.hidden, [hidden] { display: none !important; }
h1, h2, h3, p { margin: 0; }
h2, h3 { font-size: 16px; }
button.accent { background: #326ca9; border-color: #71a6db; color: #fff; }
button.accent:hover { background: #3d7fbe; }
.muted, .hint { color: var(--muted); }
.hint { font-size: 13px; line-height: 1.55; }
.eyebrow { font-size: 14px; color: var(--muted); }
.skip { position: absolute; top: -70px; z-index: 100; padding: 12px; color: #fff; background: #326ca9; }
.skip:focus { top: 0; }
.icon-button { min-width: 38px; padding: 7px; }

/* Familiar application menu and toolbar. */
.topbar { min-height: 58px; display: flex; align-items: center; gap: 10px; border-bottom: 1px solid var(--line); flex: none; }
.brand { margin-right: auto; padding-right: 16px; }
.brand h1 { font-size: 25px; font-weight: 650; letter-spacing: -.6px; }
.topbar nav { display: flex; gap: 8px; }
.topbar nav button { background: #30363f; }
#libraryCount { color: #d4dae3; padding-left: 4px; font-weight: 400; }
.live-toggle { min-width: 170px; }
.live-toggle.locked { background: #244c35; border-color: #6ca67e; color: #d3f6df; }
.toolbar { display: flex; align-items: center; gap: 10px; padding: 7px 0; flex: none; }
.show-picker { display: flex; align-items: center; gap: 7px; }
.show-picker label { font-size: 14px; }
.show-picker select { width: 190px; }
.search { display: flex; align-items: center; gap: 8px; min-width: 100px; }
.search input { width: 100%; background: #252a31 !important; }
.toolbar > .search { flex: 1; }
.toolbar > .search > span { display: none; }
.subtle { font-size: 14px; }
.stop-all { background: #a63836; color: #fff; border-color: #d6817e; min-width: 155px; font-size: 16px; }
.stop-all:hover { background: #bd4540; }
.workspace { display: grid; grid-template-columns: minmax(0, 1fr) 310px; gap: 16px; flex: 1; min-height: 0; }
.pad-panel { display: flex; flex-direction: column; min-height: 0; min-width: 0; }
.section-label { display: flex; justify-content: space-between; align-items: center; min-height: 27px; gap: 8px; flex: none; }
.section-label h2 { font-size: 15px; font-weight: 600; }
.section-label h2 span { font-size: 13px; color: var(--muted); font-weight: 400; margin-left: 9px; }
.legend { display: flex; align-items: center; gap: 5px; font-size: 12px; color: var(--muted); }
.legend i { width: 9px; height: 9px; margin-left: 7px; border-radius: 2px; }
.ready { background: var(--orange); }.playing { background: var(--green); }.paused { background: var(--blue); }.played { background: var(--red); }
.pad-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--gap); }
#favorites { flex: none; }
.scroll-heading { margin-top: 6px; min-height: 30px; border-top: 1px solid #737e8e; }
.pad-scroll { min-height: 0; flex: 1; overflow-y: auto; overflow-x: hidden; scrollbar-color: #7c8796 #252a31; scrollbar-width: thin; scrollbar-gutter: stable; }
#padGrid { padding-bottom: 2px; }
.pad { height: var(--pad-height); min-height: 120px; min-width: 0; background: #30363f; border: 1px solid #626d7b; border-left: 4px solid var(--orange); border-radius: 6px; padding: 8px 9px; display: flex; flex-direction: column; gap: 4px; }
.pad:hover { border-top-color: #97a4b4; border-right-color: #97a4b4; border-bottom-color: #97a4b4; }
.pad[data-state=playing], .pad[data-state=loading] { background: #2a4636; border-color: #6c9a7c; border-left-color: var(--green); }
.pad[data-state=paused] { background: #2c405a; border-color: #6f95c5; border-left-color: var(--blue); }
.pad[data-state=played], .pad[data-state=error] { border-left-color: var(--red); }
.pad.empty-pad { background: #272c33; border-color: #4d5764; border-left-color: #687585; }
.pad-top { display: flex; align-items: center; gap: 8px; min-height: 24px; }
.pad-number { display: inline-block; font-size: 16px; font-weight: 650; color: #d5dce6; min-width: 24px; font-variant-numeric: tabular-nums; }
.pad-label { font-size: 16px; line-height: 23px; font-weight: 650; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; min-width: 0; flex: 1; }
.pad-status { color: var(--orange); font-size: 12px; white-space: nowrap; }
.pad[data-state=playing] .pad-status, .pad[data-state=loading] .pad-status { color: #b0ebc7; }
.pad[data-state=paused] .pad-status { color: #bdd8ff; }
.pad[data-state=played] .pad-status, .pad[data-state=error] .pad-status { color: var(--red); }
.pad.empty-pad .pad-label, .pad.empty-pad .pad-status { color: var(--muted); font-weight: 400; }
.pad-file { font-size: 13px; line-height: 16px; min-height: 32px; color: #c4ccd7; overflow: hidden; overflow-wrap: anywhere; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.pad.empty-pad .pad-file { color: #aeb8c7; }
.pad-actions { margin-top: auto; display: grid; grid-template-columns: minmax(70px, 1fr) 70px 100px; gap: 6px; }
.pad-actions button { min-height: 36px; height: 36px; padding: 5px 7px; font-size: 14px; }
.pad-actions button svg { width: 17px; height: 17px; }
.pad-actions .play-button { background: #3b526d; border-color: #7695b9; color: #fff; }
.pad-actions .play-button:hover { background: #476788; }
.pad[data-state=playing] .play-button { background: #3b634b; border-color: #8db79b; }
.pad.empty-pad .play-button { background: #343e4b; border-color: #657387; }
.pad-hint { min-height: 22px; display: flex; justify-content: space-between; align-items: center; gap: 8px; color: var(--muted); font-size: 12px; flex: none; }

/* Two clearly separated time displays and full labels for playback actions. */
.transport { display: flex; flex-direction: column; gap: 8px; padding: 10px 12px; border: 1px solid #56616e; border-radius: 7px; background: #292e36; min-height: 0; min-width: 0; }
.transport-heading { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.transport-heading h2 { font-size: 16px; }
#focusNumber { font-size: 13px; color: #d1dae8; white-space: nowrap; }
.focus-title { min-height: 38px; font-size: 16px; line-height: 20px; font-weight: 600; overflow-wrap: anywhere; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.time-box { flex: 1; min-height: 90px; max-height: 170px; border: 1px solid #535f6d; border-radius: 5px; background: #1d232b; padding: 8px; text-align: center; display: flex; flex-direction: column; justify-content: center; }
.time-box > span { color: #c7d0dd; font-size: 14px; }
.time-box output { font-size: 70px; line-height: 1.12; font-weight: 600; letter-spacing: -2px; font-variant-numeric: tabular-nums; }
.remaining output { color: #f6d086; }
.deck-heading { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 3px; }
.deck-heading h2 { font-size: 14px; }
.deck-heading > span { font-size: 13px; color: var(--muted); }
.decks { display: flex; flex-direction: column; gap: 7px; }
.deck { padding: 7px 8px; border: 1px solid #5b6877; border-radius: 5px; background: #343d48; display: grid; grid-template-columns: 24px minmax(0, 1fr); column-gap: 6px; row-gap: 6px; }
.deck-index { font-size: 14px; color: #d2deeb; }
.deck-info { min-width: 0; }
.deck-info strong { display: block; font-size: 14px; line-height: 18px; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.deck-info small { display: block; margin-top: 2px; font-size: 12px; color: #c0cbd9; }
.deck-actions { grid-column: 1 / -1; display: grid; grid-template-columns: 38px 1fr 38px; gap: 6px; }
.deck-actions button { min-height: 32px; padding: 4px 6px; font-size: 13px; }
.deck.empty { display: block; min-height: 45px; padding: 12px; color: var(--muted); background: #272d35; border-color: #475361; font-size: 14px; }
.transport-bottom { margin-top: auto; padding-top: 4px; }
.offline-indicator { display: flex; gap: 7px; align-items: center; font-size: 12px; line-height: 17px; }
.status-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--orange); flex: none; }
.status-dot.ok { background: var(--green); }
.transport-bottom p { font-size: 12px; margin: 3px 0 7px; color: var(--muted); }
.check-button { width: 100%; font-size: 14px; min-height: 34px; }
.timeline-footer { flex: none; padding: 5px 0 8px; }
.timeline-caption { display: flex; justify-content: space-between; gap: 12px; color: #cbd3df; font-size: 12px; line-height: 18px; margin-bottom: 4px; }
#timelineLabel { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.timeline-wrap { height: 9px; border: 1px solid #526073; border-radius: 4px; overflow: hidden; background: #141a21; }
#timeline { height: 100%; width: 0; background: #79a7db; }
.timeline-wrap.warning #timeline { background: #ed7772; animation: warning 1s steps(1,end) infinite; }
.timeline-wrap.warning { outline: 1px solid var(--red); }
@keyframes warning { 50% { opacity: .2; } }

dialog { width: min(540px, calc(100vw - 32px)); max-height: 88dvh; overflow-y: auto; background: #2c333d; color: var(--text); border: 1px solid #8896a8; border-radius: 8px; padding: 24px; font-size: 15px; }
dialog::backdrop { background: #0009; }
.wide-dialog { width: min(900px, calc(100vw - 32px)); }
.dialog-head { display: flex; justify-content: space-between; align-items: center; gap: 16px; margin-bottom: 16px; }
.dialog-head h2 { font-size: 23px; font-weight: 600; }
.dialog-description, dialog > p, .setup-section > p { color: #c7d0dc; font-size: 15px; line-height: 1.55; }
.dialog-tools, .button-row { display: flex; gap: 9px; flex-wrap: wrap; margin: 17px 0; }
.dialog-tools .search { flex: 1; }
.dialog-footnote { margin-top: 16px; }
.file-list { min-height: 180px; max-height: 45dvh; overflow: auto; }
.library-empty { padding: 32px 20px; border: 1px dashed #7e8b9e; border-radius: 5px; text-align: center; color: #c7d0dd; font-size: 16px; line-height: 1.6; }
.file-row { display: flex; align-items: center; gap: 12px; border-bottom: 1px solid #515e70; padding: 12px 0; }
.file-name { min-width: 0; flex: 1; }
.file-name strong { font-size: 15px; overflow-wrap: anywhere; }
.file-name small { display: block; color: var(--muted); font-size: 13px; margin-top: 4px; overflow-wrap: anywhere; }
.file-size { color: var(--muted); font-size: 13px; white-space: nowrap; }
.field { display: block; margin: 18px 0; font-size: 15px; }
.field input:not([type=range]), .field select { display: block; width: 100%; margin-top: 7px; font-size: 16px; }
.field output { float: right; }
.music-picker { position: relative; margin-top: 7px; }
.music-select-trigger { width: 100%; min-height: 42px; justify-content: space-between; text-align: left; font-weight: 400; }
.music-select-trigger > span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.music-select-popup { position: absolute; top: calc(100% + 4px); left: 0; right: 0; z-index: 5; padding: 8px; border: 1px solid #94a5b9; border-radius: 6px; background: #303944; box-shadow: 0 6px 18px #0005; }
.field .music-select-popup input { margin-top: 0; background: #252c35; }
.music-options { max-height: min(220px, 30dvh); overflow-y: auto; margin-top: 6px; scrollbar-color: #8191a5 #303944; }
.music-option { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 9px 10px; min-height: 48px; border-radius: 4px; cursor: pointer; }
.music-option > span { min-width: 0; }
.music-option strong, .music-option small { display: block; overflow-wrap: anywhere; }
.music-option strong { font-size: 15px; font-weight: 600; }
.music-option small { font-size: 12px; margin-top: 3px; color: #c4ceda; }
.music-option.active { background: #42638a; outline: 1px solid #8cafd5; outline-offset: -1px; }
.music-option[aria-selected=true] strong { color: #d3e9ff; }
.music-no-results { padding: 16px 10px; color: #d7dfe8; font-size: 14px; line-height: 1.5; }
.music-option-count { padding: 8px 4px 0; margin-top: 5px; border-top: 1px solid #5a6b7f; font-size: 12px; color: #cad5e1; }
.field input[type=range] { margin-top: 14px; display: block; }
.checkbox { display: flex; align-items: center; gap: 10px; margin: 18px 0; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 9px; margin-top: 24px; }
.setup-section { border-top: 1px solid #627084; padding-top: 20px; margin-top: 20px; }
.setup-section h3 { font-size: 17px; margin-bottom: 8px; }
.setup-section code { font-size: 14px; color: #f0f3f8; }
.danger-text { color: #ffc3be; }
.notice { position: fixed; z-index: 100; bottom: 55px; left: 20px; max-width: min(760px,calc(100vw - 40px)); display: flex; align-items: center; gap: 16px; padding: 14px 16px; border: 1px solid #98b9dd; border-radius: 6px; background: #30465e; color: #fff; font-size: 15px; line-height: 1.5; }
.notice button { padding: 4px; min-width: 34px; background: transparent; border: 0; }
.notice.error { background: #663330; border-color: #dca19b; }
.update-banner { position: fixed; left: 0; top: 0; right: 0; display: flex; align-items: center; justify-content: center; gap: 16px; padding: 10px; z-index: 80; color: #fff; background: #345b88; }
.context-menu { position: fixed; z-index: 60; padding: 5px; min-width: 260px; border: 1px solid #95a4b6; border-radius: 5px; background: #303a47; }
.context-menu button { display: block; width: 100%; text-align: left; border: 0; font-weight: 400; }
.check-results { padding-top: 12px; font-size: 15px; line-height: 1.6; }
.check-line { border-bottom: 1px solid #586779; padding: 9px 0; overflow-wrap: anywhere; }
.check-line.good { color: #ace0bf; }.check-line.bad { color: #ffbdb6; }
#importProgress { padding: 12px; border: 1px solid #95b8dc; border-radius: 5px; margin-bottom: 12px; background: #2b4867; }
body.live .pad-actions [data-action=edit] { visibility: hidden; }

@media (min-width: 1600px) {
  body { padding: 0 20px; }
  .workspace { grid-template-columns: minmax(0,1fr) 350px; gap: 20px; }
  .time-box output { font-size: 90px; }
  .pad-label { font-size: 18px; }
  .pad-file { font-size: 14px; }
}
@media (max-width: 1250px) {
  body { padding: 0 10px; }
  .topbar { gap: 7px; }
  .topbar button { font-size: 14px; padding: 7px 9px; }
  .live-toggle { min-width: 155px; }
  .show-picker label, .legend { display: none; }
  .show-picker select { width: 175px; }
  .subtle { max-width: 155px; font-size: 12px; line-height: 15px; padding: 5px 8px; }
  .workspace { grid-template-columns: minmax(0,1fr) 280px; gap: 12px; }
  .pad-actions { grid-template-columns: minmax(65px,1fr) 60px 34px; gap: 5px; }
  .pad-actions [data-action=edit] .action-text { display: none; }
  .pad-actions button { font-size: 13px; padding: 5px 4px; }
  .pad-label { font-size: 15px; }
  .pad-status { font-size: 11px; }
  .time-box output { font-size: 64px; }
  .pad-hint { font-size: 11px; }
}
@media (max-width: 900px) {
  body { height: auto; min-height: 100dvh; overflow: auto; }
  .topbar { flex-wrap: wrap; padding: 12px 0; }
  .brand { flex: 1; }
  .topbar nav { order: 3; width: 100%; }
  .topbar nav button { flex: 1; }
  .toolbar { flex-wrap: wrap; }
  .show-picker { flex: 1; }
  .show-picker select { width: 100%; flex: 1; }
  .toolbar > .search { order: 4; flex-basis: 100%; }
  .toolbar .subtle { display: none; }
  .workspace { display: flex; flex-direction: column; }
  .pad-panel { height: 710px; flex: none; }
  .transport { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
  .transport-heading, .focus-title, .deck-heading, .decks, .transport-bottom { grid-column: 1 / -1; }
  .time-box { min-height: 120px; }
  .decks { flex-direction: row; }
  .deck { flex: 1; min-width: 0; }
  .timeline-footer { position: sticky; bottom: 0; background: var(--bg); z-index: 10; padding-top: 7px; }
}
@media (max-width: 560px) {
  body { padding: 0 10px; }
  button, input, select { font-size: 16px; }
  .brand h1 { font-size: 24px; }
  .topbar nav button { font-size: 14px; }
  .topbar nav button svg { display: none; }
  .live-toggle { min-width: 160px; }
  .show-picker select { max-width: 175px; }
  .stop-all { min-width: 135px; padding: 7px; font-size: 15px; }
  .pad-grid { grid-template-columns: 1fr; }
  .pad-panel { height: 980px; }
  .pad-scroll { min-height: 270px; }
  .pad { height: 132px !important; }
  .pad-label { font-size: 17px; }
  .pad-status { font-size: 13px; }
  .pad-file { font-size: 14px; line-height: 18px; min-height: 36px; }
  .pad-actions { grid-template-columns: minmax(70px,1fr) 68px 100px; gap: 6px; }
  .pad-actions [data-action=edit] .action-text { display: inline; }
  .pad-actions button { font-size: 14px; }
  .pad-hint span { display: none; }
  .decks { flex-direction: column; }
  .time-box output { font-size: 51px; }
  .file-row { flex-wrap: wrap; }
  .file-name { flex-basis: 70%; }
  .file-size { display: none; }
  .dialog-tools .search { flex-basis: 100%; }
  dialog { padding: 18px; }
  .dialog-head h2 { font-size: 21px; }
}
@media (prefers-reduced-motion: reduce) { .timeline-wrap.warning #timeline { animation: none; } }
