/**
 * WASTELAND RADIO STYLES
 * Apocalyptic player UI - 274 years old, still transmitting
 */

/* Main radio container - fixed to bottom */
#wasteland-radio {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 1000;
  background: linear-gradient(to bottom, #0a0a0a 0%, #141414 100%);
  border-top: 2px solid var(--brass);
  box-shadow: 0 -4px 32px rgba(0, 0, 0, 0.8), inset 0 1px 0 rgba(205, 184, 125, 0.15);
  backdrop-filter: blur(8px);
  font-family: "JetBrains Mono", monospace;
}

/* Scratched metal texture overlay */
#wasteland-radio::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    repeating-linear-gradient(0deg,
      transparent,
      transparent 2px,
      rgba(205, 184, 125, 0.02) 2px,
      rgba(205, 184, 125, 0.02) 4px),
    repeating-linear-gradient(90deg,
      transparent,
      transparent 2px,
      rgba(205, 184, 125, 0.015) 2px,
      rgba(205, 184, 125, 0.015) 4px);
  pointer-events: none;
  opacity: 0.6;
}

/* Main player layout */
.wr-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: clamp(12px, 2vw, 20px);
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: clamp(12px, 3vw, 24px);
  align-items: center;
  position: relative;
  z-index: 1;
}

/* Left: Transport controls */
.wr-controls {
  display: flex;
  gap: 8px;
  align-items: center;
}

.wr-btn {
  background: rgba(10, 10, 10, 0.6);
  border: 1px solid var(--brass);
  color: var(--brass);
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  cursor: pointer;
  font-size: 16px;
  transition: all 0.15s ease;
  position: relative;
  overflow: hidden;
}

.wr-btn::before {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 50% 50%, rgba(205, 184, 125, 0.1), transparent);
  opacity: 0;
  transition: opacity 0.2s;
}

.wr-btn:hover::before {
  opacity: 1;
}

.wr-btn:hover {
  background: rgba(205, 184, 125, 0.08);
  border-color: var(--brass);
  box-shadow: 0 0 12px rgba(205, 184, 125, 0.3), inset 0 0 8px rgba(205, 184, 125, 0.1);
  transform: translateY(-1px);
}

.wr-btn:active {
  transform: translateY(0);
  box-shadow: 0 0 8px rgba(205, 184, 125, 0.2), inset 0 2px 4px rgba(0, 0, 0, 0.4);
}

.wr-btn.active {
  background: rgba(205, 184, 125, 0.15);
  border-color: var(--brass);
  box-shadow: 0 0 16px rgba(205, 184, 125, 0.4), inset 0 0 12px rgba(205, 184, 125, 0.2);
}

/* Play button - larger */
#wr-play {
  width: 48px;
  height: 48px;
  font-size: 20px;
  border-width: 2px;
}

#wr-play.playing {
  animation: pulse-glow 2s ease-in-out infinite;
}

@keyframes pulse-glow {

  0%,
  100% {
    box-shadow: 0 0 12px rgba(205, 184, 125, 0.4);
  }

  50% {
    box-shadow: 0 0 20px rgba(205, 184, 125, 0.6);
  }
}

/* Repeat button states */
.wr-btn.repeat-off {
  opacity: 0.5;
}

.wr-btn.repeat-all {
  opacity: 1;
}

.wr-btn.repeat-one {
  opacity: 1;
  color: var(--ember);
  border-color: var(--ember);
}

/* Center: Track info & progress */
.wr-track-info {
  display: grid;
  gap: 8px;
  min-width: 0;
}

/* Frequency display - nixie tube style */
.wr-frequency-display {
  display: flex;
  align-items: center;
  gap: 12px;
  background: rgba(0, 0, 0, 0.6);
  border: 1px solid rgba(205, 184, 125, 0.3);
  padding: 6px 12px;
  position: relative;
  overflow: hidden;
}

