:root {
  color-scheme: dark;
  --bg: #090b0f;
  --panel: #11151b;
  --panel-2: #171d25;
  --line: #2b3441;
  --text: #f5f8fb;
  --muted: #9aa6b5;
  --red: #ef2439;
  --red-2: #bd1022;
  --cyan: #24d5ff;
  --amber: #ffb23f;
  --green: #52d273;
  --rise: #1688ff;
  --hold: #00b368;
  --fall: #ffa927;
  --rest: #ff202d;
  --freq: #6517f2;
  --width: #9a9a9a;
  --shadow: 0 24px 80px rgba(0, 0, 0, 0.42);
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
}

body {
  margin: 0;
  color: var(--text);
  background:
    radial-gradient(circle at 18% 0%, rgba(239, 36, 57, 0.18), transparent 29rem),
    linear-gradient(135deg, #07090d 0%, #111721 48%, #090b0f 100%);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button,
input,
a {
  font: inherit;
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

.app-shell {
  min-height: 100vh;
  padding: 22px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  width: min(1480px, 100%);
  margin: 0 auto 18px;
}

.brand {
  display: inline-flex;
  align-items: center;
  min-width: 0;
  color: var(--text);
}

.brand strong,
.brand small {
  display: block;
  line-height: 1.05;
}

.brand strong {
  font-size: 1.04rem;
  letter-spacing: 0;
}

.brand small {
  margin-top: 4px;
  color: var(--muted);
  font-size: 0.78rem;
}

.select-tool-button {
  flex: 0 0 auto;
  min-width: 116px;
  border: 1px solid rgba(36, 213, 255, 0.42);
  padding: 10px 14px;
  color: var(--cyan);
  background: rgba(36, 213, 255, 0.08);
  text-align: center;
  text-transform: uppercase;
  font-size: 0.85rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  cursor: pointer;
  transition:
    border-color 160ms ease,
    background-color 160ms ease,
    color 160ms ease;
}

.select-tool-button:hover,
.select-tool-button:focus-visible {
  border-color: var(--cyan);
  color: #fff;
  background: rgba(36, 213, 255, 0.14);
  outline: none;
}

.select-tool-button[hidden],
.tool-hub[hidden] {
  display: none;
}

.tool-hub {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0;
  width: min(1480px, 100%);
  margin: 0 auto 18px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(17, 21, 27, 0.82);
  box-shadow: var(--shadow);
}

.hub-copy {
  padding: clamp(22px, 3vw, 38px);
}

.hub-copy span {
  display: block;
  margin-bottom: 12px;
  color: var(--cyan);
  font-size: 0.78rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.14em;
}

.hub-copy h1 {
  max-width: 650px;
}

.tool-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
  align-content: stretch;
  padding: 0 clamp(22px, 3vw, 38px) clamp(22px, 3vw, 38px);
}

.tool-card {
  position: relative;
  display: flex;
  min-height: 0;
  flex-direction: column;
  align-items: flex-start;
  justify-content: flex-start;
  gap: 12px;
  border: 1px solid var(--line);
  padding: 20px;
  color: var(--text);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.035), rgba(255, 255, 255, 0.01)),
    var(--panel-2);
  text-align: left;
  cursor: pointer;
  transition:
    transform 160ms ease,
    border-color 160ms ease,
    background-color 160ms ease,
    box-shadow 160ms ease;
}

.tool-card:hover {
  transform: translateY(-1px);
}

.tool-card.active {
  border-color: rgba(239, 36, 57, 0.84);
  background:
    linear-gradient(180deg, rgba(239, 36, 57, 0.22), rgba(17, 21, 27, 0.9)),
    var(--panel-2);
  box-shadow: 0 0 28px rgba(239, 36, 57, 0.2);
}

.tool-status {
  border: 1px solid rgba(239, 36, 57, 0.72);
  padding: 6px 9px;
  color: #ffdce0;
  background: rgba(239, 36, 57, 0.16);
  box-shadow: 0 0 18px rgba(239, 36, 57, 0.16);
  font-size: 0.72rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.12em;
}

