:root {
    --bg-primary: #0a0a0a;
    --bg-secondary: #141414;
    --bg-tertiary: #1a1a1a;
    --bg-hover: #242424;
    --bg-active: #2a2a2a;
    
    --text-primary: #ffffff;
    --text-secondary: #a0a0a0;
    --text-muted: #666666;
    
    --accent: #ffffff;
    --accent-hover: #e0e0e0;
    
    --border: #2a2a2a;
    --border-light: #333333;
    
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 8px 40px rgba(0, 0, 0, 0.5);
    
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 14px;
    --radius-full: 50%;
    
    --transition-fast: 150ms ease;
    --transition-normal: 250ms ease;
    
    --space-xs: 4px;
    --space-sm: 8px;
    --space-md: 12px;
    --space-lg: 16px;
    --space-xl: 20px;
    
    --font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    --font-size-xs: 0.75rem;
    --font-size-sm: 0.8125rem;
    --font-size-base: 0.9375rem;
    --font-size-lg: 1rem;
    --font-size-xl: 1.125rem;
    --font-size-2xl: 1.25rem;
}

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

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

body {
    font-family: var(--font-family);
    background: var(--bg-primary);
    color: var(--text-primary);
    height: 100vh;
    line-height: 1.4;
    overflow: hidden;
}

.app {
    height: 100vh;
    display: flex;
    flex-direction: column;
    padding: var(--space-md);
}

.header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-sm) 0;
    border-bottom: 1px solid var(--border);
    gap: var(--space-md);
    flex-shrink: 0;
}

.header__brand {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
}

.header__logo {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--text-primary);
    color: var(--bg-primary);
    border-radius: var(--radius-full);
    font-size: var(--font-size-base);
}

.header__title {
    font-size: var(--font-size-lg);
    font-weight: 600;
    letter-spacing: -0.02em;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-xs);
    padding: var(--space-xs) var(--space-sm);
    border: none;
    border-radius: var(--radius-md);
    font-family: inherit;
    font-size: var(--font-size-sm);
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition-fast);
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

.btn:hover {
    background: var(--bg-hover);
}

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

.btn--upload {
    background: var(--text-primary);
    color: var(--bg-primary);
    cursor: pointer;
    text-decoration: none;
}

#fileInput {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.btn--upload:hover {
    background: var(--accent-hover);
}

.btn--icon {
    width: 40px;
    height: 40px;
    padding: 0;
    background: transparent;
    color: var(--text-secondary);
}

.btn--icon:hover {
    color: var(--text-primary);
    background: var(--bg-hover);
}

.btn--icon.active {
    color: var(--text-primary);
}

.btn--play {
    width: 56px;
    height: 56px;
    background: var(--text-primary);
    color: var(--bg-primary);
    border-radius: var(--radius-full);
    font-size: var(--font-size-lg);
}

.btn--play:hover {
    transform: scale(1.05);
    background: var(--accent-hover);
}

.btn--play.playing {
    animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(255, 255, 255, 0.4); }
    50% { box-shadow: 0 0 0 10px rgba(255, 255, 255, 0); }
}

.main {
    flex: 1;
    display: grid;
    grid-template-columns: 1fr 280px;
    gap: var(--space-md);
    padding: var(--space-md) 0;
    min-height: 0;
    overflow: hidden;
}

.player {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: var(--space-lg);
    padding: var(--space-xl);
    background: var(--bg-secondary);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
    width: 100%;
    height: 100%;
    min-height: 400px;
}

.player__visualizer {
    width: 100%;
    height: 50px;
    min-height: 40px;
    border-radius: var(--radius-sm);
    overflow: hidden;
    background: var(--bg-tertiary);
}

.player__visualizer canvas {
    width: 100%;
    height: 100%;
    display: block;
}

.player__art {
    position: relative;
    width: 220px;
    height: 220px;
}

.player__art-inner {
    width: 100%;
    height: 100%;
    border-radius: var(--radius-full);
    background: linear-gradient(145deg, #1a1a1a, #0a0a0a);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 4rem;
    color: var(--text-muted);
    box-shadow: var(--shadow-lg);
    transition: transform var(--transition-normal);
    overflow: hidden;
}

.player__art-inner img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: none;
}

