/* ==========================================================================
   UwUpad Music 2.0 — Spotify-inspired Design System & Mobile One-Touch
   ========================================================================== */

:root {
  --font-body: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-display: 'Manrope', 'Inter', sans-serif;

  /* Spotify-like Dark Palette with UwUpad Signature Accent */
  --bg-base: #000000;
  --bg-elevated: #121212;
  --bg-card: #181818;
  --bg-card-hover: #282828;
  --bg-press: #333333;
  --bg-glass: rgba(18, 18, 18, 0.86);

  --accent: #e3a9c3;
  --accent-bright: #f0bfd5;
  --accent-dark: #c986a5;
  --accent-rgb: 227, 169, 195;

  --dominant-rgb: 90, 62, 78;
  --dominant-color: rgb(var(--dominant-rgb));

  --text-primary: #ffffff;
  --text-secondary: #b3b3b3;
  --text-muted: #727272;

  --border-subtle: rgba(255, 255, 255, 0.08);
  --border-strong: rgba(255, 255, 255, 0.16);
  --danger: #f15e6c;
  --success: #1ed760;

  --radius-sm: 6px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --radius-full: 9999px;

  --sidebar-left-w: 256px;
  --sidebar-right-w: 320px;
  --player-h: 88px;
  --topbar-h: 64px;
  --mobile-tabbar-h: 58px;
  --mobile-mini-h: 62px;

  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
}

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

html, body {
  height: 100%;
  background: var(--bg-base);
  color: var(--text-primary);
  font-family: var(--font-body);
  font-size: 14px;
  line-height: 1.45;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

button, input, select {
  font-family: inherit;
  color: inherit;
}

button {
  background: none;
  border: none;
  cursor: pointer;
}

a {
  color: inherit;
  text-decoration: none;
}

img {
  display: block;
  max-width: 100%;
}

.is-hidden {
  display: none !important;
}

/* Custom Scrollbar */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.18);
  border-radius: var(--radius-full);
}
::-webkit-scrollbar-thumb:hover { background: rgba(255, 255, 255, 0.34); }

/* ==========================================================================
   APP SHELL LAYOUT (Spotify 3-Column Bento)
   ========================================================================== */

.app-shell {
  display: grid;
  grid-template-columns: var(--sidebar-left-w) minmax(0, 1fr) var(--sidebar-right-w);
  grid-template-rows: minmax(0, 1fr) var(--player-h);
  grid-template-areas:
    "left main right"
    "player player player";
  gap: 8px;
  padding: 8px;
  height: 100dvh;
  width: 100%;
  background: var(--bg-base);
}

.app-shell.is-right-collapsed {
  grid-template-columns: var(--sidebar-left-w) minmax(0, 1fr) 0px;
}

.app-shell.is-right-collapsed .sidebar-right {
  opacity: 0;
  pointer-events: none;
  padding: 0;
  overflow: hidden;
}

/* Left Sidebar */
.sidebar-left {
  grid-area: left;
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-height: 0;
}

.nav-panel, .library-sidebar-panel {
  background: var(--bg-elevated);
  border-radius: var(--radius-md);
  padding: 12px;
}

.brand-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 10px 14px;
}

.brand-link {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 1.15rem;
  letter-spacing: -0.02em;
}

.brand-link img {
  width: 28px;
  height: 28px;
  border-radius: 6px;
}

.brand-badge {
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  padding: 2px 6px;
  border-radius: 4px;
  background: rgba(var(--accent-rgb), 0.16);
  color: var(--accent);
  letter-spacing: 0.05em;
}

.sidebar-nav-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.nav-item-btn {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-weight: 600;
  font-size: 0.95rem;
  transition: color 0.15s ease, background 0.15s ease;
  text-align: left;
}

.nav-item-btn i {
  width: 20px;
  text-align: center;
  font-size: 1.05rem;
}

.nav-item-btn:hover {
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.05);
}

.nav-item-btn.is-active {
  color: var(--text-primary);
  background: var(--bg-card-hover);
}

.nav-item-btn.is-active i {
  color: var(--accent);
}

.library-sidebar-panel {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.library-sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 4px 8px 10px;
  color: var(--text-secondary);
  font-weight: 700;
  font-size: 0.9rem;
}

.icon-btn {
  width: 34px;
  height: 34px;
  border-radius: var(--radius-full);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--text-secondary);
  transition: background 0.15s ease, color 0.15s ease, transform 0.15s ease;
}

.icon-btn:hover {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-primary);
}

.icon-btn:active {
  transform: scale(0.94);
}

.sidebar-playlists-scroll {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.sidebar-pl-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 8px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background 0.15s ease;
  text-align: left;
  width: 100%;
}

.sidebar-pl-item:hover {
  background: rgba(255, 255, 255, 0.06);
}

.sidebar-pl-item.is-active {
  background: var(--bg-card-hover);
}

.sidebar-pl-thumb {
  width: 42px;
  height: 42px;
  border-radius: 6px;
  object-fit: cover;
  flex-shrink: 0;
  background: var(--bg-card);
  display: flex;
  align-items: center;
  justify-content: center;
}

.sidebar-pl-thumb.is-liked {
  background: linear-gradient(135deg, #450af5, #e3a9c3);
  color: #fff;
}

.sidebar-pl-meta {
  min-width: 0;
  flex: 1;
}

.sidebar-pl-name {
  font-weight: 600;
  font-size: 0.88rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar-pl-sub {
  font-size: 0.76rem;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar-back-link {
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid var(--border-subtle);
}

/* Main Content Area */
.main-viewport {
  grid-area: main;
  background: var(--bg-elevated);
  border-radius: var(--radius-md);
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  position: relative;
  overflow: hidden;
}

.main-scroll {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  scroll-behavior: smooth;
  position: relative;
}

/* Sticky Topbar */
.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  height: var(--topbar-h);
  padding: 0 24px;
  display: flex;
  align-items: center;
  gap: 12px;
  background: rgba(18, 18, 18, 0.78);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid transparent;
  transition: background 0.2s ease, border-color 0.2s ease;
}

.topbar.is-scrolled {
  background: rgba(18, 18, 18, 0.96);
  border-bottom-color: var(--border-subtle);
}

.history-nav {
  display: flex;
  align-items: center;
  gap: 6px;
}

.history-btn {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-full);
  background: rgba(0, 0, 0, 0.55);
  color: var(--text-primary);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s ease, opacity 0.15s ease;
}

.history-btn:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.14);
}

