:root {
  --bg: #0d0f14;
  --bg-raised: #161a22;
  --bg-input: #1d222c;
  --border: #2a303c;
  --text: #eef1f6;
  --muted: #9aa3b2;
  --accent: #ff4f8b;
  --accent-2: #7c6bff;
  --danger: #ff6b6b;
  --radius: 14px;
  --lyric-size: 2.2rem;
  color-scheme: dark;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

a {
  color: inherit;
}

h1,
h2,
h3 {
  margin: 0 0 0.5rem;
  line-height: 1.2;
}

.muted {
  color: var(--muted);
}

.small {
  font-size: 0.9rem;
}

/* ---------- Seitenrahmen ---------- */

.page {
  min-height: 100vh;
  padding: 24px 16px;
  margin: 0 auto;
}

.page.center {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
}

.page.wide {
  max-width: 1200px;
}

.page-head {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 16px;
}

.page-head h1 {
  margin: 0;
}

.card {
  width: 100%;
  max-width: 560px;
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.35);
}

.page.wide .card {
  max-width: none;
  margin-bottom: 16px;
}

.brand h1 {
  font-size: 2rem;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--accent);
  font-weight: 600;
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.links {
  display: flex;
  gap: 16px;
  color: var(--muted);
}

.notice p {
  color: var(--muted);
}

/* ---------- Formulare ---------- */

form {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 16px;
}

label {
  font-weight: 600;
  font-size: 0.95rem;
}

input[type="url"],
input[type="text"],
select,
textarea {
  width: 100%;
  font: inherit;
  color: var(--text);
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px 14px;
}

input:focus-visible,
select:focus-visible,
textarea:focus-visible,
button:focus-visible,
a:focus-visible {
  outline: 2px solid var(--accent-2);
  outline-offset: 2px;
}

textarea {
  resize: vertical;
}

.hint {
  margin: 4px 0 8px;
  color: var(--muted);
  font-size: 0.9rem;
  min-height: 1.4em;
}

.error {
  color: var(--danger);
  margin: 8px 0 0;
}

.check {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 500;
  margin: 8px 0;
  cursor: pointer;
}

.checks {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 20px;
  margin: 8px 0;
}

input[type="range"] {
  accent-color: var(--accent);
  width: 100%;
}

input[type="checkbox"],
input[type="radio"] {
  accent-color: var(--accent);
  width: 18px;
  height: 18px;
}

/* ---------- Buttons ---------- */

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font: inherit;
  font-weight: 600;
  color: var(--text);
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 16px;
  text-decoration: none;
  cursor: pointer;
  transition: background 0.15s, transform 0.1s;
}

.button:hover {
  background: #262c38;
}

.button:active {
  transform: translateY(1px);
}

.button:disabled {
  opacity: 0.5;
  cursor: default;
}

.button.primary {
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  border-color: transparent;
}

.button.primary:hover {
  filter: brightness(1.08);
}

.button.ghost {
  background: transparent;
}

.button.wide {
  width: 100%;
  padding: 14px;
  margin-top: 8px;
}

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

.badge {
  font-size: 0.85rem;
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(124, 107, 255, 0.2);
  color: #c9c2ff;
}

/* ---------- Fortschritt ---------- */

.progress {
  height: 10px;
  background: var(--bg-input);
  border-radius: 999px;
  overflow: hidden;
  margin: 16px 0 8px;
}

.progress .bar {
  height: 100%;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  border-radius: inherit;
  transition: width 0.4s ease;
}

.step {
  font-weight: 600;
  margin: 8px 0 0;
}

.wait h1 {
  font-size: 1.6rem;
}

.loading {
  text-align: center;
}

.spinner {
  width: 40px;
  height: 40px;
  margin: 0 auto 12px;
  border-radius: 50%;
  border: 4px solid var(--border);
  border-top-color: var(--accent);
  animation: spin 0.9s linear infinite;
}

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

/* ---------- Benchmark ---------- */

.table-wrap {
  overflow-x: auto;
}

