:root {
  color-scheme: dark;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: #080a0d;
  color: #f6f8fb;
}

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  height: 100%;
  margin: 0;
  overflow: hidden;
  background: #080a0d;
}

body {
  min-width: 320px;
}

body.modal-open {
  overflow: hidden;
}

#playerCanvas {
  display: block;
  position: fixed;
  top: 50%;
  left: 50%;
  width: 100vw;
  height: 100vh;
  transform: translate(-50%, -50%);
  background: #080a0d;
}

.hud {
  position: fixed;
  bottom: 14px;
  left: 50%;
  z-index: 5;
  width: min(1220px, calc(100vw - 20px));
  transform: translateX(-50%);
  display: grid;
  gap: 8px;
  padding: 10px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(26, 27, 30, 0.96), rgba(6, 7, 9, 0.96)),
    #090a0c;
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.62), inset 0 1px 0 rgba(255, 255, 255, 0.08);
  transition: opacity 180ms ease, transform 180ms ease;
  backdrop-filter: blur(14px);
}

.hud.is-pinned {
  border-color: rgba(0, 255, 168, 0.42);
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.66), 0 0 0 1px rgba(0, 255, 168, 0.14), inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

.hud.is-hidden {
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 12px);
}

.hud-topbar,
.module-head,
.transport-buttons,
.bpm-rack,
.hud-footer {
  display: flex;
  align-items: center;
  gap: 8px;
}

.hud-topbar {
  display: grid;
  grid-template-columns: minmax(240px, 1fr) minmax(230px, auto) auto auto;
  gap: 12px;
  align-items: center;
  min-height: 48px;
  padding: 4px 4px 8px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.hud-readouts {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
  min-width: 0;
}

.hud-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.brand-mark {
  width: 62px;
  height: auto;
  flex: 0 0 auto;
  display: block;
  filter: drop-shadow(0 0 10px rgba(255, 255, 255, 0.1));
}

.brand-copy {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.brand-name {
  color: rgba(246, 248, 251, 0.72);
  font-size: 0.68rem;
  font-weight: 850;
  line-height: 1;
  text-transform: uppercase;
}

.hud-account {
  display: grid;
  grid-template-columns: minmax(78px, 1fr) auto auto;
  gap: 6px;
  align-items: center;
  min-width: 0;
}

.account-status {
  min-width: 0;
  overflow: hidden;
  color: rgba(246, 248, 251, 0.72);
  font-size: 0.72rem;
  font-weight: 850;
  line-height: 1.1;
  text-overflow: ellipsis;
  text-transform: uppercase;
  white-space: nowrap;
}

.hud-deck {
  display: grid;
  grid-template-columns: minmax(200px, 0.65fr) minmax(460px, 1.35fr) minmax(280px, 0.85fr) minmax(170px, 0.5fr);
  gap: 8px;
  align-items: stretch;
}

.hud-module {
  min-width: 0;
  display: grid;
  align-content: start;
  gap: 8px;
  padding: 10px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 7px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.065), rgba(255, 255, 255, 0.028)),
    rgba(0, 0, 0, 0.22);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.07), inset 0 -1px 0 rgba(0, 0, 0, 0.5);
}

.transport-module {
  border-left: 3px solid rgba(0, 229, 255, 0.74);
}

.selection-module {
  border-left: 3px solid rgba(255, 45, 149, 0.62);
}

.export-module {
  border-left: 3px solid rgba(255, 176, 0, 0.72);
}

.playlist-quick-module {
  border-left: 3px solid rgba(0, 255, 168, 0.7);
}

.module-head {
  justify-content: space-between;
  min-height: 20px;
  color: rgba(246, 248, 251, 0.64);
  font-size: 0.68rem;
  font-weight: 850;
  line-height: 1;
  text-transform: uppercase;
}

.loop-name {
  min-width: 0;
  max-width: 620px;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  font-size: 0.96rem;
  font-weight: 800;
  letter-spacing: 0;
}

