/* App layout: sidebar + views + feed + player bar (index.html) */

.app {
  display: grid;
  grid-template-columns: 232px 1fr;
  min-height: 100vh;
}

/* ---------- Sidebar ---------- */

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  padding: 20px 14px;
  border-right: 1px solid var(--border);
  background: var(--bg-raised);
}

.brand-block {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.brand-slogan {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-faint);
  padding-left: 46px;
}

.side-nav {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-top: 28px;
}

.side-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 14px;
  border-radius: var(--radius-sm);
  color: var(--text-dim);
  font-size: 0.95rem;
  font-weight: 600;
  text-align: left;
  transition: background 0.15s, color 0.15s;
}

.side-link:hover {
  background: var(--bg-hover);
  color: var(--text);
}

.side-link.is-active {
  background: rgba(255, 106, 0, 0.1);
  color: var(--accent-soft);
}

.side-foot {
  margin-top: auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.side-legal {
  color: var(--text-faint);
  font-size: 0.72rem;
  line-height: 1.6;
}

.side-auth {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 14px;
}

.side-auth-hint {
  font-size: 0.78rem;
  color: var(--text-dim);
  margin-bottom: 10px;
  text-align: center;
}

/* ---------- Main ---------- */

.app-main {
  min-width: 0;
  padding: 0 28px 140px;
}

.app-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 4px;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  background: rgba(10, 10, 15, 0.8);
  backdrop-filter: blur(12px);
  z-index: 20;
}

.view-title {
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.topbar-tag {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  color: var(--text-faint);
}

.topbar-tag:hover {
  color: var(--accent-soft);
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 16px;
}

/* ---------- Auth modal ---------- */

.modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(5, 5, 8, 0.7);
  backdrop-filter: blur(6px);
}

.modal-card {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 400px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 34px 30px;
  animation: modal-in 0.18s ease-out;
}

@keyframes modal-in {
  from { opacity: 0; transform: translateY(10px) scale(0.98); }
  to { opacity: 1; transform: none; }
}

.modal-close {
  position: absolute;
  top: 14px;
  right: 16px;
  font-size: 1.4rem;
  color: var(--text-faint);
  line-height: 1;
}

.modal-close:hover {
  color: var(--text);
}

.view {
  padding-top: 26px;
}

/* ---------- Create ---------- */

.create-head {
  margin-bottom: 22px;
}

.create-title {
  font-size: clamp(1.8rem, 4vw, 2.6rem);
  font-weight: 700;
  letter-spacing: -0.03em;
  background: linear-gradient(180deg, #fff 30%, #b9b9c9 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.create-sub {
  color: var(--text-dim);
  margin-top: 6px;
}

.create-panel {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
}

.field-label {
  display: block;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-dim);
  margin: 14px 0 8px;
}

.field-label:first-child {
  margin-top: 0;
}

.field-hint {
  text-transform: none;
  letter-spacing: 0;
  color: var(--text-faint);
  font-weight: 400;
}

.field {
  width: 100%;
  padding: 12px 14px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  background: var(--bg-raised);
  font-family: var(--font);
  font-size: 0.95rem;
  resize: vertical;
  outline: none;
  transition: border-color 0.15s;
}

.field:focus {
  border-color: var(--accent);
}

.field-lyrics {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  line-height: 1.6;
}

.template-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 10px;
  margin-bottom: 14px;
}

.template-card {
  padding: 13px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--bg-raised);
  color: var(--text);
  text-align: left;
  cursor: pointer;
  transition: border-color 0.15s, transform 0.15s;
}

.template-card:hover {
  border-color: var(--accent);
  transform: translateY(-1px);
}

.template-card.is-selected {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px var(--accent);
}

.template-card strong {
  display: block;
  font-size: 0.9rem;
  margin-bottom: 5px;
}

.template-card span,
.template-card small {
  display: block;
  color: var(--text-dim);
  font-size: 0.74rem;
  line-height: 1.45;
}

.template-card .template-meta {
  color: var(--accent-soft);
  font-family: var(--font-mono);
  font-size: 0.68rem;
  letter-spacing: 0.04em;
  margin-top: 7px;
  text-transform: uppercase;
}

.create-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-top: 16px;
  flex-wrap: wrap;
}

.studio-chips {
  justify-content: flex-start;
  margin: 0;
}

.model-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.model-row .field-label {
  margin: 0;
}

