/* ============================================================
   Later additions: recently-played / track picker panel, artist spotlight, character counter, mobile player layout.
   Rules here come after main.css so they override it.
   ============================================================ */

/* v5.7: listen shortcuts + recently played (now-playing bar), artist spotlight, character counter, Discord / report links */
#npBox .npl,
#npHistBtn {
  flex: none;
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: rgba(150, 160, 255, 0.18);
  color: #fff;
  cursor: pointer;
  text-decoration: none;
  transition:
    background 0.2s,
    transform 0.2s;
}
#npBox .npl:hover,
#npHistBtn:hover,
#npBox.hist #npHistBtn {
  background: rgba(43, 200, 215, 0.35);
  transform: scale(1.06);
}
#npBox .npl:focus-visible,
#npHistBtn:focus-visible {
  outline: 2px solid #2bc8d7;
  outline-offset: 2px;
}
#npHistBtn[hidden] {
  display: none;
}
#npHistPanel {
  display: none;
  position: absolute;
  left: 0;
  bottom: calc(100% + 8px);
  width: min(320px, calc(100vw - 24px));
  max-height: min(60vh, 340px);
  overflow: auto;
  padding: 10px 8px 8px;
  border-radius: 20px;
  border: 1px solid rgba(150, 160, 255, 0.35);
  background: rgba(20, 15, 67, 0.94);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  box-shadow: 0 18px 40px -16px rgba(0, 0, 0, 0.7);
}
#npBox.hist #npHistPanel {
  display: block;
}
#npHistPanel .hh {
  padding: 2px 10px 8px;
  font:
    700 11px/1 Figtree,
    system-ui,
    sans-serif;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #9ea5dc;
}
#npHistList {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
#npHistList button {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 2px;
  align-items: flex-start;
  text-align: left;
  padding: 8px 10px;
  border: 0;
  border-radius: 12px;
  background: transparent;
  color: #f4f7ff;
  cursor: pointer;
  font:
    600 13px/1.2 Figtree,
    system-ui,
    sans-serif;
  transition: background 0.2s;
}
#npHistList button:hover,
#npHistList button:focus-visible {
  background: rgba(150, 160, 255, 0.18);
  outline: none;
}
#npHistList button.ok {
  background: rgba(43, 200, 215, 0.3);
}
#npHistList b,
#npHistList span {
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
#npHistList span {
  color: #bfc0f8;
  font-weight: 500;
  font-size: 12px;
}
@media (min-width: 641px) {
  #npBox {
    max-width: max(150px, min(420px, calc(100vw - 84px - var(--sh))));
  }
}
@media (max-width: 640px) {
  #npBox,
  #npBox.shift {
    max-width: min(100%, 380px);
  }
  #npHistPanel {
    bottom: auto;
    top: calc(100% + 8px);
    left: 50%;
    transform: translateX(-50%);
  }
}
#rside {
  flex: 0 1 440px;
  min-width: 0;
  max-width: 100%;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 16px;
}
.stage {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
}
#rside .stage > .form {
  grid-area: 1/1;
  min-width: 0;
  width: 100%;
  max-width: none;
  box-sizing: border-box;
  flex: none;
}
.stage > .off {
  visibility: hidden;
  pointer-events: none;
  opacity: 0;
}
@media (max-width: 860px) {
  #rside {
    flex: none;
    width: min(460px, 100%);
    gap: 10px;
  }
}
/* the switch: same pill, jelly bubble and drag as the nav */
.seg {
  position: relative;
  align-self: center;
  display: flex;
  flex-wrap: nowrap;
  gap: 2px;
  padding: 6px;
  border-radius: 999px;
  background: rgba(28, 22, 96, 0.62);
  border: 1px solid var(--line);
  box-shadow:
    0 14px 40px -18px rgba(0, 0, 0, 0.7),
    inset 0 1px 0 rgba(255, 255, 255, 0.08);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  cursor: grab;
}
.seg.drag {
  cursor: grabbing;
}
.seg.drag .bubble.nt0 {
  transition:
    transform 0.25s ease,
    box-shadow 0.25s ease;
  transform: scale(1.08);
  box-shadow:
    0 10px 28px -6px rgba(127, 31, 234, 0.95),
    inset 0 1px 0 rgba(255, 255, 255, 0.3);
}
body:has(#radio.on) .seg {
  -webkit-backdrop-filter: none;
  backdrop-filter: none;
  background: rgba(22, 17, 82, 0.92);
}
.segbtn {
  position: relative;
  z-index: 1;
  min-width: 112px;
  padding: 9px 22px 7px;
  border: 0;
  border-radius: 999px;
  background: none;
  color: var(--soft);
  cursor: inherit;
  -webkit-user-drag: none;
  font-family: "Digitalt", "Figtree", system-ui, sans-serif;
  font-size: 20px;
  font-weight: 400;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  transition:
    color 0.2s,
    background 0.2s;
}
.segbtn:hover {
  background: rgba(150, 160, 255, 0.2);
  color: #fff;
}
.segbtn.act,
.segbtn.act:hover {
  background: none;
  color: #fff;
}
.segbtn:focus-visible {
  outline: 2px solid var(--cyan);
  outline-offset: 2px;
}
#spot {
  box-sizing: border-box;
  justify-content: flex-start;
  align-items: center;
  text-align: center;
  gap: 14px;
}
#spot .spl {
  font:
    700 12px/1 Figtree,
    system-ui,
    sans-serif;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--cyan);
}
#spot .spn {
  margin: 0;
  font-size: clamp(30px, 3.6vw, 42px);
  line-height: 1.05;
  font-weight: 800;
  letter-spacing: -0.02em;
}
#spot .spb {
  margin: 0;
  font-size: 17px;
  line-height: 1.55;
  color: var(--soft);
}
#spot .row {
  margin-top: 6px;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 12px;
}
#spot .btn {
  min-height: 46px;
  padding: 0 22px;
  font-size: 15px;
}
.stage {
  touch-action: pan-y;
}
#spot {
  cursor: grab;
}

