:root {
    --font-main: 'VT323', monospace;
    --text-primary: #fff;
    --text-secondary: #ccc;
    --bg-main: #000;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    font-family: var(--font-main);
    background-color: var(--bg-main);
    color: var(--text-primary);
    overflow: hidden;
    font-size: 16px;
}

#app {
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100vw;
    height: 100vh;
}

#screen {
    position: relative;
    width: 100%;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    background: var(--bg-main);
}

#video-container {
    position: relative;
    width: 100%;
    /* Calculate a 16:9 height, then take 90% of that value */
    height: calc(100vw * 9 / 16 * 0.9);
    max-height: 90vh; /* Ensure it doesn't exceed 90% of the viewport height */
    max-width: calc(92vh * 16 / 9); /* Fallback for very tall screens */
    overflow: hidden;
    box-shadow: 0 0 20px rgba(255, 255, 255, 0.1);
    border-radius: 15px; /* Added for rounded corners */
}

#player, #gif-container {
    position: absolute;
    top: -10%; left: -10%;
    width: 120%; height: 120%;
}

#gif-container { z-index: 5; }
#gif-player { width: 100%; height: 100%; object-fit: cover; }
.hidden { display: none !important; }

.click-blocker {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 2;
}

#video-container.low-power {
    filter: brightness(0.4) blur(10px);
    transition: filter 0.5s ease-in-out;
}

.crt-overlay {
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 100%;
    pointer-events: none;
    z-index: 10;
    /* Scanlines */
    background: repeating-linear-gradient(0deg, rgba(0,0,0,0.3) 0, rgba(0,0,0,0.3) 1px, transparent 1px, transparent 2px);
}
/* Vignette */
.crt-overlay::before {
    content: '';
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background: radial-gradient(circle, transparent 60%, rgba(0,0,0,0.8) 100%);
}
/* Screen Glow */
.crt-overlay::after {
    content: '';
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 100%;
    box-shadow: inset 0 0 40px rgba(255, 255, 255, 0.15);
}

.ui-header, .ui-footer {
    position: absolute;
    left: 0;
    width: 100%;
    padding: 15px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    z-index: 20;
}
.ui-header { top: 0; }
.ui-footer { bottom: 0; }

.media-controls { display: flex; align-items: center; gap: 15px; }
.media-controls button { background: none; border: none; color: var(--text-primary); font-size: 20px; cursor: pointer; display: flex; align-items: center; justify-content: center; }
#play-pause-button img { height: 32px; filter: invert(1); }
#prev-button img, #next-button img { height: 28px; filter: invert(1); }
.icon-prev { transform: scaleX(-1); }
.volume-bar { display: flex; gap: 4px; align-items: center; }
.volume-bar div {
    width: 12px;
    height: 12px;
    background: var(--text-primary);
    opacity: 0.3;
    border: 1px solid rgba(255, 255, 255, 0.2);
}
.volume-bar div.active { opacity: 1; }
#change-station { text-decoration: underline; cursor: pointer; }

.station-info {
    display: flex;
    align-items: center;
    width: 100%;
}

.seek-bar-container {
    flex-grow: 1;
    padding: 0 20px;
}

.seek-bar {
    width: 100%;
    height: 1px;
    background: var(--text-secondary);
    position: relative;
}

.seek-handle {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--text-primary);
    position: absolute;
    top: 50%;
    transform: translate(-50%, -50%);
    left: 0; /* JS will update this */
}

.video-overlay { position: absolute; z-index: 15; padding: 20px; }
.top-left { top: 0; left: 0; }
.top-right { top: 0; right: 0; text-align: right; }

.track-info, .listeners-info, .shortcuts { background: rgba(0,0,0,0.5); padding: 10px; }
.shortcuts b { color: var(--text-secondary); }

#about-button, #fullscreen-button {
    cursor: pointer;
    font-size: 24px;
    margin-left: 15px;
}

.listeners-info a {
    color: var(--text-primary);
    text-decoration: none;
}

.listeners-info a:hover {
    text-decoration: underline;
}

.video-list-container {
    position: fixed;
    top: 50%; left: 50%;
    transform: translate(-50%, -50%);
    width: 80%; max-width: 500px;
    background: rgba(0,0,0,0.9);
    padding: 20px;
    z-index: 30;
}
.video-list { list-style: none; max-height: 50vh; overflow-y: auto; }
.video-list li { padding: 8px; cursor: pointer; }
.video-list li:hover { background: var(--text-primary); color: var(--bg-main); }
