:root {
  color-scheme: dark;
  --bg: #111318;
  --panel: #1b1f27;
  --panel-2: #242a33;
  --ink: #f7f2e7;
  --muted: #aeb5c2;
  --line: #343b48;
  --accent: #ffcf5a;
  --accent-2: #42d7c6;
  --green: #8de25c;
  --blue: #69a7ff;
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: #111318;
  color: var(--ink);
}

button,
input,
select,
textarea {
  font: inherit;
}

.hidden {
  display: none !important;
}

.main-menu {
  position: fixed;
  inset: 0;
  z-index: 10;
  display: grid;
  grid-template-columns: minmax(20rem, 1.1fr) minmax(20rem, 0.9fr);
  min-height: 100vh;
  background: #111318;
}

.menu-visual {
  min-height: 100vh;
  background: #0e1016;
}

#menuCanvas {
  width: 100%;
  height: 100%;
  display: block;
}

.menu-content {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: flex-start;
  gap: 1rem;
  padding: clamp(1.25rem, 5vw, 4rem);
  border-left: 1px solid var(--line);
  background: #171a21;
}

.menu-copy {
  max-width: 32rem;
  margin: 0;
  color: var(--muted);
  font-size: 1rem;
  line-height: 1.55;
}

.release-badge,
.version-line {
  margin: 0;
  color: var(--accent);
  font-size: 0.86rem;
  font-weight: 900;
}

.menu-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.7rem;
  margin-top: 0.5rem;
}

.icon-text-btn {
  min-height: 2.65rem;
  border: 1px solid var(--line);
  color: var(--ink);
  background: var(--panel-2);
  padding: 0 1rem;
  cursor: pointer;
  font-weight: 850;
}

.full-btn {
  width: 100%;
}

.help-panel {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  padding: 1rem;
  background: rgba(10, 12, 16, 0.76);
}

.help-content {
  width: min(42rem, 100%);
  border: 1px solid var(--line);
  background: var(--panel);
  padding: 1rem;
}

.help-header {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: flex-start;
  border-bottom: 1px solid var(--line);
  padding-bottom: 1rem;
}

.help-content ol {
  margin: 1rem 0 0;
  padding-left: 1.4rem;
  color: var(--muted);
  line-height: 1.65;
}

.studio-shell {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  min-height: 5.8rem;
  padding: 1rem;
  border-bottom: 1px solid var(--line);
  background: #171a21;
}

.kicker {
  margin: 0 0 0.35rem;
  color: var(--accent-2);
  font-size: 0.76rem;
  font-weight: 850;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

h1,
h2 {
  margin: 0;
  line-height: 1.05;
}

h1 {
  font-size: clamp(1.65rem, 3vw, 3rem);
}

h2 {
  font-size: 1.35rem;
}

.workspace {
  flex: 1;
  display: grid;
  grid-template-columns: 18rem minmax(34rem, 1fr) 22rem;
  min-height: 0;
}

.settings-panel,
.editor-panel,
.export-panel {
  min-height: 0;
  border-right: 1px solid var(--line);
  background: var(--panel);
}

.settings-panel,
.export-panel {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  padding: 1rem;
}

.editor-panel {
  display: grid;
  grid-template-rows: minmax(14rem, 32vh) auto auto 1fr;
  gap: 1rem;
  padding: 1rem;
  background: #14171d;
}

.section-info {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  border: 1px solid var(--line);
  background: var(--panel);
  padding: 0.75rem 0.9rem;
}

.section-info strong {
  color: var(--accent);
}

.section-info span {
  color: var(--muted);
  font-size: 0.9rem;
}

.section-tabs {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.45rem;
}

.section-tab {
  min-height: 2.5rem;
  border: 1px solid var(--line);
  color: var(--muted);
  background: var(--panel);
  cursor: pointer;
  font-weight: 850;
}

.section-tab.active {
  color: #101318;
  border-color: var(--accent);
  background: var(--accent);
}

#stageCanvas {
  width: 100%;
  height: 100%;
  display: block;
  border: 1px solid var(--line);
  background: #0e1016;
}

.transport {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 0.55rem;
}

.transport .icon-text-btn {
  min-height: 2.45rem;
  padding: 0 0.75rem;
}

#loadFile {
  display: none;
}

.primary-btn,
.icon-btn,
.lane-toggle {
  border: 1px solid var(--line);
  color: var(--ink);
  background: var(--panel-2);
  cursor: pointer;
}

.primary-btn {
  min-height: 2.65rem;
  padding: 0 1rem;
  color: #15120a;
  background: var(--accent);
  border-color: #f6c445;
  font-weight: 900;
}

