/* ————— base ————— */
:root {
  --bg-1: #171228;
  --bg-2: #0d0a17;
  --amber: #f4b266;
  --amber-soft: rgba(244, 178, 102, 0.16);
  --text: #cfc4e8;
  --text-dim: #a89fc4;
  --line: rgba(255, 255, 255, 0.09);
  --hud: rgba(15, 11, 26, 0.42);
  --shadow: 0 1px 10px rgba(0, 0, 0, 0.55);
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html, body { height: 100%; }

body {
  font-family: "Quicksand", system-ui, -apple-system, sans-serif;
  background: radial-gradient(120% 90% at 50% 0%, var(--bg-1) 0%, var(--bg-2) 70%);
  color: var(--text);
  overflow: hidden;
  user-select: none;
  -webkit-user-select: none;
}

/* ————— fallback under-layer (visible until the scene paints) ————— */
#stars { position: fixed; inset: 0; pointer-events: none; }
#stars i {
  position: absolute;
  border-radius: 50%;
  background: #cfc4e8;
  opacity: 0.2;
  animation: twinkle 4s ease-in-out infinite;
}
@keyframes twinkle {
  0%, 100% { opacity: 0.08; }
  50% { opacity: 0.55; }
}

.glow {
  position: fixed;
  left: 50%;
  top: 42%;
  width: 70vmin;
  height: 70vmin;
  transform: translate(-50%, -50%);
  background: radial-gradient(circle, rgba(244, 178, 102, 0.07) 0%, transparent 65%);
  pointer-events: none;
}

/* ————— full-screen scene ————— */
.scene {
  position: fixed;
  inset: 0;
  z-index: 0;
  cursor: pointer;
}
.scene video {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: opacity 0.4s ease;
}
.scene video.dim { opacity: 0; }
body.no-video .scene video { display: none; }

.scene .vignette {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(180deg, rgba(13, 10, 23, 0.5) 0%, transparent 16%),
    linear-gradient(0deg, rgba(13, 10, 23, 0.55) 0%, transparent 24%),
    radial-gradient(120% 120% at 50% 45%, transparent 58%, rgba(13, 10, 23, 0.42) 100%);
}

/* ————— header / footer ————— */
header {
  position: fixed;
  top: 0; left: 0; right: 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px 28px;
  font-size: 13px;
  letter-spacing: 0.06em;
  color: var(--text-dim);
  text-shadow: var(--shadow);
  z-index: 5;
}
header b { color: var(--text); font-weight: 600; }
.moon { color: var(--amber); margin-right: 6px; text-shadow: 0 0 14px rgba(244, 178, 102, 0.6); }
#clock { font-variant-numeric: tabular-nums; }

footer {
  position: fixed;
  bottom: 14px; left: 0; right: 0;
  text-align: center;
  font-size: 11px;
  letter-spacing: 0.08em;
  color: rgba(200, 190, 226, 0.5);
  text-shadow: var(--shadow);
  z-index: 4;
}

/* ————— bottom HUD ————— */
.deck {
  position: fixed;
  bottom: 38px;
  left: 50%;
  transform: translateX(-50%);
  width: min(660px, calc(100vw - 28px));
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 10px 18px;
  border-radius: 18px;
  background: var(--hud);
  backdrop-filter: blur(16px) saturate(1.15);
  -webkit-backdrop-filter: blur(16px) saturate(1.15);
  border: 1px solid var(--line);
  box-shadow: 0 12px 36px rgba(0, 0, 0, 0.38);
  z-index: 5;
}

.now {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
  min-width: 0;
  font-size: 13.5px;
  font-weight: 500;
  text-shadow: var(--shadow);
}
.now #title {
  flex: 1;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--text);
}
.now #count { font-size: 11px; color: var(--text-dim); font-variant-numeric: tabular-nums; }

/* tiny equalizer */
.eq { display: inline-flex; align-items: flex-end; gap: 2.5px; height: 12px; }
.eq i {
  width: 3px;
  border-radius: 2px;
  background: var(--amber);
  height: 30%;
  animation: bounce 1.1s ease-in-out infinite;
  animation-play-state: paused;
  opacity: 0.45;
}
.eq i:nth-child(1) { animation-delay: 0s; }
.eq i:nth-child(2) { animation-delay: 0.25s; }
.eq i:nth-child(3) { animation-delay: 0.5s; }
.eq i:nth-child(4) { animation-delay: 0.15s; }
.eq.on i { animation-play-state: running; opacity: 1; }
@keyframes bounce {
  0%, 100% { height: 25%; }
  50% { height: 100%; }
}

