:root {
    --bg: #141619;
    --panel: #1e2126;
    --panel-soft: #272b31;
    --panel-raise: #2d3238;
    --line: #373c44;
    --text: #edf0f5;
    --muted: #9ea7b3;
    --accent: #cf4a45;
    --accent-soft: #7e3a39;
    --ok: #5e8f76;
    --chip: #242931;
    --shadow: 0 14px 32px rgba(0, 0, 0, 0.34);
}

* {
    box-sizing: border-box;
}

html,
body {
    margin: 0;
    padding: 0;
    min-height: 100%;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    color: var(--text);
    background:
        radial-gradient(1200px 560px at 50% -180px, rgba(255, 255, 255, 0.08), transparent),
        linear-gradient(180deg, #101215 0%, #141619 100%);
    -webkit-tap-highlight-color: transparent;
}

button,
input,
select {
    font: inherit;
}

.radio-shell {
    width: min(100%, 940px);
    margin: 0 auto;
    padding: 12px 12px 96px;
    display: grid;
    gap: 12px;
}

.radio-header,
.radio-face,
.playlist-drawer {
    border: 1px solid var(--line);
    border-radius: 20px;
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.045), transparent 24%),
        var(--panel);
    box-shadow: var(--shadow);
}

.radio-header {
    padding: 14px 14px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
}

.brand-company {
    margin: 0;
    color: var(--muted);
    font-size: 11px;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

.brand-title {
    margin: 3px 0 0;
    font-size: 22px;
    line-height: 1.2;
    font-weight: 760;
}

.header-status {
    display: flex;
    align-items: center;
    gap: 8px;
}

.status-pill {
    min-height: 32px;
    padding: 7px 10px;
    border-radius: 999px;
    background: #22262d;
    border: 1px solid #30363f;
    color: var(--muted);
    font-size: 12px;
    font-weight: 700;
}

.status-pill.playing {
    color: #f3f0eb;
    border-color: #4a535d;
    background: #293039;
}

.admin-link {
    min-height: 32px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    border-radius: 999px;
    border: 1px solid #38404a;
    color: #d7deea;
    padding: 7px 11px;
    font-size: 12px;
    font-weight: 700;
}

.radio-face {
    padding: 14px;
    display: grid;
    gap: 12px;
}

.radio-scale-wrap {
    padding: 8px 9px;
    border-radius: 14px;
    border: 1px solid #3a4049;
    background: #181b20;
}

.frequency-scale {
    position: relative;
    height: 54px;
    border-radius: 10px;
    border: 1px solid #3a4049;
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.05), transparent 35%),
        #121418;
    overflow: hidden;
}

.frequency-ticks {
    position: absolute;
    inset: 12px 10px 20px;
    background:
        repeating-linear-gradient(
            90deg,
            rgba(255, 255, 255, 0.22) 0 1px,
            transparent 1px 18px
        );
}

.frequency-labels {
    position: absolute;
    left: 10px;
    right: 10px;
    bottom: 4px;
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    color: #aeb9c7;
    font-size: 11px;
}

.frequency-labels span {
    justify-self: center;
}

