/* NOTE: global layout/typography tokens are now defined in `Spotify_base.css`.
 * Public view only adds its own safety rules and layout skin here. */

/* ===== Public view safety: hide all playback controls/buttons ===== */
/* Ensure the public page never shows any transport, volume, transfer, or add-to-queue controls */
.spotify-root.public-view .owner-only,
.spotify-root.public-view [data-owner-required],
.spotify-root.public-view #sp-mini-player,
.spotify-root.public-view #sp-expanded,
.spotify-root.public-view .btn-transport,
.spotify-root.public-view [data-act="playnow"],
.spotify-root.public-view [data-act="addq"],
.spotify-root.public-view [data-act="playctx"],
.spotify-root.public-view #sp-volume,
.spotify-root.public-view #sp-ios-bgctl,
.spotify-root.public-view #sp-use-web-player,
.spotify-root.public-view .reload-btn,
.spotify-root.public-view #sp-refresh-all,
.spotify-root.public-view #sp-retry-btn,
.spotify-root[data-is-owner="0"] .owner-only,
.spotify-root[data-is-owner="0"] [data-owner-required],
.spotify-root[data-is-owner="0"] #sp-mini-player,
.spotify-root[data-is-owner="0"] #sp-expanded,
.spotify-root[data-is-owner="0"] .btn-transport,
.spotify-root[data-is-owner="0"] [data-act="playnow"],
.spotify-root[data-is-owner="0"] [data-act="addq"],
.spotify-root[data-is-owner="0"] [data-act="playctx"],
.spotify-root[data-is-owner="0"] #sp-volume,
.spotify-root[data-is-owner="0"] #sp-ios-bgctl,
.spotify-root[data-is-owner="0"] #sp-use-web-player {
	display: none !important;
}

/* ===== Public share page specific styles ===== */
.spotify-root.public-view {
	min-height: 100vh;
	padding-bottom: 0;
}

/* Public header styling */
.sp-head-public {
	background: linear-gradient(135deg, rgba(29, 185, 84, 0.2) 0%, rgba(0, 0, 0, 0.95) 60%) !important;
	border: 1px solid rgba(29, 185, 84, 0.2);
	margin: 1rem auto;
	max-width: 1100px;
}

.sp-head-public .sp-head-left {
	flex: 1;
}

.sp-head-public .label {
	display: flex;
	align-items: center;
	font-size: 0.75rem;
	letter-spacing: 1px;
}

.sp-head-public .title {
	font-size: 1.4rem;
	line-height: 1.3;
	margin-bottom: 0.3rem;
}

.sp-head-public .sp-head-actions {
	flex-shrink: 0;
}

/* Public layout - modern card grid */
.sp-layout-public {
	display: grid;
	gap: 1rem;
	grid-template-columns: 1fr;
	padding: 0 0.5rem;
	max-width: 1100px;
	margin: 0 auto;
}

/* Mobile: single column stack */
@media (max-width: 767.98px) {
	.sp-layout-public {
		gap: 0.8rem;
	}
	
	.sp-layout-public .sp-panel {
		border-radius: 14px;
	}
	
	.sp-layout-public .sp-panel-body {
		padding: 0.8rem;
		max-height: 280px;
		overflow-y: auto;
	}
	
	/* Player 區塊更大更突出 */
	.sp-layout-public #sec-player {
		min-height: 200px;
	}
	
	.sp-layout-public #sec-player .sp-panel-body {
		max-height: none;
		padding: 1rem;
	}
}

/* Tablet: 2 column grid */
@media (min-width: 768px) and (max-width: 1199.98px) {
	.sp-layout-public {
		grid-template-columns: repeat(2, 1fr);
		gap: 1.2rem;
		padding: 0 1rem;
	}
	
	/* Player 橫跨全寬 */
	.sp-layout-public #sec-player {
		grid-column: 1 / -1;
	}
	
	.sp-layout-public .sp-panel-body {
		max-height: 320px;
	}
}

/* Desktop: 3 column bento grid */
@media (min-width: 1200px) {
	.sp-layout-public {
		grid-template-columns: 1.2fr 1fr 1fr;
		grid-template-rows: auto auto;
		gap: 1.4rem;
		padding: 0;
	}
	
	/* Player 左側占兩行 */
	.sp-layout-public #sec-player {
		grid-column: 1;
		grid-row: 1 / 3;
		min-height: 420px;
	}
	
	/* Profile 右上角 */
	.sp-layout-public #sec-profile {
		grid-column: 2;
		grid-row: 1;
	}
	
	/* Recent 右上角旁邊 */
	.sp-layout-public #sec-recent {
		grid-column: 3;
		grid-row: 1;
	}
	
	/* Playlists 中間下方 */
	.sp-layout-public #sec-playlists {
		grid-column: 2;
		grid-row: 2;
	}
	
	/* Tracks 右下角 */
	.sp-layout-public #sec-tracks {
		grid-column: 3;
		grid-row: 2;
	}
	
	.sp-layout-public .sp-panel-body {
		max-height: 280px;
	}
	
	.sp-layout-public #sec-player .sp-panel-body {
		max-height: none;
		min-height: 320px;
	}
}

/* Public view panels - cleaner look */
.public-view .sp-panel {
	background: linear-gradient(165deg, rgba(29, 185, 84, 0.08) 0%, rgba(18, 18, 18, 0.98) 30%, rgba(9, 9, 9, 1) 100%);
	border: 1px solid rgba(255, 255, 255, 0.06);
	border-radius: 16px;
	overflow: hidden;
	transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.public-view .sp-panel:hover {
	transform: translateY(-2px);
	box-shadow: 0 20px 40px rgba(0, 0, 0, 0.5);
	border-color: rgba(29, 185, 84, 0.15);
}

.public-view .sp-panel-head {
	background: linear-gradient(145deg, rgba(35, 35, 35, 0.9), rgba(25, 25, 25, 0.95));
	padding: 0.9rem 1rem;
	border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.public-view .sp-panel-head h2 {
	font-size: 0.85rem;
	font-weight: 600;
	letter-spacing: 0.3px;
}

.public-view .sp-panel-body {
	padding: 1rem;
	overflow-y: auto;
}

.public-view .sp-panel-foot {
	background: rgba(15, 15, 15, 0.9);
	padding: 0.6rem 1rem;
	border-top: 1px solid rgba(255, 255, 255, 0.04);
}

/* Player panel special styling */
.public-view #sec-player {
	background: linear-gradient(150deg, rgba(29, 185, 84, 0.12) 0%, rgba(18, 18, 18, 0.98) 40%, rgba(9, 9, 9, 1) 100%);
}

.public-view #sec-player .sp-panel-body {
	display: flex;
	flex-direction: column;
	justify-content: center;
}

/* Now playing cover image enhancement */
.public-view #sp-player .cover {
	width: 120px;
	height: 120px;
	border-radius: 12px;
	box-shadow: 0 8px 25px rgba(0, 0, 0, 0.6);
	flex-shrink: 0;
}

@media (min-width: 768px) {
	.public-view #sp-player .cover {
		width: 140px;
		height: 140px;
	}
}

@media (min-width: 1200px) {
	.public-view #sp-player .cover {
		width: 180px;
		height: 180px;
		border-radius: 14px;
	}
}

/* Public footer */
.sp-public-footer {
	border-top: 1px solid rgba(255, 255, 255, 0.06);
	color: rgba(255, 255, 255, 0.4);
	padding: 1.5rem 1rem;
	margin-top: 2rem;
	background: linear-gradient(180deg, transparent 0%, rgba(0, 0, 0, 0.3) 100%);
}

.sp-public-footer p {
	margin: 0;
	line-height: 1.6;
}

.sp-public-footer .fab.fa-spotify {
	font-size: 1.2em;
	vertical-align: middle;
}

/* Mobile tabs adjustment for public view */
.public-view .sp-mobile-tabs {
	background: rgba(12, 12, 12, 0.98);
	border-bottom: 1px solid rgba(29, 185, 84, 0.15);
	margin-top: 0.5rem;
}

.public-view .sp-mobile-tabs .sp-nav-btn {
	padding: 0.6rem 1rem;
	font-size: 0.75rem;
	border-radius: 10px;
}

.public-view .sp-mobile-tabs .sp-nav-btn .tab-label {
	display: inline;
}

/* Track/playlist item improvements for public view */
.public-view .track-item,
.public-view .playlist-item {
	padding: 0.6rem 0.5rem;
	border-radius: 8px;
	transition: background 0.15s ease;
}

.public-view .track-item:hover,
.public-view .playlist-item:hover {
	background: rgba(255, 255, 255, 0.04);
}

/* Empty state styling */
.public-view .empty {
	text-align: center;
	padding: 2rem 1rem;
	color: rgba(255, 255, 255, 0.4);
	font-size: 0.9rem;
}

