@import url("https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@400;500;600;700&display=swap");

:root {
  color-scheme: dark;
  font-family: "Space Grotesk", Inter, "Segoe UI", Arial, sans-serif;
  background: #050505;
  color: #f2f2f2;
  --bg: #050505;
  --text: #f2f2f2;
  --muted: #a8a8a8;
  --soft: rgba(255, 255, 255, 0.08);
  --soft-strong: rgba(255, 255, 255, 0.16);
  --panel: rgba(8, 8, 8, 0.82);
  --panel-strong: rgba(12, 12, 12, 0.94);
  --line: rgba(255, 255, 255, 0.12);
  --line-strong: rgba(255, 255, 255, 0.26);
  --accent: #ffffff;
  --danger: #ff7a7a;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at top left, rgba(255, 255, 255, 0.09), transparent 28rem),
    linear-gradient(180deg, #090909 0%, #050505 52%, #030303 100%);
  color: var(--text);
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.03) 1px, transparent 1px);
  background-size: 42px 42px;
  mask-image: linear-gradient(to bottom, black, transparent 78%);
}

button,
select,
input {
  font: inherit;
}

button,
.import-button {
  min-height: 36px;
  border: 1px solid var(--line);
  border-radius: 0;
  background: rgba(255, 255, 255, 0.08);
  color: var(--text);
  padding: 0 14px;
  cursor: pointer;
  transition: border-color 160ms ease, background 160ms ease, transform 160ms ease;
}

button:hover,
.import-button:hover {
  border-color: var(--line-strong);
  background: rgba(255, 255, 255, 0.14);
  transform: translateY(-1px);
}

button.primary {
  border-color: rgba(255, 255, 255, 0.65);
  background: #f2f2f2;
  color: #050505;
  font-weight: 700;
}

button.primary:hover {
  background: #ffffff;
}

.shell {
  position: relative;
  width: min(1380px, calc(100vw - 32px));
  margin: 0 auto;
  padding: 38px 0 26px;
}

.topbar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
  gap: 20px;
  margin-bottom: 22px;
}

.eyebrow {
  margin: 0 0 2px;
  color: var(--muted);
  font-size: 14px;
}

h1,
h2,
p {
  margin: 0;
  letter-spacing: 0;
}

h1 {
  color: #ffffff;
  font-size: clamp(48px, 7vw, 92px);
  line-height: 0.9;
  font-weight: 700;
}

.subhead {
  max-width: 520px;
  margin-top: 12px;
  color: var(--muted);
  font-size: 18px;
  line-height: 1.35;
}

h2 {
  color: #ffffff;
  font-size: 15px;
  font-weight: 600;
}

.connection {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--muted);
  padding-bottom: 8px;
}

.status-dot {
  width: 9px;
  height: 9px;
  border-radius: 0;
  background: #6c6c6c;
  box-shadow: 0 0 0 5px rgba(255, 255, 255, 0.06);
}

.status-dot.connected {
  background: #ffffff;
  box-shadow: 0 0 0 5px rgba(255, 255, 255, 0.18);
}

.workspace {
  display: grid;
  gap: 14px;
}

.panel,
.keyboard-frame {
  border: 1px solid var(--line);
  border-radius: 0;
  background: var(--panel);
  box-shadow: 0 20px 70px rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(18px);
}

.keyboard-stage {
  display: grid;
  gap: 12px;
}

.stage-header {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
  gap: 18px;
  min-height: 58px;
}

.stage-header p {
  margin-top: 3px;
  color: var(--muted);
  font-size: 13px;
}

.panel {
  padding: 14px;
}

.actions {
  display: flex;
  gap: 8px;
}

.import-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.import-button input {
  display: none;
}

.keyboard-frame {
  overflow: auto;
  padding: 22px;
  min-height: 424px;
}

.keyboard {
  position: relative;
  min-width: 960px;
  height: 360px;
}

.key {
  position: absolute;
  display: grid;
  place-items: center;
  border: 1px solid color-mix(in srgb, var(--key-color), white 22%);
  border-bottom-color: rgba(0, 0, 0, 0.65);
  border-radius: 0;
  color: rgba(255, 255, 255, 0.9);
  font-size: 12px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.16), rgba(0, 0, 0, 0.28)),
    var(--key-color);
  box-shadow:
    inset 0 -11px 18px rgba(0, 0, 0, 0.34),
    0 0 22px color-mix(in srgb, var(--key-color), transparent 42%);
  user-select: none;
}