.history-btn:disabled {
  opacity: 0.35;
  cursor: default;
}

.topbar-search {
  position: relative;
  flex: 1;
  max-width: 420px;
}

.topbar-search i.search-ico {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-secondary);
  pointer-events: none;
  font-size: 0.9rem;
}

.topbar-search input {
  width: 100%;
  height: 40px;
  padding: 0 38px 0 38px;
  border-radius: var(--radius-full);
  background: #242424;
  border: 1.5px solid transparent;
  color: var(--text-primary);
  font-size: 0.9rem;
  outline: none;
  transition: background 0.15s ease, border-color 0.15s ease;
}

.topbar-search input::placeholder {
  color: var(--text-secondary);
}

.topbar-search input:hover {
  background: #2a2a2a;
}

.topbar-search input:focus {
  background: #2a2a2a;
  border-color: var(--text-primary);
}

.search-clear-btn {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  width: 24px;
  height: 24px;
  border-radius: var(--radius-full);
  color: var(--text-secondary);
  display: none;
  align-items: center;
  justify-content: center;
}

.search-clear-btn.is-visible {
  display: inline-flex;
}

.search-clear-btn:hover {
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.1);
}

.topbar-actions {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 10px;
}

.pill-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 36px;
  padding: 0 16px;
  border-radius: var(--radius-full);
  font-weight: 700;
  font-size: 0.85rem;
  transition: transform 0.15s ease, background 0.15s ease, opacity 0.15s ease;
  white-space: nowrap;
}

.pill-btn:active {
  transform: scale(0.96);
}

.pill-btn.primary {
  background: var(--accent);
  color: #000000;
}

.pill-btn.primary:hover {
  background: var(--accent-bright);
  transform: scale(1.03);
}

.pill-btn.secondary {
  background: rgba(255, 255, 255, 0.1);
  color: var(--text-primary);
}

.pill-btn.secondary:hover {
  background: rgba(255, 255, 255, 0.18);
}

.pill-btn.ghost {
  background: transparent;
  border: 1px solid var(--border-strong);
  color: var(--text-primary);
}

.pill-btn.ghost:hover {
  border-color: var(--text-primary);
}

.user-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 3px 12px 3px 4px;
  border-radius: var(--radius-full);
  background: rgba(0, 0, 0, 0.55);
  border: 1px solid var(--border-subtle);
  font-weight: 600;
  font-size: 0.85rem;
  transition: background 0.15s ease;
}

.user-chip:hover {
  background: var(--bg-card-hover);
}

.user-chip img {
  width: 28px;
  height: 28px;
  border-radius: var(--radius-full);
  object-fit: cover;
}

/* ==========================================================================
   PAGE VIEWS & SECTIONS
   ========================================================================== */

.page-container {
  padding: 20px 24px 48px;
}

.section-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 16px;
  gap: 12px;
}

.section-title {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 1.45rem;
  letter-spacing: -0.02em;
}

.section-link {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.section-link:hover {
  color: var(--text-primary);
  text-decoration: underline;
}

.home-section-block {
  margin-bottom: 32px;
}

/* Quick Access Grid (Spotify Home Top) */
.quick-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 10px;
}

.quick-tile {
  display: flex;
  align-items: center;
  gap: 12px;
  height: 58px;
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.07);
  overflow: hidden;
  cursor: pointer;
  position: relative;
  padding-right: 12px;
  transition: background 0.18s ease;
  text-align: left;
}

.quick-tile:hover {
  background: rgba(255, 255, 255, 0.16);
}

.quick-tile-art {
  width: 58px;
  height: 58px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-card);
  font-size: 1.25rem;
}

.quick-tile-art img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.quick-tile-title {
  font-weight: 700;
  font-size: 0.92rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 1;
}

.quick-tile-play {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-full);
  background: var(--accent);
  color: #000;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transform: translateY(4px);
  transition: opacity 0.18s ease, transform 0.18s ease;
  box-shadow: 0 6px 14px rgba(0, 0, 0, 0.45);
}

.quick-tile:hover .quick-tile-play {
  opacity: 1;
  transform: translateY(0);
}

/* Cards Shelf & Grid */
.cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(175px, 1fr));
  gap: 16px;
}

.media-card {
  background: var(--bg-card);
  padding: 14px;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: background 0.2s ease, transform 0.15s ease;
  display: flex;
  flex-direction: column;
  gap: 10px;
  text-align: left;
  position: relative;
}

.media-card:hover {
  background: var(--bg-card-hover);
}

.media-card:active {
  transform: scale(0.98);
}

.media-card-cover {
  position: relative;
  width: 100%;
  aspect-ratio: 1 / 1;
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: #242424;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.45);
}

.media-card-cover.is-round {
  border-radius: var(--radius-full);
}

.media-card-cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.media-card-cover .chart-badge-icon {
  font-size: 2.4rem;
  color: #fff;
}

.card-play-fab {
  position: absolute;
  right: 8px;
  bottom: 8px;
  width: 44px;
  height: 44px;
  border-radius: var(--radius-full);
  background: var(--accent);
  color: #000;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.55);
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 0.2s var(--ease-out), transform 0.2s var(--ease-out), background 0.15s ease;
}

.media-card:hover .card-play-fab {
  opacity: 1;
  transform: translateY(0);
}

.card-play-fab:hover {
  background: var(--accent-bright);
  transform: scale(1.06) !important;
}

.media-card-title {
  font-weight: 700;
  font-size: 0.95rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.media-card-sub {
  font-size: 0.82rem;
  color: var(--text-secondary);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  min-height: 1.2em;
}

/* Genre Browse Tiles */
.genre-tiles-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(156px, 1fr));
  gap: 12px;
}

