* { box-sizing: border-box; }

html, body {
  height: 100%;
  margin: 0;
  color: #fff;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  overflow: hidden;
}

.bg {
  position: fixed;
  inset: 0;
  z-index: -2;
  background: #111 url("assets/bg.jpg") center / cover no-repeat;
}

/* SVG feTurbulence noise, tiled + blended over the art for a grainy film look */
.grain {
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  opacity: .18;
  mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  background-size: 180px 180px;
}

.bg-overlay {
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background: linear-gradient(to bottom, rgba(0, 0, 0, .18), rgba(0, 0, 0, 0) 45%, rgba(0, 0, 0, .55) 100%);
}

main {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  padding: 280px 1rem 32px;
}

/* top-left clock */
.clock {
  position: fixed;
  top: 20px;
  left: 20px;
  z-index: 20;
  font-size: .9rem;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
  text-shadow: 0 1px 6px rgba(0, 0, 0, .5);
}
.clock .blink { animation: blink 1s step-end infinite; }
.clock .ampm { margin-left: .35rem; opacity: .7; }
@keyframes blink { 50% { opacity: 0; } }

/* top-center online pill */
.online-pill {
  position: fixed;
  top: 20px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 20;
  display: inline-flex;
  align-items: center;
  gap: .5rem;
  font-size: .85rem;
  font-weight: 500;
  text-shadow: 0 1px 6px rgba(0, 0, 0, .5);
}
.dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #22c55e;
  box-shadow: 0 0 6px rgba(34, 197, 94, .8);
  flex-shrink: 0;
}

/* top-right links */
.top-right {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 20;
  display: flex;
  gap: .5rem;
}
.pill-link {
  display: inline-flex;
  align-items: center;
  gap: .5rem;
  padding: .5rem .7rem;
  border-radius: 999px;
  color: #fff;
  text-decoration: none;
  font-size: .85rem;
  font-weight: 500;
  text-shadow: 0 1px 6px rgba(0, 0, 0, .5);
  transition: opacity .15s, transform .15s;
}
.pill-link:hover { opacity: .8; }
.pill-link:active { transform: scale(.95); }

/* hero */
.hero {
  font-family: "Fraunces", serif;
  font-style: italic;
  font-weight: 600;
  font-size: clamp(4rem, 9vw, 7.5rem);
  text-align: center;
  text-shadow: 0 4px 24px rgba(0, 0, 0, .55);
  margin: 0;
}

/* bottom-center player */
.player {
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 1rem;
  width: min(92vw, 500px);
  padding: .85rem 1.4rem .85rem .85rem;
  border-radius: 999px;
  background: rgba(255, 255, 255, .1);
  backdrop-filter: blur(40px) saturate(1.5);
  -webkit-backdrop-filter: blur(40px) saturate(1.5);
  border: 1px solid rgba(255, 255, 255, .2);
  box-shadow: 0 8px 40px rgba(0, 0, 0, .45), inset 0 1px 0 rgba(255, 255, 255, .25);
}
.cover {
  width: 58px;
  height: 58px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
  background: #333;
}
.meta {
  flex: 1;
  min-width: 0;
  max-width: 240px;
  display: flex;
  flex-direction: column;
  gap: .25rem;
}
.title, .artist {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.title { font-size: .95rem; font-weight: 600; }
.artist { font-size: .8rem; color: rgba(255, 255, 255, .65); }
.seek-bar {
  position: relative;
  height: 4px;
  width: 100%;
  border-radius: 999px;
  background: rgba(255, 255, 255, .25);
  cursor: pointer;
  margin-top: .15rem;
}
.seek-fill {
  position: absolute;
  inset: 0 auto 0 0;
  width: 0%;
  border-radius: 999px;
  background: #fff;
}
.time { font-size: .65rem; color: rgba(255, 255, 255, .55); font-variant-numeric: tabular-nums; }

.controls { display: flex; align-items: center; gap: .25rem; flex-shrink: 0; }
.controls button {
  all: unset;
  display: grid;
  place-items: center;
  width: 2.25rem;
  height: 2.25rem;
  border-radius: 50%;
  color: rgba(255, 255, 255, .8);
  cursor: pointer;
  transition: background .15s, color .15s, transform .1s;
}
.controls button:hover { background: rgba(255, 255, 255, .15); color: #fff; }
.controls button:active { transform: scale(.95); }
.play-btn {
  width: 2.75rem !important;
  height: 2.75rem !important;
  background: #fff !important;
  color: #000 !important;
  box-shadow: 0 4px 12px rgba(0, 0, 0, .3);
}
.play-btn:hover { background: #fff !important; transform: scale(1.05); }

/* hidden YouTube host: real in-viewport size so decoding isn't throttled,
   just visually hidden (0x0 + off-screen makes Chrome stall it in BUFFERING) */
#yt-player {
  position: fixed;
  top: 0;
  left: 0;
  opacity: 0;
  pointer-events: none;
  z-index: -1;
}

@media (max-width: 480px) {
  .pill-link span { display: none; }
  .player { width: 92vw; gap: .75rem; padding: .7rem 1.1rem .7rem .7rem; }
  .cover { width: 46px; height: 46px; }
  main { padding-top: 130px; }
}
