/* index.css - Updated for popupPanel centering, reduced border, animation reinforcement */
/* Variables from global.css (merged to remove dependency) */
: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 */
@font-face {
    font-family: "OCR-A";
    src: url("/nc_assets/fonts/ocr-a-regular.ttf") format("truetype");
    font-weight: 400; /* Added: Explicit weight for better browser matching */
    font-style: normal; /* Added: Explicit style */
    font-display: swap; /* Added: Swap to fallback during load, prevents FOUT */
}
body {
font-family: "OCR-A", "Courier New", monospace, "Noto Sans JP", sans-serif; /* Updated: Added system-ui fallback for robustness */
    color: #FFFFFF !important;
    background-color: #000000 !important;
    margin: 0;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    overflow-x: hidden;
    overflow-y: hidden; /* Prevent scroll */
}
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;
}
/* General styles merged from global (for img, button, a) */
img {
    max-width: 100%; /* Merged: Responsive images */
    height: auto;
    display: block;
}
a {
    color: var(--retro-blue); /* Merged default: Teal links */
    text-decoration: underline; /* Merged default: Underline */
}
button {
    background: var(--retro-gray); /* Merged default: Gray bg */
    border: 1px solid #000; /* Merged default: Black border */
    padding: 0.5rem; /* Merged default: Padding */
    cursor: pointer; /* Merged default: Pointer */
}
button:hover {
    background: transparent; /* Override to transparent (no cyan); matches footer preference */
    color: #fff; /* Keep white text on hover */
}
/* Page Wrapper */
.page-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
    flex: 1; /* Grow to fill space, push footer down */
}
/* Header (only for image banners now) */
.retro-header {
    width: 100%;
    background-color: transparent; /* Remove background to eliminate black bars */
}
.banner-container {
    display: flex;
    flex-direction: row;
    flex-wrap: nowrap;
    width: 100%;
    height: auto; /* Let images determine height */
    border: 1px solid #a30000; /* Single border around entire banner for flush fit */
    align-items: stretch; /* Ensure images stretch to fill without extra space */
}
.banner-image {
    flex: 1 1 0;
    min-width: 0;
    height: auto;
    object-fit: contain; /* Preserve aspect ratio */
    border: none; /* Remove individual borders */
}
/* Scrolling Banner - Position:relative for containment */
.scrolling-banner {
    position: relative;
    width: 100%;
    height: 32px;
    background-color: rgba(0, 0, 0, 0.7);
    color: #FFFF00;
    font-size: 14px;
    line-height: 30px;
    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-top: 0;
    margin-bottom: 0;
}
.scrolling-banner span {
    position: absolute;
    top: 0;
    left: 0;
    transform: translateX(100vw);
    white-space: nowrap;
    animation: marquee 10s linear forwards;
    font-weight: bold; /* Added: Bold text for readability */
    text-shadow: 1px 1px 1px #000000; /* Added: Subtle shadow to reduce blur during animation */
}
@keyframes marquee {
    0% { transform: translateX(100vw); }
    100% { transform: translateX(calc(-100vw - var(--text-width))); }
}
/* Navigation */
.nav-links {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    padding: 5px 0;
    z-index: 3;
    margin: 0 0 10px 0;
    width: 100%;
}
.nav-links a {
    color: #FFFFFF;
    text-decoration: none;
    font-weight: bold;
    padding: 5px 15px;
    transition: color 0.2s, text-shadow 0.2s;
    text-shadow: 1px 1px 0 #000000;
}
.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 */
.main-content {
    display: flex;
    flex-direction: row;
    justify-content: space-between;
    align-items: flex-start;
    width: 100%;
    max-width: 1600px;
    gap: 60px;
    margin: 0 auto;
    flex: 1;
}
.comment-box, .song-history {
    flex: 1;
    min-height: 408px;
    padding: 15px;
    background-color: transparent;
    overflow-y: auto;
    text-align: center;
    z-index: 1;
}
.box-with-image {
    flex: 2;
    min-width: 600px;
    min-height: 408px;
    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;
}
.box-with-image .header-image {
    width: 100%;
    height: auto;
    margin-bottom: 10px;
    display: block;
}
.box-with-image p {
    font-size: 20px;
    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; /* Adjusted: !important to prevent loss/inheritance issues */
    margin-top: 10px;
}
.song-history ul {
    list-style: none;
    padding: 0;
    margin: 0;
}
.song-history ul li {
    color: #FFFF00; /* Explicit white to match screenshot; change to #FFFF00 if that's what was lost */
}
/* Radio Footer */
.radio-footer {
    display: grid;
    grid-template-columns: auto 1fr auto auto; /* Added extra column for visitor-counter */
    align-items: center;
    width: 100%;
    padding: 10px 20px;
    margin-top: auto; /* Stick to bottom via flex */
    z-index: 10;
    gap: 10px;
    overflow: visible;
    position: relative; /* Anchor for absolute center */
}
.radio-footer .footer-bg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: transparent; /* Removed black bar */
    z-index: 0;
    grid-column: 1 / -1; /* Span full */
}
.radio-footer::before {
    content: '';
    position: absolute;
    top: 0; /* Top border */
    left: 0;
    width: 100%;
    height: 1px;
background: var(--accent-red); /* Updated: Use accent red for consistency */
    z-index: 0;
}
.radio-footer.hidden-metadata .left-section {
    transform: translateX(-150%);
    opacity: 0;
}
/* Left Section */
.left-section {
    grid-column: 1;
    display: flex;
    align-items: center;
    gap: 10px;
    max-width: 450px; /* Increased as per request */
    transition: transform 0.3s ease-in-out, opacity 0.3s ease-in-out;
    will-change: transform, opacity;
    z-index: 1;
}
/* Album Art */
.album-art {
    flex: 0 0 80px;
    width: 80px; /* Added: Explicit width for consistency */
    height: 80px; /* Adjusted: Fixed height to prevent spill on tall images */
    border: 1px solid var(--accent-red);
    object-fit: cover; /* Adjusted: Crop to fill square (matches old global), prevent distortion/spill */
    cursor: pointer;
    transition: transform 0.3s ease-in-out;
}
/* Track Info */
.track-info {
    display: flex;
    flex-direction: column;
    justify-content: center;
    max-width: 350px; /* Increased as per request */
    max-height: 80px;
    cursor: pointer;
    transition: transform 0.3s ease-in-out;
}
.track-title {
    font-size: 1.2em;
    font-weight: bold;
    font-family: "OCR-A", monospace;
    text-overflow: ellipsis;
    white-space: nowrap; /* Kept for truncation if needed */
    color: #FFFF00;
    margin-bottom: 2px;
}
.track-artist {
    font-size: 1.1em;
    color: #D3D3D3;
    text-overflow: ellipsis;
    white-space: nowrap; /* Kept for truncation if needed */
}
/* Center Controls */
.center-controls {
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    display: flex;
    flex-direction: row; /* Row for play | LIVE+visualizer | volume */
    align-items: center;
    justify-content: center;
    gap: 20px; /* Spacing between main elements */
    z-index: 1;
    min-width: 250px; /* Adjusted for new layout */
}
/* LIVE Container (Restore bar polish) */
.live-container {
    display: flex;
    flex-direction: column; /* Column: Text above visualizer toggle */
    justify-content: center;
    align-items: center;
    position: relative;
    color: #D3D3D3;
    font-size: 0.9em;
    width: auto;
    z-index: 1;
    gap: 5px; /* Small gap between LIVE text and toggle */
}
#liveText {
    background: rgba(0, 0, 0, 0.8);
    padding: 0 10px;
    z-index: 1;
}
/* Controls */
.controls {
    flex: 0 0 auto;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 20px;
    position: relative;
    z-index: 1;
}
/* Volume Wrapper (Right, column 3) */
.volume-wrapper {
    grid-column: 3;
    display: flex;
    align-items: center;
    padding: 0 15px;
    z-index: 1;
    position: relative; /* Added: Relative for absolute child positioning */
}
.volume-btn {
    background: none;
    border: none;
    color: #FFFFFF;
    width: 55px;
    height: 55px;
    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; /* Added: Absolute to overlay without pushing */
    left: 100%; /* Start right of button */
    top: 50%;
    transform: translateY(-50%);
}
.volume-wrapper:hover .volume-slider,
.volume-slider:focus,
.volume-btn:focus + .volume-slider {
    width: 150px;
    opacity: 1;
}
/* Control Buttons */
.control-btn {
    background: none !important; /* Adjusted: !important to force transparent, prevent breakage */
    border: none;
    color: #FFFFFF;
    width: 50px;
    height: 50px;
    cursor: pointer;
    transition: color 0.3s, transform 0.2s;
    display: flex; /* Added for SVG centering */
    align-items: center; /* Added for SVG centering */
    justify-content: center; /* Added for SVG centering */
}
.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; /* Added: Override global hover background */
}
/* Visualizer Toggle */
.visualizer-toggle {
    flex: 0 0 18px; /* Increased from 18 */
    background: none;
    border: none;
    color: #FFFFFF;
    width: 90px !important; /* Increased; !important to override potential conflicts */
    height: 90px !important; /* Increased; !important for safety */
    cursor: pointer;
    transition: color 0.3s;
    position: relative;
    z-index: 1;
    display: flex;
    align-items: center;
    justify-content: center;
}
.visualizer-toggle:hover,
.visualizer-toggle:focus {
    color: var(--accent-red);
    outline: none;
    background: transparent !important;
}
/* 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 - Pinned to viewport bottom-right */
.visitor-counter {
    position: fixed; /* Fixed to viewport */
    bottom: 10px; /* Spacing from bottom edge */
    right: 10px; /* Spacing from right edge */
    display: flex;
    align-items: center;
    z-index: 100; /* High z-index to ensure above footer/other elements */
    padding: 5px; /* Optional: Light padding for aesthetics */
    background: rgba(0, 0, 0, 0.5); /* Optional: Semi-transparent bg to blend with dark theme */
    border-radius: 4px; /* Optional: Rounded corners */
}