/* artist spotlight icon: the avatar grows to fill all the room above the text (a square that fits the space, so it reaches up to the top), with a gradient ring and soft glow */
#spot .spav {
  position: relative;
  flex: 1 1 0;
  min-height: 96px;
  width: 100%;
  margin: 0 0 4px;
  container-type: size;
  display: grid;
  place-items: center;
}
#spot .spai {
  position: relative;
  isolation: isolate;
  width: 180px;
  width: min(calc(100cqw - 24px), calc(100cqh - 24px));
  aspect-ratio: 1;
  border-radius: 50%;
}
#spot .spai::before {
  content: "";
  position: absolute;
  inset: -6px;
  border-radius: 50%;
  z-index: -1;
  background: conic-gradient(
    from 0deg,
    #2bc8d7,
    #8d9bff,
    #b678ff,
    #7f1fea,
    #2bc8d7
  );
  animation: spring 9s linear infinite;
}
#spot .spai::after {
  content: "";
  position: absolute;
  inset: -16px;
  border-radius: 50%;
  z-index: -2;
  background: radial-gradient(
    closest-side,
    rgba(127, 31, 234, 0.55),
    rgba(43, 200, 215, 0.18) 70%,
    transparent
  );
  filter: blur(12px);
  opacity: 0.9;
}
#spot .spai img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
  border: 5px solid #1c1660;
  background: #1c1660;
  box-shadow: 0 14px 32px -10px rgba(0, 0, 0, 0.7);
  -webkit-user-drag: none;
  user-select: none;
}
@keyframes spring {
  to {
    transform: rotate(360deg);
  }
}
@media (prefers-reduced-motion: reduce) {
  #spot .spai::before {
    animation: none;
  }
}
html.lowfx #spot .spai::before {
  animation: none;
}
html.lowfx #spot .spai::after {
  filter: none;
}
/* low-effects mode: the Radio/Request switch is click-only (no dragging the pill or swiping the panel) and nothing glides when it changes */
html.lowfx .seg,
html.lowfx #spot {
  cursor: auto;
  touch-action: auto;
}
html.lowfx .seg .segbtn {
  cursor: pointer;
}
html.lowfx .seg .bubble,
html.lowfx .seg .bubble:not(.nt0),
html.lowfx .stage,
html.lowfx .stage * {
  transition: none !important;
}
.stage.swiping,
.stage.swiping * {
  cursor: grabbing !important;
  user-select: none;
  -webkit-user-select: none;
}
/* while screens slide: clip to the card column plus room for the glow, and fade out toward the clipped edges instead of cutting hard */
.stage.clip {
  overflow: hidden;
  margin: -100px -80px;
  padding: 100px 80px;
  -webkit-mask-image:
    linear-gradient(
      90deg,
      transparent,
      #000 80px,
      #000 calc(100% - 80px),
      transparent
    ),
    linear-gradient(
      180deg,
      transparent,
      #000 100px,
      #000 calc(100% - 100px),
      transparent
    );
  -webkit-mask-composite: source-in;
  mask-image:
    linear-gradient(
      90deg,
      transparent,
      #000 80px,
      #000 calc(100% - 80px),
      transparent
    ),
    linear-gradient(
      180deg,
      transparent,
      #000 100px,
      #000 calc(100% - 100px),
      transparent
    );
  mask-composite: intersect;
}
.cc {
  align-self: flex-end;
  font-size: 12px;
  line-height: 1;
  color: var(--mute);
  font-variant-numeric: tabular-nums;
}
.cc.warn {
  color: #ffd28a;
}
.cc.full {
  color: #ffb4c8;
}
.rrh {
  text-align: center;
  font-size: 13px;
  color: var(--mute);
}
.rrh a {
  color: var(--cyan);
  text-decoration: underline;
  text-underline-offset: 3px;
}
/* phones: the counter, report line and switch add ~64px to the request area, so the text area gives that back */
@media (max-width: 640px) {
  #request textarea.field {
    height: calc(3 * clamp(44px, 6vh, 54px) + 2 * 16px - 36px);
  }
  #radio:has(#npBox.show) #request textarea.field {
    height: calc(3 * clamp(44px, 6vh, 54px) + 2 * 16px - 90px);
  }
  /* phones: the switch stands up on the right side of the card as a slim vertical pill (labels stay in the DOM for screen readers), and the screens swipe up/down */
  #rside {
    position: relative;
  }
  #rside .seg {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    z-index: 6;
    align-self: auto;
    flex-direction: column;
    padding: 6px 4px;
    order: 0;
  }
  .seg .bubble {
    top: 0;
    bottom: auto;
    left: 4px;
    right: 4px;
    width: auto;
    height: 0;
  }
  .seg .bubble:not(.nt0) {
    transition:
      top 0.4s cubic-bezier(0.65, 0, 0.2, 1),
      height 0.4s cubic-bezier(0.65, 0, 0.2, 1),
      transform 0.25s ease,
      box-shadow 0.25s ease;
  }
  .segbtn {
    min-width: 0;
    width: 12px;
    height: 40px;
    padding: 0;
    font-size: 0;
    line-height: 0;
    color: transparent;
  }
  .segbtn::after {
    content: "";
    position: absolute;
    top: 0;
    bottom: 0;
    left: -10px;
    right: -10px;
  }
  .stage {
    touch-action: none;
  }
  #request textarea {
    touch-action: pan-y;
  }
  #rside #spot,
  #rside #request {
    padding-right: 40px;
  }
  #rside #spot {
    padding-left: 40px;
  }
  .stage.clip {
    margin: -40px -24px;
    padding: 40px 24px;
    -webkit-mask-image:
      linear-gradient(
        90deg,
        transparent,
        #000 24px,
        #000 calc(100% - 24px),
        transparent
      ),
      linear-gradient(
        180deg,
        transparent,
        #000 40px,
        #000 calc(100% - 40px),
        transparent
      );
    mask-image:
      linear-gradient(
        90deg,
        transparent,
        #000 24px,
        #000 calc(100% - 24px),
        transparent
      ),
      linear-gradient(
        180deg,
        transparent,
        #000 40px,
        #000 calc(100% - 40px),
        transparent
      );
  }
}
/* Discord icon in the socials row: 5 across on desktop; on phones 2 + 2 with the Discord icon centred underneath */
@media (min-width: 561px) {
  #home .socials {
    width: min(600px, 100%);
    grid-template-columns: repeat(5, minmax(0, 1fr));
  }
}
#socials a.card:nth-child(5) {
  --g: 88, 101, 242;
}
#home.on .socials .card:nth-child(5) {
  animation-delay: 0.65s;
}
@media (max-width: 560px) {
  #home #socials a.card:nth-child(5) {
    grid-column: 1/-1;
    justify-self: center;
    width: calc(50% - 9px);
  }
}

