:root {
  --sidebar-w: 280px;
  --bg: #0f172a;
  --panel: #0b1220;
  --accent: #06b6d4;
  --muted: #9aa4b2;
  --card: #0f172a;
  --round: 12px;
  font-size: 16px;
}
* {
  box-sizing: border-box;
}
html,
body,
#app {
  height: 100%;
  margin: 0;
  font-family: Inter, ui-sans-serif, system-ui, Segoe UI, Roboto,
    "Helvetica Neue", Arial;
}
body {
  background: linear-gradient(180deg, #071020 0%, #071226 100%);
  color: #e6eef6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* layout mobile first */
#app {
  display: flex;
  flex-direction: column;
  padding: 12px;
  gap: 12px;
  height: 100vh;
}

#main {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 12px;
  order: 2;
}

.grid {
  flex: 1;
  display: grid;
  gap: 10px;
  border-radius: 14px;
  padding: 12px;
  grid-auto-rows: 1fr;
  height: 100vh;
  max-height: 100vh;
}

/* slots */
.slot {
  background: linear-gradient(
    180deg,
    rgba(255, 255, 255, 0.015),
    rgba(255, 255, 255, 0.01)
  );
  border-radius: 10px;
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  border: 1px solid rgba(255, 255, 255, 0.02);
}
.player-wrap {
  flex: 1;
  min-height: 150px;
  background: #000;
  display: flex;
  align-items: center;
  justify-content: center;
}
.controls {
  display: flex;
  gap: 6px;
  padding: 6px;
  align-items: center;
  border-top: 1px solid rgba(255, 255, 255, 0.02);
  background: rgba(0, 0, 0, 0.35);
}
.controls .slider {
  width: 100px;
}
.slot .label {
  position: absolute;
  left: 8px;
  top: 8px;
  background: rgba(0, 0, 0, 0.5);
  padding: 4px 8px;
  border-radius: 6px;
  font-size: 0.85rem;
}

/* empty placeholder */
.empty {
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  min-height: 120px;
}

/* bottom info */
.controls-bottom {
  padding: 8px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.02);
  text-align: center;
  font-size: 0.85rem;
  color: var(--muted);
}

/* sidebar */
#sidebar {
  width: 100%;
  background: linear-gradient(
    180deg,
    rgba(255, 255, 255, 0.02),
    rgba(255, 255, 255, 0.01)
  );
  border-radius: 14px;
  padding: 12px;
  display: flex;
  flex-direction: row;
  gap: 8px;
  overflow-x: auto;
  order: 1;
  flex-shrink: 0;
}

#sidebar header h1 {
  font-size: 1rem;
  margin: 0;
  color: var(--accent);
  flex-shrink: 0;
}

/* channel item */
.channel-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.02);
  min-width: 180px;
  flex-shrink: 0;
}
.channel-item.dragging {
  opacity: 0.6;
}

.thumb {
  width: 40px;
  height: 40px;
  border-radius: 6px;
  object-fit: cover;
  flex-shrink: 0;
}
.channel-info {
  flex: 1;
  min-width: 0;
}
.channel-info .name {
  font-size: 0.9rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.channel-info .meta {
  font-size: 0.75rem;
  color: var(--muted);
}
.item-actions {
  display: flex;
  gap: 4px;
}

.icon-btn {
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.03);
  padding: 4px;
  border-radius: 8px;
  color: inherit;
  cursor: pointer;
}
.icon-btn:hover {
  transform: translateY(-1px);
}

/* add button */
.add-btn {
  min-width: 44px;
  height: 44px;
  border-radius: 10px;
  font-size: 1.5rem;
  background: linear-gradient(90deg, var(--accent), #7ce4f0);
  color: #022;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  cursor: pointer;
}
.add-btn:hover {
  filter: brightness(0.95);
}

/* grid templates for mobile-first */
.grid.cols-1 {
  grid-template-columns: 1fr;
}
.grid.cols-2 {
  grid-template-columns: 1fr 1fr;
}
.grid.cols-3 {
  grid-template-columns: 1fr 1fr 1fr;
}
.grid.cols-4 {
  grid-template-columns: repeat(2, 1fr);
}
.grid.cols-5 {
  grid-template-columns: repeat(3, 1fr);
}
.grid.cols-6 {
  grid-template-columns: repeat(3, 1fr);
}

/* larger screens */
@media (min-width: 900px) {
  #app {
    flex-direction: row;
    padding: 18px;
    gap: 18px;
  }
  #sidebar {
    flex-direction: column;
    width: var(--sidebar-w);
    overflow-x: hidden;
  }
  #main {
    order: 2;
    flex: 1;
  }
  .channels-list {
    flex-direction: column;
    overflow: auto;
  }
  .channel-item {
    min-width: 0;
  }
}