.primary-btn.alt {
  color: #101318;
  background: var(--accent-2);
  border-color: var(--accent-2);
}

.icon-btn {
  width: 2.65rem;
  height: 2.65rem;
  display: grid;
  place-items: center;
  font-weight: 900;
}

.primary-btn:hover,
.icon-btn:hover,
.lane-toggle:hover {
  filter: brightness(1.12);
}

.text-field,
.select-field,
.slider-field {
  display: grid;
  gap: 0.35rem;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 850;
  text-transform: uppercase;
}

.text-field input,
.select-field select {
  min-height: 2.35rem;
  width: 100%;
  border: 1px solid var(--line);
  color: var(--ink);
  background: #12151b;
  padding: 0 0.65rem;
}

.text-field input::placeholder {
  color: #707989;
}

.slider-field {
  grid-template-columns: auto 1fr auto;
  align-items: center;
}

.slider-field span {
  grid-column: 1 / -1;
}

.slider-field input {
  width: 100%;
  accent-color: var(--accent-2);
}

.slider-field strong {
  min-width: 2.7rem;
  color: var(--ink);
  text-align: right;
}

.mix-panel {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.55rem;
  padding-top: 0.25rem;
}

.lane-toggle {
  min-height: 2.45rem;
  color: var(--muted);
  font-weight: 850;
}

.lane-toggle.active {
  color: #101318;
  border-color: var(--accent-2);
  background: var(--accent-2);
}

.sequencer {
  display: grid;
  grid-template-columns: 5.8rem repeat(16, minmax(1.7rem, 1fr));
  grid-auto-rows: minmax(3.3rem, 1fr);
  gap: 0.35rem;
  min-height: 25rem;
  overflow: auto;
}

.lane-label,
.step {
  border: 1px solid var(--line);
  background: var(--panel);
}

.lane-label {
  display: grid;
  place-items: center;
  padding: 0.35rem;
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 900;
  text-transform: uppercase;
}

.step {
  position: relative;
  min-width: 0;
  cursor: pointer;
}

.step::after {
  content: "";
  position: absolute;
  inset: 31%;
  background: rgba(255, 255, 255, 0.14);
}

.step.active[data-lane="lead"]::after {
  inset: 16%;
  background: var(--accent);
}

.step.active[data-lane="bass"]::after {
  inset: 20% 26%;
  background: var(--accent-2);
}

.step.active[data-lane="pulse"]::after {
  inset: 26% 18%;
  background: var(--green);
}

.step.active[data-lane="spark"]::after {
  inset: 18%;
  background: var(--blue);
}

.step.active[data-lane="drums"]::after {
  inset: 24%;
  background: #ff7a59;
}

.step.playhead {
  outline: 2px solid var(--ink);
  outline-offset: -2px;
}

.export-panel {
  border-right: 0;
}

.export-panel p:last-child {
  margin: 0.55rem 0 0;
  color: var(--muted);
  line-height: 1.45;
}

.license-panel {
  border: 1px solid var(--line);
  background: #12151b;
  padding: 0.85rem;
}

.license-panel p:last-child {
  margin: 0;
  color: var(--muted);
  font-size: 0.88rem;
  line-height: 1.45;
}

#exportText {
  flex: 1;
  min-height: 18rem;
  resize: none;
  border: 1px solid var(--line);
  color: var(--ink);
  background: #12151b;
  padding: 0.75rem;
  font: 0.78rem/1.35 ui-monospace, SFMono-Regular, Consolas, "Liberation Mono", monospace;
}

.status-bar {
  min-height: 2.2rem;
  border-top: 1px solid var(--line);
  background: #171a21;
  color: var(--muted);
  padding: 0.55rem 1rem;
  font-size: 0.88rem;
}

@media (max-width: 1100px) {
  .workspace {
    grid-template-columns: 16rem 1fr;
  }

  .export-panel {
    grid-column: 1 / -1;
    border-top: 1px solid var(--line);
  }
}

@media (max-width: 760px) {
  .main-menu {
    grid-template-columns: 1fr;
  }

  .menu-visual {
    min-height: 38vh;
  }

  .menu-content {
    min-height: 62vh;
    border-left: 0;
    border-top: 1px solid var(--line);
  }

  .topbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .transport {
    justify-content: flex-start;
  }

  .transport .icon-text-btn,
  .transport .primary-btn {
    flex: 1 1 7rem;
  }

  .workspace {
    grid-template-columns: 1fr;
  }

  .settings-panel,
  .editor-panel {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .sequencer {
    grid-template-columns: 5rem repeat(16, minmax(1.9rem, 1fr));
  }

  .section-info {
    align-items: flex-start;
    flex-direction: column;
  }
}
