:root {
    --bg: #0c0f14;
    --bg-elevated: #141a24;
    --bg-card: #1a2230;
    --bg-card-hover: #222c3d;
    --border: rgba(255, 255, 255, 0.08);
    --text: #eef2f7;
    --text-muted: #8b9ab0;
    --accent: #3b9eff;
    --accent-glow: rgba(59, 158, 255, 0.25);
    --accent-dark: #2a7fd4;
    --success: #34d399;
    --error: #f87171;
    --radius: 14px;
    --radius-sm: 10px;
    --shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
    --font: 'DM Sans', system-ui, -apple-system, sans-serif;
    --max-width: 720px;
}

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

html {
    font-size: 16px;
    -webkit-font-smoothing: antialiased;
}

body {
    font-family: var(--font);
    background: var(--bg);
    color: var(--text);
    line-height: 1.5;
    min-height: 100dvh;
}

body::before {
    content: '';
    position: fixed;
    inset: 0;
    background:
        radial-gradient(ellipse 80% 50% at 50% -20%, rgba(59, 158, 255, 0.12), transparent),
        radial-gradient(ellipse 60% 40% at 100% 100%, rgba(59, 158, 255, 0.06), transparent);
    pointer-events: none;
    z-index: 0;
}

.page {
    position: relative;
    z-index: 1;
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 1.5rem 1.25rem 2rem;
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
}

/* Header */
.header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 2rem;
}

.header__brand {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.header__logo {
    width: 48px;
    height: 48px;
    color: var(--accent);
    flex-shrink: 0;
}

.header__logo svg {
    width: 100%;
    height: 100%;
}

.header__title {
    font-size: 1.5rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    line-height: 1.2;
}

.header__tagline {
    font-size: 0.875rem;
    color: var(--text-muted);
    margin-top: 0.125rem;
}

.lang-switch {
    display: flex;
    gap: 0.25rem;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 0.25rem;
}

.lang-switch__btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 2.5rem;
    padding: 0.375rem 0.625rem;
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--text-muted);
    text-decoration: none;
    border-radius: 7px;
    transition: background 0.15s, color 0.15s;
}

.lang-switch__btn:hover {
    color: var(--text);
    background: var(--bg-card);
}

.lang-switch__btn--active {
    color: var(--text);
    background: var(--accent);
}

/* Main */
.main {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 1.75rem;
}

/* Player */
.player {
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.5rem;
    box-shadow: var(--shadow);
}

.player__now {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1.25rem;
}

.player__art {
    position: relative;
    width: 4.5rem;
    height: 4.5rem;
    border-radius: 12px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    overflow: hidden;
    flex-shrink: 0;
}

.player__art-layer {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.player__art-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    opacity: 0;
    transform: scale(1.05);
    transition: opacity 0.35s ease, transform 0.35s ease;
}

.player__art--logo .player__art-img {
    opacity: 1;
    transform: scale(1);
}

.player__art-fallback {
    color: var(--accent);
    opacity: 1;
    transition: opacity 0.3s ease;
}

.player__art--logo .player__art-fallback {
    opacity: 0;
    pointer-events: none;
}

.player__art-fallback svg {
    width: 1.75rem;
    height: 1.75rem;
}

.player__art-eq {
    position: absolute;
    bottom: 0.35rem;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    align-items: flex-end;
    gap: 2px;
    height: 0.875rem;
    padding: 0 0.35rem;
    border-radius: 4px;
    background: rgba(0, 0, 0, 0.55);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.player__art--playing .player__art-eq {
    opacity: 1;
}

.player__art-eq span {
    display: block;
    width: 3px;
    height: 4px;
    background: var(--accent);
    border-radius: 1px;
    animation: eq-bounce 0.9s ease-in-out infinite;
}

.player__art-eq span:nth-child(1) { animation-delay: 0s; }
.player__art-eq span:nth-child(2) { animation-delay: 0.15s; }
.player__art-eq span:nth-child(3) { animation-delay: 0.3s; }
.player__art-eq span:nth-child(4) { animation-delay: 0.45s; }

@keyframes eq-bounce {
    0%, 100% { height: 4px; }
    50% { height: 12px; }
}

.player__art--playing.player__art--logo::after {
    content: '';
    position: absolute;
    inset: -3px;
    border-radius: 14px;
    border: 2px solid var(--accent);
    opacity: 0.5;
    animation: art-glow 2s ease-in-out infinite;
    pointer-events: none;
}

@keyframes art-glow {
    0%, 100% { opacity: 0.25; transform: scale(1); }
    50% { opacity: 0.55; transform: scale(1.02); }
}

.player__meta {
    min-width: 0;
    flex: 1;
}

.player__meta-top {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.375rem;
}

.player__live {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    font-size: 0.6875rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: #fff;
    background: #e53e3e;
    padding: 0.125rem 0.5rem;
    border-radius: 999px;
}

.player__live::before {
    content: '';
    width: 0.4rem;
    height: 0.4rem;
    border-radius: 50%;
    background: currentColor;
    animation: pulse 1.5s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.35; }
}

