/* ══════════════════════════════════════
   LEFT RAIL
══════════════════════════════════════ */
#left-rail {
    position: fixed;
    top: 0; left: 0; bottom: 0; width: 220px;
    display: flex; flex-direction: column;
    padding: 28px 14px 20px;
    padding-bottom: 56px; /* высота плеера */
    z-index: 1100;
    border-right: 1px solid var(--border);
    background: var(--bg);
    overflow-y: auto; scrollbar-width: none;
    transition: transform .35s cubic-bezier(.22,1,.36,1);
}
#left-rail::-webkit-scrollbar { display: none; }

.lr-overlay {
    position: fixed; inset: 0;
    background: rgba(0,0,0,.5); backdrop-filter: blur(4px);
    z-index: 1090; opacity: 0; visibility: hidden;
    transition: opacity .3s, visibility .3s;
}
.lr-overlay.open { opacity: 1; visibility: visible; }

.lr-logo {
    font-family: var(--fd); font-size: 1.1rem; font-weight: 900;
    letter-spacing: -.03em; text-transform: uppercase;
    color: var(--text); text-decoration: none;
    padding: 0 8px; margin-bottom: 24px; display: block;
}
.lr-logo em { font-style: normal; color: var(--primary); }

.lr-user {
    display: flex; align-items: center; gap: 10px;
    padding: 10px 8px; border-radius: 10px; margin-bottom: 8px;
}
.lr-avatar {
    width: 34px; height: 34px; border-radius: 50%;
    object-fit: cover; flex-shrink: 0;
    border: 1px solid var(--border); background: var(--surf-el);
}
.lr-user-info { min-width: 0; }
.lr-nickname {
    font-size: .72rem; font-weight: 600; color: var(--text);
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.lr-username {
    font-family: 'Courier New', monospace;
    font-size: .55rem; color: var(--muted); margin-top: 1px;
}

.lr-nav { flex: 1; display: flex; flex-direction: column; gap: 1px; }

.lr-item {
    display: flex; align-items: center; gap: 10px;
    padding: 9px 10px; border-radius: 8px;
    color: var(--muted); text-decoration: none;
    font-size: .72rem; font-weight: 500;
    transition: color .15s, background .15s; cursor: pointer;
}
.lr-item:hover  { color: var(--text); background: rgba(255,255,255,.04); }
.lr-item.active { color: var(--primary); background: rgba(60,255,160,.06); }
.lr-item-btn {
    background: none; border: none; width: 100%;
    text-align: left; font-family: inherit;
}
.lr-item-icon {
    width: 15px; height: 15px; opacity: .5;
    flex-shrink: 0; transition: opacity .15s;
}
.lr-item:hover .lr-item-icon,
.lr-item.active .lr-item-icon { opacity: .9; }

.lr-divider { height: 1px; background: var(--border); margin: 6px 8px; opacity: .5; }

.lr-footer {
    padding-top: 12px;
    border-top: 1px solid var(--border);
    margin-top: 8px;
}
.lr-logout {
    display: flex; align-items: center; gap: 10px;
    width: 100%; padding: 9px 10px; border-radius: 8px;
    border: none; background: transparent;
    color: var(--muted); font-family: inherit;
    font-size: .72rem; font-weight: 500; cursor: pointer;
    transition: color .15s, background .15s;
}
.lr-logout:hover { color: var(--accent); background: rgba(255,92,58,.06); }
.lr-logout img { width: 15px; height: 15px; opacity: .5; }

/* ══════════════════════════════════════
   APP MAIN
══════════════════════════════════════ */
#app-main {
    margin-left: 220px;
    flex: 1;
    min-width: 0;
}


#page {
    padding-top: 50px;
    min-height: calc(100vh - 56px);
    transition: opacity .15s;
}

/* Home page two-column layout */
main {
    display: flex;
    gap: 12px;
    padding-top: 54px;
}
#left_panel  { flex: 1; min-width: 0; }
#right_panel {
    width: 330px; flex-shrink: 0;
    display: flex; flex-direction: column;
    gap: 6px; padding-top: 16px;
}

/* ══════════════════════════════════════
   HEADER
══════════════════════════════════════ */
.main-header {
    display: flex;
    justify-content: center;
    position: fixed;
    top: 0; left: 0; right: 0;
    height: 50px;
    background: rgba(8, 10, 15, .85);
    backdrop-filter: blur(22px);
    -webkit-backdrop-filter: blur(22px);
    border-bottom: 1px solid var(--border);
    z-index: 1000;
    transition: background .3s;
}

