/* ==========================================================================
   1. БАЗОВЫЕ НАСТРОЙКИ И ДИНАМИЧЕСКИЙ ЖИВОЙ RGB-ФОН
   ========================================================================== */
:root {
    /* Базовые значения каналов из ползунков */
    --user-r: 255;
    --user-g: 123;
    --user-b: 181;
    
    /* Сборщики основного цвета и свечения */
    --main-color: rgb(var(--user-r), var(--user-g), var(--user-b));
    --glow-color: rgba(var(--user-r), var(--user-g), var(--user-b), 0.4);
    
    /* Динамический расчет глубокого фона на основе выбранного цвета */
    --bg-start: rgb(calc(var(--user-r) * 0.1), calc(var(--user-g) * 0.06), calc(var(--user-b) * 0.15));
    --bg-mid: rgb(calc(var(--user-r) * 0.04), calc(var(--user-g) * 0.04), calc(var(--user-b) * 0.1));
    --bg-end: #03040b;
}

body {
    background: linear-gradient(180deg, var(--bg-start) 0%, var(--bg-mid) 50%, var(--bg-end) 100%);
    color: #fff;
    font-family: 'Segoe UI', Arial, sans-serif;
    margin: 0;
    height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden;
    position: relative;
    transition: background 0.5s ease;
}

/* Контейнер для динамических элементов аквариума */
.aquarium-back {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
    pointer-events: none;
}

/* Пузырьки воздуха */
.bubble {
    position: absolute;
    bottom: -20px;
    background: var(--glow-color);
    border: 1px solid rgba(var(--user-r), var(--user-g), var(--user-b), 0.3);
    border-radius: 50%;
    animation: rise linear infinite;
}

@keyframes rise {
    0% { transform: translateY(0) translateX(0); opacity: 0; }
    10% { opacity: 0.6; }
    90% { opacity: 0.6; }
    100% { transform: translateY(-105vh) translateX(var(--bounce)); opacity: 0; }
}

/* Анатомические неоновые рыбки */
.fish {
    position: absolute;
    width: 55px; 
    height: 30px;
    filter: drop-shadow(0 0 8px var(--main-color));
    animation-timing-function: linear;
    animation-iteration-count: infinite;
}

/* Элементы SVG рыбки меняются на лету */
.fish svg .fish-body {
    fill: radial-gradient(circle at 30% 50%, #ffffff 0%, var(--main-color) 80%) !important;
}
.fish svg .fish-fins {
    fill: var(--main-color) !important;
    opacity: 0.7;
}

@keyframes swim {
    0% { left: -70px; top: var(--start-y); }
    100% { left: 105vw; top: var(--end-y); }
}

@keyframes swim-left {
    0% { right: -70px; top: var(--start-y); }
    100% { right: 105vw; top: var(--end-y); }
}


/* ==========================================================================
   2. УГЛОВАЯ ЗАКЛАДКА И ВЫДВИЖНАЯ ШТОРКА (DRAWER)
   ========================================================================== */
.corner-tab {
    position: fixed;
    top: 0;
    left: 0;
    width: 0;
    height: 0;
    border-top: 75px solid rgba(255, 255, 255, 0.04);
    border-right: 75px solid transparent;
    z-index: 100;
    cursor: pointer;
    transition: border-color 0.3s;
}

.corner-tab span {
    position: absolute;
    top: -62px;
    left: 8px;
    font-size: 10px;
    font-weight: bold;
    color: var(--main-color);
    letter-spacing: 1px;
    text-shadow: 0 0 8px var(--main-color);
    user-select: none;
    transform: rotate(-45deg);
}

.corner-tab:hover {
    border-top-color: var(--glow-color);
}

.info-drawer {
    position: fixed;
    top: 0;
    left: -380px; 
    width: 360px;
    height: 100vh;
    background: rgba(15, 11, 20, 0.6);
    border-right: 1px solid rgba(255, 255, 255, 0.08);
    backdrop-filter: blur(25px);
    -webkit-backdrop-filter: blur(25px);
    z-index: 200;
    box-sizing: border-box;
    padding: 40px 20px;
    transition: left 0.4s cubic-bezier(0.1, 0.9, 0.2, 1);
    box-shadow: 15px 0 50px rgba(0,0,0,0.6);
}

.info-drawer.open { left: 0; }

.drawer-close-btn {
    position: absolute;
    top: 15px;
    right: 20px;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 8px; 
    width: 32px;
    height: 32px;
    display: flex;
    justify-content: center;
    align-items: center;
    color: #5c5066;
    font-size: 20px;
    cursor: pointer;
    line-height: 1;
    box-sizing: border-box;
    transition: all 0.3s;
    outline: none !important;
}
.drawer-close-btn:hover { 
    color: var(--main-color); 
    background: var(--glow-color);
    border-color: var(--main-color);
}

.drawer-content h2 {
    font-size: 16px;
    color: var(--main-color);
    margin-top: 20px;
    margin-bottom: 20px;
    letter-spacing: 2px;
    text-transform: uppercase;
}

#citySearch {
    width: 100%;
    padding: 10px 12px;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 10px;
    color: #fff;
    margin-bottom: 20px;
    box-sizing: border-box;
    outline: none;
    font-family: inherit;
}
#citySearch:focus { border-color: var(--main-color); }

