:root {
  color-scheme: dark;
  --ground: #111419;
  --panel: #1b2028;
  --inner: #14191f;
  --line: #343b46;
  --muted: #a0abba;
  --white: #eff1f4;
  --ice: #b0cfff;
  --mint: #b4e9c9;
  --amber: #f2b787;
  --accent: #92bcef;
  font:
    15px/1.45 'Inter',
    'Hiragino Sans',
    'Yu Gothic',
    system-ui,
    sans-serif;
  color: var(--white);
  background: var(--ground);
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
}
button,
input,
select {
  font: inherit;
}
button {
  border: 1px solid #444c58;
  color: var(--white);
  border-radius: 5px;
  background: #2a3039;
  padding: 0.44rem 0.82rem;
  font-weight: 560;
  cursor: pointer;
}
button:hover:enabled {
  background: #373f4c;
  border-color: #677386;
}
button:active:enabled {
  transform: translateY(1px);
}
button:focus-visible,
input:focus-visible,
select:focus-visible,
canvas:focus-visible {
  outline: 2px solid var(--ice);
  outline-offset: 3px;
}
button:disabled {
  opacity: 0.45;
  cursor: default;
}
button[aria-pressed='true'] {
  color: var(--ice);
}
.icon {
  width: 18px;
  height: 18px;
  flex: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.icon svg {
  width: 100%;
  height: 100%;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}
button .icon {
  vertical-align: -0.26em;
}
.topbar,
.top-actions,
nav,
.brand,
.showline,
.show-id,
.show-status,
.panel-head,
.panel-head h2,
.stage-foot,
.stage-foot > span,
.cue-tools,
.transport-inner,
.transport-keys,
.top-actions button,
.port-button,
.deck-key,
.go-key,
.record,
.segments,
.select-head,
.color-presets,
.channel-title,
.dialog-actions {
  display: flex;
  align-items: center;
}
.topbar {
  min-height: 65px;
  border-bottom: 1px solid var(--line);
  padding: 0 clamp(16px, 2.6vw, 48px);
  gap: clamp(20px, 4vw, 70px);
  background: #191d24;
}
.brand {
  gap: 11px;
  white-space: nowrap;
  font-size: 1.38rem;
  letter-spacing: -0.06em;
  font-weight: 420;
}
.brand strong {
  font-weight: 735;
}
.brand img {
  width: 35px;
  height: 35px;
}
.topbar nav {
  gap: 10px;
  align-self: stretch;
}
nav button {
  background: transparent;
  border: 0;
  border-radius: 0;
  border-bottom: 2px solid transparent;
  padding: 0 0.63rem;
  font-size: 0.91rem;
  color: var(--muted);
}
nav button[aria-current='page'] {
  border-bottom-color: var(--ice);
  color: var(--white);
}
.top-actions {
  gap: 8px;
  margin-left: auto;
}
.top-actions button {
  gap: 8px;
  font-size: 0.88rem;
  white-space: nowrap;
}
.lamp,
.fixture-dot,
.signal,
.tag b,
.record-dot {
  border-radius: 50%;
  display: inline-block;
}
.lamp {
  width: 7px;
  height: 7px;
  background: #8894a4;
}
.lamp.connected {
  background: var(--mint);
}
.lamp.armed {
  background: var(--amber);
}
.quiet {
  border-color: transparent;
  background: transparent;
  color: var(--muted);
}
.icon-button {
  padding: 4px;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.showline {
  justify-content: space-between;
  min-height: 72px;
  gap: 8px;
}
.show-id,
.show-status {
  gap: 11px;
}
.show-status {
  font-size: 0.81rem;
  color: var(--muted);
}
.show-status i {
  width: 1px;
  height: 14px;
  background: var(--line);
}
.show-id .book {
  color: var(--muted);
}
h1,
h2,
h3,
p {
  margin: 0;
}
h1 {
  font-size: 1.3rem;
  letter-spacing: 0.015em;
  font-weight: 650;
}
.tag {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: #bacce3;
  background: #1e2935;
  border: 1px solid #3b4b5e;
  padding: 3px 9px;
  border-radius: 20px;
  font-size: 0.79rem;
}
.tag b {
  width: 6px;
  height: 6px;
  background: var(--ice);
}
.tag.live {
  background: #30271e;
  color: #f9c497;
  border-color: #65513c;
}
.tag.live b {
  background: var(--amber);
}
main,
.transport-inner {
  max-width: 1700px;
  margin: 0 auto;
  padding: 0 clamp(16px, 2.6vw, 48px);
}
main {
  padding-bottom: 20px;
}
.upper,
.lower {
  display: grid;
  gap: 15px;
}
.upper {
  grid-template-columns: minmax(0, 1.48fr) minmax(350px, 1fr);
}
.lower {
  margin-top: 15px;
  grid-template-columns: minmax(0, 2.15fr) minmax(290px, 1fr);
}
.panel {
  border: 1px solid var(--line);
  background: var(--panel);
  border-radius: 8px;
  overflow: hidden;
  min-width: 0;
}
.panel-head {
  height: 51px;
  justify-content: space-between;
  gap: 8px;
  padding: 0 16px;
  border-bottom: 1px solid var(--line);
}
.panel-head h2 {
  min-width: 0;
  font-size: 1.03rem;
  letter-spacing: 0.01em;
  font-weight: 620;
  gap: 9px;
  white-space: nowrap;
}
.panel-head h2 .icon {
  color: #bdc7d5;
}
.compact,
.cue-tools button,
.record,
.segments button {
  font-size: 0.83rem;
}
.segments {
  gap: 2px;
  border: 1px solid #353e49;
  border-radius: 5px;
  padding: 2px;
  background: #151a21;
}
.segments button {
  padding: 2px 11px;
  background: transparent;
  border-color: transparent;
  color: var(--muted);
  border-radius: 3px;
}
.segments button[aria-pressed='true'] {
  background: #38414f;
  color: #f4f6fa;
  box-shadow: 0 1px 3px #0004;
}
.stage {
  position: relative;
  height: clamp(232px, 26vh, 365px);
  background: #090c13;
}
.stage canvas {
  display: block;
  width: 100%;
  height: 100%;
}
.stage-legend,
.stage-camera {
  position: absolute;
  font-size: 0.74rem;
  color: #c1cad7;
  pointer-events: none;
}
.stage-legend {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  top: 12px;
  left: 15px;
  background: #10151dcc;
  border: 1px solid #414858aa;
  border-radius: 4px;
  padding: 2px 7px;
}
.signal {
  width: 6px;
  height: 6px;
  background: var(--mint);
}
.stage-camera {
  right: 14px;
  bottom: 9px;
  color: #9eaabb;
}
.stage-foot {
  justify-content: space-between;
  background: #191e26;
  border-top: 1px solid #303742;
  min-height: 35px;
  padding: 4px 15px;
  color: #b8c2cf;
  font-size: 0.8rem;
}
.stage-foot > span {
  gap: 7px;
}
.stage-foot label {
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
}
.stage-foot input {
  accent-color: var(--ice);
  margin: 0;
}
.fixture-dot {
  width: 7px;
  height: 7px;
  background: var(--amber);
}
.cue-panel {
  display: flex;
  flex-direction: column;
}
.record {
  gap: 7px;
  background: #322c2e;
  color: #f3c2b3;
  border-color: #614b49;
}
.record-dot {
  width: 8px;
  height: 8px;
  border: 1.5px solid currentColor;
}
.cue-grid {
  display: grid;
  align-items: center;
  grid-template-columns: 48px minmax(75px, 1fr) 61px 60px;
  gap: 7px;
}
.cue-heading {
  padding: 8px 17px 6px;
  color: var(--muted);
  font-size: 0.76rem;
  border-bottom: 1px solid var(--line);
}
#cue-list {
  flex: 1;
  min-height: 0;
  max-height: clamp(174px, 22vh, 340px);
  overflow: auto;
}
.cue-row {
  position: relative;
  width: 100%;
  text-align: left;
  border: 0;
  border-radius: 0;
  border-bottom: 1px solid #2c333d;
  padding: 7px 17px;
  color: #dbe0e8;
  background: transparent;
  font-size: 0.85rem;
  font-weight: 440;
  min-height: 33px;
}
.cue-row.selected {
  background: #283647;
}
.cue-row.selected:before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 3px;
  background: var(--ice);
}
.cue-row.playing .cue-id {
  color: var(--mint);
}
.cue-id,
.tnum,
.cue-time,
.fader-val,
.patch-pill,
#master-value,
.grid-cell {
  font-variant-numeric: tabular-nums;
}
.cue-id {
  font:
    600 0.8rem ui-monospace,
    monospace;
  color: var(--ice);
}
.cue-time,
.cue-follow {
  color: #b2bdca;
  font-size: 0.8rem;
}
.cue-name {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.cue-effect-mark {
  color: var(--ice);
  font-size: 0.68rem;
  margin-right: 0.5em;
  font-weight: 650;
}
.cue-tools {
  flex-wrap: wrap;
  padding: 7px 12px;
  gap: 6px;
  min-height: 38px;
  border-top: 1px solid var(--line);
}
.cue-tools button {
  padding: 3px 8px;
}
.cue-tools button:last-child {
  margin-left: auto;
}
.empty {
  padding: 16px;
  color: var(--muted);
  font-size: 0.87rem;
}
#fader-bank {
  display: flex;
  overflow: auto;
  min-height: 215px;
  background: #171c23;
}
.strip {
  --swatch: #adb7cc;
  position: relative;
  flex: 1 0 75px;
  min-width: 0;
  max-width: 145px;
  border-right: 1px solid #323943;
  padding: 8px 5px 9px;
  display: flex;
  flex-direction: column;
  align-items: center;
}
.strip:last-child {
  border-right: 0;
}
.strip.selected {
  background: linear-gradient(#2a3543, #202832);
}
.strip.selected:before {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  content: '';
  height: 2px;
  background: var(--ice);
}
.fixture-select {
  width: 100%;
  background: transparent;
  border: 1px solid transparent;
  min-height: 47px;
  line-height: 1.18;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  padding: 1px 2px 3px;
}
.fixture-no {
  display: flex;
  align-items: center;
  gap: 5px;
  color: #aebaca;
  font:
    500 0.78rem ui-monospace,
    monospace;
}
.fixture-no i {
  width: 12px;
  height: 4px;
  border-radius: 2px;
  background: var(--swatch);
}
.fixture-label {
  font-size: 0.76rem;
  font-weight: 550;
  line-height: 1.2;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow-wrap: anywhere;
  max-width: 100%;
  min-height: 2.3em;
}
.fader-area {
  --fader-cap-height: 16px;
  position: relative;
  height: 104px;
  min-height: 80px;
  width: 46px;
  margin: 3px 0 2px;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  cursor: ns-resize;
  background:
    repeating-linear-gradient(to top, transparent 0 9px, #56616e 9px 10px) 2px center / 6px
      calc(100% - 14px) no-repeat,
    repeating-linear-gradient(to top, transparent 0 9px, #56616e 9px 10px) right 2px center / 6px
      calc(100% - 14px) no-repeat;
}
.v-fader {
  display: block;
  position: absolute;
  inset: 0;
  margin: auto;
  writing-mode: vertical-lr;
  direction: rtl;
  appearance: none;
  -webkit-appearance: none;
  width: 32px;
  height: 100%;
  background: transparent;
  pointer-events: none;
}
.fader-area:has(.v-fader:disabled) {
  cursor: default;
}
.fader-area[data-dragging] {
  outline: 1px solid var(--ice);
  border-radius: 4px;
}
.v-fader::-webkit-slider-runnable-track {
  width: 8px;
  border: 1px solid #080a0d;
  border-radius: 4px;
  background: linear-gradient(to top, #8197ae 0 var(--level), #0e1117 var(--level) 100%);
}
.v-fader::-moz-range-track {
  width: 7px;
  border: 1px solid #080a0d;
  background: #0c1014;
  border-radius: 4px;
}
.v-fader::-webkit-slider-thumb {
  appearance: none;
  -webkit-appearance: none;
  height: var(--fader-cap-height);
  width: 29px;
  margin-left: -11px;
  text-align: center;
  border-radius: 3px;
  border: 1px solid #10151b;
  background: linear-gradient(
    #d6dce1 0%,
    #98a6b4 39%,
    #556170 43%,
    #e3e9f0 50%,
    #83909d 57%,
    #697786 100%
  );
  box-shadow: 0 2px 3px #000a;
}
.v-fader::-moz-range-thumb {
  height: var(--fader-cap-height);
  width: 28px;
  border: 1px solid #13191d;
  border-radius: 3px;
  background: linear-gradient(#b8c3cf, #7f8a9a 42%, #e3e9f0 49%, #697786 60%);
}
.fader-val {
  font-weight: 650;
  font-size: 0.85rem;
}
@media (any-pointer: coarse) and (orientation: landscape) {
  .strip .fader-area {
    width: min(100%, 60px);
    height: clamp(120px, 17vh, 160px);
  }
}
/* Fit the full travel above the playback controls on landscape tablets. */
@media (any-pointer: coarse) and (orientation: landscape) and (min-width: 801px) and (max-height: 820px) {
  .topbar {
    min-height: 52px;
  }
  .showline {
    min-height: 46px;
  }
  .stage {
    height: clamp(158px, 25vh, 201px);
  }
  .panel-head {
    height: 44px;
  }
}
.fader-addr {
  font-size: 0.64rem;
  color: #aab5c4;
  letter-spacing: 0.03em;
}
#attribute-body {
  padding: 12px 15px;
  max-height: 250px;
  overflow: auto;
}
.select-head {
  justify-content: space-between;
  gap: 6px;
  margin-bottom: 9px;
}
.select-head strong {
  font-size: 0.96rem;
}
.attr-mode {
  font-size: 0.7rem;
  color: var(--muted);
  text-align: right;
}
.color-presets {
  gap: 7px;
  margin-bottom: 9px;
}
.color-presets button {
  width: 24px;
  height: 21px;
  border: 2px solid #ffffff30;
  background: var(--color);
  border-radius: 4px;
  padding: 0;
}
.color-presets button:hover {
  background: var(--color);
  outline: 1px solid var(--white);
}
.attr-line {
  display: grid;
  grid-template-columns: minmax(64px, auto) minmax(53px, 1fr) 44px;
  gap: 9px;
  align-items: center;
  min-height: 27px;
  font-size: 0.8rem;
  color: #c6cfda;
}
.attr-line input[type='range'],
.master input {
  width: 100%;
  accent-color: #b9ccdf;
  height: 5px;
  cursor: pointer;
}
.attr-line input[type='number'] {
  width: 44px;
  padding: 1px 3px;
  text-align: center;
  background: #11161c;
  border: 1px solid var(--line);
  border-radius: 3px;
  color: var(--white);
  font-size: 0.78rem;
  appearance: textfield;
}
.attr-line input[type='number']::-webkit-inner-spin-button {
  appearance: none;
}
.attr-line select {
  grid-column: 2/4;
  max-width: 100%;
  background: var(--inner);
  color: var(--white);
  border: 1px solid var(--line);
  border-radius: 3px;
}
.attr-hint {
  font-size: 0.8rem;
  color: var(--muted);
}
.transport {
  position: sticky;
  bottom: 0;
  z-index: 4;
  background: #21262f;
  border-top: 1px solid #414954;
  box-shadow: 0 -6px 18px #090b0e50;
}
.transport-inner {
  min-height: 84px;
  gap: clamp(12px, 2.4vw, 42px);
}
.small-label {
  color: var(--muted);
  font-size: 0.73rem;
}
.transport-state {
  min-width: 100px;
  width: clamp(100px, 15vw, 220px);
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.transport-state strong {
  font-size: 0.94rem;
  text-overflow: ellipsis;
  overflow: hidden;
  white-space: nowrap;
}
.progress {
  height: 2px;
  max-width: 145px;
  background: #39434e;
  margin-top: 3px;
}
.progress b {
  display: block;
  background: var(--mint);
  height: 100%;
  width: 0;
}
.transport-keys {
  gap: 7px;
}
.deck-key,
.go-key,
#blackout {
  height: 43px;
  gap: 7px;
  font-size: 0.95rem;
}
.go-key {
  background: var(--mint);
  border: 1px solid #d3f5dd;
  color: #152b21;
  padding: 0 18px;
  font-size: 1.1rem;
  font-weight: 740;
  letter-spacing: 0.02em;
}
.go-key:hover:enabled {
  background: #cef3db;
  border-color: #e3ffed;
}
.go-key .icon {
  width: 15px;
}
.go-key .icon svg {
  fill: currentColor;
}
.go-key kbd {
  font: 500 0.66rem system-ui;
  color: #365645;
  border: 1px solid #719782;
  border-radius: 3px;
  padding: 1px 4px;
  margin-left: 10px;
}
.master {
  margin-left: auto;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 4px 10px;
  min-width: 115px;
  max-width: 200px;
  width: 16vw;
  font-size: 0.84rem;
}
.master input {
  grid-column: 1/3;
  margin: 3px 0;
}
.master output {
  color: var(--ice);
}
#blackout {
  color: #f3c4b3;
  background: #352c2c;
  border-color: #65504b;
  padding: 0 12px;
  white-space: nowrap;
}
#blackout[aria-pressed='true'] {
  color: #fff;
  background: #9a3934;
  border-color: #ff9f89;
}
#hold[aria-pressed='true'] {
  background: #514335;
  color: #ffe2ae;
}
.workspace-view {
  min-height: 465px;
}
.view-note {
  padding: 14px 17px;
  color: var(--muted);
  font-size: 0.89rem;
}
.scroll-table {
  overflow: auto;
}
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}
th,
td {
  text-align: left;
  padding: 9px 14px;
  white-space: nowrap;
  border-bottom: 1px solid var(--line);
}
th {
  font-weight: 500;
  color: var(--muted);
  font-size: 0.83rem;
}
.patch-pill {
  background: #293543;
  color: var(--ice);
  padding: 3px 7px;
  border-radius: 3px;
}
#channels {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(46px, 1fr));
  gap: 3px;
  padding: 0 14px 15px;
}
.grid-cell {
  display: flex;
  flex-direction: column;
  align-items: center;
  border: 1px solid #35404b;
  border-radius: 3px;
  padding: 3px 0;
  background: #141a20;
  font-size: 0.85rem;
}
.grid-cell span {
  font-size: 0.68rem;
  color: #a9b3bf;
}
.grid-cell.on {
  background: #31465a;
  color: #eff6ff;
}
dialog {
  width: min(510px, calc(100% - 28px));
  max-height: 88vh;
  padding: 0;
  background: #20262f;
  color: var(--white);
  border: 1px solid #485361;
  border-radius: 8px;
  box-shadow: 0 25px 85px #0009;
}
dialog::backdrop {
  background: #070a10bc;
}
dialog form > header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--line);
  padding: 14px 19px;
}
dialog h2 {
  font-size: 1.14rem;
}
dialog #dismiss {
  font-size: 1.4rem;
  background: transparent;
  border: 0;
  color: var(--muted);
}
#dialog-body {
  padding: 17px 19px;
  display: grid;
  gap: 14px;
}
.field {
  display: grid;
  gap: 5px;
  color: #ccd5df;
  font-size: 0.9rem;
}
.field input,
.field select {
  background: #13181e;
  border: 1px solid #47525e;
  color: var(--white);
  padding: 8px 10px;
  border-radius: 4px;
  min-width: 0;
  width: 100%;
}
.pair {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
dialog p {
  font-size: 0.9rem;
  color: #c1cbd7;
  line-height: 1.6;
}
.modal-row {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}
.modal-row button,
.file-choice {
  font-size: 0.89rem;
}
.file-choice {
  padding: 10px 12px;
  text-align: left;
}
.port-card {
  border: 1px solid #404a57;
  border-radius: 5px;
  padding: 12px;
  display: grid;
  gap: 8px;
}
.port-card h3 {
  font-size: 1rem;
}
.port-card h3 small {
  font-size: 0.8rem;
  font-weight: 450;
  color: var(--muted);
  margin-left: 10px;
}
#dialog-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 7px;
  padding: 0 19px 17px;
}
.primary-btn {
  background: #c4d8f2;
  border-color: #c4d8f2;
  color: #1d2937;
}
.primary-btn:hover:enabled {
  background: #deebff;
}
.danger {
  color: #f4b9ab;
}
#dialog-error {
  margin: 0 19px 14px;
  color: #ffc4b1;
}
.help {
  font-size: 0.83rem;
  color: var(--muted);
}
#notice {
  position: fixed;
  bottom: 92px;
  left: 50%;
  transform: translateX(-50%);
  max-width: 90vw;
  z-index: 7;
  background: #334150;
  border: 1px solid #627386;
  border-radius: 6px;
  padding: 8px 15px;
  color: white;
  font-size: 0.88rem;
  box-shadow: 0 3px 12px #0005;
  pointer-events: none;
}
#notice:empty {
  display: none;
}
[hidden] {
  display: none !important;
}
@media (min-width: 1450px) {
  .fader-area {
    height: 130px;
  }
  .strip {
    padding-top: 12px;
    padding-bottom: 12px;
  }
  .stage {
    height: clamp(265px, 29vh, 390px);
  }
  .cue-row {
    min-height: 40px;
  }
}
@media (max-width: 1080px) {
  .topbar {
    gap: 20px;
  }
  .topbar nav {
    gap: 0;
  }
  .upper {
    grid-template-columns: minmax(0, 1.25fr) minmax(330px, 1fr);
  }
  .lower {
    grid-template-columns: minmax(0, 1.9fr) minmax(250px, 1fr);
  }
  .strip {
    flex-basis: 65px;
  }
  .panel-head {
    padding: 0 11px;
  }
  .panel-head h2 {
    font-size: 0.94rem;
  }
  .transport-inner {
    gap: 14px;
  }
}
@media (max-width: 800px) {
  .topbar {
    flex-wrap: wrap;
    gap: 7px 15px;
    padding-top: 10px;
  }
  .brand {
    font-size: 1.21rem;
  }
  .brand img {
    width: 29px;
    height: 29px;
  }
  .topbar nav {
    order: 3;
    width: 100%;
    height: 35px;
  }
  .topbar nav button {
    margin-right: 10px;
  }
  .upper,
  .lower {
    grid-template-columns: 1fr;
  }
  .lower {
    gap: 12px;
  }
  .stage {
    height: clamp(210px, 38vw, 320px);
  }
  #cue-list {
    max-height: 238px;
  }
  .cue-row {
    min-height: 36px;
  }
  .transport-inner {
    flex-wrap: wrap;
    padding-top: 9px;
    padding-bottom: 9px;
    gap: 8px 14px;
  }
  .transport-state {
    flex: 1;
  }
  .transport-keys {
    order: 2;
  }
  .master {
    width: 145px;
  }
  .transport-inner #blackout {
    order: 3;
  }
  .attributes #attribute-body {
    max-height: none;
  }
  #fader-bank {
    min-height: 190px;
  }
  .strip {
    flex-basis: 67px;
  }
  .showline {
    min-height: 60px;
  }
  .show-status {
    gap: 6px;
  }
  .show-id {
    gap: 6px;
  }
  .stage-foot {
    padding: 4px 10px;
  }
}
@media (max-width: 540px) {
  main,
  .transport-inner {
    padding-left: 10px;
    padding-right: 10px;
  }
  .topbar {
    padding-left: 12px;
    padding-right: 12px;
  }
  .show-status #save-status,
  .show-status i,
  .wide-label {
    display: none;
  }
  .top-actions button {
    padding: 5px 8px;
  }
  .showline h1 {
    font-size: 1.09rem;
  }
  .showline .tag {
    font-size: 0.7rem;
  }
  .cue-grid {
    grid-template-columns: 39px minmax(60px, 1fr) 55px 55px;
  }
  .stage {
    height: 218px;
  }
  .master {
    width: 37%;
    min-width: 80px;
  }
  .transport-state {
    width: 55%;
  }
  .transport-keys {
    flex: 1;
  }
  .deck-key,
  .go-key,
  #blackout {
    height: 37px;
    padding: 0 9px;
  }
  .go-key {
    flex: 1;
    justify-content: center;
  }
  .go-key kbd {
    display: none;
  }
  .transport-keys {
    gap: 5px;
  }
  .transport-inner {
    gap: 8px;
  }
  .transport-state .small-label {
    display: none;
  }
  #notice {
    bottom: 102px;
  }
  .stage-legend {
    left: 9px;
    top: 7px;
  }
  .fader-area {
    height: 90px;
  }
}
@media (prefers-reduced-motion: reduce) {
  * {
    scroll-behavior: auto !important;
  }
}

