/* ==========================================================================
   SD MUSIC — Official Stylesheet (v4 — Strict Mobile Viewport Containment
   & Universal Left-Right Horizontal Scrolling for All Exceeding Elements)
   App Made by Soham Dandavate | © Copyright Soham Dandavate
   ========================================================================== */

:root {
  --bg-base: #030305;
  --bg-surface: #0c0c12;
  --bg-elevated: #151520;
  --bg-card: rgba(25, 25, 38, 0.76);
  --bg-glass: rgba(14, 14, 22, 0.88);
  --accent-primary: #ff0033;
  --accent-secondary: #ff4d00;
  --accent-gradient: linear-gradient(135deg, #ff0033 0%, #ff4d00 100%);
  --accent-glow: rgba(255, 0, 51, 0.35);
  --text-primary: #ffffff;
  --text-secondary: #a8a8bd;
  --text-muted: #6c6c84;
  --border-subtle: rgba(255, 255, 255, 0.08);
  --border-bright: rgba(255, 255, 255, 0.16);
  --success: #00e676;
  --warning: #ffab00;
  --danger: #ff1744;
  --info: #00b0ff;
  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --radius-pill: 999px;
  --nav-height-mobile: 64px;
  --miniplayer-height: 72px;
  --sidebar-width: 248px;
  --header-height: 68px;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

html, body {
  width: 100%;
  max-width: 100vw;
  height: 100%;
  background-color: var(--bg-base);
  color: var(--text-primary);
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
  direction: ltr;
}

/* CRITICAL FIX FOR MOBILE KEYBOARDS TYPING BACKWARDS ('hi' -> 'ih') */
input,
textarea,
select,
[contenteditable="true"] {
  user-select: text !important;
  -webkit-user-select: text !important;
  direction: ltr !important;
  unicode-bidi: normal !important;
  text-align: left !important;
}

/* CRITICAL FIX FOR CSS GRID / FLEX CHILDREN OVERFLOWING MOBILE SCREEN:
   Ensure all structural containers have min-width: 0 and max-width: 100% */
.app-shell,
.main-workspace,
.feed-column,
#musicFeedView,
#categorizedSectionsWrap,
#dynamicSearchSection,
#savedPlaylistsSection,
.admin-panel-section,
.player-stage-column,
.dock-main-row,
.dock-track-left {
  min-width: 0;
  max-width: 100%;
}

::-webkit-scrollbar {
  width: 5px;
  height: 5px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.22);
  border-radius: 999px;
}
::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 0, 51, 0.65);
}

.ambient-backdrop {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  background:
    radial-gradient(circle at 18% 15%, rgba(255, 0, 51, 0.16), transparent 45%),
    radial-gradient(circle at 82% 25%, rgba(255, 77, 0, 0.11), transparent 50%),
    radial-gradient(circle at 50% 85%, rgba(110, 0, 255, 0.09), transparent 55%);
}

/* ==========================================================================
   LOGIN GATE & TIMED INVITE OVERLAY
   ========================================================================== */
.auth-overlay {
  position: fixed;
  inset: 0;
  z-index: 30000;
  background: radial-gradient(circle at top, #1a060d 0%, #050508 65%, #020203 100%);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 16px;
  overflow-y: auto;
}

.auth-overlay.hidden {
  display: none !important;
}

.auth-card {
  width: 100%;
  max-width: 430px;
  background: rgba(16, 16, 26, 0.88);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 26px;
  padding: 28px 22px 24px;
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.75), 0 0 40px rgba(255, 0, 51, 0.14);
  text-align: center;
  position: relative;
}

.auth-logo-wrap {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 64px;
  height: 64px;
  border-radius: 20px;
  background: var(--accent-gradient);
  box-shadow: 0 10px 28px rgba(255, 0, 51, 0.45);
  margin-bottom: 12px;
}

.auth-title {
  font-size: 1.65rem;
  font-weight: 800;
  letter-spacing: -0.5px;
  margin-bottom: 4px;
}

.auth-creator-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(255, 0, 51, 0.14);
  border: 1px solid rgba(255, 0, 51, 0.35);
  color: #ff6b88;
  font-size: 0.74rem;
  font-weight: 700;
  padding: 5px 12px;
  border-radius: var(--radius-pill);
  margin-bottom: 16px;
  text-transform: uppercase;
  letter-spacing: 0.6px;
}

.auth-subtitle {
  color: var(--text-secondary);
  font-size: 0.88rem;
  line-height: 1.45;
  margin-bottom: 20px;
}

.invite-banner {
  background: linear-gradient(135deg, rgba(0, 230, 118, 0.15), rgba(0, 176, 255, 0.12));
  border: 1px solid rgba(0, 230, 118, 0.4);
  border-radius: 14px;
  padding: 12px 14px;
  margin-bottom: 18px;
  text-align: left;
  display: none;
}

.invite-banner.active {
  display: block;
}

.invite-banner-title {
  color: var(--success);
  font-weight: 700;
  font-size: 0.85rem;
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 4px;
}

.invite-banner-desc {
  color: #d0f8e4;
  font-size: 0.8rem;
  line-height: 1.35;
}

.form-group {
  text-align: left;
  margin-bottom: 15px;
}

.form-label {
  display: block;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.form-input {
  width: 100%;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 13px;
  padding: 12px 14px;
  color: var(--text-primary);
  font-size: 0.95rem;
  outline: none;
  transition: all 0.2s ease;
}

.form-input:focus {
  border-color: var(--accent-primary);
  background: rgba(255, 255, 255, 0.08);
  box-shadow: 0 0 0 3px rgba(255, 0, 51, 0.2);
}

.btn-primary {
  width: 100%;
  background: var(--accent-gradient);
  color: #fff;
  font-weight: 700;
  font-size: 0.95rem;
  padding: 13px 18px;
  border: none;
  border-radius: 14px;
  cursor: pointer;
  box-shadow: 0 8px 24px rgba(255, 0, 51, 0.38);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.auth-error {
  color: #ff5252;
  background: rgba(255, 23, 68, 0.12);
  border: 1px solid rgba(255, 23, 68, 0.3);
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 0.83rem;
  margin-bottom: 14px;
  display: none;
}

.auth-error.visible {
  display: block;
}

.auth-footer-copy {
  margin-top: 20px;
  padding-top: 14px;
  border-top: 1px solid var(--border-subtle);
  font-size: 0.75rem;
  color: var(--text-secondary);
  line-height: 1.5;
}

.auth-footer-copy strong {
  color: #fff;
}

/* ==========================================================================
   APP SHELL LAYOUT
   ========================================================================== */
.app-shell {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: var(--sidebar-width) minmax(0, 1fr);
  grid-template-rows: var(--header-height) minmax(0, 1fr);
  width: 100vw;
  max-width: 100vw;
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
}

.top-header {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 0 18px;
  background: rgba(8, 8, 13, 0.94);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border-subtle);
  z-index: 50;
  width: 100%;
  max-width: 100vw;
}

.brand-cluster {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  flex-shrink: 0;
}

.brand-icon {
  width: 36px;
  height: 36px;
  border-radius: 11px;
  background: var(--accent-gradient);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 14px rgba(255, 0, 51, 0.4);
}

.brand-text-wrap {
  display: flex;
  flex-direction: column;
}

.brand-name {
  font-weight: 800;
  font-size: 1.05rem;
  letter-spacing: -0.4px;
  display: flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}

.brand-badge {
  font-size: 0.6rem;
  background: rgba(255, 0, 51, 0.2);
  color: #ff6b88;
  border: 1px solid rgba(255, 0, 51, 0.4);
  padding: 1px 6px;
  border-radius: 6px;
  font-weight: 700;
}

.brand-sub {
  font-size: 0.66rem;
  color: var(--text-secondary);
  font-weight: 500;
  white-space: nowrap;
}

/* Search Bar (Strict LTR) */
.search-container {
  flex: 1;
  min-width: 0;
  max-width: 540px;
  position: relative;
  display: flex;
  align-items: center;
  direction: ltr;
}

.search-input {
  width: 100%;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: var(--radius-pill);
  padding: 10px 72px 10px 38px;
  color: #fff;
  font-size: 0.94rem;
  outline: none;
  transition: border-color 0.2s, background 0.2s;
  direction: ltr !important;
  unicode-bidi: normal !important;
  text-align: left !important;
  user-select: text !important;
  -webkit-user-select: text !important;
}

.search-input:focus {
  background: rgba(255, 255, 255, 0.12);
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 3px rgba(255, 0, 51, 0.18);
}

.search-icon-left {
  position: absolute;
  left: 13px;
  color: var(--text-secondary);
  pointer-events: none;
  font-size: 0.9rem;
}

.search-voice-btn {
  position: absolute;
  right: 40px;
  background: transparent;
  border: none;
  color: var(--text-secondary);
  width: 28px;
  height: 28px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
}

.search-btn-go {
  position: absolute;
  right: 5px;
  background: var(--accent-gradient);
  border: none;
  color: #fff;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8rem;
}

/* Header Right Actions — Horizontally Scrollable if Exceeding Screen Width! */
.header-actions {
  display: flex;
  align-items: center;
  gap: 7px;
  overflow-x: auto;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
  touch-action: pan-x;
  scrollbar-width: none;
  max-width: 100%;
}
.header-actions::-webkit-scrollbar {
  display: none;
}

.header-actions > * {
  flex: 0 0 auto;
  white-space: nowrap;
}

.header-user-controls {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 0 0 auto;
}

.mode-switch-pill {
  display: inline-flex;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid var(--border-bright);
  border-radius: var(--radius-pill);
  padding: 3px;
  gap: 2px;
}

.mode-switch-btn {
  border: none;
  background: transparent;
  color: var(--text-secondary);
  font-size: 0.75rem;
  font-weight: 700;
  padding: 5px 11px;
  border-radius: var(--radius-pill);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.mode-switch-btn.active {
  background: var(--accent-gradient);
  color: #fff;
  box-shadow: 0 2px 10px rgba(255, 0, 51, 0.4);
}

.bg-play-badge {
  background: rgba(0, 230, 118, 0.14);
  border: 1px solid rgba(0, 230, 118, 0.4);
  color: var(--success);
  font-size: 0.72rem;
  font-weight: 700;
  padding: 5px 9px;
  border-radius: var(--radius-pill);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  white-space: nowrap;
}

.car-mode-btn {
  background: rgba(0, 176, 255, 0.14);
  border: 1px solid rgba(0, 176, 255, 0.4);
  color: #40c4ff;
  font-size: 0.72rem;
  font-weight: 700;
  padding: 5px 9px;
  border-radius: 999px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  white-space: nowrap;
}

.session-timer-pill {
  display: none;
  align-items: center;
  gap: 5px;
  background: rgba(255, 171, 0, 0.15);
  border: 1px solid rgba(255, 171, 0, 0.45);
  color: #ffd54f;
  font-size: 0.74rem;
  font-weight: 700;
  padding: 5px 10px;
  border-radius: var(--radius-pill);
  white-space: nowrap;
}

.session-timer-pill.visible {
  display: inline-flex;
}

.user-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid var(--border-subtle);
  padding: 4px 10px 4px 5px;
  border-radius: var(--radius-pill);
  font-size: 0.78rem;
  font-weight: 600;
  white-space: nowrap;
}

.user-avatar {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--accent-gradient);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 0.72rem;
  color: #fff;
}

.btn-logout-small {
  background: rgba(255, 23, 68, 0.14);
  border: 1px solid rgba(255, 23, 68, 0.35);
  color: #ff6b88;
  border-radius: 10px;
  padding: 6px 10px;
  font-size: 0.74rem;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
}

.btn-logout-small:hover {
  background: var(--danger);
  color: #fff;
}

/* ==========================================================================
   SIDEBAR NAVIGATION (DESKTOP)
   ========================================================================== */
.sidebar {
  background: rgba(10, 10, 16, 0.78);
  border-right: 1px solid var(--border-subtle);
  padding: 18px 12px 110px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  overflow-y: auto;
}

.nav-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.nav-section-label {
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--text-muted);
  padding: 14px 12px 6px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  border-radius: 12px;
  color: var(--text-secondary);
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  border: none;
  background: transparent;
  width: 100%;
  text-align: left;
  transition: all 0.18s ease;
}

.nav-item:hover {
  background: rgba(255, 255, 255, 0.06);
  color: #fff;
}

.nav-item.active {
  background: rgba(255, 0, 51, 0.15);
  color: #fff;
  border: 1px solid rgba(255, 0, 51, 0.35);
}

.nav-item.admin-nav {
  background: linear-gradient(135deg, rgba(255, 0, 51, 0.18), rgba(255, 171, 0, 0.14));
  border: 1px solid rgba(255, 171, 0, 0.4);
  color: #ffd54f;
}

.sidebar-copyright {
  margin-top: 20px;
  padding: 14px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-subtle);
  font-size: 0.74rem;
  color: var(--text-secondary);
  line-height: 1.5;
}

.sidebar-copyright strong {
  color: #fff;
  display: block;
  margin-bottom: 2px;
}

/* ==========================================================================
   MAIN CONTENT AREA + UNIVERSAL LEFT-RIGHT SCROLLING SHELVES
   ========================================================================== */
.main-workspace {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 410px;
  width: 100%;
  height: 100%;
  overflow: hidden;
  transition: grid-template-columns 0.3s ease;
}

.main-workspace.video-stage-expanded {
  grid-template-columns: minmax(0, 1fr) 520px;
}

.main-workspace.cinema-mode .feed-column {
  display: none;
}

.main-workspace.cinema-mode {
  grid-template-columns: minmax(0, 1fr);
}

.main-workspace.cinema-mode .player-stage-column {
  max-width: 1080px;
  width: 100%;
  margin: 0 auto;
  border-left: none;
}

.feed-column {
  width: 100%;
  height: 100%;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 18px 22px 160px;
}

/* Filter Chips Row — Smooth Left-Right Scrolling */
.chips-row {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: 8px;
  width: 100%;
  overflow-x: auto !important;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
  touch-action: pan-x pan-y;
  overscroll-behavior-x: contain;
  padding-bottom: 10px;
  margin-bottom: 16px;
}

.chip {
  flex: 0 0 auto;
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  padding: 8px 15px;
  border-radius: var(--radius-pill);
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
}

.chip:hover {
  background: rgba(255, 255, 255, 0.13);
  color: #fff;
}

.chip.active {
  background: #fff;
  color: #050507;
  border-color: #fff;
  font-weight: 700;
}

.hero-banner {
  background: linear-gradient(135deg, rgba(255, 0, 51, 0.26) 0%, rgba(20, 20, 35, 0.92) 65%, rgba(255, 77, 0, 0.2) 100%);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 20px;
  padding: 18px 20px;
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  width: 100%;
  overflow: hidden;
}

.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(255, 0, 51, 0.25);
  border: 1px solid rgba(255, 0, 51, 0.5);
  color: #ff809b;
  font-size: 0.68rem;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 999px;
  margin-bottom: 8px;
  text-transform: uppercase;
  max-width: 100%;
  overflow-x: auto;
  white-space: nowrap;
}

.hero-title {
  font-size: 1.35rem;
  font-weight: 800;
  letter-spacing: -0.4px;
  margin-bottom: 6px;
  word-wrap: break-word;
}

.hero-sub {
  color: var(--text-secondary);
  font-size: 0.83rem;
  max-width: 560px;
  line-height: 1.45;
}

/* Section Headers — Left-Right Scrollable if buttons exceed width */
.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin: 20px 0 12px;
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.section-header::-webkit-scrollbar {
  display: none;
}

.section-title {
  font-size: 1.08rem;
  font-weight: 800;
  letter-spacing: -0.3px;
  display: flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
  flex-shrink: 0;
}

.section-controls-right {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.scroll-arrow-btn {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid var(--border-subtle);
  color: #fff;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.74rem;
  flex-shrink: 0;
}

.scroll-arrow-btn:hover {
  background: var(--accent-primary);
  border-color: var(--accent-primary);
}

.section-Action {
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  padding: 5px 11px;
  border-radius: var(--radius-pill);
  font-size: 0.73rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
}

/* Horizontal Scrollable Carousel for All Shelves (Contained within 100% Width!) */
.media-carousel {
  display: flex;
  flex-wrap: nowrap;
  gap: 14px;
  width: 100%;
  max-width: 100%;
  overflow-x: auto !important;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
  touch-action: pan-x pan-y;
  overscroll-behavior-x: contain;
  scroll-snap-type: x proximity;
  padding: 4px 2px 12px;
}

.media-carousel .media-card {
  flex: 0 0 205px;
  width: 205px;
  max-width: 205px;
  scroll-snap-align: start;
}

/* Search & Library Grid */
.media-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 170px), 1fr));
  gap: 14px;
  width: 100%;
}

.media-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: 16px;
  padding: 10px;
  cursor: pointer;
  transition: transform 0.2s ease, border-color 0.2s ease, background 0.2s;
  display: flex;
  flex-direction: column;
  position: relative;
  user-select: none;
  -webkit-user-select: none;
  min-width: 0;
}

.media-card:hover {
  transform: translateY(-3px);
  background: rgba(34, 34, 52, 0.88);
  border-color: rgba(255, 0, 51, 0.45);
}

.media-card.playing {
  border-color: var(--accent-primary);
  box-shadow: 0 0 22px rgba(255, 0, 51, 0.25);
}

.thumb-wrap {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 10;
  border-radius: 11px;
  overflow: hidden;
  background: #14141f;
  margin-bottom: 9px;
}

.thumb-wrap img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  pointer-events: none;
}

.thumb-play-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.2s;
}

.media-card:hover .thumb-play-overlay,
.media-card.playing .thumb-play-overlay {
  opacity: 1;
}

.play-circle {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--accent-gradient);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 6px 18px rgba(255, 0, 51, 0.55);
  font-size: 0.95rem;
}

.thumb-duration {
  position: absolute;
  bottom: 6px;
  right: 6px;
  background: rgba(0, 0, 0, 0.82);
  color: #fff;
  font-size: 0.66rem;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 5px;
}

.thumb-era-tag {
  position: absolute;
  top: 6px;
  left: 6px;
  background: rgba(255, 0, 51, 0.88);
  color: #fff;
  font-size: 0.62rem;
  font-weight: 800;
  padding: 2px 7px;
  border-radius: 5px;
  text-transform: uppercase;
}

.media-title {
  font-size: 0.84rem;
  font-weight: 700;
  color: #fff;
  line-height: 1.35;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  margin-bottom: 4px;
}

.media-artist {
  font-size: 0.74rem;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.media-meta-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 4px;
  margin-top: auto;
  padding-top: 8px;
  font-size: 0.68rem;
  color: var(--text-muted);
}

.media-meta-row > span {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}

.card-Quick-actions {
  display: flex;
  gap: 4px;
  flex-shrink: 0;
}

.icon-btn-tiny {
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid transparent;
  color: var(--text-secondary);
  width: 25px;
  height: 25px;
  border-radius: 7px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.72rem;
}

.icon-btn-tiny:hover,
.icon-btn-tiny.liked {
  color: var(--accent-primary);
  border-color: rgba(255, 0, 51, 0.4);
  background: rgba(255, 0, 51, 0.14);
}

/* ==========================================================================
   RIGHT STAGE PANEL (SONG / VIDEO PLAYER + DRAGGABLE UP NEXT QUEUE)
   ========================================================================== */
.player-stage-column {
  background: rgba(11, 11, 18, 0.94);
  border-left: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 16px 18px 130px;
}

.stage-top-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 12px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.stage-top-bar::-webkit-scrollbar {
  display: none;
}

.stage-close-mobile {
  display: none;
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.25);
  color: #fff;
  min-height: 36px;
  padding: 6px 14px;
  border-radius: 999px;
  cursor: pointer;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-size: 0.8rem;
  font-weight: 700;
  flex-shrink: 0;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.4);
  transition: all 0.2s ease;
}

.stage-close-mobile:active {
  background: var(--accent-gradient);
  transform: scale(0.96);
}

.visual-stage-box {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  border-radius: 16px;
  overflow: hidden;
  background: #000000;
  border: 1px solid rgba(255, 255, 255, 0.14);
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.72);
  margin-bottom: 10px;
  flex-shrink: 0;
}

.visual-stage-box.video-mode {
  border-color: rgba(255, 0, 51, 0.55);
  box-shadow: 0 14px 38px rgba(255, 0, 51, 0.22);
}

.yt-video-viewport {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 2;
  background: #000;
}

.yt-video-viewport iframe {
  width: 100% !important;
  height: 100% !important;
  border: 0;
  display: block;
}

.song-art-overlay {
  position: absolute;
  inset: 0;
  z-index: 5;
  background: radial-gradient(circle at center, #1f0a14 0%, #07070c 100%);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 16px;
  transition: opacity 0.25s ease, visibility 0.25s;
}

.visual-stage-box.video-mode .song-art-overlay {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

/* Video Variants Bar — Horizontally Scrollable on Mobile */
.video-variants-bar {
  display: none;
  align-items: center;
  gap: 6px;
  flex-wrap: nowrap;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  touch-action: pan-x;
  margin-bottom: 12px;
  padding: 8px 10px;
  background: rgba(255, 0, 51, 0.08);
  border: 1px solid rgba(255, 0, 51, 0.25);
  border-radius: 12px;
  width: 100%;
}

.video-variants-bar.visible {
  display: flex;
}

.video-variants-label {
  font-size: 0.72rem;
  font-weight: 700;
  color: #ff809b;
  white-space: nowrap;
  flex-shrink: 0;
}

.variant-pill {
  flex: 0 0 auto;
  white-space: nowrap;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.14);
  color: var(--text-secondary);
  font-size: 0.72rem;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 999px;
  cursor: pointer;
}

.variant-pill:hover,
.variant-pill.active {
  background: var(--accent-gradient);
  color: #fff;
  border-color: transparent;
}

.song-art-disc-wrap {
  position: relative;
  width: 132px;
  height: 132px;
  border-radius: 18px;
  overflow: hidden;
  box-shadow: 0 12px 32px rgba(255, 0, 51, 0.35);
  border: 2px solid rgba(255, 255, 255, 0.18);
}

.song-art-disc-wrap img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.eq-bars {
  display: flex;
  align-items: flex-end;
  gap: 4px;
  height: 20px;
  margin-top: 12px;
}

.eq-bar {
  width: 4px;
  background: var(--accent-gradient);
  border-radius: 99px;
  height: 5px;
  transition: height 0.2s;
}

.eq-bars.active .eq-bar:nth-child(1) { animation: eqBounce 0.7s infinite ease-in-out 0.1s; }
.eq-bars.active .eq-bar:nth-child(2) { animation: eqBounce 0.55s infinite ease-in-out 0.25s; }
.eq-bars.active .eq-bar:nth-child(3) { animation: eqBounce 0.8s infinite ease-in-out 0.05s; }
.eq-bars.active .eq-bar:nth-child(4) { animation: eqBounce 0.6s infinite ease-in-out 0.3s; }
.eq-bars.active .eq-bar:nth-child(5) { animation: eqBounce 0.75s infinite ease-in-out 0.15s; }

@keyframes eqBounce {
  0%, 100% { height: 5px; }
  50% { height: 20px; }
}

.now-playing-info {
  margin-bottom: 10px;
  width: 100%;
}

.np-title {
  font-size: 1rem;
  font-weight: 800;
  color: #fff;
  line-height: 1.35;
  margin-bottom: 4px;
  word-wrap: break-word;
}

.np-artist {
  font-size: 0.8rem;
  color: var(--text-secondary);
}

.np-creator-watermark {
  display: inline-block;
  margin-top: 6px;
  font-size: 0.68rem;
  color: #ff809b;
  background: rgba(255, 0, 51, 0.12);
  border: 1px solid rgba(255, 0, 51, 0.28);
  padding: 2px 8px;
  border-radius: 999px;
  font-weight: 600;
  white-space: nowrap;
}

/* Dedicated In-Stage Audio Controls (Only visible in Audio/Song Mode) */
.stage-audio-controls-panel {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 12px 14px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 14px;
  margin: 10px 0 12px;
  width: 100%;
}

.visual-stage-box.video-mode ~ .stage-audio-controls-panel {
  display: none !important;
}

.stage-seek-row {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
}

.stage-seek-row .dock-progress-range {
  flex: 1;
  height: 6px;
  border-radius: 3px;
  background: rgba(255, 255, 255, 0.16);
}

.stage-seek-row .dock-progress-range::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--accent-primary);
  box-shadow: 0 0 10px rgba(255, 0, 51, 0.8);
  cursor: pointer;
}

.stage-buttons-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 18px;
  width: 100%;
}

.stage-buttons-row .ctrl-btn {
  font-size: 1.25rem;
  width: 40px;
  height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.stage-buttons-row .ctrl-btn-play {
  width: 52px;
  height: 52px;
  font-size: 1.4rem;
  box-shadow: 0 4px 18px rgba(255, 0, 51, 0.45);
}

/* Queue / Playlist Customization Toolbar — Clearly Visible on Mobile & Desktop */
.queue-header {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin: 14px 0 10px;
  padding: 10px 12px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  flex-shrink: 0;
  height: auto;
  min-height: unset;
  box-sizing: border-box;
}

.queue-header-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
}

.queue-title-wrap {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.queue-title-text {
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  color: #ffffff;
}

.queue-count-badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 700;
  background: rgba(255, 0, 51, 0.16);
  border: 1px solid rgba(255, 0, 51, 0.35);
  color: #ff8598;
  line-height: 1.2;
}

.queue-drag-hint {
  font-size: 0.68rem;
  font-weight: 500;
  color: var(--text-muted);
  display: inline-flex;
  align-items: center;
  gap: 4px;
  opacity: 0.85;
}

.queue-toolbar-btns {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  width: 100%;
  margin-left: 0;
}

.queue-action-btn {
  width: 100%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  background: linear-gradient(135deg, rgba(255, 0, 51, 0.22), rgba(255, 61, 0, 0.22));
  border: 1px solid rgba(255, 0, 51, 0.55);
  color: #ff99aa;
  font-size: 0.75rem;
  font-weight: 700;
  padding: 7px 10px;
  border-radius: 8px;
  cursor: pointer;
  white-space: nowrap;
  line-height: 1.2;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.35);
  box-sizing: border-box;
  transition: all 0.2s ease;
}

.queue-action-btn:hover,
.queue-action-btn:active {
  background: var(--accent-gradient);
  border-color: transparent;
  color: #ffffff;
  transform: translateY(-1px);
}

.queue-list {
  display: flex;
  flex-direction: column;
  gap: 7px;
  width: 100%;
}

.queue-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 8px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid transparent;
  cursor: pointer;
  user-select: none;
  width: 100%;
  min-width: 0;
}

.queue-item:hover {
  background: rgba(255, 255, 255, 0.07);
}

.queue-item.active {
  background: rgba(255, 0, 51, 0.14);
  border-color: rgba(255, 0, 51, 0.38);
}

.queue-item.dragging {
  opacity: 0.55;
  border: 1px dashed var(--accent-primary);
  transform: scale(0.98);
}

.queue-item.drag-over {
  border-top: 2px solid #00e676;
}

.queue-item * {
  pointer-events: none;
}
.queue-item .queue-remove-btn,
.queue-item .drag-handle {
  pointer-events: auto;
}

.drag-handle {
  cursor: grab;
  color: var(--text-muted);
  font-size: 0.95rem;
  padding: 4px 5px;
  touch-action: none;
  flex-shrink: 0;
}

.queue-item img {
  width: 44px;
  height: 32px;
  border-radius: 6px;
  object-fit: cover;
  flex-shrink: 0;
  pointer-events: none;
}

.queue-item-meta {
  flex: 1;
  min-width: 0;
}

.queue-item-title {
  font-size: 0.79rem;
  font-weight: 600;
  color: #fff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.queue-item-artist {
  font-size: 0.69rem;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.queue-remove-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  width: 24px;
  height: 24px;
  border-radius: 6px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.78rem;
  flex-shrink: 0;
}

.queue-remove-btn:hover {
  background: rgba(255, 23, 68, 0.2);
  color: #ff5252;
}

/* ==========================================================================
   LONG-PRESS / RIGHT-CLICK CONTEXT MENU
   ========================================================================== */
.context-menu-backdrop {
  position: fixed;
  inset: 0;
  z-index: 9500;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(6px);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 14px;
}

.context-menu-backdrop.visible {
  display: flex;
}

.context-menu-sheet {
  width: 100%;
  max-width: 370px;
  max-height: 90vh;
  overflow-y: auto;
  background: #12121d;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 22px;
  padding: 18px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.85);
}

.ctx-track-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding-bottom: 12px;
  margin-bottom: 12px;
  border-bottom: 1px solid var(--border-subtle);
}

.ctx-track-header img {
  width: 50px;
  height: 50px;
  border-radius: 10px;
  object-fit: cover;
  flex-shrink: 0;
}

.ctx-option-btn {
  width: 100%;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.07);
  color: #fff;
  padding: 11px 14px;
  border-radius: 12px;
  font-size: 0.85rem;
  font-weight: 600;
  text-align: left;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 7px;
}

.ctx-option-btn:hover {
  background: rgba(255, 0, 51, 0.18);
  border-color: rgba(255, 0, 51, 0.45);
}

.sd-toast {
  position: fixed;
  bottom: 145px;
  left: 50%;
  transform: translateX(-50%) translateY(30px);
  background: rgba(18, 18, 28, 0.96);
  border: 1px solid var(--accent-primary);
  color: #fff;
  padding: 10px 16px;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 700;
  max-width: 92vw;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.7);
  z-index: 20000;
  opacity: 0;
  pointer-events: none;
  transition: all 0.25s ease;
}

.sd-toast.visible {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ==========================================================================
   ANDROID AUTO / IN-CAR DRIVING MODE OVERLAY
   ========================================================================== */
.car-mode-overlay {
  position: fixed;
  inset: 0;
  z-index: 9200;
  background: radial-gradient(circle at center, #14070e 0%, #040407 100%);
  display: none;
  flex-direction: column;
  justify-content: space-between;
  padding: 20px;
  overflow-y: auto;
}

.car-mode-overlay.active {
  display: flex;
}

.car-top-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}

.car-main-display {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 22px;
  flex-wrap: wrap;
  text-align: center;
}

.car-art-img {
  width: 150px;
  height: 150px;
  border-radius: 22px;
  object-fit: cover;
  border: 3px solid var(--accent-primary);
  box-shadow: 0 16px 44px rgba(255, 0, 51, 0.4);
}

.car-track-title {
  font-size: 1.4rem;
  font-weight: 900;
  color: #fff;
  margin-bottom: 8px;
  max-width: 90vw;
}

.car-track-artist {
  font-size: 1rem;
  color: #ff809b;
  font-weight: 700;
}

.car-giant-controls {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 12px;
  max-width: 780px;
  width: 100%;
  margin: 0 auto;
}

.car-ctrl-btn {
  height: 76px;
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.08);
  border: 2px solid rgba(255, 255, 255, 0.16);
  color: #fff;
  font-size: 1.5rem;
  font-weight: 800;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
}

.car-ctrl-btn.primary {
  background: var(--accent-gradient);
  border-color: transparent;
  box-shadow: 0 10px 30px rgba(255, 0, 51, 0.45);
}

.car-ctrl-btn span {
  font-size: 0.72rem;
  text-transform: uppercase;
}

/* ==========================================================================
   BOTTOM PLAYER DOCK
   ========================================================================== */
.player-dock {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  width: 100vw;
  max-width: 100vw;
  height: 82px;
  background: rgba(10, 10, 16, 0.96);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border-top: 1px solid rgba(255, 255, 255, 0.12);
  z-index: 90;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 0 18px;
}

.dock-progress-wrap {
  position: absolute;
  top: -5px;
  left: 0;
  right: 0;
  height: 10px;
  display: flex;
  align-items: center;
  cursor: pointer;
}

.dock-progress-range {
  width: 100%;
  height: 4px;
  appearance: none;
  -webkit-appearance: none;
  background: rgba(255, 255, 255, 0.18);
  outline: none;
  cursor: pointer;
}

.dock-progress-range::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 13px;
  height: 13px;
  border-radius: 50%;
  background: var(--accent-primary);
  box-shadow: 0 0 10px var(--accent-primary);
  cursor: pointer;
}

.dock-main-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: center;
  gap: 12px;
  width: 100%;
}

.dock-track-left {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  cursor: pointer;
}

.dock-thumb {
  width: 46px;
  height: 46px;
  border-radius: 10px;
  object-fit: cover;
  border: 1px solid var(--border-bright);
  flex-shrink: 0;
}

.dock-track-text {
  min-width: 0;
  flex: 1;
}

.dock-title {
  font-size: 0.86rem;
  font-weight: 700;
  color: #fff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.dock-artist {
  font-size: 0.72rem;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.dock-controls-center {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.ctrl-btn {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  font-size: 1rem;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.ctrl-btn:hover,
.ctrl-btn.active {
  color: #fff;
  background: rgba(255, 255, 255, 0.08);
}

.ctrl-btn-play {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: var(--accent-gradient);
  color: #fff;
  border: none;
  font-size: 1.05rem;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 6px 18px rgba(255, 0, 51, 0.45);
  flex-shrink: 0;
}

.dock-right-tools {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
}

.time-label {
  font-size: 0.74rem;
  color: var(--text-secondary);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.volume-slider {
  width: 80px;
  accent-color: var(--accent-primary);
  cursor: pointer;
}

/* ==========================================================================
   ADMIN CONTROL CENTER & SAVED PLAYLISTS CARDS
   ========================================================================== */
.admin-panel-section {
  display: none;
  width: 100%;
}

.admin-panel-section.active {
  display: block;
}

.admin-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 280px), 1fr));
  gap: 16px;
  margin-bottom: 24px;
  width: 100%;
}

.admin-card {
  background: rgba(20, 20, 32, 0.85);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 18px;
  padding: 16px;
  min-width: 0;
  max-width: 100%;
  overflow: hidden;
}

.admin-card-title {
  font-size: 0.98rem;
  font-weight: 800;
  margin-bottom: 6px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.admin-card-sub {
  font-size: 0.78rem;
  color: var(--text-secondary);
  margin-bottom: 14px;
  line-height: 1.4;
}

.inline-form-row {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}

.inline-form-row .form-input {
  flex: 1;
  min-width: 120px;
  padding: 10px 12px;
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid var(--border-bright);
  color: #fff;
  font-weight: 600;
  font-size: 0.78rem;
  padding: 8px 12px;
  border-radius: 10px;
  cursor: pointer;
  white-space: nowrap;
}

.btn-secondary:hover,
.btn-secondary.active {
  background: var(--accent-gradient);
  border-color: transparent;
}

.tag-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 0.68rem;
  font-weight: 700;
  white-space: nowrap;
}

.tag-online {
  background: rgba(0, 230, 118, 0.15);
  color: var(--success);
  border: 1px solid rgba(0, 230, 118, 0.4);
}

.tag-offline {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-secondary);
  border: 1px solid var(--border-subtle);
}

.tag-kicked {
  background: rgba(255, 23, 68, 0.15);
  color: #ff6b88;
  border: 1px solid rgba(255, 23, 68, 0.4);
}

.user-session-card {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-subtle);
  border-radius: 14px;
  padding: 12px;
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  width: 100%;
  min-width: 0;
}

.user-session-meta {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
  max-width: 100%;
}

/* Admin User Session Controls — Left-Right Scrollable on Mobile! */
.user-session-controls {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: nowrap;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  touch-action: pan-x;
  max-width: 100%;
  padding-bottom: 2px;
}

.user-session-controls > * {
  flex: 0 0 auto;
}

.generated-link-box {
  background: rgba(0, 230, 118, 0.08);
  border: 1px solid rgba(0, 230, 118, 0.35);
  border-radius: 12px;
  padding: 12px;
  margin-top: 10px;
  word-break: break-all;
  font-size: 0.78rem;
  color: #d0f8e4;
  display: none;
}

.generated-link-box.visible {
  display: block;
}

/* ==========================================================================
   MOBILE BOTTOM NAVIGATION & SMALL SCREEN CONTAINMENT
   ========================================================================== */
.mobile-bottom-nav {
  display: none;
}

@media (max-width: 980px) {
  .app-shell {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: auto minmax(0, 1fr);
  }

  .sidebar {
    display: none;
  }

  /* Three-tier mobile header: Row 1 = Brand & User/Logout, Row 2 = Search, Row 3 = Scrollable Action Pills */
  .top-header {
    flex-wrap: wrap;
    padding: 8px 10px;
    gap: 8px;
    height: auto;
  }

  .brand-cluster {
    order: 1;
    flex: 1 1 auto;
    min-width: 0;
  }

  .header-user-controls {
    order: 2;
    display: flex;
    align-items: center;
    gap: 6px;
    flex: 0 0 auto;
    margin-left: auto;
  }

  .search-container {
    order: 3;
    flex: 1 1 100%;
    max-width: 100%;
    width: 100%;
  }

  .header-actions {
    order: 4;
    flex: 1 1 100%;
    width: 100%;
    max-width: 100%;
    justify-content: flex-start;
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    touch-action: pan-x;
    scrollbar-width: none;
    padding-bottom: 2px;
    gap: 6px;
  }

  .user-chip span#userDisplayName,
  .bg-play-badge span.bg-label-text {
    display: none;
  }

  .main-workspace,
  .main-workspace.video-stage-expanded {
    grid-template-columns: minmax(0, 1fr);
  }

  .player-stage-column {
    position: fixed;
    inset: 0;
    z-index: 120;
    background: #07070c;
    transform: translateY(105%);
    transition: transform 0.32s cubic-bezier(0.22, 1, 0.36, 1);
    padding: 12px 12px 90px;
    width: 100vw;
    max-width: 100vw;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }

  .player-stage-column.mobile-open {
    transform: translateY(0);
  }

  /* Compact responsive visual stage on mobile so queue controls are always visible without clipping */
  .visual-stage-box {
    max-height: 220px;
    margin-bottom: 8px;
  }

  .now-playing-info {
    margin-bottom: 8px;
  }

  .queue-header {
    margin: 8px 0 8px;
    padding: 8px 10px;
    gap: 8px;
  }

  .stage-close-mobile {
    display: inline-flex;
  }

  .player-dock {
    bottom: var(--nav-height-mobile);
    height: 68px;
    padding: 0 10px;
  }

  .dock-right-tools {
    display: none;
  }

  .dock-main-row {
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 8px;
  }

  /* Hide shuffle & repeat in compact mobile mini-dock (still accessible inside full drawer) so dock never overflows! */
  #shuffleBtn,
  #repeatBtn {
    display: none;
  }

  /* Mobile Bottom Navigation — Smooth Left-Right Scrollable if buttons exceed narrow screens */
  .mobile-bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    width: 100vw;
    max-width: 100vw;
    height: var(--nav-height-mobile);
    background: rgba(8, 8, 13, 0.96);
    backdrop-filter: blur(20px);
    border-top: 1px solid var(--border-subtle);
    display: flex;
    align-items: center;
    justify-content: space-around;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    touch-action: pan-x;
    z-index: 95;
    padding: 0 4px env(safe-area-inset-bottom);
  }

  .mob-nav-btn {
    flex: 0 0 auto;
    background: transparent;
    border: none;
    color: var(--text-secondary);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;
    font-size: 0.65rem;
    font-weight: 600;
    cursor: pointer;
    padding: 6px 8px;
    white-space: nowrap;
  }

  .mob-nav-btn.active {
    color: var(--accent-primary);
  }

  .feed-column {
    padding: 12px 12px 175px;
  }

  .media-carousel .media-card {
    flex: 0 0 164px;
    width: 164px;
    max-width: 164px;
  }

  .media-grid {
    grid-template-columns: repeat(auto-fill, minmax(min(100%, 140px), 1fr));
    gap: 10px;
  }

  .brand-sub {
    display: none;
  }
}

/* In-App Offline button visible when download feature is enabled */
#sdOfflineBtn { display: inline-flex; }

@keyframes sdShakeCard {
  0% { transform: translateX(0); }
  20% { transform: translateX(-7px); }
  40% { transform: translateX(7px); }
  60% { transform: translateX(-4px); }
  80% { transform: translateX(4px); }
  100% { transform: translateX(0); }
}