.tool-card strong {
  display: block;
  color: #fff;
  font-size: 1.15rem;
  line-height: 1.08;
}

.tool-card small {
  display: block;
  max-width: 30ch;
  color: var(--muted);
  font-size: 0.86rem;
  line-height: 1.4;
}

.workspace {
  display: grid;
  grid-template-columns: minmax(285px, 355px) minmax(0, 1fr);
  gap: 18px;
  width: min(1480px, 100%);
  margin: 0 auto;
}

.tool-workspace:not(.active) {
  display: none;
}

.control-panel,
.stage {
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(17, 21, 27, 0.9);
  box-shadow: var(--shadow);
}

.control-panel {
  display: grid;
  gap: 1px;
  align-self: start;
  overflow: hidden;
}

.control-block {
  padding: 20px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.035), rgba(255, 255, 255, 0.01));
}

.label-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  max-width: 620px;
  font-size: clamp(2.1rem, 4vw, 4.5rem);
  line-height: 0.94;
  letter-spacing: 0;
}

h2 {
  font-size: 0.84rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: #dce5ee;
}

p {
  max-width: 610px;
  margin-top: 12px;
  color: var(--muted);
  font-size: 1rem;
  line-height: 1.55;
}

output,
.counter {
  color: var(--cyan);
  font-size: 0.88rem;
  white-space: nowrap;
}

input[type="range"] {
  width: 100%;
  height: 26px;
  margin: 0;
  accent-color: var(--red);
}

.quick-options,
.tag-grid,
.snippet-list {
  display: grid;
  gap: 8px;
}

.quick-options {
  grid-template-columns: repeat(5, 1fr);
  margin-top: 13px;
}

.chip,
.tag {
  min-height: 42px;
  border: 1px solid var(--line);
  color: var(--text);
  background: var(--panel-2);
  cursor: pointer;
  transition:
    border-color 160ms ease,
    background-color 160ms ease,
    color 160ms ease,
    transform 160ms ease;
}

.chip:hover,
.tag:hover,
.icon-button:hover,
.secondary-button:hover,
.primary-button:hover,
.download-link:hover,
.small-button:hover,
.info-button:hover {
  transform: translateY(-1px);
}

.chip.active,
.tag.active {
  border-color: rgba(239, 36, 57, 0.95);
  color: white;
  background: linear-gradient(180deg, var(--red), var(--red-2));
  box-shadow: 0 0 18px rgba(239, 36, 57, 0.23);
}

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

.tag {
  min-width: 0;
  padding: 0 8px;
  font-size: 0.88rem;
}

.meter {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 7px;
  margin-top: 12px;
}

.meter span {
  height: 6px;
  background: var(--line);
}

.meter span.is-on:nth-child(1) {
  background: var(--green);
}

.meter span.is-on:nth-child(2) {
  background: var(--amber);
}

.meter span.is-on:nth-child(3) {
  background: var(--red);
}

.channel-map {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 11px;
  margin-top: 12px;
  color: var(--muted);
  font-weight: 800;
}

.channel-map i {
  display: block;
  height: 2px;
  background: linear-gradient(90deg, var(--cyan), var(--red));
  box-shadow: 0 0 18px rgba(36, 213, 255, 0.3);
}

.stage {
  min-height: calc(100vh - 86px);
  padding: clamp(20px, 3vw, 42px);
  overflow: hidden;
}

.stage-head {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  align-items: flex-start;
}

.icon-button,
.secondary-button,
.primary-button,
.download-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  border: 1px solid transparent;
  color: var(--text);
  text-decoration: none;
  cursor: pointer;
  transition:
    transform 160ms ease,
    border-color 160ms ease,
    background-color 160ms ease;
}

.icon-button {
  width: 46px;
  height: 46px;
  flex: 0 0 46px;
  border-color: var(--line);
  background: var(--panel-2);
}

svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.scope-wrap {
  position: relative;
  margin-top: 30px;
  border: 1px solid rgba(255, 255, 255, 0.11);
  background:
    linear-gradient(rgba(255, 255, 255, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.035) 1px, transparent 1px),
    #080b10;
  background-size: 28px 28px;
}

.scope-meta {
  position: absolute;
  inset: 16px 18px auto 18px;
  z-index: 1;
  display: flex;
  justify-content: space-between;
  color: var(--muted);
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  pointer-events: none;
}

canvas {
  display: block;
  width: 100%;
  height: min(36vh, 440px);
  min-height: 285px;
}

.composer-grid {
  display: grid;
  grid-template-columns: minmax(280px, 0.88fr) minmax(0, 1.4fr);
  gap: 14px;
  margin-top: 16px;
}

.snippet-bank,
.timeline-panel {
  min-width: 0;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(8, 11, 16, 0.46);
}

.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 14px 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.section-head span {
  color: var(--cyan);
  font-size: 0.84rem;
  white-space: nowrap;
}

.snippet-list {
  min-height: 184px;
  max-height: 292px;
  overflow: auto;
  padding: 12px;
}

.snippet-card,
.timeline-item,
.empty-list,
.timeline-empty {
  border: 1px solid var(--line);
  background: rgba(23, 29, 37, 0.82);
}

.snippet-card,
.timeline-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-width: 0;
  padding: 12px;
  cursor: grab;
}

.snippet-card:active,
.timeline-item:active {
  cursor: grabbing;
}

.snippet-card strong,
.timeline-item strong {
  display: block;
  color: #fff;
  font-size: 0.95rem;
}

.snippet-card span,
.timeline-item span,
.empty-list,
.timeline-empty {
  display: block;
  margin-top: 5px;
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.35;
}

.empty-list,
.timeline-empty {
  padding: 14px;
}

.timeline-dropzone {
  min-height: 184px;
  padding: 12px;
  transition:
    border-color 160ms ease,
    background-color 160ms ease;
}

.timeline-dropzone.is-dragging {
  outline: 1px solid rgba(36, 213, 255, 0.58);
  background: rgba(36, 213, 255, 0.05);
}

.timeline-list {
  display: flex;
  gap: 10px;
  min-height: 120px;
  overflow-x: auto;
  padding-bottom: 4px;
}

.timeline-item {
  flex-direction: column;
  align-items: flex-start;
  flex-basis: 180px;
  min-width: 180px;
  max-width: 360px;
  border-color: rgba(239, 36, 57, 0.34);
  background: linear-gradient(180deg, rgba(239, 36, 57, 0.16), rgba(23, 29, 37, 0.86));
}

.timeline-tools {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-start;
  gap: 6px;
  width: 100%;
  margin-top: 4px;
}

.timeline-summary {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.07);
}

.timeline-summary div {
  padding: 16px;
  background: rgba(12, 15, 20, 0.78);
}

.timeline-summary span,
.download-panel span,
.progress-copy span {
  display: block;
  color: var(--muted);
  font-size: 0.76rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
}

.timeline-summary strong,
.download-panel strong,
.progress-copy strong {
  display: block;
  margin-top: 6px;
  color: #fff;
  font-size: 0.96rem;
}

.export-row {
  display: grid;
  gap: 12px;
  margin-top: 18px;
}

.export-actions,
.transport {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
}

.export-action {
  display: flex;
  align-items: stretch;
  gap: 8px;
}

.secondary-button,
.primary-button,
.download-link,
.small-button,
.info-button {
  min-height: 50px;
  padding: 0 19px;
  font-weight: 800;
}

.secondary-button {
  border-color: var(--line);
  background: var(--panel-2);
}

.primary-button,
.download-link {
  border-color: rgba(239, 36, 57, 0.78);
  background: linear-gradient(180deg, var(--red), var(--red-2));
  box-shadow: 0 16px 34px rgba(239, 36, 57, 0.22);
}