body {
  min-height: 100svh;
  display: flex;
  flex-direction: column;
}
main,
.transport {
  width: 100%;
}
.transport {
  margin-top: auto;
}
.next-cue {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
  width: clamp(88px, 12vw, 175px);
  padding-left: 16px;
  border-left: 1px solid #414a55;
}
.next-cue strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 0.91rem;
  font-weight: 560;
}
.transport-state {
  width: clamp(105px, 11vw, 176px);
}
.output-meter {
  position: absolute;
  right: -2px;
  bottom: 6px;
  height: calc(100% - 12px);
  width: 3px;
  background: #29313b;
  border-radius: 2px;
  overflow: hidden;
}
.output-meter i {
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  height: var(--output, 0%);
  background: var(--swatch);
  opacity: 0.85;
}
@media (max-width: 900px) {
  .transport-inner {
    gap: 9px;
  }
  .next-cue {
    padding-left: 9px;
  }
  .go-key kbd {
    margin-left: 0;
  }
  .transport-state {
    min-width: 80px;
  }
}
@media (max-width: 800px) {
  .next-cue {
    width: 22%;
  }
  .transport-keys {
    order: 2;
  }
  .transport-state {
    flex: 1;
  }
  .master {
    margin-left: auto;
  }
}
@media (max-width: 540px) {
  .transport-state {
    width: 26%;
    flex: 1;
  }
  .next-cue {
    width: 28%;
    border: 0;
    padding: 0;
  }
  .next-cue .small-label {
    font-size: 0.63rem;
  }
  .next-cue strong {
    font-size: 0.74rem;
  }
  .master {
    width: 31%;
  }
}

