:root {
    --color-bg: #000;
    --color-text: #fff;
    --color-dim: #888;
}

body {
    margin: 0; padding: 0;
    background: #000; color: #fff;
    font-family: system-ui, sans-serif;
    overflow: hidden;
    height: 100vh;
    user-select: none;
    -webkit-user-select: none;
}

/* === Радио слой === */
.radio-layer {
    position: fixed; inset: 0;
    z-index: 1;
    display: flex; align-items: center; justify-content: center;
    background: #000;
}
.radio-layer video,
.radio-layer img {
    width: 100%; height: 100%;
    object-fit: contain;
    background: #000;
    pointer-events: none;
    -webkit-user-drag: none;
    transition: filter 0.5s ease;
}

body.is-paused .radio-layer video,
body.is-paused .radio-layer img {
    filter: blur(24px) brightness(0.5);
}

/* Прозрачный overlay против правого клика на видео/картинке */
.radio-layer::before {
    content: '';
    position: absolute; inset: 0;
    z-index: 3;
    background: transparent;
    pointer-events: auto;
}

.init-play-btn {
    position: absolute; top: 50%; left: 50%;
    transform: translate(-50%, -50%);
    width: 90px; height: 90px;
    background: rgba(255, 255, 255, 0.1);
    border: 2px solid rgba(255, 255, 255, 0.4);
    border-radius: 50%;
    cursor: pointer; z-index: 5;
    display: flex; align-items: center; justify-content: center;
}
.init-play-btn svg { width: 30px; height: 30px; fill: #fff; margin-left: 4px; }
.init-play-btn.hidden { display: none; }

body.is-paused .radio-layer::after {
    content: '';
    position: absolute; inset: 0;
    background: rgba(0, 0, 0, 0.4);
    z-index: 2;
    pointer-events: none;
}
body.is-paused .init-play-btn:not(.hidden) {
    display: flex !important;
    opacity: 1; z-index: 10;
    pointer-events: auto;
}

.init-play-btn.hidden {
    display: none !important;
}

/* === Шапка === */
.site-header {
    position: fixed; top: 10px; left: 50%;
    transform: translateX(-50%);
    padding: 10px 25px;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(10px);
    z-index: 50;
    display: flex; flex-direction: column;
    align-items: center;
    transition: transform 0.6s cubic-bezier(0.6, 0.04, 0.3, 1),
                opacity 0.4s ease;
    transform-origin: center center;
    will-change: transform, opacity;
}

/* Скрытие шапки — сжатие в горизонтальный овал */
.site-header.collapsed {
    transform: translateX(-50%) scaleX(0);
    opacity: 0;
    pointer-events: none;
}
.site-header.collapsed .header-inner {
    opacity: 0;
    transition: opacity 0.2s;
}
.header-inner {
    display: flex; align-items: center; gap: 12px;
    cursor: pointer;
    transition: opacity 0.4s ease;
}

.header-avatar {
    width: 36px; height: 36px;
    border-radius: 50%;
    background: #222;
    overflow: hidden;
    flex-shrink: 0;
    position: relative;
    transition: transform 0.4s ease;
}

.header-content {
    display: flex; flex-direction: column;
    justify-content: center; align-items: flex-start;
    min-width: 0;
}

/* === Бегущая строка === */
.header-title-viewport {
    overflow: hidden;
    max-width: 280px;
    width: 100%;
    position: relative;
    mask-image: linear-gradient(to right, transparent 0, #000 12px, #000 calc(100% - 12px), transparent 100%);
    -webkit-mask-image: linear-gradient(to right, transparent 0, #000 12px, #000 calc(100% - 12px), transparent 100%);
}

.header-title-track {
    font-weight: 700;
    line-height: 1.2;
    white-space: nowrap;
    display: inline-block;
    will-change: transform;
}

/* Анимация запускается через JS-класс, когда контент не помещается */
.header-title-track.scrolling {
    animation: titleScroll 15s linear infinite;
}

@keyframes titleScroll {
    0%   { transform: translateX(0); }
    10%   { transform: translateX(0); }       /* пауза в начале */
    85%  { transform: translateX(var(--scroll-distance, -100%)); }
    100% { transform: translateX(var(--scroll-distance, -100%)); }
}

.dynamic-part {
    opacity: 0.85;
}
.dynamic-part:not(:empty)::before {
    content: ' - ';
    opacity: 0.6;
}
.dynamic-part:not(:empty)::after {
    content: ' - ';
    opacity: 0.6;
}
.static-part-end:not(:empty)::after {
    content: ' -|';
    opacity: 0.6;
}

/* === Громкость === */
.header-volume {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-top: 4px;
    cursor: default;
    width: 100%;
    flex-shrink: 0;
}
.volume-icon { cursor: pointer; flex-shrink: 0; }
.volume-slider-h {
    flex: 1;
    min-width: 60px;
    height: 3px;
    background: rgba(255, 255, 255, 0.2);
    -webkit-appearance: none; appearance: none;
    cursor: pointer; margin: 0; padding: 0;
}
.volume-slider-h::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 8px; height: 8px;
    background: #fff; border-radius: 50%;
}

/* === Анимация "настройка на волну" === */
.tuning-animation {
    position: fixed;
    top: 50%; left: 50%;
    transform: translate(-50%, -50%);
    z-index: 6;
    display: none;
    flex-direction: column;
    align-items: center;
    gap: 18px;
    pointer-events: none;
}
.tuning-animation.active { display: flex; }

.tuning-bars {
    display: flex;
    align-items: flex-end;
    gap: 6px;
    height: 60px;
}
.tuning-bars span {
    display: block;
    width: 5px;
    background: linear-gradient(to top, #00ff88, #88ddff);
    border-radius: 3px;
    animation: tuneBar 0.9s ease-in-out infinite;
    box-shadow: 0 0 8px rgba(0, 255, 136, 0.5);
}
.tuning-bars span:nth-child(1) { animation-delay: 0s;    height: 30%; }
.tuning-bars span:nth-child(2) { animation-delay: 0.15s; height: 70%; }
.tuning-bars span:nth-child(3) { animation-delay: 0.3s;  height: 50%; }
.tuning-bars span:nth-child(4) { animation-delay: 0.45s; height: 90%; }
.tuning-bars span:nth-child(5) { animation-delay: 0.6s;  height: 40%; }

@keyframes tuneBar {
    0%, 100% { transform: scaleY(0.3); opacity: 0.5; }
    50%      { transform: scaleY(1);   opacity: 1; }
}

.tuning-label {
    color: #fff;
    font-size: 12px;
    letter-spacing: 4px;
    text-transform: uppercase;
    opacity: 0.6;
    animation: pulseLabel 1.4s ease-in-out infinite;
}
@keyframes pulseLabel {
    0%, 100% { opacity: 0.4; }
    50%      { opacity: 1; }
}

/* Адаптив */
@media (max-width: 768px) and (orientation: portrait) {
    .site-header { padding: 10px 15px; }
    .header-title-viewport { max-width: 200px; }
}