.alt-primary {
  border-color: rgba(36, 213, 255, 0.72);
  background: linear-gradient(180deg, #17aace, #0c738d);
  box-shadow: 0 16px 34px rgba(36, 213, 255, 0.15);
}

.full-button {
  width: 100%;
  margin-top: 10px;
}

.full-button:first-child {
  margin-top: 0;
}

.small-button,
.info-button {
  min-height: 34px;
  border: 1px solid var(--line);
  color: var(--text);
  background: var(--panel-2);
  cursor: pointer;
  transition:
    transform 160ms ease,
    border-color 160ms ease,
    background-color 160ms ease;
}

.small-button {
  padding: 0 10px;
  font-size: 0.78rem;
}

.small-button:disabled,
.primary-button:disabled,
.secondary-button:disabled,
.info-button:disabled {
  cursor: not-allowed;
  opacity: 0.45;
  transform: none;
}

.danger {
  border-color: rgba(239, 36, 57, 0.46);
  color: #ffc8ce;
}

.linx-snippet-card .small-button.danger {
  border-color: rgba(239, 36, 57, 0.72);
  color: #ffdce0;
  background: rgba(239, 36, 57, 0.16);
  box-shadow: 0 0 18px rgba(239, 36, 57, 0.16);
  font-weight: 900;
  text-transform: none;
  letter-spacing: 0;
}

.info-button {
  width: 42px;
  min-height: 50px;
  padding: 0;
  border-color: rgba(255, 255, 255, 0.2);
  border-radius: 999px;
  color: #fff;
  font-family: Georgia, serif;
  font-style: italic;
  font-size: 1rem;
}

.info-panel {
  justify-self: end;
  max-width: 620px;
  padding: 12px 14px;
  border: 1px solid rgba(36, 213, 255, 0.32);
  color: #d8f6ff;
  background: rgba(36, 213, 255, 0.08);
  font-size: 0.9rem;
  line-height: 1.45;
}

.info-panel[hidden] {
  display: none;
}

.empty-list[hidden],
.timeline-empty[hidden] {
  display: none;
}

.download-panel {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-top: 18px;
  padding: 15px;
  border: 1px solid rgba(82, 210, 115, 0.36);
  background: rgba(82, 210, 115, 0.08);
}

.progress-panel {
  display: grid;
  gap: 12px;
  margin-top: 18px;
  padding: 15px;
  border: 1px solid rgba(36, 213, 255, 0.32);
  background: rgba(36, 213, 255, 0.07);
}

.progress-copy {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 14px;
}

.progress-copy strong {
  color: var(--cyan);
}

.progress-track {
  position: relative;
  height: 12px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(0, 0, 0, 0.28);
}

.progress-track i {
  display: block;
  width: 0%;
  height: 100%;
  background: linear-gradient(90deg, var(--cyan), var(--red));
  box-shadow: 0 0 18px rgba(36, 213, 255, 0.42);
  transition: width 120ms ease;
}

.progress-panel[hidden],
.download-panel[hidden] {
  display: none;
}

#stimTool .control-block > .progress-panel,
#stimTool .control-block > .download-panel {
  margin-top: 10px;
}

#stimTool .control-block > .download-panel {
  display: grid;
  align-items: stretch;
  gap: 12px;
}

#stimTool .control-block > .progress-panel[hidden],
#stimTool .control-block > .download-panel[hidden] {
  display: none;
}

#stimTool .control-block > .download-panel .download-link {
  display: grid;
  place-items: center;
  text-align: center;
}

.linx-meta {
  display: grid;
  gap: 18px;
}

.linx-meta[hidden] {
  display: none;
}

.linx-meta-item {
  display: grid;
  gap: 8px;
}

.linx-meta-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.linx-meta-item > span,
.linx-meta-heading span,
.linx-param label {
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.12em;
}

.linx-meta-value {
  display: block;
  color: var(--text);
  font-size: 1.28rem;
  line-height: 1.15;
}