.player__label {
    display: block;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--accent);
    margin-bottom: 0.375rem;
}

.player__station {
    font-size: 1.375rem;
    font-weight: 600;
    letter-spacing: -0.02em;
    line-height: 1.3;
}

.player__track {
    font-size: 0.9375rem;
    color: var(--text);
    margin-top: 0.25rem;
    line-height: 1.4;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.player__category,
.player__genre {
    font-size: 0.8125rem;
    color: var(--text-muted);
    margin-top: 0.25rem;
    min-height: 1.25rem;
}

.player__controls {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 3rem;
    height: 3rem;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    transition: transform 0.2s cubic-bezier(0.34, 1.4, 0.64, 1), background 0.2s, box-shadow 0.2s;
}

.btn:active:not(:disabled) {
    transform: scale(0.92);
}

.btn--primary {
    background: var(--accent);
    color: #fff;
    box-shadow: 0 4px 16px var(--accent-glow);
    position: relative;
}

.btn--primary::before {
    content: '';
    position: absolute;
    inset: -4px;
    border-radius: 50%;
    border: 2px solid var(--accent);
    opacity: 0;
    transform: scale(0.85);
    transition: opacity 0.3s, transform 0.3s;
    pointer-events: none;
}

.btn--primary.is-playing::before {
    opacity: 0.35;
    transform: scale(1);
    animation: btn-ring 2s ease-in-out infinite;
}

@keyframes btn-ring {
    0%, 100% { opacity: 0.2; transform: scale(1); }
    50% { opacity: 0.45; transform: scale(1.08); }
}

.btn--primary:hover:not(:disabled) {
    background: var(--accent-dark);
    transform: scale(1.05);
}

.btn--primary.is-playing {
    background: var(--accent-dark);
}

.btn--primary:disabled {
    opacity: 0.45;
    cursor: not-allowed;
    transform: none;
}

.btn__icons {
    position: relative;
    width: 1.375rem;
    height: 1.375rem;
}

.btn__icons .icon {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    transition: opacity 0.25s ease, transform 0.3s cubic-bezier(0.34, 1.4, 0.64, 1);
}

.btn--primary .icon--play {
    opacity: 1;
    transform: scale(1) rotate(0deg);
}

.btn--primary .icon--pause {
    opacity: 0;
    transform: scale(0.5) rotate(-90deg);
}

.btn--primary.is-playing .icon--play {
    opacity: 0;
    transform: scale(0.5) rotate(90deg);
}

.btn--primary.is-playing .icon--pause {
    opacity: 1;
    transform: scale(1) rotate(0deg);
}

.btn--secondary {
    background: var(--bg-card);
    color: var(--text-muted);
    border: 1px solid var(--border);
}

.btn--secondary:hover {
    background: var(--bg-card-hover);
    color: var(--text);
}

.icon {
    width: 1.375rem;
    height: 1.375rem;
}

@media (prefers-reduced-motion: reduce) {
    .btn__icons .icon,
    .player__art-img,
    .player__art-fallback,
    .player__art-eq span,
    .player__art--playing.player__art--logo::after,
    .btn--primary::before {
        animation: none;
        transition: none;
    }
}

.volume {
    display: flex;
    align-items: center;
    gap: 0.625rem;
    margin-left: auto;
    flex: 1;
    min-width: 140px;
}

.volume__label {
    font-size: 0.75rem;
    color: var(--text-muted);
    white-space: nowrap;
}

.volume__slider {
    flex: 1;
    -webkit-appearance: none;
    appearance: none;
    height: 4px;
    background: var(--bg-card);
    border-radius: 2px;
    outline: none;
}

.volume__slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 14px;
    height: 14px;
    background: var(--accent);
    border-radius: 50%;
    cursor: pointer;
}

.volume__slider::-moz-range-thumb {
    width: 14px;
    height: 14px;
    background: var(--accent);
    border-radius: 50%;
    border: none;
    cursor: pointer;
}

.player__status {
    font-size: 0.8125rem;
    color: var(--text-muted);
    margin-top: 1rem;
    min-height: 1.25rem;
}

.player__status--error {
    color: var(--error);
}

