:root {
  --edge: clamp(1rem, 2.2vw, 1.75rem);
  --glass: rgba(255, 255, 255, 0.1);
  --glass-line: rgba(255, 255, 255, 0.2);
  --shadow-glass: 0 8px 40px rgba(0, 0, 0, 0.45), inset 0 1px 0 rgba(255, 255, 255, 0.25);
  --text-shadow: 0 1px 6px rgba(0, 0, 0, 0.55);

  --accent: #ff5a36;   /* coral-red, sampled from the mural wall -- used only on the hype button */
  --accent-2: #ffb648; /* warm amber, sampled from the floor light */

  --swift: 140ms cubic-bezier(0.4, 0, 0.2, 1);
  --glide: 320ms cubic-bezier(0.4, 0, 0.2, 1);
  --settle: 620ms cubic-bezier(0.16, 1, 0.3, 1);
  --ease-settle: cubic-bezier(0.16, 1, 0.3, 1);

  font-size: 16px;
}

* { box-sizing: border-box; }

html, body { height: 100%; margin: 0; }

body {
  font-family: "Baloo 2", "Nirmala UI", ui-rounded, system-ui, sans-serif;
  color: #fff;
  background: #140c0c;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

/* ---------- Background photo + scrim ---------- */

.bg__layer {
  position: fixed;
  inset: 0;
  z-index: -2;
  background-size: cover;
  background-position: 50% 50%;
  opacity: 0;
  transition: opacity 0.35s ease;
}

/* Muscle-tier backgrounds -- opacity is driven entirely by JS (see script.js
   setBackgroundTier/flashLift) based on cumulative rep count. #bgStart0 is
   the only one visible by default. */
#bgStart0    { background-image: url("assets/bg-start.png");     opacity: 1; }
#bgLifted0   { background-image: url("assets/bg-lifted.png"); }
#bgStart30   { background-image: url("assets/bg-start-30.png"); }
#bgLifted30  { background-image: url("assets/bg-lifted-30.png"); }
#bgStart65   { background-image: url("assets/bg-start-65.png"); }
#bgLifted65  { background-image: url("assets/bg-lifted-65.png"); }
#bgStart100  { background-image: url("assets/bg-start-100.png"); }
#bgLifted100 { background-image: url("assets/bg-lifted-100.png"); }

@media (prefers-reduced-motion: reduce) {
  .bg__layer {
    transition: none;
  }
}

.bg__scrim {
  position: fixed;
  inset: 0;
  z-index: -1;
  background: linear-gradient(
    180deg,
    rgba(10, 6, 6, 0.55) 0%,
    rgba(10, 6, 6, 0.15) 26%,
    rgba(10, 6, 6, 0.2) 58%,
    rgba(10, 6, 6, 0.6) 100%
  );
}

/* ---------- Layout ---------- */

main {
  position: relative;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  padding: max(var(--edge), env(safe-area-inset-top)) var(--edge)
    max(var(--edge), env(safe-area-inset-bottom));
}

/* ---------- Top bar ---------- */

.topbar {
  position: fixed;
  top: max(1.15rem, env(safe-area-inset-top));
  left: var(--edge);
  right: var(--edge);
  z-index: 20;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.6rem;
  text-shadow: var(--text-shadow);
}

.topbar__row {
  width: 100%;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 0.75rem;
}

.genre-tabs {
  display: flex;
  gap: 0.4rem;
}

.genre-tab {
  padding: 0.3rem 0.85rem;
  border: 1px solid var(--glass-line);
  border-radius: 999px;
  background: var(--glass);
  backdrop-filter: blur(20px) saturate(150%);
  -webkit-backdrop-filter: blur(20px) saturate(150%);
  color: rgba(255, 255, 255, 0.65);
  font-family: inherit;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  cursor: pointer;
  transition: background var(--swift), color var(--swift), border-color var(--swift), transform var(--swift);
}

.genre-tab:hover { background: rgba(255, 255, 255, 0.18); color: #fff; }
.genre-tab:active { transform: scale(0.95); }

.genre-tab.is-active {
  background: rgba(255, 255, 255, 0.22);
  border-color: rgba(255, 255, 255, 0.45);
  color: #fff;
}

.topbar__time {
  justify-self: start;
  font-size: 0.82rem;
  font-weight: 500;
  letter-spacing: 0.01em;
  font-variant-numeric: tabular-nums;
  color: rgba(255, 255, 255, 0.92);
}

.presence {
  justify-self: center;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.82rem;
  font-weight: 500;
  letter-spacing: 0.01em;
  white-space: nowrap;
  color: rgba(255, 255, 255, 0.92);
}

.presence__dot {
  position: relative;
  width: 10px;
  height: 10px;
  flex: none;
  border-radius: 50%;
  background: #4ade80;
  box-shadow: 0 0 8px rgba(74, 222, 128, 0.9);
}

.presence__dot::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: #4ade80;
  opacity: 0.75;
  animation: ping 1.9s cubic-bezier(0, 0, 0.2, 1) infinite;
}

@keyframes ping {
  75%, 100% { transform: scale(2.2); opacity: 0; }
}

.presence__count { font-variant-numeric: tabular-nums; }

.presence__label {
  font-weight: 400;
  color: rgba(255, 255, 255, 0.62);
}

.reps-reset {
  display: grid;
  place-items: center;
  width: 1.4rem;
  height: 1.4rem;
  margin: -0.35rem -0.2rem -0.35rem 0.1rem;
  border: none;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.12);
  color: rgba(255, 255, 255, 0.7);
  cursor: pointer;
  transition: background var(--swift), color var(--swift), transform var(--swift);
}