/* Remove grid positioning (now irrelevant with fixed) */
.radio-footer .visitor-counter {
    grid-column: auto; /* Reset to default */
    grid-row: auto; /* Reset to default */
    justify-self: auto;
    padding-right: 0; /* Remove old padding */
}
/* Visualizer - Behind footer */
.visualizer {
    position: fixed; /* Changed: Fixed to bottom viewport */
    bottom: 0;
    left: 0;
    width: 100%;
    height: 100px; /* Reduced: Subtle behind footer */
    background: transparent;
    display: none;
    z-index: -1; /* Behind everything */
}
.visualizer.active {
    display: block;
}
canvas {
    width: 100%;
    height: 100%;
}
/* Popup Panel - Spotify-like layout, fixed clipping, enhanced animation */
.popup-panel {
    position: fixed;
    left: 0 !important;
    right: auto !important;
    top: auto !important;
    bottom: -480px; /* Offscreen */
    width: 300px !important;
    height: fit-content; /* Added: Auto-size based on content, extends upwards */
    overflow-y: visible; /* Added: No scrollbar, allow overflow if extreme */
    padding: 15px;
    background: rgba(0, 0, 0, 0.8);
    border: 0;
    box-shadow: none; /* Removed shadow to avoid clip illusion */
    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 !important;
    opacity: 0;
    will-change: bottom, opacity; /* Optimize animation */
}
.popup-panel.visible {
    bottom: 120px; /* Adjusted: Position just above 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: 100%;
    max-width: 280px;
    height: auto;
    border: 1px solid var(--accent-red);
    margin: 0 auto 10px;
    display: block;
}
.popup-panel .popup-title {
    font-size: 1.4em;
    margin: 0;
    color: #FFFF00; /* Yellow to match footer */
    text-align: center;
}
.popup-panel .popup-artist {
    font-size: 1.2em;
    margin: 0;
    color: #D3D3D3; /* Light gray to match footer */
    text-align: center;
}
/* Loading Indicator Animation */
.loading-indicator {
    animation: spin 1s linear infinite;
}
@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}
/* Media Queries - Pure flex, no absolutes */
@media (max-width: 1024px) {
    .retro-header {
        padding: 5px;
    }
    .banner-container {
        flex-direction: column;
        min-height: auto;
    }
    .banner-image {
        width: 100%;
        height: 100px;
    }
    .scrolling-banner {
        font-size: 10px;
        height: 24px;
        line-height: 24px;
        margin-top: 5px;
        margin-bottom: 5px;
    }
    .nav-links {
        padding: 10px 0;
        margin: 5px 0;
    }
    .main-content {
        flex-direction: column;
        gap: 40px;
        margin-top: 20px;
        padding-bottom: 100px;
        max-width: 100%;
    }
    .box-with-image {
        min-width: 300px;
        max-width: 600px;
        flex: 1;
    }
    .comment-box,
    .song-history {
        overflow-y: auto;
    }
    .page-wrapper {
        padding-bottom: 90px;
    }
    .radio-footer {
        height: 90px;
    }
    .popup-panel {
        bottom: -400px;
        width: 80% !important;
        max-height: 350px;
    }
    .popup-panel.visible {
        bottom: 90px;
    }
}
@media (max-width: 768px) {
    .retro-header {
        padding: 5px;
    }
    .banner-container {
        flex-direction: column;
        min-height: auto;
    }
    .banner-image {
        width: 100%;
        height: 100px;
    }
    .scrolling-banner {
        font-size: 10px;
        height: 24px;
        line-height: 24px;
        margin-top: 5px;
        margin-bottom: 5px;
    }
    .nav-links {
        flex-direction: column;
        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; /* Adjusted */
    }
    .radio-footer {
        grid-template-columns: 1fr; /* Stack to single column */
        grid-template-rows: auto auto auto; /* Rows for left, center, right (combine volume + counter) */
        min-height: 90px;
        height: auto;
        padding: 5px 10px;
        align-items: flex-start; /* Mobile upward align */
    }
    .left-section {
        grid-column: 1;
        grid-row: 1;
        max-width: none; /* Full width on mobile */
        justify-self: start;
    }
    .center-controls {
        position: static;
        transform: none;
        grid-column: 1;
        grid-row: 2;
        flex-direction: row;
        gap: 10px;
        justify-content: center;
    }
    .volume-wrapper {
        grid-column: 1;
        grid-row: 3;
        justify-self: center; /* Center on mobile */
        padding: 0;
    }
    .visitor-counter {
        bottom: 5px; /* Tighter spacing on mobile */
        right: 5px;
        font-size: 0.8em; /* Smaller if text-based; adjust if script renders image */
    }
    .radio-footer::before {
        display: none; /* Hide bar on mobile */
    }
    .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: 90% !important;
        max-height: 300px;
    }
}
@media (max-width: 480px) {
    .retro-header {
        padding: 5px;
    }
    .banner-container {
        flex-direction: column;
        min-height: auto;
    }
    .banner-image {
        width: 100%;
        height: 100px;
    }
    .scrolling-banner {
        font-size: 10px;
        height: 24px;
        line-height: 24px;
        margin-top: 5px;
        margin-bottom: 5px;
    }
    .nav-links {
        flex-direction: row;
        padding: 5px;
        width: 100%;
        margin: 5px 0;
    }
    .nav-links a {
        padding: 10px 15px;
        color: var(--accent-red);
    }
    .main-content {
        gap: 30px;
        margin-top: 20px;
        padding: 5px;
        width: 100%;
    }
    .box-with-image p {
        font-size: 16px;
    }
    .radio-footer {
        padding: 5px;
        gap: 5px;
    }
    .page-wrapper {
        padding-bottom: 110px;
    }
    .album-art {
        flex: 0 0 60px;
        height: auto;
        max-height: 100%;
        margin-right: 5px;
    }
    .track-title {
        font-size: 1em;
    }
    .track-artist {
        font-size: 0.9em;
    }
    .volume-btn,
    .control-btn,
    .visualizer-toggle {
        width: 32px;
        height: 32px;
    }
    .controls {
        gap: 10px;
    }
    .volume-wrapper {
        padding: 0 10px;
    }
    .volume-wrapper:hover .volume-slider,
    .volume-slider:focus,
    .volume-btn:focus+.volume-slider {
        width: 80px;
    }
    .visualizer-toggle {
        margin-right: 20px;
    }
    .popup-panel {
        width: 100% !important;
        bottom: -300px;
        max-height: 250px;
    }
    .popup-panel.visible {
        bottom: 90px;
    }
    .popup-panel .popup-art {
        width: 200px;
        height: auto;
    }
    .popup-panel .popup-title {
        font-size: 1.2em;
    }
    .popup-panel .popup-artist {
        font-size: 1em;
    }
    .visitor-counter {
        bottom: 5px;
        right: 5px;
        padding: 3px; /* Even tighter */
    }
}