.genre-tile {
  height: 92px;
  border-radius: var(--radius-md);
  padding: 14px;
  position: relative;
  overflow: hidden;
  text-align: left;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 1.02rem;
  color: #fff;
  display: flex;
  align-items: flex-start;
  transition: transform 0.15s ease, filter 0.15s ease;
}

.genre-tile:hover {
  transform: translateY(-2px);
  filter: brightness(1.08);
}

.genre-tile::after {
  content: '';
  position: absolute;
  width: 58px;
  height: 58px;
  right: -10px;
  bottom: -10px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.18);
  transform: rotate(22deg);
}

/* ==========================================================================
   ENTITY HERO HEADER (Artist, Playlist, Chart, Favorites)
   ========================================================================== */

.entity-hero {
  position: relative;
  padding: 28px 24px 24px;
  display: flex;
  align-items: flex-end;
  gap: 24px;
  background: linear-gradient(180deg, rgba(var(--dominant-rgb), 0.72) 0%, rgba(18, 18, 18, 0.25) 100%);
  transition: background 0.5s ease;
}

.entity-cover-wrap {
  width: 196px;
  height: 196px;
  flex-shrink: 0;
  border-radius: var(--radius-md);
  overflow: hidden;
  box-shadow: 0 14px 36px rgba(0, 0, 0, 0.55);
  background: var(--bg-card);
  display: flex;
  align-items: center;
  justify-content: center;
}

.entity-cover-wrap.is-round {
  border-radius: var(--radius-full);
}

.entity-cover-wrap img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.entity-info {
  min-width: 0;
  flex: 1;
}

.entity-kicker {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 0.76rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-primary);
  margin-bottom: 6px;
}

.role-pill {
  padding: 2px 8px;
  border-radius: var(--radius-full);
  background: rgba(var(--accent-rgb), 0.22);
  color: var(--accent-bright);
  border: 1px solid rgba(var(--accent-rgb), 0.4);
  font-size: 0.68rem;
}

.entity-title {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: clamp(1.75rem, 4vw, 3.2rem);
  line-height: 1.08;
  letter-spacing: -0.03em;
  margin-bottom: 10px;
  word-break: break-word;
}

.entity-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  font-size: 0.9rem;
  color: var(--text-secondary);
}

.entity-meta strong {
  color: var(--text-primary);
}

.entity-action-bar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  padding: 18px 24px 12px;
  background: linear-gradient(180deg, rgba(var(--dominant-rgb), 0.16) 0%, transparent 100%);
}

.big-play-btn {
  width: 54px;
  height: 54px;
  border-radius: var(--radius-full);
  background: var(--accent);
  color: #000;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.35rem;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.45);
  transition: transform 0.15s ease, background 0.15s ease;
}

.big-play-btn:hover {
  background: var(--accent-bright);
  transform: scale(1.05);
}

.big-play-btn:active {
  transform: scale(0.96);
}

/* ==========================================================================
   FILTER BAR & CHIPS
   ========================================================================== */

.filter-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  padding: 8px 0 14px;
}

.chips-scroll {
  display: flex;
  align-items: center;
  gap: 8px;
  overflow-x: auto;
  scrollbar-width: none;
  padding-bottom: 2px;
}

.chips-scroll::-webkit-scrollbar { display: none; }

.chip-btn {
  height: 34px;
  padding: 0 14px;
  border-radius: var(--radius-full);
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-primary);
  font-size: 0.83rem;
  font-weight: 600;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: background 0.15s ease, color 0.15s ease;
}

.chip-btn:hover {
  background: rgba(255, 255, 255, 0.15);
}

.chip-btn.is-active {
  background: var(--text-primary);
  color: #000;
}

.filter-selects {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.filter-select {
  height: 34px;
  padding: 0 12px;
  border-radius: var(--radius-full);
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid transparent;
  color: var(--text-primary);
  font-size: 0.83rem;
  font-weight: 600;
  cursor: pointer;
  outline: none;
}

.filter-select:hover, .filter-select:focus {
  background: rgba(255, 255, 255, 0.14);
  border-color: var(--border-strong);
}

.filter-select option {
  background: #1c1c1e;
  color: #fff;
}

.filter-reset-btn {
  height: 34px;
  padding: 0 12px;
  border-radius: var(--radius-full);
  color: var(--accent);
  font-size: 0.82rem;
  font-weight: 600;
}

.filter-reset-btn:hover {
  background: rgba(var(--accent-rgb), 0.12);
}

/* ==========================================================================
   TRACK LIST (Desktop Table + Mobile One-Touch Rows)
   ========================================================================== */

.track-list-header {
  display: grid;
  grid-template-columns: 38px minmax(200px, 4fr) minmax(80px, 1.2fr) minmax(110px, 1.8fr) 76px 76px;
  gap: 12px;
  padding: 8px 12px;
  border-bottom: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  font-size: 0.76rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 6px;
}

.track-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.track-row {
  display: grid;
  grid-template-columns: 38px minmax(200px, 4fr) minmax(80px, 1.2fr) minmax(110px, 1.8fr) 76px 76px;
  gap: 12px;
  align-items: center;
  padding: 7px 12px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background 0.14s ease;
  content-visibility: auto;
  contain-intrinsic-size: 56px;
}

.track-row.is-compact {
  grid-template-columns: 38px minmax(0, 1fr) 76px;
}

.track-row:hover {
  background: rgba(255, 255, 255, 0.08);
}

.track-row.is-playing {
  background: rgba(var(--accent-rgb), 0.12);
}

.track-row.is-playing .track-row-title {
  color: var(--accent);
}

.track-col-index {
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-secondary);
  font-size: 0.9rem;
  font-variant-numeric: tabular-nums;
}

.track-row .row-play-ico { display: none; color: var(--text-primary); }
.track-row:hover .row-idx-num { display: none; }
.track-row:hover .row-play-ico { display: inline-block; }
.track-row.is-playing .row-idx-num { display: none; }
.track-row.is-playing .row-play-ico { display: inline-block; color: var(--accent); }