.wr-frequency-display::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(to bottom, rgba(205, 184, 125, 0.05), transparent);
  pointer-events: none;
}

.wr-freq-label {
  font-size: 10px;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: rgba(227, 215, 180, 0.5);
  font-weight: 600;
}

#wr-frequency {
  font-size: 18px;
  font-weight: 600;
  color: var(--brass);
  letter-spacing: 0.08em;
  text-shadow: 0 0 8px rgba(205, 184, 125, 0.6);
  font-family: "Orbitron", monospace;
  min-width: 90px;
}

/* Track title */
#wr-track-title {
  font-size: clamp(13px, 2vw, 15px);
  color: var(--sand);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  letter-spacing: 0.03em;
  line-height: 1.2;
}

/* Progress bar area */
.wr-progress-area {
  display: flex;
  gap: 10px;
  align-items: center;
}

.wr-time {
  font-size: 12px;
  color: rgba(227, 215, 180, 0.7);
  font-variant-numeric: tabular-nums;
  min-width: 45px;
  text-align: center;
}

/* Custom range slider - brass dial style */
.wr-slider {
  flex: 1;
  height: 6px;
  background: rgba(28, 43, 59, 0.6);
  border: 1px solid rgba(205, 184, 125, 0.2);
  position: relative;
  cursor: pointer;
  overflow: hidden;
}

.wr-slider::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: var(--progress, 0%);
  background: linear-gradient(to right, var(--brass), var(--ember));
  box-shadow: 0 0 8px rgba(205, 184, 125, 0.5);
  transition: width 0.1s linear;
}

/* Actual range input (invisible) */
#wr-seek,
#wr-volume {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 6px;
  background: transparent;
  position: absolute;
  inset: 0;
  cursor: pointer;
  z-index: 2;
}

#wr-seek::-webkit-slider-thumb,
#wr-volume::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 16px;
  height: 16px;
  background: var(--brass);
  border: 2px solid #0a0a0a;
  box-shadow: 0 0 8px rgba(205, 184, 125, 0.6), inset 0 1px 2px rgba(255, 255, 255, 0.2);
  cursor: grab;
  transition: all 0.15s;
}

#wr-seek::-webkit-slider-thumb:hover,
#wr-volume::-webkit-slider-thumb:hover {
  box-shadow: 0 0 16px rgba(205, 184, 125, 0.8), inset 0 1px 2px rgba(255, 255, 255, 0.3);
  transform: scale(1.1);
}

#wr-seek::-webkit-slider-thumb:active,
#wr-volume::-webkit-slider-thumb:active {
  cursor: grabbing;
  transform: scale(0.95);
}

#wr-seek::-moz-range-thumb,
#wr-volume::-moz-range-thumb {
  width: 16px;
  height: 16px;
  background: var(--brass);
  border: 2px solid #0a0a0a;
  border-radius: 0;
  box-shadow: 0 0 8px rgba(205, 184, 125, 0.6), inset 0 1px 2px rgba(255, 255, 255, 0.2);
  cursor: grab;
  transition: all 0.15s;
}

/* Right: Signal meter & utilities */
.wr-utilities {
  display: flex;
  gap: 12px;
  align-items: center;
}

/* Make the Ads toggle text slightly smaller and let it size to content */
#wr-ads-toggle {
  font-size: 12px;
  width: auto;
  height: 32px;
  padding: 0 10px;
}

/* Signal strength meter */
.wr-signal-meter {
  display: flex;
  gap: 3px;
  align-items: flex-end;
  height: 32px;
  padding: 4px 8px;
  background: rgba(0, 0, 0, 0.5);
  border: 1px solid rgba(205, 184, 125, 0.3);
}

.signal-bar {
  width: 4px;
  background: rgba(28, 43, 59, 0.6);
  border: 1px solid rgba(205, 184, 125, 0.2);
  transition: all 0.3s ease;
}

.signal-bar:nth-child(1) {
  height: 25%;
}

.signal-bar:nth-child(2) {
  height: 40%;
}

.signal-bar:nth-child(3) {
  height: 55%;
}

.signal-bar:nth-child(4) {
  height: 70%;
}

.signal-bar:nth-child(5) {
  height: 85%;
}

.signal-bar:nth-child(6) {
  height: 100%;
}

.signal-bar.active {
  background: linear-gradient(to top, var(--ember), var(--brass));
  box-shadow: 0 0 6px rgba(205, 184, 125, 0.6);
  animation: signal-pulse 1.5s ease-in-out infinite;
}

@keyframes signal-pulse {

  0%,
  100% {
    opacity: 0.7;
  }

  50% {
    opacity: 1;
  }
}

.signal-bar:nth-child(1).active {
  animation-delay: 0s;
}

.signal-bar:nth-child(2).active {
  animation-delay: 0.1s;
}

.signal-bar:nth-child(3).active {
  animation-delay: 0.2s;
}

.signal-bar:nth-child(4).active {
  animation-delay: 0.3s;
}

.signal-bar:nth-child(5).active {
  animation-delay: 0.4s;
}

.signal-bar:nth-child(6).active {
  animation-delay: 0.5s;
}

/* Volume control */
.wr-volume-control {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 100px;
}

.wr-volume-icon {
  font-size: 14px;
  color: var(--brass);
}

#wr-volume-slider-container {
  position: relative;
  flex: 1;
  height: 6px;
}

/* Playlist panel */
#wr-playlist-panel {
  position: fixed;
  right: clamp(12px, 4vw, 32px);
  left: auto;
  bottom: calc(var(--wr-player-height, 120px) + 12px);
  width: min(420px, calc(100vw - 24px));
  max-height: min(70vh, calc(100vh - var(--wr-player-height, 120px) - 24px));
  background: linear-gradient(to bottom, #0f0f0f, #0a0a0a);
  border: 2px solid var(--brass);
  border-bottom: none;
  box-shadow: 0 -8px 32px rgba(0, 0, 0, 0.8);
  border-radius: 8px 8px 0 0;
  transform: translateY(calc(100% + 16px));
  opacity: 0;
  pointer-events: none;
  transition: transform 0.35s cubic-bezier(0.22, 0.61, 0.36, 1), opacity 0.25s ease;
  overflow: hidden;
  z-index: 999;
  display: flex;
  flex-direction: column;
}

#wr-playlist-panel.open {
  transform: translateY(0);
  opacity: 1;
  pointer-events: auto;
}

.wr-playlist-header {
  padding: 12px 16px;
  background: rgba(205, 184, 125, 0.08);
  border-bottom: 1px solid rgba(205, 184, 125, 0.3);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.wr-playlist-title {
  font-size: 14px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--brass);
  font-weight: 600;
}

.wr-playlist-count {
  font-size: 12px;
  color: rgba(227, 215, 180, 0.6);
}

#wr-playlist-items {
  overflow-y: auto;
  max-height: calc(100% - 56px);
  overscroll-behavior: contain;
  flex: 1;
}

/* Custom scrollbar */
#wr-playlist-items::-webkit-scrollbar {
  width: 8px;
}

#wr-playlist-items::-webkit-scrollbar-track {
  background: rgba(0, 0, 0, 0.4);
}

#wr-playlist-items::-webkit-scrollbar-thumb {
  background: rgba(205, 184, 125, 0.3);
  border: 1px solid rgba(205, 184, 125, 0.5);
}

#wr-playlist-items::-webkit-scrollbar-thumb:hover {
  background: rgba(205, 184, 125, 0.5);
}

/* Playlist items */
.playlist-item {
  padding: 10px 16px;
  display: grid;
  grid-template-columns: 30px 1fr auto;
  gap: 12px;
  align-items: center;
  border-bottom: 1px solid rgba(205, 184, 125, 0.1);
  cursor: pointer;
  transition: all 0.15s;
  position: relative;
}

