:root {
  --bg: #241a12;
  --fg: #f7efe3;
  --muted: #cbbba6;
  --border: rgba(255, 255, 255, 0.22);
  --online: #4ade80;
  --font-display: "Baloo 2", system-ui, sans-serif;
  --font-body: "DM Sans", system-ui, sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font-body);
  -webkit-font-smoothing: antialiased;
}

button { font: inherit; cursor: pointer; border: 0; background: none; color: inherit; }
a { color: inherit; text-decoration: none; }

.stage {
  position: relative;
  min-height: 100svh;
  overflow: hidden;
}

.bg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.scrim {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(to bottom, rgba(28, 20, 14, 0.45), transparent 28%),
    linear-gradient(to top, rgba(22, 16, 11, 0.68), transparent 42%);
}

.grain {
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: 0.28;
  mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='3'/%3E%3C/filter%3E%3Crect width='160' height='160' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* ---------- top bar ---------- */

.topbar {
  position: relative;
  z-index: 10;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem 1rem;
  padding: 0.75rem 1rem;
}

.clock {
  order: 1;
  font-size: 11px;
  letter-spacing: 0.2em;
  font-variant-numeric: tabular-nums;
  color: rgba(247, 239, 227, 0.8);
}

.presence {
  order: 3;
  display: flex;
  width: 100%;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  font-size: 11px;
}

.presence b { font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }

.dot {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: var(--online);
  box-shadow: 0 0 10px var(--online);
}

.links {
  order: 2;
  display: flex;
  gap: 0.75rem;
  font-size: 0.8rem;
  font-weight: 500;
}
.links a:hover { opacity: 0.7; }

@media (min-width: 640px) {
  .topbar { padding: 1rem 2rem; }
  .clock, .presence, .links { font-size: 0.75rem; }
  .presence { order: 2; width: auto; }
  .links { order: 3; gap: 1.25rem; font-size: 0.8rem; }
}

/* ---------- hero ---------- */

.hero {
  position: relative;
  z-index: 10;
  display: flex;
  min-height: calc(100svh - 72px);
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  gap: 2rem;
  padding: 2rem 1rem;
}

.hero-title {
  margin: 0;
  text-align: center;
  font-family: var(--font-display);
  font-weight: 800;
  line-height: 0.92;
  font-size: clamp(3rem, 17vw, 5rem);
  text-shadow: 0 6px 40px rgba(20, 12, 6, 0.55);
}
.hero-title span { display: block; }

@media (min-width: 640px) {
  .hero { gap: 2.5rem; padding: 4rem 1rem 2.5rem; }
  .hero-title { font-size: clamp(3.5rem, 13vw, 10rem); }
}

.controls {
  display: flex;
  width: 100%;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
}

/* ---------- horn ---------- */

.horn-wrap { display: flex; flex-direction: column; align-items: center; gap: 0.25rem; }

.horn-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.45rem 0.9rem;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 600;
  background: rgba(120, 74, 30, 0.55);
  border: 1px solid var(--border);
  backdrop-filter: blur(12px);
  transition: transform 0.15s ease, background 0.2s ease;
  touch-action: manipulation;
  user-select: none;
}
.horn-btn:hover { background: rgba(160, 100, 36, 0.65); }
.horn-btn:active { transform: scale(0.94); }
.horn-btn.honking {
  animation: horn-shake 0.35s ease-in-out;
  box-shadow: 0 0 26px rgba(240, 190, 90, 0.5);
}

@keyframes horn-shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-3px) rotate(-1.5deg); }
  75% { transform: translateX(3px) rotate(1.5deg); }
}

.hint { font-size: 10px; color: rgba(247, 239, 227, 0.5); }

/* ---------- player ---------- */

.player-stack { display: flex; flex-direction: column; align-items: center; gap: 0.75rem; width: 100%; }

.glass {
  background: rgba(52, 38, 27, 0.5);
  backdrop-filter: blur(20px) saturate(1.2);
  border: 1px solid var(--border);
  box-shadow: 0 20px 60px rgba(20, 12, 6, 0.45);
}

.player {
  position: relative;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  width: min(560px, 94vw);
  border-radius: 1.5rem;
  padding: 0.75rem;
}

@media (min-width: 640px) {
  .player { gap: 1rem; border-radius: 999px; padding: 0.75rem 1.25rem 0.75rem 0.75rem; }
}

.yt-host {
  position: absolute;
  width: 0;
  height: 0;
  overflow: hidden;
  opacity: 0;
  pointer-events: none;
}

.vinyl {
  flex: none;
  width: 48px;
  height: 48px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background:
    radial-gradient(circle at center, #f2e6d2 0 14%, transparent 15%),
    repeating-radial-gradient(circle at center, #4a3222 0 2px, #2b1d13 2px 4px);
}
.vinyl.spinning { animation: vinyl-spin 6s linear infinite; }
@keyframes vinyl-spin { to { transform: rotate(360deg); } }

@media (min-width: 640px) { .vinyl { width: 56px; height: 56px; } }

.meta { flex: 1; min-width: 0; }
.meta p { margin: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.t-title { font-size: 13px; font-weight: 600; }
.t-artist { font-size: 11px; color: var(--muted); }
.times { margin-top: 0.25rem !important; font-size: 11px; color: var(--muted); font-variant-numeric: tabular-nums; }

.seek {
  -webkit-appearance: none;
  appearance: none;
  margin-top: 0.5rem;
  width: 100%;
  height: 4px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.28);
  cursor: pointer;
}
.seek::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 12px;
  height: 12px;
  border-radius: 999px;
  background: var(--fg);
}
.seek::-moz-range-thumb {
  width: 12px;
  height: 12px;
  border: 0;
  border-radius: 999px;
  background: var(--fg);
}

.buttons { display: flex; flex: none; align-items: center; gap: 0.25rem; }
@media (min-width: 640px) { .buttons { gap: 0.5rem; } }

.ghost {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.25rem;
  height: 2.25rem;
  border-radius: 999px;
  color: rgba(247, 239, 227, 0.85);
  transition: background 0.2s ease;
}
.ghost:hover { background: rgba(255, 255, 255, 0.12); }

.main {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 3rem;
  height: 3rem;
  border-radius: 999px;
  background: var(--fg);
  color: #2b1d13;
  transition: transform 0.2s ease;
}
.main:hover { transform: scale(1.06); }
.main:disabled { opacity: 0.6; cursor: default; transform: none; }

/* ---------- recently played ---------- */

.recent {
  display: flex;
  width: min(560px, 94vw);
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
}

.recent-label {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  color: var(--muted);
}

.recent button {
  max-width: 46vw;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 0.8rem;
  font-weight: 500;
  color: rgba(247, 239, 227, 0.88);
}
.recent button:hover { opacity: 0.7; }
@media (min-width: 640px) { .recent button { max-width: 200px; } }

@media (prefers-reduced-motion: reduce) {
  .vinyl.spinning, .horn-btn.honking { animation: none; }
}