.player__art-inner.playing {
    animation: rotate 20s linear infinite;
}

.player__art-inner.playing img {
    display: block;
}

@keyframes rotate {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.player__info {
    text-align: center;
}

.player__title {
    font-size: var(--font-size-base);
    font-weight: 600;
    margin-bottom: 2px;
    max-width: 100%;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.player__artist {
    font-size: var(--font-size-xs);
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.player__progress {
    width: 100%;
    max-width: 400px;
    display: flex;
    align-items: center;
    gap: var(--space-md);
}

.player__time {
    font-size: var(--font-size-xs);
    color: var(--text-muted);
    min-width: 36px;
    font-variant-numeric: tabular-nums;
}

.player__progress-bar {
    flex: 1;
    height: 4px;
    background: var(--bg-tertiary);
    border-radius: 2px;
    cursor: pointer;
    position: relative;
    transition: height var(--transition-fast);
}

.player__progress-bar:hover {
    height: 6px;
}

.player__progress-bar:hover .player__progress-thumb {
    opacity: 1;
    transform: translateY(-50%) scale(1);
}

.player__progress-fill {
    height: 100%;
    background: var(--text-primary);
    border-radius: 2px;
    width: 0%;
    transition: width 100ms linear;
}

.player__progress-thumb {
    position: absolute;
    top: 50%;
    left: 0%;
    width: 12px;
    height: 12px;
    background: var(--text-primary);
    border-radius: var(--radius-full);
    transform: translateY(-50%) translateX(-50%) scale(0);
    opacity: 0;
    transition: all var(--transition-fast);
    box-shadow: var(--shadow-sm);
}

.player__controls {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
}

.player__volume {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    width: 100%;
    max-width: 140px;
}

.player__volume-bar {
    flex: 1;
    height: 4px;
    background: var(--bg-tertiary);
    border-radius: 2px;
    cursor: pointer;
    position: relative;
}

.player__volume-fill {
    height: 100%;
    background: var(--text-primary);
    border-radius: 2px;
    width: 70%;
    transition: width var(--transition-fast);
}

.playlist {
    display: flex;
    flex-direction: column;
    background: var(--bg-secondary);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
    overflow: hidden;
    min-height: 0;
}

.playlist__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-sm) var(--space-md);
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}

.playlist__title {
    font-size: var(--font-size-sm);
    font-weight: 600;
}

.playlist__count {
    font-size: var(--font-size-xs);
    color: var(--text-muted);
}

.playlist__list {
    flex: 1;
    overflow-y: auto;
    padding: var(--space-xs);
}

.playlist__list::-webkit-scrollbar {
    width: 4px;
}

.playlist__list::-webkit-scrollbar-track {
    background: transparent;
}

.playlist__list::-webkit-scrollbar-thumb {
    background: var(--border-light);
    border-radius: 2px;
}

.playlist__empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: var(--space-sm);
    padding: var(--space-xl);
    color: var(--text-muted);
    text-align: center;
}

.playlist__empty i {
    font-size: 2rem;
    opacity: 0.3;
}

.playlist__empty p {
    font-size: var(--font-size-xs);
}

.track-item {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    padding: var(--space-xs) var(--space-sm);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: background var(--transition-fast);
}

.track-item:hover {
    background: var(--bg-hover);
}

.track-item.active {
    background: var(--bg-active);
}

.track-item.active .track-item__title {
    color: var(--text-primary);
}

.track-item__icon {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-tertiary);
    border-radius: var(--radius-sm);
    color: var(--text-muted);
    font-size: var(--font-size-xs);
    flex-shrink: 0;
}

.track-item.active .track-item__icon {
    background: var(--text-primary);
    color: var(--bg-primary);
}

.track-item__info {
    flex: 1;
    min-width: 0;
}