.playlist-item::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 3px;
  background: var(--brass);
  opacity: 0;
  transition: opacity 0.2s;
}

.playlist-item:hover {
  background: rgba(205, 184, 125, 0.05);
}

.playlist-item.active {
  background: rgba(205, 184, 125, 0.08);
}

.playlist-item.active::before {
  opacity: 1;
}

.pl-index {
  font-size: 12px;
  color: rgba(227, 215, 180, 0.4);
  font-weight: 600;
  text-align: center;
}

.playlist-item.active .pl-index {
  color: var(--brass);
}

.pl-info {
  min-width: 0;
}

.pl-title {
  font-size: 13px;
  color: var(--sand);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 2px;
}

.playlist-item.active .pl-title {
  color: var(--brass);
  font-weight: 600;
}

.pl-freq {
  font-size: 10px;
  color: rgba(227, 215, 180, 0.5);
  letter-spacing: 0.08em;
}

.pl-duration {
  font-size: 12px;
  color: rgba(227, 215, 180, 0.6);
  font-variant-numeric: tabular-nums;
}

/* Responsive adjustments */
@media (max-width: 860px) {
  .wr-container {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .wr-controls {
    justify-content: center;
  }

  .wr-utilities {
    justify-content: space-between;
    width: 100%;
  }

  .wr-frequency-display {
    justify-content: center;
  }

  .wr-signal-meter {
    order: -1;
  }

  #wr-playlist-panel {
    left: clamp(8px, 4vw, 24px);
    right: clamp(8px, 4vw, 24px);
    width: auto;
  }
}

@media (max-width: 480px) {
  .wr-btn {
    width: 36px;
    height: 36px;
    font-size: 14px;
  }

  #wr-play {
    width: 44px;
    height: 44px;
    font-size: 18px;
  }

  #wr-frequency {
    font-size: 16px;
  }

  .wr-volume-control {
    min-width: 80px;
  }
}

/* Accessibility - keyboard focus states */
.wr-btn:focus-visible,
#wr-seek:focus-visible,
#wr-volume:focus-visible {
  outline: 2px solid var(--brass);
  outline-offset: 2px;
}

/* Subtle default shadow for cards/fragments across pages */
.card,
.fragment,
.tile.card,
.scrap,
.note {
  box-shadow: 2px 2px 8px rgba(0, 0, 0, 0.6);
  transition: box-shadow .2s ease, transform .2s ease;
}

.card:hover,
.fragment:hover,
.tile.card:hover,
.scrap:hover,
.note:hover {
  box-shadow: 3px 3px 12px rgba(0, 0, 0, 0.8);
  transform: translateY(-1px);
}

/* Loading state */
#wasteland-radio.loading .wr-btn {
  pointer-events: none;
  opacity: 0.5;
}

#wasteland-radio.loading #wr-track-title::after {
  content: "...";
  animation: loading-dots 1.5s infinite;
}

@keyframes loading-dots {

  0%,
  20% {
    content: ".";
  }

  40% {
    content: "..";
  }

  60%,
  100% {
    content: "...";
  }
}

/* Prefers reduced motion */
@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* Pressed flower overlays - shows when Anna's Flower is playing */
.wr-pressed-flower {
  position: fixed;
  opacity: 0;
  pointer-events: none;
  transition: opacity 1.2s ease, transform 0.3s ease;
  z-index: 998;
  filter: drop-shadow(0 4px 16px rgba(0, 0, 0, 0.5));
}

.wr-pressed-flower.visible {
  opacity: 0.75;
}

.wr-pressed-flower img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  filter: sepia(0.25) saturate(0.75) brightness(0.95);
}

/* Four flower positions - tastefully scattered */
.wr-pressed-flower.flower-1 {
  bottom: 140px;
  right: 30px;
  width: 160px;
  height: 160px;
  transform: rotate(-8deg);
}

