/* MusicTV Studio 2.0 — Single Source of Truth Design System (ZERO !important hacks!) */
:root {
  --ms-bg: #06090f;
  --ms-surface: rgba(10, 14, 22, 0.44);
  --ms-surface-strong: rgba(12, 16, 26, 0.64);
  --ms-border: rgba(255, 255, 255, 0.11);
  --ms-text: #f8fafc;
  --ms-text-muted: rgba(255, 255, 255, 0.66);
  --ms-accent: #2dd4bf;
  --ms-gold: #f5b938;
  --ms-radius-card: 22px;
  --ms-radius-tile: 16px;
  --ms-safe-top: max(0px, env(safe-area-inset-top, 0px), var(--ms-native-safe-top, 0px));
  --ms-safe-bottom: max(0px, env(safe-area-inset-bottom, 0px), var(--ms-native-safe-bottom, 0px));
  --ms-sidebar-w: 248px;
  --ms-metal-skin-url: url("../../assets/lyric-plate-gold.jpg");
  --ms-metal-flip: none;
  --ms-metal-flip-left: none;
  --ms-metal-flip-right: none;
}

*, *::before, *::after { box-sizing: border-box; }
html, body {
  margin: 0; padding: 0;
  width: 100%; height: 100dvh; overflow: hidden;
  background: var(--ms-bg); color: var(--ms-text);
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Noto Sans SC", "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
  user-select: none;
}
button, input { font-family: inherit; }
.is-hidden { display: none !important; }

/* Global Fixed Brushed Metal Backdrop */
#msViewportBackdrop {
  position: fixed; inset: 0; z-index: 0; pointer-events: none;
  background-color: var(--ms-bg);
  background-image: linear-gradient(180deg, rgba(6, 9, 15, 0.30), rgba(6, 9, 15, 0.46)), var(--ms-metal-skin-url);
  background-size: cover; background-position: center center;
  transform: var(--ms-metal-flip);
  transition: transform 0.24s ease;
}
html:not(.ms-metal-skin-on) #msViewportBackdrop {
  background-image: none; background-color: #000000;
}

/* Unique App Shell */
.ms-shell {
  position: relative; z-index: 1;
  display: flex; width: 100%; height: 100dvh; overflow: hidden;
}