.meter-pill,
#exportStatus,
#playlistStatus,
#playlistPanelStatus {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 24px;
  padding: 0 8px;
  border: 1px solid rgba(255, 255, 255, 0.11);
  border-radius: 6px;
  background: rgba(0, 0, 0, 0.3);
  color: rgba(246, 248, 251, 0.78);
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum" 1;
  font-size: 0.72rem;
  font-weight: 750;
  white-space: nowrap;
}

#frameReadout {
  width: 86px;
}

#phaseReadout {
  width: 112px;
}

.control-field {
  display: grid;
  gap: 5px;
  min-width: 0;
}

.control-field span,
.inline-field {
  color: rgba(246, 248, 251, 0.64);
  font-size: 0.72rem;
  font-weight: 700;
  line-height: 1;
  text-transform: uppercase;
}

.selection-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 8px;
}

.selection-grid .control-wide {
  grid-column: span 3;
}

.control-field select {
  width: 100%;
  max-width: none;
}

.transport-buttons,
.bpm-rack,
.export-grid,
.playlist-toolbar,
.playlist-live-grid,
.playlist-item-toolbar,
.playlist-file-grid,
.playlist-share-row {
  min-width: 0;
}

.transport-buttons {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 6px;
}

.bpm-rack {
  display: grid;
  grid-template-columns: minmax(86px, 1fr) 44px 44px;
  align-items: end;
  gap: 6px;
}

.bpm-field input {
  width: 100%;
}

.export-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
}

.export-grid #exportResolution {
  grid-column: 1 / -1;
}

.export-grid #setColoursButton {
  grid-column: span 1;
}

.export-grid #exportButton,
.export-grid .download-link {
  grid-column: 1 / -1;
}

.playlist-quick-actions {
  display: grid;
  grid-template-columns: 1fr;
  gap: 6px;
}

.playlist-workspace {
  position: fixed;
  top: 14px;
  right: 14px;
  bottom: 14px;
  z-index: 7;
  width: min(580px, calc(100vw - 28px));
  pointer-events: none;
}

.playlist-workspace[hidden] {
  display: none;
}

.playlist-workspace-panel {
  height: 100%;
  display: grid;
  grid-template-rows: auto auto auto auto minmax(0, 1fr) auto auto;
  gap: 10px;
  padding: 12px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(22, 24, 28, 0.97), rgba(6, 7, 9, 0.97)),
    #080a0d;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.68), inset 0 1px 0 rgba(255, 255, 255, 0.08);
  backdrop-filter: blur(16px);
  pointer-events: auto;
}

.playlist-workspace-header,
.playlist-header-actions,
.playlist-title-stack {
  min-width: 0;
}

.playlist-workspace-header {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  padding-bottom: 10px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.11);
}

.playlist-title-stack {
  display: grid;
  gap: 3px;
}

.playlist-title-stack span {
  color: rgba(246, 248, 251, 0.62);
  font-size: 0.68rem;
  font-weight: 850;
  line-height: 1;
  text-transform: uppercase;
}

.playlist-title-stack strong {
  overflow: hidden;
  font-size: 1rem;
  line-height: 1.15;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.playlist-header-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
}

.playlist-toolbar,
.playlist-item-toolbar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) repeat(3, minmax(76px, auto));
  gap: 6px;
  align-items: end;
}

.playlist-live-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
}

.playlist-file-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 6px;
}

.playlist-share-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(76px, auto);
  gap: 6px;
}

#playlistShareUrl {
  width: 100%;
  font-size: 0.74rem;
}

.playlist-item-list {
  display: grid;
  align-content: start;
  gap: 6px;
  min-height: 180px;
  overflow: auto;
  padding: 2px 2px 2px 0;
}

.playlist-row {
  width: 100%;
  min-height: 54px;
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  text-align: left;
  white-space: normal;
}