.track-item__title {
    font-size: var(--font-size-xs);
    font-weight: 500;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.track-item__artist {
    font-size: 0.6875rem;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.track-item__duration {
    font-size: var(--font-size-xs);
    color: var(--text-muted);
    font-variant-numeric: tabular-nums;
    flex-shrink: 0;
}

.track-item__delete {
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    border-radius: var(--radius-sm);
    color: var(--text-muted);
    cursor: pointer;
    opacity: 0;
    transition: all var(--transition-fast);
    flex-shrink: 0;
}

.track-item:hover .track-item__delete {
    opacity: 1;
}

.track-item__delete:hover {
    background: rgba(255, 59, 48, 0.1);
    color: #ff3b30;
}

.footer {
    padding: var(--space-sm) 0;
    text-align: center;
    color: var(--text-muted);
    font-size: var(--font-size-xs);
    border-top: 1px solid var(--border);
    flex-shrink: 0;
}

.footer a {
    color: var(--text-muted);
    text-decoration: none;
    transition: color var(--transition-fast);
}

.footer a:hover {
    color: var(--text-primary);
}

.drop-zone {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: all var(--transition-normal);
}

.drop-zone.active {
    opacity: 1;
    visibility: visible;
}

.drop-zone__content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--space-md);
    padding: var(--space-xl);
    border: 2px dashed var(--border-light);
    border-radius: var(--radius-lg);
    color: var(--text-secondary);
}

.drop-zone__content i {
    font-size: 3rem;
}

.drop-zone__content p {
    font-size: var(--font-size-sm);
}

.drop-zone__hint {
    font-size: var(--font-size-xs) !important;
    opacity: 0.6;
}

@media (max-width: 900px) {
    .main {
        grid-template-columns: 1fr;
        grid-template-rows: auto 1fr;
    }
    
    .playlist {
        max-height: 300px;
    }
    
    .player {
        padding: var(--space-md);
        gap: var(--space-sm);
    }
    
    .player__art {
        width: 140px;
        height: 140px;
    }
}

@media (max-width: 640px) {
    .app {
        padding: var(--space-sm);
    }
    
    .header {
        padding: var(--space-xs) 0;
    }
    
    .header__title {
        font-size: var(--font-size-base);
    }
    
    .header__logo {
        width: 32px;
        height: 32px;
    }
    
    .btn--upload span {
        display: none;
    }
    
    .btn--upload {
        width: 36px;
        height: 36px;
        padding: 0;
    }
    
    .main {
        padding: var(--space-sm) 0;
        gap: var(--space-sm);
    }
    
    .player {
        padding: var(--space-md);
    }
    
    .player__art {
        width: 120px;
        height: 120px;
    }
    
    .player__art-inner {
        font-size: 2.5rem;
    }
    
    .player__title {
        font-size: var(--font-size-sm);
    }
    
    .player__controls {
        gap: var(--space-xs);
    }
    
    .btn--play {
        width: 44px;
        height: 44px;
    }
    
    .btn--icon {
        width: 32px;
        height: 32px;
    }
    
    .player__volume {
        display: none;
    }
    
    .player__visualizer {
        height: 40px;
    }
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

[hidden] {
    display: none !important;
}

.upload-progress {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.upload-progress__content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--space-md);
    padding: var(--space-xl);
    background: var(--bg-secondary);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
    min-width: 240px;
}

.upload-progress__content i {
    font-size: 2rem;
    color: var(--text-primary);
}

.upload-progress__text {
    font-size: var(--font-size-sm);
    color: var(--text-primary);
}

.upload-progress__count {
    font-size: var(--font-size-xs);
    color: var(--text-secondary);
}

.upload-progress__bar {
    width: 100%;
    height: 6px;
    background: var(--bg-tertiary);
    border-radius: 3px;
    overflow: hidden;
}

.upload-progress__fill {
    height: 100%;
    background: var(--text-primary);
    border-radius: 3px;
    width: 0%;
    transition: width 0.3s ease;
}

.btn--folder {
    background: var(--bg-tertiary) !important;
}

.btn--folder:hover {
    background: var(--bg-hover) !important;
}