.model-pick {
  width: auto;
  padding: 8px 14px;
  font-size: 0.85rem;
  border-radius: 999px;
}

.form-status {
  min-height: 20px;
  margin-top: 12px;
  font-size: 0.85rem;
  color: var(--accent-soft);
}

.form-status.is-error {
  color: #ff5c5c;
}

/* ---------- Trace panel ---------- */

.trace-panel {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 18px 20px;
  margin: 18px 0;
}

.trace-title {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--accent-soft);
  margin-bottom: 12px;
}

.trace-list {
  list-style: none;
  font-family: var(--font-mono);
  font-size: 0.82rem;
}

.trace-list li {
  padding: 5px 0;
  color: var(--text-faint);
  transition: color 0.2s;
}

.trace-list li::before {
  content: "○ ";
  color: var(--text-faint);
}

.trace-list li.active {
  color: var(--text);
}

.trace-list li.active::before {
  content: "◌ ";
  color: var(--accent);
  animation: spin 1s linear infinite;
  display: inline-block;
}

.trace-list li.done {
  color: var(--text-dim);
}

.trace-list li.done::before {
  content: "● ";
  color: var(--accent);
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ---------- Feed / song rows ---------- */

.feed-head {
  margin: 30px 0 14px;
}

.feed-head h3 {
  font-size: 1.05rem;
  font-weight: 700;
}

.song-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.song-row {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 10px 14px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  transition: background 0.15s, border-color 0.15s;
}

.song-row:hover,
.song-row.is-playing {
  background: var(--bg-hover);
  border-color: var(--text-faint);
}

.song-row.is-playing {
  border-color: var(--accent);
}

.row-play {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: var(--bg-raised);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: all 0.15s;
}

.row-play:hover {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.row-cover {
  width: 46px;
  height: 46px;
  border-radius: var(--radius-sm);
  flex-shrink: 0;
}

.row-info {
  flex: 1;
  min-width: 0;
}

.row-title {
  font-weight: 600;
  font-size: 0.95rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.row-meta {
  color: var(--text-faint);
  font-size: 0.8rem;
  font-family: var(--font-mono);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.row-dl {
  padding: 7px 14px;
  font-size: 0.8rem;
}

/* ---------- Empty state ---------- */

.output-empty {
  border: 1px dashed var(--border);
  border-radius: var(--radius-lg);
  padding: 60px 30px;
  text-align: center;
  color: var(--text-dim);
}

.output-logo {
  margin: 0 auto 18px;
  opacity: 0.7;
}

.output-empty h2 {
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 8px;
}

/* ---------- Mixer ---------- */

.mixer-transport {
  display: flex;
  align-items: center;
  gap: 16px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 14px 18px;
  margin-bottom: 18px;
}

.mx-master {
  display: flex;
  align-items: center;
  gap: 10px;
}

.mx-master .field-label {
  margin: 0;
}

#mxExport {
  margin-left: auto;
}

.mixer-tracks {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.mx-track {
  display: flex;
  flex-direction: column;
  gap: 10px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 12px 14px;
}

.mx-main {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.mx-sub {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
  padding: 10px 12px;
  background: var(--bg-raised);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
}

.mx-wave {
  width: 140px;
  height: 30px;
  border-radius: 4px;
  background: var(--bg-raised);
  border: 1px solid var(--border);
  flex-shrink: 0;
}

.mx-tempo-val {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--accent-soft);
  min-width: 30px;
}

.mx-meter {
  width: 70px;
  height: 8px;
  border-radius: 4px;
  background: var(--bg-raised);
  border: 1px solid var(--border);
  overflow: hidden;
}

.mx-meter i {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, var(--accent), #ff3d77);
  transform-origin: left;
  transform: scaleX(0);
  transition: transform 0.06s linear;
}

.mx-name {
  font-weight: 600;
  font-size: 0.92rem;
  min-width: 90px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.mx-flag {
  width: 30px;
  height: 30px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--bg-raised);
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--text-dim);
  transition: all 0.15s;
}

.mx-flag:hover {
  color: var(--text);
  border-color: var(--text-faint);
}

.mx-flag.on {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.mx-ctl {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-mono);
  font-size: 0.68rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-faint);
}

.mx-ctl input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  width: 80px;
  height: 4px;
  border-radius: 2px;
  background: var(--border);
  outline: none;
  cursor: pointer;
}

.mx-ctl input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--accent);
}