.playlist-row-index {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.055);
  color: rgba(246, 248, 251, 0.72);
  font-size: 0.72rem;
  font-variant-numeric: tabular-nums;
  font-weight: 850;
}

.playlist-row-copy {
  min-width: 0;
  display: grid;
  gap: 4px;
}

.playlist-row-name,
.playlist-row-meta,
.playlist-empty {
  overflow: hidden;
  text-overflow: ellipsis;
}

.playlist-row-name {
  color: #f6f8fb;
  font-size: 0.82rem;
  font-weight: 800;
  line-height: 1.15;
  white-space: nowrap;
}

.playlist-row-meta {
  color: rgba(246, 248, 251, 0.6);
  font-size: 0.68rem;
  font-weight: 700;
  line-height: 1.1;
  white-space: nowrap;
}

.playlist-row-duration {
  color: rgba(0, 255, 168, 0.78);
  font-size: 0.68rem;
  font-variant-numeric: tabular-nums;
  font-weight: 850;
}

.playlist-row.is-active {
  border-color: rgba(0, 229, 255, 0.72);
  background:
    linear-gradient(180deg, rgba(0, 229, 255, 0.17), rgba(0, 108, 136, 0.13)),
    rgba(0, 0, 0, 0.28);
}

.playlist-row.is-playing {
  box-shadow: inset 3px 0 0 rgba(0, 255, 168, 0.82);
}

.playlist-row.is-drop-target {
  border-color: rgba(255, 176, 0, 0.86);
}

.playlist-empty {
  min-height: 76px;
  display: grid;
  place-items: center;
  padding: 14px;
  border: 1px dashed rgba(255, 255, 255, 0.18);
  border-radius: 7px;
  color: rgba(246, 248, 251, 0.58);
  font-size: 0.82rem;
  font-weight: 760;
  text-align: center;
}

.checkbox-field {
  display: grid;
  grid-template-columns: 18px minmax(0, 1fr);
  grid-template-areas:
    "box label"
    "box note";
  align-items: center;
  justify-content: start;
  column-gap: 11px;
  row-gap: 3px;
  min-height: 44px;
  padding: 7px 10px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.055);
  color: rgba(246, 248, 251, 0.78);
  font-size: 0.78rem;
  font-weight: 700;
  line-height: 1.05;
  text-align: left;
  white-space: normal;
}

.checkbox-field span {
  grid-area: label;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.checkbox-field small {
  grid-area: note;
  min-width: 0;
  overflow: hidden;
  color: rgba(255, 176, 0, 0.88);
  font-size: 0.62rem;
  font-weight: 850;
  line-height: 1;
  text-overflow: ellipsis;
  text-transform: uppercase;
  white-space: nowrap;
}

.checkbox-field small[hidden] {
  display: none;
}

.checkbox-field.is-locked {
  border-color: rgba(255, 176, 0, 0.34);
  background: rgba(255, 176, 0, 0.08);
}

.checkbox-field input {
  grid-area: box;
  align-self: center;
  justify-self: center;
  width: 16px;
  height: 16px;
  accent-color: #51daff;
}

button,
select,
input,
.download-link,
.account-link {
  min-height: 34px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 6px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.1), rgba(255, 255, 255, 0.045)),
    rgba(0, 0, 0, 0.3);
  color: #f6f8fb;
  font: inherit;
  font-size: 0.8rem;
  line-height: 1;
  min-width: 0;
}

button,
.download-link,
.account-link {
  padding: 0 12px;
  cursor: pointer;
  font-weight: 760;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.account-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 74px;
  color: #f6f8fb;
  font-size: 0.78rem;
  line-height: 1;
  text-decoration: none;
}

.account-link-secondary {
  border-color: rgba(0, 255, 168, 0.28);
}

.compact-button {
  min-width: 38px;
  padding: 0 9px;
}

