* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  background: #1a1a2e;
  color: #eee;
  font-family: 'Segoe UI', sans-serif;
  font-size: 13px;
  display: flex;
  flex-direction: column;
  align-items: center;
  min-height: 100vh;
  padding: 12px;
  gap: 0;
}

/* ── Transport ── */
#transport {
  width: 640px;
  height: 40px;
  background: #16213e;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 10px;
  border-radius: 6px 6px 0 0;
  border-bottom: 1px solid #0f3460;
}

#transport label {
  color: #aaa;
  white-space: nowrap;
}

#tempo-input {
  width: 56px;
  text-align: center;
}

#status-msg {
  font-size: 11px;
  color: #ff9900;
  margin-left: 8px;
  flex: 1;
}

#btn-lang {
  margin-left: auto;
  font-size: 11px;
  padding: 3px 8px;
}

#title-input {
  flex: 1;
  min-width: 60px;
  max-width: 160px;
  background: #0a2040;
  color: #eeeeff;
  border: 1px solid #1a4a8a;
  border-radius: 4px;
  padding: 3px 7px;
  font-size: 12px;
}

#title-input::placeholder {
  color: #556;
}

/* ── Canvas ── */
#canvas-container {
  border-left: 2px solid #0f3460;
  border-right: 2px solid #0f3460;
  line-height: 0;
}

#canvas-container.drag-over {
  outline: 3px solid rgba(80, 180, 255, 0.85);
  outline-offset: -3px;
}

canvas {
  display: block;
  cursor: crosshair;
}

/* ── Scale controls ── */
#scale-controls {
  width: 640px;
  height: 40px;
  background: #16213e;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 10px;
  border-top: 1px solid #0f3460;
}

#scale-controls label {
  color: #aaa;
  white-space: nowrap;
}

/* ── Palette area ── */
#palette-area {
  width: 640px;
  min-height: 60px;
  background: #16213e;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  flex-wrap: wrap;
  border-top: 1px solid #0f3460;
}

#color-palette {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
}

.palette-color {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 3px solid transparent;
  cursor: pointer;
  transition: border-color 0.1s, opacity 0.1s;
  flex-shrink: 0;
}

.palette-color:hover {
  border-color: rgba(255,255,255,0.5);
}

.palette-color.selected {
  border-color: #ffffff;
}

.palette-color.disabled {
  opacity: 0.25;
  cursor: not-allowed;
}

.palette-color.disabled:hover {
  border-color: transparent;
}

/* ── Tool panel ── */
#tool-panel {
  display: flex;
  gap: 4px;
  margin-left: auto;
  align-items: center;
  flex-wrap: wrap;
}

.tool-btn {
  padding: 5px 9px;
  background: #0f3460;
  color: #ddd;
  border: 2px solid transparent;
  border-radius: 4px;
  cursor: pointer;
  font-size: 14px;
  transition: background 0.1s;
}

.tool-btn:hover {
  background: #1a4a8a;
}

.tool-btn.selected {
  border-color: #ffffff;
  background: #1a4a8a;
}

/* ── Octave buttons ── */
.oct-btn {
  padding: 4px 7px;
  background: #0f3460;
  color: #888;
  border: 2px solid transparent;
  border-radius: 4px;
  cursor: pointer;
  font-size: 12px;
  font-weight: bold;
  transition: background 0.1s, color 0.1s;
}

.oct-btn:hover {
  background: #1a4a8a;
  color: #ccc;
}

.oct-btn.selected {
  border-color: #ffffff;
  background: #1a4a8a;
  color: #ffffff;
}

/* ── Bugz panel ── */
#bugz-panel {
  width: 640px;
  background: #16213e;
  padding: 8px;
  border-radius: 0 0 6px 6px;
  display: flex;
  gap: 8px;
  border-top: 1px solid #0f3460;
}

.bugz-card {
  flex: 1;
  background: #0f3460;
  border-radius: 6px;
  padding: 8px 6px 6px;
  display: flex;
  flex-direction: column;
  gap: 5px;
  border-top: 3px solid transparent;
  cursor: pointer;
  outline: 2px solid transparent;
  transition: outline-color 0.1s;
}

.bugz-card.selected {
  outline-color: rgba(255, 255, 255, 0.55);
}

.bugz-card .bugz-name-row {
  display: flex;
  align-items: center;
  gap: 5px;
  font-weight: bold;
  font-size: 11px;
}

.bugz-card .field-row {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.bugz-card .field-row label {
  font-size: 10px;
  color: #aaa;
}

/* ── Common form controls ── */
button {
  padding: 5px 10px;
  background: #0f3460;
  color: #eee;
  border: 1px solid #1a4a8a;
  border-radius: 4px;
  cursor: pointer;
  font-size: 12px;
  transition: background 0.1s;
}

button:hover {
  background: #1a4a8a;
}

button:active {
  background: #0a2840;
}

select,
input[type="number"],
input[type="range"] {
  background: #0a2040;
  color: #eee;
  border: 1px solid #1a4a8a;
  border-radius: 4px;
  padding: 3px 5px;
  font-size: 12px;
  width: 100%;
}

input[type="range"] {
  padding: 0;
  cursor: pointer;
}

input[type="number"] {
  width: 56px;
}

/* ── Tone config inline panel ── */
#tone-config {
  display: none;
  align-items: center;
  gap: 4px;
}

#tone-config select {
  width: auto;
  padding: 3px 5px;
}