.reps-reset:hover { background: rgba(255, 255, 255, 0.22); color: #fff; }
.reps-reset:active { transform: rotate(-90deg); }

.links {
  justify-self: end;
  display: flex;
  align-items: center;
}

.links a {
  display: grid;
  place-items: center;
  width: 2rem;
  height: 2rem;
  min-width: 44px;
  min-height: 44px;
  margin: -6px;
  border-radius: 50%;
  color: rgba(255, 255, 255, 0.92);
  text-decoration: none;
  transition: background var(--swift), transform var(--swift), color var(--swift);
}

.links a:hover { background: rgba(255, 255, 255, 0.16); color: #fff; }
.links a:active { transform: scale(0.95); }

/* ---------- Floating hype button ---------- */

.horns {
  position: fixed;
  left: var(--edge);
  top: 50%;
  translate: 0 -50%;
  z-index: 20;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  opacity: 1;
  transform: scale(1);
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.horns.is-suppressed {
  opacity: 0;
  transform: scale(0.85);
  pointer-events: none;
}

.hype-btn {
  position: relative;
  width: 64px;
  height: 64px;
  min-width: 44px;
  min-height: 44px;
  border: none;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #1a0e08;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 8px 28px rgba(255, 90, 54, 0.45);
  transition: transform var(--swift), box-shadow var(--swift);
}

.hype-btn:hover { transform: translateY(-2px) scale(1.04); box-shadow: 0 12px 32px rgba(255, 90, 54, 0.55); }
.hype-btn:active { transform: scale(0.94); }

.hype-btn__emoji {
  font-size: 28px;
  line-height: 1;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.35));
  transition: transform 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.hype-btn.is-hit .hype-btn__emoji { transform: scale(1.35) rotate(-8deg); }

.hype-btn__ring {
  position: absolute;
  inset: -6px;
  border-radius: 50%;
  border: 2px solid rgba(255, 182, 72, 0.55);
  animation: hype-breathe 2.6s ease-in-out infinite;
  pointer-events: none;
}

.hype-btn__ring--2 { animation-delay: 1.3s; }

@keyframes hype-breathe {
  0%   { transform: scale(1);    opacity: 0.7; }
  70%  { transform: scale(1.35); opacity: 0; }
  100% { transform: scale(1.35); opacity: 0; }
}

.hype-btn.is-hit::before,
.hype-btn.is-hit::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 2px solid var(--accent-2);
  animation: hype-shockwave 0.6s ease-out forwards;
  pointer-events: none;
}

.hype-btn.is-hit::after { animation-delay: 0.1s; }

@keyframes hype-shockwave {
  0%   { transform: scale(1);   opacity: 0.9; }
  100% { transform: scale(2.2); opacity: 0; }
}

/* ---------- Maxed-out state (30+ reps) ---------- */

.hype-btn.is-maxed {
  background: linear-gradient(135deg, #ffd24d, #ff9d2e);
  box-shadow: 0 8px 28px rgba(255, 180, 30, 0.55);
}

.hype-btn.is-maxed:hover {
  box-shadow: 0 12px 32px rgba(255, 180, 30, 0.65);
}

.hype-btn.is-maxed .hype-btn__ring {
  border-color: rgba(255, 210, 77, 0.65);
}

/* One-time bigger burst the moment 30 reps is crossed -- takes priority over
   the normal .is-hit shockwave since both target ::before/::after and this
   rule comes later in the cascade. */
.hype-btn.is-max-burst::before,
.hype-btn.is-max-burst::after {
  content: "";
  position: absolute;
  inset: -10px;
  border-radius: 50%;
  border: 3px solid #ffd24d;
  animation: hype-max-shockwave 1s ease-out forwards;
  pointer-events: none;
}

.hype-btn.is-max-burst::after { animation-delay: 0.15s; }

@keyframes hype-max-shockwave {
  0%   { transform: scale(1);   opacity: 1; }
  100% { transform: scale(3.2); opacity: 0; }
}

.max-toast {
  position: absolute;
  left: 50%;
  bottom: calc(100% + 14px);
  transform: translate(-50%, 8px) scale(0.85);
  white-space: nowrap;
  background: linear-gradient(135deg, #ffd24d, #ff9d2e);
  color: #1a0e08;
  font-weight: 800;
  font-size: 0.78rem;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  padding: 0.4rem 0.9rem;
  border-radius: 999px;
  box-shadow: 0 8px 24px rgba(255, 180, 30, 0.5);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease, transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.max-toast.is-visible {
  opacity: 1;
  transform: translate(-50%, 0) scale(1);
}

.max-flash {
  position: fixed;
  inset: 0;
  z-index: 40;
  background: radial-gradient(circle at 8% 50%, rgba(255, 210, 77, 0.4), transparent 55%);
  opacity: 0;
  pointer-events: none;
}

.max-flash.is-active {
  animation: max-flash-pulse 0.7s ease-out;
}

@keyframes max-flash-pulse {
  0%   { opacity: 0; }
  25%  { opacity: 1; }
  100% { opacity: 0; }
}

.confetti-particle {
  position: fixed;
  width: 7px;
  height: 7px;
  border-radius: 2px;
  z-index: 41;
  pointer-events: none;
  animation: confetti-burst 0.9s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

@keyframes confetti-burst {
  0%   { transform: translate(-50%, -50%) translate(0, 0) rotate(0deg); opacity: 1; }
  100% { transform: translate(-50%, -50%) translate(var(--dx), calc(var(--dy) + 50px)) rotate(var(--spin)); opacity: 0; }
}

@media (prefers-reduced-motion: reduce) {
  .hype-btn.is-max-burst::before,
  .hype-btn.is-max-burst::after,
  .max-flash.is-active,
  .confetti-particle {
    animation: none !important;
    display: none;
  }
}

/* ---------- Dock (playlist + player) ---------- */

.dock {
  position: relative;
  width: 100%;
  max-width: 30rem;
  margin-bottom: clamp(0.5rem, 7vh, 4.5rem);
}

.list {
  position: absolute;
  left: 0;
  right: 0;
  bottom: calc(100% + 0.7rem);
  z-index: 5;
  max-height: min(48dvh, 24rem);
  overflow-y: auto;
  overscroll-behavior: contain;
  border-radius: 1.35rem;
  border: 1px solid var(--glass-line);
  background: rgba(20, 20, 22, 0.55);
  backdrop-filter: blur(28px) saturate(150%);
  -webkit-backdrop-filter: blur(28px) saturate(150%);
  box-shadow: var(--shadow-glass);

  opacity: 0;
  visibility: hidden;
  transform: translate3d(0, 10px, 0) scale(0.985);
  transform-origin: bottom center;
  transition: opacity var(--glide), transform var(--glide), visibility 0s linear 320ms;

  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.28) transparent;
}

.list.is-open {
  opacity: 1;
  visibility: visible;
  transform: none;
  transition: opacity var(--glide), transform 420ms var(--ease-settle), visibility 0s;
}

.list::-webkit-scrollbar { width: 6px; }
.list::-webkit-scrollbar-track { background: transparent; }
.list::-webkit-scrollbar-thumb { border-radius: 999px; background: rgba(255, 255, 255, 0.24); }
.list::-webkit-scrollbar-thumb:hover { background: rgba(255, 255, 255, 0.4); }

.list ol {
  margin: 0;
  padding: 0.4rem;
  list-style: none;
  counter-reset: t;
}

.list li { counter-increment: t; }

.list button {
  width: 100%;
  display: flex;
  align-items: baseline;
  gap: 0.6rem;
  padding: 0.45rem 0.7rem;
  border: none;
  border-radius: 0.7rem;
  background: transparent;
  color: rgba(255, 255, 255, 0.82);
  font-family: inherit;
  font-size: 0.86rem;
  font-weight: 600;
  text-align: left;
  cursor: pointer;
}

.list button::before {
  content: counter(t);
  flex: none;
  width: 1.4rem;
  font-size: 0.7rem;
  font-variant-numeric: tabular-nums;
  color: rgba(255, 255, 255, 0.4);
}

.list button:hover { background: rgba(255, 255, 255, 0.12); color: #fff; }

.list li.is-current button {
  background: rgba(255, 255, 255, 0.18);
  color: #fff;
  font-weight: 800;
}

.track__title { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.track__artist {
  font-size: 0.74rem;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.5);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ---------- Bumper (rotating quote) ---------- */

.bumper {
  width: 100%;
  margin: 0 auto 0.7rem;
  padding: 0 0.5rem;
  text-align: center;
  user-select: none;
  font-size: clamp(1rem, 2.6vw, 1.28rem);
  font-weight: 600;
  line-height: 1.5;
  letter-spacing: 0.01em;
  color: rgba(255, 255, 255, 0.8);
  text-shadow: var(--text-shadow);
  transition: opacity 240ms ease;
}

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

.player {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  padding: 0.4rem 0.9rem 0.4rem 0.4rem;
  border-radius: 999px;
  border: 1px solid var(--glass-line);
  background: var(--glass);
  backdrop-filter: blur(28px) saturate(150%);
  -webkit-backdrop-filter: blur(28px) saturate(150%);
  box-shadow: var(--shadow-glass);
}

/* Spinning vinyl artwork */

.disc {
  position: relative;
  width: 3.25rem;
  height: 3.25rem;
  flex: none;
  transition: transform var(--glide);
}

.disc.is-spinning { transform: scale(1.03); }

.disc__ring {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  overflow: hidden;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.4);
  outline: 1px solid rgba(255, 255, 255, 0.2);
  outline-offset: -1px;
  background: #1a1a1a;
  animation: disc-spin 8s linear infinite;
  animation-play-state: paused;
}

.disc.is-spinning .disc__ring { animation-play-state: running; }

.disc__art { width: 100%; height: 100%; object-fit: cover; display: block; }

.disc__hub {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 0.5rem;
  height: 0.5rem;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.7);
  box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.4);
}

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

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

.player__title {
  margin: 0;
  font-weight: 700;
  font-size: 0.84rem;
  line-height: 1.25;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.35);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: opacity 220ms ease;
}

.player__artist {
  margin: 0;
  font-size: 0.71rem;
  font-weight: 600;
  line-height: 1.25;
  color: rgba(255, 255, 255, 0.7);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: opacity 220ms ease;
}

/* Custom seek bar (transform-driven, not a native range input) */

.seek {
  position: relative;
  height: 10px;
  margin-top: 0.2rem;
  cursor: pointer;
  touch-action: none;
}

.seek__rail {
  position: absolute;
  inset-inline: 0;
  top: 50%;
  height: 3px;
  transform: translateY(-50%);
  border-radius: 999px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.2);
}

.seek__fill {
  height: 100%;
  width: 100%;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.9);
  transform: scaleX(0);
  transform-origin: left center;
  will-change: transform;
}

.seek__knob {
  position: absolute;
  top: 50%;
  left: 0;
  width: 10px;
  height: 10px;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.5);
  opacity: 0;
  transition: opacity var(--swift);
  will-change: transform;
}

.seek:hover .seek__knob,
.seek:focus-visible .seek__knob { opacity: 1; }

.time {
  margin-top: 0.05rem;
  font-size: 0.62rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  color: rgba(255, 255, 255, 0.6);
}

/* Controls */

.player__controls {
  display: flex;
  align-items: center;
  gap: 0.15rem;
  flex: none;
}

.player__controls button {
  display: grid;
  place-items: center;
  width: 1.8rem;
  height: 1.8rem;
  border: none;
  border-radius: 50%;
  background: transparent;
  color: rgba(255, 255, 255, 0.8);
  cursor: pointer;
  transition: background var(--swift), color var(--swift), transform var(--swift);
}

.player__controls button:hover { background: rgba(255, 255, 255, 0.15); color: #fff; }
.player__controls button:active { transform: scale(0.92); }

#playBtn {
  width: 2.25rem;
  height: 2.25rem;
  background: #fff;
  color: #000;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.35);
}

#playBtn:hover { background: #fff; color: #000; transform: scale(1.06); }

#shuffleBtn.is-active,
#playlistBtn.is-active {
  color: #fff;
  background: rgba(255, 255, 255, 0.2);
}

/* ---------- Hidden YouTube player ---------- */

#ytPlayer {
  position: fixed;
  bottom: 0;
  right: 0;
  width: 1px;
  height: 1px;
  opacity: 0.01;
  pointer-events: none;
}

/* ---------- Focus ---------- */

:focus-visible {
  outline: 2px solid #fff;
  outline-offset: 3px;
  border-radius: 8px;
}

/* ---------- Small screens ---------- */

@media (max-width: 640px) {
  .presence__label { display: none; }

  .player {
    flex-wrap: wrap;
    padding: 0.75rem;
    border-radius: 1.5rem;
    row-gap: 0.6rem;
  }

  .player__controls {
    width: 100%;
    justify-content: center;
    gap: 0.35rem;
  }

  .disc { width: 3.75rem; height: 3.75rem; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }

  .disc__ring,
  .presence__dot::after,
  .hype-btn__ring,
  .hype-btn.is-hit::before,
  .hype-btn.is-hit::after {
    animation: none !important;
  }

  .disc.is-spinning { transform: none; }
}