.primary-button {
  border-color: rgba(0, 229, 255, 0.42);
  background:
    linear-gradient(180deg, rgba(0, 229, 255, 0.3), rgba(0, 108, 136, 0.26)),
    rgba(0, 0, 0, 0.32);
}

.pin-toggle {
  min-width: 58px;
  border-color: rgba(255, 255, 255, 0.14);
}

.hud.is-pinned .pin-toggle {
  border-color: rgba(0, 255, 168, 0.7);
  background:
    linear-gradient(180deg, rgba(0, 255, 168, 0.28), rgba(0, 102, 75, 0.24)),
    rgba(0, 0, 0, 0.3);
}

button:hover,
button:focus-visible,
.download-link:hover,
.download-link:focus-visible,
.account-link:hover,
.account-link:focus-visible {
  border-color: rgba(81, 218, 255, 0.76);
  background: rgba(81, 218, 255, 0.17);
  outline: none;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.56;
}

input:disabled,
select option:disabled {
  color: rgba(246, 248, 251, 0.5);
}

button.is-locked {
  border-color: rgba(255, 176, 0, 0.36);
  color: rgba(255, 224, 151, 0.9);
}

select,
input {
  padding: 0 9px;
}

select {
  width: 100%;
  max-width: none;
  overflow: hidden;
  text-overflow: ellipsis;
}

input {
  width: 86px;
}

label,
#frameReadout,
#phaseReadout,
#exportStatus,
#playlistStatus,
#playlistPanelStatus,
#playlistModalStatus,
#upgradeModalStatus {
  color: rgba(246, 248, 251, 0.78);
  font-size: 0.82rem;
  white-space: nowrap;
}

#exportStatus {
  justify-content: center;
  min-width: 86px;
}

#playlistSelect {
  min-width: 0;
}

#playlistItemSelect {
  min-width: 0;
}

#playlistPlayToggle.is-active {
  border-color: rgba(0, 255, 168, 0.78);
  background: rgba(0, 255, 168, 0.16);
}

#playlistAddItem.is-active {
  border-color: rgba(255, 176, 0, 0.82);
  background: rgba(255, 176, 0, 0.18);
}

.download-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
}

.download-link[hidden] {
  display: none;
}

.hud-footer {
  justify-content: space-between;
  padding: 0 4px;
  color: rgba(246, 248, 251, 0.62);
  font-size: 0.72rem;
  font-weight: 720;
}

.hud-footer span:first-child {
  color: rgba(255, 176, 0, 0.92);
}

.export-mini-hud {
  position: fixed;
  right: 14px;
  bottom: 14px;
  z-index: 6;
  width: min(340px, calc(100vw - 20px));
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
  padding: 9px;
  border: 1px solid rgba(0, 229, 255, 0.34);
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(26, 27, 30, 0.97), rgba(6, 7, 9, 0.97)),
    #090a0c;
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.62), 0 0 0 1px rgba(0, 229, 255, 0.08), inset 0 1px 0 rgba(255, 255, 255, 0.08);
  backdrop-filter: blur(14px);
}

.export-mini-hud[hidden] {
  display: none;
}

.export-mini-copy {
  min-width: 0;
  display: grid;
  gap: 3px;
}

.export-mini-copy span {
  color: rgba(246, 248, 251, 0.58);
  font-size: 0.66rem;
  font-weight: 850;
  line-height: 1;
  text-transform: uppercase;
}

.export-mini-copy strong {
  min-width: 0;
  overflow: hidden;
  color: rgba(246, 248, 251, 0.9);
  font-size: 0.82rem;
  font-weight: 800;
  line-height: 1.15;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.export-mini-progress {
  grid-column: 1 / -1;
  height: 5px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.1);
}

.export-mini-progress span {
  display: block;
  width: 0%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #00e5ff, #00ffa8);
  transition: width 180ms linear;
}

.export-mini-hud.is-complete {
  border-color: rgba(0, 255, 168, 0.42);
}

