@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600&family=JetBrains+Mono:wght@400;500;700&display=swap');

:root {
    --glass-bg: rgba(20, 20, 20, 0.55);
    --glass-border: rgba(255, 255, 255, 0.1);
    --text-main: #ffffff;
    --text-muted: #a0a0a0;
}

html {
    font-size: clamp(13px, 0.9vw, 16px);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Inter', sans-serif;
    user-select: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    -webkit-user-drag: none;
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.15) transparent;
}

/* Canvas со снежинками */
#snow-canvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    pointer-events: none;
    z-index: 0;
}

/* Кастомный курсор */
html, body, button, a, .glass-window, .game-item, .playlist-item {
    cursor: url('avatars/cursor.png'), auto !important; 
}

button:hover, a:hover, .game-item:hover, .playlist-item:hover {
    cursor: url('avatars/cursor.png'), pointer !important;
}

img {
    pointer-events: none;
    -webkit-user-drag: none;
}

body {
    background: linear-gradient(-45deg, #0f0c29, #302b63, #24243e, #0f0c29);
    background-size: 400% 400%;
    animation: gradientBG 15s ease infinite;
    color: var(--text-main);
    overflow: hidden; 
}

@keyframes gradientBG {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

#workspace {
    width: 100vw;
    height: 100vh;
    position: relative;
    z-index: 1;
}

/* Окна */
.glass-window {
    background: var(--glass-bg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--glass-border);
    border-radius: 20px;
    box-shadow: 
        0 10px 40px rgba(0, 0, 0, 0.5),
        0 0 20px rgba(112, 0, 255, 0.15),
        inset 0 0 15px rgba(255, 255, 255, 0.03);
    position: absolute; 
    padding: 0;
    transition: transform 0.3s cubic-bezier(0.25, 0.8, 0.25, 1), 
                box-shadow 0.3s ease, 
                border-color 0.3s ease;
    overflow: hidden;
}

.glass-window:hover {
    border-color: rgba(255, 255, 255, 0.22);
    box-shadow: 
        0 12px 45px rgba(0, 0, 0, 0.6),
        0 0 25px rgba(140, 69, 255, 0.3),
        inset 0 0 20px rgba(255, 255, 255, 0.05);
}

.window-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 15px;
    background: rgba(255, 255, 255, 0.04);
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    cursor: grab;
}

.window-header:active {
    cursor: grabbing;
}

.window-title {
    font-size: 0.8rem;
    color: var(--text-muted);
    font-weight: 500;
}

.window-controls {
    display: flex;
    gap: 6px;
}

.win-btn {
    background: rgba(255, 255, 255, 0.1);
    border: none;
    color: #ccc;
    width: 22px;
    height: 22px;
    border-radius: 6px;
    font-size: 11px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: 0.2s;
}

