:root {
  --accent-red: #a30000;
  --retro-blue: #008080;
  --retro-gray: #c0c0c0;
  --base-font-size: 16px;
  --gutter: 1rem;
}

* {
  box-sizing: border-box;
}

body {
  font-family: "Helvetica", "Arial", sans-serif;
  color: #FFFFFF;
  background-color: #FFFFFF;
  margin: 0;
  min-height: 100vh;
  overflow-x: hidden;
  padding-bottom: 6rem;
  font-size: var(--base-font-size);
}

.header {
  position: relative;
  width: 100%;
  height: 2.5rem;
  background-color: #FFFFFF;
  display: flex;
  align-items: center;
  justify-content: space-between;
  text-align: left;
  padding: 0 1.25rem;
}

.header h1 {
  font-family: "Courier New", monospace;
  font-size: 1.5rem;
  font-weight: normal;
  text-shadow: 0.0625rem 0.0625rem 0.125rem #000000;
  margin: 0;
  color: #000000;
}

.header h1 a {
  text-decoration: none;
  color: inherit;
}

.earth-button {
  width: 2.75rem;
  height: 2.75rem;
  background: url('/nc_assets/img/earth.png') no-repeat center / cover;
  border-radius: 50%;
  border: none;
  cursor: pointer;
  transition: transform 0.3s;
  will-change: transform;
}

.earth-button:hover {
  transform: scale(1.1);
}

.popup {
  position: fixed;
  top: -100%;
  left: 0;
  width: 100%;
  height: 100%;
  background: url('/nc_assets/img/moon.jpg') no-repeat center / cover;
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 1000;
  transition: top 1s ease;
}

.popup.active {
  top: 0;
}

.popup-text {
  padding: 0.3125rem;
  border-radius: 0.3125rem;
  text-align: center;
  max-width: 80%;
  font-size: 1.125rem;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.close-button {
  border: none;
  width: 20%;
  cursor: pointer;
  transition: background-color 0.3s;
}

.close-button:hover {
  color: #000000;
}

.spacer {
  width: 100%;
  max-width: 100vw;
  margin: 0 auto 1.25rem;
  text-align: center;
  overflow: hidden;
  transition: transform 0.3s ease;
  will-change: transform;
}

.spacer svg {
  width: 100%;
  max-width: 100%;
  height: auto;
  fill: #FFFFFF;
}

.spacer svg path {
  stroke: #000000;
  stroke-width: 2px;
  transition: stroke 0.3s ease, stroke-width 0.3s ease, filter 0.3s ease;
}

.intro-text {
  text-align: center;
  padding: 1.25rem 0;
  font-size: 1rem;
  color: #000000;
}

.intro-text a {
  color: var(--accent-red);
  text-decoration: none;
  font-weight: bold;
  transition: color 0.3s;
}

.intro-text a:hover {
  color: #000000;
}

.grid-wrapper {
  max-width: 100%;
  margin: 0 auto;
  padding: 0 0.625rem;
  overflow: hidden;
  box-sizing: border-box;
}

.art-grid {
  position: relative;
  width: 100%;
  height: auto;
  margin: 0 auto;
  padding: 0;
  overflow: hidden;
}

.grid-sizer,
.art-item {
  width: 100%;
  margin: 0 0 1rem 0;
  box-sizing: border-box;
}

.art-item {
  background-color: #000000;
  border-radius: 1rem;
  text-align: center;
  transition: transform 0.3s, box-shadow 0.3s, opacity 0.3s;
  will-change: transform, opacity;
  box-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.1);
}

.art-item:hover {
  transform: scale(1.05);
  box-shadow: 0 0.5rem 1rem rgba(163, 0, 0, 0.3);
  opacity: 0.95;
}

.art-item img {
  width: 100%;
  height: auto;
  object-fit: cover;
  margin-bottom: 0.625rem;
  border-radius: 0.5rem;
  display: block;
}

.art-item p {
  margin: 0;
  font-size: 0.875rem;
  color: #FFFFFF;
}

/* Radio Footer Styles (Merged from index.css for consistency) */
.radio-footer {
   position: fixed; /* Changed back to fixed to pin to viewport bottom */
    bottom: 0; /* Pin to bottom */
    left: 0; /* Full width */
    right: 0; /* Full width */
    width: 100%;
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    padding: 5px;
    margin-top: auto;
    z-index: 10;
    gap: 5px;
    overflow: visible;
    height: auto;
    min-height: 60px;
    background-color: rgba(0, 0, 0, 0.8);
}

.radio-footer .footer-bg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: transparent;
    z-index: 0;
}

.radio-footer::before {
    display: none;
}

.radio-footer.hidden-metadata .left-section {
    transform: translateX(-150%);
    opacity: 0;
}

.left-section {
    display: flex;
    align-items: center;
    gap: 10px;
    max-width: 60%;
    transition: transform 0.3s ease-in-out, opacity 0.3s ease-in-out;
    will-change: transform, opacity;
    z-index: 1;
}

.album-art {
    flex: 0 0 60px;
    width: 60px;
    height: 60px;
    border: 1px solid var(--accent-red);
    object-fit: cover;
    cursor: pointer;
    transition: transform 0.3s ease-in-out;
}

.track-info {
    display: flex;
    flex-direction: column;
    justify-content: center;
    max-width: 200px;
    max-height: 60px;
    cursor: pointer;
    transition: transform 0.3s ease-in-out;
    flex-grow: 1;
}

.track-title {
    font-size: 1em;
    font-weight: bold;
    font-family: "OCR-A", monospace;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: #FFFF00;
    margin-bottom: 2px;
}

.track-artist {
    font-size: 0.9em;
    color: #D3D3D3;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.center-controls {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: center;
    gap: 5px;
    z-index: 1;
    min-width: auto;
}

.live-container {
    display: none;
}

.controls {
    display: flex;
    align-items: center;
    gap: 5px;
    position: relative;
    z-index: 1;
}

.volume-wrapper {
    display: flex;
    align-items: center;
    padding: 0 5px;
    z-index: 1;
    position: relative;
}