.linx-edit-button {
  display: inline-grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border: 1px solid rgba(36, 213, 255, 0.35);
  color: var(--cyan);
  background: rgba(36, 213, 255, 0.08);
  cursor: pointer;
  transition:
    transform 160ms ease,
    border-color 160ms ease,
    background-color 160ms ease;
}

.linx-edit-button:hover,
.linx-edit-button:focus-visible {
  transform: translateY(-1px);
  border-color: var(--cyan);
  background: rgba(36, 213, 255, 0.14);
  outline: none;
}

.linx-edit-button[hidden],
.linx-meta-value[hidden],
.linx-name-input[hidden] {
  display: none;
}

.linx-name-input,
.linx-snippet-name,
.linx-param input {
  width: 100%;
  border: 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.14);
  color: var(--text);
  background: rgba(8, 11, 16, 0.72);
  padding: 9px 10px;
}

.linx-param input[type="number"] {
  appearance: textfield;
  padding-right: 34px;
}

.linx-param input[type="number"]::-webkit-outer-spin-button,
.linx-param input[type="number"]::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.linx-name-input:focus,
.linx-snippet-name:focus,
.linx-param input:focus {
  outline: none;
  border-bottom-color: var(--cyan);
}

.number-stepper {
  position: relative;
  min-width: 0;
}

.number-stepper-buttons {
  position: absolute;
  top: 50%;
  right: 8px;
  display: grid;
  width: 18px;
  opacity: 0;
  pointer-events: none;
  transform: translateY(-50%);
  background: rgba(255, 255, 255, 0.18);
  transition: opacity 140ms ease;
}

.number-stepper:hover .number-stepper-buttons,
.number-stepper:focus-within .number-stepper-buttons {
  opacity: 1;
  pointer-events: auto;
}

.number-step-button {
  width: 18px;
  height: 15px;
  border: 0;
  padding: 0;
  color: #ffffff;
  background: transparent;
  cursor: pointer;
}

.number-step-button::before {
  content: "";
  display: block;
  width: 0;
  height: 0;
  margin: 0 auto;
  border-right: 5px solid transparent;
  border-left: 5px solid transparent;
}

.number-step-button.up::before {
  border-bottom: 6px solid currentColor;
}

.number-step-button.down::before {
  border-top: 6px solid currentColor;
}

.number-step-button:hover,
.number-step-button:focus-visible,
.number-step-button.active {
  color: var(--cyan);
  background: rgba(36, 213, 255, 0.14);
}

.stim-preset-panel {
  display: grid;
  gap: 14px;
}

.stim-preset-panel[hidden] {
  display: none;
}

.stim-preset-panel summary {
  list-style: none;
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  cursor: pointer;
}

.stim-preset-panel summary::-webkit-details-marker {
  display: none;
}

.stim-preset-panel summary::after {
  content: "+";
  float: right;
  color: var(--cyan);
  font-size: 1rem;
  line-height: 0.8;
}

.stim-preset-panel[open] summary::after {
  content: "-";
}

.stim-preset-list {
  display: grid;
  gap: 10px;
  margin-top: 14px;
}

.stim-preset-card {
  display: grid;
  gap: 5px;
  border: 1px solid var(--line);
  padding: 12px;
  background: rgba(8, 11, 16, 0.45);
  transition:
    border-color 160ms ease,
    background-color 160ms ease;
}

.stim-preset-card:hover,
.stim-preset-card:focus-within {
  border-color: rgba(36, 213, 255, 0.45);
  background: rgba(36, 213, 255, 0.06);
}

.stim-preset-card strong {
  color: var(--text);
  font-size: 0.98rem;
}

.stim-preset-card small {
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.35;
}

.stim-preset-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  max-height: 0;
  margin-top: 0;
  overflow: hidden;
  opacity: 0;
  transform: translateY(-3px);
  transition:
    max-height 160ms ease,
    margin-top 160ms ease,
    opacity 160ms ease,
    transform 160ms ease;
}