/* v5.8: recently played rows (tap = play, copy button), mobile: now-playing + mute top-right opposite the logo */
#npHistList .hrow {
  display: flex;
  align-items: center;
  gap: 4px;
}
#npHistList .hplay {
  flex: 1 1 auto;
  min-width: 0;
  width: auto;
}
#npHistList .hcopy {
  flex: none;
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: rgba(150, 160, 255, 0.18);
  color: #fff;
  cursor: pointer;
  transition: background 0.2s;
}
#npHistList .hcopy:hover,
#npHistList .hcopy:focus-visible {
  background: rgba(43, 200, 215, 0.35);
  outline: none;
}
#npHistList .hcopy.ok {
  background: rgba(43, 200, 215, 0.5);
}
@media (max-width: 640px) {
  #sfxBtn {
    left: auto;
    right: 12px;
    bottom: auto;
    top: calc(36px + env(safe-area-inset-top, 0px));
  }
  #volBox {
    left: auto;
    right: 11px;
    bottom: auto;
    top: calc(82px + env(safe-area-inset-top, 0px));
  }
  #npBox,
  #npBox.shift {
    --sh: 0px;
    position: fixed;
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    align-items: center;
    left: auto;
    right: 58px;
    bottom: auto;
    top: calc(24px + env(safe-area-inset-top, 0px));
    width: auto;
    max-width: calc(100vw - 58px - 196px);
    min-width: 120px;
    margin: 0;
    padding: 6px 8px;
    gap: 4px;
    border-radius: 18px;
    align-self: auto;
    transform: none;
    animation: none;
  }
  #npBox:not(.show) {
    display: flex;
    opacity: 0;
    pointer-events: none;
  }
  #npBox.show {
    animation: none;
  }
  #npTxt {
    flex: 1 1 100%;
    padding-left: 4px;
  }
  #npBox > button {
    width: 28px;
    height: 28px;
  }
  #npHistPanel {
    top: calc(100% + 8px);
    bottom: auto;
    left: auto;
    right: -46px;
    transform: none;
    width: min(320px, calc(100vw - 24px));
  }
  #radio:has(#npBox.show) #request textarea.field {
    height: calc(3 * clamp(44px, 6vh, 54px) + 2 * 16px - 36px);
  }
}