.export-mini-hud.is-complete .export-mini-progress span {
  background: #00ffa8;
}

.export-mini-hud.is-error {
  border-color: rgba(255, 45, 149, 0.55);
}

.export-mini-hud.is-error .export-mini-progress span {
  background: #ff2d95;
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(0, 0, 0, 0.72);
}

.modal[hidden] {
  display: none;
}

.modal-panel {
  width: min(920px, calc(100vw - 24px));
  max-height: min(760px, calc(100vh - 36px));
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 14px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 8px;
  background: rgba(8, 10, 13, 0.97);
  box-shadow: 0 22px 60px rgba(0, 0, 0, 0.56);
}

.modal-panel-small {
  width: min(460px, calc(100vw - 24px));
}

.modal-panel-timing {
  width: min(640px, calc(100vw - 24px));
}

.modal-panel-upgrade {
  width: min(680px, calc(100vw - 24px));
  border-color: rgba(255, 176, 0, 0.34);
  background:
    linear-gradient(180deg, rgba(255, 176, 0, 0.08), rgba(0, 0, 0, 0)),
    rgba(8, 10, 13, 0.98);
}

.modal-message {
  margin: 0;
  color: rgba(246, 248, 251, 0.78);
  font-size: 0.88rem;
  line-height: 1.45;
}

.upgrade-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 7px 12px;
  margin: 0;
  padding: 10px 12px 10px 28px;
  border: 1px solid rgba(255, 255, 255, 0.11);
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.045);
  color: rgba(246, 248, 251, 0.82);
  font-size: 0.82rem;
  line-height: 1.35;
}

.upgrade-list[hidden] {
  display: none;
}

.timing-copy {
  display: grid;
  gap: 12px;
}

.timing-copy p {
  margin: 0;
  color: rgba(246, 248, 251, 0.86);
  font-size: 0.92rem;
  line-height: 1.5;
}

.timing-facts {
  display: grid;
  gap: 6px;
  padding: 10px;
  border: 1px solid rgba(255, 255, 255, 0.11);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.045);
  color: rgba(246, 248, 251, 0.78);
  font-size: 0.82rem;
  line-height: 1.35;
}

.timing-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.timing-actions button:first-child {
  border-color: rgba(0, 229, 255, 0.55);
  background: rgba(0, 229, 255, 0.16);
}

#playlistNameInput,
#playlistTargetSelect {
  width: 100%;
}

.modal-header,
.modal-footer {
  display: flex;
  align-items: center;
  gap: 10px;
}

.modal-header {
  justify-content: space-between;
}

.modal-header h2 {
  margin: 0;
  font-size: 1rem;
  letter-spacing: 0;
}

.modal-footer {
  justify-content: flex-end;
  flex-wrap: wrap;
}

.palette-editor {
  display: grid;
  gap: 8px;
  overflow: auto;
  padding-right: 2px;
}

.palette-row {
  display: grid;
  grid-template-columns: minmax(92px, 1fr) minmax(190px, 1.3fr) minmax(190px, 1.3fr);
  align-items: center;
  gap: 8px;
  min-height: 42px;
}

.palette-name {
  display: grid;
  grid-template-columns: 56px minmax(0, 1fr);
  align-items: center;
  gap: 8px;
  min-width: 0;
  color: rgba(246, 248, 251, 0.78);
  font-size: 0.82rem;
}

.palette-name input {
  width: 100%;
}

.palette-pair {
  display: grid;
  grid-template-columns: 44px minmax(92px, 1fr) 44px;
  align-items: center;
  gap: 8px;
}

.palette-pair label {
  font-weight: 700;
}

.palette-pair input[type="text"] {
  width: 100%;
  text-transform: uppercase;
}

.palette-pair input[type="color"] {
  width: 44px;
  padding: 2px;
}

.palette-row.is-invalid input[type="text"] {
  border-color: rgba(255, 90, 90, 0.85);
}

