:root {
  --accent-red: #a30000; /* Used extensively; from global */
  --retro-blue: #008080; /* Unused in index but safe; from global */
  --retro-gray: #c0c0c0; /* For button defaults if needed; from global */
}
/* Font and Base - Mobile-first: Small fonts base, scale up; allow scroll on mobile */
@font-face {
    font-family: "OCR-A";
    src: url("/nc_assets/fonts/ocr-a-regular.ttf") format("truetype");
    font-weight: 400;
    font-style: normal;
    font-display: swap;
}
body {
    font-family: "OCR-A", "Courier New", monospace, "Noto Sans JP", sans-serif;
    color: #FFFFFF !important;
    background-color: #000000 !important;
    margin: 0;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    overflow-x: hidden;
    overflow-y: auto; /* Base: Allow scroll on mobile */
    font-size: 14px; /* Base small for mobile, scales with rem */
}
body::before {
    content: "";
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: url("/nc_assets/img/background.GIF"), url("https://via.placeholder.com/1920x1080/000000");
    background-repeat: no-repeat;
    background-position: center;
    background-size: cover;
    opacity: 1;
    z-index: -1 !important;
    image-rendering: pixelated; /* Preserve retro crispness on scale */
}
/* General styles - Add lazy-loading hint; compress images externally */
img {
    max-width: 100%;
    height: auto;
    display: block;
    image-rendering: pixelated; /* Retro preservation */
    /* Suggest adding loading="lazy" in HTML for performance */
}
a {
    color: var(--retro-blue);
    text-decoration: underline;
}
button {
    background: var(--retro-gray);
    border: 1px solid #000;
    padding: 0.5rem;
    cursor: pointer;
    min-width: 44px; /* Touch-friendly min */
    min-height: 44px;
}
button:hover {
    background: transparent;
    color: #fff;
}
/* Page Wrapper - Base mobile; add padding for fixed footer */
.page-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
    flex: 1;
    padding-bottom: 150px; /* Increased base padding for fixed footer on mobile (adjust based on actual height) */
}
/* Header - Mobile stack */
.retro-header {
    width: 100%;
    background-color: transparent;
    padding: 5px;
}
.banner-container {
    display: flex;
    flex-direction: column; /* Mobile-first stack */
    width: 100%;
    height: auto;
    border: 1px solid #a30000;
    align-items: stretch;
}
.banner-image {
    flex: 1 1 0;
    min-width: 0;
    width: 100%; /* Ensure full width stretch */
    height: auto; /* Auto height to preserve aspect without clipping */
    object-fit: cover; /* Changed to cover: Fills space without gaps, may crop edges for retro banners */
    border: none;
}
/* Scrolling Banner - Smaller base */
.scrolling-banner {
    position: relative;
    width: 100%;
    height: 24px;
    background-color: rgba(0, 0, 0, 0.7);
    color: #FFFF00;
    font-size: 10px;
    line-height: 24px;
    overflow: hidden;
    white-space: nowrap;
    border-top: 1px solid var(--accent-red) !important;
    border-bottom: 1px solid var(--accent-red) !important;
    text-align: center;
    z-index: 2;
    margin: 5px 0;
}
.scrolling-banner span {
    position: absolute;
    top: 0;
    left: 0;
    transform: translateX(100vw);
    white-space: nowrap;
    animation: marquee 10s linear forwards;
    font-weight: bold;
    text-shadow: 1px 1px 1px #000000;
}
@keyframes marquee {
    0% { transform: translateX(100vw); }
    100% { transform: translateX(calc(-100vw - var(--text-width))); }
}
/* Navigation - Mobile row, wrap if needed */
.nav-links {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    padding: 5px;
    z-index: 3;
    margin: 5px 0;
    width: 100%;
}
.nav-links a {
    color: #FFFFFF;
    text-decoration: none;
    font-weight: bold;
    padding: 10px 15px; /* Touch-friendly */
    transition: color 0.2s, text-shadow 0.2s;
    text-shadow: 1px 1px 0 #000000;
    color: var(--accent-red); /* Mobile emphasis */
}
.nav-links a:hover {
    color: var(--accent-red);
    text-shadow: 2px 2px 2px #000000, -1px -1px 1px #FFFFFF;
}
h3 {
    font-family: "Courier New", monospace;
    text-shadow: 0 0 5px var(--accent-red),
    0 0 10px var(--accent-red),
    0 0 20px var(--accent-red);
}
/* Main Content - Mobile column */
.main-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
    gap: 30px;
    margin: 20px auto 0;
    padding: 5px;
    flex: 1;
}
.comment-box, .song-history {
    flex: 1;
    min-height: auto;
    padding: 15px;
    background-color: transparent;
    overflow-y: auto;
    text-align: center;
    z-index: 1;
    width: 100%;
}
.box-with-image {
    flex: 1;
    min-width: 0;
    min-height: auto;
    padding: 30px;
    background-image: url("/nc_assets/img/poke1.gif");
    background-repeat: no-repeat;
    background-position: center;
    background-size: contain;
    overflow-y: auto;
    text-align: center;
    z-index: 1;
    width: 100%;
}
.box-with-image .header-image {
    width: 100%;
    height: auto;
    margin-bottom: 10px;
    display: block;
}
.box-with-image p {
    font-size: 1rem; /* Scaled from 16px */
    font-weight: bold;
    margin: 0 0 10px;
    color: #FFFFFF;
}
.box-with-image ul {
    list-style: none;
    padding: 0;
    margin: 0;
}
.box-with-image ul li a {
    color: #D3D3D3;
    text-decoration: none;
    transition: color 0.3s;
}
.box-with-image ul li a:hover {
    color: #FFFFFF;
}
.comment-box h3, .song-history h3 {
    margin-bottom: 10px;
    text-transform: uppercase;
}
.listener-counter {
    font-size: 12px;
    color: #FFFF00 !important;
    margin-top: 10px;
}
.song-history ul {
    list-style: none;
    padding: 0;
    margin: 0;
}
.song-history ul li {
    color: #FFFF00;
}
/* Radio Footer - Relative for mobile, attached to bottom */
.radio-footer {
    position: relative; /* Changed: Not fixed, flows with content */
    width: 100%;
    display: flex; /* Changed to flex row for inline layout */
    flex-direction: row;
    align-items: center;
    justify-content: space-between; /* Space elements */
    padding: 5px;
    z-index: 10;
    gap: 5px;
    overflow: visible;
    height: auto;
    min-height: 60px; /* Reduced for compact mobile */
}
.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; /* Hide on mobile */
}
.radio-footer.hidden-metadata .left-section {
    transform: translateX(-150%);
    opacity: 0;
}
/* Left Section - Flex inline */
.left-section {
    display: flex;
    align-items: center;
    gap: 10px;
    max-width: 60%; /* Prevent overflow on long titles */
    transition: transform 0.3s ease-in-out, opacity 0.3s ease-in-out;
    will-change: transform, opacity;
    z-index: 1;
}
/* Album Art - Smaller mobile */
.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 */
.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; /* Fill space */
}
.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 - Inline flex for play */
.center-controls {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: center;
    gap: 5px; /* Tighter for mobile */
    z-index: 1;
    min-width: auto; /* Hug content */
}
/* LIVE Container - Hidden mobile */
.live-container {
    display: none;
}
/* Controls - Touch-friendly, inline */
.controls {
    display: flex;
    align-items: center;
    gap: 5px;
    position: relative;
    z-index: 1;
}
/* Volume Wrapper - Inline */
.volume-wrapper {
    display: flex;
    align-items: center;
    padding: 0 5px; /* Tighter */
    z-index: 1;
    position: relative;
}
.volume-btn {
    background: none;
    border: none;
    color: #FFFFFF;
    width: 44px; /* Min touch */
    height: 44px;
    cursor: pointer;
    transition: color 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
}
.volume-btn:hover,
.volume-btn:focus {
    color: var(--accent-red);
    outline: none;
    background: transparent !important;
}
.volume-slider {
    width: 0;
    opacity: 0;
    transition: width 0.3s, opacity 0.2s;
    accent-color: var(--accent-red);
    margin-left: 10px;
    height: 10px;
    background: #D3D3D3;
    border-radius: 5px;
    position: absolute;
    left: 100%;
    top: 50%;
    transform: translateY(-50%);
}
.volume-wrapper:hover .volume-slider,
.volume-slider:focus,
.volume-btn:focus + .volume-slider {
    width: 80px; /* Mobile shorter */
    opacity: 1;
}
/* Control Buttons */
.control-btn {
    background: none !important;
    border: none;
    color: #FFFFFF;
    width: 44px; /* Min touch */
    height: 44px;
    cursor: pointer;
    transition: color 0.3s, transform 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}