.mx-fx {
  width: auto;
  padding: 7px 10px;
  font-size: 0.8rem;
}

.mx-rm {
  margin-left: auto;
  font-size: 1.2rem;
  color: var(--text-faint);
  line-height: 1;
  padding: 4px 8px;
}

.mx-rm:hover {
  color: #ff5c5c;
}

.mixer-add {
  margin-top: 22px;
}

.mx-add-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.mx-add-groups {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.mx-add-group {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.mx-group-label {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-faint);
  width: 70px;
  flex-shrink: 0;
}

.chip-sm {
  padding: 5px 12px;
  font-size: 0.76rem;
}

/* ---------- Timeline ---------- */

.timeline {
  position: relative;
  margin: 22px 0;
  padding: 14px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  overflow-x: auto;
}

.tl-ruler {
  position: relative;
  height: 18px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 6px;
  flex-shrink: 0;
}

.tl-spacer {
  display: inline-block;
  width: 110px;
}

.tl-mark {
  position: absolute;
  top: 1px;
  font-family: var(--font-mono);
  font-size: 0.6rem;
  color: var(--text-faint);
}

.tl-lane {
  display: flex;
  align-items: stretch;
  height: 42px;
  border-bottom: 1px solid var(--border);
}

.tl-lane:last-child {
  border-bottom: none;
}

.tl-lane-name {
  width: 110px;
  flex-shrink: 0;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--text-dim);
  display: flex;
  align-items: center;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  padding-right: 8px;
}

.tl-lane-grid {
  position: relative;
  flex-shrink: 0;
  background: repeating-linear-gradient(
    90deg, var(--border) 0 1px, transparent 1px 40px);
}

.tl-clip {
  position: absolute;
  top: 5px;
  bottom: 5px;
  display: flex;
  align-items: center;
  background: linear-gradient(135deg, rgba(255, 106, 0, 0.35), rgba(139, 92, 246, 0.3));
  border: 1px solid var(--accent);
  border-radius: 6px;
  cursor: grab;
  overflow: hidden;
  min-width: 8px;
}

.tl-clip.dragging {
  cursor: grabbing;
  opacity: 0.85;
  z-index: 2;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.5);
}

.tl-clip-label {
  font-family: var(--font-mono);
  font-size: 0.6rem;
  color: var(--text-dim);
  padding: 0 6px;
  pointer-events: none;
  overflow: hidden;
  white-space: nowrap;
}

.tl-handle {
  position: absolute;
  right: 0;
  top: 0;
  bottom: 0;
  width: 8px;
  cursor: ew-resize;
  background: rgba(255, 106, 0, 0.45);
}

.tl-playhead {
  position: absolute;
  top: 52px;
  bottom: 12px;
  width: 2px;
  background: var(--accent);
  box-shadow: 0 0 8px var(--accent-glow);
  opacity: 0;
  pointer-events: none;
  z-index: 3;
}

.mx-pick {
  width: auto;
  padding: 8px 12px;
  font-size: 0.85rem;
  border-radius: 999px;
}

.mx-upload {
  cursor: pointer;
  display: inline-flex;
  align-items: center;
}

/* ---------- Track grid (explore) ---------- */

.track-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 16px;
}

/* ---------- Player bar ---------- */

.playerbar {
  position: fixed;
  inset: auto 0 0 0;
  z-index: 60;
  display: grid;
  grid-template-columns: 1fr 2fr 1fr;
  align-items: center;
  gap: 20px;
  padding: 12px 22px;
  background: rgba(18, 18, 26, 0.92);
  backdrop-filter: blur(16px);
  border-top: 1px solid var(--border);
}

.pb-track {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.pb-cover {
  width: 46px;
  height: 46px;
  border-radius: var(--radius-sm);
  flex-shrink: 0;
}

.pb-info {
  min-width: 0;
}

.pb-title {
  font-weight: 600;
  font-size: 0.92rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pb-meta {
  color: var(--text-faint);
  font-size: 0.76rem;
  font-family: var(--font-mono);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pb-center {
  display: flex;
  align-items: center;
  gap: 14px;
}

.pb-btn {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background 0.15s, transform 0.12s;
}

.pb-btn:hover {
  background: var(--accent-soft);
}

.pb-btn:active {
  transform: scale(0.94);
}

.pb-progress {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 10px;
}

.pb-time {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--text-faint);
  min-width: 34px;
}

.pb-seek,
.pb-vol {
  -webkit-appearance: none;
  appearance: none;
  height: 4px;
  border-radius: 2px;
  background: var(--border);
  outline: none;
  cursor: pointer;
}

.pb-seek {
  flex: 1;
}

.pb-vol {
  width: 90px;
  justify-self: end;
}

.pb-seek::-webkit-slider-thumb,
.pb-vol::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--accent);
}

/* ---------- Responsive ---------- */

@media (max-width: 860px) {
  .app {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
    height: auto;
    flex-direction: row;
    align-items: center;
    flex-wrap: wrap;
    border-right: none;
    border-bottom: 1px solid var(--border);
    padding: 12px 14px;
  }

  .side-nav {
    flex-direction: row;
    margin-top: 0;
    margin-left: auto;
  }

  .side-foot {
    display: none;
  }

  .app-main {
    padding: 0 16px 130px;
  }

  .playerbar {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .pb-vol {
    display: none;
  }
}

/* ---------- context menu ---------- */

.ctx-menu {
  position: fixed;
  z-index: 300;
  min-width: 170px;
  padding: 5px;
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: 0 10px 34px rgba(0, 0, 0, 0.55);
  animation: ctx-in 0.1s ease;
}

@keyframes ctx-in {
  from { opacity: 0; transform: scale(0.96); }
  to { opacity: 1; transform: scale(1); }
}

.ctx-item {
  position: relative;
  display: block;
  width: 100%;
  padding: 7px 12px;
  border: none;
  border-radius: var(--radius-sm);
  background: none;
  color: var(--text);
  font-family: var(--font);
  font-size: 0.82rem;
  text-align: left;
  cursor: pointer;
  white-space: nowrap;
}

.ctx-item:hover {
  background: var(--bg-hover);
}

.ctx-item.danger {
  color: #ff7a7a;
}

.ctx-item.disabled {
  color: var(--text-faint);
  cursor: default;
}

.ctx-item.disabled:hover {
  background: none;
}

.ctx-item.has-sub > span::after {
  content: "";
}

.ctx-sep {
  height: 1px;
  margin: 4px 8px;
  background: var(--border);
}

.ctx-sub {
  display: none;
  position: absolute;
  left: 100%;
  top: -6px;
  min-width: 140px;
  padding: 5px;
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: 0 10px 34px rgba(0, 0, 0, 0.55);
}

.ctx-item.has-sub:hover > .ctx-sub {
  display: block;
}

.ctx-menu.flip .ctx-sub {
  left: auto;
  right: 100%;
}

/* ---------- preview buttons ---------- */

.mx-item {
  display: inline-flex;
  align-items: center;
  gap: 3px;
}

.mx-prev {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 50%;
  background: var(--bg-card);
  color: var(--text-dim);
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s;
}

.mx-prev:hover {
  color: var(--accent);
  border-color: var(--accent);
}

.mx-prev.playing {
  color: var(--accent);
  border-color: var(--accent);
  box-shadow: 0 0 8px var(--accent-glow);
}

/* ---------- studio tools row ---------- */

.mixer-tools {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 8px 14px;
  margin: -8px 0 18px;
}

.mixer-tools .btn-ghost {
  padding: 5px 11px;
  font-size: 0.78rem;
}

.mixer-tools .btn-ghost.on {
  color: var(--accent);
  border-color: var(--accent);
  box-shadow: 0 0 8px var(--accent-glow);
}

.mixer-tools .btn-ghost:disabled {
  opacity: 0.35;
  cursor: default;
}

#mxRec.on {
  color: #ff5555;
  border-color: #ff5555;
  animation: rec-blink 1s ease infinite;
}

@keyframes rec-blink {
  50% { opacity: 0.45; }
}

.mx-sep {
  width: 1px;
  height: 20px;
  background: var(--border);
}

.mx-zoom-label {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  color: var(--text-faint);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.mx-status {
  margin-left: auto;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--text-dim);
}

.mixer-tools .mx-ctl input[type="range"] {
  width: 64px;
}

/* ---------- timeline extras ---------- */

.tl-ruler {
  cursor: pointer;
}

.tl-handle-l {
  right: auto;
  left: 0;
}

.tl-clip.selected {
  border-color: #fff;
  box-shadow: 0 0 0 1px #fff, 0 0 12px var(--accent-glow);
  z-index: 2;
}

/* ---------- spectrum analyzer ---------- */

.mx-spectrum {
  width: 140px;
  height: 30px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg);
}

/* ---------- lane colors ---------- */

.tl-dot {
  display: inline-block;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  margin-right: 7px;
  flex-shrink: 0;
}

/* ---------- DJ Nova agent ---------- */

.dj-agent {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  margin-bottom: 18px;
  overflow: hidden;
}

.dj-head {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 10px 14px;
  border: none;
  background: none;
  color: var(--text);
  font-family: var(--font);
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  text-align: left;
}

.dj-head:hover {
  background: var(--bg-hover);
}

.dj-avatar {
  width: 26px;
  height: 26px;
}

.dj-sub {
  font-family: var(--font-mono);
  font-size: 0.66rem;
  font-weight: 400;
  color: var(--text-faint);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-left: 8px;
}

.dj-chev {
  margin-left: auto;
  color: var(--text-faint);
}

.dj-body {
  border-top: 1px solid var(--border);
  padding: 12px 14px;
}

.dj-log {
  max-height: 220px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 12px;
}

.dj-msg {
  max-width: 85%;
  padding: 8px 12px;
  border-radius: 12px;
  font-size: 0.8rem;
  line-height: 1.45;
  white-space: pre-wrap;
}

.dj-nova {
  align-self: flex-start;
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-left: 2px solid var(--accent);
}

.dj-user {
  align-self: flex-end;
  background: var(--accent-soft);
  color: var(--text);
}

.dj-quick {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 10px;
}

.dj-form {
  display: flex;
  gap: 8px;
}

.dj-form .field {
  flex: 1;
  padding: 8px 12px;
  font-size: 0.82rem;
}

/* ---------- beat grid / ruler ticks ---------- */

.tl-tick {
  position: absolute;
  top: 10px;
  width: 1px;
  height: 8px;
  background: var(--border);
}

/* ---------- loop region ---------- */

.tl-region {
  position: absolute;
  top: 26px;
  bottom: 10px;
  background: rgba(255, 138, 61, 0.1);
  border-left: 1px solid var(--accent);
  border-right: 1px solid var(--accent);
  pointer-events: none;
  z-index: 2;
}

/* ---------- beat maker ---------- */

.beatmaker {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 14px 18px;
  margin-top: 18px;
}

.bm-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.bm-head .field-label {
  margin: 0;
}

.bm-actions {
  display: flex;
  gap: 8px;
}

.bm-grid {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.bm-row {
  display: flex;
  align-items: center;
  gap: 4px;
}

.bm-label {
  width: 52px;
  flex-shrink: 0;
  font-family: var(--font-mono);
  font-size: 0.66rem;
  color: var(--text-faint);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.bm-step {
  width: 22px;
  height: 22px;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--bg);
  cursor: pointer;
  padding: 0;
  transition: background 0.1s, border-color 0.1s;
}

.bm-step.beat {
  border-color: rgba(255, 255, 255, 0.18);
}

.bm-step:hover {
  border-color: var(--accent);
}

.bm-step.on {
  background: var(--accent);
  border-color: var(--accent);
  box-shadow: 0 0 8px var(--accent-glow);
}

.bm-pads {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 10px;
}

.bm-pad {
  padding: 14px 18px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-raised);
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 0.72rem;
  cursor: pointer;
  transition: transform 0.08s, border-color 0.1s;
}

.bm-pad:hover {
  border-color: var(--accent);
}

.bm-pad.hit {
  transform: scale(0.94);
  border-color: var(--accent);
  background: var(--accent-soft);
}

/* ---------- clip waveforms / lane drop / dB ---------- */