.indicator-line {
    position: absolute;
    top: 3px;
    bottom: 3px;
    left: 40%;
    width: 2px;
    background: linear-gradient(180deg, #f57a73, #c6423f);
    box-shadow: 0 0 9px rgba(207, 74, 69, 0.8);
    transform: translateX(-50%);
    transition: left 0.2s ease;
}

.frequency-scale.mix-drift .indicator-line {
    animation: indicatorDrift 7s ease-in-out infinite alternate;
}

@keyframes indicatorDrift {
    from {
        transform: translateX(-54%);
    }
    to {
        transform: translateX(-46%);
    }
}

.radio-center {
    display: grid;
    gap: 12px;
}

.cover-stage {
    border-radius: 16px;
    border: 1px solid #3b414b;
    background: #1a1e24;
    padding: 10px;
}

.cover-frame {
    position: relative;
    width: 100%;
    border-radius: 16px;
    overflow: hidden;
    border: 1px solid #434a56;
    background:
        radial-gradient(circle at 25% 20%, rgba(255, 255, 255, 0.13), transparent 40%),
        repeating-linear-gradient(
            135deg,
            rgba(255, 255, 255, 0.04) 0 4px,
            transparent 4px 14px
        ),
        #16191d;
    aspect-ratio: 1 / 1;
}

.cover-frame img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.cover-placeholder {
    position: absolute;
    inset: 0;
    display: grid;
    place-content: center;
    text-align: center;
    gap: 6px;
    color: #cdd5df;
}

.cover-placeholder strong {
    font-size: 20px;
    letter-spacing: 0.03em;
}

.cover-placeholder span {
    font-size: 12px;
    color: #9aa5b4;
}

.track-meta {
    margin-top: 10px;
}

.track-meta h2 {
    margin: 0;
    font-size: 21px;
    line-height: 1.2;
    font-weight: 760;
}

.track-meta p {
    margin: 3px 0 0;
    color: var(--muted);
    font-size: 13px;
}

.radio-vu-box {
    border-radius: 16px;
    border: 1px solid #3b414b;
    background: #1b1f26;
    padding: 10px;
    display: grid;
    gap: 8px;
}

.radio-vu-box header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.radio-vu-box h3 {
    margin: 0;
    font-size: 14px;
    color: #cad3de;
}

.mini-btn {
    min-height: 30px;
    border: 1px solid #404a56;
    background: #242a32;
    color: #d8dee8;
    border-radius: 999px;
    padding: 5px 10px;
    font-size: 12px;
    font-weight: 700;
}

.vu-needle-wrap {
    margin-top: 8px;
}

.vu-needle-dial {
    height: 74px;
    border-radius: 12px;
    border: 1px solid #39404b;
    background: #12161b;
    position: relative;
    overflow: hidden;
}

.needle-base {
    position: absolute;
    left: 50%;
    bottom: 8px;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #dbdfeb;
    transform: translateX(-50%);
}

.needle {
    --angle: -42deg;
    position: absolute;
    left: calc(50% - 1px);
    bottom: 12px;
    width: 2px;
    height: 48px;
    border-radius: 2px;
    background: linear-gradient(180deg, #f9b7b3, #d14f47);
    transform-origin: 50% 100%;
    transform: rotate(var(--angle));
}

.vu-bars {
    margin-top: 8px;
    height: 74px;
    border-radius: 12px;
    border: 1px solid #39404b;
    background: #11151b;
    display: grid;
    grid-template-columns: repeat(10, 1fr);
    align-items: end;
    gap: 4px;
    padding: 8px;
}

.vu-bar {
    display: block;
    min-height: 8px;
    border-radius: 4px 4px 2px 2px;
    background: #4d5868;
    transition: height 0.08s linear, background 0.08s linear;
}

.pinned-box {
    border-radius: 12px;
    border: 1px solid #3a414d;
    background: #151a20;
    padding: 8px;
    display: grid;
    gap: 8px;
}

.pinned-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.pinned-head h4 {
    margin: 0;
    font-size: 13px;
    color: #cad3de;
}

.pinned-head span {
    min-width: 24px;
    min-height: 24px;
    border-radius: 999px;
    border: 1px solid #46505d;
    background: #232a34;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #dce4ef;
    font-size: 11px;
    font-weight: 700;
    padding: 0 7px;
}

.pinned-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    gap: 6px;
    max-height: 168px;
    overflow: auto;
}

.pinned-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 34px;
    gap: 8px;
    align-items: center;
}

.pinned-play {
    min-height: 38px;
    border-radius: 10px;
    border: 1px solid #3c4652;
    background: #222932;
    color: #ebf0f7;
    text-align: left;
    padding: 6px 8px;
}

.pinned-play strong {
    display: block;
    font-size: 12px;
    line-height: 1.2;
}

.pinned-play span {
    display: block;
    margin-top: 2px;
    font-size: 11px;
    color: #9ca7b5;
    line-height: 1.2;
}

.pinned-remove {
    min-height: 34px;
    width: 34px;
    border-radius: 10px;
    border: 1px solid #414b58;
    background: #272d36;
    color: #dce4ef;
    font-size: 18px;
    line-height: 1;
}

.pinned-empty {
    margin: 0;
    color: #9ca8b6;
    font-size: 12px;
}

.control-row {
    display: grid;
    gap: 10px;
    grid-template-columns: 1fr 1.2fr 1fr;
}

.control-btn {
    min-height: 50px;
    border-radius: 16px;
    border: 1px solid #444b56;
    background: #242931;
    color: #ecf0f6;
    font-size: 15px;
    font-weight: 740;
}

.play-btn {
    font-size: 18px;
    background: #2d343f;
}

.seek-row {
    display: grid;
    grid-template-columns: 44px 1fr 44px;
    align-items: center;
    gap: 7px;
    color: var(--muted);
    font-size: 12px;
}

input[type="range"] {
    width: 100%;
    accent-color: var(--accent);
}

.radio-knob-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.knob-card {
    border-radius: 16px;
    border: 1px solid #3c424c;
    background: #1b1f25;
    padding: 10px;
    text-align: center;
}