.win-btn:hover { background: rgba(255, 255, 255, 0.25); color: #fff; }

.window-body-wrapper {
    display: grid;
    grid-template-rows: 1fr;
    transition: grid-template-rows 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

.window-body {
    overflow: hidden;
    padding: 18px;
    transition: opacity 0.25s ease, padding 0.35s ease;
    opacity: 1;
}

.glass-window.minimized .window-body-wrapper {
    grid-template-rows: 0fr;
}

.glass-window.minimized .window-body {
    opacity: 0;
    padding-top: 0;
    padding-bottom: 0;
}

/* Позиции окон по умолчанию */
#window-profile     { width: 290px; top: 40px; left: 40px; }
#window-music       { width: 320px; top: 40px; left: 350px; }
#window-discord-rpc { width: 310px; top: 40px; left: 690px; }
#window-clock       { width: 250px; top: 290px; left: 40px; }
#window-socials     { width: 280px; top: 40px; left: 1020px; }
#window-games       { width: 400px; top: 375px; left: 1320px; }
#window-hardware    { width: 340px; top: 40px; left: 1320px; }

/* Профиль */
.profile-avatar-container {
    width: 52px;
    height: 52px;
    border-radius: 50%;
    position: relative;
    flex-shrink: 0;
}

.profile-avatar-img {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
    display: block;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

/* Индикатор статуса Discord */
.discord-status-dot {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    position: absolute;
    bottom: 0;
    right: 0;
    border: 2.5px solid #141414;
    background-color: #747f8d;
    transition: background-color 0.3s ease, box-shadow 0.3s ease;
}

.discord-status-dot.status-online,
.rpc-status-badge.status-online {
    background-color: #23a55a !important;
    box-shadow: 0 0 8px rgba(35, 165, 90, 0.6);
}

.discord-status-dot.status-idle,
.rpc-status-badge.status-idle {
    background-color: #f0b232 !important;
    box-shadow: 0 0 8px rgba(240, 178, 50, 0.6);
}

.discord-status-dot.status-dnd,
.rpc-status-badge.status-dnd {
    background-color: #f23f43 !important;
    box-shadow: 0 0 8px rgba(242, 63, 67, 0.6);
}

.discord-status-dot.status-offline,
.rpc-status-badge.status-offline {
    background-color: #80848e !important;
}

/* Discord Rich Presence */
.rpc-container {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.rpc-user-bar {
    display: flex;
    align-items: center;
    gap: 12px;
}

.rpc-avatar-wrapper {
    position: relative;
    width: 48px;
    height: 48px;
    flex-shrink: 0;
}

.rpc-avatar {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
}

.rpc-status-badge {
    position: absolute;
    bottom: -1px;
    right: -1px;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    border: 2px solid #141414;
}

.rpc-user-info h3 {
    font-size: 0.95rem;
    font-weight: 600;
    margin-bottom: 2px;
}

.rpc-status-text {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.rpc-activity-card {
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 12px;
    padding: 10px;
    display: flex;
    gap: 10px;
    align-items: center;
}

.rpc-activity-icon {
    width: 42px;
    height: 42px;
    border-radius: 8px;
    object-fit: cover;
    background: rgba(255,255,255,0.05);
}

.rpc-activity-details {
    display: flex;
    flex-direction: column;
    gap: 2px;
    overflow: hidden;
}

.rpc-activity-title {
    font-size: 0.8rem;
    font-weight: 600;
    color: #ffffff;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.rpc-activity-subtitle {
    font-size: 0.72rem;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.rpc-loading {
    font-size: 0.8rem;
    color: var(--text-muted);
    text-align: center;
    padding: 10px 0;
}

/* Окно часов */
.clock-body {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 10px 0;
}

#clock-time {
    font-family: 'JetBrains Mono', monospace;
    font-size: 2.2rem;
    font-weight: 700;
    color: #ffffff;
    letter-spacing: 1px;
    text-shadow: 0 4px 20px rgba(255,255,255,0.15);
}

#clock-date {
    font-size: 0.82rem;
    color: var(--text-muted);
    margin-top: 2px;
    text-transform: capitalize;
}

.clock-tz {
    font-size: 0.7rem;
    color: rgba(255, 255, 255, 0.4);
    margin-top: 6px;
    font-family: 'JetBrains Mono', monospace;
}

/* Соцсети (С защитой от Drag-and-Drop) */
.social-btn {
    display: block;
    padding: 8px 12px;
    margin-top: 6px;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 8px;
    text-decoration: none;
    color: white;
    text-align: center;
    font-size: 0.85rem;
    transition: 0.2s;
    user-select: none;
    -webkit-user-select: none;
    -webkit-user-drag: none;
}

.social-btn:hover {
    background: rgba(255, 255, 255, 0.15);
    transform: translateY(-1px);
}

/* Игры */
.games-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
    max-height: 220px;
    overflow-y: auto;
    padding-right: 8px;
}

.game-item {
    padding: 10px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 10px;
    text-align: center;
    font-size: 0.85rem;
    cursor: pointer;
    transition: 0.2s;
    user-select: none;
    -webkit-user-drag: none;
}

.game-item:hover {
    background: rgba(255, 255, 255, 0.15);
}

/* Всплывающие постеры */
#game-hover-poster {
    position: fixed;
    width: 180px;
    height: 260px;
    background-size: cover;
    background-position: center;
    border-radius: 12px;
    pointer-events: none;
    opacity: 0;
    visibility: hidden;
    transform: scale(0.95);
    transition: opacity 0.2s ease, transform 0.2s ease, visibility 0.2s ease;
    z-index: 9999;
    box-shadow: 0 15px 35px rgba(0,0,0,0.6);
}

#game-hover-poster.visible {
    opacity: 1;
    visibility: visible;
    transform: scale(1);
}

#game-hover-poster.multi {
    width: min(520px, 90vw);
    height: 260px;
    background: rgba(15, 15, 15, 0.85);
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    border: 1px solid rgba(255,255,255,0.12);
    padding: 12px;
}

.multi-poster-container {
    display: flex;
    gap: 10px;
    width: 100%;
    height: 100%;
}

.sub-poster-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
}

.sub-poster-img {
    width: 100%;
    height: 205px;
    background-size: cover;
    background-position: center;
    border-radius: 8px;
}

.sub-poster-item span {
    font-size: 0.75rem;
    color: #ddd;
    text-align: center;
}

/* Характеристики */
.hardware-list {
    list-style: none;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.78rem;
    line-height: 1.4;
    color: #cccccc;
    max-height: 240px;
    overflow-y: auto;
    padding-right: 4px;
}

.hardware-list li {
    padding: 3px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.03);
    white-space: pre-wrap;
}

.hardware-list li.hw-header {
    color: #ffffff;
    font-weight: 600;
    padding-top: 10px;
    padding-bottom: 4px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.12);
    letter-spacing: 0.5px;
}

