/* ============================================
   MELODEX - Main Stylesheet v2.0
   Fully Responsive: Mobile / Tablet / Desktop
   Colors: #7B3FF2 #FF2D98 #5A8BFF #121C3B
============================================ */

@import url('https://fonts.googleapis.com/css2?family=Clash+Display:wght@400;500;600;700&family=DM+Sans:ital,opsz,wght@0,9..40,300;0,9..40,400;0,9..40,500;0,9..40,600;1,9..40,400&display=swap');

:root {
  --purple: #7B3FF2;
  --pink: #FF2D98;
  --blue: #5A8BFF;
  --dark: #121C3B;
  --dark2: #0D1530;
  --dark3: #1A2548;
  --dark4: #222F5A;
  --text-primary: #F0F4FF;
  --text-secondary: #8892B0;
  --text-muted: #4A5578;
  --sidebar-w: 260px;
  --player-h: 88px;
  --mobile-nav-h: 62px;
  --radius: 12px;
  --radius-sm: 8px;
  --transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  --glow-purple: 0 0 30px rgba(123, 63, 242, 0.4);
  --glow-pink: 0 0 30px rgba(255, 45, 152, 0.4);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-top: env(safe-area-inset-top, 0px);
}

*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html { font-size: 16px; scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body { font-family: 'DM Sans', -apple-system, BlinkMacSystemFont, sans-serif; background-color: var(--dark2); color: var(--text-primary); min-height: 100vh; overflow-x: hidden; user-select: none; -webkit-font-smoothing: antialiased; }
h1,h2,h3,h4 { font-family: 'Clash Display', sans-serif; }
a { color: inherit; text-decoration: none; }
button,input,textarea,select { font-family: inherit; font-size: inherit; }
img { max-width: 100%; display: block; }

::-webkit-scrollbar { width: 4px; height: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--dark4); border-radius: 10px; }
::-webkit-scrollbar-thumb:hover { background: var(--purple); }

/* LAYOUT */
.app-layout {
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  grid-template-rows: 1fr var(--player-h);
  height: 100vh;
  height: 100dvh;
  grid-template-areas: "sidebar main" "player player";
  overflow: hidden;
}