.knob-card p {
    margin: 0;
    color: var(--muted);
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.knob-card span {
    margin-top: 8px;
    display: block;
    color: #ced7e3;
    font-size: 13px;
}

.knob {
    --knob-angle: -135deg;
    width: 86px;
    height: 86px;
    margin: 8px auto 0;
    border-radius: 50%;
    border: 1px solid #4a515c;
    background:
        radial-gradient(circle at 35% 30%, rgba(255, 255, 255, 0.2), transparent 42%),
        #2a2f37;
    position: relative;
    touch-action: none;
    user-select: none;
}

.knob::after {
    content: "";
    position: absolute;
    inset: 10px;
    border-radius: 50%;
    border: 1px solid #3f454f;
}

.knob-mark {
    position: absolute;
    left: 50%;
    top: 50%;
    width: 2px;
    height: 33px;
    background: #9aa4b4;
    transform-origin: 50% 100%;
    transform: translate(-50%, -100%) rotate(var(--knob-angle));
}

.knob-dot {
    position: absolute;
    left: 50%;
    top: 50%;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #d4dcea;
    transform: translate(-50%, -50%);
}

.toggle-row {
    display: grid;
    gap: 9px;
    grid-template-columns: 1.3fr 1fr 1fr;
}

.toggle-chip {
    min-height: 44px;
    border-radius: 13px;
    border: 1px solid #444c58;
    background: var(--chip);
    color: #d7e0ea;
    font-size: 13px;
    font-weight: 740;
}

.toggle-chip.active {
    border-color: #676f7c;
    color: #f4f7fb;
    background: #343b46;
}

.tap-btn {
    transition: transform 0.08s ease;
}

.tap-btn:active {
    transform: scale(0.98);
}

.playlist-drawer {
    position: fixed;
    left: max(8px, env(safe-area-inset-left));
    right: max(8px, env(safe-area-inset-right));
    bottom: max(8px, env(safe-area-inset-bottom));
    z-index: 35;
    overflow: hidden;
    transition: transform 0.24s ease;
}

.playlist-drawer.collapsed .drawer-content {
    display: none;
}

.drawer-head {
    display: grid;
    grid-template-columns: 34px 1fr auto;
    gap: 10px;
    align-items: center;
    padding: 10px;
    border-bottom: 1px solid #373d47;
}

.drawer-handle {
    min-height: 34px;
    width: 34px;
    border-radius: 10px;
    border: 1px solid #3f4651;
    background: #272c34;
    position: relative;
}

.drawer-handle::before {
    content: "";
    width: 16px;
    height: 3px;
    border-radius: 5px;
    background: #99a4b3;
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
}

.drawer-now strong {
    display: block;
    font-size: 14px;
    font-weight: 720;
    line-height: 1.2;
}

.drawer-now span {
    color: var(--muted);
    font-size: 12px;
}

.drawer-content {
    padding: 10px;
    display: grid;
    gap: 10px;
}

.drawer-filters {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}

.drawer-filters input,
.drawer-filters select {
    min-height: 44px;
    border-radius: 12px;
    border: 1px solid #424954;
    background: #181c22;
    color: #ebf0f7;
    padding: 9px 11px;
}

.drawer-filters input {
    grid-column: 1 / -1;
}

.playlist-scroll {
    max-height: min(58vh, 420px);
    overflow: auto;
    border: 1px solid #3b424d;
    border-radius: 14px;
    background: #171b20;
}

.playlist-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.playlist-row {
    display: grid;
    grid-template-columns: 44px minmax(0, 1fr) 58px 36px;
    gap: 10px;
    align-items: center;
    padding: 9px;
    border-bottom: 1px solid #2f353e;
}

.playlist-row.active {
    background: #202732;
}

.playlist-cover {
    width: 44px;
    height: 44px;
    border-radius: 10px;
    border: 1px solid #414955;
    background: #111419;
    object-fit: cover;
}

.playlist-track-btn {
    border: 0;
    background: transparent;
    color: inherit;
    text-align: left;
    min-height: 44px;
    padding: 0;
}

.playlist-track-btn strong {
    display: block;
    font-size: 14px;
    line-height: 1.2;
}

.playlist-track-btn span {
    color: var(--muted);
    font-size: 12px;
}

.playlist-duration {
    color: var(--muted);
    font-size: 12px;
    text-align: right;
}

.playlist-menu-btn {
    min-height: 36px;
    width: 36px;
    border-radius: 10px;
    border: 1px solid #3f4651;
    background: #262b34;
    color: #d8dfeb;
    font-size: 16px;
}

.playlist-loading {
    padding: 11px;
    font-size: 13px;
    color: var(--muted);
    text-align: center;
}

.track-menu {
    position: fixed;
    min-width: 170px;
    border-radius: 12px;
    border: 1px solid #404752;
    background: #1f232a;
    box-shadow: var(--shadow);
    z-index: 42;
    overflow: hidden;
}

.track-menu button {
    width: 100%;
    min-height: 42px;
    border: 0;
    border-bottom: 1px solid #303641;
    background: transparent;
    color: #e2e8f2;
    text-align: left;
    padding: 0 12px;
    font-size: 13px;
}

.track-menu button:last-child {
    border-bottom: 0;
}

.track-menu button:hover {
    background: #2a303a;
}

@media (min-width: 900px) {
    .radio-shell {
        padding-bottom: 24px;
    }

    .radio-center {
        grid-template-columns: 1fr 270px;
    }

    .playlist-drawer {
        position: static;
    }

    .playlist-drawer .drawer-content {
        display: grid !important;
    }

    .drawer-head .mini-btn,
    .drawer-head .drawer-handle {
        display: none;
    }

    .drawer-head {
        grid-template-columns: 1fr;
    }

    .playlist-scroll {
        max-height: 340px;
    }
}