/* ————— controls ————— */
.controls {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
}

.controls button {
  display: grid;
  place-items: center;
  border-radius: 50%;
  cursor: pointer;
  color: var(--text);
  transition: transform 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease;
}
.controls button svg { width: 17px; height: 17px; fill: currentColor; }

.ghost {
  width: 40px;
  height: 40px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--line);
}
.ghost:hover {
  border-color: var(--amber-soft);
  color: var(--amber);
  transform: translateY(-1px);
  box-shadow: 0 4px 18px rgba(244, 178, 102, 0.2);
}

.primary {
  width: 52px;
  height: 52px;
  border: none;
  background: linear-gradient(140deg, #ffd9a0, var(--amber));
  color: #241505;
  box-shadow: 0 6px 24px rgba(244, 178, 102, 0.35);
}
.primary:hover { transform: translateY(-1px) scale(1.03); }
.primary svg { width: 20px; height: 20px; }
.primary .ic-pause { display: none; }
body.playing .primary .ic-play { display: none; }
body.playing .primary .ic-pause { display: block; }

/* volume */
.vol { display: flex; align-items: center; gap: 7px; margin-left: 6px; }
.bare {
  width: 30px;
  height: 30px;
  background: none;
  border: none;
  color: var(--text-dim);
}
.bare:hover { color: var(--amber); }
.bare svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.bare .ic-vol { display: none; }
.bare .ic-muted { display: block; }
body.audible .bare .ic-vol { display: block; }
body.audible .bare .ic-muted { display: none; }

input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  width: 88px;
  height: 3px;
  border-radius: 2px;
  outline: none;
  cursor: pointer;
  background: linear-gradient(90deg, var(--amber) var(--fill, 70%), rgba(255, 255, 255, 0.18) 0);
}
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background: var(--amber);
  box-shadow: 0 0 8px rgba(244, 178, 102, 0.8);
}
input[type="range"]::-moz-range-thumb {
  width: 11px;
  height: 11px;
  border: none;
  border-radius: 50%;
  background: var(--amber);
  box-shadow: 0 0 8px rgba(244, 178, 102, 0.8);
}

/* ————— start curtain ————— */
#overlay {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  text-align: center;
  padding: 24px;
  background: rgba(13, 10, 23, 0.45);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  transition: opacity 0.7s ease;
}
#overlay.away { opacity: 0; pointer-events: none; }
#overlay .moon { font-size: 34px; text-shadow: none; }
#overlay h1 { font-size: 24px; font-weight: 600; letter-spacing: 0.02em; }
#overlay h1 span { color: var(--amber); }
#overlay p {
  max-width: 340px;
  font-size: 13px;
  line-height: 1.6;
  color: var(--text-dim);
}
#start {
  margin-top: 16px;
  padding: 13px 34px;
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: #241505;
  background: linear-gradient(140deg, #ffd9a0, var(--amber));
  border: none;
  border-radius: 999px;
  cursor: pointer;
  animation: breathe 2.6s ease-in-out infinite;
  transition: transform 0.18s ease;
}
#start:hover { transform: scale(1.04); }
#start[disabled] { opacity: 0.6; cursor: default; animation: none; }
@keyframes breathe {
  0%, 100% { box-shadow: 0 0 0 0 rgba(244, 178, 102, 0.35); }
  50% { box-shadow: 0 0 0 14px rgba(244, 178, 102, 0); }
}

/* ————— toast ————— */
#toast {
  position: fixed;
  bottom: 108px;
  left: 50%;
  transform: translate(-50%, 8px);
  padding: 9px 18px;
  font-size: 12px;
  letter-spacing: 0.03em;
  color: var(--text);
  background: rgba(23, 18, 40, 0.92);
  border: 1px solid var(--line);
  border-radius: 999px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease, transform 0.3s ease;
  z-index: 15;
}
#toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ————— hidden youtube player ————— */
/* offscreen, not display:none — so audio never gets suspended */
#yt {
  position: fixed;
  left: -9999px;
  top: 0;
  width: 320px;
  height: 180px;
  opacity: 0;
  pointer-events: none;
}

@media (max-width: 560px) {
  .deck { flex-wrap: wrap; justify-content: center; padding: 12px 14px; gap: 10px; }
  .now { flex-basis: 100%; justify-content: center; }
  .controls { width: 100%; justify-content: center; }
  footer { display: none; }
}