.player__status--loading {
    color: var(--accent);
}

.btn-retry {
    margin-top: 0.75rem;
    padding: 0.5rem 1rem;
    font-family: inherit;
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--text);
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s;
}

.btn-retry:hover {
    background: var(--bg-card-hover);
    border-color: rgba(59, 158, 255, 0.3);
}

/* Stations */
.stations__header {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 0.5rem;
    margin-bottom: 0.875rem;
}

.stations__title {
    font-size: 1rem;
    font-weight: 600;
}

.stations__count {
    font-size: 0.8125rem;
    color: var(--text-muted);
}

.stations__toolbar {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    margin-bottom: 0.875rem;
}

.category-filter {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.category-filter__btn {
    padding: 0.4375rem 0.75rem;
    font-family: inherit;
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--text-muted);
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 999px;
    cursor: pointer;
    transition: background 0.15s, color 0.15s, border-color 0.15s;
}

.category-filter__btn:hover {
    color: var(--text);
    background: var(--bg-card-hover);
}

.category-filter__btn--active {
    color: #fff;
    background: var(--accent);
    border-color: var(--accent);
}

.search {
    display: flex;
    align-items: center;
    gap: 0.625rem;
    padding: 0.75rem 1rem;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
}

.search:focus-within {
    border-color: rgba(59, 158, 255, 0.45);
    box-shadow: 0 0 0 3px var(--accent-glow);
}

.search__icon {
    width: 1.125rem;
    height: 1.125rem;
    color: var(--text-muted);
    flex-shrink: 0;
}

.search__input {
    flex: 1;
    min-width: 0;
    border: none;
    background: transparent;
    color: var(--text);
    font-family: inherit;
    font-size: 0.9375rem;
    outline: none;
}

.search__input::placeholder {
    color: var(--text-muted);
}

.search__input::-webkit-search-cancel-button {
    -webkit-appearance: none;
}

.stations__empty {
    font-size: 0.875rem;
    color: var(--text-muted);
    text-align: center;
    padding: 1.5rem 1rem;
    border: 1px dashed var(--border);
    border-radius: var(--radius-sm);
    margin-bottom: 0.875rem;
}

.station-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.station-card {
    display: flex;
    align-items: center;
    gap: 0.875rem;
    width: 100%;
    padding: 0.875rem 1rem;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text);
    font-family: inherit;
    font-size: inherit;
    text-align: left;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s, transform 0.15s;
}

.station-card:hover {
    background: var(--bg-card-hover);
    border-color: rgba(59, 158, 255, 0.3);
}

.station-card--active {
    border-color: var(--accent);
    background: rgba(59, 158, 255, 0.08);
    box-shadow: 0 0 0 1px var(--accent-glow);
}

.station-card__icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 2.25rem;
    height: 2.25rem;
    background: var(--bg-elevated);
    border-radius: 8px;
    color: var(--accent);
    flex-shrink: 0;
    overflow: hidden;
}

.station-card__icon--logo {
    background: #fff;
    padding: 2px;
}

.station-card__icon svg {
    width: 1.125rem;
    height: 1.125rem;
}

.station-card__logo {
    width: 100%;
    height: 100%;
    object-fit: contain;
    border-radius: 6px;
}

.station-card__info {
    flex: 1;
    min-width: 0;
}

.station-card__name {
    display: block;
    font-weight: 600;
    font-size: 0.9375rem;
}

.station-card__category,
.station-card__genre {
    display: inline-block;
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 0.2rem;
    padding: 0.1rem 0.45rem;
    background: var(--bg-elevated);
    border-radius: 999px;
}

.station-card__play {
    color: var(--text-muted);
    opacity: 0;
    transition: opacity 0.15s, color 0.15s;
}

.station-card__play svg {
    width: 1.25rem;
    height: 1.25rem;
}

.station-card:hover .station-card__play,
.station-card--active .station-card__play {
    opacity: 1;
    color: var(--accent);
}

/* Footer */
.footer {
    margin-top: 2.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border);
    text-align: center;
    font-size: 0.8125rem;
    color: var(--text-muted);
}

.footer a {
    color: var(--accent);
    text-decoration: none;
}

.footer a:hover {
    text-decoration: underline;
}

.footer__url {
    margin-top: 0.375rem;
}

.footer__url a {
    color: var(--text-muted);
}

/* Responsive */
@media (max-width: 480px) {
    .header__title {
        font-size: 1.25rem;
    }

    .volume {
        width: 100%;
        margin-left: 0;
        margin-top: 0.5rem;
    }

    .player__controls {
        justify-content: flex-start;
    }
}