#paletteStatus {
  min-width: 170px;
  margin-right: auto;
  color: rgba(246, 248, 251, 0.78);
  font-size: 0.82rem;
}

#paletteStatus[data-state="error"] {
  color: #ff7272;
}

#paletteStatus[data-state="ok"] {
  color: #87ffbf;
}

.webgl-error {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 24px;
  background: #080a0d;
  color: #f6f8fb;
  font-size: 1rem;
}

.webgl-error[hidden] {
  display: none;
}

@media (max-width: 1120px) {
  .hud-deck {
    grid-template-columns: minmax(210px, 0.8fr) minmax(340px, 1.2fr);
  }

  .export-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 920px) {
  .hud-topbar {
    grid-template-columns: minmax(220px, 1fr) auto;
  }

  .hud-account {
    grid-column: 1 / -1;
    grid-template-columns: minmax(0, 1fr) auto auto;
  }

  .hud-readouts {
    grid-column: 1 / -1;
    justify-content: flex-start;
  }

  .hud-deck {
    grid-template-columns: 1fr;
  }

  .selection-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .selection-grid .control-wide {
    grid-column: span 1;
  }

  .export-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .playlist-live-grid,
  .playlist-file-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .playlist-toolbar,
  .playlist-item-toolbar {
    grid-template-columns: minmax(0, 1fr) repeat(3, minmax(72px, auto));
  }
}

@media (max-width: 760px) {
  .hud {
    align-items: stretch;
    bottom: 8px;
    width: calc(100vw - 14px);
    max-height: min(76vh, calc(100vh - 14px));
    overflow: auto;
    padding: 8px;
  }

  .export-mini-hud {
    right: 7px;
    bottom: 8px;
    width: calc(100vw - 14px);
  }

  .hud-topbar {
    grid-template-columns: 1fr auto;
    gap: 8px;
    min-height: 42px;
  }

  .hud-account {
    grid-column: 1 / -1;
  }

  .hud-brand {
    gap: 8px;
  }

  .brand-mark {
    width: 46px;
  }

  .hud-readouts {
    display: none;
  }

  .selection-grid,
  .export-grid {
    grid-template-columns: 1fr;
  }

  .selection-grid .control-wide {
    grid-column: auto;
  }

  .transport-buttons,
  .bpm-rack {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .bpm-field {
    grid-column: 1 / -1;
  }

  .playlist-live-grid,
  .playlist-file-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .playlist-workspace {
    top: auto;
    right: 7px;
    bottom: 7px;
    left: 7px;
    width: auto;
    height: min(84vh, calc(100vh - 14px));
  }

  .playlist-workspace-panel {
    gap: 8px;
    padding: 9px;
  }

  .playlist-workspace-header,
  .playlist-toolbar,
  .playlist-item-toolbar {
    grid-template-columns: 1fr;
  }

  .playlist-header-actions {
    justify-content: stretch;
  }

  .playlist-header-actions #playlistPanelStatus {
    flex: 1 1 auto;
  }

  .playlist-item-list {
    min-height: 150px;
  }

  .playlist-row {
    grid-template-columns: 30px minmax(0, 1fr);
  }

  .playlist-row-duration {
    grid-column: 2;
    justify-self: start;
  }

  .timing-actions {
    grid-template-columns: 1fr;
  }

  .upgrade-list {
    grid-template-columns: 1fr;
  }

  .loop-name {
    max-width: 100%;
  }

  button,
  select,
  input,
  .download-link,
  .account-link {
    font-size: 0.8rem;
  }

  button,
  select,
  input,
  .download-link,
  .account-link {
    min-height: 38px;
  }

  #playlistSelect,
  #playlistItemSelect,
  #playlistShareUrl,
  #exportResolution {
    width: 100%;
    max-width: none;
  }

  .hud-footer {
    align-items: flex-start;
    flex-direction: column;
    gap: 4px;
  }

  .palette-row {
    grid-template-columns: 1fr;
  }

  .palette-name {
    grid-template-columns: 64px minmax(0, 1fr);
  }
}