.controls {
  display: grid;
  gap: 14px;
  background: var(--panel-strong);
}

.command-deck {
  display: grid;
  grid-template-columns: minmax(520px, 1.6fr) minmax(280px, 0.7fr);
  gap: 14px;
  align-items: start;
}

.tabs {
  display: flex;
  gap: 8px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 0;
  background: rgba(255, 255, 255, 0.04);
}

.tab {
  flex: 1;
  border-color: transparent;
  background: transparent;
}

.tab.active {
  border-color: var(--line-strong);
  background: rgba(255, 255, 255, 0.18);
}

.control-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 12px;
}

label.disabled {
  opacity: 0.48;
}

label.disabled::after {
  content: "effect controls color";
  color: #cfcfcf;
  font-size: 11px;
}

select,
input[type="range"],
input[type="color"] {
  width: 100%;
}

.native-select {
  display: none;
}

input[type="color"] {
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 0;
  background: rgba(255, 255, 255, 0.07);
  color: #ffffff;
}

.custom-select {
  position: relative;
  z-index: 20;
}

.custom-select-button {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  min-height: 40px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.07);
  padding: 0 10px;
  text-align: left;
}

.custom-select-chevron {
  color: var(--muted);
  font-size: 18px;
  line-height: 1;
}

.custom-select-menu {
  position: absolute;
  left: 0;
  right: 0;
  top: calc(100% + 6px);
  display: none;
  max-height: 292px;
  overflow-y: auto;
  border: 1px solid var(--line-strong);
  background: rgba(6, 6, 6, 0.98);
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.72);
  padding: 4px;
}

.custom-select.open .custom-select-menu {
  display: grid;
  gap: 2px;
}

.custom-select-option {
  width: 100%;
  min-height: 34px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--muted);
  padding: 0 10px;
  text-align: left;
  transform: none;
}

.custom-select-option:hover,
.custom-select-option.selected {
  border-color: var(--line);
  background: rgba(255, 255, 255, 0.14);
  color: #ffffff;
  transform: none;
}

.custom-select-menu::-webkit-scrollbar {
  width: 10px;
}

.custom-select-menu::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.06);
}

.custom-select-menu::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.34);
}

input[type="color"] {
  padding: 4px;
}

input[type="range"] {
  accent-color: #ffffff;
}

.actions {
  flex-wrap: wrap;
}

.actions button,
.actions .import-button {
  flex: 1;
  min-width: 112px;
}

.summary {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
  margin: 0;
}

.summary-row {
  display: grid;
  grid-template-columns: 16px auto auto;
  gap: 8px;
  align-items: center;
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: 0;
  background: rgba(255, 255, 255, 0.055);
  padding: 0 12px 0 9px;
  color: var(--muted);
  font-size: 12px;
}

.summary-row span:nth-child(2) {
  color: #ffffff;
}

.summary-row span:nth-child(3) {
  max-width: 150px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.mini-dot {
  width: 14px;
  height: 14px;
  border-radius: 0;
  background: var(--dot);
  box-shadow: 0 0 18px var(--dot);
}

.log {
  display: grid;
  gap: 6px;
  max-height: 292px;
  overflow: auto;
  color: var(--muted);
  font-family: ui-monospace, SFMono-Regular, Consolas, "Liberation Mono", monospace;
  font-size: 11px;
  line-height: 1.45;
}

.log .error {
  color: var(--danger);
}

@media (max-width: 1120px) {
  .command-deck {
    grid-template-columns: 1fr;
  }

  .control-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 680px) {
  .shell {
    width: min(100vw - 20px, 1380px);
    padding-top: 22px;
  }

  .topbar {
    grid-template-columns: 1fr;
  }

  .stage-header {
    grid-template-columns: 1fr;
  }

  .summary {
    justify-content: flex-start;
  }

  .connection,
  .actions {
    align-items: stretch;
    flex-direction: column;
  }

  h1 {
    font-size: 48px;
  }

  .subhead {
    font-size: 16px;
  }

  .control-grid,
  .tabs {
    display: grid;
    grid-template-columns: 1fr;
  }
}
