/* Donker als een zaal, met één verlichte titelstrook zoals in een oude jukebox. */
:root {
  color-scheme: dark;
  --ink: #0c1428;
  --panel: #131d36;
  --raised: #1d2a4c;
  --line: #2b3961;
  --text: #edf0f8;
  --text-soft: #a7b4cf;
  --strip: #f5e8c8;
  --strip-ink: #1c1a2c;
  --strip-rule: #bd3428;
  --glow: #ffb13d;
  --glow-ink: #2a1a00;
  --font: Bahnschrift, "DIN Alternate", "Roboto Condensed", "Arial Narrow", "Segoe UI", system-ui, sans-serif;
  --row-height: 64px;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html,
body {
  height: 100%;
}

body {
  margin: 0;
  background: var(--ink);
  color: var(--text);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.35;
  -webkit-text-size-adjust: 100%;
}

button,
input {
  font: inherit;
  color: inherit;
}

button {
  cursor: pointer;
}

:focus-visible {
  outline: 2px solid var(--glow);
  outline-offset: 2px;
}

.icon {
  width: 24px;
  height: 24px;
  fill: currentColor;
  flex: none;
}

.icon-button {
  display: inline-grid;
  place-items: center;
  width: 44px;
  height: 44px;
  flex: none;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--text);
}

.icon-button:hover {
  background: var(--raised);
}

.text-button {
  min-height: 44px;
  padding: 0 20px;
  border: 0;
  border-radius: 6px;
  background: var(--glow);
  color: var(--glow-ink);
  font-weight: 600;
}

/* De titelstrook: het enige lichte vlak op de pagina. */
.strip {
  background: var(--strip);
  color: var(--strip-ink);
  border-top: 3px solid var(--strip-rule);
  border-bottom: 3px solid var(--strip-rule);
}

.cover {
  display: grid;
  place-items: center;
  overflow: hidden;
  flex: none;
  width: 44px;
  height: 44px;
  border-radius: 3px;
  background: var(--raised);
  color: var(--text-soft);
  font-weight: 600;
  font-size: 1.1rem;
}

.cover img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* Indeling */
.app {
  display: grid;
  height: 100vh;
  height: 100dvh;
  grid-template-columns: minmax(340px, 30%) minmax(0, 1fr);
  grid-template-rows: auto minmax(0, 1fr) auto;
  grid-template-areas:
    "top stage"
    "list stage"
    "bar bar";
}

.top {
  grid-area: top;
  padding: 12px 16px;
  background: var(--panel);
}

.top-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}

.brand {
  margin: 0;
  font-size: 1.5rem;
  font-weight: 700;
  font-stretch: 85%;
}

.count {
  flex: 1;
  margin: 0;
  color: var(--text-soft);
  font-size: 0.875rem;
  white-space: nowrap;
}

.search {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 44px;
  padding: 0 12px;
  border-radius: 6px;
  background: var(--raised);
  color: var(--text-soft);
}

.search:focus-within {
  outline: 2px solid var(--glow);
  outline-offset: 2px;
}

.search input {
  flex: 1;
  min-width: 0;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--text);
  font-size: 1rem;
}

.search input::placeholder {
  color: var(--text-soft);
}

.menu {
  position: fixed;
  inset: 60px auto auto 16px;
  min-width: 200px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--raised);
  color: var(--text);
}

.menu button {
  display: block;
  width: 100%;
  min-height: 44px;
  padding: 0 12px;
  border: 0;
  border-radius: 4px;
  background: transparent;
  text-align: left;
}

.menu button:hover {
  background: var(--line);
}

/* Lijst */
.list {
  grid-area: list;
  position: relative;
  overflow-y: auto;
  background: var(--panel);
  overscroll-behavior: contain;
}

.list-spacer {
  position: relative;
}

.list-empty {
  margin: 0;
  padding: 24px 16px;
  color: var(--text-soft);
  overflow-wrap: anywhere;
}

.row {
  position: absolute;
  inset: 0 0 auto;
  display: flex;
  align-items: center;
  height: var(--row-height);
  padding-right: 8px;
}

.row-main {
  display: flex;
  flex: 1;
  align-items: center;
  gap: 12px;
  min-width: 0;
  height: 100%;
  padding: 0 8px 0 16px;
  border: 0;
  background: transparent;
  text-align: left;
}

.row:hover {
  background: var(--raised);
}

.row-text {
  display: grid;
  flex: 1;
  min-width: 0;
}