.hardware-list li.hw-header:first-child {
    padding-top: 0;
}

/* Скроллбар */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
    margin: 4px 0;
}

::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.15);
    border-radius: 10px;
    transition: background 0.2s ease;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.35);
}

::-webkit-scrollbar-corner {
    background: transparent;
}

/* Плеер */
.music-body { display: flex; flex-direction: column; align-items: center; }
.music-cover-container { width: 130px; height: 130px; border-radius: 16px; overflow: hidden; background: rgba(0,0,0,0.2); box-shadow: 0 8px 25px rgba(0,0,0,0.4); margin-bottom: 12px; }
#music-cover { width: 100%; height: 100%; object-fit: cover; }
#music-title { font-size: 0.95rem; font-weight: 600; text-align: center; margin-bottom: 10px; }
.music-progress-wrapper { width: 100%; }
.music-progress-bg { width: 100%; height: 5px; background: rgba(255,255,255,0.15); border-radius: 3px; cursor: pointer; overflow: hidden; }
.music-progress-fill { width: 0%; height: 100%; background: #fff; transition: width 0.1s linear; }
.music-time { display: flex; justify-content: space-between; font-size: 0.75rem; color: var(--text-muted); margin-top: 5px; }

.music-controls { display: flex; gap: 12px; margin-top: 12px; align-items: center; justify-content: center; }
.music-controls button { background: rgba(255,255,255,0.08); border: 1px solid rgba(255,255,255,0.1); color: white; border-radius: 50%; width: 42px; height: 42px; cursor: pointer; transition: 0.2s; display: flex; align-items: center; justify-content: center; }
.music-controls button svg { width: 18px; height: 18px; }
.music-controls button:hover { background: rgba(255,255,255,0.2); transform: scale(1.08); }
.music-controls button:active { transform: scale(0.95); }

/* Вертикальный микшер громкости */
.volume-dropdown-wrapper {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}

.volume-popover {
    position: absolute;
    bottom: 50px;
    left: 50%;
    transform: translateX(-50%) translateY(10px) scale(0.9);
    background: rgba(18, 18, 18, 0.85);
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    border: 1px solid rgba(255, 255, 255, 0.15);
    padding: 12px 10px;
    border-radius: 20px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5);
    opacity: 0;
    visibility: hidden;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 100;
}

.volume-popover::after {
    content: '';
    position: absolute;
    bottom: -15px;
    left: 0;
    width: 100%;
    height: 15px;
}

.volume-dropdown-wrapper:hover .volume-popover {
    opacity: 1;
    visibility: visible;
    transform: translateX(-50%) translateY(0) scale(1);
}

.volume-bar-v-bg {
    width: 6px;
    height: 80px;
    background: rgba(255, 255, 255, 0.15);
    border-radius: 4px;
    cursor: pointer;
    position: relative;
    overflow: hidden;
}

.volume-bar-v-fill {
    width: 100%;
    height: 80%;
    background: #ffffff;
    border-radius: 4px;
    position: absolute;
    bottom: 0;
    transition: height 0.05s linear;
}

/* Сворачивание плейлиста */
.playlist-container {
    width: 100%;
    display: grid;
    grid-template-rows: 0fr;
    transition: grid-template-rows 0.35s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.25s ease;
    opacity: 0;
}

.playlist-container.open {
    grid-template-rows: 1fr;
    opacity: 1;
}

.playlist-inner {
    min-height: 0;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.playlist-divider {
    width: 100%;
    height: 1px;
    background: rgba(255, 255, 255, 0.08);
    margin-top: 15px;
    margin-bottom: 12px;
}

.playlist-header {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.8px;
    margin-bottom: 8px;
    padding-left: 2px;
}

.playlist-items {
    max-height: 130px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding-right: 4px;
}

.playlist-item {
    padding: 8px 12px;
    background: rgba(255, 255, 255, 0.04);
    border-radius: 8px;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: space-between;
    user-select: none;
    -webkit-user-drag: none;
}

.playlist-item:hover {
    background: rgba(255, 255, 255, 0.12);
}

.playlist-item.active {
    background: rgba(255, 255, 255, 0.18);
    border: 1px solid rgba(255, 255, 255, 0.2);
    font-weight: 600;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

/* Мобильная адаптивность */
@media (max-width: 768px) {
    body { 
        overflow-y: auto !important; 
    }

    #workspace { 
        display: flex; 
        flex-direction: column; 
        align-items: center; 
        padding: 20px 15px 40px 15px; 
        height: auto; 
        gap: 15px; 
    }

    .glass-window { 
        position: relative !important; 
        top: auto !important; 
        left: auto !important; 
        width: 100% !important; 
        max-width: 450px; 
        transform: none !important; 
    }

    #game-hover-poster { 
        display: none !important; 
    }

    .volume-dropdown-wrapper .volume-popover {
        display: none !important;
    }
}