#npHistPanel {
  display: none;
  flex-direction: column;
}
#npBox.hist #npHistPanel {
  display: flex;
}
#npHistPanel .hh {
  flex: none;
}
#npHistList {
  overflow: auto;
  min-height: 0;
}
#npHistPanel {
  overflow: hidden;
  max-height: min(60vh, 380px);
}
#npHistList .hrow.cur .hplay {
  background: rgba(255, 200, 87, 0.16);
  box-shadow: inset 0 0 0 1.5px #ffc857;
}
#npHistList .hrow.last .hplay {
  background: rgba(43, 200, 215, 0.22);
}
#npHistList .tag {
  font:
    700 10px/1 Figtree,
    system-ui,
    sans-serif;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  font-style: normal;
  color: #2bc8d7;
}
#npHistList .tag.now {
  color: #ffc857;
}

#npHistList {
  padding-right: 4px;
  scrollbar-width: thin;
  scrollbar-color: rgba(150, 160, 255, 0.4) transparent;
}
#npHistList::-webkit-scrollbar {
  width: 6px;
}
#npHistList::-webkit-scrollbar-track {
  background: transparent;
  margin: 4px 0;
}
#npHistList::-webkit-scrollbar-thumb {
  background: rgba(150, 160, 255, 0.4);
  border-radius: 3px;
}
#npHistList::-webkit-scrollbar-thumb:hover {
  background: rgba(150, 160, 255, 0.65);
}
#npHistList::-webkit-scrollbar-button {
  display: none;
  width: 0;
  height: 0;
}

#npPrev,
#npPause {
  flex: none;
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: rgba(150, 160, 255, 0.18);
  color: #fff;
  cursor: pointer;
  transition:
    background 0.2s,
    transform 0.2s,
    opacity 0.2s;
}
#npPrev:hover:not(:disabled),
#npPause:hover {
  background: rgba(43, 200, 215, 0.35);
  transform: scale(1.06);
}
#npPrev:disabled {
  opacity: 0.35;
  cursor: default;
}
#npPrev:focus-visible,
#npPause:focus-visible {
  outline: 2px solid #2bc8d7;
  outline-offset: 2px;
}
#npPause .il,
#npPause.isp .ip {
  display: none;
}
#npPause.isp .il {
  display: block;
}
#npPause.isp {
  background: rgba(43, 200, 215, 0.4);
}
#npPrev {
  order: 1;
}
#npPause {
  order: 2;
}
#npSkip {
  order: 3;
}
#npCopy {
  order: 4;
}
#npHistBtn {
  order: 5;
}
@media (max-width: 640px) {
  #npBox > button {
    width: 28px;
    height: 28px;
  }
  #npBox {
    max-width: calc(100vw - 58px - 190px);
  }
}

