:root {
  --bg: #14151a;
  --panel: #1e2028;
  --panel-hover: #262935;
  --line: #2a2c36;
  --text: #f2f2f5;
  --muted: #9a9cab;
  --accent: #ff5c8a;
  --accent-2: #7c5cff;
  --danger: #ff4d4d;
  --radius: 16px;
  --gradient: linear-gradient(135deg, var(--accent), var(--accent-2));
}

*, *::before, *::after { box-sizing: border-box; }

body {
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100dvh;
}

button { font: inherit; border: 0; cursor: pointer; color: inherit; }

.header,
.main {
  max-width: 1100px;
  margin-inline: auto;
  padding-inline: 16px;
}

.header {
  padding-block: 20px 12px;
  display: grid;
  gap: 14px;
}

.hero {
  position: relative;
  overflow: hidden;
  border-radius: var(--radius);
  background: var(--panel);
  min-height: 240px;
  display: flex;
  align-items: flex-end;

  /* Foto rechts, vloeit links over in de achtergrond zodat de titel leesbaar blijft. */
  &::after {
    content: "";
    position: absolute;
    inset: 0;
    background:
      linear-gradient(90deg, var(--panel) 50%, rgb(30 32 40 / 50%) 62%, rgb(30 32 40 / 0%) 78%),
      linear-gradient(0deg, rgb(20 21 26 / 60%), transparent 50%);
  }
}

.hero-photo {
  position: absolute;
  inset: 0 0 0 auto;
  width: 50%;
  height: 100%;
  object-fit: cover;
  object-position: 40% 35%;
}

.hero-text {
  position: relative;
  z-index: 1;
  padding: 24px;

  h1 { margin: 0; font-size: clamp(26px, 5vw, 40px); letter-spacing: -0.5px; line-height: 1.1; }
  h1 span { color: var(--accent); }
  p { margin: 6px 0 0; color: var(--muted); }
}

.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
}

.search {
  flex: 1 1 260px;
  position: relative;
  display: flex;

  input {
    flex: 1;
    min-width: 0;
    font: inherit;
    color: var(--text);
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 999px;
    padding: 10px 16px 10px 40px;
    outline: none;
    transition: border-color .15s;

    &::placeholder { color: var(--muted); }
    &:focus { border-color: var(--accent); }
  }
}

.search-icon {
  position: absolute;
  left: 14px;
  top: 50%;
  translate: 0 -50%;
  font-size: 14px;
  pointer-events: none;
}

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

.btn {
  background: var(--gradient);
  padding: 10px 18px;
  border-radius: 999px;
  font-weight: 600;

  &.secondary { background: var(--panel); }
  &:hover { filter: brightness(1.1); }
}

.volume { display: flex; align-items: center; gap: 6px; color: var(--muted); font-size: 14px; }

.main { padding-block: 8px 48px; }

.dropzone {
  border: 2px dashed #3a3d4a;
  border-radius: var(--radius);
  padding: 18px;
  text-align: center;
  color: var(--muted);
  margin-bottom: 20px;
  transition: border-color .15s, background .15s, color .15s;

  &.is-over {
    border-color: var(--accent);
    background: rgb(255 92 138 / 6%);
    color: var(--text);
  }
}

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

.card[hidden] { display: none; }

.empty {
  grid-column: 1 / -1;
  text-align: center;
  color: var(--muted);
  padding: 48px 0;
}

.card {
  background: var(--panel);
  border-radius: var(--radius);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  position: relative;

  cursor: grab;
  transition: opacity .15s, outline-color .15s;
  outline: 2px dashed transparent;
  outline-offset: 2px;

  &.is-dragging { opacity: .35; outline-color: var(--accent); cursor: grabbing; }
  &.is-playing .play { background: #2c2140; }
  &.is-playing .icon { animation: pulse .9s ease-in-out infinite; }
}

.key {
  position: absolute;
  top: 8px;
  left: 10px;
  font-size: 11px;
  color: var(--muted);
  border: 1px solid #3a3d4a;
  border-radius: 6px;
  padding: 1px 6px;
}

.play {
  background: var(--panel);
  aspect-ratio: 1.3;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px;
  transition: background .15s, transform .08s;

  &:hover { background: var(--panel-hover); }
  &:active { transform: scale(.97); }
}

.icon {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 22px;
  background: var(--gradient);
}

.name {
  font-weight: 600;
  text-align: center;
  overflow-wrap: anywhere;
  font-size: 15px;
}

.progress { height: 3px; background: var(--line); }
.progress-bar { height: 100%; width: 0; background: var(--accent); }

.tools {
  display: flex;
  border-top: 1px solid var(--line);

  button {
    flex: 1;
    background: transparent;
    padding: 9px 4px;
    font-size: 13px;
    color: var(--muted);

    &:hover { background: var(--panel-hover); color: var(--text); }
    & + button { border-left: 1px solid var(--line); }
  }

  .delete:hover { color: var(--danger); }
  .share:hover { color: #25d366; }
  .share-icon {
    width: 1em;
    height: 1em;
    vertical-align: -0.125em;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
  }
}

.card.is-highlighted {
  outline: 2px solid var(--accent);
  box-shadow: 0 0 0 6px rgb(255 92 138 / 20%);
}

.shared-banner {
  position: fixed;
  inset: auto 16px 16px;
  max-width: 520px;
  margin-inline: auto;
  display: flex;
  gap: 8px;
  padding: 8px;
  border-radius: 999px;
  background: var(--panel);
  box-shadow: 0 10px 30px rgb(0 0 0 / 50%);
  z-index: 10;

  &[hidden] { display: none; }

  .shared-play {
    flex: 1;
    min-width: 0;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 4px 12px 4px 4px;
    border-radius: 999px;
    background: var(--panel-hover);
    text-align: left;

    span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  }
  .icon { width: 44px; height: 44px; font-size: 18px; flex: none; }
  .shared-close { background: transparent; color: var(--muted); padding: 0 12px; }
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  translate: -50% 20px;
  max-width: calc(100% - 32px);
  padding: 10px 18px;
  border-radius: 999px;
  background: var(--text);
  color: var(--bg);
  font-weight: 600;
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s, translate .2s;
  z-index: 20;

  &.is-visible { opacity: 1; translate: -50% 0; }
}

@keyframes pulse {
  50% { transform: scale(1.12); }
}

/* ---------- Mobiel: twee kolommen ---------- */
@media (max-width: 600px) {
  .header { padding-top: 12px; }
  .hero { min-height: 230px; }
  .hero-photo { width: 100%; object-position: 40% 30%; }
  .hero::after {
    background: linear-gradient(0deg, var(--panel) 10%, rgb(30 32 40 / 50%) 45%, rgb(30 32 40 / 0%) 70%);
  }
  .hero-text { padding: 16px; }

  .search { flex-basis: 100%; }
  .actions { width: 100%; }
  .volume { flex: 1; }
  .volume input { flex: 1; min-width: 0; }
  .dropzone { display: none; }

  .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .play { aspect-ratio: 1.15; gap: 6px; padding: 10px 8px; }
  .icon { width: 44px; height: 44px; font-size: 18px; }
  .name { font-size: 14px; }
  .tools .label { display: none; }
}
