/* ========================================
   K2D Font Faces
======================================== */
@font-face { font-family: 'K2D'; src: url('fonts/K2D/K2D-Thin.ttf') format('truetype'); font-weight: 100; }
@font-face { font-family: 'K2D'; src: url('fonts/K2D/K2D-ExtraLight.ttf') format('truetype'); font-weight: 200; }
@font-face { font-family: 'K2D'; src: url('fonts/K2D/K2D-Light.ttf') format('truetype'); font-weight: 300; }
@font-face { font-family: 'K2D'; src: url('fonts/K2D/K2D-Regular.ttf') format('truetype'); font-weight: 400; }
@font-face { font-family: 'K2D'; src: url('fonts/K2D/K2D-Medium.ttf') format('truetype'); font-weight: 500; }
@font-face { font-family: 'K2D'; src: url('fonts/K2D/K2D-SemiBold.ttf') format('truetype'); font-weight: 600; }
@font-face { font-family: 'K2D'; src: url('fonts/K2D/K2D-Bold.ttf') format('truetype'); font-weight: 700; }
@font-face { font-family: 'K2D'; src: url('fonts/K2D/K2D-ExtraBold.ttf') format('truetype'); font-weight: 800; }
/* ========================================
   CSS Variables
======================================== */
:root {
  --bg-primary:    #0d0d0d;
  --bg-secondary:  #141414;
  --bg-sidebar:    #111111;
  --bg-card:       #1a1a1a;
  --bg-hover:      #222222;
  --bg-input:      #1e1e1e;
  --accent:        #e8365d;
  --accent-hover:  #f04a6e;
  --accent-dim:    rgba(232, 54, 93, 0.15);
  --accent-glow:   rgba(232, 54, 93, 0.3);
  --text-primary:  #f0f0f0;
  --text-secondary:#999999;
  --text-muted:    #555555;
  --border:        #2a2a2a;
  --radius:        8px;
  --radius-sm:     6px;
  --radius-lg:     12px;
  --sidebar-width: 260px;
  --np-height:     90px;
  --transition:    0.2s ease;
  --login-gradient: radial-gradient(ellipse at 15% 15%, #2a0815 0%, #0d0d0d 55%);
  --bg-card-alpha: rgba(26, 26, 26, 0.85);
}

/* ========================================
   Reset & Base
======================================== */
*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html, body {
  height: 100%;
  /* iOS: fill the full visual viewport including safe areas */
  height: -webkit-fill-available;
  overflow: hidden;
}

body {
  font-family: 'K2D', sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  -webkit-font-smoothing: antialiased;
}

.hidden {
  display: none !important;
}

/* Standard scrollbar (Firefox, iframe, embed) */
* {
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.1) transparent;
}

::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.2);
}

/* ========================================
   Activity Loading Screen
======================================== */
.activity-loading {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--login-gradient);
}

.activity-loading-card {
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 24px;
}

.activity-spinner {
  width: 40px;
  height: 40px;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.activity-loading-text {
  color: var(--text-secondary);
  font-size: 14px;
}
.activity-loading-meta {
  max-width: 320px;
  color: var(--text-muted);
  font-size: 12px;
  line-height: 1.5;
}
.activity-loading.is-error .activity-spinner {
  display: none;
}
.activity-loading.is-error .activity-loading-text {
  color: var(--text-primary);
}
.activity-loading.is-error .activity-loading-meta {
  color: #c98c96;
}

/* ========================================
   Login Screen
======================================== */
.login-screen {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100vh;
  height: 100dvh;
  background: var(--login-gradient);
}

.login-card {
  text-align: center;
  padding: 48px 40px;
  max-width: 360px;
  width: 100%;
}

.login-logo {
  font-size: 36px;
  font-weight: 700;
  letter-spacing: -1px;
  margin-bottom: 8px;
}

.login-subtitle {
  color: var(--text-muted);
  font-size: 14px;
  margin-bottom: 32px;
}

.btn-discord {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  gap: 10px;
  padding: 12px 24px;
  background: #5865F2;
  color: #fff;
  border: none;
  border-radius: var(--radius);
  font-family: 'K2D', sans-serif;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: background var(--transition);
}
.btn-discord:hover {
  background: #4752c4;
}

.login-footer {
  margin-top: 20px;
}
.login-footer a {
  text-decoration: none;
  font-size: 13px;
  color: var(--text-muted);
  transition: color 0.2s ease;
}
.login-footer a:hover {
  color: var(--text-secondary);
}

/* ========================================
   App Layout
======================================== */
.app {
  display: grid;
  grid-template-columns: var(--sidebar-width) 1fr;
  grid-template-rows: 1fr var(--np-height);
  height: 100vh;
  height: 100dvh; /* respects iOS dynamic viewport */
  transition: grid-template-columns 0.3s ease;
}

@media (min-width: 769px) {
  .app.sidebar-collapsed {
    --sidebar-width: 76px;
  }
  .app.sidebar-collapsed .logo-text,
  .app.sidebar-collapsed .beta-badge,
  .app.sidebar-collapsed .sidebar-label,
  .app.sidebar-collapsed .chevron-icon,
  .app.sidebar-collapsed .guild-item span,
  .app.sidebar-collapsed .guild-item .guild-voice-icon,
  .app.sidebar-collapsed .playlist-item-info,
  .app.sidebar-collapsed .user-name,
  .app.sidebar-collapsed #btn-lang,
  .app.sidebar-collapsed #btn-logout,
  .app.sidebar-collapsed #btn-create-playlist {
    display: none !important;
  }
  .app.sidebar-collapsed .sidebar-top {
    padding: 24px 0 0;
  }
  .app.sidebar-collapsed .sidebar-header {
    flex-direction: column;
    gap: 16px;
    margin-bottom: 24px;
  }
  .app.sidebar-collapsed .sidebar-collapsible-header {
    display: none !important;
  }
  .app.sidebar-collapsed .guild-section {
    margin-bottom: 8px;
  }
  .app.sidebar-collapsed .guild-section.collapsed {
    display: none !important;
  }
  .app.sidebar-collapsed .logo {
    margin: 0;
    text-align: center;
  }
  .app.sidebar-collapsed .sidebar-collapse-btn {
    opacity: 1;
    width: 100%;
    display: flex;
    justify-content: center;
    padding-bottom: 12px;
    margin-bottom: 8px;
    border-bottom: 1px solid var(--border);
  }
  .app.sidebar-collapsed .sidebar-collapse-btn svg {
    transform: rotate(180deg);
  }
  .app.sidebar-collapsed .sidebar-playlists {
    padding: 0;
    margin-top: 8px;
    align-items: center;
  }
  .app.sidebar-collapsed .sidebar-playlists-header {
    display: none !important;
  }
  .app.sidebar-collapsed .sidebar-bottom {
    padding: 16px 0;
  }
  .app.sidebar-collapsed .user-info {
    flex-direction: column;
    justify-content: center;
    padding: 16px 0 0;
    gap: 12px;
    border-top: none;
    position: relative;
  }
  .app.sidebar-collapsed .user-info::before {
    content: '';
    position: absolute;
    top: 0;
    left: 16px;
    right: 16px;
    height: 1px;
    background: var(--border);
  }
  .app.sidebar-collapsed .user-avatar {
    width: 44px;
    height: 44px;
  }
  .app.sidebar-collapsed .guild-item,
  .app.sidebar-collapsed .playlist-item {
    width: 48px;
    height: 48px;
    padding: 0;
    margin: 0 auto 8px auto;
    justify-content: center;
  }
  .app.sidebar-collapsed .guild-item {
    border-radius: 50%;
  }
  .app.sidebar-collapsed .playlist-item {
    border-radius: 12px; /* distinguish from circular guilds */
  }
  .app.sidebar-collapsed .guild-item.active {
    border-radius: 16px; /* Discord-like active morph */
  }
}

/* ========================================
   Sidebar
======================================== */
.sidebar {
  grid-row: 1 / 3;
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  overflow-y: auto;
  overflow-x: hidden;
  position: relative;
}

.sidebar-top {
  padding: 24px 20px 0;
}

.sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}
.sidebar-collapse-btn {
  color: var(--text-secondary);
  transition: color var(--transition);
}
.sidebar-collapse-btn svg {
  transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.sidebar-collapse-btn:hover {
  color: var(--text-primary);
}

.logo {
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -1px;
  margin-bottom: 0;
  white-space: nowrap;
}
.beta-badge {
  font-size: 10px;
  font-weight: 700;
  background: var(--accent);
  color: #fff;
  padding: 2px 6px;
  border-radius: 4px;
  vertical-align: super;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  white-space: nowrap;
}

.accent {
  color: var(--accent);
}

.sidebar-label {
  font-size: 12px;
  color: var(--text-secondary);
  margin-bottom: 10px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  white-space: nowrap;
  overflow: hidden;
}

.sidebar-collapsible-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  user-select: none;
}
.sidebar-collapsible-header:hover .sidebar-label,
.sidebar-collapsible-header:hover .chevron-icon {
  color: var(--text-primary);
}
.sidebar-collapsible-header .sidebar-label {
  margin-bottom: 0; /* Override default margin inside flex container */
}
.chevron-icon {
  color: var(--text-secondary);
  transition: transform var(--transition);
}
.guild-section.collapsed .chevron-icon {
  transform: rotate(-90deg);
}
.guild-section.collapsed .guild-list {
  display: none;
}
.sidebar-collapsible-header {
  margin-bottom: 10px;
}

.guild-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.guild-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  background: none;
  border: none;
  width: 100%;
  text-align: left;
  transition: background var(--transition), color var(--transition), border-radius 0.3s ease;
  font-size: 14px;
  font-weight: 500;
  color: var(--text-secondary);
}
.guild-item span {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.guild-item:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}
.guild-item.active {
  background: var(--accent-dim);
  color: var(--text-primary);
}
.guild-item .guild-icon {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
}
.guild-item .guild-icon-placeholder {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--bg-hover);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  flex-shrink: 0;
}
.guild-item .guild-voice-icon {
  margin-left: auto;
  flex-shrink: 0;
  color: var(--accent);
  opacity: 0.85;
}
.guild-item.in-voice {
  color: var(--text-primary);
}
.guild-section {
  margin-bottom: 16px;
}

/* User Info */
.sidebar-bottom {
  margin-top: auto;
  flex-shrink: 0;
  position: sticky;
  bottom: 0;
  background: var(--bg-sidebar);
  padding: 16px 20px;
  z-index: 10;
}
.user-info {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 0 0 0;
  border-top: 1px solid var(--border);
}
.user-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  object-fit: cover;
}
.user-name {
  flex: 1;
  font-size: 14px;
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.user-mode-badge {
  padding: 4px 8px;
  border-radius: 999px;
  background: rgba(88, 101, 242, 0.14);
  color: #aab2ff;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

/* ========================================
   Sidebar Playlists
======================================== */
.sidebar-playlists {
  padding: 0 20px;
  margin-top: 20px;
  flex: 1;
  min-height: 80px; /* guarantees it never squishes too much */
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
}
.sidebar-playlists-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}
.sidebar-playlists-header .sidebar-label {
  margin-bottom: 0;
}
.playlist-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
  overflow-y: auto;
  flex: 1;
}
.playlist-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 10px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background var(--transition), border-radius 0.3s ease;
  font-size: 13px;
  color: var(--text-secondary);
}
.playlist-item:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}
.playlist-item-thumb {
  width: 28px;
  height: 28px;
  border-radius: 4px;
  object-fit: cover;
  flex-shrink: 0;
  background: var(--bg-hover);
}
.playlist-item-icon {
  width: 28px;
  height: 28px;
  border-radius: 4px;
  background: var(--bg-hover);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  color: var(--text-muted);
}
.playlist-item-info {
  min-width: 0;
  flex: 1;
}
.playlist-item-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 500;
}
.playlist-item-count {
  font-size: 11px;
  color: var(--text-muted);
}

/* ========================================
   Create / Edit Playlist Modal
======================================== */
.pl-edit-card {
  min-width: 400px;
  max-width: 460px;
  padding: 0;
  overflow: hidden;
}
.pl-edit-header {
  padding: 28px 28px 0;
  text-align: center;
}
.pl-edit-icon {
  width: 48px;
  height: 48px;
  margin: 0 auto 12px;
  background: var(--bg-hover);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--accent);
}
.pl-edit-header h3 {
  margin-bottom: 6px;
}
.pl-edit-subtitle {
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 4px;
}
.pl-edit-form {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 16px 28px 0;
}
.pl-label {
  font-size: 12px;
  color: var(--text-secondary);
  font-weight: 600;
  margin-top: 4px;
}
.pl-label-hint {
  font-weight: 400;
  color: var(--text-muted);
}
.pl-input {
  width: 100%;
  padding: 10px 12px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-family: 'K2D', sans-serif;
  font-size: 13px;
  outline: none;
  transition: border-color var(--transition);
}
.pl-input::placeholder {
  color: var(--text-muted);
}
.pl-input:focus {
  border-color: var(--accent);
}
.pl-import-section {
  margin: 16px 28px 0;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-secondary);
}
.pl-import-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  cursor: pointer;
  user-select: none;
  list-style: none;
}
.pl-import-toggle::-webkit-details-marker { display: none; }
.pl-import-toggle .pl-label-hint {
  font-size: 12px;
}
.pl-import-section[open] .pl-import-toggle {
  border-bottom: 1px solid var(--border);
  color: var(--text-primary);
}
.pl-import-content {
  padding: 12px 14px;
}
.pl-import-hint {
  font-size: 11px;
  color: var(--text-muted);
  margin-bottom: 10px;
  line-height: 1.4;
}
.pl-import-row {
  display: flex;
  gap: 8px;
  align-items: center;
}
.pl-import-row .pl-input {
  flex: 1;
}
.btn-sm {
  padding: 8px 14px;
  font-size: 12px;
  flex: none;
}
.pl-import-status {
  font-size: 12px;
  padding: 6px 0;
  color: var(--text-secondary);
}
.pl-import-status.error {
  color: #e05050;
}
.pl-import-status.success {
  color: #50c878;
}
.pl-edit-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 20px 28px;
  margin-top: 8px;
  border-top: 1px solid var(--border);
  background: var(--bg-secondary);
}

/* ========================================
   Playlist View (Spotify-like, inline)
======================================== */
.main-view {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  position: relative;
}
.pv-header {
  flex-shrink: 0;
  padding-bottom: 20px;
}
.pv-back-btn {
  margin-bottom: 12px;
}
.pv-hero {
  display: flex;
  align-items: flex-end;
  gap: 20px;
  margin-bottom: 20px;
}
.pv-thumb {
  width: 180px;
  height: 180px;
  border-radius: var(--radius-lg);
  object-fit: cover;
  box-shadow: 0 8px 32px rgba(0,0,0,0.5);
  flex-shrink: 0;
}
.pv-thumb-placeholder {
  width: 180px;
  height: 180px;
  border-radius: var(--radius-lg);
  background: var(--bg-hover);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  flex-shrink: 0;
  box-shadow: 0 8px 32px rgba(0,0,0,0.5);
}
.pv-meta {
  min-width: 0;
}
.pv-label {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-secondary);
  font-weight: 600;
}
.pv-name {
  font-size: 36px;
  font-weight: 800;
  letter-spacing: -0.5px;
  margin: 4px 0 6px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.pv-count {
  font-size: 13px;
  color: var(--text-muted);
}
.pv-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}
.pv-play-btn {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: var(--accent);
  border: none;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: transform 0.15s, background var(--transition);
  flex-shrink: 0;
}
.pv-play-btn:hover {
  transform: scale(1.06);
  background: var(--accent-hover);
}
.pv-play-btn svg {
  margin-left: 2px;
}
.pv-action-btn {
  width: 34px;
  height: 34px;
  color: var(--text-muted);
}
.pv-action-btn:hover {
  color: var(--text-primary);
}
.pv-delete-btn:hover {
  color: #e05050 !important;
}
.pv-track-header {
  display: grid;
  grid-template-columns: 40px 1fr 56px;
  padding: 0 16px 8px;
  font-size: 12px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.pv-col-dur {
  text-align: right;
  display: flex;
  align-items: center;
  justify-content: flex-end;
}
.pv-tracks {
  flex: 1;
  overflow-y: auto;
  padding-bottom: 8px;
}
.pv-track {
  display: grid;
  grid-template-columns: 40px 1fr 56px;
  align-items: center;
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background var(--transition);
}
.pv-track:hover {
  background: var(--bg-hover);
}
.pv-track-num {
  font-size: 14px;
  color: var(--text-muted);
  font-weight: 500;
  text-align: center;
}
.pv-track:hover .pv-track-num .pv-num-text {
  display: none;
}
.pv-track:hover .pv-track-num .pv-play-icon {
  display: block;
}
.pv-play-icon {
  display: none;
  color: var(--text-primary);
}
.pv-track-main {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}
.pv-track-img {
  width: 40px;
  height: 40px;
  border-radius: 4px;
  object-fit: cover;
  flex-shrink: 0;
  background: var(--bg-hover);
}
.pv-track-text {
  min-width: 0;
}
.pv-track-title {
  font-size: 13px;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.pv-track:hover .pv-track-title {
  color: var(--text-primary);
}
.pv-track-author {
  font-size: 11px;
  color: var(--text-secondary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.pv-track-dur {
  text-align: right;
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 500;
}
.pv-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px 20px;
  color: var(--text-muted);
  font-size: 14px;
  gap: 12px;
}
.pv-loading {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  background: rgba(var(--bg-base-rgb, 18,18,20), 0.85);
  backdrop-filter: blur(4px);
  z-index: 10;
  border-radius: var(--radius);
}
.pv-loading-spinner {
  width: 36px;
  height: 36px;
  border: 3px solid var(--bg-hover);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: pv-spin 0.8s linear infinite;
}
@keyframes pv-spin {
  to { transform: rotate(360deg); }
}
.pv-loading-text {
  font-size: 13px;
  color: var(--text-secondary);
  font-weight: 500;
}

/* ========================================
   Context Menu (right-click)
======================================== */
.context-menu {
  position: fixed;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 8px 32px rgba(0,0,0,0.5);
  z-index: 2000;
  min-width: 200px;
  padding: 4px 0;
  font-size: 13px;
}
.ctx-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 8px 14px;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-secondary);
  font: inherit;
  text-align: left;
  transition: background var(--transition), color var(--transition);
  position: relative;
  white-space: nowrap;
}
.ctx-item:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}
.ctx-item:focus-visible {
  outline: none;
  background: var(--bg-hover);
  color: var(--text-primary);
}
.ctx-danger:hover {
  color: #e05050 !important;
}
.ctx-label {
  pointer-events: none;
}
.ctx-separator {
  height: 1px;
  background: var(--border);
  margin: 4px 0;
}
.ctx-arrow {
  margin-left: auto;
}
.ctx-submenu {
  display: none;
  position: absolute;
  left: 100%;
  top: -4px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 8px 32px rgba(0,0,0,0.5);
  min-width: 180px;
  padding: 4px 0;
  z-index: 2001;
}
.ctx-has-sub:hover .ctx-submenu {
  display: block;
}
.ctx-sub-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 14px;
  cursor: pointer;
  color: var(--text-secondary);
  transition: background var(--transition), color var(--transition);
  font-size: 13px;
}
.ctx-sub-item:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

/* ========================================
   Button Icon
======================================== */
.btn-icon {
  background: none;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  padding: 4px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color var(--transition), background var(--transition);
}
.btn-icon:hover {
  color: var(--text-primary);
  background: var(--bg-hover);
}

/* ========================================
   Main Content
======================================== */
.main {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  padding: 0 36px;
}
.main > .main-view {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: fadeInView 0.5s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes fadeInView {
  from {
    opacity: 0;
    transform: translateY(12px) scale(0.99);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

/* ── Search Bar (centered top) ── */
.search-bar {
  display: flex;
  justify-content: center;
  padding: 20px 0 16px;
  flex-shrink: 0;
}
.search-box {
  position: relative;
  width: 100%;
  max-width: 540px;
}
.search-icon {
  position: absolute;
  left: 16px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  pointer-events: none;
  transition: color var(--transition);
}
.search-box input {
  width: 100%;
  padding: 12px 18px 12px 46px;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 28px;
  color: var(--text-primary);
  font-family: 'K2D', sans-serif;
  font-size: 14px;
  outline: none;
  transition: all var(--transition);
  box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}
.search-box input::placeholder {
  color: var(--text-muted);
}
.search-box input:hover {
  border-color: var(--text-muted);
  background: var(--bg-card);
}
.search-box input:focus {
  border-color: var(--accent);
  background: var(--bg-card);
  box-shadow: 0 2px 16px rgba(0,0,0,0.25), 0 0 0 1px var(--accent);
}
.search-box input:focus ~ .search-icon,
.search-box:focus-within .search-icon {
  color: var(--accent);
}

/* Search Results Dropdown */
.search-results {
  position: absolute;
  top: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  min-width: 380px;
  max-height: 420px;
  overflow-y: auto;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  z-index: 100;
  box-shadow: 0 12px 40px rgba(0,0,0,0.5);
}

.search-result-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  cursor: pointer;
  transition: background var(--transition);
}
.search-result-item:hover {
  background: var(--bg-hover);
}
.search-result-item img {
  width: 40px;
  height: 40px;
  border-radius: 4px;
  object-fit: cover;
  flex-shrink: 0;
}
.search-result-item .sr-info {
  flex: 1;
  min-width: 0;
}
.search-result-item .sr-title {
  font-size: 13px;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.search-result-item .sr-author {
  font-size: 12px;
  color: var(--text-secondary);
}
.search-result-item .sr-duration {
  font-size: 12px;
  color: var(--text-muted);
  flex-shrink: 0;
}

/* Playlist card in search results */
.sr-playlist-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
}
.sr-playlist-card .sr-info { flex: 1; min-width: 0; }

/* Empty / error state in search results */
.sr-empty {
  padding: 14px 16px;
  font-size: 13px;
  color: var(--text-muted);
  text-align: center;
}

/* Loading spinner in search results / paste modal */
.sr-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.sr-spinner {
  width: 22px;
  height: 22px;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
@keyframes spin {
  to { transform: rotate(360deg); }
}

/* Accent button (add playlist) */
.btn-accent {
  flex-shrink: 0;
  padding: 6px 14px;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  font-family: 'K2D', sans-serif;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: background var(--transition);
}
.btn-accent:hover { background: var(--accent-hover); }


.queue-header {
  display: grid;
  grid-template-columns: 24px minmax(0, 1fr) 120px 80px 36px;
  padding: 0 16px 10px;
  font-size: 12px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  transition: grid-template-columns 0.15s ease;
}
.select-mode-active .queue-header {
  grid-template-columns: minmax(0, 1fr) 120px 80px 36px;
}
.select-mode-active .queue-header > span:first-child {
  display: none;
}
.col-dur {
  text-align: right;
}
.col-track {
  padding-left: 56px;
}
.col-added {
  text-align: left;
}

/* Queue List */
.queue-list {
  flex: 1;
  overflow-y: auto;
  padding-bottom: 8px;
  position: relative;
}

.queue-empty {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 200px;
  color: var(--text-muted);
  font-size: 14px;
}
.queue-empty-voice {
  flex-direction: column;
  gap: 16px;
  height: 300px;
  color: var(--text-muted);
}
.queue-empty-voice svg {
  opacity: 0.4;
}
.queue-empty-voice p {
  font-size: 14px;
  max-width: 260px;
  text-align: center;
  line-height: 1.5;
}

.queue-item {
  display: grid;
  grid-template-columns: 24px minmax(0, 1fr) 120px 80px 36px;
  align-items: center;
  padding: 10px 16px;
  border-radius: var(--radius-sm);
  transition: background var(--transition), opacity 0.2s;
  cursor: default;
}
.queue-item:hover {
  background: var(--bg-hover);
}
.queue-item[draggable="true"] {
  cursor: grab;
}
.queue-item[draggable="true"] .qi-track {
  cursor: grab;
}
.queue-item.dragging {
  opacity: 0.35;
}
.queue-item.drag-over {
  box-shadow: inset 0 2px 0 var(--accent);
}

/* External drag-and-drop indicator line */
.queue-drop-indicator {
  height: 2px;
  background: var(--accent);
  border-radius: 1px;
  margin: -1px 12px;
  position: relative;
  pointer-events: none;
  box-shadow: 0 0 6px var(--accent);
}
.queue-drop-indicator::before {
  content: '';
  position: absolute;
  left: -5px;
  top: -4px;
  width: 10px;
  height: 10px;
  background: var(--accent);
  border-radius: 50%;
}

/* Highlight queue list when dragging a link over it */
.queue-list.drag-external {
  outline: 2px dashed rgba(232, 54, 93, 0.92);
  outline-offset: -2px;
  border-radius: 16px;
  background: linear-gradient(180deg, rgba(232, 54, 93, 0.12), rgba(232, 54, 93, 0.04));
}
#queueView.queue-drop-active .queue-header {
  color: rgba(232, 54, 93, 0.9);
  border-bottom-color: rgba(232, 54, 93, 0.45);
}
.qi-drag {
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  opacity: 0;
  transition: opacity var(--transition);
}
.queue-item:hover .qi-drag {
  opacity: 0.5;
}
.queue-item:hover .qi-drag:hover {
  opacity: 1;
}

.queue-item .qi-num {
  font-size: 14px;
  color: var(--text-muted);
  font-weight: 500;
  display: flex;
  align-items: center;
  justify-content: center;
}
.queue-item.playing .qi-num {
  color: var(--accent);
}
.queue-item.playing .qi-num svg {
  color: var(--accent);
}

.queue-item .qi-track {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}
.queue-item .qi-thumb {
  width: 44px;
  height: 44px;
  border-radius: 4px;
  object-fit: cover;
  flex-shrink: 0;
}
.queue-item .qi-info {
  min-width: 0;
}
.queue-item .qi-title {
  font-size: 14px;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.queue-item.playing .qi-title {
  color: var(--accent);
}
.queue-item .qi-author {
  font-size: 12px;
  color: var(--text-secondary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.queue-item.playing .qi-author {
  color: var(--accent);
  opacity: 0.8;
}
.queue-item .qi-duration {
  text-align: right;
  font-size: 13px;
  color: var(--text-secondary);
  font-weight: 500;
}
.queue-item .qi-added-by {
  font-size: 12px;
  color: var(--text-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.queue-item .qi-remove {
  opacity: 0;
  transition: opacity var(--transition);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
}
.queue-item:hover .qi-remove {
  opacity: 1;
}

/* Playing indicator icon */
.playing-indicator {
  display: flex;
  align-items: flex-end;
  gap: 2px;
  height: 14px;
}
.playing-indicator span {
  width: 3px;
  background: var(--accent);
  border-radius: 1px;
  animation: eq 0.8s ease-in-out infinite alternate;
}
.playing-indicator span:nth-child(1) { height: 6px; animation-delay: 0s; }
.playing-indicator span:nth-child(2) { height: 10px; animation-delay: 0.2s; }
.playing-indicator span:nth-child(3) { height: 4px; animation-delay: 0.4s; }
.playing-indicator span:nth-child(4) { height: 8px; animation-delay: 0.1s; }

@keyframes eq {
  0% { height: 4px; }
  100% { height: 14px; }
}

/* ========================================
   Queue Selection Mode
======================================== */

/* Selection action bar */
.queue-select-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 16px;
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  gap: 12px;
  animation: qs-slide-in 0.15s ease-out;
}
@keyframes qs-slide-in {
  from { opacity: 0; transform: translateY(-6px); }
  to { opacity: 1; transform: translateY(0); }
}
.qs-left {
  display: flex;
  align-items: center;
  gap: 10px;
}
.qs-count {
  font-size: 13px;
  color: var(--text-secondary);
  font-weight: 500;
}
.qs-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}
.qs-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  font-size: 12px;
  font-weight: 500;
  background: var(--bg-hover);
  color: var(--text-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background var(--transition), color var(--transition), border-color var(--transition);
  white-space: nowrap;
}
.qs-btn:hover {
  background: var(--bg-input);
  color: var(--text-primary);
  border-color: var(--text-muted);
}
.qs-btn-danger:hover {
  background: rgba(224, 80, 80, 0.12);
  color: #e05050;
  border-color: rgba(224, 80, 80, 0.3);
}
.qs-btn-ghost {
  background: transparent;
  border-color: transparent;
}
.qs-btn-ghost:hover {
  background: var(--bg-hover);
  border-color: transparent;
}

/* Select-all checkbox */
.qs-check-all-wrap {
  display: flex;
  align-items: center;
  cursor: pointer;
}
.qs-check-all-wrap .qs-check-all {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
  pointer-events: none;
}
.qs-check-visual {
  width: 18px;
  height: 18px;
  border: 2px solid var(--text-muted);
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background var(--transition), border-color var(--transition);
  flex-shrink: 0;
}
.qs-check-all:checked + .qs-check-visual {
  background: var(--accent);
  border-color: var(--accent);
}
.qs-check-all:checked + .qs-check-visual::after {
  content: '';
  width: 10px;
  height: 6px;
  border-left: 2px solid #fff;
  border-bottom: 2px solid #fff;
  transform: rotate(-45deg) translateY(-1px);
}
.qs-check-all:indeterminate + .qs-check-visual {
  background: var(--accent);
  border-color: var(--accent);
}
.qs-check-all:indeterminate + .qs-check-visual::after {
  content: '';
  width: 10px;
  height: 0;
  border-bottom: 2px solid #fff;
}
.qs-check-all-wrap:hover .qs-check-visual {
  border-color: var(--accent);
}

/* Per-item checkbox (inside qi-num) */
.qi-select-wrap {
  display: none;
  align-items: center;
  cursor: pointer;
}
.select-mode .qi-select-wrap {
  display: flex;
}
.select-mode .qi-num-text {
  display: none;
}
.qi-select-cb {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
  pointer-events: none;
}
.qi-select-visual {
  width: 16px;
  height: 16px;
  border: 2px solid var(--text-muted);
  border-radius: 3px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background var(--transition), border-color var(--transition);
  flex-shrink: 0;
}
.qi-select-cb:checked + .qi-select-visual {
  background: var(--accent);
  border-color: var(--accent);
}
.qi-select-cb:checked + .qi-select-visual::after {
  content: '';
  width: 8px;
  height: 5px;
  border-left: 2px solid #fff;
  border-bottom: 2px solid #fff;
  transform: rotate(-45deg) translateY(-1px);
}
.queue-item:hover .qi-select-visual {
  border-color: var(--accent);
}

/* Selected row highlight */
.queue-item.selected {
  background: color-mix(in srgb, var(--accent) 10%, transparent);
}
.queue-item.selected:hover {
  background: color-mix(in srgb, var(--accent) 16%, transparent);
}

/* In select mode: hide drag handle, change cursor */
.select-mode .qi-drag {
  display: none;
}
.select-mode .queue-item {
  cursor: pointer;
  grid-template-columns: 48px 1fr 120px 80px;
}

/* "Add to Playlist" dropdown from selection bar */
.qs-playlist-dropdown {
  position: absolute;
  bottom: calc(100% + 6px);
  left: 0;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 8px 32px rgba(0,0,0,0.4);
  min-width: 200px;
  max-height: 240px;
  overflow-y: auto;
  padding: 4px 0;
  z-index: 2100;
  animation: qs-dd-in 0.12s ease-out;
}
@keyframes qs-dd-in {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}
.qs-pl-item {
  padding: 8px 14px;
  font-size: 13px;
  color: var(--text-secondary);
  cursor: pointer;
  transition: background var(--transition), color var(--transition);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.qs-pl-item:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}
.qs-pl-new {
  color: var(--accent);
  font-weight: 500;
}

/* ========================================
   Now Playing Bar
======================================== */
.now-playing {
  grid-column: 2;
  display: grid;
  grid-template-columns: 260px 1fr 220px;
  align-items: center;
  padding: 0 24px;
  /* iOS: push content above the home indicator / browser toolbar */
  padding-bottom: env(safe-area-inset-bottom, 0px);
  background: var(--bg-card-alpha);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-top: 1px solid rgba(255, 255, 255, 0.04);
  z-index: 100;
  gap: 16px;
}

.np-track-info {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}
.np-thumb-wrap {
  width: 52px;
  height: 52px;
  flex-shrink: 0;
  position: relative;
}
.np-thumb {
  width: 52px;
  height: 52px;
  border-radius: 6px;
  object-fit: cover;
}
.np-thumb-placeholder {
  width: 52px;
  height: 52px;
  border-radius: 6px;
  background: var(--bg-hover);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
}
.np-text {
  min-width: 0;
}
.np-title {
  display: block;
  font-size: 14px;
  font-weight: 700;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.np-author {
  display: block;
  font-size: 12px;
  color: var(--accent);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Controls */
.np-controls {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.np-buttons {
  display: flex;
  align-items: center;
  gap: 16px;
}
.np-btn {
  color: var(--text-secondary);
  transition: color var(--transition), transform var(--transition);
}
.np-btn svg,
.mp-icon-btn svg {
  display: block;
  overflow: visible;
}
.np-btn:hover {
  color: var(--text-primary);
  background: transparent;
  transform: scale(1.1);
}
.np-btn-main {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--text-primary) !important;
  color: var(--bg-primary) !important;
  display: flex;
  align-items: center;
  justify-content: center;
}
.np-btn-main:hover {
  transform: scale(1.08);
  color: var(--bg-primary) !important;
}

.np-btn.loop-active {
  color: var(--accent);
}

/* Loop badge */
.loop-badge {
  position: absolute;
  bottom: -2px;
  right: -2px;
  font-size: 8px;
  font-weight: 800;
  background: var(--accent);
  color: #fff;
  border-radius: 3px;
  padding: 0 3px;
  line-height: 13px;
}
#btn-loop {
  position: relative;
}

/* Progress */
.np-progress-row {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  max-width: 500px;
}
.np-time {
  font-size: 11px;
  color: var(--text-muted);
  min-width: 36px;
  text-align: center;
  font-weight: 500;
}
.np-progress-bar {
  flex: 1;
  height: 4px;
  background: var(--border);
  border-radius: 2px;
  cursor: pointer;
  position: relative;
  touch-action: none;
}
.np-progress-bar:hover {
  height: 6px;
}
.np-progress-bar:hover .np-progress-dot,
.np-progress-bar:active .np-progress-dot {
  opacity: 1;
}
.np-progress-fill {
  height: 100%;
  background: var(--accent);
  border-radius: 2px;
  width: 0%;
  transition: width 0.3s linear;
  position: relative;
}
.np-progress-dot {
  position: absolute;
  right: -5px;
  top: 50%;
  transform: translateY(-50%);
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #fff;
  opacity: 0;
  transition: opacity 0.15s;
  box-shadow: 0 0 4px rgba(0,0,0,0.4);
}

/* ========================================
   Now Playing Extra
======================================== */
.np-extra {
  display: flex;
  align-items: center;
  gap: 8px;
  justify-content: flex-end;
}

.volume-wrap {
  position: relative;
}
.volume-dropdown {
  position: absolute;
  bottom: calc(100% + 10px);
  right: 0;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 8px 28px rgba(0,0,0,0.45);
  min-width: 100px;
  padding: 6px 0;
  z-index: 200;
}
.vol-option {
  padding: 8px 16px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  cursor: pointer;
  text-align: center;
  transition: all var(--transition);
}
.vol-option:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}
.vol-option.active {
  color: var(--accent);
  font-weight: 700;
}

/* ========================================
   Modal
======================================== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 20px;
}
.modal-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 28px;
  min-width: 280px;
  max-width: 400px;
  width: 100%;
  max-height: calc(100vh - 40px);
  max-height: calc(100dvh - 40px);
  overflow-y: auto;
}
.modal-card h3 {
  font-size: 18px;
  font-weight: 700;
  margin-bottom: 16px;
}

.vc-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 16px;
  max-height: 300px;
  overflow-y: auto;
}

.vc-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background var(--transition);
  font-size: 14px;
  color: var(--text-secondary);
}
.vc-item:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}
.vc-item svg {
  flex-shrink: 0;
  color: var(--text-muted);
}
.vc-item .vc-members {
  font-size: 11px;
  color: var(--text-muted);
  margin-left: auto;
}

.btn-secondary {
  width: 100%;
  padding: 10px;
  background: var(--bg-hover);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text-secondary);
  font-family: 'K2D', sans-serif;
  font-size: 13px;
  cursor: pointer;
  transition: background var(--transition), color var(--transition);
}
.btn-secondary:hover {
  background: var(--border);
  color: var(--text-primary);
}

/* ========================================
   Toast Notifications
======================================== */
.toast-container {
  position: fixed;
  bottom: calc(var(--np-height) + 16px);
  left: var(--sidebar-width);
  width: calc(100% - var(--sidebar-width));
  z-index: 3000;
  display: flex;
  flex-direction: column-reverse;
  align-items: center;
  gap: 8px;
  pointer-events: none;
}
.toast {
  padding: 10px 24px;
  background: var(--bg-card) !important;
  border: 1px solid var(--border);
  border-radius: 20px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.4);
  font-size: 13px;
  font-weight: 500;
  color: var(--text-primary);
  pointer-events: auto;
  animation: toastIn 0.35s cubic-bezier(0.16, 1, 0.3, 1) forwards;
  white-space: nowrap;
}
.toast.toast-out {
  animation: toastOut 0.3s ease forwards;
}
@keyframes toastIn {
  from { opacity: 0; transform: translateY(12px) scale(0.95); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}
@keyframes toastOut {
  from { opacity: 1; transform: translateY(0) scale(1); }
  to   { opacity: 0; transform: translateY(8px) scale(0.95); }
}

/* ========================================
   Paste Link Preview Modal
======================================== */
.paste-modal-card {
  min-width: 360px;
  max-width: 420px;
}
.paste-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  padding: 20px 0;
}
.paste-loading-text {
  color: var(--text-secondary);
  font-size: 13px;
}
.paste-header {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 20px;
}
.paste-thumb {
  width: 72px;
  height: 72px;
  border-radius: var(--radius);
  object-fit: cover;
  background: var(--bg-hover);
  flex-shrink: 0;
}
.paste-info {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.paste-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.paste-author {
  font-size: 13px;
  color: var(--accent);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.paste-duration {
  font-size: 12px;
  color: var(--text-muted);
}
.paste-actions {
  display: flex;
  gap: 10px;
}
.paste-actions .btn-secondary {
  flex: 1;
}
.paste-actions .btn-accent {
  flex: 1;
}
.paste-error {
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.paste-error-text {
  color: var(--text-secondary);
  font-size: 13px;
}

/* ========================================
   Playlist Confirmation Modal
======================================== */
.playlist-modal-card {
  min-width: 360px;
  max-width: 420px;
}
.playlist-modal-header {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 18px;
}
.playlist-modal-thumb {
  width: 72px;
  height: 72px;
  border-radius: var(--radius);
  object-fit: cover;
  background: var(--bg-hover);
  flex-shrink: 0;
}
.playlist-modal-info {
  min-width: 0;
}
.playlist-modal-name {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.playlist-modal-count {
  font-size: 13px;
  color: var(--text-muted);
}
.playlist-modal-hint {
  font-size: 13px;
  color: var(--text-secondary);
  margin-bottom: 18px;
}
.playlist-modal-actions {
  display: flex;
  gap: 10px;
}
.playlist-modal-actions .btn-secondary {
  flex: 1;
}
.btn-accent {
  flex: 1;
  padding: 10px;
  background: var(--accent);
  border: none;
  border-radius: var(--radius);
  color: #fff;
  font-family: 'K2D', sans-serif;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background var(--transition), transform 0.1s;
}
.btn-accent:hover {
  background: #d02e52;
}
.btn-accent:active {
  transform: scale(0.97);
}

/* ========================================
   Bug Report
======================================== */
.bug-report-btn {
  position: fixed;
  bottom: calc(var(--np-height) + env(safe-area-inset-bottom, 0px) + 16px);
  right: 16px;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 900;
  transition: color var(--transition), border-color var(--transition), background var(--transition);
  opacity: 0.6;
}
.bug-report-btn:hover {
  opacity: 1;
  color: var(--accent);
  border-color: var(--accent);
  background: var(--accent-dim);
}
.bug-report-btn:focus-visible {
  opacity: 1;
  color: var(--accent);
  border-color: var(--accent);
  background: var(--accent-dim);
  outline: none;
}
/* Confirm Modal */
.confirm-modal-card {
  min-width: 300px;
  max-width: 400px;
  text-align: center;
}
.confirm-modal-card p {
  font-size: 14px;
  line-height: 1.5;
  margin-bottom: 18px;
  color: var(--text-primary);
}
.confirm-modal-actions {
  display: flex;
  flex-direction: row;
  gap: 10px;
  justify-content: center;
}
.confirm-modal-actions .btn-secondary,
.confirm-modal-actions .btn-accent {
  flex: 1;
  min-width: 0;
}

.bug-modal-card {
  min-width: 380px;
  max-width: 460px;
}
.bug-modal-copy {
  margin: -4px 0 12px;
  font-size: 13px;
  line-height: 1.45;
  color: var(--text-muted);
}
.bug-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.bug-context {
  margin-bottom: 12px;
  padding: 10px 12px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 12px;
  line-height: 1.45;
  color: var(--text-muted);
}
.bug-error {
  margin: -2px 0 2px;
  font-size: 12px;
  color: var(--accent);
}
.bug-label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 13px;
  color: var(--text-secondary);
}
.bug-select,
.bug-input,
.bug-textarea {
  width: 100%;
  padding: 10px 12px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-family: 'K2D', sans-serif;
  font-size: 13px;
  transition: border-color var(--transition);
  outline: none;
}
.bug-select:focus,
.bug-input:focus,
.bug-textarea:focus {
  border-color: var(--accent);
}
.bug-textarea {
  resize: vertical;
  min-height: 80px;
  max-height: 200px;
}
.bug-select {
  cursor: pointer;
  -webkit-appearance: none;
  appearance: none;
}
.bug-checkbox-label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--text-muted);
  cursor: pointer;
}
.bug-checkbox {
  accent-color: var(--accent);
  width: 16px;
  height: 16px;
  cursor: pointer;
}
.bug-actions {
  display: flex;
  gap: 10px;
  margin-top: 4px;
}
.bug-actions .btn-secondary,
.bug-actions .btn-accent {
  flex: 1;
}
.bug-submit-loading {
  pointer-events: none;
  opacity: 0.6;
}

/* ========================================
   State: No player (empty state)
======================================== */
.now-playing.inactive {
  opacity: 0.4;
  pointer-events: none;
}

/* ========================================
   State: Controls locked (wrong voice channel)
======================================== */
.now-playing.controls-locked .np-controls,
.now-playing.controls-locked .np-extra {
  opacity: 0.25;
  pointer-events: none;
  user-select: none;
}
/* Mobile bar: dim the mini actions too */
.now-playing.controls-locked .np-mini-actions {
  opacity: 0.25;
  pointer-events: none;
}

/* Wrong-channel notice inside the queue area */
.wrong-channel-notice {
  flex-direction: column;
  gap: 12px;
  height: 280px;
  color: var(--text-muted);
  text-align: center;
  padding: 0 32px;
}
.wrong-channel-notice svg {
  opacity: 0.5;
  flex-shrink: 0;
  color: var(--accent);
}
.wrong-channel-notice p {
  font-size: 14px;
  line-height: 1.5;
  max-width: 340px;
}
.wrong-channel-notice strong {
  color: var(--text-secondary);
  font-weight: 700;
}
.wc-channel-name {
  display: inline-block;
  background: var(--bg-hover);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 1px 8px;
  font-weight: 700;
  color: var(--accent);
  font-size: 13px;
}

/* Mobile player locked: overlay the controls area */
.mobile-player.controls-locked .mp-controls,
.mobile-player.controls-locked .mp-seek-section {
  opacity: 0.25;
  pointer-events: none;
  user-select: none;
}
.mobile-player.controls-locked .mp-inner::after {
  content: '🔒 Entre no canal do bot para controlar';
  position: absolute;
  bottom: calc(env(safe-area-inset-bottom, 0px) + 120px);
  left: 24px;
  right: 24px;
  text-align: center;
  font-size: 13px;
  color: var(--text-secondary);
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px 16px;
  z-index: 2;
}

/* ========================================
   Lyrics Panel – Immersive Synced View
======================================== */
.lyrics-panel {
  position: fixed;
  inset: 0;
  z-index: 900;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity 0.35s ease;
}
.lyrics-panel.hidden {
  display: none !important;
}
.lyrics-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.92);
  backdrop-filter: blur(30px);
  -webkit-backdrop-filter: blur(30px);
}
.lyrics-container {
  position: relative;
  width: min(1240px, calc(100vw - 72px));
  max-width: calc(100vw - 72px);
  height: 85vh;
  display: flex;
  flex-direction: column;
  z-index: 1;
}
.lyrics-titlebar {
  display: contents;
}
.lyrics-titlebar-title {
  display: none;
}
.lyrics-close-btn {
  position: absolute;
  top: 0;
  right: 0;
  color: var(--text-muted);
  z-index: 2;
  padding: 6px;
}
.lyrics-close-btn:hover {
  color: var(--text-primary);
}

/* Track header */
.lyrics-track-header {
  display: flex;
  align-items: center;
  gap: 16px;
  width: min(100%, 760px);
  margin: 0 auto;
  padding-bottom: 24px;
  flex-shrink: 0;
}
.lyrics-album-art {
  width: 64px;
  height: 64px;
  border-radius: 10px;
  object-fit: cover;
  box-shadow: 0 4px 24px var(--accent-glow);
}
.lyrics-track-meta {
  min-width: 0;
}
.lyrics-track-title {
  font-size: 20px;
  font-weight: 700;
  color: var(--text-primary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.lyrics-track-artist {
  font-size: 14px;
  color: var(--accent);
  margin-top: 2px;
}

/* Scrollable lyrics area */
.lyrics-scroll {
  flex: 1;
  overflow-y: auto;
  position: relative;
  -ms-overflow-style: none;
  scrollbar-width: none;
  mask-image: linear-gradient(
    to bottom,
    transparent 0%,
    black 12%,
    black 80%,
    transparent 100%
  );
  -webkit-mask-image: linear-gradient(
    to bottom,
    transparent 0%,
    black 12%,
    black 80%,
    transparent 100%
  );
}
.lyrics-scroll::-webkit-scrollbar {
  display: none;
}
.lyrics-scroll-inner {
  width: min(100%, 760px);
  margin: 0 auto;
}
.lyrics-spacer-top,
.lyrics-spacer-bottom {
  height: 35vh;
}

/* Individual lyric lines */
.lyrics-line {
  display: block;
  width: 100%;
  max-width: 100%;
  font-size: clamp(34px, 3.8vw, 58px);
  font-weight: 600;
  line-height: 1.22;
  padding: 10px 0;
  background: none;
  border: none;
  color: rgba(255, 255, 255, 0.08);
  font-family: inherit;
  text-align: left;
  white-space: normal;
  word-break: normal;
  overflow-wrap: break-word;
  opacity: 0.12;
  filter: blur(8px);
  transform: translate3d(0, 16px, 0) scale(0.968);
  transform-origin: left center;
  backface-visibility: hidden;
  text-shadow: 0 0 0 rgba(255, 255, 255, 0);
  transition:
    color 0.38s cubic-bezier(0.22, 1, 0.36, 1),
    transform 0.5s cubic-bezier(0.22, 1, 0.36, 1),
    filter 0.42s cubic-bezier(0.22, 1, 0.36, 1),
    opacity 0.42s ease,
    text-shadow 0.42s ease;
  cursor: pointer;
  user-select: none;
  will-change: transform, filter, opacity;
}
.lyrics-line:hover {
  color: rgba(255, 255, 255, 0.35);
  opacity: 0.22;
  filter: blur(5.5px);
}
.lyrics-line:focus-visible {
  outline: none;
  color: rgba(255, 255, 255, 0.55);
  opacity: 0.36;
  filter: blur(4px);
}

/* Active line – bright, crisp, and immediate */
.lyrics-line.active {
  color: #ffffff;
  opacity: 1;
  transform: translate3d(0, 0, 0) scale(1);
  filter: blur(0);
  text-shadow: 0 0 28px rgba(255, 255, 255, 0.16);
}

/* Nearby lines (±1) – visible enough to frame the current lyric */
.lyrics-line.near {
  color: rgba(255, 255, 255, 0.24);
  opacity: 0.34;
  filter: blur(4.2px);
  transform: translate3d(0, 7px, 0) scale(0.982);
}

/* Plain (non-synced) lyrics fallback */
.lyrics-plain {
  width: 100%;
  font-size: clamp(20px, 1.8vw, 28px);
  font-weight: 500;
  line-height: 1.8;
  color: rgba(255, 255, 255, 0.55);
  white-space: pre-wrap;
  padding: 20px 0;
}

.lyrics-loading {
  text-align: center;
  color: var(--text-muted);
  font-size: 15px;
  padding: 60px 0;
}

.lyrics-source-tag {
  padding-top: 12px;
  font-size: 11px;
  color: var(--text-muted);
  text-align: right;
  flex-shrink: 0;
}
@media (prefers-reduced-motion: reduce) {
  .lyrics-line {
    transform: none;
    transition: color 0.25s ease, opacity 0.25s ease, filter 0.25s ease;
  }
}
.modal-hint {
  font-size: 12px;
  color: var(--text-muted);
  margin: -8px 0 16px;
}

/* Lyrics button active */
.np-btn.lyrics-active {
  color: var(--accent);
}

/* ========================================
   Mini progress bar in now-playing bar
======================================== */
.np-mini-progress {
  display: none; /* shown only on mobile via media query */
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: rgba(255, 255, 255, 0.07);
  pointer-events: none;
  z-index: 1;
}
.np-mini-fill {
  height: 100%;
  background: var(--accent);
  width: 0%;
  transition: width 0.3s linear;
}

/* Mini controls in the bar (mobile only) */
.np-mini-actions {
  display: none;
  align-items: center;
  gap: 4px;
  padding: 0 8px;
  flex-shrink: 0;
}

/* ========================================
   Mobile Full-Screen Player
======================================== */
.mobile-player {
  position: fixed;
  inset: 0;
  z-index: 800;
  transform: translateY(100%);
  transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  pointer-events: none;
  display: flex;
  flex-direction: column;
}
.mobile-player.open {
  transform: translateY(0);
  pointer-events: auto;
}
.mp-bg {
  position: absolute;
  inset: 0;
  background: var(--bg-primary);
  z-index: 0;
}
.mp-bg::after {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse at 50% -10%, var(--accent-glow) 0%, transparent 60%);
}

.mp-inner {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  height: 100%;
  padding: max(env(safe-area-inset-top), 20px) 24px max(env(safe-area-inset-bottom), 24px);
  box-sizing: border-box;
  overflow: hidden;
}

/* Header */
.mp-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
  margin-bottom: 12px;
}
.mp-header-label {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-secondary);
}
.mp-header-btn {
  width: 40px;
  height: 40px;
  color: var(--text-secondary);
}
.mp-header-btn:hover {
  color: var(--text-primary);
  background: transparent;
}
.mp-header-btn.active {
  color: var(--text-primary);
}

/* Now Playing inner view */
.mp-np-view {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

/* Artwork */
.mp-artwork {
  flex: 1;
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding-bottom: 20px;
}
.mp-art-img {
  width: min(72vw, 340px);
  height: min(72vw, 340px);
  border-radius: var(--radius-lg);
  object-fit: cover;
  box-shadow: 0 20px 64px rgba(0, 0, 0, 0.65);
  flex-shrink: 0;
}
.mp-art-ph {
  background: var(--bg-hover);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
}

/* Track info row */
.mp-track-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 18px;
  flex-shrink: 0;
}
.mp-track-text {
  flex: 1;
  min-width: 0;
}
.mp-title {
  font-size: 20px;
  font-weight: 700;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--text-primary);
}
.mp-author {
  font-size: 14px;
  color: var(--accent);
  margin-top: 3px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.mp-icon-btn {
  width: 40px;
  height: 40px;
  color: var(--text-secondary);
  flex-shrink: 0;
}
.mp-icon-btn.lyrics-active {
  color: var(--accent);
}

/* Seek */
.mp-seek-section {
  flex-shrink: 0;
  margin-bottom: 22px;
}
.mp-progress-bar {
  width: 100%;
  height: 5px;
  background: rgba(255, 255, 255, 0.12);
  border-radius: 3px;
  cursor: pointer;
  position: relative;
  margin-bottom: 10px;
  touch-action: none;
}
.mp-progress-bar:active {
  height: 7px;
}
.mp-progress-fill {
  height: 100%;
  background: var(--accent);
  border-radius: 3px;
  width: 0%;
  transition: width 0.3s linear;
  position: relative;
}
.mp-progress-dot {
  position: absolute;
  right: -7px;
  top: 50%;
  transform: translateY(-50%);
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #fff;
  opacity: 0;
  transition: opacity 0.15s;
}
.mp-progress-bar:active .mp-progress-dot {
  opacity: 1;
}
.mp-time-row {
  display: flex;
  justify-content: space-between;
}
.mp-time-label {
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 500;
}

/* Controls */
.mp-controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
  margin-bottom: 14px;
  padding: 0 2px;
}
.mp-ctrl {
  width: 48px;
  height: 48px;
  color: var(--text-secondary);
  border-radius: 50%;
  position: relative;
}
.mp-ctrl:hover {
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.07);
}
.mp-ctrl.loop-active {
  color: var(--accent);
}
.mp-play-btn {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: #fff;
  border: none;
  color: #000;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.15s;
  flex-shrink: 0;
  box-shadow: 0 4px 24px rgba(0,0,0,0.4);
}
.mp-play-btn:hover {
  transform: scale(1.07);
}
.mp-play-btn:active {
  transform: scale(0.96);
}
#mp-icon-play {
  margin-left: 3px;
}

/* Volume picker */
.mp-vol-picker {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 4px 0;
  flex-shrink: 0;
  margin-top: 4px;
}
.mp-vol-options {
  display: flex;
  justify-content: space-around;
  flex-wrap: wrap;
  padding: 4px;
  gap: 4px;
}
.mp-vol-opt {
  padding: 6px 10px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  cursor: pointer;
  border-radius: var(--radius-sm);
  transition: all var(--transition);
  min-width: 44px;
  text-align: center;
}
.mp-vol-opt:hover {
  color: var(--text-primary);
  background: var(--bg-hover);
}
.mp-vol-opt.active {
  color: var(--accent);
  font-weight: 700;
}

/* Queue view */
.mp-queue-view {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
}
.mp-queue-list {
  flex: 1;
  overflow-y: auto;
  padding-bottom: 8px;
}
.mp-queue-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 4px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  border-bottom: 1px solid var(--border);
  transition: background var(--transition);
}
.mp-queue-item:hover {
  background: var(--bg-hover);
}
.mp-queue-item.playing {
  border-bottom-color: transparent;
}
.mp-qi-num {
  font-size: 13px;
  color: var(--text-muted);
  min-width: 22px;
  text-align: center;
  flex-shrink: 0;
}
.mp-qi-thumb {
  width: 44px;
  height: 44px;
  border-radius: 6px;
  object-fit: cover;
  flex-shrink: 0;
  background: var(--bg-hover);
}
.mp-qi-info {
  flex: 1;
  min-width: 0;
}
.mp-qi-title {
  font-size: 14px;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.mp-queue-item.playing .mp-qi-title {
  color: var(--accent);
}
.mp-qi-author {
  font-size: 12px;
  color: var(--text-secondary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.mp-qi-dur {
  font-size: 12px;
  color: var(--text-muted);
  flex-shrink: 0;
}

/* ========================================
   Hamburger Button (hidden on desktop)
======================================== */
.btn-sidebar-toggle {
  display: none;
  flex-shrink: 0;
  width: 36px;
  height: 36px;
}

/* ========================================
   Sidebar Overlay (mobile backdrop)
======================================== */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.65);
  z-index: 499;
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
}
.sidebar-overlay.active {
  display: block;
}

body.sidebar-mobile-open {
  overflow: hidden;
}

/* ========================================
   Mobile Responsive  (≤ 768px)
======================================== */
@media (max-width: 768px) {

  /* App: single-column grid — sidebar off-canvas */
  .app {
    grid-template-columns: 1fr;
    /* stack row height + safe-area for iOS bottom bar */
    grid-template-rows: 1fr calc(var(--np-height) + env(safe-area-inset-bottom, 0px));
  }

  /* Sidebar: fixed off-canvas drawer */
  .sidebar {
    grid-row: unset;
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    width: 280px;
    transform: translateX(-100%);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 500;
    box-shadow: 4px 0 32px rgba(0, 0, 0, 0.6);
    overflow-y: auto;
  }
  .sidebar.mobile-open {
    transform: translateX(0);
  }

  /* Desktop sidebar collapse button — hidden on mobile */
  .sidebar-collapse-btn {
    display: none;
  }

  /* Hamburger visible on mobile */
  .btn-sidebar-toggle {
    display: flex !important;
  }

  /* Search bar row: hamburger + input */
  .search-bar {
    align-items: center;
    gap: 10px;
    padding: 12px 0 10px;
  }
  .search-box {
    flex: 1;
    max-width: 100%;
  }

  /* Main: full width, reduced padding */
  .main {
    padding: 0 12px;
  }

  /* ── Now Playing: compact clickable mini bar ── */
  .now-playing {
    grid-column: 1;
    grid-template-columns: 1fr auto;
    padding: 0 12px;
    /* keep content above iOS home indicator */
    padding-bottom: env(safe-area-inset-bottom, 0px);
    gap: 0;
    cursor: pointer;
    position: relative;
    overflow: visible;
  }
  .np-mini-progress {
    display: block;
  }
  .now-playing .np-controls,
  .now-playing .np-extra {
    display: none;
  }
  .np-track-info {
    pointer-events: none;
    flex: 1;
  }
  .np-mini-actions {
    display: flex;
    pointer-events: auto;
  }

  /* Queue: hide "Added by" column */
  .queue-header {
    grid-template-columns: 20px minmax(0, 1fr) 64px;
  }
  .queue-header .col-track {
    padding-left: 56px;
  }
  .queue-header .col-added,
  .queue-header > span:last-child {
    display: none;
  }
  .queue-item {
    grid-template-columns: 20px minmax(0, 1fr) 64px;
    padding: 8px 10px;
  }
  .queue-item .qi-added-by,
  .queue-item .qi-remove {
    display: none;
  }
  .select-mode-active .queue-header {
    grid-template-columns: minmax(0, 1fr) 64px;
  }
  .select-mode .queue-item {
    grid-template-columns: minmax(0, 1fr) 64px;
  }
  .queue-select-bar {
    flex-wrap: wrap;
    gap: 8px;
    padding: 8px 10px;
  }
  .qs-btn span {
    display: none;
  }

  /* Playlist view hero: compact */
  .pv-hero {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }
  .pv-thumb,
  .pv-thumb-placeholder {
    width: 120px;
    height: 120px;
  }
  .pv-name {
    font-size: 22px;
  }
  .pv-track-header {
    grid-template-columns: 32px 1fr 52px;
    padding: 0 10px 8px;
  }
  .pv-track {
    grid-template-columns: 32px 1fr 52px;
    padding: 7px 10px;
  }

  /* Modals: fit screen width */
  .modal-card,
  .pl-edit-card,
  .playlist-modal-card {
    min-width: unset;
    width: calc(100vw - 32px);
    max-width: 420px;
    padding: 20px 18px;
  }

  /* Toast: full width */
  .toast-container {
    left: 0;
    width: 100%;
    padding: 0 16px;
  }
  .toast {
    white-space: normal;
    text-align: center;
    max-width: 100%;
    width: auto;
  }

  /* Lyrics panel: full width */
  .lyrics-container {
    width: 100%;
    max-width: 100%;
    height: 90vh;
    padding: 0 20px 20px;
    box-sizing: border-box;
  }
  .lyrics-track-header,
  .lyrics-scroll-inner {
    width: min(100%, 340px);
    margin-left: auto;
    margin-right: auto;
  }
  .lyrics-track-header {
    gap: 14px;
    padding-bottom: 18px;
  }
  .lyrics-line {
    font-size: clamp(28px, 8vw, 36px);
    line-height: 1.16;
    text-align: center;
    transform-origin: center center;
    padding: 12px 0;
  }
  .lyrics-plain {
    font-size: clamp(22px, 6.2vw, 30px);
    line-height: 1.6;
    text-align: center;
  }
  .lyrics-spacer-top,
  .lyrics-spacer-bottom {
    height: 28vh;
  }
  .lyrics-source-tag {
    text-align: center;
  }

  /* Search results: full width, no offset */
  .search-results {
    min-width: unset;
    width: 100%;
    left: 0;
    transform: none;
  }

  /* Context submenu: open to the left (avoid overflow) */
  .ctx-submenu {
    left: auto;
    right: 100%;
    top: -4px;
  }

  /* Login page: comfortable padding */
  .login-card {
    padding: 40px 24px;
  }
}

/* ========================================
   Permissions Panel – Session Management
======================================== */
.perm-panel {
  position: fixed;
  inset: 0;
  z-index: 950;
  pointer-events: none;
}
.perm-panel.open {
  pointer-events: auto;
}
.perm-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  opacity: 0;
  transition: opacity 0.25s ease;
}
.perm-panel.open .perm-backdrop {
  opacity: 1;
}
.perm-container {
  position: absolute;
  top: 0;
  right: 0;
  width: 360px;
  max-width: 100vw;
  height: 100%;
  background: var(--bg-sidebar);
  border-left: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  overflow: hidden;
}
.perm-panel.open .perm-container {
  transform: translateX(0);
}

/* Header */
.perm-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 18px 14px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.perm-header-title {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 15px;
  font-weight: 700;
  color: var(--text-primary);
}
.perm-header-title svg {
  color: var(--accent);
  flex-shrink: 0;
}

/* Scrollable body */
.perm-body {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 12px 0 24px;
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}
.perm-body::-webkit-scrollbar { width: 4px; }
.perm-body::-webkit-scrollbar-track { background: transparent; }
.perm-body::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }

.perm-empty {
  text-align: center;
  color: var(--text-muted);
  font-size: 13px;
  padding: 48px 24px;
}

/* Section headings inside the panel */
.perm-section-label {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-muted);
  padding: 8px 18px 4px;
}

/* User row */
.perm-user {
  padding: 10px 18px 4px;
  border-bottom: 1px solid var(--border);
}
.perm-user:last-child {
  border-bottom: none;
}

/* User identity row */
.perm-user-identity {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}
.perm-user-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
  background: var(--bg-hover);
}
.perm-user-avatar-ph {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--bg-hover);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 13px;
  font-weight: 700;
  color: var(--text-muted);
}
.perm-user-name-wrap {
  flex: 1;
  min-width: 0;
}
.perm-user-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.perm-user-tag {
  font-size: 11px;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 4px;
  margin-top: 1px;
}
.perm-badge-admin {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  background: rgba(232, 54, 93, 0.15);
  color: var(--accent);
  border: 1px solid rgba(232, 54, 93, 0.3);
  border-radius: 4px;
  font-size: 10px;
  font-weight: 700;
  padding: 1px 6px;
  letter-spacing: 0.04em;
}
.perm-badge-you {
  display: inline-flex;
  background: var(--bg-hover);
  color: var(--text-muted);
  border-radius: 4px;
  font-size: 10px;
  font-weight: 600;
  padding: 1px 6px;
}

/* Permission toggles */
.perm-toggles {
  display: flex;
  flex-direction: column;
  gap: 0;
  margin-bottom: 8px;
}
.perm-toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 5px 4px;
  border-radius: 6px;
  transition: background 0.15s;
}
.perm-toggle-row:hover:not(.locked) {
  background: var(--bg-hover);
}
.perm-toggle-label {
  font-size: 13px;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  gap: 7px;
}
.perm-toggle-label svg {
  color: var(--text-muted);
  flex-shrink: 0;
}

/* Toggle Switch */
.perm-toggle-switch {
  position: relative;
  width: 34px;
  height: 19px;
  flex-shrink: 0;
  cursor: pointer;
}
.perm-toggle-switch input {
  opacity: 0;
  width: 0;
  height: 0;
  position: absolute;
}
.perm-toggle-track {
  position: absolute;
  inset: 0;
  background: var(--bg-hover);
  border-radius: 10px;
  border: 1px solid var(--border);
  transition: background 0.2s, border-color 0.2s;
}
.perm-toggle-thumb {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 13px;
  height: 13px;
  border-radius: 50%;
  background: var(--text-muted);
  transition: transform 0.2s, background 0.2s;
}
.perm-toggle-switch input:checked + .perm-toggle-track {
  background: rgba(232, 54, 93, 0.25);
  border-color: var(--accent);
}
.perm-toggle-switch input:checked + .perm-toggle-track .perm-toggle-thumb {
  background: var(--accent);
  transform: translateX(15px);
}
.perm-toggle-switch.locked {
  cursor: default;
  opacity: 0.5;
  pointer-events: none;
}

/* Give Admin button */
.perm-give-admin-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 4px 0 8px;
  padding: 5px 10px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
  color: var(--accent);
  background: rgba(232, 54, 93, 0.1);
  border: 1px solid rgba(232, 54, 93, 0.2);
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}
.perm-give-admin-btn:hover {
  background: rgba(232, 54, 93, 0.2);
  border-color: var(--accent);
}

/* Permission icon on the button when panel is open */
#btn-permissions.perm-active,
#mp-perm-btn.perm-active {
  color: var(--accent);
}

/* Responsive: full-width drawer on mobile */
@media (max-width: 600px) {
  .perm-container {
    width: 100vw;
    border-left: none;
    border-top: 1px solid var(--border);
    top: auto;
    bottom: 0;
    right: 0;
    height: 80vh;
    border-radius: 16px 16px 0 0;
    transform: translateY(100%);
  }
  .perm-panel.open .perm-container {
    transform: translateY(0);
  }
}

/* ========================================
   PiP (Picture-in-Picture) Mode (Small Window)
======================================== */
@media (max-width: 500px) and (max-height: 380px), (max-height: 250px) {
  /* Oculta o restante do app: sidebar, views de lista, controles extras */
  .sidebar,
  .main,
  #sidebar-overlay,
  .mobile-player,
  .np-controls,
  .np-extra,
  .np-mini-progress,
  .np-mini-actions,
  .lyrics-panel,
  .perm-panel,
  .toast-container {
    display: none !important;
  }

  /* Ocupa a tela toda com a seção Currently Playing */
  .now-playing {
    position: fixed !important;
    inset: 0 !important;
    width: 100vw !important;
    height: 100vh !important;
    max-height: 100vh !important;
    border: none !important;
    background: radial-gradient(ellipse at 30% 50%, #1e0912 0%, #080808 100%) !important;
    display: flex !important;
    flex-direction: row !important;
    justify-content: center !important;
    align-items: center !important;
    padding: 24px !important;
    z-index: 99999 !important;
  }

  /* Reorganiza a info da faixa para colocar imagem esq, texto dir */
  .np-track-info {
    display: flex !important;
    flex-direction: row !important;
    align-items: center !important;
    justify-content: center !important;
    margin: 0 !important;
    width: 100% !important;
    max-width: 100% !important;
    gap: 24px !important;
    overflow: hidden !important;
  }

  /* Capa maior baseando-se na altura */
  .np-thumb-wrap {
    width: clamp(80px, 70vh, 200px) !important;
    height: clamp(80px, 70vh, 200px) !important;
    border-radius: 12px !important;
    box-shadow: 0 8px 30px rgba(0,0,0,0.5) !important;
    margin: 0 !important;
    flex-shrink: 0 !important;
  }

  /* Garante que imagens internas preencham o novo wrapper */
  .np-thumb, .np-thumb-placeholder {
    width: 100% !important;
    height: 100% !important;
    border-radius: 12px !important;
  }

  /* Alinha os textos a esquerda */
  .np-text {
    display: flex !important;
    flex-direction: column !important;
    align-items: flex-start !important;
    text-align: left !important;
    width: auto !important;
    min-width: 0 !important;
    overflow: hidden !important;
    gap: 8px !important;
  }

  .np-title {
    font-size: clamp(16px, 6vh, 28px) !important;
    font-weight: 700 !important;
    line-height: 1.2 !important;
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    width: 100% !important;
  }

  .np-author {
    font-size: clamp(13px, 4.5vh, 22px) !important;
    font-weight: 600 !important;
    color: var(--accent) !important;
    width: 100% !important;
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
  }
}

/* ── Language Picker Modal ── */
.lang-modal-card {
  max-width: 480px;
  max-height: calc(100vh - 40px);
  max-height: calc(100dvh - 40px);
  overflow-y: auto;
  text-align: center;
}
.lang-subtitle {
  color: var(--text-secondary);
  font-size: 14px;
  margin-bottom: 20px;
}
.lang-grid {
  display: grid !important;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}
.lang-option {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 14px 8px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--bg-secondary);
  color: var(--text-primary);
  cursor: pointer;
  transition: border-color var(--transition), background var(--transition);
  font-size: 13px;
  font-weight: 500;
  font-family: inherit;
  line-height: 1.4;
  -webkit-appearance: none;
  appearance: none;
  outline: none;
  min-width: 0;
}
.lang-option:hover {
  border-color: var(--accent);
  background: var(--bg-hover);
}
.lang-option.active {
  border-color: var(--accent);
  background: var(--accent-dim);
}
.lang-flag {
  font-size: 28px;
  line-height: 1;
}
.lang-name {
  white-space: nowrap;
}

/* ── Theme Picker (inside lang modal) ── */
.prefs-divider {
  height: 1px;
  background: var(--border);
  margin: 24px 0 20px;
}
.prefs-section-title {
  font-size: 18px;
  font-weight: 700;
  margin-bottom: 4px;
}
.prefs-section-subtitle {
  color: var(--text-secondary);
  font-size: 14px;
  margin-bottom: 16px;
}
.theme-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}
.theme-option {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 16px 12px;
  border-radius: var(--radius);
  border: 2px solid var(--border);
  background: var(--bg-secondary);
  color: var(--text-primary);
  cursor: pointer;
  transition: border-color var(--transition), background var(--transition), transform 0.15s;
  font-size: 13px;
  font-weight: 600;
  font-family: inherit;
  outline: none;
  -webkit-appearance: none;
  appearance: none;
}
.theme-option:hover {
  border-color: var(--accent);
  background: var(--bg-hover);
  transform: translateY(-2px);
}
.theme-option.active {
  border-color: var(--accent);
  background: var(--accent-dim);
}
.theme-preview {
  width: 100%;
  height: 48px;
  border-radius: 8px;
  overflow: hidden;
  display: flex;
  gap: 2px;
}
.theme-preview span {
  flex: 1;
  height: 100%;
}
.theme-name {
  white-space: nowrap;
}
@media (max-width: 500px) {
  .theme-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 500px) {
  .lang-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .lang-modal-card {
    max-width: 90vw;
  }
}

/* ── Rate Limit Cooldown ── */
body.rate-limited .np-controls .btn-icon,
body.rate-limited .mp-controls .btn-icon,
body.rate-limited .np-extra .btn-icon {
  opacity: 0.4;
  pointer-events: none;
  transition: opacity 0.3s ease;
}
/* ========== Remote-specific extras ========== */
.hidden { display: none !important; }

/* Search submit button */
.search-submit {
  position: absolute;
  right: 6px;
  top: 50%;
  transform: translateY(-50%);
  padding: 7px 16px;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 22px;
  font-family: 'K2D', sans-serif;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background var(--transition);
  white-space: nowrap;
}
.search-submit:hover { background: var(--accent-hover); }

/* Search box gets padding-right so input doesn't overlap button */
.search-box input { padding-right: 90px; }

/* Toast from old panel uses pill style + fixed pos */
.toast {
  position: fixed;
  bottom: calc(var(--np-height) + 16px);
  left: calc(var(--sidebar-width) + 50%);
  transform: translateX(-50%);
  padding: 10px 24px;
  background: var(--bg-card) !important;
  border: 1px solid var(--border);
  border-radius: 20px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.4);
  font-size: 13px;
  font-weight: 500;
  color: var(--text-primary);
  z-index: 3000;
  white-space: nowrap;
  pointer-events: auto;
  animation: toastIn 0.35s cubic-bezier(0.16,1,0.3,1) forwards;
}
.toast.error { border-color: rgba(224,80,80,0.5); color: #f07070; }
@keyframes toastIn {
  from { opacity: 0; transform: translateX(-50%) translateY(10px) scale(0.95); }
  to   { opacity: 1; transform: translateX(-50%) translateY(0) scale(1); }
}

/* Sidebar empty state */
.sidebar-empty {
  font-size: 12px;
  color: var(--text-muted);
  padding: 6px 0;
}

/* User info buttons in sidebar */
.user-btn {
  width: 28px;
  height: 28px;
  flex-shrink: 0;
  color: var(--text-muted);
}
.user-btn:hover { color: var(--text-primary); background: transparent; }

.queue-list.drag-reorder-end::after {
  content: "";
  display: block;
  height: 2px;
  margin: 0 16px 8px;
  border-radius: 999px;
  background: var(--accent);
  box-shadow: 0 0 8px rgba(232, 54, 93, 0.45);
}
.queue-item .qi-drag {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  font-size: 15px;
  line-height: 1;
  letter-spacing: -1px;
  user-select: none;
}

/* Mobile player: slide-up animation */
.mobile-player {
  pointer-events: none;
}
.mobile-player.open {
  transform: translateY(0) !important;
  pointer-events: auto !important;
}

/* Volume dropdown */
.volume-dropdown { z-index: 300; }

@media (max-width: 768px) {
  .toast {
    left: 50%;
    max-width: calc(100vw - 32px);
  }
}
