:root {
  --bg: #0c0d10;
  --panel: #14161c;
  --panel2: #1b1e27;
  --ink: #e8e0d4;
  --dim: #8a8278;
  --accent: #ffb14a;
  --mute: #c4473a;
  --lock: #6cb6ff;
  --line: #2a2e38;
  --font: "IBM Plex Sans", "Noto Sans KR", system-ui, sans-serif;
  --mono: "IBM Plex Mono", "ui-monospace", monospace;
}

* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--ink); font-family: var(--font); }
button, input, select { font-family: inherit; color: inherit; }
button { cursor: pointer; }

.topbar {
  position: sticky; top: 0; z-index: 5;
  display: flex; flex-wrap: wrap; gap: 12px 16px; align-items: center;
  padding: 10px 16px; background: #101218; border-bottom: 1px solid var(--line);
}
.brand { display: flex; flex-wrap: wrap; align-items: baseline; column-gap: 6px; min-width: 140px; }
.logo { font-weight: 700; letter-spacing: 0.18em; color: var(--accent); font-size: 18px; line-height: 1.1; }
.brand .by, .by {
  font-size: 10px; font-weight: 500; letter-spacing: 0.06em; line-height: 1.2;
  color: var(--dim); white-space: nowrap;
}
.logo .by { margin-left: 0.45em; vertical-align: baseline; }
.sub { flex: 1 0 100%; font-size: 11px; color: var(--dim); }
.recipes { display: flex; flex-wrap: wrap; gap: 4px; }
.recipes button {
  background: var(--panel2); border: 1px solid var(--line); border-radius: 999px;
  padding: 6px 10px; font-size: 12px;
}
.recipes button.active { border-color: var(--accent); color: var(--accent); }
.transport { display: flex; gap: 6px; align-items: center; margin-left: auto; }
.transport button, .btn {
  background: var(--accent); color: #1a1208; border: 0; border-radius: 4px;
  padding: 7px 12px; font-weight: 700; font-size: 12px;
}
.btn.ghost, .transport .ghost {
  background: var(--panel2); color: var(--ink); border: 1px solid var(--line);
}
.seed { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--dim); }
.seed input {
  width: 110px; background: var(--bg); border: 1px solid var(--line); border-radius: 4px;
  padding: 6px 8px; font-family: var(--mono); font-size: 12px;
}

.layers {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 8px;
  padding: 10px 16px 6px;
}
.strip {
  background: var(--panel); border: 1px solid var(--line); border-radius: 6px; padding: 8px 10px;
}
.strip.off { opacity: 0.45; }
.strip header { display: flex; align-items: center; gap: 6px; margin-bottom: 6px; }
.strip .name { font-size: 12px; font-weight: 650; }
.strip .ja { color: var(--accent); font-size: 11px; margin-left: 4px; }
.strip .tools { margin-left: auto; display: flex; gap: 4px; }
.iconbtn {
  width: 22px; height: 22px; border-radius: 3px; border: 1px solid var(--line);
  background: var(--panel2); font-size: 11px; padding: 0;
}
.iconbtn.on { border-color: var(--accent); color: var(--accent); }
.iconbtn.lock.on { border-color: var(--lock); color: var(--lock); }
.iconbtn.mute.on { border-color: var(--mute); color: var(--mute); }

label.row {
  display: grid; grid-template-columns: 64px 1fr 44px; gap: 6px; align-items: center;
  font-size: 10px; color: var(--dim); margin: 3px 0;
}
label.row input[type="range"] { width: 100%; accent-color: var(--accent); }
label.row .val { font-family: var(--mono); text-align: right; color: var(--ink); min-width: 0; }
input.val {
  width: 100%; max-width: 44px; min-width: 0; height: 18px;
  padding: 0 3px; border: 1px solid var(--line); border-radius: 3px;
  background: var(--bg); color: var(--ink);
  font-family: var(--mono); font-size: 11px; line-height: 16px;
  text-align: right; font-variant-numeric: tabular-nums;
  appearance: textfield; -moz-appearance: textfield;
}
input.val::-webkit-outer-spin-button,
input.val::-webkit-inner-spin-button {
  appearance: none; -webkit-appearance: none; margin: 0;
}
input.val:focus { outline: none; border-color: var(--accent); }
details.adv { margin-top: 4px; color: var(--dim); font-size: 11px; }

.wave { padding: 0 16px 8px; }
.wave canvas { width: 100%; height: 52px; background: #08090c; border: 1px solid var(--line); border-radius: 4px; display: block; }

.grid-hero { padding: 0 16px 12px; }
.grid-bar {
  display: flex; flex-wrap: wrap; gap: 8px 10px; align-items: center;
  margin-bottom: 8px; padding: 8px 10px;
  background: var(--panel); border: 1px solid var(--line); border-radius: 6px;
}
.grid-bar h3 {
  margin: 0; font-size: 12px; letter-spacing: 0.16em; color: var(--accent);
}
.grid-bar select {
  background: var(--bg); border: 1px solid var(--line); border-radius: 4px;
  padding: 5px 8px; font-size: 12px;
}
.grid-bar .row.tight {
  grid-template-columns: auto 90px 36px; margin: 0; min-width: 160px;
}
.bar-gap { flex: 1; min-width: 8px; }
.progress { font-family: var(--mono); font-size: 11px; color: var(--accent); min-height: 14px; }

.fx-hero { padding: 0 16px 12px; }
.fx-head {
  display: flex; flex-wrap: wrap; gap: 8px 10px; align-items: baseline;
  margin-bottom: 8px;
}
.fx-head h3 {
  margin: 0; font-size: 12px; letter-spacing: 0.16em; color: var(--accent);
}
.fx-head .hint { font-size: 11px; color: var(--dim); }
.fx-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 8px;
}
.fx-pedal {
  background: var(--panel); border: 1px solid var(--line); border-radius: 6px;
  padding: 8px 10px; cursor: grab; user-select: none;
}
.fx-pedal.off { opacity: 0.45; }
.fx-pedal header { display: flex; align-items: center; gap: 6px; margin-bottom: 6px; }
.fx-pedal .name { font-size: 12px; font-weight: 650; }
.fx-pedal .ja { color: var(--accent); font-size: 11px; margin-left: 4px; }
.fx-pedal .tools { margin-left: auto; display: flex; gap: 4px; }
.fx-pedal header select {
  flex: 1; min-width: 0; width: auto; margin: 0;
  background: var(--bg); border: 1px solid var(--line); border-radius: 4px;
  padding: 3px 6px; font-size: 12px;
}
.fx-pedal .row {
  display: grid; grid-template-columns: 64px 1fr 44px; gap: 6px; align-items: center;
  width: 100%; min-width: 0; margin: 3px 0; flex: none;
}
.fx-pedal .row input[type="range"] { width: 100%; max-width: none; min-width: 0; }
.fx-pedal input.val { max-width: 44px; min-width: 0; cursor: text; }
.fx-pedal button, .fx-pedal input, .fx-pedal select { user-select: auto; }
.fx-pedal button, .fx-pedal input[type="range"], .fx-pedal select { cursor: pointer; }
.fx-pedal.dragging { opacity: 0.5; cursor: grabbing; }
.fx-pedal.drag-over { outline: 2px solid var(--accent); }

.grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 8px;
  min-height: 220px;
}
.grid-empty {
  grid-column: 1 / -1; display: flex; align-items: center; justify-content: center;
  min-height: 200px; border: 1px dashed var(--line); border-radius: 8px;
  color: var(--dim); font-size: 13px; text-align: center; padding: 24px;
}
.cell {
  background: var(--panel); border: 1px solid var(--line); border-radius: 6px; padding: 8px; cursor: pointer;
}
.cell:hover { border-color: var(--accent); }
.cell.selected { outline: 2px solid var(--accent); }
.cell canvas { width: 100%; height: 72px; display: block; background: #08090c; }
.cell .meta { display: flex; justify-content: space-between; font-size: 10px; color: var(--dim); margin-top: 6px; font-family: var(--mono); }

.settings {
  margin: 0 16px 16px; background: var(--panel); border: 1px solid var(--line); border-radius: 6px;
}
.settings summary {
  cursor: pointer; padding: 8px 12px; font-size: 11px; letter-spacing: 0.12em; color: var(--dim);
  list-style: none;
}
.settings summary::-webkit-details-marker { display: none; }
.settings summary::before { content: "▸ "; color: var(--accent); }
.settings[open] summary::before { content: "▾ "; }
.settings-body {
  display: grid; grid-template-columns: 1fr 220px; gap: 12px 20px;
  padding: 0 12px 12px;
}
@media (max-width: 800px) {
  .settings-body { grid-template-columns: 1fr; }
}
.master select {
  width: 100%; background: var(--bg); border: 1px solid var(--line); border-radius: 4px;
  padding: 5px; font-size: 12px; margin: 2px 0 6px;
}
.field { display: block; font-size: 10px; color: var(--dim); }
.check { display: flex; gap: 6px; align-items: center; font-size: 12px; margin: 6px 0; color: var(--dim); }
.export-row { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0; }