.stim-preset-card:hover .stim-preset-actions,
.stim-preset-card:focus-within .stim-preset-actions {
  max-height: 44px;
  margin-top: 8px;
  opacity: 1;
  transform: translateY(0);
}

.stim-preset-actions .small-button:first-child {
  border-color: rgba(36, 213, 255, 0.45);
  color: var(--cyan);
}

.stim-preset-actions .small-button:last-child {
  border-color: rgba(176, 106, 255, 0.5);
  color: #cda9ff;
}

.stim-playlist-card .stim-preset-actions {
  grid-template-columns: 1fr;
}

.stim-playlist-card .stim-preset-actions .small-button,
.stim-playlist-card .stim-preset-actions .small-button:last-child {
  border-color: rgba(36, 213, 255, 0.45);
  color: var(--cyan);
}

.stim-preset-actions .small-button:hover,
.stim-preset-actions .small-button:focus-visible {
  transform: none;
}

.linx-info-bar {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1px;
  margin-top: 24px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.07);
}

.linx-info-bar div {
  padding: 14px;
  background: rgba(12, 15, 20, 0.78);
}

.linx-info-bar span {
  display: block;
  color: var(--muted);
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
}

.linx-info-bar strong {
  display: block;
  margin-top: 6px;
  color: #fff;
  font-size: 0.9rem;
}

.linx-empty {
  display: grid;
  justify-items: center;
  gap: 8px;
  margin-top: 16px;
  padding: 50px 24px;
  border: 1px dashed rgba(36, 213, 255, 0.26);
  background: rgba(8, 11, 16, 0.48);
  text-align: center;
}

.linx-empty[hidden],
.linx-editor[hidden] {
  display: none;
}

.linx-empty strong {
  font-size: 1.1rem;
}

.linx-empty span {
  color: var(--muted);
}

.linx-editor {
  display: grid;
  gap: 16px;
  margin-top: 16px;
}

.linx-channel-switch {
  display: none;
}

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

.linx-channel {
  min-width: 0;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(8, 11, 16, 0.46);
}

.linx-channel.ch1 {
  border-top: 2px solid var(--cyan);
}

.linx-channel.ch2 {
  border-top: 2px solid #b06aff;
}

.linx-snippet-list {
  display: grid;
  gap: 10px;
  min-height: 160px;
  padding: 12px;
}

.linx-snippet-card {
  border: 1px solid var(--line);
  background: rgba(23, 29, 37, 0.82);
  padding: 12px;
}

.linx-snippet-head {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}

.linx-order-controls {
  display: grid;
  grid-template-columns: auto auto;
  justify-items: center;
  align-items: center;
  column-gap: 5px;
  width: 50px;
}

.linx-order-number {
  display: grid;
  min-width: 20px;
  place-items: center;
  color: var(--muted);
  font-size: 1.06rem;
  font-weight: 900;
  line-height: 1;
}

.linx-order-arrows {
  display: grid;
  gap: 2px;
}

.linx-order-button {
  width: 18px;
  height: 14px;
  border: 0;
  padding: 0;
  background: transparent;
  cursor: pointer;
}

.linx-order-button::before {
  content: "";
  display: block;
  width: 0;
  height: 0;
  margin: 0 auto;
  border-right: 7px solid transparent;
  border-left: 7px solid transparent;
}

.linx-order-button.move-up::before {
  border-bottom: 12px solid var(--text);
}

.linx-order-button.move-down::before {
  border-top: 12px solid var(--text);
}

.linx-order-button:hover::before,
.linx-order-button:focus-visible::before {
  filter: drop-shadow(0 0 8px rgba(36, 213, 255, 0.72));
}

.linx-order-button:focus-visible {
  outline: none;
}

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

.linx-param {
  display: grid;
  gap: 5px;
}

.linx-snippet-duration {
  margin-top: 10px;
  color: var(--cyan);
  font-size: 0.84rem;
  font-weight: 400;
  text-align: right;
  letter-spacing: 0;
}