.header-inner {
    width: 100%;
    max-width: 1150px;
    padding: 0 16px;
    height: 100%;
    display: flex;
    align-items: center;
    gap: 16px;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-left: auto;
}

.logo-mobile { display: none; }

/* Search box */
.search-box {
    position: relative;
    display: flex; align-items: center;
    background: var(--surf-el);
    border: 1px solid var(--border);
    padding: 5px 12px;
    border-radius: 20px;
    gap: 8px; width: 180px;
    transition: width .35s ease, border-color .2s;
}
.search-box:hover,
.search-box:focus-within   { width: 250px; }
.search-box:focus-within   { border-color: var(--border-hi); }
.search-box svg            { width: 13px; height: 13px; stroke: var(--muted); fill: none; stroke-width: 2; flex-shrink: 0; }
.search-box input          { background: transparent; border: none; outline: none; color: var(--text); font-family: inherit; font-size: .76rem; width: 100%; }
.search-box input::placeholder { color: var(--muted); }

.text-btn {
    font-size: .68rem; font-weight: 600;
    letter-spacing: .06em; text-transform: uppercase;
    color: var(--muted); transition: color .2s; white-space: nowrap;
}
.text-btn:hover { color: var(--text); }

/* Bell */
.bell-container { position: relative; display: flex; align-items: center; cursor: pointer; }
.bell-container img { width: 17px; opacity: .6; transition: opacity .2s; }
.bell-container:hover img { opacity: 1; }
.bell-tooltip {
    position: absolute; top: calc(100% + 10px); right: 0;
    background: var(--surf-el); border: 1px solid var(--border);
    color: var(--text); padding: 8px 12px; border-radius: 8px;
    font-size: .7rem; white-space: nowrap;
    box-shadow: 0 8px 20px rgba(0,0,0,.4);
    opacity: 0; transform: translateY(-6px);
    transition: opacity .2s, transform .2s; pointer-events: none;
}
.bell-container.active .bell-tooltip { opacity: 1; transform: translateY(0); }

.login-link { font-size: .75rem; font-weight: 600; color: var(--text); }

/* Search dropdown */
.search-dropdown {
    position: absolute; top: calc(100% + 6px); left: 0; right: 0;
    background: var(--surface); border: 1px solid rgba(255,255,255,.08);
    border-radius: 12px; overflow: hidden; z-index: 4000;
    box-shadow: 0 8px 32px rgba(0,0,0,.4);
    max-height: 420px; overflow-y: auto;
}
.sd-group-label {
    padding: 8px 14px 4px; font-size: .65rem;
    letter-spacing: .1em; text-transform: uppercase;
    color: rgba(255,255,255,.35);
}
.sd-item {
    display: flex; align-items: center; gap: 10px;
    padding: 8px 14px; text-decoration: none;
    color: inherit; transition: background .15s;
}
.sd-item:hover { background: rgba(255,255,255,.06); }
.sd-ava        { width: 36px; height: 36px; border-radius: 50%; object-fit: cover; flex-shrink: 0; }
.sd-ava-ph     { background: var(--primary); display: flex; align-items: center; justify-content: center; font-size: .85rem; font-weight: 600; border-radius: 50%; }
.sd-info       { flex: 1; min-width: 0; }
.sd-title      { font-size: .88rem; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sd-sub        { font-size: .72rem; color: rgba(255,255,255,.45); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sd-type       { font-size: .6rem; letter-spacing: .08em; text-transform: uppercase; color: rgba(255,255,255,.25); flex-shrink: 0; }

/* Hamburger */
.hamburger {
    display: none; flex-direction: column;
    justify-content: center; gap: 5px;
    width: 36px; height: 36px; padding: 6px;
    background: none; border: none; cursor: pointer; flex-shrink: 0;
}
.hamburger span {
    display: block; height: 2px; border-radius: 2px;
    background: var(--text);
    transition: transform .3s, opacity .3s, width .3s;
    transform-origin: center;
}
.hamburger span:nth-child(2) { width: 70%; }
.hamburger.open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.hamburger.open span:nth-child(2) { opacity: 0; width: 0; }
.hamburger.open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* Mobile menu */
.mobile-menu {
    display: none; position: fixed;
    top: 50px; left: 0; right: 0;
    background: var(--bg); border-bottom: 1px solid var(--border);
    padding: 16px; z-index: 999;
    flex-direction: column; gap: 4px;
    transform: translateY(-8px); opacity: 0;
    transition: transform .3s cubic-bezier(.22,1,.36,1), opacity .25s;
    pointer-events: none;
}
.mobile-menu.open { transform: translateY(0); opacity: 1; pointer-events: auto; }
.mm-search {
    display: flex; align-items: center;
    background: var(--surf-el); border: 1px solid var(--border);
    padding: 10px 14px; border-radius: 12px; gap: 10px; margin-bottom: 8px;
}
.mm-search svg   { width: 15px; height: 15px; stroke: var(--muted); fill: none; stroke-width: 2; flex-shrink: 0; }
.mm-search input { background: transparent; border: none; outline: none; color: var(--text); font-family: inherit; font-size: .88rem; width: 100%; }
.mm-search input::placeholder { color: var(--muted); }
.mnl {
    display: flex; align-items: center;
    padding: 12px 14px; border-radius: 10px;
    font-size: .88rem; color: var(--text);
    transition: background .15s; cursor: pointer;
}
.mnl:hover, .mnl:active { background: var(--surf-el); }
.mndiv { height: 1px; background: var(--border); margin: 6px 0; }

/* ══════════════════════════════════════
   PLAYER
══════════════════════════════════════ */
#player {
    position: fixed; bottom: 0; left: 0; width: 100%; height: 56px;
    background: rgba(15, 20, 32, .96);
    backdrop-filter: blur(28px); -webkit-backdrop-filter: blur(28px);
    border-top: 1px solid var(--border);
    display: flex; align-items: center; gap: 10px; padding: 0 12px;
    z-index: 2000; color-scheme: dark;
}

/* Player idle state */
#player.player-idle #like_block,
#player.player-idle #comments_icon_wrap,
#player.player-idle #waveform,
#player.player-idle #volume_wrapper,
#player.player-idle #extra_block,
#player.player-idle #controls,
#player.player-idle #time     { opacity: .2; pointer-events: none; }
#player.player-idle #img_cover { display: none; }
#player.player-idle #title_block::before {
    content: ''; display: block;
    width: 34px; height: 34px; border-radius: 4px;
    background: var(--surf-el); border: 1px solid var(--border); flex-shrink: 0;
}
#player.player-idle #title_block .mq span { animation: none; }