.control-btn:disabled {
    color: var(--accent-red);
    cursor: not-allowed;
}
.control-btn:hover:not(:disabled),
.control-btn:focus:not(:disabled) {
    color: var(--accent-red);
    transform: scale(1.1);
    outline: none;
    background: transparent !important;
}
/* Visualizer Toggle - Hidden on mobile for minimal layout */
.visualizer-toggle {
    display: none; /* Hide on mobile to match screenshot simplicity */
}
/* Live Indicator */
.live-indicator {
    font-size: 0.8em;
    color: var(--accent-red);
    font-weight: bold;
    margin-left: 10px;
    animation: blink 1s infinite;
}
@keyframes blink {
    50% { opacity: 0.5; }
}
/* Visitor Counter - Hidden on mobile */
.visitor-counter {
    display: flex;
    align-items: center;
    z-index: 100;
    padding: 3px;
    background: rgba(0, 0, 0, 0.5);
    border-radius: 4px;
    font-size: 0.8em;
    justify-self: end; /* Pin to right */
    position: relative; /* Relative to footer */
}
/* Visualizer */
.visualizer {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 60px;
    background: transparent;
    display: none;
    z-index: -1;
}
.visualizer.active {
    display: block;
}
canvas {
    width: 100%;
    height: 100%;
}
/* Popup Panel - Mobile full-width; adjust for fixed footer */
.popup-panel {
    position: fixed;
    left: 0 !important;
    right: auto !important;
    top: auto !important;
    bottom: -300px;
    width: 100% !important;
    height: fit-content;
    overflow-y: visible;
    padding: 15px;
    background: rgba(0, 0, 0, 0.8);
    border: 0;
    box-shadow: none;
    z-index: 12; /* Above fixed footer */
    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 !important;
    opacity: 0;
    will-change: bottom, opacity;
    max-height: 250px;
}
.popup-panel.visible {
    bottom: 150px; /* Adjusted higher to account for taller mobile footer */
    opacity: 1;
}
.popup-panel .close-btn {
    position: absolute;
    top: -3px;
    font-size: 1em;
    background: transparent !important;
    border: none !important;
    padding: 0 !important;
    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: 200px;
    height: auto;
    border: 1px solid var(--accent-red);
    margin: 0 auto 10px;
    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 */
.loading-indicator {
    animation: spin 1s linear infinite;
}
@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}
/* Media Queries - Mobile-first: Build up from small */
@media (min-width: 481px) {
    /* Adjustments for >480px (e.g., larger phones) */
    body {
        font-size: 16px; /* Scale fonts */
    }
    .banner-image {
        height: auto; /* Keep auto */
    }
    .scrolling-banner {
        font-size: 10px;
        height: 24px;
        line-height: 24px;
    }
    .nav-links {
        flex-direction: row;
        align-items: center;
        padding: 5px 0;
    }
    .nav-links a {
        padding: 8px 15px;
        color: #FFFFFF; /* Reset from mobile red */
    }
    .main-content {
        gap: 30px;
        margin-top: 20px;
        padding: 5px;
        width: 100%;
    }
    .box-with-image p {
        font-size: 1.25rem; /* Scale up */
    }
    .radio-footer {
        padding: 5px;
        gap: 5px;
    }
    .album-art {
        flex: 0 0 60px;
        height: 60px;
    }
    .track-title {
        font-size: 1em;
    }
    .track-artist {
        font-size: 0.9em;
    }
    .volume-btn,
    .control-btn,
    .visualizer-toggle {
        width: 44px;
        height: 44px;
    }
    .controls {
        gap: 10px;
    }
    .volume-wrapper:hover .volume-slider,
    .volume-slider:focus,
    .volume-btn:focus+.volume-slider {
        width: 80px;
    }
    .popup-panel {
        width: 90% !important;
        max-height: 300px;
        bottom: -300px;
    }
    .popup-panel.visible {
        bottom: 150px; /* Adjust for footer */
    }
    .visitor-counter {
        padding: 3px;
    }
    .page-wrapper {
        padding-bottom: 150px; /* Keep for fixed footer */
    }
}
@media (min-width: 769px) {
    /* Tablet+ : Row layouts */
    .banner-container {
        flex-direction: column; /* Still stack for portrait tablet */
        min-height: auto;
    }
    .banner-image {
        width: 100%;
        height: auto;
    }
    .scrolling-banner {
        font-size: 10px;
        height: 24px;
        line-height: 24px;
        margin-top: 5px;
        margin-bottom: 5px;
    }
    .nav-links {
        flex-direction: row;
        align-items: center;
        padding: 10px;
        margin: 5px 0;
    }
    .nav-links a {
        padding: 8px 15px;
    }
    .main-content {
        flex-direction: column;
        align-items: center;
        gap: 40px;
        margin-top: 20px;
        padding: 10px;
        width: 90%;
    }
    .box-with-image,
    .comment-box,
    .song-history {
        width: 100%;
        max-width: 600px;
        min-width: 0;
        min-height: auto;
    }
    .page-wrapper {
        padding-bottom: 110px; /* Adjust for tablet */
    }
    .radio-footer {
        grid-template-columns: 1fr;
        grid-template-rows: auto auto auto auto;
        min-height: 90px;
        height: auto;
        padding: 5px 10px;
        align-items: flex-start;
    }
    .left-section {
        max-width: none;
        justify-self: start;
    }
    .center-controls {
        flex-direction: row;
        gap: 10px;
        justify-content: center;
    }
    .volume-wrapper {
        justify-self: center;
        padding: 0;
    }
    .visitor-counter {
        grid-row: 4;
        justify-self: end;
        font-size: 0.8em;
    }
    .radio-footer::before {
        display: none;
    }
    .live-container {
        display: none;
    }
    .visualizer {
        height: 60px;
    }
    .track-info {
        max-width: 200px;
    }
    .volume-wrapper:hover .volume-slider,
    .volume-slider:focus,
    .volume-btn:focus+.volume-slider {
        width: 100px;
    }
    .popup-panel {
        width: 80% !important;
        max-height: 350px;
        bottom: -400px;
    }
    .popup-panel.visible {
        bottom: 110px;
    }
}
@media (min-width: 1025px) {
    /* Desktop: Full row layouts; no scroll */
    body {
        overflow-y: hidden; /* No scroll on desktop viewport */
    }
    .page-wrapper {
        padding-bottom: 90px; /* Fixed padding for desktop footer height */
    }
    .banner-container {
        flex-direction: row;
        flex-wrap: nowrap;
    }
    .banner-image {
        flex: 1 1 0;
        height: auto;
        object-fit: contain; /* Revert to contain for desktop to preserve full image */
    }
    .scrolling-banner {
        font-size: 14px;
        height: 32px;
        line-height: 30px;
        margin-top: 0;
        margin-bottom: 0;
    }
    .nav-links {
        flex-direction: row;
        flex-wrap: wrap;
        padding: 5px 0;
        margin: 0 0 10px 0;
    }
    .nav-links a {
        padding: 5px 15px;
    }
    .main-content {
        flex-direction: row;
        justify-content: space-between;
        align-items: flex-start;
        width: 100%;
        max-width: 1600px;
        gap: 60px;
        margin: 0 auto;
        padding-bottom: 0; /* No extra padding since no scroll */
        overflow-y: auto; /* Allow internal scroll if content overflows (but assume fits) */
    }
    .box-with-image {
        flex: 2;
        min-width: 600px;
        min-height: 408px;
        max-width: 600px;
    }
    .comment-box,
    .song-history {
        flex: 1;
        min-height: 408px;
        overflow-y: auto;
        max-width: 100%;
    }
    .radio-footer {
        display: grid;
        grid-template-columns: auto 1fr auto auto; /* Restore original grid */
        grid-template-rows: auto;
        height: 90px; /* Fixed height for desktop */
        padding: 10px 20px;
        align-items: center;
        min-height: auto;
        box-sizing: border-box; /* Include padding in height for precise vertical centering */
    }
    .left-section {
        grid-column: 1;
        grid-row: 1;
        max-width: 450px;
        justify-self: start;
    }
    .center-controls {
        position: absolute;
        left: 50%;
        top: 50%; /* Restored original vertical alignment */
        transform: translate(-50%, -50%);
        gap: 20px;
        min-width: auto;
    }
    .volume-wrapper {
        grid-column: 3;
        grid-row: 1;
        padding: 0 15px;
        justify-self: end;
    }
    .visitor-counter {
        grid-column: 4; /* Desktop column */
        grid-row: 1;
        position: static; /* Static in grid */
        bottom: auto;
        right: auto;
        padding-right: 0;
        font-size: 1em;
        justify-self: end;
    }
    .radio-footer::before {
        content: '';
        position: absolute;
        top: 0;
        left: 0;
        width: 100%;
        height: 1px;
        background: var(--accent-red);
        z-index: 0;
        display: block;
    }
    .live-container {
        display: flex; /* Restored: Visible on desktop */
        flex-direction: column;
        justify-content: center;
        align-items: center;
        position: relative;
        color: #D3D3D3;
        font-size: 0.9em;
        width: auto;
        z-index: 1;
        gap: 5px;
        text-align: center; /* Ensure overall centering */
    }
    #liveText {
        background: rgba(0, 0, 0, 0.8);
        padding: 0 10px;
        z-index: 1;
        text-align: center;
        width: fit-content; /* Added: Shrink-wrap to text width for precise midpoint centering */
        margin: 0 auto; /* Added: Extra centering safety */
        transform: translateX(-7px);
    }
    .visualizer-toggle {
        flex: 0 0 18px;
        background: none;
        border: none;
        color: #FFFFFF;
        width: 90px !important; /* Restored original size and display */
        height: 90px !important;
        cursor: pointer;
        transition: color 0.3s;
        position: relative;
        z-index: 1;
        display: flex; /* Restored: Visible on desktop */
        align-items: center;
        justify-content: center;
        margin-right: 20px;
    }
    .visualizer {
        height: 100px;
    }
    .track-info {
        max-width: 350px;
    }
    .album-art {
        flex: 0 0 80px;
        width: 80px;
        height: 80px;
    }
    .volume-btn,
    .control-btn {
        width: 50px;
        height: 50px;
    }
    .visualizer-toggle:hover,
    .visualizer-toggle:focus {
        color: var(--accent-red);
        outline: none;
        background: transparent !important;
    }
    .volume-wrapper:hover .volume-slider,
    .volume-slider:focus,
    .volume-btn:focus+.volume-slider {
        width: 150px;
    }
    .popup-panel {
        width: 300px !important;
        bottom: -480px;
    }
    .popup-panel.visible {
        bottom: 120px;
    }
    .popup-panel .popup-art {
        max-width: 280px;
    }
    .popup-panel .popup-title {
        font-size: 1.4em;
    }
    .popup-panel .popup-artist {
        font-size: 1.2em;
    }
}
/* Hide visitor counter on mobile/tablet */
@media (max-width: 1024px) {
    .visitor-counter {
        display: none; /* Remove from mobile */
    }
}