.row-title,
.row-artist {
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.row-title {
  font-weight: 600;
}

.row-artist {
  color: var(--text-soft);
  font-size: 0.875rem;
}

.row-clip {
  width: 18px;
  height: 18px;
  color: var(--text-soft);
}

.row-next {
  color: var(--text-soft);
}

.row.is-next .row-next {
  color: var(--glow);
}

.row.is-current {
  background: var(--strip);
  color: var(--strip-ink);
  box-shadow: inset 0 3px 0 var(--strip-rule), inset 0 -3px 0 var(--strip-rule);
}

.row.is-current:hover {
  background: var(--strip);
}

.row.is-current .row-artist,
.row.is-current .row-clip {
  color: var(--strip-rule);
}

.row.is-current .row-next {
  color: var(--strip-ink);
}

.row.is-current .row-next:hover {
  background: rgb(28 26 44 / 0.12);
}

/* Beeld */
.stage {
  grid-area: stage;
  position: relative;
  overflow: hidden;
  background: #000;
  min-height: 0;
}

.stage.is-filled {
  position: fixed;
  inset: 0;
  z-index: 10;
}

.slideshow,
.slide,
.clip {
  position: absolute;
  inset: 0;
}

.slideshow.is-empty {
  background: linear-gradient(135deg, #0f172a, #1e3a8a 55%, #0e7490);
}

.slide {
  overflow: hidden;
  opacity: 0;
  transition: opacity 1.5s ease;
}

.slide.is-visible {
  opacity: 1;
}

.slide img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.slide-backdrop {
  object-fit: cover;
  filter: blur(40px) brightness(0.5);
  transform: scale(1.15);
}

.slide-photo {
  object-fit: contain;
  transform-origin: var(--drift-x, 50%) var(--drift-y, 50%);
  animation: drift 14s linear forwards;
}

.slideshow.is-paused .slide-photo {
  animation-play-state: paused;
}

@keyframes drift {
  to {
    transform: scale(1.08);
  }
}

.clip {
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #000;
  opacity: 0;
  pointer-events: none;
}

.stage[data-mode="video"] .clip {
  opacity: 1;
}

.now-card {
  position: absolute;
  left: 0;
  bottom: clamp(16px, 5%, 56px);
  display: flex;
  align-items: center;
  gap: clamp(10px, 1.2vw, 20px);
  max-width: min(80%, 900px);
  padding: clamp(8px, 1vw, 16px) clamp(16px, 2vw, 36px) clamp(8px, 1vw, 16px) clamp(12px, 1.5vw, 28px);
  opacity: 0;
  transform: translateX(-12px);
  transition: opacity 0.5s ease, transform 0.5s ease;
  pointer-events: none;
}

.now-card.is-visible,
.stage.no-photos .now-card {
  opacity: 1;
  transform: none;
}

.stage[data-mode="video"] .now-card:not(.is-visible) {
  opacity: 0;
}

.now-card .cover {
  width: clamp(48px, 6vw, 110px);
  height: clamp(48px, 6vw, 110px);
  background: #e4d4ac;
  color: var(--strip-rule);
  font-size: clamp(1.25rem, 3vw, 3rem);
}

.now-card-text {
  display: grid;
  min-width: 0;
}

.now-card-text strong {
  overflow: hidden;
  font-size: clamp(1.125rem, 2.6vw, 2.75rem);
  font-weight: 700;
  font-stretch: 85%;
  line-height: 1.1;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.now-card-text span {
  overflow: hidden;
  color: var(--strip-rule);
  font-size: clamp(0.875rem, 1.6vw, 1.625rem);
  font-weight: 600;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.stage-controls {
  position: absolute;
  right: 12px;
  bottom: 12px;
  display: flex;
  gap: 4px;
  padding: 4px;
  border-radius: 28px;
  background: rgb(12 20 40 / 0.8);
  opacity: 0;
  transition: opacity 0.2s ease;
  pointer-events: none;
}

.stage.is-awake .stage-controls {
  opacity: 1;
  pointer-events: auto;
}

.stage:fullscreen:not(.is-awake),
.stage.is-filled:not(.is-awake) {
  cursor: none;
}

/* Balk onderin */
.bar {
  grid-area: bar;
  display: grid;
  grid-template-columns: minmax(180px, 1fr) auto minmax(180px, 2fr) 150px auto;
  align-items: center;
  gap: 16px;
  padding: 8px 16px;
  padding-bottom: max(8px, env(safe-area-inset-bottom));
  background: var(--ink);
  border-top: 1px solid var(--line);
}

.bar-now {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
  padding: 0;
  border: 0;
  background: transparent;
  text-align: left;
}

.bar-now-text {
  display: grid;
  min-width: 0;
}

.bar-now-text strong,
.bar-now-text span {
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.bar-now-text span {
  color: var(--text-soft);
  font-size: 0.875rem;
}

.bar-controls {
  display: flex;
  align-items: center;
  gap: 4px;
}

.play-button {
  display: grid;
  place-items: center;
  width: 52px;
  height: 52px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: var(--glow);
  color: var(--glow-ink);
}

.bar-time {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--text-soft);
  font-size: 0.875rem;
  font-variant-numeric: tabular-nums;
}

.bar-time input {
  flex: 1;
  min-width: 0;
}

.bar-volume {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text-soft);
}

.bar-volume input {
  flex: 1;
  min-width: 0;
}

input[type="range"] {
  height: 24px;
  margin: 0;
  accent-color: var(--glow);
}

/* Start */
.start {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 24px;
  padding: 16px;
  background: rgb(12 20 40 / 0.94);
  text-align: center;
}

.start-button {
  width: clamp(160px, 28vmin, 260px);
  aspect-ratio: 1;
  border: 0;
  border-radius: 50%;
  background: var(--glow);
  color: var(--glow-ink);
  font-size: clamp(2rem, 6vmin, 3.25rem);
  font-weight: 700;
  font-stretch: 85%;
  box-shadow: 0 0 0 10px rgb(255 177 61 / 0.18), 0 0 90px rgb(255 177 61 / 0.45);
}

.start-note {
  margin: 0;
  color: var(--text-soft);
  font-size: 1.125rem;
}

/* Meldingen */
.toast {
  position: fixed;
  left: 50%;
  top: 16px;
  z-index: 30;
  max-width: min(90vw, 560px);
  padding: 10px 16px;
  border-radius: 6px;
  background: var(--raised);
  border: 1px solid var(--line);
  transform: translateX(-50%);
}

.scan-dialog {
  width: min(92vw, 640px);
  max-height: 80vh;
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  color: var(--text);
}

.scan-dialog::backdrop {
  background: rgb(0 0 0 / 0.6);
}

.scan-dialog h2 {
  margin: 0 0 8px;
  font-size: 1.375rem;
}

.scan-dialog p {
  margin: 0 0 8px;
  color: var(--text-soft);
}

.scan-dialog ul {
  margin: 0 0 16px;
  padding-left: 20px;
  overflow-wrap: anywhere;
}

/* Inloggen */
.login-page {
  display: grid;
  place-items: center;
  min-height: 100vh;
  min-height: 100dvh;
  padding: 16px;
}

.login {
  width: min(100%, 360px);
}

.login-title {
  margin: 0 0 24px;
  padding: 12px 20px;
  font-size: clamp(2rem, 9vw, 2.75rem);
  font-weight: 700;
  font-stretch: 85%;
  line-height: 1.1;
}

.login form {
  display: grid;
  gap: 8px;
}

.login label {
  color: var(--text-soft);
}

.login input {
  height: 48px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--panel);
}

.login .text-button {
  margin-top: 8px;
}

.login-error {
  margin: 8px 0 0;
  color: #ffb4a8;
}

/* Telefoon: beeld boven, lijst eronder */
@media (max-width: 899px) {
  .app {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: auto auto minmax(0, 1fr) auto;
    grid-template-areas:
      "stage"
      "top"
      "list"
      "bar";
  }

  .stage {
    aspect-ratio: 16 / 9;
    max-height: 34vh;
    width: 100%;
  }

  .stage.is-filled {
    aspect-ratio: auto;
    max-height: none;
  }

  .top {
    padding: 8px 16px;
  }

  .top-row {
    margin-bottom: 4px;
  }

  .brand {
    font-size: 1.25rem;
  }

  .menu {
    inset: auto 16px 96px auto;
  }

  .bar {
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 4px 12px;
    padding-inline: 16px;
  }

  .bar-time {
    grid-column: 1 / -1;
    grid-row: 2;
  }

  .bar-volume,
  .bar-full {
    display: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  .slide-photo {
    animation: none;
  }

  .slide,
  .now-card,
  .stage-controls {
    transition-duration: 0.01s;
  }
}