.linx-param[data-phase="rise"] > span {
  color: var(--rise);
}

.linx-param[data-phase="hold"] > span {
  color: var(--hold);
}

.linx-param[data-phase="fall"] > span {
  color: var(--fall);
}

.linx-param[data-phase="rest"] > span {
  color: var(--rest);
}

.linx-param[data-phase="freq"] > span {
  color: var(--freq);
}

.linx-param[data-phase="width"] > span {
  color: var(--width);
}

.linx-param[data-phase="repeat"] > span {
  color: var(--cyan);
  min-height: 2.35em;
}

#stimTool.sine-mode .linx-phase-legend {
  display: none;
}

#stimTool.sine-mode .stim-param-grid .linx-param[data-phase="rise"] > span,
#stimTool.sine-mode .stim-param-grid .linx-param[data-phase="hold"] > span,
#stimTool.sine-mode .stim-param-grid .linx-param[data-phase="fall"] > span,
#stimTool.sine-mode .stim-param-grid .linx-param[data-phase="rest"] > span {
  color: var(--text);
}

.linx-param input.invalid {
  background: rgba(239, 36, 57, 0.12);
}

.linx-waveform-row {
  margin-top: 12px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: #080b10;
}

.linx-waveform {
  display: block;
  width: 100%;
  height: 44px;
  min-height: 44px;
}

.channel-footer {
  display: flex;
  justify-content: center;
  padding: 10px 12px 14px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.summary-canvas-wrap {
  padding: 16px;
  overflow-x: hidden;
  background: #080b10;
}

.linx-phase-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  padding: 12px 16px 0;
  background: #080b10;
}

.linx-phase-legend span {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

.linx-phase-legend i {
  display: block;
  width: 26px;
  height: 4px;
}

.phase-rise {
  background: var(--rise);
}

.phase-hold {
  background: var(--hold);
}

.phase-fall {
  background: var(--fall);
}

.phase-rest {
  background: var(--rest);
}

#linxSummaryCanvas {
  display: block;
  width: 100%;
  min-height: 250px;
}

#stimSummaryCanvas {
  display: block;
  width: 100%;
  min-height: 250px;
}

.stim-summary-actions {
  display: inline-flex;
  align-items: center;
  gap: 12px;
}

.stim-window-controls {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
  white-space: nowrap;
}

.section-head .stim-window-controls span {
  color: var(--muted);
  font-size: 0.78rem;
}

.stim-window-button {
  width: 42px;
  height: 42px;
  min-width: 42px;
  border-color: rgba(36, 213, 255, 0.34);
  color: var(--cyan);
  background: rgba(36, 213, 255, 0.06);
}

.stim-window-button:hover,
.stim-window-button:focus-visible {
  border-color: var(--cyan);
  color: #ffffff;
  background: rgba(36, 213, 255, 0.14);
}

.stim-window-button:disabled {
  opacity: 0.32;
  cursor: not-allowed;
  box-shadow: none;
}

.stim-play-button {
  width: 42px;
  height: 42px;
  min-width: 42px;
  border-color: rgba(36, 213, 255, 0.58);
  color: var(--cyan);
  background: rgba(36, 213, 255, 0.08);
}

.stim-play-button:hover,
.stim-play-button:focus-visible,
.stim-play-button.is-playing {
  border-color: var(--cyan);
  color: #ffffff;
  background: rgba(36, 213, 255, 0.16);
  box-shadow: 0 0 20px rgba(36, 213, 255, 0.16);
}

.stim-play-button:disabled {
  opacity: 0.38;
  cursor: not-allowed;
  box-shadow: none;
}

.stim-view-toggle {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  padding: 12px 16px 0;
  background: #080b10;
}

.stim-view-toggle .small-button.active {
  border-color: var(--cyan);
  color: #ffffff;
  background: rgba(36, 213, 255, 0.12);
}

