/* ============================================================================
   RHP BOOMBOX — premium liquid-glass redesign (adapted off the Win95 plastic)
   Scoped under .rhp-boombox. No global leakage.
   Fixed bottom-right. z-index 120 (above content, below nav 200 + a11y 300).
   Silhouette preserved: [SPEAKER] [CORE] [SPEAKER] + carry handle + antenna.
   Material: translucent navy glass, brand gold/crimson accents, soft shadows.
   ========================================================================== */

/* ── Brand-glass tokens (boombox-local) ─────────────────────────────────── */
.rhp-boombox {
  --bb-glass:    rgba(11, 35, 64, 0.62);
  --bb-glass-2:  rgba(7, 24, 40, 0.78);
  --bb-ice:      #e8f3ff;
  --bb-muted:    #9db8d4;
  --bb-gold:     #c9a84c;
  --bb-gold-2:   #e8c97a;
  --bb-red:      #b11226;
  --bb-red-2:    #cc1530;
  --bb-line:     rgba(201, 168, 76, 0.28);
  --bb-line-2:   rgba(255, 255, 255, 0.10);
  --bb-chrome:   #c4d2e2;
  --bb-radius:   18px;
}

/* ── Shell — translucent navy glass ─────────────────────────────────────── */
.rhp-boombox {
  position: fixed;
  right: 1rem;
  bottom: 1rem;
  z-index: 120;
  width: 300px;
  max-width: calc(100vw - 2rem);
  box-sizing: border-box;
  padding: 12px;
  border-radius: var(--bb-radius);
  font-family: 'Rajdhani', 'Segoe UI', system-ui, sans-serif;
  color: var(--bb-ice);
  background:
    linear-gradient(160deg, rgba(20, 61, 106, 0.55), rgba(7, 24, 40, 0.72) 70%),
    var(--bb-glass);
  -webkit-backdrop-filter: blur(18px) saturate(1.25);
  backdrop-filter: blur(18px) saturate(1.25);
  border: 1px solid var(--bb-line);
  box-shadow:
    0 18px 50px rgba(0, 0, 0, 0.55),
    inset 0 1px 0 rgba(255, 255, 255, 0.14),
    0 0 0 1px rgba(0, 0, 0, 0.25);
  -webkit-user-select: none;
  user-select: none;
  transition: transform 0.25s ease, box-shadow 0.25s ease;
}
.rhp-boombox:hover {
  box-shadow:
    0 22px 60px rgba(0, 0, 0, 0.6),
    inset 0 1px 0 rgba(255, 255, 255, 0.18),
    0 0 28px rgba(201, 168, 76, 0.18);
}

/* ── Carry handle — slim chrome arc ─────────────────────────────────────── */
.rhp-boombox::before {
  content: "";
  position: absolute;
  top: -15px;
  left: 50%;
  transform: translateX(-50%);
  width: 110px;
  height: 18px;
  border: 4px solid var(--bb-chrome);
  border-bottom: none;
  border-radius: 14px 14px 0 0;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.5), rgba(122, 142, 166, 0.25) 60%, transparent);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.6);
  opacity: 0.85;
}

/* ── Telescoping antenna — gold-tipped ──────────────────────────────────── */
.rhp-boombox__antenna {
  position: absolute;
  top: -4px;
  right: 30px;
  width: 2.5px;
  height: 44px;
  transform-origin: bottom center;
  transform: rotate(22deg);
  border-radius: 3px 3px 0 0;
  background: linear-gradient(180deg, var(--bb-chrome), rgba(122, 142, 166, 0.4) 70%, transparent);
  pointer-events: none;
}
.rhp-boombox__antenna::after {
  content: "";
  position: absolute;
  top: -5px;
  left: 50%;
  transform: translateX(-50%);
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, var(--bb-gold-2), var(--bb-gold));
  box-shadow: 0 0 8px rgba(201, 168, 76, 0.8);
}

/* ── Layout: speaker | core | speaker ───────────────────────────────────── */
.rhp-boombox__shell {
  display: grid;
  grid-template-columns: 54px 1fr 54px;
  gap: 10px;
  align-items: center;
}