table.bench {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

table.bench th,
table.bench td {
  padding: 8px 10px;
  border-bottom: 1px solid var(--border);
  text-align: left;
  white-space: nowrap;
}

table.bench th {
  color: var(--muted);
  font-weight: 600;
}

table.bench td.num {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

table.bench td.song {
  white-space: normal;
  min-width: 200px;
}

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

.player {
  position: fixed;
  inset: 0;
  display: grid;
  /* minmax(0, …): sonst wächst die Textzeile auf die volle Texthöhe und schiebt die Fußleiste aus dem Bild */
  grid-template-rows: auto auto minmax(0, 1fr) auto;
  overflow: hidden;
  background: #000;
}

.backdrop {
  position: absolute;
  inset: 0;
  z-index: 0;
  overflow: hidden;
}

.backdrop img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  filter: blur(40px) brightness(0.35) saturate(1.2);
  transform: scale(1.2);
}

.backdrop::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(0, 0, 0, 0.55), rgba(0, 0, 0, 0.25) 40%, rgba(0, 0, 0, 0.7));
}

.visualizer {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 1;
  pointer-events: none;
}

.player > .bar,
.player > .banner,
.player > .lyrics {
  position: relative;
  z-index: 2;
}

.bar {
  transition: opacity 0.4s ease, transform 0.4s ease;
}

.bar.top {
  grid-row: 1;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  background: linear-gradient(180deg, rgba(0, 0, 0, 0.6), transparent);
}

.home {
  text-decoration: none;
  font-size: 1.4rem;
  padding: 4px 8px;
  border-radius: 8px;
}

.cover {
  width: 48px;
  height: 48px;
  object-fit: cover;
  border-radius: 8px;
  flex: none;
}

.titles {
  flex: 1;
  min-width: 0;
}

.titles .title {
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.titles .artist {
  color: var(--muted);
  font-size: 0.9rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.expires {
  color: var(--muted);
  font-size: 0.85rem;
  white-space: nowrap;
}

.icon {
  font: inherit;
  font-size: 1.1rem;
  color: var(--text);
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 10px;
  min-width: 44px;
  height: 44px;
  padding: 0 10px;
  cursor: pointer;
  white-space: nowrap;
}

.icon:hover {
  background: rgba(255, 255, 255, 0.16);
}

.icon.play {
  min-width: 56px;
  height: 56px;
  border-radius: 50%;
  font-size: 1.4rem;
  background: var(--text);
  color: #111;
}

.banner {
  grid-row: 2;
  justify-self: center;
  margin: 0 16px 8px;
  font: inherit;
  font-size: 0.9rem;
  color: #ffe2a8;
  background: rgba(255, 179, 71, 0.15);
  border: 1px solid rgba(255, 179, 71, 0.35);
  border-radius: 999px;
  padding: 6px 14px;
  cursor: pointer;
}

.banner .link {
  text-decoration: underline;
}

.lyrics {
  grid-row: 3;
  position: relative;
  min-height: 0;
  overflow-y: auto;
  padding: 33vh max(16px, 8vw) 60vh;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.2) transparent;
  -webkit-mask-image: linear-gradient(180deg, transparent, #000 12%, #000 85%, transparent);
  mask-image: linear-gradient(180deg, transparent, #000 12%, #000 85%, transparent);
}

.line {
  margin: 0 0 0.55em;
  font-size: var(--lyric-size);
  font-weight: 800;
  line-height: 1.25;
  letter-spacing: -0.01em;
  cursor: pointer;
  transition: transform 0.3s ease, filter 0.3s ease;
  transform-origin: left center;
  text-wrap: balance;
  overflow-wrap: anywhere;
}

.line.current {
  transform: scale(1.04);
}

.line:not(.current):not(.active) {
  filter: saturate(0.6);
}

.line.empty {
  color: var(--muted);
  cursor: default;
}

.word {
  /* Deckkraft wird pro Frame gesetzt, daher keine CSS-Transition. */
  will-change: opacity;
}

.line.active .word,
.line.current .word {
  text-shadow: 0 0 24px rgba(255, 79, 139, 0.25);
}

.countdown {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 0 0 0.8em;
  color: var(--muted);
  font-weight: 600;
}

.dots {
  display: inline-flex;
  gap: 6px;
}

.dots i {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.2);
  transition: background 0.2s;
}

.dots i.on {
  background: var(--accent);
}

.follow {
  position: absolute;
  z-index: 3;
  left: 50%;
  bottom: 150px;
  transform: translateX(-50%);
  background: rgba(22, 26, 34, 0.9);
  backdrop-filter: blur(8px);
}

.bar.bottom {
  grid-row: 4;
  padding: 8px 16px 16px;
  background: linear-gradient(0deg, rgba(0, 0, 0, 0.75), transparent);
}

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

.time {
  font-variant-numeric: tabular-nums;
  font-size: 0.85rem;
  color: var(--muted);
  min-width: 3.2em;
  text-align: center;
}

.track {
  position: relative;
  flex: 1;
  height: 28px;
  display: flex;
  align-items: center;
}

.track::before {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  height: 6px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.15);
}

.track .fill {
  position: absolute;
  left: 0;
  height: 6px;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  pointer-events: none;
}

.track .marker {
  position: absolute;
  width: 2px;
  height: 14px;
  margin-left: -1px;
  background: rgba(255, 255, 255, 0.55);
  border-radius: 1px;
  pointer-events: none;
}

.track input[type="range"] {
  position: absolute;
  inset: 0;
  width: 100%;
  margin: 0;
  opacity: 0;
  cursor: pointer;
}

.controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px 24px;
  margin-top: 8px;
}

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

.group.transport {
  gap: 12px;
}

.toggle {
  font: inherit;
  font-weight: 600;
  color: var(--text);
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 999px;
  padding: 8px 14px;
  cursor: pointer;
  white-space: nowrap;
}

.toggle.on {
  background: rgba(255, 79, 139, 0.25);
  border-color: var(--accent);
}

input.slim {
  width: 110px;
}

.label {
  font-size: 1.1rem;
}

/* Start-Overlay */

.overlay {
  position: absolute;
  inset: 0;
  z-index: 5;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  background: rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(4px);
}

.bigplay {
  width: 120px;
  height: 120px;
  border-radius: 50%;
  border: none;
  font-size: 3rem;
  padding-left: 10px;
  color: #111;
  background: linear-gradient(135deg, #fff, #ffd6e6);
  box-shadow: 0 12px 50px rgba(255, 79, 139, 0.45);
  cursor: pointer;
  transition: transform 0.15s;
}

.bigplay:hover {
  transform: scale(1.05);
}

/* Vollbild: Leisten nach Inaktivität ausblenden */

.player.ui-hidden {
  cursor: none;
}

.player.ui-hidden .bar.top {
  opacity: 0;
  transform: translateY(-100%);
  pointer-events: none;
}

.player.ui-hidden .bar.bottom {
  opacity: 0;
  transform: translateY(100%);
  pointer-events: none;
}

.player.ui-hidden .banner,
.player.ui-hidden .follow {
  opacity: 0;
  pointer-events: none;
}

/* Einstellungen */

.scrim {
  position: absolute;
  inset: 0;
  z-index: 6;
  background: rgba(0, 0, 0, 0.4);
}

.panel {
  position: absolute;
  z-index: 7;
  top: 0;
  right: 0;
  bottom: 0;
  width: min(420px, 100%);
  overflow-y: auto;
  padding: 16px 20px 32px;
  background: var(--bg-raised);
  border-left: 1px solid var(--border);
  box-shadow: -20px 0 60px rgba(0, 0, 0, 0.4);
}

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

.panel-head h2 {
  margin: 0;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin: 14px 0;
}

.field small {
  font-weight: 400;
}

.lyrics-check {
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}

.lyrics-check dl {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 4px 16px;
  margin: 0 0 12px;
}

.lyrics-check dt {
  color: var(--muted);
}

.lyrics-check dd {
  margin: 0;
}

.candidates {
  list-style: none;
  margin: 12px 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.candidate {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  font-weight: 400;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: 10px;
  cursor: pointer;
}

.candidate span {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.candidate .preview {
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.status {
  color: var(--muted);
  min-height: 1.5em;
}

/* ---------- Handy ---------- */

@media (max-width: 640px) {
  .line {
    font-size: calc(var(--lyric-size) * 0.72);
  }

  .card {
    padding: 18px;
  }

  .expires {
    display: none;
  }

  .controls {
    justify-content: center;
  }

  .group.transport {
    width: 100%;
    justify-content: center;
  }

  input.slim {
    width: 90px;
  }

  .follow {
    bottom: 190px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .line,
  .bar,
  .progress .bar {
    transition: none;
  }
}