.station-table { width: 100%; border-collapse: collapse; font-family: 'Courier New', Courier, monospace; font-size: 13px; margin-top: 10px; }
.station-table th { text-align: left; color: var(--main-color); padding: 12px 8px; border-bottom: 2px solid var(--main-color); font-family: 'Segoe UI', Arial, sans-serif; font-size: 12px; letter-spacing: 1px; text-transform: uppercase; }
.station-table td { padding: 10px 8px; border-bottom: 1px solid rgba(255,255,255,0.04); color: #dfd8e6; }
.status-online-tag { color: #00ff00; font-weight: bold; text-shadow: 0 0 5px #00ff00; }

.drawer-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.4);
    z-index: 150;
    display: none;
    opacity: 0;
    transition: opacity 0.3s;
}
.drawer-overlay.open { display: block; opacity: 1; }
/* ==========================================================================
   3. ИНТЕРФЕЙС ЦЕНТРАЛЬНОГО СТЕКЛЯННОГО ПЛЕЕРА
   ========================================================================== */
.player-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
    width: 320px;
    position: relative;
    z-index: 10;
}

.square-logo-tile {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.07);
    border-radius: 24px;
    padding: 20px;
    width: 320px;
    height: 320px;
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    box-shadow: 0 25px 60px rgba(0, 0, 0, 0.5), inset 0 1px 1px rgba(255, 255, 255, 0.1);
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    align-items: center;
}

.top-info { 
    width: 100%; 
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.station-title { 
    font-size: 20px; 
    font-weight: bold; 
    letter-spacing: 3px; 
    margin: 0 0 8px 0; 
    text-transform: uppercase; 
    color: var(--main-color); 
    text-shadow: 0 0 10px var(--glow-color); 
}

.track-marquee { 
    width: 100%; 
    overflow: hidden; 
    position: relative; 
    height: 20px;
    display: flex;
    justify-content: center;
}

#now-playing { 
    display: inline-block; 
    white-space: nowrap; 
    position: absolute; 
    font-size: 11px; 
    color: #a69bb0; 
    font-family: 'Courier New', Courier, monospace; 
    animation: scroll-text 12s linear infinite; 
    width: 100%;
}

@keyframes scroll-text {
    0% { transform: translateX(100%); }
    100% { transform: translateX(-100%); }
}

.logo-area { 
    display: flex; 
    justify-content: center; 
    align-items: center; 
    flex-grow: 1; 
    width: 100%; 
    margin-bottom: 10px; 
}

.wave { stroke: var(--main-color); opacity: 0.6; }
.skull { fill: var(--main-color); filter: drop-shadow(0 0 12px var(--main-color)); }

.external-controls { width: 100%; display: flex; flex-direction: column; gap: 15px; box-sizing: border-box; }
.controls-row { display: flex; justify-content: space-between; align-items: center; width: 100%; padding: 0 10px; box-sizing: border-box; }

.nav-arrow { 
    background: none; 
    border: none; 
    color: #42354c; 
    font-size: 24px; 
    cursor: pointer; 
    user-select: none; 
    transition: all 0.3s;
    outline: none;
    padding: 0 10px;
}
.nav-arrow:hover { color: var(--main-color); text-shadow: 0 0 10px var(--main-color); }
.nav-arrow:active { transform: scale(0.9); }