#title_block {
    display: flex; align-items: center; gap: 9px;
    width: 230px; flex-shrink: 0; overflow: hidden;
}
#img_cover {
    width: 37px; height: 37px; object-fit: cover;
    border-radius: 4px; flex-shrink: 0; cursor: pointer; transition: opacity .2s;
}
#img_cover:hover { opacity: .75; }
.mw  { flex: 1; overflow: hidden; white-space: nowrap; }
.mq  { display: inline-block; white-space: nowrap; animation: ms 15s linear infinite; }
@keyframes ms { 0% { transform: translateX(0); } 100% { transform: translateX(-50%); } }
#p_cover_text { font-size: .74rem; color: #DDE6F0; }

#like_block  { min-width: 56px; display: flex; align-items: center; justify-content: center; }
#like_wrapper {
    display: flex; align-items: center; gap: 4px;
    padding: 4px 8px; border-radius: 20px;
    background: #0F1420; border: 1px solid rgba(255,255,255,.045);
    cursor: pointer; transition: border-color .2s; flex-shrink: 0; min-width: 40px;
}
#like_wrapper:hover { border-color: rgba(230,80,80,.4); }
#img_like_icon { width: 13px; height: 13px; }
#like_count    { font-size: .66rem; color: #DDE6F0; }

#controls { display: flex; align-items: center; gap: 3px; flex-shrink: 0; }
#controls button {
    background: transparent; border: none; padding: 4px 5px; border-radius: 4px;
    display: flex; align-items: center; justify-content: center; transition: background .15s;
}
#controls button:hover { background: rgba(255,255,255,.045); }
#controls button img { width: 17px; height: 17px; }
#img_play_icon { width: 24px !important; height: 24px !important; }

#waveform { flex: 1; min-width: 0; cursor: pointer; }
#time {
    font-size: .7rem; color: #7A8899;
    font-variant-numeric: tabular-nums; white-space: nowrap;
    min-width: 96px; text-align: center; cursor: pointer; flex-shrink: 0;
}