.tl-clip-wave {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.tl-lane.drop-target {
  background: rgba(255, 138, 61, 0.07);
  outline: 1px dashed var(--accent);
  outline-offset: -1px;
}

.mx-db {
  font-family: var(--font-mono);
  font-size: 0.66rem;
  color: var(--text-faint);
  min-width: 52px;
  text-align: right;
}

.mx-db.hot {
  color: #ff5555;
}

.bm-actions .mx-ctl {
  display: flex;
  align-items: center;
  gap: 8px;
}

.bm-actions .mx-ctl span {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  color: var(--text-faint);
  text-transform: uppercase;
}

.bm-actions .mx-ctl input[type="range"] {
  width: 80px;
}

/* ---------- cue points ---------- */

.tl-cue {
  position: absolute;
  top: 1px;
  padding: 0 3px;
  font-family: var(--font-mono);
  font-size: 0.58rem;
  font-weight: 600;
  color: #0a0e14;
  background: var(--accent);
  border-radius: 0 0 4px 4px;
  cursor: pointer;
  z-index: 4;
  transform: translateX(-1px);
}

.tl-cue:hover {
  filter: brightness(1.2);
}

/* ---------- drag-to-timeline ---------- */

.timeline.drag-hover {
  outline: 2px dashed var(--accent);
  outline-offset: -2px;
  border-radius: 10px;
}

.chip[draggable="true"] {
  cursor: grab;
}

.chip[draggable="true"]:active {
  cursor: grabbing;
}

/* ---------- movable panels ---------- */

.panel-wrap {
  position: relative;
  display: flow-root;
}

.panel-grip {
  position: absolute;
  top: -9px;
  right: 16px;
  z-index: 8;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 15px;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg-card);
  color: var(--text-faint);
  font-size: 8px;
  letter-spacing: 2px;
  cursor: grab;
  opacity: 0;
  transition: opacity 0.15s;
}

.panel-wrap:hover .panel-grip,
.panel-wrap.floating .panel-grip {
  opacity: 1;
}

.panel-grip:hover {
  color: var(--accent);
  border-color: var(--accent);
}

.panel-grip:active {
  cursor: grabbing;
}

.panel-wrap.floating {
  padding: 10px;
  background: rgba(18, 18, 26, 0.96);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.6), 0 0 0 1px rgba(255, 106, 0, 0.15);
  backdrop-filter: blur(8px);
}

.panel-wrap.floating .panel-grip {
  top: 4px;
  right: 10px;
}

/* ---------- snap-grid overlay ---------- */

.snap-overlay {
  position: fixed;
  inset: 0;
  z-index: 590;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.15s;
  background-image:
    repeating-linear-gradient(90deg, rgba(255, 106, 0, 0.07) 0 1px, transparent 1px 80px),
    repeating-linear-gradient(0deg, rgba(255, 106, 0, 0.07) 0 1px, transparent 1px 80px);
}

.snap-overlay.show {
  opacity: 1;
}

.snap-ghost {
  position: fixed;
  z-index: 591;
  pointer-events: none;
  border: 1.5px dashed var(--accent);
  border-radius: 12px;
  background: rgba(255, 106, 0, 0.08);
  display: none;
}

.snap-ghost.show {
  display: block;
}

.snap-ghost.slot {
  border: none;
  border-radius: 2px;
  background: var(--accent);
  box-shadow: 0 0 12px var(--accent-glow);
}

/* ---------- floating panel chrome ---------- */

.pw-bar {
  display: none;
}

.panel-wrap.floating .pw-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin: -4px -4px 8px;
  padding: 4px 6px 6px;
  border-bottom: 1px solid var(--border);
  cursor: grab;
  user-select: none;
}

.panel-wrap.floating .pw-bar:active {
  cursor: grabbing;
}

.pw-name {
  font-family: var(--font-mono);
  font-size: 0.62rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-faint);
}

.pw-btns {
  display: flex;
  gap: 4px;
}

.pw-btn {
  width: 18px;
  height: 18px;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 5px;
  background: var(--bg-hover);
  color: var(--text-dim);
  font-size: 10px;
  line-height: 1;
  cursor: pointer;
}

.pw-btn:hover {
  color: var(--accent);
  border-color: var(--accent);
}

.pw-resize {
  position: absolute;
  right: 2px;
  bottom: 2px;
  width: 14px;
  height: 14px;
  cursor: nwse-resize;
  display: none;
  background: linear-gradient(135deg, transparent 50%, var(--text-faint) 50%);
  border-radius: 0 0 4px 0;
  opacity: 0.6;
}

.panel-wrap.floating .pw-resize {
  display: block;
}

.panel-wrap.floating {
  overflow: auto;
}

.panel-wrap.collapsed > *:not(.pw-bar):not(.panel-grip) {
  display: none;
}

.panel-wrap.collapsed {
  height: auto !important;
}

.panel-wrap.floating .panel-grip {
  display: none; /* title bar takes over as the drag handle */
}
