:root {
  --bg: #0d1b2a;
  --surface: #10263f;
  --accent: #1f5a8a;
  --highlight: #ff4f3f;
  --text: #f5f7ff;
  --muted: #5e7690;
  --font-mono: "JetBrains Mono", "Fira Code", monospace;
}
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}
body {
  background: radial-gradient(circle at 15% 0%, rgba(31, 90, 138, 0.25), transparent 42%), radial-gradient(circle at 88% 10%, rgba(255, 79, 63, 0.14), transparent 35%), var(--bg);
  color: var(--text);
  font-family: var(--font-mono);
  height: 100vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
input,
button,
textarea,
select {
  background-color: var(--surface);
  color: var(--text);
  border: 1px solid var(--muted);
  font-family: var(--font-mono);
}
button,
select,
input[type="range"] {
  touch-action: manipulation;
}
button {
  padding: 0.55em 1em;
  cursor: pointer;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
}
button:hover {
  background-color: var(--accent);
}
button:active {
  background-color: var(--highlight);
}
input[type="range"] {
  width: 100px;
  cursor: pointer;
}
select {
  padding: 0.35em 0.55em;
  border-radius: 8px;
  cursor: pointer;
}
.field-group {
  display: flex;
  align-items: center;
  gap: 0.5em;
  font-size: 13px;
  white-space: nowrap;
}
#toolbar {
  background-color: rgba(16, 38, 63, 0.9);
  padding: 0.75em 1em;
  display: flex;
  align-items: center;
  gap: 1em;
  flex-wrap: wrap;
  border-bottom: 1px solid var(--muted);
}
#workspace {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: 1fr;
}
#workspace.mixer-open {
  grid-template-columns: minmax(0, 1fr) 280px;
}
#editor-wrap {
  position: relative;
  flex: 1;
  overflow: hidden;
}
#editor,
#editor-hl {
  position: absolute;
  inset: 0;
  margin: 0;
  padding: 1em;
  font: 14px/1.6 var(--font-mono);
  white-space: pre-wrap;
  overflow: auto;
  -moz-tab-size: 2;
    -o-tab-size: 2;
       tab-size: 2;
}
#editor {
  color: transparent;
  caret-color: var(--text);
  background: transparent;
  border: none;
  outline: none;
  resize: none;
  z-index: 1;
}
#editor-hl {
  color: var(--text);
  background: rgba(7, 17, 28, 0.35);
  border: none;
  z-index: 0;
}
#statusbar {
  background-color: rgba(16, 38, 63, 0.92);
  padding: 0.5em 1em;
  display: flex;
  align-items: center;
  gap: 1em;
  border-top: 1px solid var(--muted);
  font-size: 12px;
}
#beat-dots {
  display: flex;
  gap: 4px;
  align-items: center;
}
.beat-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background-color: var(--muted);
  transition: background-color 0.05s;
}
.beat-dot.active {
  background-color: var(--highlight);
}
#status-message {
  margin-left: auto;
  opacity: 0.9;
}
#mixer-panel {
  border-left: 1px solid var(--muted);
  background: rgba(6, 16, 28, 0.88);
  padding: 0.7em;
  overflow: auto;
}
#mixer-panel.collapsed {
  display: none;
}
#mixer-panel h3 {
  font-size: 13px;
  margin-bottom: 0.6em;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
#mixer-transport {
  display: grid;
  gap: 0.45em;
  border: 1px solid #34516b;
  border-radius: 8px;
  padding: 0.5em;
  margin-bottom: 0.6em;
  background: rgba(16, 38, 63, 0.55);
}
.transport-row {
  display: grid;
  grid-template-columns: 40px 1fr auto;
  align-items: center;
  gap: 0.4em;
  font-size: 11px;
  color: #b8c9da;
}
.transport-row select {
  width: 100%;
}
.transport-val {
  min-width: 2.8ch;
  text-align: right;
  color: #dfe9f6;
}
#mixer-strips {
  display: grid;
  gap: 0.55em;
}
.m-strip {
  border: 1px solid #34516b;
  border-radius: 8px;
  padding: 0.45em;
  background: rgba(16, 38, 63, 0.7);
}
.m-name {
  font-size: 12px;
  font-weight: 600;
  margin-bottom: 0.2em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.m-vu {
  height: 4px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.1);
  margin-bottom: 0.35em;
}
.m-vu.active {
  background: #6cf6ae;
  box-shadow: 0 0 8px rgba(108, 246, 174, 0.8);
}
.m-row {
  display: grid;
  grid-template-columns: 28px 28px 1fr;
  gap: 0.35em;
  margin-bottom: 0.35em;
}
.m-btn {
  padding: 0.25em 0;
  border-radius: 6px;
  font-size: 11px;
}
.m-btn.active {
  background: var(--highlight);
}
.m-slider,
.m-send {
  width: 100%;
}
.m-sends {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.35em;
}
.m-sends label {
  font-size: 11px;
  color: #b8c9da;
}
#mixer-fx {
  margin-top: 0.75em;
  border-top: 1px solid #34516b;
  padding-top: 0.65em;
  display: grid;
  gap: 0.5em;
}
#mixer-fx label {
  font-size: 11px;
  color: #b8c9da;
  display: grid;
  gap: 0.2em;
}
.tok-comment {
  color: #8ea0b2;
  font-style: italic;
}
.tok-track {
  color: var(--highlight);
  font-weight: 700;
}
.tok-subtrack {
  color: #ff8779;
  font-weight: 700;
}
.tok-section {
  color: #7ed6ff;
}
.tok-inherit {
  color: #94afc8;
}
.tok-arrangement {
  color: #4ee0df;
}
.tok-var-def {
  color: #ffd166;
}
.tok-var-ref {
  color: #ffbf5a;
}
.tok-pattern {
  color: #c9a2ff;
}
.tok-repeat {
  color: #d8b7ff;
}
.tok-note {
  color: #8ee7b0;
}
.tok-chord {
  color: #b7f2cd;
}
.tok-mode {
  color: #7adff6;
}
.tok-operator {
  color: #f9b26f;
}
.tok-progression {
  color: #f29bc7;
}
.tok-channel {
  color: #f59866;
}
.tok-number {
  color: #f7ba67;
}
.tok-error {
  -webkit-text-decoration: underline wavy var(--highlight);
          text-decoration: underline wavy var(--highlight);
}
#var-tooltip {
  position: fixed;
  pointer-events: none;
  z-index: 99;
  background: rgba(12, 30, 48, 0.97);
  border: 1px solid var(--muted);
  border-radius: 8px;
  padding: 0.5em 0.7em;
  max-width: min(320px, 80vw);
  font-size: 12px;
  line-height: 1.5;
}
#var-tooltip strong {
  display: block;
  color: var(--highlight);
  margin-bottom: 0.2em;
}
#about-link {
  color: var(--text);
  text-decoration: none;
  border: 1px solid var(--muted);
  border-radius: 8px;
  padding: 0.48em 0.75em;
  background: rgba(0, 0, 0, 0.12);
}
#shortcuts {
  color: #b8c9da;
  font-size: 12px;
  margin-left: auto;
}
#midi-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}
#statusbar[data-state="error"] #status-message {
  color: var(--highlight);
}
#statusbar[data-state="playing"] #status-message {
  color: #6cf6ae;
}
#statusbar[data-state="warning"] #status-message {
  color: #f9cb6b;
}
.slider-wrap {
  display: inline-flex;
  align-items: center;
  gap: 0.45em;
}
.slider-value {
  min-width: 2.4ch;
  text-align: right;
}
#preset-select {
  min-width: 9.5rem;
}
@media (max-width: 900px) {
  #workspace.mixer-open {
    grid-template-columns: 1fr;
  }
}
@media (max-width: 720px) {
  #toolbar {
    gap: 0.6em;
    padding: 0.7em;
  }
  .field-group {
    font-size: 12px;
  }
  #preset-select {
    min-width: 7.5rem;
  }
}