/* SIDEBAR */
.sidebar {
  grid-area: sidebar;
  background: var(--dark);
  border-right: 1px solid rgba(90,139,255,0.08);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  position: relative;
  z-index: 100;
}
.sidebar::before { content:''; position:absolute; top:-100px; left:-100px; width:300px; height:300px; background:radial-gradient(circle,rgba(123,63,242,0.12) 0%,transparent 70%); pointer-events:none; }
.sidebar-logo { padding:24px 20px 18px; display:flex; align-items:center; gap:10px; flex-shrink:0; }
.sidebar-logo .logo-icon { width:34px; height:34px; }
.sidebar-logo .logo-text { font-family:'Clash Display',sans-serif; font-size:1.45rem; font-weight:700; background:linear-gradient(90deg,var(--purple),var(--blue)); -webkit-background-clip:text; -webkit-text-fill-color:transparent; background-clip:text; }
.sidebar-nav { padding:6px 10px; display:flex; flex-direction:column; gap:2px; flex-shrink:0; }
.nav-item { display:flex; align-items:center; gap:13px; padding:10px 13px; border-radius:var(--radius-sm); cursor:pointer; transition:var(--transition); color:var(--text-secondary); font-weight:500; font-size:0.875rem; border:none; background:none; width:100%; text-align:left; white-space:nowrap; touch-action:manipulation; }
.nav-item:hover { background:rgba(123,63,242,0.1); color:var(--text-primary); }
.nav-item.active { background:rgba(123,63,242,0.18); color:var(--purple); }
.nav-item svg { flex-shrink:0; }
.sidebar-divider { height:1px; background:rgba(90,139,255,0.08); margin:10px 14px; flex-shrink:0; }
.sidebar-section-title { padding:4px 23px; font-size:0.68rem; font-weight:600; letter-spacing:0.1em; text-transform:uppercase; color:var(--text-muted); flex-shrink:0; }
.sidebar-playlists { flex:1; overflow-y:auto; padding:2px 10px; min-height:0; }
.playlist-item { display:flex; align-items:center; gap:10px; padding:8px 12px; border-radius:var(--radius-sm); cursor:pointer; transition:var(--transition); color:var(--text-secondary); font-size:0.85rem; }
.playlist-item:hover { background:rgba(90,139,255,0.08); color:var(--text-primary); }
.playlist-item-thumb { width:30px; height:30px; border-radius:5px; background:linear-gradient(135deg,var(--purple),var(--blue)); flex-shrink:0; display:flex; align-items:center; justify-content:center; font-size:0.7rem; overflow:hidden; }
.playlist-item-thumb img { width:100%; height:100%; object-fit:cover; }
.playlist-item-name { flex:1; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.btn-new-playlist { margin:6px 10px; display:flex; align-items:center; gap:8px; padding:9px 13px; border-radius:var(--radius-sm); background:rgba(123,63,242,0.12); border:1px dashed rgba(123,63,242,0.3); color:var(--purple); cursor:pointer; transition:var(--transition); font-size:0.85rem; font-weight:500; width:calc(100% - 20px); flex-shrink:0; touch-action:manipulation; }
.btn-new-playlist:hover { background:rgba(123,63,242,0.2); border-color:var(--purple); }
.sidebar-user { padding:14px 12px; border-top:1px solid rgba(90,139,255,0.08); display:flex; align-items:center; gap:10px; cursor:pointer; transition:var(--transition); flex-shrink:0; }
.sidebar-user:hover { background:rgba(255,255,255,0.03); }
.user-avatar { width:34px; height:34px; border-radius:50%; background:linear-gradient(135deg,var(--purple),var(--pink)); display:flex; align-items:center; justify-content:center; font-size:0.8rem; font-weight:700; color:white; flex-shrink:0; }
.user-info { flex:1; min-width:0; }
.user-name { font-size:0.85rem; font-weight:600; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.user-status { font-size:0.72rem; color:var(--text-muted); }

/* MAIN CONTENT */
.main-content { grid-area:main; overflow-y:auto; overflow-x:hidden; background:linear-gradient(180deg,rgba(123,63,242,0.06) 0%,var(--dark2) 260px); position:relative; min-width:0; }
.main-header { position:sticky; top:0; z-index:50; background:rgba(13,21,48,0.88); backdrop-filter:blur(20px); -webkit-backdrop-filter:blur(20px); border-bottom:1px solid rgba(90,139,255,0.06); padding:10px 20px; display:flex; align-items:center; gap:12px; }
.header-logo-mobile { display:none; align-items:center; gap:8px; flex-shrink:0; }
.header-logo-mobile .logo-text { font-family:'Clash Display',sans-serif; font-size:1.2rem; font-weight:700; background:linear-gradient(90deg,var(--purple),var(--blue)); -webkit-background-clip:text; -webkit-text-fill-color:transparent; background-clip:text; }
.search-bar { flex:1; max-width:460px; position:relative; }
.search-bar input { width:100%; background:rgba(255,255,255,0.05); border:1px solid rgba(90,139,255,0.12); border-radius:40px; padding:9px 14px 9px 40px; color:var(--text-primary); font-size:0.875rem; transition:var(--transition); outline:none; -webkit-appearance:none; }
.search-bar input::placeholder { color:var(--text-muted); }
.search-bar input:focus { border-color:rgba(123,63,242,0.5); background:rgba(123,63,242,0.06); box-shadow:0 0 0 3px rgba(123,63,242,0.1); }
.search-bar .search-icon { position:absolute; left:12px; top:50%; transform:translateY(-50%); color:var(--text-muted); pointer-events:none; }
.header-actions { display:flex; align-items:center; gap:8px; margin-left:auto; flex-shrink:0; }

/* BUTTONS */
.btn { padding:8px 18px; border-radius:40px; font-size:0.85rem; font-weight:600; cursor:pointer; transition:var(--transition); border:none; white-space:nowrap; touch-action:manipulation; }
.btn-ghost { background:transparent; color:var(--text-secondary); border:1px solid rgba(90,139,255,0.15); }
.btn-ghost:hover { color:var(--text-primary); border-color:rgba(90,139,255,0.4); }
.btn-primary { background:linear-gradient(135deg,var(--purple),var(--pink)); color:white; box-shadow:0 4px 14px rgba(123,63,242,0.35); }
.btn-primary:hover { transform:translateY(-1px); box-shadow:0 6px 20px rgba(123,63,242,0.5); }
.btn-primary:active { transform:translateY(0); }
.btn-icon { width:34px; height:34px; border-radius:50%; background:rgba(255,255,255,0.05); border:1px solid rgba(90,139,255,0.12); color:var(--text-secondary); display:flex; align-items:center; justify-content:center; cursor:pointer; transition:var(--transition); flex-shrink:0; touch-action:manipulation; }
.btn-icon:hover { background:rgba(123,63,242,0.15); color:var(--purple); }

/* SECTIONS */
.page-section { padding:22px; display:none; }
.page-section.active { display:block; }
.section-header { display:flex; align-items:flex-start; justify-content:space-between; margin-bottom:18px; gap:10px; }
.section-title { font-size:1.3rem; font-weight:700; }
.section-subtitle { font-size:0.82rem; color:var(--text-muted); margin-top:2px; }
.see-all { font-size:0.8rem; color:var(--purple); cursor:pointer; font-weight:500; transition:var(--transition); flex-shrink:0; margin-top:4px; }
.see-all:hover { text-decoration:underline; }

/* SONG CARDS */
.songs-grid { display:grid; grid-template-columns:repeat(auto-fill,minmax(155px,1fr)); gap:14px; }
.song-card { background:rgba(255,255,255,0.03); border:1px solid rgba(90,139,255,0.06); border-radius:var(--radius); padding:12px; cursor:pointer; transition:var(--transition); position:relative; }
.song-card:hover { background:rgba(123,63,242,0.1); border-color:rgba(123,63,242,0.2); transform:translateY(-2px); }
.song-card:active { transform:scale(0.97); }
.song-card-thumb { width:100%; aspect-ratio:1; border-radius:var(--radius-sm); margin-bottom:10px; background:var(--dark3); position:relative; overflow:hidden; }
.song-card-thumb img { width:100%; height:100%; object-fit:cover; }
.song-card-play { position:absolute; bottom:7px; right:7px; width:36px; height:36px; border-radius:50%; background:linear-gradient(135deg,var(--purple),var(--pink)); border:none; color:white; display:flex; align-items:center; justify-content:center; opacity:0; transform:translateY(6px); transition:var(--transition); cursor:pointer; box-shadow:0 4px 12px rgba(123,63,242,0.5); touch-action:manipulation; }
.song-card:hover .song-card-play { opacity:1; transform:translateY(0); }
@media (hover:none) { .song-card-play { opacity:1; transform:translateY(0); } }
.song-card-title { font-size:0.85rem; font-weight:600; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; margin-bottom:3px; }
.song-card-artist { font-size:0.75rem; color:var(--text-muted); white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }

/* SONG LIST */
.songs-list { display:flex; flex-direction:column; gap:2px; }
.song-list-header { display:grid; grid-template-columns:36px 1fr 150px 55px 36px; padding:7px 10px; font-size:0.72rem; color:var(--text-muted); font-weight:500; letter-spacing:0.05em; text-transform:uppercase; border-bottom:1px solid rgba(90,139,255,0.08); margin-bottom:4px; }
.song-row { display:grid; grid-template-columns:36px 1fr 150px 55px 36px; align-items:center; padding:7px 10px; border-radius:var(--radius-sm); cursor:pointer; transition:var(--transition); gap:8px; }
.song-row:hover { background:rgba(255,255,255,0.04); }
.song-row:active { background:rgba(123,63,242,0.06); }
.song-row.playing { background:rgba(123,63,242,0.1); }
.song-row.playing .song-title { color:var(--purple); }
.song-row-num { font-size:0.85rem; color:var(--text-muted); text-align:center; position:relative; }
.song-row-num .play-icon { display:none; }
.song-row:hover .song-row-num .num { display:none; }
.song-row:hover .song-row-num .play-icon { display:flex; justify-content:center; }
.song-row-info { display:flex; align-items:center; gap:10px; min-width:0; }
.song-row-thumb { width:38px; height:38px; border-radius:6px; background:var(--dark3); flex-shrink:0; overflow:hidden; }
.song-row-thumb img { width:100%; height:100%; object-fit:cover; }
.song-title { font-size:0.85rem; font-weight:500; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.song-artist { font-size:0.75rem; color:var(--text-muted); white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.song-duration { font-size:0.78rem; color:var(--text-muted); text-align:right; }
.song-actions { display:flex; align-items:center; gap:4px; opacity:0; transition:var(--transition); }
.song-row:hover .song-actions { opacity:1; }
@media (hover:none) { .song-actions { opacity:1; } }
.btn-fav { background:none; border:none; color:var(--text-muted); cursor:pointer; padding:4px; border-radius:4px; transition:var(--transition); display:flex; align-items:center; touch-action:manipulation; }
.btn-fav:hover { color:var(--pink); }
.btn-fav.active { color:var(--pink) !important; opacity:1 !important; }
.song-row .btn-fav.active { opacity:1; }

/* PLAYER */
.player { grid-area:player; background:rgba(13,21,48,0.96); backdrop-filter:blur(30px); -webkit-backdrop-filter:blur(30px); border-top:1px solid rgba(90,139,255,0.1); display:flex; align-items:center; padding:0 20px; gap:12px; z-index:200; }
.player-song { display:flex; align-items:center; gap:12px; width:260px; min-width:0; flex-shrink:0; }
.player-thumb { width:50px; height:50px; border-radius:8px; background:linear-gradient(135deg,var(--dark3),var(--dark4)); flex-shrink:0; overflow:hidden; box-shadow:0 4px 12px rgba(0,0,0,0.3); }
.player-thumb img { width:100%; height:100%; object-fit:cover; }
.player-song-info { flex:1; min-width:0; }
.player-song-title { font-size:0.85rem; font-weight:600; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.player-song-artist { font-size:0.75rem; color:var(--text-muted); white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.player-fav { background:none; border:none; color:var(--text-muted); cursor:pointer; transition:var(--transition); padding:5px; flex-shrink:0; touch-action:manipulation; }
.player-fav:hover { color:var(--pink); }
.player-fav.active { color:var(--pink); }
.player-controls { flex:1; display:flex; flex-direction:column; align-items:center; gap:6px; min-width:0; }
.player-buttons { display:flex; align-items:center; gap:16px; }
.btn-control { background:none; border:none; color:var(--text-secondary); cursor:pointer; transition:var(--transition); padding:6px; border-radius:50%; display:flex; align-items:center; justify-content:center; touch-action:manipulation; }
.btn-control:hover { color:var(--text-primary); }
.btn-control.active { color:var(--purple); }
.btn-play-main { width:42px; height:42px; border-radius:50%; background:white; color:var(--dark2); display:flex; align-items:center; justify-content:center; border:none; cursor:pointer; transition:var(--transition); box-shadow:0 4px 14px rgba(0,0,0,0.3); touch-action:manipulation; }
.btn-play-main:hover { transform:scale(1.07); box-shadow:0 6px 20px rgba(255,255,255,0.15); }
.btn-play-main:active { transform:scale(0.95); }
.player-progress { display:flex; align-items:center; gap:9px; width:100%; max-width:480px; }
.progress-time { font-size:0.68rem; color:var(--text-muted); width:32px; flex-shrink:0; }
.progress-time.end { text-align:right; }
.progress-bar { flex:1; height:4px; background:rgba(255,255,255,0.1); border-radius:10px; cursor:pointer; position:relative; transition:height 0.15s; touch-action:none; }
.progress-bar:hover { height:6px; }
.progress-fill { height:100%; background:linear-gradient(90deg,var(--purple),var(--blue)); border-radius:10px; position:relative; transition:width 0.1s linear; pointer-events:none; }
.progress-fill::after { content:''; position:absolute; right:-5px; top:50%; transform:translateY(-50%); width:12px; height:12px; border-radius:50%; background:white; opacity:0; transition:opacity 0.15s; }
.progress-bar:hover .progress-fill::after { opacity:1; }
.player-volume { display:flex; align-items:center; gap:8px; width:140px; flex-shrink:0; }
.volume-bar { flex:1; height:4px; background:rgba(255,255,255,0.1); border-radius:10px; cursor:pointer; position:relative; touch-action:none; }
.volume-fill { height:100%; background:var(--text-secondary); border-radius:10px; transition:width 0.1s; }

/* HERO */
.hero-banner { background:linear-gradient(135deg,rgba(123,63,242,0.3) 0%,rgba(90,139,255,0.2) 50%,rgba(255,45,152,0.15) 100%); border-radius:16px; padding:32px 28px; margin-bottom:28px; position:relative; overflow:hidden; }
.hero-banner::before { content:''; position:absolute; inset:0; background:url("data:image/svg+xml,%3Csvg width='500' height='200' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M0 100 Q50 60 100 100 Q150 140 200 100 Q250 60 300 100 Q350 140 400 100 Q450 60 500 100' stroke='rgba(255,255,255,0.05)' stroke-width='2' fill='none'/%3E%3C/svg%3E") center/cover; pointer-events:none; }
.hero-title { font-size:2rem; font-weight:700; line-height:1.2; margin-bottom:8px; }
.hero-title span { background:linear-gradient(90deg,var(--pink),var(--purple),var(--blue)); -webkit-background-clip:text; -webkit-text-fill-color:transparent; background-clip:text; }
.hero-sub { color:var(--text-secondary); font-size:0.9rem; margin-bottom:18px; }

/* LOADING */
.loading-spinner { display:flex; align-items:center; justify-content:center; padding:40px; }
.spinner { width:32px; height:32px; border:3px solid rgba(123,63,242,0.2); border-top-color:var(--purple); border-radius:50%; animation:spin 0.8s linear infinite; }
@keyframes spin { to { transform:rotate(360deg); } }

/* EMPTY */
.empty-state { text-align:center; padding:50px 20px; color:var(--text-muted); }
.empty-icon { font-size:2.8rem; margin-bottom:14px; opacity:0.5; }
.empty-title { font-family:'Clash Display',sans-serif; font-size:1.05rem; color:var(--text-secondary); margin-bottom:6px; }

/* PLAYLIST HERO */
.playlist-hero { display:flex; gap:24px; padding:22px 22px 0; align-items:flex-end; background:linear-gradient(180deg,rgba(123,63,242,0.2) 0%,transparent 100%); }
.playlist-hero-cover { width:180px; height:180px; border-radius:12px; background:linear-gradient(135deg,var(--purple),var(--blue)); box-shadow:0 14px 36px rgba(0,0,0,0.4); overflow:hidden; flex-shrink:0; }
.playlist-hero-cover img { width:100%; height:100%; object-fit:cover; }
.playlist-hero-info { flex:1; min-width:0; }
.playlist-hero-type { font-size:0.72rem; color:var(--text-muted); font-weight:600; text-transform:uppercase; letter-spacing:0.1em; margin-bottom:6px; }
.playlist-hero-name { font-family:'Clash Display',sans-serif; font-size:2.2rem; font-weight:700; margin-bottom:6px; word-break:break-word; }
.playlist-hero-meta { font-size:0.85rem; color:var(--text-secondary); margin-bottom:18px; }
.playlist-actions { display:flex; gap:10px; align-items:center; flex-wrap:wrap; }
.btn-play-all { width:50px; height:50px; border-radius:50%; background:linear-gradient(135deg,var(--purple),var(--pink)); border:none; color:white; display:flex; align-items:center; justify-content:center; cursor:pointer; transition:var(--transition); box-shadow:var(--glow-purple); touch-action:manipulation; }
.btn-play-all:hover { transform:scale(1.08); }
.btn-play-all:active { transform:scale(0.95); }

/* MODALS */
.modal-overlay { position:fixed; inset:0; background:rgba(0,0,0,0.75); backdrop-filter:blur(8px); z-index:1000; display:flex; align-items:center; justify-content:center; opacity:0; pointer-events:none; transition:opacity 0.25s; padding:16px; }
.modal-overlay.show { opacity:1; pointer-events:all; }
.modal { background:var(--dark3); border:1px solid rgba(90,139,255,0.12); border-radius:16px; padding:28px; width:100%; max-width:400px; box-shadow:0 24px 60px rgba(0,0,0,0.5),var(--glow-purple); transform:translateY(20px) scale(0.97); transition:transform 0.25s cubic-bezier(0.4,0,0.2,1); max-height:90vh; overflow-y:auto; }
.modal-overlay.show .modal { transform:translateY(0) scale(1); }
.modal-title { font-family:'Clash Display',sans-serif; font-size:1.4rem; font-weight:700; margin-bottom:4px; background:linear-gradient(90deg,var(--text-primary),var(--blue)); -webkit-background-clip:text; -webkit-text-fill-color:transparent; background-clip:text; }
.modal-subtitle { font-size:0.82rem; color:var(--text-muted); margin-bottom:22px; }
.form-group { margin-bottom:14px; }
.form-label { display:block; font-size:0.78rem; font-weight:600; color:var(--text-secondary); margin-bottom:5px; letter-spacing:0.03em; }
.form-input { width:100%; background:rgba(255,255,255,0.04); border:1px solid rgba(90,139,255,0.15); border-radius:var(--radius-sm); padding:10px 13px; color:var(--text-primary); font-size:0.875rem; transition:var(--transition); outline:none; -webkit-appearance:none; }
.form-input:focus { border-color:var(--purple); background:rgba(123,63,242,0.06); box-shadow:0 0 0 3px rgba(123,63,242,0.12); }
.form-input::placeholder { color:var(--text-muted); }
.form-actions { display:flex; gap:8px; margin-top:18px; }
.form-actions .btn { flex:1; padding:11px; }
.modal-switch { text-align:center; margin-top:14px; font-size:0.82rem; color:var(--text-muted); }
.modal-switch span { color:var(--purple); cursor:pointer; font-weight:600; }
.modal-close { position:absolute; top:14px; right:14px; background:none; border:none; color:var(--text-muted); cursor:pointer; padding:5px; border-radius:6px; transition:var(--transition); touch-action:manipulation; }
.modal-close:hover { color:var(--text-primary); background:rgba(255,255,255,0.05); }

/* TOAST */
.toast-container { position:fixed; bottom:calc(var(--player-h) + 14px); right:16px; z-index:2000; display:flex; flex-direction:column; gap:6px; pointer-events:none; }
.toast { background:var(--dark3); border:1px solid rgba(90,139,255,0.15); border-radius:10px; padding:10px 14px; font-size:0.85rem; display:flex; align-items:center; gap:8px; box-shadow:0 8px 24px rgba(0,0,0,0.3); animation:toastIn 0.3s cubic-bezier(0.4,0,0.2,1); max-width:260px; transition:opacity 0.3s,transform 0.3s; }
.toast.success { border-left:3px solid #4ade80; }
.toast.error { border-left:3px solid var(--pink); }
.toast.info { border-left:3px solid var(--blue); }
@keyframes toastIn { from{opacity:0;transform:translateX(16px)} to{opacity:1;transform:translateX(0)} }

/* CONTEXT MENU */
.context-menu { position:fixed; background:var(--dark3); border:1px solid rgba(90,139,255,0.12); border-radius:var(--radius); padding:5px; min-width:170px; box-shadow:0 12px 36px rgba(0,0,0,0.4); z-index:500; display:none; }
.context-menu.show { display:block; }
.context-item { display:flex; align-items:center; gap:10px; padding:8px 11px; border-radius:var(--radius-sm); cursor:pointer; font-size:0.85rem; transition:var(--transition); color:var(--text-secondary); touch-action:manipulation; }
.context-item:hover { background:rgba(123,63,242,0.1); color:var(--text-primary); }
.context-item.danger:hover { background:rgba(255,45,152,0.1); color:var(--pink); }
.context-divider { height:1px; background:rgba(90,139,255,0.08); margin:3px 0; }

/* MISC */
.playing-bars { display:flex; align-items:flex-end; gap:2px; height:13px; }
.playing-bars span { display:block; width:3px; background:var(--purple); border-radius:2px; animation:bars 0.8s ease infinite alternate; }
.playing-bars span:nth-child(2) { animation-delay:0.2s; }
.playing-bars span:nth-child(3) { animation-delay:0.4s; }
@keyframes bars { from{height:4px} to{height:13px} }
.badge { display:inline-flex; align-items:center; padding:2px 8px; border-radius:20px; font-size:0.68rem; font-weight:600; }
.badge-purple { background:rgba(123,63,242,0.2); color:var(--purple); }
.badge-pink { background:rgba(255,45,152,0.15); color:var(--pink); }
.muted .volume-fill { background:var(--text-muted); opacity:0.4; }
.error-msg { color:var(--pink); font-size:0.78rem; margin-top:5px; display:none; }
.error-msg.show { display:block; }
.playlist-select-list { max-height:240px; overflow-y:auto; margin:10px 0; display:flex; flex-direction:column; gap:3px; }
.playlist-select-item { display:flex; align-items:center; gap:10px; padding:9px 11px; border-radius:var(--radius-sm); cursor:pointer; transition:var(--transition); touch-action:manipulation; }
.playlist-select-item:hover { background:rgba(123,63,242,0.1); }
.playlist-select-thumb { width:38px; height:38px; border-radius:6px; background:linear-gradient(135deg,var(--purple),var(--blue)); flex-shrink:0; overflow:hidden; display:flex; align-items:center; justify-content:center; font-size:0.8rem; }
.playlist-select-name { font-size:0.85rem; font-weight:500; }
.playlist-select-count { font-size:0.72rem; color:var(--text-muted); }

/* ==============================
   MOBILE BOTTOM NAV
============================== */
.mobile-nav {
  display: none;
  grid-area: mobile-nav;
  background: rgba(13,21,48,0.97);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-top: 1px solid rgba(90,139,255,0.1);
  z-index: 300;
}

.mobile-nav-inner {
  display: flex;
  width: 100%;
  height: 100%;
  align-items: stretch;
}

.mobile-nav-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  padding: 6px 4px calc(6px + var(--safe-bottom));
  cursor: pointer;
  transition: var(--transition);
  border: none;
  background: none;
  color: var(--text-muted);
  font-size: 0.62rem;
  font-weight: 500;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

.mobile-nav-item.active { color: var(--purple); }
.mobile-nav-item:active { opacity: 0.7; }
.mobile-nav-icon { width: 22px; height: 22px; display: flex; align-items: center; justify-content: center; }

/* Mobile player progress bar strip */
.player-progress-strip {
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: rgba(255,255,255,0.08);
  cursor: pointer;
  display: none;
}
.player-progress-strip .strip-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--purple), var(--blue));
  transition: width 0.1s linear;
}

/* Mobile player controls */
.player-mobile-btns {
  display: none;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

/* ==============================
   TABLET (769–1024px)
============================== */
@media (min-width: 769px) and (max-width: 1024px) {
  :root { --sidebar-w: 210px; }
  .sidebar-logo .logo-text { font-size:1.3rem; }
  .nav-item { font-size:0.82rem; padding:9px 11px; }
  .songs-grid { grid-template-columns:repeat(auto-fill,minmax(140px,1fr)); gap:12px; }
  .song-list-header,
  .song-row { grid-template-columns:32px 1fr 55px 32px; }
  .song-list-header span:nth-child(3),
  .song-row > .song-artist:not(.song-row-info .song-artist) { display:none; }
  .player-song { width:200px; }
  .player-volume { width:110px; }
}

/* ==============================
   MOBILE (≤ 768px)
============================== */
@media (max-width: 768px) {
  :root {
    --player-h: 68px;
    --mobile-nav-h: 60px;
  }

  .app-layout {
    grid-template-columns: 1fr;
    grid-template-rows: 1fr var(--player-h) var(--mobile-nav-h);
    grid-template-areas:
      "main"
      "player"
      "mobile-nav";
  }

  .sidebar { display: none; }
  .mobile-nav { display: flex; }

  /* Header */
  .main-header { padding:9px 14px; gap:10px; }
  .header-logo-mobile { display:flex; }
  .header-actions { display:none; }

  /* Sections */
  .page-section { padding:14px; }

  /* Hero */
  .hero-banner { padding:20px 16px; margin-bottom:18px; border-radius:12px; }
  .hero-title { font-size:1.5rem; }
  .hero-sub { font-size:0.82rem; }

  /* Grid */
  .songs-grid { grid-template-columns:repeat(auto-fill,minmax(130px,1fr)); gap:10px; }
  .song-card { padding:10px; }
  .song-card-title { font-size:0.8rem; }

  /* Song list simplified */
  .song-list-header { display:none; }
  .song-row { grid-template-columns:44px 1fr 34px; padding:8px 4px; }
  .song-row-num,
  .song-row > .song-artist:not(.song-row-info .song-artist),
  .song-row > .song-duration { display:none; }
  .song-row-info { gap:10px; }
  .song-row-thumb { width:44px; height:44px; border-radius:8px; }
  .song-title { font-size:0.875rem; }
  .song-actions { opacity:1; }

  /* Player simplified */
  .player {
    padding: 0 14px;
    gap: 10px;
    position: relative;
  }

  .player-progress-strip { display:block; }
  .player-controls { display:none; }
  .player-volume { display:none; }
  .btn-shuffle,
  .btn-repeat { display:none; }

  .player-song { width:auto; flex:1; min-width:0; }
  .player-thumb { width:44px; height:44px; }
  .player-song-title { font-size:0.82rem; }
  .player-song-artist { font-size:0.72rem; }
  .player-mobile-btns { display:flex; }

  /* Playlist hero */
  .playlist-hero { flex-direction:column; align-items:center; text-align:center; padding:18px 14px 0; gap:14px; }
  .playlist-hero-cover { width:140px; height:140px; }
  .playlist-hero-name { font-size:1.5rem; }
  .playlist-actions { justify-content:center; }

  /* Modals as bottom sheets */
  .modal-overlay { align-items:flex-end; padding:0; }
  .modal { border-radius:20px 20px 0 0; max-width:100%; max-height:88vh; padding:22px 18px calc(18px + var(--safe-bottom)); transform:translateY(100%); }
  .modal-overlay.show .modal { transform:translateY(0) scale(1); }

  /* Toast */
  .toast-container {
    bottom: calc(var(--player-h) + var(--mobile-nav-h) + 8px);
    right: 10px;
    left: 10px;
    align-items: center;
  }
  .toast { max-width:100%; }

  .section-title { font-size:1.1rem; }
}

/* ==============================
   SMALL MOBILE (≤ 380px)
============================== */
@media (max-width: 380px) {
  .songs-grid { grid-template-columns:repeat(2,1fr); gap:8px; }
  .hero-title { font-size:1.25rem; }
  .player-thumb { width:38px; height:38px; }
  .modal { padding:18px 14px calc(14px + var(--safe-bottom)); }
}

/* ==============================
   LARGE DESKTOP (≥ 1400px)
============================== */
@media (min-width: 1400px) {
  :root { --sidebar-w: 280px; }
  .songs-grid { grid-template-columns:repeat(auto-fill,minmax(170px,1fr)); gap:16px; }
  .page-section { padding:28px; }
}
