:root {
  --ink: #111214;
  --muted: #6b7280;
  --bg: #ffffff;
  --stroke: #e6e6ea;
  --accent: #ff3aa7;
  --accent-press: #e23193;
  --sun: #ffd84d;
  --radius: 16px;
  font-family: 'Work Sans', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg);
  color: var(--ink);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
}

.app {
  max-width: 1080px;
  margin: 0 auto;
  padding: 28px 22px 80px;
}

h1 {
  margin: 0;
  font-size: 28px;
  font-weight: 700;
  letter-spacing: 0.4px;
}

h3 {
  margin: 0 0 14px 0;
  font-size: 16px;
  font-weight: 700;
  letter-spacing: 0.3px;
}

.subtitle {
  margin: 4px 0 0 0;
  color: var(--muted);
  font-size: 14px;
}

label {
  display: block;
  color: var(--muted);
  font-size: 12px;
  margin-bottom: 6px;
}

.card {
  background: #fff;
  border: 1px solid var(--stroke);
  border-radius: var(--radius);
  padding: 18px 18px 16px;
  box-shadow: 0 6px 20px rgba(17, 18, 20, 0.06);
  margin: 20px 0;
}

.brand-header {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
}

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

.brand-mark {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-mark .sun {
  width: 6px;
  height: 48px;
  border-radius: 3px;
  background: var(--sun);
}

.brand-logo {
  width: 96px;
  height: 96px;
  object-fit: contain;
  border-radius: 12px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.08);
}

.brand-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

.btn {
  border: 2px solid var(--accent);
  background: transparent;
  color: var(--accent);
  border-radius: 999px;
  padding: 10px 14px;
  font-weight: 700;
  font-size: 15px;
  cursor: pointer;
  transition: 0.15s;
}

.btn:hover {
  background: var(--accent);
  color: #fff;
}

.btn:active {
  background: var(--accent-press);
  border-color: var(--accent-press);
  color: #fff;
}

.btn.muted {
  border-color: #d6d6db;
  color: #444;
}

.btn.muted:hover {
  background: #d6d6db;
  color: #111214;
}

.btn.warn {
  border-color: #ffb703;
  color: #aa6a00;
}

.btn.warn:hover {
  background: #ffb703;
  color: #312407;
}

input[type="range"],
input[type="number"],
input[type="text"],
select {
  border: 1px solid var(--stroke);
  border-radius: 12px;
  background: #fff;
  color: var(--ink);
  padding: 12px 14px;
  font-size: 15px;
  min-width: 160px;
  outline: none;
}

.zoom-icon {
  display: inline-flex;
  align-items: center;
  font-size: 18px;
  color: var(--ink);
  margin-bottom: 2px;
}

input[type="range"] {
  min-width: unset;
  width: 200px;
  padding: 0;
}

input:focus,
select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(255, 58, 167, 0.15);
}

.row {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  align-items: flex-end;
}

.pill.stat {
  border: 1px solid var(--stroke);
  border-radius: 999px;
  padding: 10px 14px;
  font-weight: 700;
  min-width: 120px;
  text-align: center;
}

.timeline-card .timeline-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 10px;
}

/* timeline-scroll enables its own vertical scrollbar for many clips */
.timeline-scroll {
  position: relative;
  overflow-x: auto;
  overflow-y: auto;
  border: 1px solid var(--stroke);
  border-radius: 12px;
  background: #fafafa;
  padding: 10px;
  max-height: 380px;
}

.timeline {
  position: relative;
  min-height: 220px;
}

.tracks {
  position: relative;
}


.timeline-lane {
  position: relative;
  height: 190px;
  margin-bottom: 14px;
  border-bottom: 1px solid var(--stroke);
}

.clip {
  position: absolute;
  top: 8px;
  height: 170px;
  background: rgba(255, 58, 167, 0.08);
  border: 1px solid var(--accent);
  border-radius: 14px;
  cursor: grab;
  transition: box-shadow 0.15s, transform 0.15s;
  overflow: hidden;
  padding: 0;
}

.clip:active { cursor: grabbing; }

.clip .waveform {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  background: #fff;
  border: none;
  pointer-events: none;
  z-index: 1;
}

.clip-overlay {
  position: absolute;
  inset: 0;
  z-index: 3;
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  background: transparent;
  pointer-events: none;
  color: var(--ink);
}

.clip-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 600;
  padding: 0;
  background: transparent;
  border: none;
  pointer-events: auto;
}

.clip-title {
  display: inline-flex;
  align-items: center;
  padding: 4px 8px;
  color: var(--ink);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  border: 1px solid rgba(255, 58, 167, 0.35);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.12);
}

.clip-controls {
  display: flex;
  flex-direction: column;
  gap: 6px;
  align-items: flex-start;
  width: fit-content;
  font-size: 13px;
  padding: 6px 8px;
  background: transparent;
  border: 1px solid rgba(255, 58, 167, 0.18);
  border-radius: 12px;
  box-shadow: none;
  pointer-events: auto;
  color: var(--ink);
}

.clip-controls label {
  margin-bottom: 3px;
  color: var(--ink);
}

.clip-controls .control {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

.clip-controls .gain-control {
  width: 100%;
}

.clip-controls .gain-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.clip-controls .gain-value {
  font-weight: 600;
  color: var(--ink);
  min-width: 48px;
  text-align: right;
}

.clip-fades {
  display: flex;
  gap: 8px;
  align-items: flex-start;
  width: auto;
}

.clip-fades .fade-control {
  flex: 0 0 88px;
  width: 88px;
}

.clip-fades .fade-control label {
  white-space: nowrap;
}

.clip-controls input[type="number"] {
  min-width: 0;
  width: 44px;
  padding: 8px 10px;
  color: var(--ink);
}

/* Drag bar for moving the entire clip */
.clip-drag-bar {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 14px;
  background: rgba(255, 58, 167, 0.18);
  border-bottom: 1px solid rgba(255, 58, 167, 0.35);
  z-index: 4;
  cursor: grab;
  pointer-events: auto;
}

.clip-drag-bar:active { cursor: grabbing; }

.playhead {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 2px;
  background: var(--ink);
  pointer-events: none;
  z-index: 2;
}

.playhead-handle {
  position: absolute;
  top: -14px;
  left: 50%;
  transform: translateX(-50%);
  width: 16px;
  height: 16px;
  background: #fff;
  border: 2px solid var(--ink);
  border-radius: 6px 6px 4px 4px;
  box-shadow: 0 2px 6px rgba(17, 18, 20, 0.12);
  pointer-events: auto;
}

.clip-handle {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 12px;
  background: linear-gradient(90deg, rgba(255,58,167,0.18), rgba(255,58,167,0.28));
  border: 1px solid rgba(255, 58, 167, 0.45);
  z-index: 4;
  cursor: ew-resize;
  pointer-events: auto;
}

.clip-handle.left { left: 0; border-radius: 0 6px 6px 0; }
.clip-handle.right { right: 0; border-radius: 6px 0 0 6px; }

.clip-handle::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 4px;
  height: 26px;
  background: rgba(17, 18, 20, 0.25);
  border-radius: 4px;
}

/* Remove default spinners from fade number inputs */
input[type="number"]::-webkit-inner-spin-button,
input[type="number"]::-webkit-outer-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

input[type="number"] {
  -moz-appearance: textfield;
}


@media (max-width: 720px) {
  .row {
    flex-direction: column;
    align-items: stretch;
  }

  input[type="range"] { width: 100%; }
  .brand-header { flex-direction: column; align-items: flex-start; }
  .brand-actions { width: 100%; }
  .btn { width: 100%; text-align: center; }
}

/* Scrollbar styling */
.timeline-scroll::-webkit-scrollbar { height: 8px; width: 8px; }
.timeline-scroll::-webkit-scrollbar-track { background: transparent; }
.timeline-scroll::-webkit-scrollbar-thumb {
  background: rgba(0,0,0,0.15);
  border-radius: 8px;
}
.timeline-scroll::-webkit-scrollbar-thumb:hover {
  background: rgba(0,0,0,0.25);
}