.wr-pressed-flower.flower-1.visible {
  animation: gentle-sway-1 7s ease-in-out infinite;
}

.wr-pressed-flower.flower-2 {
  bottom: 130px;
  left: 25px;
  width: 140px;
  height: 140px;
  transform: rotate(12deg);
}

.wr-pressed-flower.flower-2.visible {
  animation: gentle-sway-2 8s ease-in-out infinite 0.5s;
}

.wr-pressed-flower.flower-3 {
  top: 120px;
  right: 40px;
  width: 150px;
  height: 150px;
  transform: rotate(-15deg);
}

.wr-pressed-flower.flower-3.visible {
  animation: gentle-sway-3 6.5s ease-in-out infinite 1s;
}

.wr-pressed-flower.flower-4 {
  top: 140px;
  left: 35px;
  width: 145px;
  height: 145px;
  transform: rotate(6deg);
}

.wr-pressed-flower.flower-4.visible {
  animation: gentle-sway-4 7.5s ease-in-out infinite 1.5s;
}

/* Unique sway animations for each flower */
@keyframes gentle-sway-1 {

  0%,
  100% {
    transform: rotate(-8deg) translateY(0);
  }

  50% {
    transform: rotate(-10deg) translateY(-5px);
  }
}

@keyframes gentle-sway-2 {

  0%,
  100% {
    transform: rotate(12deg) translateY(0) translateX(0);
  }

  50% {
    transform: rotate(14deg) translateY(-3px) translateX(2px);
  }
}

@keyframes gentle-sway-3 {

  0%,
  100% {
    transform: rotate(-15deg) translateY(0);
  }

  50% {
    transform: rotate(-13deg) translateY(-4px);
  }
}

@keyframes gentle-sway-4 {

  0%,
  100% {
    transform: rotate(6deg) translateY(0) translateX(0);
  }

  50% {
    transform: rotate(8deg) translateY(-6px) translateX(-2px);
  }
}

@media (max-width: 860px) {
  .wr-pressed-flower.flower-1 {
    width: 100px;
    height: 100px;
    bottom: 110px;
    right: 15px;
  }

  .wr-pressed-flower.flower-2 {
    width: 90px;
    height: 90px;
    bottom: 100px;
    left: 12px;
  }

  .wr-pressed-flower.flower-3 {
    width: 95px;
    height: 95px;
    top: 80px;
    right: 20px;
  }

  .wr-pressed-flower.flower-4 {
    width: 92px;
    height: 92px;
    top: 90px;
    left: 18px;
  }
}

.wr-frequency-display {
  white-space: nowrap;
  min-width: 150px;
  justify-content: center;
  flex-shrink: 0;
}

#wr-frequency {
  font-variant-numeric: tabular-nums;
  min-width: 110px;
  text-align: right;
}


.wr-track-info {
  flex-wrap: nowrap;
  overflow: hidden;

}

footer {
  padding-bottom: 180px !important;

  position: relative;

  z-index: 10;
}

/* Interactive cursor update */
a,
button,
.btn,
.tile,
.card,
.playlist-item,
.wr-btn,
input[type="range"] {
  cursor: pointer;
}

/* Tile Play Button Styles */
.tile .tag {
  align-self: flex-start;
  background: rgba(205, 184, 125, 0.15);
  color: black;
  padding: 0.4rem 0.9rem;
  border-radius: 4px;
  font-size: 0.85rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  transition: all 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
  border: 1px solid transparent;
}

.tile:hover .tag {
  background: #6b8e23;
  /* Wasteland Green */
  color: #fff;
  transform: scale(1.1) rotate(-3deg);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
  border-color: rgba(255, 255, 255, 0.2);
}

.tile.playing .tag {
  background: #6b8e23;
  color: #fff;
  box-shadow: 0 0 12px rgba(107, 142, 35, 0.6);
  border-color: rgba(255, 255, 255, 0.3);
}

.tile.playing .tag::after {
  content: "ING";
}