@font-face {
    font-family: 'Vazirmatn';
    src: url('fonts/Vazirmatn.woff2') format('woff2');
    font-weight: normal;
    font-style: normal;
    font-display: swap;
}

:root {
    --bg: #0a0a1a;
    --card: rgba(20,20,40,0.95);
    --text: #e0e0e0;
    --primary: #6c63ff;
    --accent: #00d2ff;
    --green: #00ff88;
    --pink: #ff6584;
    --red: #ff4757;
    --glass: rgba(255,255,255,0.04);
    --border: rgba(255,255,255,0.08);
    --shadow: 0 8px 32px rgba(0,0,0,0.6);
    --radius: 20px;
}
body.light {
    --bg: #f0f2f5;
    --card: rgba(255,255,255,0.95);
    --text: #1a1a2e;
    --glass: rgba(0,0,0,0.02);
    --border: rgba(0,0,0,0.08);
    --shadow: 0 8px 32px rgba(0,0,0,0.08);
}

* { margin: 0; padding: 0; box-sizing: border-box; }
body {
    font-family: 'Vazirmatn', 'Tahoma', sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 12px;
    transition: all 0.3s;
    -webkit-tap-highlight-color: transparent;
    user-select: none;
}

#app {
    width: 100%;
    max-width: 440px;
    background: var(--card);
    backdrop-filter: blur(40px);
    -webkit-backdrop-filter: blur(40px);
    border: 1px solid var(--border);
    border-radius: 28px;
    padding: 20px 16px;
    box-shadow: var(--shadow);
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.header { display: flex; align-items: center; justify-content: space-between; }
.header h1 {
    font-size: 1.2rem; font-weight: 900;
    background: linear-gradient(135deg, var(--primary), var(--accent), var(--pink));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}
.icon-btn {
    width: 36px; height: 36px; border-radius: 50%;
    border: 1px solid var(--border); background: var(--glass);
    color: var(--text); font-size: 1rem; cursor: pointer;
    display: flex; align-items: center; justify-content: center;
}
.icon-btn:active { transform: scale(0.9); }

.now-playing {
    display: flex; align-items: center; gap: 12px;
    background: var(--glass); border: 1px solid var(--border);
    border-radius: var(--radius); padding: 14px;
}
.cover-img {
    width: 64px; height: 64px; border-radius: 14px;
    object-fit: cover; flex-shrink: 0; background: var(--glass);
}
.song-info { flex: 1; min-width: 0; }
.song-title { font-weight: 700; font-size: 0.9rem; }
.song-artist { font-size: 0.72rem; opacity: 0.5; margin-top: 2px; }

.equalizer {
    display: flex; align-items: flex-end; justify-content: center;
    gap: 3px; height: 40px;
}
.equalizer .bar {
    width: 4px; background: var(--primary); border-radius: 2px;
    transition: height 0.15s ease; height: 4px;
}
.equalizer.active .bar { animation: eq 0.8s ease-in-out infinite alternate; }
.equalizer .bar:nth-child(odd) { animation-delay: 0.2s; }
.equalizer .bar:nth-child(even) { animation-delay: 0.5s; }
@keyframes eq { 0% { height: 4px; } 100% { height: 36px; } }

.progress-container { margin: 2px 0; }
.progress-bar {
    width: 100%; height: 6px; background: var(--border);
    border-radius: 3px; cursor: pointer;
}
.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary), var(--accent), var(--green));
    border-radius: 3px; width: 0%; transition: width 0.1s linear;
}
.time-row { display: flex; justify-content: space-between; font-size: 0.7rem; opacity: 0.5; margin-top: 4px; }

.controls { display: flex; justify-content: center; align-items: center; gap: 12px; }
.ctrl-btn {
    width: 40px; height: 40px; border-radius: 50%;
    border: 1px solid var(--border); background: var(--glass);
    color: var(--text); font-size: 0.9rem; cursor: pointer;
    display: flex; align-items: center; justify-content: center;
}
.ctrl-btn:active { transform: scale(0.9); }
.play-btn {
    width: 56px; height: 56px; font-size: 1.3rem;
    background: var(--primary); border-color: var(--primary);
    box-shadow: 0 4px 20px rgba(108,99,255,0.4);
}
.ctrl-btn.active { color: var(--green); border-color: var(--green); }

.volume-row { display: flex; align-items: center; gap: 8px; }
.volume-row i { font-size: 0.75rem; opacity: 0.5; }
.volume-slider {
    flex: 1; height: 4px; -webkit-appearance: none;
    background: var(--border); border-radius: 2px; outline: none;
    accent-color: var(--primary);
}

.playlist {
    background: var(--glass); border: 1px solid var(--border);
    border-radius: var(--radius); padding: 12px;
    max-height: 200px; overflow-y: auto;
    display: flex; flex-direction: column; gap: 8px;
}
.playlist-header { display: flex; justify-content: space-between; font-size: 0.8rem; font-weight: 700; }
.song-count { font-size: 0.7rem; opacity: 0.5; }
.search-box {
    width: 100%; padding: 8px 12px;
    background: var(--glass); border: 1px solid var(--border);
    border-radius: 14px; color: var(--text);
    font-family: 'Vazirmatn', 'Tahoma', sans-serif;
    font-size: 0.75rem; outline: none;
}
.search-box:focus { border-color: var(--primary); }
.playlist-items { display: flex; flex-direction: column; gap: 4px; }
.empty-state { text-align: center; padding: 20px; font-size: 0.8rem; opacity: 0.4; }
.playlist-item {
    padding: 8px 12px; border-radius: 14px;
    cursor: pointer; display: flex; align-items: center;
    gap: 8px; font-size: 0.75rem;
}
.playlist-item:active { background: var(--glass); }
.playlist-item.playing { background: rgba(108,99,255,0.12); border: 1px solid rgba(108,99,255,0.2); }
.playlist-item .idx {
    width: 24px; height: 24px; border-radius: 50%;
    background: var(--glass); display: flex;
    align-items: center; justify-content: center;
    font-size: 0.65rem; font-weight: 700; flex-shrink: 0;
}
.playlist-item.playing .idx { background: var(--primary); color: #fff; }
.playlist-item .info { flex: 1; min-width: 0; }
.playlist-item .name { font-weight: 600; }
.playlist-item .artist { font-size: 0.65rem; opacity: 0.5; }
.playlist-item .del-btn { opacity: 0.4; color: var(--red); cursor: pointer; font-size: 0.75rem; padding: 4px; }

.bottom-actions { display: flex; gap: 8px; }
.action-btn {
    flex: 1; padding: 12px; border-radius: 14px;
    border: 1px solid var(--border); background: var(--glass);
    color: var(--text); font-family: 'Vazirmatn', 'Tahoma', sans-serif;
    font-weight: 600; font-size: 0.8rem; cursor: pointer;
    text-align: center; transition: all 0.15s;
}
.action-btn:active { background: rgba(108,99,255,0.1); border-color: var(--primary); }

.footer { text-align: center; padding-top: 10px; border-top: 1px solid var(--border); font-size: 0.68rem; opacity: 0.5; }
.footer .designer span { font-weight: 700; color: var(--primary); }
.footer .contact { cursor: pointer; color: var(--primary); margin-top: 2px; }
.footer .version { font-size: 0.6rem; opacity: 0.4; margin-top: 4px; }

::-webkit-scrollbar { width: 3px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }