:root {
  --bg: #241043;
  --bg-2: #3c1c69;
  --scene: url("/themes/space.svg");
  --glass: rgba(255, 255, 255, 0.08);
  --glass-line: rgba(255, 255, 255, 0.16);
  --accent: #ffc24b;   /* warmer Abspiel-Knopf, einladend */
  --accent-2: #ff7eb3; /* aktiver Zustand */
  --text: #ffffff;
  --text-dim: rgba(255, 255, 255, 0.62);
  --radius: 28px;
  --player-h: 132px;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

/* hidden muss IMMER verstecken – auch bei Elementen mit eigener display-Regel
   (.setup und .player setzen display, das sonst das hidden-Attribut aushebelt) */
[hidden] { display: none !important; }

/* ---------- Themes (Eltern wählen, Standard = space) ---------- */
html[data-theme="dino"] {
  --bg: #102b1b;
  --bg-2: #234d33;
  --scene: url("/themes/dino.svg");
  --accent: #f4b942;
  --accent-2: #ff8c5a;
}
html[data-theme="ocean"] {
  --bg: #0a2a47;
  --bg-2: #11567d;
  --scene: url("/themes/ocean.svg");
  --accent: #ffd166;
  --accent-2: #48cae4;
}
html[data-theme="construction"] {
  --bg: #262420;
  --bg-2: #423d34;
  --scene: url("/themes/construction.svg");
  --accent: #ffc300;
  --accent-2: #ff7a00;
}

html {
  margin: 0;
  height: 100%;
  background-color: var(--bg);
  background-image:
    var(--scene),
    radial-gradient(120% 90% at 50% -10%, var(--bg-2), transparent 60%);
  background-repeat: no-repeat, no-repeat;
  background-position: center bottom, center top;
  background-size: cover, 100% 100%;
  background-attachment: fixed, fixed;
}

body {
  margin: 0;
  min-height: 100%;
  font-family: "Baloo 2", system-ui, sans-serif;
  color: var(--text);
  background: transparent;
  overscroll-behavior: none;
  user-select: none;
}

/* ---------- Kachel-Grid ---------- */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 22px;
  padding: 28px;
  padding-bottom: calc(var(--player-h) + 28px);
}

.tile {
  position: relative;
  border: none;
  padding: 0;
  background: var(--glass);
  border-radius: var(--radius);
  overflow: hidden;
  cursor: pointer;
  aspect-ratio: 1 / 1;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
  transition: transform 0.18s ease, box-shadow 0.18s ease;
}
.tile:active { transform: scale(0.95); }
.tile img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.tile.playing {
  outline: 5px solid var(--accent-2);
  outline-offset: -5px;
  box-shadow: 0 0 0 6px rgba(255, 126, 179, 0.25), 0 14px 40px rgba(0, 0, 0, 0.45);
}

/* Equalizer als Signature – zeigt ohne Worte "hier läuft etwas" */
.eq {
  position: absolute;
  left: 14px;
  bottom: 14px;
  display: none;
  gap: 4px;
  align-items: flex-end;
  height: 30px;
  padding: 7px 9px;
  border-radius: 12px;
  background: rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(6px);
}
.tile.playing .eq { display: flex; }
.eq span {
  width: 5px;
  background: var(--accent);
  border-radius: 3px;
  animation: bounce 0.9s ease-in-out infinite;
}
.eq span:nth-child(2) { animation-delay: 0.2s; }
.eq span:nth-child(3) { animation-delay: 0.4s; }
.eq span:nth-child(4) { animation-delay: 0.1s; }
@keyframes bounce {
  0%, 100% { height: 8px; }
  50% { height: 22px; }
}

/* ---------- Player-Leiste ---------- */
.player {
  position: fixed;
  inset: auto 0 0 0;
  height: var(--player-h);
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 0 22px;
  background: rgba(20, 8, 40, 0.82);
  backdrop-filter: blur(18px);
  border-top: 1px solid var(--glass-line);
}
.now-cover {
  width: 88px;
  height: 88px;
  border-radius: 18px;
  object-fit: cover;
  flex: none;
  background: var(--glass);
}
.now-text { flex: 1; min-width: 0; }
.now-title {
  display: block;
  font-size: 1.5rem;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ctrl {
  flex: none;
  border: none;
  border-radius: 50%;
  display: grid;
  place-items: center;
  cursor: pointer;
  transition: transform 0.15s ease;
}
.ctrl:active { transform: scale(0.9); }
.ctrl svg { width: 48%; height: 48%; }
.ctrl-play {
  width: 92px;
  height: 92px;
  background: var(--accent);
  color: #2a1500;
}
.ctrl-play svg { fill: currentColor; }
.ctrl-stop {
  width: 72px;
  height: 72px;
  background: var(--glass);
  color: var(--text);
}
.ctrl-stop svg { fill: currentColor; }

/* ---------- Setup-Hinweis ---------- */
.setup {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 24px;
  background: var(--bg);
}
.setup-card {
  max-width: 420px;
  text-align: center;
}
.setup-card h1 { font-size: 2rem; margin: 0 0 8px; }
.setup-card p { color: var(--text-dim); font-size: 1.15rem; line-height: 1.5; }
.setup-link {
  display: inline-block;
  margin-top: 18px;
  padding: 14px 26px;
  border-radius: 16px;
  background: var(--accent);
  color: #2a1500;
  font-weight: 700;
  text-decoration: none;
}

@media (prefers-reduced-motion: reduce) {
  .eq span { animation: none; height: 16px; }
  .tile { transition: none; }
}