#playButton {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.06);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    color: var(--main-color);
    padding: 12px 28px;
    cursor: pointer;
    border-radius: 14px;
    font-weight: bold;
    font-size: 13px;
    letter-spacing: 1px;
    min-width: 120px;
    transition: 0.3s;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
}
#playButton:hover { background: var(--glow-color); border-color: var(--main-color); color: #fff; box-shadow: 0 0 15px var(--main-color); }

.volume-box { display: flex; align-items: center; background: rgba(255, 255, 255, 0.02); border: 1px solid rgba(255, 255, 255, 0.05); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); padding: 8px 14px; border-radius: 14px; box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2); }
.volume-label { font-size: 10px; font-weight: bold; color: #5c5066; margin-right: 12px; letter-spacing: 1px; }
#volumeSlider { flex-grow: 1; cursor: pointer; accent-color: var(--main-color); }


/* ==========================================================================
   4. ПУЛЬТ УПРАВЛЕНИЯ КАНАЛАМИ RGB И СВЕТЛЫЙ РЕЖИМ
   ========================================================================== */
.rgb-controller-box {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 100;
    display: flex;
    flex-direction: column;
    gap: 10px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.07);
    padding: 12px 16px;
    border-radius: 18px;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    box-shadow: 0 12px 35px rgba(0,0,0,0.4);
    width: 180px;
    box-sizing: border-box;
}

.rgb-slider-row { display: flex; align-items: center; width: 100%; gap: 10px; }
.rgb-lead { font-size: 11px; font-weight: bold; width: 12px; user-select: none; }
.r-lead { color: #ff4f4f; text-shadow: 0 0 5px rgba(255, 79, 79, 0.5); }
.g-lead { color: #4fff4f; text-shadow: 0 0 5px rgba(79, 255, 79, 0.5); }
.b-lead { color: #4f4fff; text-shadow: 0 0 5px rgba(79, 79, 255, 0.5); }

.rgb-controller-box input[type="range"] { flex-grow: 1; cursor: pointer; height: 4px; accent-color: #fff; }

.theme-toggle-btn {
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
    color: var(--main-color);
    padding: 6px;
    border-radius: 8px;
    cursor: pointer;
    font-weight: bold;
    font-size: 10px;
    letter-spacing: 0.5px;
    transition: 0.3s;
}
.theme-toggle-btn:hover { background: var(--glow-color); color: #fff; }

/* ДНЕВНОЙ РЕЖИМ (ПЕРЕБИВАЕТ РАСЧЕТНЫЙ RGB ФОН НА ЗЕФИРНЫЙ) */
body.light-theme {
    background: linear-gradient(180deg, #ffeef4 0%, #ffd6e8 60%, #ffbad2 100%) !important;
}
body.light-theme .fish svg .fish-body { fill: radial-gradient(circle at 30% 50%, #ffffff 0%, var(--main-color) 80%) !important; }
body.light-theme #now-playing { color: #7d657a; }
body.light-theme .volume-label { color: #8c7387; }
body.light-theme .nav-arrow { color: #bfa3b5; }
body.light-theme .info-drawer { background: rgba(255, 238, 244, 0.8); border-right-color: rgba(0,0,0,0.05); }
body.light-theme .drawer-content h2 { color: var(--main-color); }
body.light-theme #citySearch { background: rgba(0, 0, 0, 0.03); border-color: rgba(0,0,0,0.08); color: #333; }
body.light-theme .station-table th { color: var(--main-color); border-bottom-color: var(--main-color); }
body.light-theme .station-table td { color: #4a3b47; border-bottom-color: rgba(0,0,0,0.05); }
body.light-theme .drawer-close-btn { color: #8c7387; background: rgba(0,0,0,0.02); }

@media (max-width: 600px) {
    .station-table thead { display: none; }
    .station-table tr { display: block; margin-bottom: 15px; border: 1px solid rgba(255,255,255,0.05); border-radius: 8px; padding: 5px; background: rgba(0,0,0,0.1); }
    .station-table td { display: flex; justify-content: space-between; text-align: right; border-bottom: 1px solid rgba(255,255,255,0.02); padding: 8px 10px; }
    .station-table td:last-child { border-bottom: none; }
    .station-table td::before { content: attr(data-label); float: left; color: var(--main-color); font-weight: bold; font-family: 'Segoe UI', Arial, sans-serif; font-size: 11px; }
    .info-drawer { width: 100%; left: -100%; }
    .rgb-controller-box { top: auto; bottom: 20px; right: 20px; }
}