/* ── Speaker grilles — glass cones with gold hairline ───────────────────── */
.rhp-boombox__speaker {
  width: 54px;
  height: 54px;
  border-radius: 50%;
  background:
    radial-gradient(circle at 38% 34%, rgba(255, 255, 255, 0.10), transparent 45%),
    radial-gradient(circle, rgba(0, 0, 0, 0.55), rgba(3, 13, 24, 0.9));
  border: 1px solid var(--bb-line-2);
  box-shadow:
    inset 0 0 14px rgba(0, 0, 0, 0.8),
    0 0 0 1px rgba(201, 168, 76, 0.35),
    0 2px 8px rgba(0, 0, 0, 0.45);
  position: relative;
  align-self: center;
}
.rhp-boombox__speaker::before {
  content: "";
  position: absolute;
  inset: 11px;
  border-radius: 50%;
  border: 1px solid rgba(201, 168, 76, 0.22);
  box-shadow: inset 0 0 10px rgba(0, 0, 0, 0.7);
}
.rhp-boombox__speaker::after {
  content: "";
  position: absolute;
  inset: 22px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, rgba(201, 168, 76, 0.55), rgba(3, 13, 24, 0.95));
  border: 1px solid rgba(0, 0, 0, 0.5);
}

/* ── Core ───────────────────────────────────────────────────────────────── */
.rhp-boombox__core {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* ── Display — dark glass readout (ice/gold, not green LCD) ──────────────── */
.rhp-boombox__display {
  background: var(--bb-glass-2);
  border: 1px solid var(--bb-line-2);
  border-radius: 10px;
  padding: 7px 9px;
  box-shadow: inset 0 2px 10px rgba(0, 0, 0, 0.5);
  position: relative;
  overflow: hidden;
}
.rhp-boombox__mode {
  font-size: 0.6rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--bb-gold);
  font-weight: 700;
}
.rhp-boombox__title {
  font-size: 0.82rem;
  font-weight: 600;
  line-height: 1.25;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--bb-ice);
  margin-top: 1px;
}
.rhp-boombox__license {
  font-size: 0.58rem;
  letter-spacing: 0.04em;
  color: var(--bb-muted);
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* EQ bars — gold, animate while playing */
.rhp-boombox__eq {
  display: flex;
  align-items: flex-end;
  gap: 3px;
  height: 14px;
  margin-top: 5px;
}
.rhp-boombox__eq span {
  flex: 1;
  background: linear-gradient(180deg, var(--bb-gold-2), var(--bb-gold));
  border-radius: 2px;
  height: 22%;
  box-shadow: 0 0 4px rgba(201, 168, 76, 0.4);
}
.rhp-boombox.is-playing .rhp-boombox__eq span {
  animation: rhp-bb-eq 0.9s ease-in-out infinite;
}
.rhp-boombox.is-playing .rhp-boombox__eq span:nth-child(2) { animation-delay: 0.15s; }
.rhp-boombox.is-playing .rhp-boombox__eq span:nth-child(3) { animation-delay: 0.30s; }
.rhp-boombox.is-playing .rhp-boombox__eq span:nth-child(4) { animation-delay: 0.45s; }
.rhp-boombox.is-playing .rhp-boombox__eq span:nth-child(5) { animation-delay: 0.60s; }
@keyframes rhp-bb-eq {
  0%, 100% { height: 18%; }
  50%      { height: 100%; }
}

/* scratch flicker */
.rhp-boombox.is-scratching .rhp-boombox__display::after {
  content: "";
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(
    90deg, rgba(201, 168, 76, 0) 0 3px, rgba(201, 168, 76, 0.22) 3px 5px);
  mix-blend-mode: screen;
  animation: rhp-bb-scratch 0.42s linear;
}
@keyframes rhp-bb-scratch {
  0%   { transform: translateX(0);    opacity: 0.8; }
  50%  { transform: translateX(-5px); opacity: 0.4; }
  100% { transform: translateX(0);    opacity: 0; }
}

/* ── Controls ───────────────────────────────────────────────────────────── */
.rhp-boombox__controls {
  display: flex;
  align-items: center;
  gap: 6px;
}

/* Glass buttons — 44px touch target via hit-area padding */
.rhp-boombox__btn {
  flex: 0 0 auto;
  width: 38px;
  height: 38px;
  display: inline-grid;
  place-items: center;
  padding: 0;
  border-radius: 11px;
  border: 1px solid var(--bb-line-2);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.10), rgba(255, 255, 255, 0.02));
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
  color: var(--bb-gold-2);
  cursor: pointer;
  position: relative;
  transition: transform 0.12s ease, background 0.18s ease, box-shadow 0.18s ease, color 0.18s ease;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.12), 0 2px 6px rgba(0, 0, 0, 0.35);
}
/* expand hit area to >=44px without changing visual bounds */
.rhp-boombox__btn::after {
  content: "";
  position: absolute;
  inset: -4px;
}
.rhp-boombox__btn svg { width: 18px; height: 18px; display: block; }
.rhp-boombox__btn:hover {
  background: linear-gradient(180deg, rgba(201, 168, 76, 0.22), rgba(201, 168, 76, 0.06));
  color: #fff;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.2), 0 0 14px rgba(201, 168, 76, 0.3);
}
.rhp-boombox__btn:active { transform: translateY(1px) scale(0.96); }
.rhp-boombox__btn:focus-visible { outline: 2px solid var(--bb-gold); outline-offset: 2px; }