.track-col-main {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.track-thumb {
  width: 42px;
  height: 42px;
  border-radius: 4px;
  object-fit: cover;
  flex-shrink: 0;
  background: var(--bg-card);
}

.track-title-stack {
  min-width: 0;
  flex: 1;
}

.track-row-title {
  font-weight: 600;
  font-size: 0.94rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  display: flex;
  align-items: center;
  gap: 6px;
}

.explicit-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 15px;
  height: 15px;
  border-radius: 2px;
  background: rgba(255, 255, 255, 0.25);
  color: #000;
  font-size: 0.62rem;
  font-weight: 800;
  flex-shrink: 0;
}

.track-row-artist {
  font-size: 0.82rem;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  display: inline-block;
  max-width: 100%;
}

.artist-link {
  cursor: pointer;
  transition: color 0.12s ease;
}

.artist-link:hover {
  color: var(--text-primary);
  text-decoration: underline;
}

.track-col-views,
.track-col-tags,
.track-col-dur {
  color: var(--text-secondary);
  font-size: 0.84rem;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.track-col-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 4px;
}

.row-action-btn {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-full);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--text-secondary);
  opacity: 0.72;
  transition: opacity 0.14s ease, color 0.14s ease, background 0.14s ease;
}

.row-action-btn i,
.row-action-btn svg {
  pointer-events: none;
}

.track-row:hover .row-action-btn,
.row-action-btn.is-liked {
  opacity: 1;
}

.row-action-btn:hover {
  background: rgba(255, 255, 255, 0.12);
  color: var(--text-primary);
}

.row-action-btn.is-liked {
  color: var(--accent);
}

/* ==========================================================================
   SEARCH VIEW (Top Result + Tracks + Artists + Playlists)
   ========================================================================== */

.search-top-grid {
  display: grid;
  grid-template-columns: minmax(260px, 1.15fr) minmax(0, 1.85fr);
  gap: 20px;
  margin-bottom: 28px;
}

.top-result-card {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  padding: 20px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 14px;
  cursor: pointer;
  position: relative;
  transition: background 0.2s ease;
  min-height: 210px;
}

.top-result-card:hover {
  background: var(--bg-card-hover);
}

.top-result-cover {
  width: 96px;
  height: 96px;
  border-radius: var(--radius-md);
  object-fit: cover;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
}

.top-result-cover.is-round {
  border-radius: var(--radius-full);
}

.top-result-name {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 1.6rem;
  line-height: 1.15;
}

.top-result-sub {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text-secondary);
  font-size: 0.88rem;
}

.kind-pill {
  padding: 2px 10px;
  border-radius: var(--radius-full);
  background: rgba(255, 255, 255, 0.12);
  color: var(--text-primary);
  font-weight: 700;
  font-size: 0.74rem;
  text-transform: uppercase;
}

.top-result-fab {
  position: absolute;
  right: 20px;
  bottom: 20px;
  width: 48px;
  height: 48px;
  border-radius: var(--radius-full);
  background: var(--accent);
  color: #000;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.55);
}

/* Artist About Card */
.artist-about-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 16px;
  margin-top: 20px;
}

.about-card {
  background: var(--bg-card);
  border-radius: var(--radius-md);
  padding: 18px;
  border: 1px solid var(--border-subtle);
}

.about-card h4 {
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-secondary);
  margin-bottom: 10px;
}

.genre-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.genre-pill {
  padding: 5px 12px;
  border-radius: var(--radius-full);
  background: rgba(var(--accent-rgb), 0.14);
  color: var(--accent-bright);
  font-size: 0.82rem;
  font-weight: 600;
}

/* ==========================================================================
   RIGHT SIDEBAR (NOW PLAYING & QUEUE)
   ========================================================================== */

.sidebar-right {
  grid-area: right;
  background: var(--bg-elevated);
  border-radius: var(--radius-md);
  padding: 16px;
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow-y: auto;
  background-image: linear-gradient(180deg, rgba(var(--dominant-rgb), 0.25) 0%, transparent 280px);
  transition: opacity 0.2s ease;
}

.np-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}

.np-header h3 {
  font-weight: 700;
  font-size: 0.95rem;
}

.np-cover {
  width: 100%;
  aspect-ratio: 1 / 1;
  border-radius: var(--radius-md);
  object-fit: cover;
  background: var(--bg-card);
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.5);
  margin-bottom: 14px;
}

.np-title-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.np-track-title {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 1.15rem;
  line-height: 1.25;
  cursor: pointer;
}

.np-track-title:hover { text-decoration: underline; }

.np-track-artist {
  color: var(--text-secondary);
  font-size: 0.9rem;
  margin-top: 2px;
  display: inline-block;
}

.np-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 12px 0 18px;
}

.np-tag {
  padding: 3px 9px;
  border-radius: var(--radius-full);
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-secondary);
  font-size: 0.74rem;
  font-weight: 600;
  cursor: pointer;
}

.np-tag:hover {
  background: rgba(255, 255, 255, 0.16);
  color: var(--text-primary);
}

.queue-box {
  background: var(--bg-card);
  border-radius: var(--radius-md);
  padding: 12px;
}

.queue-box-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
  font-weight: 700;
  font-size: 0.85rem;
}

.queue-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.queue-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px;
  border-radius: var(--radius-sm);
  cursor: pointer;
}

.queue-item:hover { background: rgba(255, 255, 255, 0.08); }

.queue-item img {
  width: 38px;
  height: 38px;
  border-radius: 4px;
  object-fit: cover;
  flex-shrink: 0;
}

.queue-item-meta { min-width: 0; flex: 1; }
.queue-item-title {
  font-weight: 600;
  font-size: 0.84rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.queue-item-artist {
  font-size: 0.75rem;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ==========================================================================
   DESKTOP STICKY PLAYER
   ========================================================================== */

.sticky-player {
  grid-area: player;
  background: var(--bg-base);
  display: grid;
  grid-template-columns: minmax(220px, 1fr) minmax(300px, 1.4fr) minmax(210px, 1fr);
  align-items: center;
  gap: 16px;
  padding: 0 18px;
  position: relative;
  min-width: 0;
  max-width: 100%;
}

.player-left {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.player-cover {
  width: 56px;
  height: 56px;
  border-radius: 6px;
  object-fit: cover;
  background: var(--bg-card);
  flex-shrink: 0;
  cursor: pointer;
}

.player-meta {
  min-width: 0;
  flex: 0 1 auto;
  max-width: 100%;
}

#player-like-btn {
  flex-shrink: 0;
}

.player-title {
  font-weight: 600;
  font-size: 0.9rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  cursor: pointer;
}

.player-title:hover { text-decoration: underline; }

.player-artist {
  font-size: 0.78rem;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  display: inline-block;
  max-width: 100%;
}

.player-center {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  min-width: 0;
}

.player-buttons {
  display: flex;
  align-items: center;
  gap: 16px;
}

.ctrl-btn {
  width: 34px;
  height: 34px;
  border-radius: var(--radius-full);
  color: var(--text-secondary);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  transition: color 0.14s ease, transform 0.12s ease;
  position: relative;
  flex-shrink: 0;
}

.ctrl-btn:hover { color: var(--text-primary); }
.ctrl-btn:active { transform: scale(0.92); }
.ctrl-btn.is-active { color: var(--accent); }
.ctrl-btn.is-active::after {
  content: '';
  position: absolute;
  bottom: 2px;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--accent);
}

.play-main-btn {
  width: 38px;
  height: 38px;
  border-radius: var(--radius-full);
  background: var(--text-primary);
  color: #000;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.95rem;
  transition: transform 0.14s ease, background 0.14s ease;
}

.play-main-btn:hover { transform: scale(1.06); }
.play-main-btn:active { transform: scale(0.95); }
.play-main-btn.is-loading { opacity: 0.65; }

.timeline-row {
  width: 100%;
  max-width: 540px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.time-label {
  font-size: 0.72rem;
  color: var(--text-secondary);
  font-variant-numeric: tabular-nums;
  min-width: 34px;
  text-align: center;
}

.seek-bar-wrap {
  flex: 1;
  height: 18px;
  display: flex;
  align-items: center;
  cursor: pointer;
  touch-action: none;
}

.seek-track {
  width: 100%;
  height: 4px;
  border-radius: var(--radius-full);
  background: rgba(255, 255, 255, 0.2);
  position: relative;
  overflow: visible;
}

.seek-bar-wrap:hover .seek-track { height: 6px; }

.seek-fill {
  height: 100%;
  width: 0%;
  border-radius: var(--radius-full);
  background: var(--text-primary);
  position: relative;
}

.seek-bar-wrap:hover .seek-fill { background: var(--accent); }

.seek-thumb {
  position: absolute;
  right: -6px;
  top: 50%;
  transform: translateY(-50%) scale(0);
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #fff;
  transition: transform 0.12s ease;
}

.seek-bar-wrap:hover .seek-thumb,
.seek-bar-wrap.is-seeking .seek-thumb {
  transform: translateY(-50%) scale(1);
}

.player-right {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
  min-width: 0;
  max-width: 100%;
  overflow: hidden;
}

.volume-wrap {
  display: flex;
  align-items: center;
  gap: 6px;
  width: 136px;
  flex: 0 1 136px;
  min-width: 0;
}

.volume-slider {
  -webkit-appearance: none;
  appearance: none;
  flex: 1;
  width: 100%;
  min-width: 0;
  margin: 0;
  height: 4px;
  border-radius: var(--radius-full);
  background: linear-gradient(90deg, var(--text-primary) var(--vol-pct, 100%), rgba(255,255,255,0.2) var(--vol-pct, 100%));
  outline: none;
  cursor: pointer;
}

.volume-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #fff;
}

/* ==========================================================================
   FULLSCREEN PLAYER (Desktop & Mobile Swipe-Down)
   ========================================================================== */

.fullscreen-player {
  position: fixed;
  inset: 0;
  z-index: 120;
  background: #0a0a0c;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: max(20px, env(safe-area-inset-top)) 24px max(28px, env(safe-area-inset-bottom));
  opacity: 0;
  visibility: hidden;
  transform: translateY(28px);
  transition: opacity 0.28s var(--ease-out), transform 0.28s var(--ease-out), visibility 0.28s;
  overflow: hidden;
}

.fullscreen-player.is-visible {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.fullscreen-bg {
  position: absolute;
  inset: -40px;
  background-size: cover;
  background-position: center;
  filter: blur(60px) saturate(1.4) brightness(0.42);
  z-index: -1;
  transition: transform 0.08s linear;
  will-change: transform;
}

.fs-top-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  z-index: 2;
}

.fs-handle {
  width: 38px;
  height: 4px;
  border-radius: 2px;
  background: rgba(255, 255, 255, 0.35);
  margin: 0 auto;
  display: none;
}

.fs-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 22px;
  max-width: 520px;
  width: 100%;
  margin: 0 auto;
  z-index: 2;
}

.fs-cover-stage {
  width: min(360px, 76vw);
  aspect-ratio: 1 / 1;
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.65);
  touch-action: pan-y;
}

.fs-cover-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  will-change: transform;
}

.fs-meta-row {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.fs-title {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: clamp(1.35rem, 3vw, 1.85rem);
  line-height: 1.2;
}

.fs-artist {
  color: var(--text-secondary);
  font-size: 1rem;
  margin-top: 4px;
  display: inline-block;
}

.fs-controls-box {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.fs-buttons {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 8px;
}

.fs-play-btn {
  width: 64px;
  height: 64px;
  border-radius: var(--radius-full);
  background: #fff;
  color: #000;
  font-size: 1.45rem;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.45);
}

.fs-extra-actions {
  display: flex;
  align-items: center;
  justify-content: space-around;
  width: 100%;
  padding-top: 4px;
}

/* ==========================================================================
   MOBILE ONE-TOUCH MODE (< 768px)
   ========================================================================== */

.mobile-mini-player,
.mobile-tabbar {
  display: none;
}

@media (max-width: 1023px) {
  .app-shell {
    grid-template-columns: 220px minmax(0, 1fr);
    grid-template-areas:
      "left main"
      "player player";
  }
  .sidebar-right {
    display: none;
  }
}

@media (max-width: 767px) {
  .app-shell {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: minmax(0, 1fr);
    grid-template-areas: "main";
    padding: 0;
    gap: 0;
  }

  .sidebar-left,
  .sticky-player,
  .history-nav {
    display: none !important;
  }

  .main-viewport {
    border-radius: 0;
  }

  .main-scroll {
    padding-bottom: calc(var(--mobile-tabbar-h) + var(--mobile-mini-h) + env(safe-area-inset-bottom) + 18px);
  }

  .topbar {
    padding: 0 12px;
    height: 56px;
  }

  .topbar-actions .pill-btn span {
    display: none;
  }

  .page-container {
    padding: 14px 14px 28px;
  }

  .entity-hero {
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 20px 16px 16px;
    gap: 14px;
  }

  .entity-cover-wrap {
    width: 164px;
    height: 164px;
  }

  .entity-meta {
    justify-content: center;
  }

  .entity-action-bar {
    padding: 12px 16px;
    justify-content: center;
  }

  .quick-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
  }

  .quick-tile {
    height: 52px;
  }

  .quick-tile-art {
    width: 52px;
    height: 52px;
  }

  .quick-tile-play {
    display: none;
  }

  .cards-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
  }

  .search-top-grid {
    grid-template-columns: 1fr;
  }

  .track-list-header {
    display: none;
  }

  .track-row,
  .track-row.is-compact {
    grid-template-columns: minmax(0, 1fr) auto;
    padding: 8px 6px;
    gap: 8px;
    min-height: 58px;
  }

  .track-col-index,
  .track-col-views,
  .track-col-tags,
  .track-col-dur {
    display: none;
  }

  .track-thumb {
    width: 48px;
    height: 48px;
  }

  .row-action-btn {
    width: 42px;
    height: 42px;
    opacity: 1;
  }

  /* Floating Swipeable Mini-Player */
  .mobile-mini-player {
    display: flex;
    flex-direction: column;
    position: fixed;
    left: 8px;
    right: 8px;
    bottom: calc(var(--mobile-tabbar-h) + env(safe-area-inset-bottom) + 6px);
    height: var(--mobile-mini-h);
    border-radius: 10px;
    background: linear-gradient(90deg, rgba(var(--dominant-rgb), 0.92), rgba(28, 28, 32, 0.96));
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.55);
    z-index: 80;
    overflow: hidden;
    touch-action: pan-y;
    border: 1px solid rgba(255, 255, 255, 0.1);
  }

  .mobile-mini-player.is-empty {
    display: none;
  }

  .mini-inner {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 0 8px 0 8px;
    will-change: transform;
  }

  .mini-cover {
    width: 44px;
    height: 44px;
    border-radius: 6px;
    object-fit: cover;
    flex-shrink: 0;
  }

  .mini-meta {
    min-width: 0;
    flex: 1;
  }

  .mini-title {
    font-weight: 700;
    font-size: 0.88rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .mini-artist {
    font-size: 0.76rem;
    color: rgba(255, 255, 255, 0.76);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .mini-btn {
    width: 44px;
    height: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    color: #fff;
    flex-shrink: 0;
  }

  .mini-btn.is-liked {
    color: var(--accent);
  }

  .mini-progress-track {
    height: 2px;
    width: 100%;
    background: rgba(255, 255, 255, 0.18);
  }

  .mini-progress-fill {
    height: 100%;
    width: 0%;
    background: #fff;
  }

  /* Bottom Tab Bar */
  .mobile-tabbar {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    height: calc(var(--mobile-tabbar-h) + env(safe-area-inset-bottom));
    padding-bottom: env(safe-area-inset-bottom);
    background: linear-gradient(180deg, rgba(12, 12, 12, 0.92) 0%, #000 100%);
    backdrop-filter: blur(20px);
    border-top: 1px solid var(--border-subtle);
    z-index: 85;
  }

  .tabbar-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    color: var(--text-secondary);
    font-size: 0.68rem;
    font-weight: 600;
  }

  .tabbar-item i {
    font-size: 1.15rem;
  }

  .tabbar-item.is-active {
    color: var(--text-primary);
  }

  .tabbar-item.is-active i {
    color: var(--accent);
  }

  .fs-handle {
    display: block;
  }

  /* Prevent accidental artist profile navigation when tapping track rows on mobile;
     artist profile stays accessible via Fullscreen Player Tap on artist name */
  .track-row .artist-link,
  .top-result-card .artist-link,
  .entity-meta .artist-link,
  .player-artist,
  .np-track-artist {
    pointer-events: none;
  }

  .track-row .artist-link:hover,
  .top-result-card .artist-link:hover {
    text-decoration: none;
  }

  .fs-artist.artist-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 0;
  }

  .fs-artist.artist-link::after {
    content: '';
    display: inline-block;
    width: 6px;
    height: 6px;
    border-top: 1.6px solid currentColor;
    border-right: 1.6px solid currentColor;
    transform: rotate(45deg);
    opacity: 0.72;
    margin-left: 1px;
  }
}

/* ==========================================================================
   CONTEXT MENU / MOBILE BOTTOM SHEET / MODALS / TOASTS
   ========================================================================== */

.context-menu {
  position: fixed;
  z-index: 250;
  min-width: 220px;
  max-height: calc(100dvh - 20px);
  overflow-y: auto;
  background: #282828;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-md);
  padding: 6px;
  box-shadow: 0 16px 36px rgba(0, 0, 0, 0.65);
  display: none;
}

.context-menu.is-visible {
  display: block;
}

.menu-item-btn {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 4px;
  font-size: 0.88rem;
  font-weight: 500;
  text-align: left;
  color: var(--text-primary);
}

.menu-item-btn:hover {
  background: rgba(255, 255, 255, 0.1);
}

.menu-item-btn i {
  width: 18px;
  text-align: center;
  color: var(--text-secondary);
}

.menu-item-btn.is-danger {
  color: var(--danger);
}

.sheet-backdrop {
  position: fixed;
  inset: 0;
  z-index: 210;
  background: rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.2s ease, visibility 0.2s ease;
}

.sheet-backdrop.is-visible {
  opacity: 1;
  visibility: visible;
}

.bottom-sheet {
  width: 100%;
  max-width: 520px;
  max-height: 78dvh;
  background: #1f1f22;
  border-radius: 18px 18px 0 0;
  padding: 10px 16px calc(18px + env(safe-area-inset-bottom));
  transform: translateY(100%);
  transition: transform 0.26s var(--ease-out);
  overflow-y: auto;
}

.sheet-backdrop.is-visible .bottom-sheet {
  transform: translateY(0);
}

.sheet-grab {
  width: 40px;
  height: 4px;
  border-radius: 2px;
  background: rgba(255, 255, 255, 0.3);
  margin: 0 auto 14px;
}

.sheet-track-head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding-bottom: 14px;
  margin-bottom: 8px;
  border-bottom: 1px solid var(--border-subtle);
}

.sheet-track-head img {
  width: 48px;
  height: 48px;
  border-radius: 6px;
  object-fit: cover;
}

.sheet-action-btn {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 14px;
  min-height: 48px;
  padding: 10px 8px;
  border-radius: var(--radius-sm);
  font-size: 0.98rem;
  font-weight: 500;
  text-align: left;
}

.sheet-action-btn:active {
  background: rgba(255, 255, 255, 0.08);
}

.sheet-action-btn i {
  width: 22px;
  text-align: center;
  color: var(--text-secondary);
  font-size: 1.05rem;
}

/* Modal */
.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 230;
  background: rgba(0, 0, 0, 0.72);
  backdrop-filter: blur(6px);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.modal-overlay.is-visible {
  display: flex;
}

.modal-box {
  width: 100%;
  max-width: 420px;
  background: #242428;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg);
  padding: 22px;
  position: relative;
  box-shadow: 0 24px 48px rgba(0, 0, 0, 0.65);
}

.modal-close {
  position: absolute;
  right: 12px;
  top: 12px;
  width: 32px;
  height: 32px;
  border-radius: var(--radius-full);
  color: var(--text-secondary);
  font-size: 1.25rem;
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal-close:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
}

.modal-title {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 1.2rem;
  margin-bottom: 12px;
}

.modal-input {
  width: 100%;
  height: 42px;
  padding: 0 14px;
  border-radius: var(--radius-sm);
  background: #141416;
  border: 1px solid var(--border-strong);
  color: #fff;
  font-size: 0.95rem;
  outline: none;
  margin-bottom: 14px;
}

.modal-input:focus {
  border-color: var(--accent);
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

.pl-pick-list {
  list-style: none;
  max-height: 260px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 12px;
}

.pl-pick-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px;
  border-radius: var(--radius-sm);
  cursor: pointer;
}

.pl-pick-item:hover {
  background: rgba(255, 255, 255, 0.08);
}

.pl-pick-item img {
  width: 40px;
  height: 40px;
  border-radius: 4px;
  object-fit: cover;
}

/* Toasts */
.toast-stack {
  position: fixed;
  right: 20px;
  bottom: calc(var(--player-h) + 16px);
  z-index: 260;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}

@media (max-width: 767px) {
  .toast-stack {
    right: 12px;
    left: 12px;
    bottom: calc(var(--mobile-tabbar-h) + var(--mobile-mini-h) + env(safe-area-inset-bottom) + 14px);
    align-items: center;
  }
}

.toast-pill {
  background: #2b2b30;
  color: #fff;
  border: 1px solid var(--border-strong);
  padding: 10px 16px;
  border-radius: var(--radius-md);
  font-size: 0.88rem;
  font-weight: 600;
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.55);
  pointer-events: auto;
  animation: toastIn 0.2s var(--ease-out);
}

.toast-pill.is-error {
  border-color: rgba(241, 94, 108, 0.55);
  background: #361b20;
}

.dl-toast {
  width: 280px;
  background: #232327;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-md);
  padding: 12px;
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.55);
}

.dl-bar {
  height: 4px;
  background: rgba(255, 255, 255, 0.14);
  border-radius: 4px;
  overflow: hidden;
  margin-top: 8px;
}

.dl-fill {
  height: 100%;
  width: 0%;
  background: var(--accent);
  transition: width 0.12s linear;
}

@keyframes toastIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Skeletons & Empty State */
.skeleton {
  background: linear-gradient(90deg, rgba(255,255,255,0.06) 25%, rgba(255,255,255,0.12) 50%, rgba(255,255,255,0.06) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.2s infinite;
  border-radius: var(--radius-sm);
}

.skeleton-row {
  height: 52px;
  margin-bottom: 6px;
}

@keyframes shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

.empty-state {
  padding: 48px 16px;
  text-align: center;
  color: var(--text-secondary);
}

.empty-state i {
  font-size: 2.2rem;
  margin-bottom: 12px;
  opacity: 0.55;
}

.empty-state h3 {
  color: var(--text-primary);
  margin-bottom: 6px;
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}

/* ==========================================================================
   SPA UPLOAD VIEW
   ========================================================================== */

.upload-shell {
  max-width: 920px;
  margin: 0 auto;
}

.upload-hero-head {
  margin-bottom: 20px;
}

.upload-bento-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 24px;
  display: grid;
  grid-template-columns: 240px minmax(0, 1fr);
  gap: 26px;
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.35);
}

.upload-cover-col {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.upload-cover-drop {
  aspect-ratio: 1 / 1;
  width: 100%;
  border-radius: var(--radius-md);
  border: 2px dashed var(--border-strong);
  background: rgba(255, 255, 255, 0.03);
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  cursor: pointer;
  overflow: hidden;
  transition: border-color 0.16s ease, background 0.16s ease, transform 0.16s ease;
}

.upload-cover-drop:hover,
.upload-cover-drop.is-drag {
  border-color: var(--accent);
  background: rgba(var(--accent-rgb), 0.08);
}

.upload-cover-drop.has-image {
  border-style: solid;
  border-color: var(--border-strong);
}

.upload-cover-prompt {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 16px;
  color: var(--text-secondary);
  transition: opacity 0.16s ease;
}

.upload-cover-prompt i {
  font-size: 2.3rem;
  color: var(--accent);
  margin-bottom: 4px;
}

.upload-cover-prompt strong {
  color: var(--text-primary);
  font-size: 0.92rem;
}

.upload-cover-prompt span {
  font-size: 0.82rem;
}

.upload-cover-prompt small {
  margin-top: 6px;
  font-size: 0.72rem;
  color: var(--text-muted);
}

.upload-cover-drop.has-image .upload-cover-prompt {
  opacity: 0;
}

.upload-cover-preview {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0;
  transition: opacity 0.2s ease;
}

.upload-cover-drop.has-image .upload-cover-preview {
  opacity: 1;
}

.upload-cover-remove {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 30px;
  height: 30px;
  border-radius: var(--radius-full);
  background: rgba(0, 0, 0, 0.72);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.16s ease, background 0.16s ease;
}

.upload-cover-drop.has-image:hover .upload-cover-remove,
.upload-cover-drop.has-image .upload-cover-remove:focus-visible {
  opacity: 1;
  pointer-events: auto;
}

.upload-cover-remove:hover {
  background: var(--danger);
}

.upload-hint-center {
  font-size: 0.75rem;
  color: var(--text-muted);
  text-align: center;
  line-height: 1.35;
}

.upload-fields-col {
  display: flex;
  flex-direction: column;
  gap: 16px;
  min-width: 0;
}

.upload-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.upload-label-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.upload-label {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.upload-counter,
.upload-hint {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.upload-input {
  width: 100%;
  height: 42px;
  padding: 0 14px;
  background: #121214;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-size: 0.94rem;
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.upload-input::placeholder {
  color: var(--text-muted);
}

.upload-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(var(--accent-rgb), 0.16);
}

.upload-genre-wrap {
  position: relative;
}

.upload-genre-caret {
  position: absolute;
  right: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-secondary);
  font-size: 0.78rem;
  pointer-events: none;
  transition: transform 0.16s ease;
}

.upload-genre-wrap.is-open .upload-genre-caret {
  transform: translateY(-50%) rotate(180deg);
}

.upload-genre-dropdown {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  max-height: 240px;
  overflow-y: auto;
  background: #232327;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-md);
  padding: 6px;
  z-index: 40;
  box-shadow: 0 16px 32px rgba(0, 0, 0, 0.6);
  display: none;
}

.upload-genre-wrap.is-open .upload-genre-dropdown {
  display: block;
}

.upload-genre-opt {
  width: 100%;
  text-align: left;
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text-primary);
}

.upload-genre-opt:hover {
  background: rgba(255, 255, 255, 0.1);
}

.upload-tags-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.upload-tag-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: var(--radius-full);
  background: rgba(var(--accent-rgb), 0.16);
  border: 1px solid rgba(var(--accent-rgb), 0.35);
  color: var(--accent-bright);
  font-size: 0.82rem;
  font-weight: 600;
}

.upload-tag-pill button {
  color: var(--accent-bright);
  font-size: 1rem;
  line-height: 1;
  opacity: 0.8;
}

.upload-tag-pill button:hover {
  opacity: 1;
}

.upload-audio-drop {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 16px;
  border-radius: var(--radius-md);
  border: 1.5px dashed var(--border-strong);
  background: #121214;
  cursor: pointer;
  transition: border-color 0.16s ease, background 0.16s ease;
}

.upload-audio-drop:hover,
.upload-audio-drop.is-drag {
  border-color: var(--accent);
  background: rgba(var(--accent-rgb), 0.08);
}

.upload-audio-drop.has-file {
  border-style: solid;
  border-color: rgba(30, 215, 96, 0.55);
  background: rgba(30, 215, 96, 0.08);
}

.upload-audio-drop i {
  font-size: 1.4rem;
  color: var(--accent);
  flex-shrink: 0;
}

.upload-audio-drop.has-file i {
  color: var(--success);
}

.upload-audio-text {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.upload-audio-text strong {
  font-size: 0.9rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.upload-audio-text small {
  font-size: 0.76rem;
  color: var(--text-secondary);
}

.upload-footer-bar {
  grid-column: 1 / -1;
  padding-top: 18px;
  border-top: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.upload-terms-label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--text-secondary);
  font-size: 0.86rem;
  cursor: pointer;
}

.upload-terms-label input {
  accent-color: var(--accent);
  width: 16px;
  height: 16px;
}

.upload-terms-label a {
  color: var(--text-primary);
  text-decoration: underline;
}

.upload-submit-btn {
  min-width: 148px;
  justify-content: center;
  position: relative;
}

.upload-submit-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  transform: none !important;
}

.upload-submit-btn.is-loading {
  color: transparent !important;
  pointer-events: none;
}

.upload-submit-btn.is-loading::after {
  content: '';
  position: absolute;
  width: 18px;
  height: 18px;
  border: 2.5px solid #000;
  border-right-color: transparent;
  border-radius: 50%;
  animation: uwuSpin 0.7s linear infinite;
}

@keyframes uwuSpin {
  to { transform: rotate(360deg); }
}

@media (max-width: 767px) {
  .upload-bento-card {
    grid-template-columns: 1fr;
    padding: 18px;
    gap: 18px;
  }

  .upload-cover-col {
    max-width: 210px;
    margin: 0 auto;
    width: 100%;
  }

  .upload-footer-bar {
    flex-direction: column;
    align-items: stretch;
  }

  .upload-submit-btn {
    width: 100%;
  }
}