.linx-toast {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 10;
  border: 1px solid rgba(36, 213, 255, 0.42);
  padding: 10px 14px;
  color: #d8f6ff;
  background: rgba(8, 11, 16, 0.94);
  opacity: 0;
  transform: translateY(8px);
  transition:
    opacity 180ms ease,
    transform 180ms ease;
}

.linx-toast.show {
  opacity: 1;
  transform: translateY(0);
}

@media (max-width: 940px) {
  .app-shell {
    padding: 14px;
  }

  .tool-grid {
    padding-top: 0;
  }

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

  .stage {
    min-height: auto;
  }

  .control-panel {
    order: 2;
  }

  .stage {
    order: 1;
  }

  #linxTool .stage > .control-panel,
  #stimTool .stage > .control-panel {
    margin: 24px 0;
    box-shadow: none;
  }

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

  .timeline-list {
    flex-direction: column;
  }

  .timeline-item {
    max-width: none;
  }

  .linx-channels,
  .linx-info-bar {
    grid-template-columns: 1fr;
  }

  .linx-channel-switch {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
  }

  .linx-channel-toggle {
    display: grid;
    gap: 4px;
    min-height: 62px;
    border: 1px solid var(--line);
    border-top: 3px solid transparent;
    padding: 12px;
    color: var(--text);
    background: rgba(8, 11, 16, 0.56);
    text-align: left;
    cursor: pointer;
  }

  .linx-channel-toggle.ch1 {
    border-top-color: var(--cyan);
  }

  .stim-summary-actions {
    flex-wrap: wrap;
    justify-content: flex-end;
  }

  .stim-window-controls {
    order: 2;
  }

  .linx-channel-toggle.ch2 {
    border-top-color: #b06aff;
  }

  .linx-channel-toggle span {
    font-weight: 900;
    text-transform: uppercase;
    letter-spacing: 0.12em;
  }

  .linx-channel-toggle small {
    color: var(--muted);
    font-size: 0.84rem;
    font-weight: 800;
  }

  .linx-channel-toggle.active {
    background: rgba(23, 29, 37, 0.92);
    box-shadow: inset 0 0 0 1px rgba(36, 213, 255, 0.14);
  }

  #linxTool .linx-channel:not(.mobile-active),
  #stimTool .linx-channel:not(.mobile-active) {
    display: none;
  }

  .stim-preset-card .stim-preset-actions {
    max-height: 44px;
    margin-top: 8px;
    opacity: 1;
    transform: translateY(0);
  }
}

@media (max-width: 620px) {
  .stage-head,
  .transport,
  .export-actions,
  .export-action,
  .download-panel,
  .progress-copy {
    align-items: stretch;
  }

  .stage-head,
  .transport,
  .export-actions,
  .export-action,
  .download-panel,
  .progress-copy {
    flex-direction: column;
  }

  .topbar {
    flex-direction: row;
    align-items: center;
  }

  .brand strong,
  .brand small {
    white-space: nowrap;
  }

  .brand strong {
    font-size: 0.95rem;
  }

  .select-tool-button {
    min-width: auto;
    padding: 9px 10px;
    font-size: 0.72rem;
  }

  .hub-copy {
    padding: 28px 24px 18px;
  }

  .hub-copy p {
    font-size: 1rem;
    line-height: 1.55;
  }

  .tool-grid {
    gap: 14px;
    padding: 0 24px 28px;
  }

  .tool-card {
    min-height: 0;
    gap: 10px;
    padding: 18px;
  }

  .tool-card strong {
    font-size: 1.06rem;
    line-height: 1.15;
  }

  .tool-card small {
    max-width: none;
  }

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

  .quick-options {
    grid-template-columns: repeat(5, minmax(42px, 1fr));
  }

  .timeline-summary {
    grid-template-columns: 1fr;
  }

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

  h1 {
    font-size: 2.32rem;
  }

  canvas {
    height: 360px;
  }

  .icon-button {
    align-self: flex-start;
  }
}