/* Play — crimson glass, slightly larger */
.rhp-boombox__play {
  width: 44px;
  height: 44px;
  border-radius: 13px;
  color: #fff;
  background: linear-gradient(180deg, var(--bb-red-2), var(--bb-red) 70%, #8a0d1d);
  border-color: rgba(232, 85, 106, 0.6);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.25), 0 3px 10px rgba(177, 18, 38, 0.4);
}
.rhp-boombox__play svg { width: 20px; height: 20px; }
.rhp-boombox__play:hover {
  background: linear-gradient(180deg, #e8556a, var(--bb-red-2) 70%, var(--bb-red));
  color: #fff;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.3), 0 0 18px rgba(204, 21, 48, 0.5);
}

/* Volume */
.rhp-boombox__volwrap {
  display: flex;
  align-items: center;
  gap: 5px;
  flex: 1 1 auto;
  min-width: 0;
  padding-left: 2px;
}
.rhp-boombox__volicon { display: inline-grid; place-items: center; color: var(--bb-muted); }
.rhp-boombox__volicon svg { width: 16px; height: 16px; }
.rhp-boombox__vol {
  flex: 1 1 auto;
  min-width: 34px;
  height: 22px;
  accent-color: var(--bb-gold);
  cursor: pointer;
}
.rhp-boombox__vol:focus-visible { outline: 2px solid var(--bb-gold); outline-offset: 2px; }

/* ── Cassette window removed (was the Win95 tell) ───────────────────────── */
.rhp-boombox__core::before { content: none; }

/* ── Tablet/phone: scale down, stay above safe area, never block nav ────── */
/* Mobile: remove the boombox entirely. Audio playback is unreliable on phones
   and the transition scratch was firing without music ("tiny record scratches").
   Desktop keeps the full boombox. */
@media (max-width: 768px) {
  .rhp-boombox { display: none !important; }
}

/* Small phones: collapse to a compact glass bar (speakers off, controls full) */
@media (max-width: 480px) {
  .rhp-boombox {
    width: calc(100vw - 1.2rem);
    right: 0.6rem;
    left: 0.6rem;
    bottom: calc(0.6rem + env(safe-area-inset-bottom, 0px));
  }
  .rhp-boombox__shell { grid-template-columns: 1fr; }
  .rhp-boombox__speaker { display: none; }
  .rhp-boombox::before { width: 88px; }     /* shorter handle on the wide bar */
  .rhp-boombox__antenna { right: 18px; }
  .rhp-boombox__btn { width: 40px; height: 40px; }   /* bigger on touch */
  .rhp-boombox__play { width: 46px; height: 46px; }
}

/* ── Reduced motion ─────────────────────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  .rhp-boombox,
  .rhp-boombox__btn { transition: none; }
  .rhp-boombox.is-playing .rhp-boombox__eq span,
  .rhp-boombox.is-scratching .rhp-boombox__display::after { animation: none !important; }
  .rhp-boombox.is-playing .rhp-boombox__eq span { height: 55%; }
}
.mode-reduced-motion .rhp-boombox.is-playing .rhp-boombox__eq span,
.mode-reduced-motion .rhp-boombox.is-scratching .rhp-boombox__display::after { animation: none !important; }
.mode-reduced-motion .rhp-boombox.is-playing .rhp-boombox__eq span { height: 55%; }