.volume-btn,
.control-btn,
.visualizer-toggle {
    background: none;
    border: none;
    color: #FFFFFF;
    width: 44px;
    height: 44px;
    cursor: pointer;
    transition: color 0.3s, transform 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.volume-btn:hover,
.volume-btn:focus,
.control-btn:hover:not(:disabled),
.control-btn:focus:not(:disabled),
.visualizer-toggle:hover,
.visualizer-toggle:focus {
    color: var(--accent-red);
    transform: scale(1.1);
    outline: none;
    background: transparent;
}

.control-btn:disabled {
    color: var(--accent-red);
    cursor: not-allowed;
}

.volume-slider {
    width: 0;
    opacity: 0;
    transition: width 0.3s, opacity 0.2s;
    accent-color: var(--accent-red);
    margin-left: 0.625rem;
    height: 0.625rem;
    background: #D3D3D3;
    border-radius: 0.3125rem;
    position: absolute;
    left: 100%;
    top: 50%;
    transform: translateY(-50%);
}

.volume-wrapper:hover .volume-slider,
.volume-slider:focus,
.volume-btn:focus + .volume-slider {
    width: 5rem;
    opacity: 1;
}

.live-indicator {
    font-size: 0.8em;
    color: var(--accent-red);
    font-weight: bold;
    margin-left: 0.625rem;
    animation: blink 1s infinite;
}

@keyframes blink {
  50% { opacity: 0.5; }
}

.visitor-counter {
  position: fixed;
  bottom: 0.3125rem;
  right: 0.3125rem;
  display: flex;
  align-items: center;
  z-index: 100;
  padding: 0.1875rem;
  background: rgba(0, 0, 0, 0.5);
  border-radius: 0.25rem;
  font-size: 0.8em;
}

.visualizer {
  position: fixed;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 3.75rem;
  background: transparent;
  display: none;
  z-index: -1;
  will-change: transform;
}

.visualizer.active {
  display: block;
}

canvas {
  width: 100%;
  height: 100%;
}

.popup-panel {
  position: fixed;
  left: 0;
  bottom: -18.75rem;
  width: 100%;
  height: fit-content;
  overflow-y: visible;
  padding: 0.9375rem;
  background: rgba(0, 0, 0, 0.8);
  border: 0;
  box-shadow: none;
  z-index: 12;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  transition: bottom 0.3s ease-in-out, opacity 0.3s ease-in-out;
  opacity: 0;
  will-change: bottom, opacity;
}

.popup-panel.visible {
  bottom: 5.625rem;
  opacity: 1;
}

.popup-panel .close-btn {
  position: absolute;
  top: -0.1875rem;
  font-size: 1em;
  background: transparent;
  border: none;
  padding: 0;
  color: #FF0000;
  cursor: pointer;
}

.popup-panel .close-btn:hover,
.popup-panel .close-btn:focus {
  color: var(--accent-red);
}

.popup-panel .popup-header {
  margin: 0;
}

.popup-panel .popup-art {
  width: 100%;
  max-width: 12.5rem;
  height: auto;
  border: 1px solid var(--accent-red);
  margin: 0 auto 0.625rem;
  display: block;
}

.popup-panel .popup-title {
  font-size: 1.2em;
  margin: 0;
  color: #FFFF00;
  text-align: center;
}

.popup-panel .popup-artist {
  font-size: 1em;
  margin: 0;
  color: #D3D3D3;
  text-align: center;
}

.loading-indicator {
  animation: spin 1s linear infinite;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* Medium screens (481px+) */
@media (min-width: 30rem) {
  .grid-sizer,
  .art-item {
    width: calc(50% - var(--gutter)/2);
    margin: 0 0 var(--gutter) 0;
  }
  .art-grid {
    padding: 0 calc(var(--gutter)/2);
  }
  body {
    padding-bottom: 7.5rem;
  }
  .album-art {
    flex: 0 0 5rem;
    height: 5rem;
  }
  .track-info {
    max-width: 21.875rem;
  }
  .track-title {
    font-size: 1.2em;
  }
  .track-artist {
    font-size: 1.1em;
  }
  .volume-btn,
  .control-btn,
  .visualizer-toggle {
    width: 3.125rem;
    height: 3.125rem;
  }
  .volume-wrapper:hover .volume-slider,
  .volume-slider:focus,
  .volume-btn:focus + .volume-slider {
    width: 6.25rem;
  }
  .popup-panel.visible {
    bottom: 5.625rem;
  }
  .popup-panel .popup-art {
    max-width: 17.5rem;
  }
  .popup-panel .popup-title {
    font-size: 1.4em;
  }
  .popup-panel .popup-artist {
    font-size: 1.2em;
  }
  .visualizer {
    height: 6.25rem;
  }
}

/* Large screens (769px+) */
@media (min-width: 48.0625rem) {
  .grid-sizer,
  .art-item {
    width: calc(33.333% - (2 * var(--gutter)/3));
  }
  .left-section {
    max-width: 28.125rem;
  }
  .center-controls {
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    gap: 1.25rem;
  }
  .volume-wrapper {
    justify-self: end;
  }
  .live-container {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    position: relative;
    color: #D3D3D3;
    font-size: 0.9em;
    width: auto;
    z-index: 1;
    gap: 0.3125rem;
  }
#liveText {
    background: rgba(0, 0, 0, 0.8);
    padding: 0 10px;
    z-index: 1;
    text-align: center;
    width: fit-content;
    margin: 0 auto;
    transform: translateX(0px); /* Horizontal nudge for midpoint centering, matching index.css */
    position: relative; /* Enable relative positioning */
    top: 20px;
  }
  .radio-footer::before {
    display: block;
  }
  .volume-wrapper:hover .volume-slider,
  .volume-slider:focus,
  .volume-btn:focus + .volume-slider {
    width: 9.375rem;
  }
  .visualizer-toggle {
    width: 5.625rem;
    height: 5.625rem;
  }
  .visitor-counter {
    bottom: 0.625rem;
    right: 0.625rem;
    font-size: 1em;
    padding: 0.3125rem;
  }
}

/* Extra large screens (1025px+) */
@media (min-width: 75rem) {
  .grid-sizer,
  .art-item {
    width: calc(25% - 1rem);
  }
  .art-grid {
    max-width: 120rem;
    margin: 0 auto;
  }
  .popup-panel {
    left: 0;
    right: auto;
    width: 18.75rem;
    bottom: -30rem;
    max-height: none;
  }
  .popup-panel.visible {
    bottom: 7.5rem;
  }
}

/* Mobile override (max-width: 48rem) */
@media (max-width: 48rem) {
  .radio-footer {
    display: none;
  }
  body {
    padding-bottom: 0;
  }
  .visualizer {
    display: none;
  }
  .popup-panel.visible {
    bottom: 0;
  }
}

/* Hide visitor counter on mobile/tablet */
@media (max-width: 1024px) {
    .visitor-counter {
        display: none;
    }
}