#volume_wrapper { display: flex; align-items: center; gap: 6px; flex-shrink: 0; }
#volume {
    -webkit-appearance: none; appearance: none;
    width: 62px; height: 3px; border-radius: 2px;
    background: var(--surface); cursor: pointer; border: none; outline: none;
}
#volume::-webkit-slider-thumb { -webkit-appearance: none; width: 10px; height: 10px; border-radius: 50%; background: var(--primary); cursor: pointer; }
#volume::-moz-range-thumb     { width: 10px; height: 10px; border-radius: 50%; background: var(--primary); border: none; }
#volume_options { display: flex; flex-direction: column; gap: 2px; }
#img_mute_icon, #img_normalize_icon { width: 14px; cursor: pointer; opacity: .55; transition: opacity .15s; }
#img_mute_icon:hover, #img_normalize_icon:hover { opacity: 1; }

#extra_block { display: flex; flex-direction: column; gap: 4px; flex-shrink: 0; }
#img_playlist_icon, #img_share_track_icon { width: 14px; cursor: pointer; opacity: .55; transition: opacity .15s; }
#img_playlist_icon:hover, #img_share_track_icon:hover { opacity: 1; }

/* Comments icon */
#comments_icon_wrap { position: relative; display: flex; align-items: center; flex-shrink: 0; }
#btn_comments { width: 22px; cursor: pointer; opacity: .55; transition: opacity .15s, filter .2s; flex-shrink: 0; }
#btn_comments:hover  { opacity: 1; }
#btn_comments.active { opacity: 1; filter: drop-shadow(0 0 4px var(--primary)); }
#comments_badge {
    position: absolute; top: -5px; right: -5px;
    min-width: 14px; height: 14px; border-radius: 7px;
    background: var(--accent); color: #fff;
    font-size: .48rem; font-weight: 700;
    display: flex; align-items: center; justify-content: center; padding: 0 3px;
    pointer-events: none; opacity: 0; transition: opacity .2s;
}
#comments_badge.visible { opacity: 1; }

/* Playlist popup */
#playlist {
    position: fixed; bottom: 64px; right: 10px;
    max-width: 315px; width: 95%; z-index: 1500;
    background: rgba(15,20,32,.95);
    backdrop-filter: blur(22px); -webkit-backdrop-filter: blur(22px);
    border: 1px solid var(--border); border-radius: 16px;
    padding: 9px; box-shadow: 0 -8px 32px rgba(0,0,0,.55);
    overflow-y: auto; max-height: 60vh;
    opacity: 0; transform: translateY(14px) scale(.96);
    transition: opacity .3s, transform .4s cubic-bezier(.22,1,.36,1);
    pointer-events: none;
}
#playlist.playlist-open { opacity: 1; transform: translateY(0) scale(1); pointer-events: auto; }