/* desktop: the volume slider stands up above the speaker button */
@media (min-width: 641px) {
  #volBox {
    left: 17px;
    bottom: calc(66px + env(safe-area-inset-bottom, 0px));
    width: 40px;
    height: 180px;
    padding: 11px 0 0;
    flex-direction: column;
    justify-content: flex-start;
    align-items: center;
    border-radius: 20px;
    transform: translateY(6px);
    touch-action: none;
  }
  #volBox.show {
    transform: none;
  }
  #volPct {
    min-width: 0;
    margin: 0;
    text-align: center;
    font-size: 11px;
  }
  #volRng {
    position: absolute;
    left: 50%;
    top: 101px;
    width: 130px;
    height: 24px;
    margin: -12px 0 0 -65px;
    transform: rotate(-90deg);
    touch-action: none;
  }
  #volRng::-webkit-slider-thumb {
    width: 18px;
    height: 18px;
    margin-top: -7px;
  }
  #volRng::-moz-range-thumb {
    width: 18px;
    height: 18px;
  }
  #npBox.shift {
    --sh: 0px;
  }
}

/* ---------- debug: download counter (js/debug-downloads.js) ---------- */
#dbgBtn {
  position: fixed;
  right: 16px;
  bottom: calc(16px + env(safe-area-inset-bottom, 0px));
  z-index: 60;
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  padding: 0;
  border-radius: 50%;
  border: 1px solid rgba(150, 160, 255, 0.35);
  background: rgba(20, 15, 67, 0.7);
  color: #bfc0f8;
  cursor: pointer;
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  transition: background 0.2s, color 0.2s, transform 0.2s;
}
#dbgBtn:hover,
#dbgBtn[aria-expanded="true"] {
  background: rgba(150, 160, 255, 0.2);
  color: #fff;
}
#dbgBtn:focus-visible {
  outline: 2px solid #2bc8d7;
  outline-offset: 2px;
}
#dbgPanel {
  position: fixed;
  right: 16px;
  bottom: calc(66px + env(safe-area-inset-bottom, 0px));
  z-index: 60;
  width: min(280px, calc(100vw - 32px));
  box-sizing: border-box;
  padding: 14px 16px;
  border-radius: 20px;
  border: 1px solid rgba(150, 160, 255, 0.35);
  background: rgba(20, 15, 67, 0.94);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  box-shadow: 0 18px 40px -16px rgba(0, 0, 0, 0.7);
  color: #f4f7ff;
  font: 500 13px/1.3 Figtree, system-ui, sans-serif;
  opacity: 0;
  transform: translateY(6px);
  pointer-events: none;
  transition: opacity 0.2s, transform 0.2s;
}
#dbgPanel.show {
  opacity: 1;
  transform: none;
  pointer-events: auto;
}
#dbgPanel .dh {
  font: 700 11px/1 Figtree, system-ui, sans-serif;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #9ea5dc;
}
#dbgPanel .dt {
  margin: 6px 0 10px;
  font: 800 30px/1 Figtree, system-ui, sans-serif;
  font-variant-numeric: tabular-nums;
}
#dbgPanel ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
#dbgPanel li {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}
#dbgPanel li b {
  font-variant-numeric: tabular-nums;
}
#dbgPanel small {
  color: #9ea5dc;
}
#dbgPanel .dn {
  margin: 10px 0 0;
  font-size: 12px;
  color: #bfc0f8;
}
#dbgPanel .dn:empty {
  display: none;
}
@media (max-width: 640px) {
  #dbgBtn {
    right: auto;
    left: 12px;
    bottom: calc(100px + env(safe-area-inset-bottom, 0px));
    width: 38px;
    height: 38px;
  }
  #dbgPanel {
    right: auto;
    left: 12px;
    bottom: calc(146px + env(safe-area-inset-bottom, 0px));
  }
}
