:root {
  color-scheme: dark;
  --bg: #080806;
  --panel: #151511;
  --panel-strong: #202018;
  --line: #38382d;
  --text: #f5f0df;
  --muted: #aaa28c;
  --hot: #ff4b2f;
  --amber: #ffb000;
  --lime: #c7ff4f;
  --cyan: #36e0ff;
  --ink: #080806;
  --shadow: 0 24px 70px rgba(0, 0, 0, 0.36);
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background:
    radial-gradient(circle at 20% 10%, rgba(255, 75, 47, 0.16), transparent 28rem),
    radial-gradient(circle at 85% 8%, rgba(199, 255, 79, 0.12), transparent 24rem),
    linear-gradient(135deg, #080806 0%, #151511 48%, #10120d 100%);
}

body {
  min-height: 100vh;
  margin: 0;
  color: var(--text);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
  line-height: 1.45;
}

button,
select,
input {
  font: inherit;
}

button,
select {
  color: inherit;
}

button {
  border: 0;
}

.instrument-shell {
  width: min(1500px, calc(100% - 28px));
  margin: 0 auto;
  padding: 18px 0 26px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 76px;
  padding: 12px 0 18px;
}

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

.mark {
  display: grid;
  flex: 0 0 62px;
  width: 62px;
  height: 62px;
  place-items: center;
  border: 1px solid #59523a;
  border-radius: 8px;
  background:
    linear-gradient(135deg, rgba(255, 176, 0, 0.24), rgba(54, 224, 255, 0.1)),
    var(--panel);
  color: var(--lime);
  font-size: 1.15rem;
  font-weight: 900;
  letter-spacing: 0;
  box-shadow: inset 0 0 22px rgba(255, 176, 0, 0.18);
}

h1 {
  margin: 0;
  font-size: clamp(1.35rem, 4vw, 2.55rem);
  line-height: 1;
  letter-spacing: 0;
}

#statusLine {
  display: block;
  min-height: 1.35em;
  margin-top: 7px;
  color: var(--muted);
  font-size: 0.94rem;
}

.transport {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 10px;
}

.transport button,
.kit-button {
  min-height: 44px;
  cursor: pointer;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #1c1c16;
  transition:
    transform 140ms ease,
    border-color 140ms ease,
    background 140ms ease,
    opacity 140ms ease;
}

.transport button {
  min-width: 94px;
  padding: 0 18px;
  font-weight: 800;
}

.transport button:hover:not(:disabled),
.kit-button:hover {
  transform: translateY(-1px);
  border-color: #6b6144;
  background: #26251c;
}

.transport button:disabled {
  cursor: not-allowed;
  opacity: 0.42;
}

.transport .primary {
  border-color: #ffb000;
  background: linear-gradient(135deg, #ffb000, #ff4b2f);
  color: #120d05;
  box-shadow: 0 14px 38px rgba(255, 75, 47, 0.26);
}

.performance-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(300px, 390px);
  gap: 16px;
  align-items: stretch;
}

.stage-panel,
.control-panel,
.timeline-panel,
.kit-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(21, 21, 17, 0.88);
  box-shadow: var(--shadow);
}

.stage-panel {
  position: relative;
  min-height: 430px;
  overflow: hidden;
}

#stageCanvas {
  display: block;
  width: 100%;
  height: min(62vh, 620px);
  min-height: 430px;
  background:
    linear-gradient(rgba(255, 176, 0, 0.08) 1px, transparent 1px),
    linear-gradient(90deg, rgba(54, 224, 255, 0.07) 1px, transparent 1px),
    #090907;
  background-size: 46px 46px;
}

.stage-readouts {
  position: absolute;
  left: 12px;
  right: 12px;
  bottom: 12px;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

.stage-readouts > div,
.meter-strip > div {
  min-width: 0;
  border: 1px solid rgba(245, 240, 223, 0.12);
  border-radius: 8px;
  background: rgba(8, 8, 6, 0.78);
  padding: 9px 10px;
  backdrop-filter: blur(10px);
}

.stage-readouts span,
.meter-strip span {
  display: block;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
  text-transform: uppercase;
}

.stage-readouts strong,
.meter-strip strong {
  display: block;
  overflow: hidden;
  margin-top: 3px;
  color: var(--text);
  font-size: 1rem;
  line-height: 1.15;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.control-panel {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 16px;
}

.field {
  display: grid;
  gap: 8px;
  min-width: 0;
  color: var(--muted);
  font-size: 0.92rem;
  font-weight: 800;
}

.field span {
  display: flex;
  justify-content: space-between;
  gap: 8px;
}

.field b {
  color: var(--lime);
  font-weight: 900;
}

select {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #0f0f0c;
  padding: 0 12px;
}

.switch {
  display: flex;
  align-items: center;
  gap: 10px;
  width: fit-content;
  color: var(--text);
  cursor: pointer;
  font-weight: 800;
}

.switch input {
  width: 42px;
  height: 23px;
  margin: 0;
  accent-color: var(--amber);
}

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

input[type="range"] {
  width: 100%;
  accent-color: var(--hot);
}

.kit-panel {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin-top: 16px;
  padding: 12px;
}

.kit-button {
  display: grid;
  gap: 4px;
  min-width: 0;
  padding: 12px;
  text-align: left;
}

.kit-button.active {
  border-color: var(--cyan);
  background: linear-gradient(135deg, rgba(54, 224, 255, 0.18), rgba(255, 176, 0, 0.13));
}

.kit-button strong {
  overflow-wrap: anywhere;
  color: var(--text);
  font-size: 0.98rem;
  line-height: 1.18;
}

.kit-button span {
  color: var(--muted);
  font-size: 0.84rem;
  line-height: 1.25;
}

.timeline-panel {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(220px, 330px);
  gap: 0;
  min-height: 190px;
  margin-top: 16px;
  overflow: hidden;
}

#timelineCanvas {
  display: block;
  width: 100%;
  height: 190px;
  background: #0b0b08;
}

.event-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 190px;
  overflow: auto;
  border-left: 1px solid var(--line);
  padding: 12px;
}

.event-chip {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
  border: 1px solid rgba(245, 240, 223, 0.1);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.035);
  padding: 8px 10px;
}

.event-chip strong,
.event-chip span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.event-chip strong {
  color: var(--text);
  font-size: 0.87rem;
}

.event-chip span {
  color: var(--muted);
  font-size: 0.78rem;
}

@media (max-width: 980px) {
  .topbar,
  .performance-grid,
  .timeline-panel {
    grid-template-columns: 1fr;
  }

  .topbar {
    display: grid;
    align-items: start;
  }

  .transport {
    justify-content: stretch;
  }

  .transport button {
    flex: 1 1 130px;
  }

  .performance-grid {
    display: grid;
  }

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

  .event-list {
    max-height: none;
    border-top: 1px solid var(--line);
    border-left: 0;
  }
}

@media (max-width: 620px) {
  .instrument-shell {
    width: min(100% - 16px, 1500px);
    padding-top: 8px;
  }

  .brand {
    align-items: flex-start;
  }

  .mark {
    flex-basis: 52px;
    width: 52px;
    height: 52px;
    font-size: 1rem;
  }

  .stage-panel {
    min-height: 390px;
  }

  #stageCanvas {
    height: 390px;
    min-height: 390px;
  }

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

  .kit-panel {
    grid-template-columns: 1fr;
  }
}