/* Desktop Left Sidebar */
.ms-desktop-sidebar {
  display: none;
  position: relative; isolation: isolate; overflow-y: auto;
  width: var(--ms-sidebar-w); flex-shrink: 0;
  border-right: 1px solid var(--ms-border);
  padding: 18px 12px 24px;
  flex-direction: column; gap: 6px;
}
.ms-desktop-sidebar::before {
  content: ''; position: absolute; inset: 0; z-index: -1; pointer-events: none;
  background-image: linear-gradient(180deg, rgba(6, 9, 15, 0.44), rgba(6, 9, 15, 0.62)), var(--ms-metal-skin-url);
  background-size: cover; background-position: center;
  transform: var(--ms-metal-flip-left);
}
html:not(.ms-metal-skin-on) .ms-desktop-sidebar::before { background-image: none; background: #05070c; }
@media (min-width: 768px) {
  .ms-desktop-sidebar { display: flex; }
}
.ms-brand {
  display: flex; align-items: center; gap: 11px;
  padding: 4px 10px 14px; border-bottom: 1px solid var(--ms-border); margin-bottom: 6px;
}
.ms-brand-logo {
  width: 38px; height: 38px; border-radius: 12px; object-fit: cover;
  border: 1px solid rgba(45, 212, 191, 0.35);
}
.ms-side-btn {
  width: 100%; display: flex; align-items: center; gap: 12px;
  padding: 11px 14px; border-radius: 14px; border: 1px solid transparent;
  background: transparent; color: rgba(255, 255, 255, 0.82);
  font-size: 14px; font-weight: 600; cursor: pointer; text-align: left;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.ms-side-btn:hover { background: rgba(255, 255, 255, 0.06); color: #ffffff; }
.ms-side-btn.is-active {
  background: rgba(45, 212, 191, 0.16); color: #5eead4;
  border-color: rgba(45, 212, 191, 0.28);
}
.ms-side-btn i { width: 18px; text-align: center; font-size: 15px; }

/* Central Stage */
.ms-main {
  position: relative; flex: 1; min-width: 0; height: 100dvh;
  display: flex; flex-direction: column; overflow: hidden;
}

/* Transparent Floating Top Header */
.ms-top-header {
  position: absolute; top: 0; left: 0; right: 0; z-index: 30;
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: calc(6px + var(--ms-safe-top)) 14px 6px;
  min-height: calc(50px + var(--ms-safe-top));
  background: transparent;
  pointer-events: none;
}
.ms-top-header > * { pointer-events: auto; }
.ms-top-left { display: flex; align-items: center; gap: 6px; min-width: 0; }
.ms-icon-btn {
  width: 40px; height: 40px; border-radius: 999px; border: none;
  background: transparent; color: #ffffff; font-size: 19px;
  display: inline-flex; align-items: center; justify-content: center;
  cursor: pointer; text-shadow: 0 1px 8px rgba(0, 0, 0, 0.78);
  transition: background 0.14s, transform 0.12s;
}
.ms-icon-btn:hover { background: rgba(255, 255, 255, 0.10); }
.ms-icon-btn:active { transform: scale(0.92); }
.ms-dynamic-title {
  display: inline-flex; align-items: center; gap: 6px;
  background: transparent; border: none; color: #ffffff;
  font-size: 16.5px; font-weight: 800; letter-spacing: 0.2px;
  cursor: pointer; padding: 4px 6px; max-width: 58vw;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  text-shadow: 0 1px 8px rgba(0, 0, 0, 0.8);
}

/* Scrollable View Container (Pixel Curved-Screen Golden Rules) */
.ms-view-scroll {
  flex: 1; min-height: 0; overflow-y: auto; overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  padding: calc(58px + var(--ms-safe-top)) 12px 215px;
}
@media (max-width: 767px) {
  .ms-view-scroll { scrollbar-width: none; -ms-overflow-style: none; }
  .ms-view-scroll::-webkit-scrollbar { display: none; width: 0; height: 0; }
}
@media (min-width: 768px) {
  .ms-view-scroll { padding: calc(58px + var(--ms-safe-top)) 28px 185px; }
}
.ms-view-root {
  width: 100%; max-width: 1040px; margin: 0 auto;
}

/* Home View: Full-Bleed Top Hero Banner (Block 1) */
.ms-hero-banner {
  position: relative;
  margin-top: calc(-58px - var(--ms-safe-top));
  min-height: 256px;
  border-radius: 0 0 var(--ms-radius-card) var(--ms-radius-card);
  overflow: hidden;
  border-bottom: 1px solid var(--ms-border);
  box-shadow: 0 14px 36px rgba(0, 0, 0, 0.42);
}
@media (max-width: 767px) {
  .ms-hero-banner {
    margin-left: -12px; margin-right: -12px;
    width: 100vw; max-width: 100vw;
  }
}
.ms-swipe-track {
  display: flex; width: 100%; height: 100%;
  overflow-x: auto; scroll-snap-type: x mandatory; scroll-behavior: smooth;
  -webkit-overflow-scrolling: touch; scrollbar-width: none;
}
.ms-swipe-track::-webkit-scrollbar { display: none; }
.ms-hero-slide {
  flex: 0 0 100%; width: 100%; min-height: 256px;
  scroll-snap-align: start; scroll-snap-stop: always; position: relative;
}
.ms-hero-slide img {
  width: 100%; height: 100%; object-fit: cover; display: block;
  transform: var(--ms-metal-flip);
}
.ms-dots-pill {
  position: absolute; z-index: 6; display: flex; align-items: center; gap: 6px;
  padding: 4px 8px; border-radius: 999px;
  background: rgba(0, 0, 0, 0.30); backdrop-filter: blur(6px);
}
.ms-dot {
  width: 6px; height: 6px; border-radius: 999px; border: none; padding: 0;
  background: rgba(255, 255, 255, 0.42); cursor: pointer;
  transition: width 0.16s, background 0.16s;
}
.ms-dot.is-on { width: 16px; background: #ffffff; }

/* Home View: Center Cover Showcase Card (Block 2) */
.ms-cover-showcase {
  position: relative; width: 100%; max-width: 460px; margin: 12px auto;
  aspect-ratio: 1 / 1; max-height: 52vh;
  border-radius: var(--ms-radius-card); overflow: hidden;
  background: var(--ms-surface-strong);
  box-shadow: 0 18px 42px rgba(0, 0, 0, 0.46);
  cursor: pointer; transition: transform 0.18s ease;
}
.ms-cover-showcase:active { transform: scale(0.985); }
.ms-cover-showcase img { width: 100%; height: 100%; object-fit: cover; display: block; }
.ms-cover-scrim {
  position: absolute; inset: auto 0 0 0; padding: 30px 16px 14px;
  background: linear-gradient(to top, rgba(0,0,0,0.82), rgba(0,0,0,0.32) 55%, transparent);
  display: flex; align-items: flex-end; justify-content: space-between; gap: 10px;
}

/* Home View: Bottom 5-Plate Swipeable Metallic Lyrics Backdrop (Block 3) */
.ms-lyrics-plate-wrap {
  position: relative; width: 100%; max-width: 460px; margin: 12px auto 16px;
  border-radius: var(--ms-radius-card); overflow: hidden;
  box-shadow: 0 14px 36px rgba(0, 0, 0, 0.42);
}
@media (max-width: 767px) {
  .ms-lyrics-plate-wrap {
    margin-left: -12px; margin-right: -12px;
    width: 100vw; max-width: 100vw;
  }
}
.ms-plate-slide {
  flex: 0 0 100%; width: 100%;
  aspect-ratio: 3 / 2; min-height: 268px; max-height: 330px;
  scroll-snap-align: start; scroll-snap-stop: always; overflow: hidden;
}
.ms-plate-slide img {
  width: 100%; height: 100%; object-fit: cover; display: block;
  transform: var(--ms-metal-flip);
}

/* Home View: Clean 9-Chart Grid */
.ms-chart-grid-9 {
  display: grid; grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 9px; max-width: 760px; margin: 14px auto 22px;
}
.ms-chart-tile {
  min-height: 62px; padding: 12px 8px; border-radius: var(--ms-radius-tile);
  background: var(--ms-surface); border: 1px solid var(--ms-border);
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  color: rgba(255, 255, 255, 0.94); font-size: 14px; font-weight: 700; letter-spacing: 0.5px;
  cursor: pointer; display: flex; align-items: center; justify-content: center;
  transition: background 0.14s, transform 0.12s, border-color 0.14s;
}
.ms-chart-tile:hover { background: rgba(255, 255, 255, 0.10); border-color: rgba(45, 212, 191, 0.35); }
.ms-chart-tile:active { transform: scale(0.96); }

/* Home View: Vertical Full-Size HD Featured Playlists */
.ms-section-head {
  max-width: 460px; margin: 18px auto 12px;
  display: flex; align-items: center; justify-content: space-between;
  font-size: 15px; font-weight: 800; color: #f8fafc;
}
.ms-playlist-feed {
  display: flex; flex-direction: column; align-items: center; gap: 16px;
}
.ms-pl-card {
  position: relative; width: 100%; max-width: 460px;
  aspect-ratio: 1 / 1; max-height: 52vh;
  border-radius: var(--ms-radius-card); overflow: hidden;
  background: var(--ms-surface); border: 1px solid var(--ms-border);
  box-shadow: 0 16px 38px rgba(0, 0, 0, 0.42); cursor: pointer;
}
.ms-pl-card img { width: 100%; height: 100%; object-fit: cover; display: block; transition: opacity 0.3s ease; }
.ms-pl-card img.is-placeholder { opacity: 0; }
.ms-pl-badge {
  position: absolute; top: 12px; right: 12px;
  padding: 3px 9px; border-radius: 999px;
  background: rgba(0, 0, 0, 0.55); backdrop-filter: blur(6px);
  font-size: 11px; font-family: ui-monospace, monospace; color: #e2e8f0;
}

/* Smoked-Glass Cards, Track Rows, Pixel Tiles */
.ms-card {
  background: var(--ms-surface); border: 1px solid var(--ms-border);
  border-radius: 18px; backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
}
.ms-track-row {
  display: flex; align-items: center; gap: 12px; padding: 10px 12px;
  border-radius: 14px; cursor: pointer; transition: background 0.14s;
}
.ms-track-row:hover { background: rgba(255, 255, 255, 0.07); }
.ms-track-row.is-playing { background: rgba(45, 212, 191, 0.14); }
.ms-track-thumb {
  width: 44px; height: 44px; border-radius: 10px; object-fit: cover;
  background: rgba(255,255,255,0.06); flex-shrink: 0;
}

/* Google Pixel Quick Settings Toggle Tile */
.ms-px-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px; }
.ms-px-tile {
  display: flex; align-items: center; gap: 11px; padding: 11px 13px;
  border-radius: 20px; cursor: pointer; text-align: left;
  background: var(--ms-surface); border: 1px solid var(--ms-border);
  backdrop-filter: blur(8px); transition: all 0.15s;
}
.ms-px-tile.is-on { background: rgba(27, 34, 48, 0.72); border-color: rgba(255, 255, 255, 0.24); }
.ms-px-ico {
  width: 36px; height: 36px; border-radius: 14px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center; font-size: 14px;
  background: rgba(255, 255, 255, 0.08); color: #94a3b8;
}
.ms-px-tile.is-on .ms-px-ico { background: #ffffff; color: #090d16; }

/* Skin Swatch Picker */
.ms-skin-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
@media (min-width: 640px) { .ms-skin-grid { grid-template-columns: repeat(6, minmax(0, 1fr)); } }
.ms-skin-swatch {
  position: relative; aspect-ratio: 3 / 2; border-radius: 12px; overflow: hidden;
  border: 2px solid rgba(255, 255, 255, 0.14); padding: 0; cursor: pointer; background: #000;
}
.ms-skin-swatch.is-active { border-color: var(--ms-accent); box-shadow: 0 0 0 1px rgba(45, 212, 191, 0.45); }
.ms-skin-swatch img { width: 100%; height: 100%; object-fit: cover; display: block; transform: var(--ms-metal-flip); }
.ms-skin-lbl {
  position: absolute; inset: auto 0 0 0; padding: 4px 4px 3px;
  background: linear-gradient(to top, rgba(0,0,0,0.8), transparent);
  color: #fff; font-size: 10px; font-weight: 700; text-align: center;
}
.ms-dir-btn {
  flex: 1; padding: 6px 6px; border-radius: 10px; border: 1px solid var(--ms-border);
  background: rgba(255,255,255,0.06); color: #cbd5e1; font-size: 11px; font-weight: 700; cursor: pointer;
}
.ms-dir-btn.is-active { background: #ffffff; color: #090d16; border-color: #ffffff; }

/* Transparent Floating Bottom Dock (Lyrics + Player + Mobile 4-Tab Nav) */
.ms-bottom-dock {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 40;
  display: flex; flex-direction: column;
  background: transparent; pointer-events: none;
}
@media (min-width: 768px) { .ms-bottom-dock { left: var(--ms-sidebar-w); } }
.ms-bottom-dock > * { pointer-events: auto; }

.ms-lyrics-strip {
  padding: 4px 16px 2px; text-align: center; cursor: pointer;
}
.ms-lrc-main {
  font-size: 14px; font-weight: 800; color: rgba(255,255,255,0.96);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  text-shadow: 0 1px 8px rgba(0,0,0,0.9);
}
.ms-lrc-sub {
  font-size: 12px; font-weight: 600; color: rgba(255,255,255,0.72);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-height: 16px;
  text-shadow: 0 1px 6px rgba(0,0,0,0.85);
}

.ms-player-bar {
  padding: 6px 14px 4px; display: flex; flex-direction: column; gap: 6px;
}
.ms-player-top {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
}
.ms-player-meta { display: flex; align-items: center; gap: 10px; min-width: 0; flex: 1; cursor: pointer; }
.ms-player-thumb { width: 42px; height: 42px; border-radius: 10px; object-fit: cover; flex-shrink: 0; }
.ms-player-controls { display: flex; align-items: center; justify-content: center; gap: 18px; }
.ms-play-circle {
  width: 42px; height: 42px; border-radius: 999px; border: none;
  background: var(--ms-gold); color: #090d16; font-size: 15px;
  display: inline-flex; align-items: center; justify-content: center;
  cursor: pointer; box-shadow: 0 6px 18px rgba(245, 185, 56, 0.35);
}
.ms-ctrl-ico {
  background: transparent; border: none; color: rgba(255,255,255,0.9);
  font-size: 16px; cursor: pointer; padding: 6px;
  text-shadow: 0 1px 6px rgba(0,0,0,0.85);
}
.ms-prog-row {
  display: flex; align-items: center; gap: 8px; font-size: 10.5px;
  font-family: ui-monospace, monospace; color: rgba(255,255,255,0.78);
  text-shadow: 0 1px 4px rgba(0,0,0,0.85);
}
.ms-prog-track {
  flex: 1; height: 4px; border-radius: 999px; background: rgba(255,255,255,0.22);
  position: relative; cursor: pointer; overflow: hidden;
}
.ms-prog-fill {
  height: 100%; width: 0%; border-radius: 999px;
  background: linear-gradient(90deg, var(--ms-gold), var(--ms-accent));
}

/* Mobile 4-Tab Bottom Navigation */
.ms-mobile-nav {
  display: grid; grid-template-columns: repeat(4, minmax(0, 1fr));
  padding: 6px 4px calc(6px + var(--ms-safe-bottom));
}
@media (min-width: 768px) { .ms-mobile-nav { display: none; } }
.ms-mob-btn {
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  background: transparent; border: none; color: rgba(255,255,255,0.88);
  cursor: pointer; padding: 3px 0; text-shadow: 0 1px 6px rgba(0,0,0,0.92);
}
.ms-mob-btn i { font-size: 18px; filter: drop-shadow(0 1px 4px rgba(0,0,0,0.85)); }
.ms-mob-btn span { font-size: 11px; font-weight: 700; }
.ms-mob-btn.is-active { color: #ffffff; }
.ms-mob-btn.is-active i { color: var(--ms-accent); filter: drop-shadow(0 0 8px rgba(45,212,191,0.55)); }

/* Collapsed Transparent Icon-Only Pill */
.ms-collapsed-pill {
  position: fixed; right: 14px; bottom: calc(66px + var(--ms-safe-bottom)); z-index: 50;
  display: flex; align-items: center; gap: 8px;
}
@media (min-width: 768px) { .ms-collapsed-pill { bottom: 20px; } }

/* Left Drawer */
.ms-drawer-overlay {
  position: fixed; inset: 0; z-index: 70; background: rgba(0,0,0,0.55);
}
.ms-drawer-panel {
  position: relative; isolation: isolate;
  width: 296px; max-width: 84vw; height: 100%; overflow-y: auto;
  padding: calc(16px + var(--ms-safe-top)) 16px calc(20px + var(--ms-safe-bottom));
  border-right: 1px solid var(--ms-border);
  display: flex; flex-direction: column; gap: 12px;
}
.ms-drawer-panel::before {
  content: ''; position: absolute; inset: 0; z-index: -1; pointer-events: none;
  background-image: linear-gradient(180deg, rgba(6, 9, 15, 0.44), rgba(6, 9, 15, 0.62)), var(--ms-metal-skin-url);
  background-size: cover; background-position: center;
  transform: var(--ms-metal-flip-left);
}
html:not(.ms-metal-skin-on) .ms-drawer-panel::before { background-image: none; background: #000; }

/* Fullscreen Immersive Player */
.ms-fs-player {
  position: fixed; inset: 0; z-index: 80; isolation: isolate;
  display: flex; flex-direction: column; overflow: hidden;
  padding: var(--ms-safe-top) 0 var(--ms-safe-bottom);
  background: var(--ms-bg);
}
.ms-fs-player::before {
  content: ''; position: absolute; inset: 0; z-index: -1; pointer-events: none;
  background-image: linear-gradient(180deg, rgba(6, 9, 15, 0.30), rgba(6, 9, 15, 0.48)), var(--ms-metal-skin-url);
  background-size: cover; background-position: center;
  transform: var(--ms-metal-flip);
}
html:not(.ms-metal-skin-on) .ms-fs-player::before { background-image: none; background: #030712; }
.ms-fs-body {
  flex: 1; min-height: 0; display: grid; grid-template-columns: 1fr;
  align-items: center; gap: 16px; padding: 12px 20px; overflow: hidden;
}
@media (min-width: 860px) { .ms-fs-body { grid-template-columns: 1fr 1.15fr; padding: 16px 48px; } }
.ms-vinyl-disc {
  width: min(260px, 64vw); aspect-ratio: 1 / 1; margin: 0 auto; border-radius: 999px;
  background: radial-gradient(circle, #111 32%, #1d222b 34%, #0b0d12 46%, #181c24 58%, #07090d 72%);
  border: 2px solid rgba(245, 185, 56, 0.42);
  box-shadow: 0 22px 54px rgba(0, 0, 0, 0.65);
  display: flex; align-items: center; justify-content: center;
  animation: msSpin 22s linear infinite; animation-play-state: paused;
}
.ms-vinyl-disc.is-spinning { animation-play-state: running; }
.ms-vinyl-disc img { width: 46%; height: 46%; border-radius: 999px; object-fit: cover; border: 2px solid rgba(255,255,255,0.22); }
@keyframes msSpin { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }

.ms-fs-lyrics {
  height: 100%; max-height: 44vh; overflow-y: auto; text-align: center;
  padding: 28% 8px; scrollbar-width: none;
}
@media (min-width: 860px) { .ms-fs-lyrics { max-height: 68vh; } }
.ms-fs-lyrics::-webkit-scrollbar { display: none; }
.ms-fs-lrc-line {
  padding: 9px 6px; color: rgba(255,255,255,0.48); font-size: 15px; line-height: 1.5;
  cursor: pointer; transition: color 0.2s, transform 0.2s;
}
.ms-fs-lrc-line.is-active {
  color: #ffffff; font-size: 18px; font-weight: 800; transform: scale(1.03);
}
.ms-fs-lrc-trans { font-size: 13px; color: rgba(255,255,255,0.62); margin-top: 2px; font-weight: 500; }

/* Toast */
.ms-toast-host {
  position: fixed; top: calc(60px + var(--ms-safe-top)); left: 50%; transform: translateX(-50%);
  z-index: 100; display: flex; flex-direction: column; gap: 6px; pointer-events: none;
}
.ms-toast {
  padding: 8px 16px; border-radius: 999px; font-size: 12.5px; font-weight: 700;
  background: rgba(10, 14, 22, 0.88); color: #f8fafc;
  border: 1px solid rgba(45, 212, 191, 0.42); backdrop-filter: blur(10px);
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.45);
}