.spotify-root{
	color:var(--sp-txt);
	background:radial-gradient(circle at top left,#1db95411 0,#000 55%,#000 100%);
}
.spotify-hero{border-radius:18px;position:relative;padding:2.1rem 1.7rem 1.5rem;background:linear-gradient(135deg,#0a4125,#0f5d33,#121212);box-shadow:0 18px 45px rgba(0,0,0,.8)}
.gradient-dark-green{background:linear-gradient(135deg,#0a4125,#0f5d33,#121212)}
/* Header avatar in redesigned layout (not inside .spotify-hero) */
.sp-head .hero-avatar-wrapper{width:76px;height:76px;position:relative}
.sp-head .hero-avatar{width:76px;height:76px;border-radius:18px;object-fit:cover;box-shadow:0 8px 24px rgba(0,0,0,.75);background:#0b0b0b}
.sp-head .hero-avatar.placeholder{display:flex;align-items:center;justify-content:center;font-size:2.1rem;color:var(--sp-green);border:2px dashed #245335;border-radius:18px;background:rgba(0,0,0,.35)}
.sp-head .head-meta .badges{gap:.4rem}
.sp-head .sp-head-actions{align-self:flex-end}
/* View-only badge tone */
#sp-viewonly-indicator{background:rgba(0,188,212,.18);border:1px solid rgba(0,188,212,.35);color:#9feaf2}
/* Legacy hero (kept for compatibility) */
.spotify-hero .hero-avatar-wrapper{width:140px;height:140px;position:relative}
.spotify-hero .hero-avatar{width:140px;height:140px;border-radius:16px;object-fit:cover;box-shadow:0 4px 18px rgba(0,0,0,.55);background:#0b0b0b}
.spotify-hero .hero-avatar.placeholder{display:flex;align-items:center;justify-content:center;font-size:4rem;color:var(--sp-green);border:2px dashed #245335;border-radius:16px;background:rgba(0,0,0,.25)}
.spotify-hero .hero-title{font-weight:700;letter-spacing:.5px}
/* panel/card/track 基本樣式已集中在 `Spotify_base.css` 的
 * Card v2 與 shared components，這裡只保留 public 特有外觀。 */
#sp-player .progress{height:6px;background:#2a2a2a;border-radius:3px;overflow:hidden}
#sp-player .progress-bar{background:var(--sp-green);transition:width .4s}
.volume-range{width:160px}
.live-dot{width:10px;height:10px;border-radius:50%;background:var(--sp-green);box-shadow:0 0 6px var(--sp-green);animation:spBlink 1.4s infinite}
@keyframes spBlink{0%,70%{opacity:1}85%{opacity:.25}100%{opacity:1}}
.panel-body::-webkit-scrollbar{width:8px}
.panel-body::-webkit-scrollbar-thumb{background:#2d2d2d;border-radius:4px}
.panel-body::-webkit-scrollbar-thumb:hover{background:#3a3a3a}
.panel-player .panel-body{min-height:170px}
.panel-recent .panel-body{max-height:300px;overflow:auto}
.panel-playlists .panel-body,.panel-tracks .panel-body{max-height:360px;overflow:auto}
/* ===== Redesigned Shell (Public-only) ===== */
.spotify-root.redesigned{--sp-shell-gap:1.6rem;}
.spotify-root.redesigned .sp-head.container-fluid{padding-left:1.2rem;padding-right:1.2rem}
/* 若全域 header sticky 樣式曾污染，這裡確保 sp-head 不是 sticky 並還原背景 */
.sp-head{position:relative;background:linear-gradient(120deg,rgba(0,0,0,.9),rgba(9,48,28,.96)) !important;border-radius:18px;border:1px solid rgba(255,255,255,.06);box-shadow:0 18px 40px rgba(0,0,0,.65);}
.sp-head{display:flex;justify-content:space-between;align-items:center;padding:1.35rem 1.4rem 1.25rem;margin-bottom:1.2rem;}
.sp-head .title{font-weight:650;letter-spacing:.6px;}
.sp-head .label{font-size:.7rem;letter-spacing:1.2px;text-transform:uppercase;opacity:.92;font-weight:650;color:var(--sp-green);}
.spotify-shell{display:block;min-height:60vh;padding-bottom:2.4rem;}
.spotify-shell.container-fluid{padding-left:1.2rem;padding-right:1.2rem;max-width:1140px;margin:0 auto}

/* Public read-only tone: cards like a status board */
.sp-main{margin-top:.4rem;}
.sp-panel{border-radius:18px;background:radial-gradient(circle at top left,#1db95418 0,#121212 52%,#090909 100%);border:1px solid rgba(255,255,255,.04);box-shadow:0 16px 35px rgba(0,0,0,.7);} 
.sp-panel-head{background:linear-gradient(145deg,#1f1f1f,#191919);border-bottom-color:rgba(255,255,255,.06);}
.sp-panel-foot{background:#111;border-top-color:rgba(255,255,255,.06);}

/* 手機／平板上，Spotify header 固定在畫面頂端並帶毛玻璃效果 */
@media (max-width:991.98px){
	.sp-head.container-fluid{position:sticky;top:calc(var(--safe-top,env(safe-area-inset-top,0px)));z-index:1030;padding-top:calc(.85rem+var(--safe-top,env(safe-area-inset-top,0px)));padding-bottom:.85rem;}
	.sp-head{border-radius:14px;backdrop-filter:blur(18px) saturate(130%);-webkit-backdrop-filter:blur(18px) saturate(130%);background:linear-gradient(120deg,rgba(0,0,0,.82),rgba(9,48,28,.92)) !important;box-shadow:0 18px 40px rgba(0,0,0,.75);margin-bottom:.6rem;}
	.spotify-root.redesigned .sp-main{padding-top:.4rem;}
}

/* PWA 獨立安裝模式：再多預留一點安全距離，避免 iOS 工具列重疊 */
@media (display-mode:standalone) and (max-width:991.98px){
	.sp-head.container-fluid{top:calc(env(safe-area-inset-top,0px));padding-top:calc(1rem+env(safe-area-inset-top,0px));}
	.spotify-root.redesigned .sp-main{padding-top:.6rem;}
}

/* ====== ENHANCED MOBILE NAVIGATION TABS ====== */
.sp-mobile-tabs {
  position: sticky;
  top: 0;
  z-index: 10;
  background: rgba(18, 18, 18, 0.95);
  backdrop-filter: saturate(120%) blur(8px);
  -webkit-backdrop-filter: saturate(120%) blur(8px);
  border-bottom: 1px solid var(--sp-border);
  padding: 0.5rem 0.5rem calc(0.5rem + env(safe-area-inset-top, 0));
  margin: 0 calc(-1 * var(--container-padding));
  overflow: hidden;
}

.sp-mobile-tabs .tabs-scroll {
  display: flex;
  gap: 0.3rem;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scroll-behavior: smooth;
  scrollbar-width: none;
  position: relative;
  padding: 0 0.5rem;
  scroll-snap-type: x proximity;
}

.sp-mobile-tabs .tabs-scroll::-webkit-scrollbar {
  display: none;
}

/* Enhanced navigation buttons */
.sp-mobile-tabs .sp-nav-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 0.5rem 0.8rem;
  border-radius: 12px;
  border: 1px solid var(--sp-border);
  background: rgba(24, 24, 24, 0.8);
  color: var(--sp-txt-dim);
  font-weight: 600;
  font-size: 0.8rem;
  white-space: nowrap;
  min-height: 44px;
  min-width: 44px;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  transition: all 0.2s ease;
  scroll-snap-align: start;
  flex-shrink: 0;
  position: relative;
}

.sp-mobile-tabs .sp-nav-btn i {
  color: var(--sp-green);
  font-size: 1rem;
}

.sp-mobile-tabs .sp-nav-btn.active,
.sp-mobile-tabs .sp-nav-btn:focus,
.sp-mobile-tabs .sp-nav-btn:hover {
  background: rgba(29, 185, 84, 0.15);
  color: #fff;
  border-color: var(--sp-green);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(29, 185, 84, 0.2);
}

.sp-mobile-tabs .sp-nav-btn:focus-visible {
  outline: 2px solid var(--sp-green);
  outline-offset: 2px;
}

/* Navigation overflow gradients */
.nav-gradient {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 20px;
  pointer-events: none;
  z-index: 1;
}

.nav-gradient-left {
  left: 0;
  background: linear-gradient(90deg, rgba(18, 18, 18, 0.95) 0%, transparent 100%);
}

.nav-gradient-right {
  right: 0;
  background: linear-gradient(-90deg, rgba(18, 18, 18, 0.95) 0%, transparent 100%);
}

/* ====== PWA AND TOUCH ENHANCEMENTS ====== */

/* PWA safe areas and viewport optimizations */
.spotify-root {
	padding-left: env(safe-area-inset-left);
	padding-right: env(safe-area-inset-right);
	padding-bottom: env(safe-area-inset-bottom);
}

.sp-head {
	padding-top: calc(1.4rem + env(safe-area-inset-top, 0));
}

/* Enhanced touch targets - minimum 44px for accessibility */
.btn-panel-action {
	min-height: 44px;
	min-width: 44px;
	touch-action: manipulation;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	padding: 8px 12px;
	font-weight: 500;
	transition: all 0.2s ease;
}


/* 🎵 Enhanced queue management */
.track-item.dragging {
	opacity: 0.5;
	transform: rotate(5deg);
	z-index: 1000;
}

.track-item {
	transition: transform 0.2s ease, box-shadow 0.2s ease;
	cursor: grab;
}

.track-item:active {
	cursor: grabbing;
}

.track-item:hover {
	transform: translateY(-1px);
	box-shadow: 0 4px 12px rgba(29, 185, 84, 0.15);
}

/* 🔍 Enhanced search experience */
.search-loading {
	background: rgba(24, 24, 24, 0.95);
	border-radius: 8px;
	backdrop-filter: blur(4px);
}

.search-item {
	transition: all 0.2s ease;
	border-radius: 8px;
	padding: 0.75rem 0.5rem;
}

.search-item:hover {
	background: rgba(29, 185, 84, 0.1);
	transform: translateX(4px);
}


.sp-nav-btn {
	touch-action: manipulation;
	-webkit-tap-highlight-color: transparent;
}

.track-item, .playlist-item, .device-item {
	min-height: 44px;
	touch-action: manipulation;
	-webkit-tap-highlight-color: rgba(29, 185, 84, 0.1);
}

/* Improved focus states for accessibility and PWA */
.sp-nav-btn:focus-visible {
	outline: 2px solid var(--sp-green);
	outline-offset: 2px;
}

.btn-panel-action:focus-visible {
	outline: 2px solid var(--sp-green);
	outline-offset: 2px;
}

.track-item:focus-visible, .playlist-item:focus-visible {
	outline: 2px solid var(--sp-green);
	outline-offset: 1px;
}

/* Enhanced scrolling for mobile devices */
.sp-panel-body {
	-webkit-overflow-scrolling: touch;
	overscroll-behavior: contain;
}

.tabs-scroll {
	scroll-snap-type: x proximity;
}

.sp-nav-btn {
	scroll-snap-align: start;
}

/* ====== LANDSCAPE ORIENTATION OPTIMIZATIONS ====== */
@media screen and (orientation: landscape) and (max-height: 500px) {
	.sp-head {
		padding: 0.5rem 0 0.3rem;
		margin-bottom: 0.2rem;
	}
	
	.sp-head .hero-avatar-wrapper {
		width: 40px;
		height: 40px;
	}
	
	.sp-head .hero-avatar {
		width: 40px;
		height: 40px;
		border-radius: 6px;
	}
	
	.sp-head .title {
		font-size: 1rem;
	}
	
	.sp-mobile-tabs {
		padding: 0.25rem 0.5rem;
	}
	
	.sp-mobile-tabs .sp-nav-btn {
		padding: 0.3rem 0.5rem;
		font-size: 0.7rem;
		min-height: 36px;
	}
	
	.sp-panel-head {
		padding: 0.5rem 0.8rem;
	}
	
	.sp-panel-body {
		padding: 0.6rem 0.8rem;
		max-height: 200px;
	}
}

/* ====== HIGH DPI / RETINA DISPLAY OPTIMIZATIONS ====== */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
	.hero-avatar, .sp-head .hero-avatar {
		image-rendering: -webkit-optimize-contrast;
		image-rendering: crisp-edges;
	}
	
	img.cover {
		image-rendering: -webkit-optimize-contrast;
		image-rendering: crisp-edges;
	}
}

/* ====== DARK MODE SUPPORT ====== */
@media (prefers-color-scheme: dark) {
	.spotify-root {
		--sp-bg: #000000;
		--sp-panel: #111111;
		--sp-panel-alt: #161616;
		--sp-border: #222222;
		--sp-txt: #ffffff;
		--sp-txt-dim: #b3b3b3;
	}
}

/* ====== REDUCED MOTION SUPPORT ====== */
@media (prefers-reduced-motion: reduce) {
	.sp-panel {
		animation: none;
	}
	
	.live-dot {
		animation: none;
	}
	
	.skeleton {
		animation: none;
	}
	
	.btn-transport, .sp-nav-btn, .track-item, .playlist-item {
		transition: none;
	}
}

/* ====== HIGH CONTRAST MODE SUPPORT ====== */
@media (prefers-contrast: high) {
	.spotify-root {
		--sp-border: #ffffff;
		--sp-txt-dim: #cccccc;
	}
	
	.sp-panel {
		border-width: 2px;
	}
	
	.sp-nav-btn {
		border-width: 2px;
	}
}

/* 解除桌面版寬度限制，允許面板隨螢幕寬度擴展 */
@media (min-width:1200px){
	.main-content .container,
	.spotify-shell.container,
	.sp-head.container{max-width:100%}
}
.sp-main{display:flex;flex-direction:column;gap:1.6rem;}
.sp-grid-two{display:grid;gap:1.4rem;grid-template-columns:repeat(auto-fit,minmax(260px,1fr));}
.sp-panel{background:var(--sp-panel);border:1px solid var(--sp-border);border-radius:16px;display:flex;flex-direction:column;min-height:120px;box-shadow:0 2px 8px -4px rgba(0,0,0,.55);} 
.sp-panel-head{padding:.75rem .95rem;border-bottom:1px solid var(--sp-border);font-weight:600;font-size:.85rem;background:linear-gradient(145deg,#1f1f1f,#191919);}
.sp-panel-body{padding:.85rem .95rem;font-size:.85rem;line-height:1.35rem;overflow:auto;max-height:420px;}
.sp-panel-foot{padding:.55rem .9rem;border-top:1px solid var(--sp-border);background:#151515;border-bottom-left-radius:16px;border-bottom-right-radius:16px;}
.sp-panel-body::-webkit-scrollbar{width:8px}
.sp-panel-body::-webkit-scrollbar-thumb{background:#2d2d2d;border-radius:4px}
.sp-panel-body::-webkit-scrollbar-thumb:hover{background:#3a3a3a}
.sp-panel .track-item,.sp-panel .playlist-item{background:transparent;}
.sp-panel .track-item:hover,.sp-panel .playlist-item:hover{background:#232323;}
/* --- Modern controls & hero --- */
.spotify-root.modern .btn-transport{background:#1f1f1f;border:1px solid var(--sp-border);color:#fff;width:34px;height:34px;border-radius:50%;display:inline-flex;align-items:center;justify-content:center;box-shadow:0 2px 10px rgba(0,0,0,.35);transition:.18s}
.spotify-root.modern .btn-transport:hover{background:#262626;border-color:#3a3a3a}
.spotify-root.modern .btn-transport.btn-play{background:var(--sp-green);border-color:var(--sp-green);color:#000}
.spotify-root.modern .btn-transport.btn-play:hover{filter:brightness(1.05)}
.spotify-root.modern .player-hero{display:flex;gap:1rem;align-items:flex-start}
.spotify-root.modern .player-hero img.cover{width:92px;height:92px;border-radius:12px}
.spotify-root.modern .player-hero .fw-semibold{font-size:1.05rem}
.spotify-root.modern .player-hero .text-muted.small{opacity:.85}
.spotify-root.modern .player-hero .progress{height:6px;background:#2a2a2a;border-radius:6px}
.spotify-root.modern .player-hero .progress-bar{background:var(--sp-green)}
.spotify-root.modern #sp-player .badge{border-radius:999px;padding:.2rem .5rem}
/* ====== CONSOLIDATED RESPONSIVE DESIGN ====== */

/* Mobile Portrait - Very Small Screens (< 375px) */
@media (max-width: 374px) {
	.spotify-root {
		font-size: 14px;
		--sp-avatar-size: 48px;
		--sp-panel-gap: 1rem;
		--sp-panel-padding: 0.7rem 0.8rem;
		--sp-border-radius: 12px;
	}
	
	.sp-mobile-tabs .sp-nav-btn .tab-label {
		display: none;
	}
	.sp-mobile-tabs .sp-nav-btn {
		min-width: 36px;
		padding: 0.4rem;
		gap: 0;
	}
	.sp-mobile-tabs .tabs-scroll {
		gap: 0.25rem;
	}
}

/* Mobile Portrait - Standard (375px - 479px) */
@media (min-width: 375px) and (max-width: 479px) {
	.spotify-root {
		font-size: 14px;
		--sp-avatar-size: 52px;
		--sp-panel-gap: 1rem;
		--sp-border-radius: 12px;
	}
	
	.sp-mobile-tabs .sp-nav-btn .tab-label {
		font-size: 0.7rem;
	}
}

/* Mobile Landscape / Large Mobile (480px - 767px) */
@media (min-width: 480px) and (max-width: 767px) {
	.spotify-root {
		font-size: 14px;
		--sp-avatar-size: 56px;
		--sp-panel-gap: 1.1rem;
		--sp-border-radius: 14px;
	}
	
	.sp-panel-body {
		max-height: 280px;
	}
	
	img.cover {
		width: 40px;
		height: 40px;
	}
}

/* Tablet Portrait (768px - 991px) */
@media (min-width: 768px) and (max-width: 991px) {
	.spotify-root {
		font-size: 15px;
		--sp-avatar-size: 64px;
		--sp-panel-gap: 1.2rem;
		--sp-border-radius: 16px;
	}
	
	.sp-mobile-tabs {
		display: flex !important; /* Show tabs on tablets for better navigation */
		padding: 0.6rem 0.5rem;
	}
	.sp-mobile-tabs .sp-nav-btn {
		padding: 0.6rem 1rem;
		font-size: 0.85rem;
	}
	
	.sp-layout {
		grid-template-columns: repeat(2, 1fr);
	}
	
	.sp-panel-body {
		max-height: 320px;
	}
	
	img.cover {
		width: 44px;
		height: 44px;
	}
}

/* Tablet Landscape / Small Desktop (992px - 1199px) */
@media (min-width: 992px) and (max-width: 1199px) {
	.spotify-root {
		font-size: 15px;
		--sp-avatar-size: 68px;
		--sp-panel-gap: 1.3rem;
		--sp-border-radius: 16px;
	}
	
	.sp-layout {
		grid-template-columns: repeat(3, 1fr);
	}
	
	.sp-panel-body {
		max-height: 360px;
	}
}

/* Large Desktop (1200px - 1399px) */
@media (min-width: 1200px) and (max-width: 1399px) {
	.spotify-root {
		font-size: 16px;
		--sp-panel-gap: 1.4rem;
		--sp-border-radius: 18px;
	}
	
	.sp-layout {
		grid-template-columns: repeat(4, 1fr);
		max-width: 1400px;
		margin: 0 auto;
	}
	
	.sp-panel-body {
		max-height: 400px;
	}
	
	.sp-mobile-tabs {
		display: none !important;
	}
}

/* Extra Large Desktop (1400px+) */
@media (min-width: 1400px) {
	.spotify-root {
		font-size: 16px;
		--sp-panel-gap: 1.5rem;
		--sp-border-radius: 20px;
	}
	
	.sp-layout {
		grid-template-columns: repeat(5, 1fr);
		max-width: 1600px;
		margin: 0 auto;
	}
	
	.sp-panel-body {
		max-height: 420px;
	}
	
	.sp-mobile-tabs {
		display: none !important;
	}
}

/* ====== DEVICE-SPECIFIC OPTIMIZATIONS ====== */

/* Low bandwidth optimizations */
.spotify-root.low-bandwidth img {
  background: var(--sp-panel-alt);
}

.spotify-root.low-bandwidth .sp-panel {
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}

/* Low memory optimizations */
.spotify-root.low-memory .sp-panel-body {
  max-height: 200px !important;
}

.spotify-root.low-memory .sp-layout {
  gap: 1rem;
}

/* Minimal animations for low-end devices */
.spotify-root.minimal-animations *,
.spotify-root.low-cpu * {
  transition: none !important;
  animation: none !important;
}

.spotify-root.low-cpu .live-dot {
  animation: none;
  opacity: 1;
}

/* Data saver mode */
.spotify-root.data-saver img {
  display: none;
}

.spotify-root.data-saver .hero-avatar {
  background: var(--sp-green);
  display: flex;
  align-items: center;
  justify-content: center;
}

.spotify-root.data-saver .hero-avatar::before {
  content: '\1f3b5';
  font-size: 2rem;
}

/* Touch device optimizations */
.spotify-root.has-touch .sp-panel {
  transition: none;
}

.spotify-root.has-touch .sp-panel:hover {
  transform: none;
}

/* Hover-capable device enhancements */
.spotify-root.has-hover .sp-panel:hover {
  transform: translateY(-2px);
}

.spotify-root.has-hover .track-item:hover,
.spotify-root.has-hover .playlist-item:hover {
  background: rgba(29, 185, 84, 0.1);
}

/* ====== ENHANCED ACCESSIBILITY ====== */

/* Screen reader improvements */
.sr-only {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

/* Focus management for keyboard users */
.using-keyboard .sp-nav-btn:focus,
.using-keyboard .btn-panel-action:focus,
.using-keyboard .track-item:focus,
.using-keyboard .playlist-item:focus {
  outline: 3px solid var(--sp-green) !important;
  outline-offset: 2px !important;
  border-radius: 8px;
}


/* ====== UTILITY CLASSES FOR RESPONSIVE DESIGN ====== */

/* Display utilities for different breakpoints */
.d-mobile-none { display: none !important; }
.d-tablet-none { display: none !important; }
.d-desktop-none { display: none !important; }

@media (max-width: 374px) {
	.d-xs-none { display: none !important; }
	.d-xs-block { display: block !important; }
	.d-xs-flex { display: flex !important; }
}

@media (min-width: 375px) and (max-width: 767px) {
	.d-sm-none { display: none !important; }
	.d-sm-block { display: block !important; }
	.d-sm-flex { display: flex !important; }
}

/* Skeleton styles are provided once in `Spotify_base.css` and
 * reused here via the same class names.
 */

/* Base layout fixes (body flex, overflow, box-sizing) are now
 * provided in a single place below in the "FINAL LAYOUT" section
 * to avoid multiple overlapping grid definitions. */

@media (min-width: 768px) and (max-width: 991px) {
	.d-md-none { display: none !important; }
	.d-md-block { display: block !important; }
	.d-md-flex { display: flex !important; }
}

@media (min-width: 992px) and (max-width: 1199px) {
	.d-lg-none { display: none !important; }
	.d-lg-block { display: block !important; }
	.d-lg-flex { display: flex !important; }
}

@media (min-width: 1200px) {
	.d-xl-none { display: none !important; }
	.d-xl-block { display: block !important; }
	.d-xl-flex { display: flex !important; }
}

@media (max-width: 479px) {
	.text-xs-small { font-size: 0.7rem !important; }
	.text-xs-hide { display: none !important; }
}


@media (min-width: 768px) and (max-width: 1199px) {
	.d-tablet-block { display: block !important; }
	.d-tablet-inline { display: inline !important; }
	.d-tablet-inline-block { display: inline-block !important; }
	.d-tablet-flex { display: flex !important; }
	.d-tablet-none { display: none !important; }
}

@media (min-width: 1200px) {
	.d-desktop-block { display: block !important; }
	.d-desktop-inline { display: inline !important; }
	.d-desktop-inline-block { display: inline-block !important; }
	.d-desktop-flex { display: flex !important; }
	.d-desktop-none { display: none !important; }
}

/* Responsive text sizes */
.text-responsive {
	font-size: clamp(0.875rem, 2.5vw, 1rem);
}

.title-responsive {
	font-size: clamp(1.25rem, 4vw, 2rem);
}

/* Responsive spacing */
.gap-responsive {
	gap: clamp(0.5rem, 2vw, 1.5rem);
}

.p-responsive {
	padding: clamp(0.5rem, 2vw, 1.5rem);
}

.m-responsive {
	margin: clamp(0.5rem, 2vw, 1.5rem);
}

/* ====== ULTRA-WIDE AND HIGH RESOLUTION DISPLAY OPTIMIZATIONS ====== */

/* Container max-width adjustments for ultra-wide screens */
@media (min-width: 1600px) {
	.spotify-shell.container-fluid {
		max-width: 1400px;
		margin-left: auto;
		margin-right: auto;
	}
}

/* Enhanced focus states for better accessibility across devices */
@media (any-hover: hover) {
	.spotify-root .btn:hover {
		transform: translateY(-1px);
		box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
	}
}

@media (any-hover: none) {
	.spotify-root .btn:active {
		transform: scale(0.98);
	}
}

/* ====== ENHANCED MOBILE AND PWA OPTIMIZATIONS ====== */

/* Better handling of mobile browser UI */
@supports (height: 100dvh) {
	.spotify-root {
		min-height: 100dvh;
	}
}

/* Enhanced mobile landscape layout for phones */
@media screen and (max-width: 896px) and (orientation: landscape) and (max-height: 500px) {
	.sp-head {
		padding: 0.4rem 0 0.2rem;
		margin-bottom: 0.1rem;
	}
	
	.sp-head .hero-avatar-wrapper {
		width: 32px;
		height: 32px;
	}
	
	.sp-head .hero-avatar {
		width: 32px;
		height: 32px;
		border-radius: 4px;
	}
	
	.sp-head .title {
		font-size: 0.9rem;
	}
	
	.sp-mobile-tabs {
		padding: 0.2rem 0.4rem;
	}
	
	.sp-mobile-tabs .sp-nav-btn {
		padding: 0.25rem 0.4rem;
		font-size: 0.65rem;
		min-height: 32px;
	}
	
	.sp-panel-head {
		padding: 0.4rem 0.6rem;
		font-size: 0.75rem;
	}
	
	.sp-panel-body {
		padding: 0.5rem 0.6rem;
		max-height: 160px;
		font-size: 0.75rem;
	}
	
	.track-item, .playlist-item {
		gap: 0.3rem;
		padding: 0.25rem 0.3rem;
		min-height: 32px;
	}
	
	img.cover {
		width: 28px;
		height: 28px;
	}
}

/* Better foldable phone support */
@media screen and (min-width: 280px) and (max-width: 653px) {
	.spotify-root.fold-optimized .sp-layout {
		grid-template-columns: 1fr;
		gap: 0.8rem;
	}
	
	.spotify-root.fold-optimized .sp-panel {
		min-height: 100px;
	}
	
	.spotify-root.fold-optimized .sp-panel-body {
		max-height: 200px;
	}
}

/* Enhanced ultra-wide display support (21:9, 32:9 monitors) */
@media (min-width: 2560px) {
	.spotify-shell.container-fluid {
		max-width: 1600px;
	}
	
	.sp-layout {
		grid-template-columns: repeat(6, 1fr);
		gap: 2rem;
	}
	
	.sp-panel-body {
		max-height: 500px;
	}
}

/* ====== IMPROVED TYPOGRAPHY AND ACCESSIBILITY ====== */

/* Better fluid typography */
.sp-head .title {
	font-size: clamp(1.1rem, 3vw, 1.5rem);
	line-height: 1.2;
}

.sp-head .label {
	font-size: clamp(0.6rem, 1.5vw, 0.75rem);
}

.sp-panel-head {
	font-size: clamp(0.75rem, 2vw, 0.9rem);
}

.sp-panel-body {
	font-size: clamp(0.8rem, 2vw, 0.9rem);
	line-height: 1.4;
}

/* Better button focus indicators for all input methods */
.spotify-root .btn:focus-visible,
.spotify-root .sp-nav-btn:focus-visible {
	outline: 3px solid var(--sp-green);
	outline-offset: 2px;
	box-shadow: 0 0 0 6px rgba(29, 185, 84, 0.2);
}

/* Enhanced touch feedback for mobile */
@media (pointer: coarse) {
	.spotify-root .btn,
	.spotify-root .sp-nav-btn,
	.track-item, 
	.playlist-item,
	.device-item {
		transition: background-color 0.15s ease, transform 0.15s ease;
	}
	
	.spotify-root .btn:active,
	.spotify-root .sp-nav-btn:active {
		transform: scale(0.97);
		transition-duration: 0.1s;
	}
	
	.track-item:active, 
	.playlist-item:active,
	.device-item:active {
		background-color: rgba(29, 185, 84, 0.1);
		transform: scale(0.99);
		transition-duration: 0.1s;
	}
}

/* ====== PRINT STYLES FOR SHARING ====== */
@media print {
	.spotify-root {
		background: white !important;
		color: black !important;
	}
	
	.sp-mobile-tabs,
	.sp-head-actions,
	.btn-panel-action {
		display: none !important;
	}
	
	.sp-panel {
		border: 1px solid #ccc !important;
		background: white !important;
		break-inside: avoid;
		margin-bottom: 1rem;
	}
	
	.sp-panel-head {
		background: #f5f5f5 !important;
		color: black !important;
	}
	
	.sp-panel-body {
		max-height: none !important;
		overflow: visible !important;
		color: black !important;
	}
}

/* ====== IMPROVED GRID SYSTEM ====== */

/* More flexible grid system for intermediate breakpoints */
@media (min-width: 576px) and (max-width: 767px) {
	.sp-layout {
		grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
		gap: 1rem;
	}
}

@media (min-width: 992px) and (max-width: 1199px) {
	.sp-layout {
		grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
		gap: 1.3rem;
	}
}

@media (min-width: 1200px) and (max-width: 1399px) {
	.sp-layout {
		grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
		gap: 1.4rem;
	}
}

@media (min-width: 1400px) {
	.sp-layout {
		grid-template-columns: repeat(auto-fit, minmax(340px, 1fr));
		gap: 1.5rem;
	}
}

/* ====== ADDITIONAL EDGE CASES AND OPTIMIZATIONS ====== */

/* Very small screens (Galaxy Fold, etc.) */
@media (max-width: 320px) {
	.spotify-root {
		font-size: 13px;
		--sp-panel-padding: 0.6rem 0.7rem;
		--sp-min-touch-target: 40px;
	}
	
	.sp-head .title {
		font-size: 1rem;
	}
	
	.sp-panel-body {
		max-height: 150px;
		font-size: 0.75rem;
	}
}

/* Very tall screens (iPhone 14 Pro Max, etc.) */
@media (min-height: 900px) and (max-width: 500px) {
	.sp-panel-body {
		max-height: 300px;
	}
}

/* Square-ish screens (iPad Pro 12.9" in portrait) */
@media (min-width: 1000px) and (max-width: 1200px) and (min-height: 1200px) {
	.sp-layout {
		grid-template-columns: repeat(3, 1fr);
	}
	
	.sp-panel-body {
		max-height: 250px;
	}
}

/* Print styles for better document printing */
@media print {
	.spotify-root {
		background: white !important;
		color: black !important;
	}
	
	.sp-mobile-tabs,
	.sp-head-actions,
	.btn {
		display: none !important;
	}
	
	.sp-layout {
		display: block !important;
	}
	
	.sp-panel {
		break-inside: avoid;
		margin-bottom: 1rem;
		border: 1px solid #ccc !important;
	}
}

/* Legacy responsive rule - keeping for compatibility */
@media (max-width:991.98px){
	.sp-head{padding:1rem 0 .6rem;margin-bottom:.4rem;}
	.sp-panel-body{max-height:none;}
	.sp-head .hero-avatar-wrapper{width:60px;height:60px}
	.sp-head .hero-avatar{width:60px;height:60px;border-radius:10px}
}
/* Larger screens polish */
@media (min-width:1400px){
	.spotify-shell{grid-template-columns:260px 1fr;}
	.sp-panel-body{max-height:480px;}
}
/* Animations */
.sp-panel{animation:fadeIn .35s ease;}
@keyframes fadeIn{from{opacity:0;transform:translateY(6px);}to{opacity:1;transform:translateY(0);}}
/* Legacy named grid areas are no longer used; public view layout
 * is driven by a single auto-fit grid defined later. */
@media (max-width:575.98px){
	.panel-header{font-size:.85rem}
	img.cover{width:42px;height:42px}
	.volume-range{width:130px}
}
/* --- Tabs (mobile first) --- */
/* NOTE: 主要樣式定義在文件末尾的 CONSOLIDATED TAB STYLES 區塊 */
.sp-tabs-wrapper{margin-top:-1rem;margin-bottom:1.25rem}
.sp-tabs{display:flex;list-style:none;padding:0;margin:0;gap:.5rem;overflow-x:auto;-webkit-overflow-scrolling:touch}
.sp-tabs li{flex:0 0 auto}
.sp-section{display:none}
.sp-section.active{display:block}
@media (min-width: 992px){
	.sp-tabs-wrapper{display:none}
	.sp-section{display:block !important}
	/* 取消 sticky 以避免父層 grid/overflow 情境下的覆蓋與跳動 */
	.panel-player{position:static;top:auto}
}
@media (max-width: 991.98px){
	/* 移除 sticky，避免行動版上方導覽列高度偵測不一致造成跳動 */
	.panel-player{position:static;top:auto;z-index:auto}
	.panel-player .panel-body{max-height:none}
}
/* Skeleton (optional placeholders) */
.skeleton{background:linear-gradient(90deg,#1f1f1f 25%,#282828 37%,#1f1f1f 63%);background-size:400% 100%;animation:skShine 1.4s ease infinite;border-radius:4px;min-height:12px}
@keyframes skShine{0%{background-position:100% 0}100%{background-position:0 0}}
@media (max-width:1200px){.spotify-hero .hero-avatar-wrapper{width:110px;height:110px}.spotify-hero .hero-avatar,.spotify-hero .hero-avatar.placeholder{width:110px;height:110px}}
@media (max-width:768px){.spotify-hero{padding:1.5rem 1.2rem}.panel-body{padding:.75rem .8rem}}

/* View-only permission visual (owner-only disabled) */
.owner-only.disabled{opacity:.5;pointer-events:none}

/* Enhanced Lyrics Styling */
.lyrics-container {
  --lyrics-font: 1rem;
  max-height: 320px;
  overflow: auto;
  line-height: 1.6;
  scroll-behavior: smooth;
  font-size: var(--lyrics-font);
  position: relative;
  padding: 8px 4px;
  
  /* Smooth scrolling and momentum */
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  scroll-padding-top: 20px;
}

.lyric-line {
  color: var(--sp-txt-dim);
  padding: 8px 12px;
  margin: 2px 0;
  border-radius: 8px;
  transition: all 0.25s cubic-bezier(0.25, 0.46, 0.45, 0.94);
  cursor: default;
  display: flex;
  gap: 0.5rem;
  align-items: baseline;
  position: relative;
  min-height: 36px;
  
  /* Improved visual hierarchy */
  font-weight: 400;
  letter-spacing: 0.02em;
  opacity: 0.7;
}

.lyric-line .ts {
  display: none;
  font-variant-numeric: tabular-nums;
  opacity: 0.6;
  font-size: 0.8em;
  font-weight: 500;
  color: var(--sp-green);
  min-width: 42px;
  text-align: right;
  
  /* Subtle animation for timestamps */
  transition: opacity 0.2s ease;
}

.lyrics-container.show-ts .lyric-line .ts {
  display: inline;
}

.lyric-line .tx {
  flex: 1;
  transition: transform 0.25s ease;
}

/* Active line styling with enhanced visual feedback */
.lyric-line.active {
  color: #ffffff;
  background: linear-gradient(135deg, rgba(29, 185, 84, 0.15), rgba(29, 185, 84, 0.08));
  border: 1px solid rgba(29, 185, 84, 0.3);
  opacity: 1;
  font-weight: 500;
  
  /* Subtle glow effect */
  box-shadow: 0 2px 8px rgba(29, 185, 84, 0.15);
  
  /* Scale effect for emphasis */
  transform: scale(1.01);
}

.lyric-line.active .ts {
  opacity: 0.9;
  font-weight: 600;
}

/* Hover effect for clickable lyrics */
.lyrics-clickable .lyric-line {
  cursor: pointer;
}

.lyrics-clickable .lyric-line:hover:not(.active) {
  background: rgba(255, 255, 255, 0.05);
  opacity: 0.9;
  transform: translateX(4px);
}

/* Loading states */
.lyrics-loading {
  text-align: center;
  padding: 2rem 1rem;
  color: var(--sp-green);
  font-style: italic;
}

.lyrics-loading i {
  font-size: 1.2em;
  margin-right: 8px;
}

.lyrics-not-found {
  text-align: center;
  padding: 2rem 1rem;
  opacity: 0.8;
}

.lyrics-not-found small {
  display: block;
  margin-top: 8px;
  opacity: 0.7;
  font-size: 0.85em;
}

.lyrics-error {
  text-align: center;
  padding: 2rem 1rem;
  color: var(--sp-danger);
  opacity: 0.9;
}

/* Enhanced mobile responsiveness */
@media (max-width: 768px) {
  .lyrics-container {
    max-height: 280px;
    --lyrics-font: 0.95rem;
    line-height: 1.5;
    padding: 6px 2px;
  }
  
  .lyric-line {
    padding: 10px 8px;
    min-height: 42px; /* Larger touch target */
    border-radius: 6px;
  }
  
  .lyric-line .ts {
    min-width: 38px;
    font-size: 0.75em;
  }
  
  .lyric-line.active {
    transform: scale(1.005); /* Subtle on mobile */
  }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
  .lyric-line.active {
    background: rgba(29, 185, 84, 0.25);
    border-color: rgba(29, 185, 84, 0.6);
    color: #ffffff;
  }
  
  .lyrics-container {
    border: 1px solid var(--sp-border);
    border-radius: 8px;
  }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
  .lyric-line {
    transition: color 0.1s, background-color 0.1s;
  }
  
  .lyric-line .tx {
    transition: none;
  }
  
  .lyrics-container {
    scroll-behavior: auto;
  }
  
  .lyric-line.active {
    transform: none;
  }
  
  .lyrics-clickable .lyric-line:hover:not(.active) {
    transform: none;
  }
}

/* Focus indicators for keyboard navigation */
.lyric-line:focus-visible {
  outline: 2px solid var(--sp-green);
  outline-offset: 2px;
}

/* Scroll indicators */
.lyrics-container::before,
.lyrics-container::after {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  height: 20px;
  pointer-events: none;
  z-index: 1;
  transition: opacity 0.3s ease;
}

.lyrics-container::before {
  top: 0;
  background: linear-gradient(to bottom, var(--sp-panel) 0%, transparent 100%);
}

.lyrics-container::after {
  bottom: 0;
  background: linear-gradient(to top, var(--sp-panel) 0%, transparent 100%);
}

/* Lyrics panel specific enhancements */
.sp-panel[data-area="lyrics"] .sp-panel-body {
  overflow: visible;
  padding: 0.6rem 0.5rem;
}

.sp-panel[data-area="lyrics"] .lyrics-container {
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.2);
  padding: 12px 8px;
}

/* ===== Layout stability hotfix (2025-08) ===== */
/* 取消全域面板固定高度，改為僅對清單型面板設定滾動上限，避免版面互相擠壓 */
.sp-panel-body{max-height:none;}
.sp-panel[data-area="playlists"] .sp-panel-body,
.sp-panel[data-area="tracks"] .sp-panel-body,
.sp-panel[data-area="recent"] .sp-panel-body,
.sp-panel[data-area="queue"] .sp-panel-body,
.sp-panel[data-area="search"] .sp-panel-body{max-height:420px;overflow:auto}
/* Lyrics panel uses inner container scroll only to avoid nested scroll conflicts */
.sp-panel[data-area="lyrics"] .sp-panel-body{overflow:visible}
@media (min-width:992px){
	/* 確保桌面不使用 sticky，避免 grid overflow 造成亂版 */
	.sp-layout [data-area=player]{position:static;top:auto}
}

/* ===== ADDITIONAL LAYOUT STABILITY FIXES ===== */
/* Prevent container overflow issues */
.spotify-root {
	width: 100%;
	max-width: 100vw;
	overflow-x: hidden;
}

/* Ensure proper container behavior */
.spotify-root .container-fluid {
	width: 100%;
	max-width: 100%;
	overflow-x: hidden;
}

/* Fix potential grid blowout issues */
.sp-layout {
	width: 100%;
	max-width: 100%;
	overflow: visible;
}

/* Prevent panels from breaking out of containers */
.sp-panel {
	max-width: 100%;
	word-wrap: break-word;
	overflow-wrap: break-word;
}

/* Ensure mobile navigation doesn't break layout */
.sp-mobile-tabs {
	width: 100%;
	overflow-x: hidden;
}

.sp-mobile-tabs .tabs-scroll {
	width: 100%;
	overflow-x: auto;
}

/* Fix image sizing issues */
.sp-panel img {
	max-width: 100%;
	height: auto;
}

/* Prevent text overflow in panels */
.sp-panel-body {
	overflow-wrap: break-word;
	word-break: break-word;
}

/* ===== Desktop drag & drop card ordering ===== */
.sp-panel .sp-panel-head .sp-drag-handle{
	margin-left:.4rem;
}
.sp-drag-handle{
	cursor: grab;
}
.sp-panel.draggable{ outline: none; }
.sp-panel.dragging{
	opacity:.85;
	transform: scale(.995);
	box-shadow:0 10px 24px rgba(0,0,0,.45);
}
.sp-panel-placeholder{
	border:2px dashed var(--sp-border);
	background: rgba(255,255,255,.03);
}
@media (pointer: fine) and (min-width: 992px){
	.sp-panel{ cursor: default; }
	.sp-panel .sp-panel-head{ cursor: default; }
	.sp-panel .sp-panel-head .sp-drag-handle{ cursor: grab; }
	.sp-panel.dragging{ cursor: grabbing; }
}

/* ===================== FINAL LAYOUT OVERRIDES (2025-08 hotfix) ===================== */
/*
	目的：
	- 移除舊版 grid-template-areas 造成的衝突與位移。
	- 統一 Spotify 面板為自適應欄位網格（auto-fit/auto-fill），在各 breakpoint 清晰控管欄數。
	- 防止 sticky/overflow 導致的覆蓋與水平捲動。
	- 僅追加覆蓋規則，不移除原樣式，確保風險最低。
*/

/* 統一主容器為自適應網格，不使用命名區域 */
.spotify-root .sp-layout {
	display: grid !important;
	grid-template-areas: none !important;
	grid-auto-flow: row !important;
	gap: 1.4rem !important;
	/* 預設 1 欄（極小螢幕） */
	grid-template-columns: 1fr !important;
}

/* 所有分區一律交由自動流佈局，不綁定命名區域 */
.spotify-root .sp-layout [data-area] {
	grid-area: auto !important;
}

/* 依據寬度增加欄數（無命名區域，避免相互擠壓/重疊） */
@media (min-width: 576px) {
	.spotify-root .sp-layout {
		grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
		gap: 1.1rem !important;
	}
}

@media (min-width: 992px) {
	.spotify-root .sp-layout {
		grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
		gap: 1.3rem !important;
	}
}

@media (min-width: 1400px) {
	.spotify-root .sp-layout {
		grid-template-columns: repeat(4, minmax(0, 1fr)) !important;
		gap: 1.5rem !important;
	}
}

/* 面板通用安全尺寸，避免被固定高度限制 */
.spotify-root .sp-panel {
	min-width: 280px !important;
	width: 100% !important;
	height: auto !important;
	min-height: 120px !important;
	max-width: 100% !important;
	overflow: hidden; /* 防止內部溢出造成外層水平捲動 */
}

/* 預設不限制內容高度，僅列表型區塊做滾動上限，避免互相擠壓 */
.spotify-root .sp-panel-body {
	max-height: none !important;
	overflow: visible !important;
}
.spotify-root .sp-panel[data-area="playlists"] .sp-panel-body,
.spotify-root .sp-panel[data-area="tracks"] .sp-panel-body,
.spotify-root .sp-panel[data-area="recent"] .sp-panel-body,
.spotify-root .sp-panel[data-area="queue"] .sp-panel-body,
.spotify-root .sp-panel[data-area="search"] .sp-panel-body {
	max-height: 420px !important;
	overflow: auto !important;
}

/* 歌詞面板僅由內層 .lyrics-container 捲動，避免巢狀滾動衝突 */
.spotify-root .sp-panel[data-area="lyrics"] .sp-panel-body {
	overflow: visible !important;
}

/* 取消任何可能的 sticky，避免在 grid/overflow 情境造成遮擋/跳動 */
.spotify-root .panel-player,
.spotify-root .sp-layout [data-area="player"] {
	position: static !important;
	top: auto !important;
}

/* 保護外層容器不產生水平捲動 */
.spotify-root,
.spotify-root .container-fluid,
.spotify-root .spotify-shell.container-fluid,
.spotify-root .sp-head.container-fluid {
	max-width: 100% !important;
	width: 100% !important;
	overflow-x: hidden !important;
}

/* 行動版頂部導覽固定時不溢出 */
.spotify-root .sp-mobile-tabs {
	position: sticky !important;
	top: 0 !important;
	z-index: 10 !important;
	width: 100% !important;
	margin-left: 0 !important;
	margin-right: 0 !important;
}
.spotify-root .sp-mobile-tabs .tabs-scroll {
	width: 100% !important;
	overflow-x: auto !important;
}

/* 圖片尺寸保護，避免撐破網格 */
.spotify-root .sp-panel img.cover,
.spotify-root .sp-panel img {
	max-width: 100% !important;
	height: auto;
}

/* 頁首間距微調，避免與 sticky 導覽重疊 */
.spotify-root .sp-head {
	margin-bottom: 1rem !important;
	padding-top: 1rem !important;
	padding-bottom: 1rem !important;
}

/* 防止其他舊規則再度套用命名區域版型（提高權重） */
.spotify-root.redesigned.modern .sp-layout,
.spotify-root.modern .sp-layout,
.spotify-root.redesigned .sp-layout {
	grid-template-areas: none !important;
}

/* ===================== Desktop Layout Refactor (2025-08) ===================== */
/* 目標：
   1) 桌面版本採用自適應多欄網格，避免舊版命名區域造成錯位。
   2) 指定部分重點卡片在桌面可跨欄，讓視覺更平衡（可依需求調整）。
   3) 僅列表型內容限制捲動高度，其餘依內容自適應高度。 */

/* 隱藏行動分頁列於桌面，避免與桌面導覽衝突 */
@media (min-width: 992px) {
	.spotify-root .sp-mobile-tabs { display: none !important; }
}

/* 自適應欄位：992px 起為 3 欄，1400px 起為 4 欄（已於上方有基礎規則，這裡再強化一次）*/
@media (min-width: 992px) {
	.spotify-root .sp-layout {
		grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
		grid-auto-rows: minmax(120px, auto);
		align-items: start;
	}
}
@media (min-width: 1400px) {
	.spotify-root .sp-layout {
		grid-template-columns: repeat(4, minmax(0, 1fr)) !important;
	}
}


/* ===================== CONSOLIDATED TAB STYLES (authoritative) ===================== */
/* Purpose: centralize .sp-tab-btn / .sp-nav-btn behavior so desktop & mobile tab sizes
   and paddings are consistent across public & internal templates. Placed near file end
   so it overrides earlier scattered definitions without using !important. */
.sp-tab-btn,
.sp-tabs-container .sp-tab-btn,
.sp-tabs-nav .sp-tab-btn,
.sp-mobile-tabs .sp-nav-btn,
.sp-mobile-tabs .sp-nav-btn .tab-label {
	font-size: 0.8125rem;
	line-height: 1;
	padding: 0.65rem 1.25rem;
	gap: 0.5rem;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	border-radius: 999px;
	white-space: nowrap;
	font-weight: 500;
	letter-spacing: 0.01em;
	transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
	background: rgba(255, 255, 255, 0.05);
	border: 1px solid transparent;
	color: var(--sp-txt-dim, #b3b3b3);
	min-height: 40px;
	cursor: pointer;
}

.sp-tab-btn i,
.sp-mobile-tabs .sp-nav-btn i {
	font-size: 0.875rem;
	color: var(--sp-green);
	transition: color 0.2s, transform 0.2s;
}

.sp-tab-btn:hover,
.sp-mobile-tabs .sp-nav-btn:hover {
	color: #fff;
	background: rgba(255, 255, 255, 0.1);
	transform: translateY(-1px);
	box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.sp-tab-btn:hover i,
.sp-mobile-tabs .sp-nav-btn:hover i {
	transform: scale(1.1);
}

.sp-tab-btn:focus-visible,
.sp-mobile-tabs .sp-nav-btn:focus-visible {
	outline: 2px solid var(--sp-green);
	outline-offset: 2px;
}

.sp-tab-btn.active,
.sp-mobile-tabs .sp-nav-btn.active {
	background: linear-gradient(135deg, #1db954 0%, #1ed760 50%, #1db954 100%);
	color: #000;
	border-color: rgba(255, 255, 255, 0.2);
	font-weight: 600;
	box-shadow: 
		0 4px 16px rgba(29, 185, 84, 0.4),
		inset 0 1px 0 rgba(255, 255, 255, 0.2);
	transform: translateY(0);
}

.sp-tab-btn.active i,
.sp-mobile-tabs .sp-nav-btn.active i {
	color: #000;
}

.sp-tab-btn.active:hover,
.sp-mobile-tabs .sp-nav-btn.active:hover {
	background: linear-gradient(135deg, #1ed760 0%, #22e065 50%, #1ed760 100%);
	box-shadow: 
		0 6px 20px rgba(29, 185, 84, 0.5),
		inset 0 1px 0 rgba(255, 255, 255, 0.25);
}

.sp-tab-btn:active,
.sp-mobile-tabs .sp-nav-btn:active {
	transform: scale(0.97);
}

@media (max-width: 575px) {
	.sp-tab-btn,
	.sp-mobile-tabs .sp-nav-btn {
		font-size: 0.75rem;
		padding: 0.5rem 0.875rem;
		min-height: 36px;
		gap: 0.375rem;
	}
	
	.sp-tab-btn i,
	.sp-mobile-tabs .sp-nav-btn i {
		font-size: 0.8125rem;
	}
}

/* Note: special-case landscape + short-height rules (which use !important) are
   intentionally left in place to preserve their emergency behaviour. */


/* 重要卡片在桌面跨欄，平衡視覺權重（可視需求調整順序與跨欄）*/
@media (min-width: 992px) {
	.spotify-root .sp-layout [data-area="player"] { grid-column: span 2; }
	.spotify-root .sp-layout [data-area="queue"] { grid-column: span 2; }
	.spotify-root .sp-layout [data-area="search"] { grid-column: span 2; }
	/* 其他卡片維持單欄：profile / playlists / tracks / recent / party 等 */
}

/* 桌面卡片一致性：標題列與內距已統一於 Card v2 Tokens；這裡確保 body 不被全域規則誤限高 */
@media (min-width: 992px) {
	.spotify-root .sp-panel-body { max-height: none !important; overflow: visible !important; }
	.spotify-root .sp-panel[data-area="playlists"] .sp-panel-body,
	.spotify-root .sp-panel[data-area="tracks"] .sp-panel-body,
	.spotify-root .sp-panel[data-area="recent"] .sp-panel-body,
	.spotify-root .sp-panel[data-area="queue"] .sp-panel-body,
	.spotify-root .sp-panel[data-area="search"] .sp-panel-body { max-height: 460px !important; overflow: auto !important; }
	/* 歌詞仍由內層容器滾動避免巢狀 */
	.spotify-root .sp-panel[data-area="lyrics"] .sp-panel-body { overflow: visible !important; }
}

/* ===== Scoped resets against global base.css bleed (2025-08) =====
	1) base.css uses `main { padding:32px 16px; min-height:80vh; }` which unintentionally affects our nested <main.sp-main>.
	2) base.css applies `.main-content section { margin-bottom:2rem; }` which adds extra gaps to our grid items (they are <section> tags).
	We neutralize these globally-safe but locally-unwanted rules within .spotify-root only. */
.spotify-root .sp-main { padding: 0 !important; min-height: auto !important; }
.spotify-root .sp-layout > .sp-section { margin: 0 !important; }
/* Keep spacing driven by grid gap, not child margins */
.spotify-root .sp-layout { gap: clamp(.9rem, 1.6vw, 1.3rem) !important; }
/* Avoid any accidental outer margin from global first/last-child tweaks */
.spotify-root { margin-top: 0 !important; margin-bottom: 0 !important; }

/* ======================= Card v2 System (2025-08) ======================= */
/* Goals:
	 - Unify content cards with consistent paddings, radius, shadows, and states.
	 - Keep backward compatibility: existing .sp-panel markup works without changes.
	 - Allow progressive enhancement by adding .sp-card class on sections. */

/* Design tokens for cards */
.spotify-root{
	--card-bg: var(--sp-panel);
	--card-border: var(--sp-border);
	--card-radius: 16px;
	--card-shadow: 0 4px 14px rgba(0,0,0,.30);
	--card-shadow-hover: 0 10px 24px rgba(0,0,0,.35);
	--card-head-gradient: linear-gradient(145deg,#1f1f1f,#191919);
	--card-head-min-h: 48px;
	--card-pad-x: clamp(.85rem, 1.8vw, 1rem);
	--card-pad-y: clamp(.75rem, 1.6vw, .9rem);
	--card-gap: clamp(.5rem, 1.4vw, .75rem);
}

/* Card base: opt-in via .sp-card or auto-apply to .sp-panel */
.spotify-root .sp-card,
.spotify-root .sp-panel{
	background: var(--card-bg);
	border: 1px solid var(--card-border);
	border-radius: var(--card-radius);
	box-shadow: 0 2px 8px rgba(0,0,0,.25);
	transition: box-shadow .18s ease, transform .18s ease, border-color .18s ease;
}

/* Hover-capable devices get lift on hover */
@media (any-hover: hover){
	.spotify-root .sp-card:hover,
	.spotify-root .sp-panel:hover{
		box-shadow: var(--card-shadow);
		transform: translateY(-1px);
		border-color: rgba(255,255,255,.08);
	}
}

/* Head, Body, Foot unified paddings */
.spotify-root .sp-panel-head{
	min-height: var(--card-head-min-h);
	padding: var(--card-pad-y) var(--card-pad-x);
	background: var(--card-head-gradient);
	border-top-left-radius: var(--card-radius);
	border-top-right-radius: var(--card-radius);
}
.spotify-root .sp-panel-body{
	padding: var(--card-pad-y) var(--card-pad-x);
}
.spotify-root .sp-panel-foot{
	padding: calc(var(--card-pad-y) - .2rem) var(--card-pad-x);
	border-bottom-left-radius: var(--card-radius);
	border-bottom-right-radius: var(--card-radius);
}

/* Header layout polish */
.spotify-root .sp-panel-head .h6{ display:flex; align-items:center; gap:.5rem; }
.spotify-root .sp-panel-head .btn-group, 
.spotify-root .sp-panel-head .btn{ gap:.35rem; }
.spotify-root .btn-panel-action{ padding:.4rem .55rem; border-radius:8px; }

/* Drag handle visual refinement */
.spotify-root .sp-drag-handle{
	border-color: rgba(255,255,255,.12);
	color: var(--sp-txt-dim);
}
.spotify-root .sp-drag-handle:hover{ border-color: var(--sp-green); color:#fff; }
.spotify-root .sp-panel.dragging{ box-shadow: var(--card-shadow-hover); }

/* Card states */
.spotify-root .sp-panel.loading .sp-panel-body{ position:relative; }
.spotify-root .sp-panel.loading .loading-skeleton{ display:block; }
/* Default hidden; show when either panel or body is in loading state */
.spotify-root .sp-panel .loading-skeleton{ display:none; }
.spotify-root .sp-panel .sp-panel-body.loading .loading-skeleton{ display:block; }
.spotify-root .sp-panel .empty{ opacity:.85; }

/* Dense mode helper */
.spotify-root.compact .sp-panel-head{ padding: .6rem .75rem; }
.spotify-root.compact .sp-panel-body{ padding: .65rem .75rem; }
.spotify-root.compact .sp-panel-foot{ padding: .5rem .75rem; }


/* ======================= Desktop Masonry (gap fix) ======================= */
/*
	目標：
	- 修正桌面版 CSS Grid 同列等高導致的上下卡片間空白（row 高度由最高卡片決定）。
	- 在 >=992px 寬度時，改用多欄（columns）Masonry 流式排列，消除垂直空白；行動裝置維持原本單欄。
	- 僅以樣式覆蓋，不改 HTML 結構與 JS。
*/
@media (min-width: 992px) {
	/* 用 columns 取代 grid，讓不同高度的卡片能自然疊接，不留空洞 */
	.spotify-root .sp-layout {
		display: block !important;           /* 取消 grid 行為 */
		column-count: 3;                     /* 3 欄（小桌面） */
		column-gap: 1.3rem;                  /* 與原 grid gap 一致 */
	}

	/* 每個卡片（section）避免跨欄分割，並在欄內以區塊呈現 */
	.spotify-root .sp-layout > .sp-section {
		-webkit-column-break-inside: avoid;
		break-inside: avoid;                 /* 防止被切開 */
		page-break-inside: avoid;
		display: inline-block;               /* 讓元素在 column 中正確計寬 */
		width: 100%;
		margin: 0 0 1.3rem 0 !important;     /* 以下邊距模擬 grid gap */
		vertical-align: top;                 /* 避免 inline-block 基線縫隙 */
	}

	/* 移除桌面卡片內部固定高度，讓高度隨內容自適應 */
	.spotify-root .sp-panel-body {
		max-height: none !important;
		overflow: visible !important;
	}

	/* 僅列表型內容保留最大高度與滾動，避免極長清單撐爆版面 */
	.spotify-root .sp-panel[data-area="playlists"] .sp-panel-body,
	.spotify-root .sp-panel[data-area="tracks"] .sp-panel-body,
	.spotify-root .sp-panel[data-area="recent"] .sp-panel-body,
	.spotify-root .sp-panel[data-area="queue"] .sp-panel-body,
	.spotify-root .sp-panel[data-area="search"] .sp-panel-body {
		max-height: 460px !important;        /* 略高於行動版 */
		overflow: auto !important;
	}

	/* 在 columns 模式下，任何 grid 的跨欄設定無效，但確保不會殘留 sticky/定位影響排列 */
	.spotify-root .panel-player,
	.spotify-root .sp-layout [data-area="player"] {
		position: static !important;
		top: auto !important;
	}
}

@media (min-width: 1400px) {
	/* 更寬螢幕提高欄數，繼續保持 Masonry 流式排列 */
	.spotify-root .sp-layout {
		column-count: 4;                     /* 4 欄（大桌面） */
		column-gap: 1.5rem;
	}
	.spotify-root .sp-layout > .sp-section {
		margin-bottom: 1.5rem !important;
	}

	/* XL desktops: allow a bit larger but still restrained cover size */
	.spotify-root .sp-panel[data-area="playlists"] .playlist-item .cover,
	.spotify-root .sp-panel[data-area="tracks"] .track-item .cover,
	.spotify-root .sp-panel[data-area="recent"] .track-item .cover,
	.spotify-root .sp-panel[data-area="search"] #sp-search-results .search-item .cover {
		max-width: 180px;
	}
}


/* ======================= Content Card Grid (2025-08) ======================= */
/*
	 目標：
	 - 將面板內「內容項目」（播放清單/最近播放/收藏/搜尋）在桌機改為卡片格狀排列。
	 - 手機維持單欄直向列表，不破壞既有按鈕功能和事件綁定。
	 - 僅以 CSS 覆蓋既有 .playlist-item / .track-item 標記，無需調整模板或 JS。
*/

/* 容器：在對應面板上將 body 設為 Grid（>=576px 起生效） */
@media (min-width: 576px) {
	.spotify-root .sp-panel[data-area="playlists"] .sp-panel-body,
	.spotify-root .sp-panel[data-area="tracks"] .sp-panel-body,
	.spotify-root .sp-panel[data-area="recent"] .sp-panel-body,
	.spotify-root .sp-panel[data-area="search"] #sp-search-results {
		display: grid !important;
		grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)) !important;
		gap: 0.9rem !important;
		align-content: start;
	}
}

/* 卡片化：在 Grid 模式下讓每個項目轉成直式卡片 */
@media (min-width: 576px) {
	.spotify-root .sp-panel[data-area="playlists"] .playlist-item,
	.spotify-root .sp-panel[data-area="tracks"] .track-item,
	.spotify-root .sp-panel[data-area="recent"] .track-item,
	.spotify-root .sp-panel[data-area="search"] #sp-search-results .search-item {
		display: flex;
		flex-direction: column;
		align-items: stretch;
		gap: 0.55rem;
		background: rgba(255,255,255,0.02);
		border: 1px solid var(--sp-border);
		border-radius: 12px;
		padding: 0.7rem;
		transition: transform .15s ease, box-shadow .15s ease, border-color .15s ease;
	}

	.spotify-root .sp-panel[data-area="playlists"] .playlist-item:hover,
	.spotify-root .sp-panel[data-area="tracks"] .track-item:hover,
	.spotify-root .sp-panel[data-area="recent"] .track-item:hover,
	.spotify-root .sp-panel[data-area="search"] #sp-search-results .search-item:hover {
		background: rgba(29,185,84,0.06);
		border-color: rgba(255,255,255,0.12);
		box-shadow: 0 8px 24px rgba(0,0,0,0.25);
		transform: translateY(-1px);
	}

	/* 封面改為滿寬方形 */
	.spotify-root .sp-panel[data-area="playlists"] .playlist-item .cover,
	.spotify-root .sp-panel[data-area="tracks"] .track-item .cover,
	.spotify-root .sp-panel[data-area="recent"] .track-item .cover,
	.spotify-root .sp-panel[data-area="search"] #sp-search-results .search-item .cover {
		width: 100% !important;
		height: auto !important;
		aspect-ratio: 1 / 1;
		object-fit: cover;
		border-radius: 10px;
		background: #0d0d0d;
	}

	/* 文字排版與截斷（避免過長） */
	.spotify-root .sp-panel[data-area="playlists"] .playlist-item .fw-semibold,
	.spotify-root .sp-panel[data-area="tracks"] .track-item .fw-semibold,
	.spotify-root .sp-panel[data-area="recent"] .track-item .fw-semibold,
	.spotify-root .sp-panel[data-area="search"] #sp-search-results .search-item .fw-semibold {
		font-size: .95rem;
		line-height: 1.35;
		display: -webkit-box;
		line-clamp: 2;
		-webkit-line-clamp: 2;
		-webkit-box-orient: vertical;
		overflow: hidden;
	}

	.spotify-root .sp-panel[data-area="playlists"] .playlist-item .text-muted.small,
	.spotify-root .sp-panel[data-area="tracks"] .track-item .text-muted.small,
	.spotify-root .sp-panel[data-area="recent"] .track-item .text-muted.small,
	.spotify-root .sp-panel[data-area="search"] #sp-search-results .search-item .text-muted.small {
		display: -webkit-box;
		line-clamp: 1;
		-webkit-line-clamp: 1;
		-webkit-box-orient: vertical;
		overflow: hidden;
	}

	/* Search grid: section headers and the "Load more" row should span full width */
	.spotify-root .sp-panel[data-area="search"] #sp-search-results > .text-muted.small {
		grid-column: 1 / -1;
		margin-top: 0.5rem;
		margin-bottom: 0.25rem;
	}
	.spotify-root .sp-panel[data-area="search"] #sp-search-results > .d-grid {
		grid-column: 1 / -1;
	}
	.spotify-root .sp-panel[data-area="search"] #sp-search-results > .empty {
		grid-column: 1 / -1;
	}

	/* 控制按鈕群組置底對齊，移除左邊距（原本列表樣式會有 .ms-2） */
	.spotify-root .sp-panel[data-area="playlists"] .playlist-item .btn-group,
	.spotify-root .sp-panel[data-area="tracks"] .track-item .btn-group,
	.spotify-root .sp-panel[data-area="recent"] .track-item .btn-group,
	.spotify-root .sp-panel[data-area="search"] #sp-search-results .search-item .btn-group {
		margin-top: auto;
		align-self: stretch;
	}
	.spotify-root .sp-panel[data-area="playlists"] .playlist-item .ms-2,
	.spotify-root .sp-panel[data-area="tracks"] .track-item .ms-2 { margin-left: 0 !important; }

	/* 時長徽章移至副標籤行尾，保持卡片整潔 */
	.spotify-root .sp-panel[data-area="tracks"] .track-item > .text-muted.small,
	.spotify-root .sp-panel[data-area="recent"] .track-item > .text-muted.small {
		order: 3;
		opacity: .9;
	}
}

/* 大桌面卡片尺寸微調（更寬留白） */
@media (min-width: 1200px) {
	.spotify-root .sp-panel[data-area="playlists"] .sp-panel-body,
	.spotify-root .sp-panel[data-area="tracks"] .sp-panel-body,
	.spotify-root .sp-panel[data-area="recent"] .sp-panel-body,
	.spotify-root .sp-panel[data-area="search"] #sp-search-results {
		grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)) !important;
		gap: 1rem !important;
	}
}

/* Desktop card content layout (titles, meta, actions) */
@media (min-width: 992px) {
	/* Slightly roomier padding on desktop cards */
	.spotify-root .sp-panel[data-area="playlists"] .playlist-item,
	.spotify-root .sp-panel[data-area="tracks"] .track-item,
	.spotify-root .sp-panel[data-area="recent"] .track-item,
	.spotify-root .sp-panel[data-area="search"] #sp-search-results .search-item {
		padding: 0.9rem 0.9rem 0.85rem;
	}

	/* Desktop: reduce album cover size inside cards to avoid overly large images */
	.spotify-root .sp-panel[data-area="playlists"] .playlist-item .cover,
	.spotify-root .sp-panel[data-area="tracks"] .track-item .cover,
	.spotify-root .sp-panel[data-area="recent"] .track-item .cover,
	.spotify-root .sp-panel[data-area="search"] #sp-search-results .search-item .cover {
		width: 70% !important;         /* smaller than full width in desktop */
		max-width: 160px;              /* cap size for large columns */
		height: auto !important;
		aspect-ratio: 1 / 1;           /* keep square album art */
		object-fit: cover;
		margin-left: auto;             /* center horizontally */
		margin-right: auto;
		border-radius: 10px;
	}

	/* Title block min-height for consistent rows across cards */
	.spotify-root .sp-panel[data-area="playlists"] .playlist-item .flex-grow-1,
	.spotify-root .sp-panel[data-area="tracks"] .track-item .flex-grow-1,
	.spotify-root .sp-panel[data-area="recent"] .track-item .flex-grow-1,
	.spotify-root .sp-panel[data-area="search"] #sp-search-results .search-item .flex-grow-1 {
		min-height: 2.6em; /* roughly two lines */
	}

	/* Keep duration/meta after the title, align to end for tidy baseline */
	.spotify-root .sp-panel[data-area="tracks"] .track-item > .text-muted.small,
	.spotify-root .sp-panel[data-area="recent"] .track-item > .text-muted.small {
		order: 3;
		align-self: flex-end;
		margin-top: .25rem;
	}

	/* Actions row should span full width at the bottom; supports owner (.btn-group) and viewer (.ms-2) */
	.spotify-root .sp-panel[data-area="playlists"] .playlist-item > .btn-group,
	.spotify-root .sp-panel[data-area="tracks"] .track-item > .btn-group,
	.spotify-root .sp-panel[data-area="recent"] .track-item > .btn-group,
	.spotify-root .sp-panel[data-area="search"] #sp-search-results .search-item > .btn-group,
	.spotify-root .sp-panel[data-area="playlists"] .playlist-item > .ms-2,
	.spotify-root .sp-panel[data-area="tracks"] .track-item > .ms-2,
	.spotify-root .sp-panel[data-area="recent"] .track-item > .ms-2,
	.spotify-root .sp-panel[data-area="search"] #sp-search-results .search-item > .ms-2 {
		order: 4;
		width: 100%;
		margin-top: .5rem;
		display: flex;
		justify-content: flex-end;
		gap: .4rem;
		align-self: stretch;
	}

	/* Remove leftover left margin from list-mode */
	.spotify-root .sp-panel[data-area="playlists"] .playlist-item > .ms-2,
	.spotify-root .sp-panel[data-area="tracks"] .track-item > .ms-2,
	.spotify-root .sp-panel[data-area="recent"] .track-item > .ms-2 {
		margin-left: 0 !important;
	}
}