.bank-status,
#dialog-transport {
  display: flex;
  align-items: center;
  gap: 9px;
}
#bank-mode {
  font-size: 0.71rem;
  color: var(--ice);
  white-space: nowrap;
}
#dialog-transport {
  border-top: 1px solid var(--line);
  padding: 9px 17px;
  background: var(--inner);
  position: sticky;
  bottom: 0;
}
#dialog-transport > span {
  margin-right: auto;
  color: var(--muted);
  font-size: 0.8rem;
}
#dialog-transport button {
  padding: 4px 9px;
  font-size: 0.83rem;
}
#dialog-go {
  color: var(--mint);
}
#dialog-blackout[aria-pressed='true'] {
  background: #893f3a;
  color: white;
}
@media (max-width: 400px) {
  #bank-mode {
    font-size: 0.65rem;
  }
  .bank-status {
    gap: 2px;
  }
}

.stage-foot {
  flex-wrap: wrap;
  gap: 5px 12px;
}
.stage-foot > span:first-child {
  margin-right: auto;
}
.strip.overridden .fader-val,
#trim {
  color: var(--amber);
}
#cue-update:enabled,
#osc-enable[aria-pressed='true'] {
  color: var(--mint);
}
.v-fader:disabled {
  opacity: 1;
  cursor: default;
}
.pose-status {
  font-variant-numeric: tabular-nums;
  color: var(--ice);
  font-size: 0.78rem;
  margin: -3px 0 8px;
}
.mount-settings {
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 5px;
}
.mount-settings summary {
  cursor: pointer;
  font-weight: 600;
}
.mount-settings[open] > :not(summary) {
  margin-top: 10px;
}
.reversals {
  display: flex;
  gap: 16px;
}
.bank-status {
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 3px 7px;
}
@media (max-width: 440px) {
  .fader-panel .panel-head {
    min-height: 51px;
    height: auto;
    padding-block: 6px;
    flex-wrap: wrap;
  }
  .fader-panel .panel-head h2 {
    font-size: 0.94rem;
  }
}