.track-card {
    display: flex; align-items: center; gap: 9px;
    padding: 2px 9px; margin: 3px 0;
    background: var(--surface); border: 1px solid var(--border);
    border-radius: 8px; cursor: pointer; transition: background .25s, transform .25s;
}
.track-card:hover { background: var(--surf-el); }
.track-card.active-track { background: var(--surf-el); border-color: rgba(60,255,160,.25); transform: scale(1.01); }
.track-card .tcc { width: 42px; height: 42px; border-radius: 6px; object-fit: cover; flex-shrink: 0; }
.track-card .tci { flex: 1; min-width: 0; }
.track-card .tca { font-size: .66rem; font-weight: 600; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.track-card .tct { font-size: .7rem; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.track-card .tcm { font-size: .58rem; color: var(--muted); margin-top: 2px; }

/* Cover popup */
.cover-popup {
    position: fixed; bottom: 64px; left: 14px;
    background: rgba(15,20,32,.96); backdrop-filter: blur(12px);
    padding: 7px; border-radius: 14px;
    box-shadow: 0 14px 48px rgba(0,0,0,.65);
    animation: cpin .2s ease-out; z-index: 9999;
}
.cover-popup-img   { width: 270px; height: 270px; object-fit: cover; border-radius: 9px; display: block; }
.cover-popup-close { position: absolute; top: 9px; right: 12px; font-size: 14px; color: var(--text); cursor: pointer; opacity: .65; transition: opacity .2s; user-select: none; }
.cover-popup-close:hover { opacity: 1; }
@keyframes cpin { from { opacity: 0; transform: translateY(8px) scale(.95); } to { opacity: 1; transform: translateY(0) scale(1); } }

/* ══════════════════════════════════════
   COMMENTS PANEL
══════════════════════════════════════ */
#comments_panel {
    position: fixed; bottom: 56px; width: 70vw;
    max-height: 80vh; min-height: 25vh; z-index: 1400;
    background: rgba(12,17,28,.97);
    backdrop-filter: blur(22px); -webkit-backdrop-filter: blur(22px);
    border: 1px solid var(--border); border-bottom: none;
    border-radius: 14px 14px 0 0;
    box-shadow: 0 -8px 40px rgba(0,0,0,.65);
    display: flex; flex-direction: column; overflow: hidden;
    opacity: 0; transform: translateY(16px) scale(.97);
    transition: opacity .3s, transform .4s cubic-bezier(.22,1,.36,1);
    pointer-events: none;
}
#comments_panel.open { opacity: 1; transform: translateY(0) scale(1); pointer-events: auto; }

.cp-header { display: flex; align-items: center; justify-content: space-between; padding: 11px 14px; border-bottom: 1px solid var(--border); flex-shrink: 0; }
.cp-title {
    font-family: 'Courier New', monospace; font-size: .6rem; font-weight: 700;
    letter-spacing: .2em; text-transform: uppercase; color: var(--primary);
    display: flex; align-items: center; gap: 7px;
}
.cp-title-dot { width: 5px; height: 5px; border-radius: 50%; background: var(--primary); animation: cpblink 1.6s ease-in-out infinite; }
@keyframes cpblink { 0%, 100% { opacity: 1; } 50% { opacity: .3; } }
.cp-track-name { font-size: .58rem; color: var(--muted); font-family: 'Courier New', monospace; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-left: 6px; }
.cp-close { font-size: 13px; color: var(--muted); cursor: pointer; background: none; border: none; transition: color .15s; padding: 0 2px; line-height: 1; }
.cp-close:hover { color: var(--text); }

#comments_list {
    flex: 1; overflow-y: auto; padding: 10px 12px;
    display: flex; flex-direction: column; gap: 10px;
    scrollbar-width: thin; scrollbar-color: var(--border) transparent;
}
#comments_list::-webkit-scrollbar       { width: 3px; }
#comments_list::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }

.cp-empty { text-align: center; padding: 28px 16px; color: var(--muted); font-family: 'Courier New', monospace; font-size: .62rem; letter-spacing: .1em; line-height: 1.7; }
.cp-empty-icon { font-size: 22px; margin-bottom: 8px; opacity: .4; }

.cp-loader { display: flex; align-items: center; justify-content: center; padding: 20px; gap: 5px; }
.cp-loader span { width: 4px; height: 4px; border-radius: 50%; background: var(--primary); animation: cpld .9s ease-in-out infinite; }
.cp-loader span:nth-child(2) { animation-delay: .15s; }
.cp-loader span:nth-child(3) { animation-delay: .30s; }
@keyframes cpld { 0%, 80%, 100% { transform: scale(.4); opacity: .3; } 40% { transform: scale(1); opacity: 1; } }

.cp-input-area {
    border-top: 1px solid var(--border); padding: 10px 12px;
    display: flex; align-items: flex-end; gap: 8px; flex-shrink: 0;
    background: rgba(12,17,28,.7);
}
#comment_input {
    flex: 1; background: var(--surf-el); border: 1px solid var(--border);
    border-radius: 8px; padding: 8px 11px; color: var(--text);
    font-family: inherit; font-size: .73rem; resize: none; outline: none;
    line-height: 1.45; max-height: 90px; min-height: 36px;
    transition: border-color .2s; overflow-y: auto; scrollbar-width: none;
}
#comment_input::-webkit-scrollbar { display: none; }
#comment_input:focus       { border-color: var(--border-hi); }
#comment_input::placeholder { color: var(--muted); font-size: .7rem; }
#comment_input:disabled    { opacity: .4; cursor: not-allowed; }
#btn_send_comment {
    width: 34px; height: 34px; border-radius: 7px; border: none;
    background: var(--primary); color: #000; font-size: 14px; cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0; transition: opacity .15s, transform .15s; align-self: flex-end;
}
#btn_send_comment:hover    { opacity: .85; transform: scale(1.07); }
#btn_send_comment:disabled { opacity: .3; cursor: not-allowed; transform: none; }
.cp-guest-hint { text-align: center; font-family: 'Courier New', monospace; font-size: .58rem; color: var(--muted); padding: 8px 12px 2px; letter-spacing: .06em; }
.cp-guest-hint a { color: var(--primary); text-decoration: none; }
.cp-guest-hint a:hover { text-decoration: underline; }