@media (max-height: 520px) and (orientation: landscape) {
  .hud {
    top: 6px;
    bottom: 6px;
    width: calc(100vw - 12px);
    max-height: none;
    gap: 6px;
    overflow: auto;
    padding: 7px;
  }

  .hud-topbar {
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 8px;
    min-height: 38px;
    padding: 2px 2px 6px;
  }

  .hud-account {
    grid-column: 1 / -1;
    grid-template-columns: minmax(0, 1fr) auto auto;
    gap: 5px;
  }

  .account-status {
    font-size: 0.64rem;
  }

  .hud-readouts {
    display: none;
  }

  .hud-brand {
    gap: 8px;
  }

  .brand-mark {
    width: 42px;
  }

  .brand-copy {
    gap: 2px;
  }

  .brand-name {
    font-size: 0.58rem;
  }

  .loop-name {
    max-width: none;
    font-size: 0.84rem;
  }

  .hud-deck {
    grid-template-columns: minmax(0, 0.68fr) minmax(0, 0.92fr) minmax(0, 1fr) minmax(0, 0.54fr);
    gap: 6px;
  }

  .hud-module {
    gap: 6px;
    padding: 8px;
  }

  .module-head {
    min-height: 18px;
    font-size: 0.62rem;
  }

  .selection-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 6px;
  }

  .selection-grid .control-wide {
    grid-column: span 1;
  }

  .export-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 6px;
  }

  .export-grid #exportButton,
  .export-grid .download-link {
    grid-column: span 1;
  }

  .playlist-toolbar,
  .playlist-item-toolbar {
    grid-template-columns: minmax(0, 1fr) repeat(3, minmax(62px, auto));
  }

  .playlist-live-grid,
  .playlist-file-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 5px;
  }

  .transport-buttons {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .bpm-rack {
    grid-template-columns: minmax(0, 1fr) 42px 42px;
    gap: 5px;
  }

  .bpm-field {
    grid-column: auto;
  }

  button,
  select,
  input,
  .download-link,
  .account-link {
    min-height: 32px;
    font-size: 0.72rem;
  }

  button,
  .download-link {
    padding: 0 6px;
  }

  .checkbox-field {
    grid-template-columns: 16px minmax(0, 1fr);
    column-gap: 8px;
    min-height: 36px;
    padding: 5px 8px;
    font-size: 0.72rem;
  }

  #watermarkField span,
  #playlistZipField span {
    font-size: 0;
  }

  #watermarkField span::after {
    content: "Mark";
    font-size: 0.72rem;
  }

  #playlistZipField span::after {
    content: "Zip";
    font-size: 0.72rem;
  }

  .checkbox-field small {
    font-size: 0.52rem;
  }

  .hud-footer {
    align-items: center;
    flex-direction: row;
    gap: 8px;
    font-size: 0.66rem;
  }

  .export-mini-hud {
    right: 6px;
    bottom: 6px;
  }

}

@media (max-height: 520px) and (orientation: landscape) and (max-width: 720px) {
  .hud-deck {
    grid-template-columns: minmax(0, 0.82fr) minmax(0, 1fr);
  }

  .transport-module {
    grid-column: 1;
    grid-row: 1;
  }

  .export-module {
    grid-column: 2;
    grid-row: 1;
  }

  .selection-module {
    grid-column: 1 / -1;
    grid-row: 2;
  }

  .playlist-quick-module {
    grid-column: 1 / -1;
    grid-row: 3;
  }

  .playlist-quick-actions {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .selection-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .export-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .playlist-toolbar,
  .playlist-item-toolbar {
    grid-template-columns: minmax(0, 1fr) repeat(3, minmax(60px, auto));
  }
}