dialog[open]:has(.fx-editor) {
  display: flex;
  flex-direction: column;
  width: min(620px, calc(100% - 24px));
  overflow: hidden;
}
dialog:has(.fx-editor) form {
  display: flex;
  flex-direction: column;
  min-height: 0;
}
dialog:has(.fx-editor) #dialog-body {
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
}
dialog:has(.fx-editor) #dialog-actions {
  padding-top: 12px;
  border-top: 1px solid var(--line);
}
.fx-editor,
.fx-detail,
.fx-add-body {
  display: grid;
  gap: 13px;
  min-width: 0;
}
.fx-track-list,
.fx-targets > div {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.fx-track-list button {
  font-size: 0.86rem;
}
.fx-track-list button[aria-pressed='true'] {
  border-color: var(--ice);
  background: #2a3a50;
}
.fx-targets {
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
}
.fx-targets legend {
  margin-bottom: 5px;
  color: #ccd5df;
  font-size: 0.9rem;
}
.fx-targets label {
  display: flex;
  align-items: center;
  gap: 6px;
  min-height: 34px;
  padding: 3px 9px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--inner);
  font-size: 0.84rem;
  cursor: pointer;
}
.fx-targets input {
  margin: 0;
  accent-color: var(--ice);
}
.fx-waveform {
  margin: 0;
}
.fx-waveform canvas {
  display: block;
  width: 100%;
  height: 57px;
  background: var(--inner);
}
.fx-waveform figcaption {
  padding-top: 4px;
  color: var(--muted);
  font-size: 0.77rem;
}
.fx-add-panel,
.fx-advanced {
  border-top: 1px solid var(--line);
}
.fx-add-panel summary,
.fx-advanced summary {
  padding: 10px 0;
  color: var(--ice);
  cursor: pointer;
}
.fx-advanced .field {
  margin: 4px 0;
}
.fx-remove,
#fx-add {
  justify-self: start;
}
.fx-remove {
  color: #edb5a9;
}
.fx-stage-preview {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: var(--inner);
}
.fx-stage-preview summary {
  padding: 9px 12px;
  color: var(--ice);
  cursor: pointer;
}
.fx-stage-preview canvas {
  display: block;
  width: 100%;
  height: clamp(140px, 25vh, 220px);
  background: var(--ground);
}
.fx-preview-tools {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px 12px;
  padding: 8px 10px;
  color: var(--muted);
  font-size: 0.82rem;
}
@media (any-pointer: coarse) {
  .fx-editor :is(button, select, input[type='number'], summary),
  .fx-targets label {
    min-height: 42px;
  }
}
