/* ==========================================================================
   旋律管家 · Melody Concierge
   個人智能音樂客服 Agent — Design System
   ========================================================================== */

:root {
  /* Brand */
  --brand-1: #5b2bc9;
  --brand-2: #4a3fd8;
  --brand-3: #16a8c9;
  --brand-4: #16e0bd;
  --brand-grad: linear-gradient(118deg, #5b2bc9 0%, #4340d4 42%, #1a95cd 100%);
  --brand-grad-soft: linear-gradient(118deg, rgba(91, 43, 201, 0.10) 0%, rgba(22, 224, 189, 0.12) 100%);
  --brand-glow: 0 8px 28px -8px rgba(91, 43, 201, 0.45);

  /* Neutrals (light) */
  --bg: #f5f3fb;
  --bg-elev: #ffffff;
  --bg-sunken: #efecf8;
  --bg-hover: #f2eefc;
  --border: #e6e1f4;
  --border-strong: #d5cdea;

  --text: #1b1533;
  --text-2: #4a4270;
  --text-3: #7d76a0;
  --text-inv: #ffffff;

  /* Semantic */
  --ok: #0e9f6e;
  --warn: #d97706;
  --err: #dc2626;
  --info: #2563eb;

  --radius-xs: 8px;
  --radius-sm: 12px;
  --radius: 16px;
  --radius-lg: 22px;
  --radius-xl: 28px;
  --radius-full: 999px;

  --shadow-xs: 0 1px 2px rgba(27, 21, 51, 0.06);
  --shadow-sm: 0 2px 8px rgba(27, 21, 51, 0.07);
  --shadow: 0 8px 24px -6px rgba(27, 21, 51, 0.12);
  --shadow-lg: 0 18px 48px -12px rgba(27, 21, 51, 0.20);
  --shadow-xl: 0 28px 72px -18px rgba(27, 21, 51, 0.28);

  --header-h: 64px;
  --player-h: 84px;
  --sidebar-w: 236px;
  --max-w: 1240px;

  --font: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang TC",
    "PingFang SC", "Hiragino Sans GB", "Microsoft JhengHei", "Microsoft YaHei",
    "Noto Sans TC", "Noto Sans SC", "Helvetica Neue", Arial, sans-serif;
  --font-mono: "SFMono-Regular", ui-monospace, "Cascadia Mono", Consolas, monospace;

  --ease: cubic-bezier(0.32, 0.72, 0, 1);
  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
}

/* Dark theme ------------------------------------------------------------- */
html[data-theme="dark"] {
  --bg: #0e0b18;
  --bg-elev: #171327;
  --bg-sunken: #0a0813;
  --bg-hover: #221b3a;
  --border: #2c2447;
  --border-strong: #3d3360;

  --text: #f2efff;
  --text-2: #b9b0dd;
  --text-3: #837aa8;

  --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.4);
  --shadow-sm: 0 2px 10px rgba(0, 0, 0, 0.45);
  --shadow: 0 10px 30px -8px rgba(0, 0, 0, 0.6);
  --shadow-lg: 0 20px 52px -12px rgba(0, 0, 0, 0.72);
  --shadow-xl: 0 30px 80px -20px rgba(0, 0, 0, 0.85);
  --brand-grad-soft: linear-gradient(118deg, rgba(91, 43, 201, 0.26) 0%, rgba(22, 224, 189, 0.16) 100%);
}

/* Reset ------------------------------------------------------------------ */
*, *::before, *::after { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.55;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overscroll-behavior-y: none;
  text-rendering: optimizeLegibility;
}
h1, h2, h3, h4, h5, p, figure { margin: 0; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; border: none; background: none; }
a { color: var(--brand-1); text-decoration: none; }
img { display: block; max-width: 100%; }
ul, ol { margin: 0; padding: 0; list-style: none; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--brand-2); outline-offset: 2px; border-radius: 6px; }

::selection { background: rgba(91, 43, 201, 0.22); }

/* Scrollbars ------------------------------------------------------------- */
* { scrollbar-width: thin; scrollbar-color: var(--border-strong) transparent; }
*::-webkit-scrollbar { width: 10px; height: 10px; }
*::-webkit-scrollbar-track { background: transparent; }
*::-webkit-scrollbar-thumb {
  background: var(--border-strong);
  border-radius: 99px;
  border: 3px solid transparent;
  background-clip: content-box;
}
*::-webkit-scrollbar-thumb:hover { background: var(--text-3); background-clip: content-box; }

/* ==========================================================================
   Splash
   ========================================================================== */
.splash {
  position: fixed; inset: 0; z-index: 9000;
  display: grid; place-items: center;
  background: var(--brand-grad);
  transition: opacity 0.55s var(--ease), visibility 0.55s;
}
.splash.is-gone { opacity: 0; visibility: hidden; pointer-events: none; }
.splash-inner { text-align: center; }
.splash-logo {
  width: 108px; height: 108px; margin: 0 auto 20px;
  border-radius: 30px; overflow: hidden;
  box-shadow: 0 24px 60px -14px rgba(0, 0, 0, 0.5);
  animation: splashPop 0.85s var(--ease-out) both;
}
.splash-logo img { width: 100%; height: 100%; object-fit: contain; }
.splash-title {
  font-size: 25px; font-weight: 750; letter-spacing: 0.08em;
  color: #fff; animation: splashUp 0.7s 0.16s var(--ease-out) both;
}
.splash-sub {
  margin-top: 8px; font-size: 12.5px; letter-spacing: 0.28em;
  color: rgba(255, 255, 255, 0.78);
  animation: splashUp 0.7s 0.28s var(--ease-out) both;
}
.splash-bar {
  width: 148px; height: 3px; margin: 30px auto 0;
  background: rgba(255, 255, 255, 0.24); border-radius: 9px; overflow: hidden;
}
.splash-bar span {
  display: block; width: 40%; height: 100%; border-radius: 9px;
  background: #fff; animation: splashSlide 1.05s var(--ease) infinite;
}
@keyframes splashPop { from { opacity: 0; transform: scale(0.72) translateY(14px); } }
@keyframes splashUp { from { opacity: 0; transform: translateY(12px); } }
@keyframes splashSlide {
  0% { transform: translateX(-115%); }
  100% { transform: translateX(300%); }
}

/* ==========================================================================
   App shell
   ========================================================================== */
.app {
  min-height: 100dvh;
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  grid-template-rows: 1fr;
  padding-bottom: var(--player-h);
}

/* Sidebar ---------------------------------------------------------------- */
.sidebar {
  position: sticky; top: 0; align-self: start;
  height: 100dvh;
  display: flex; flex-direction: column;
  background: var(--bg-elev);
  border-right: 1px solid var(--border);
  padding: 18px 14px;
  z-index: 60;
}
.brand { display: flex; align-items: center; gap: 11px; padding: 4px 8px 20px; }
.brand-mark {
  width: 42px; height: 42px; border-radius: 13px; flex: none;
  overflow: hidden; box-shadow: var(--brand-glow);
}
.brand-mark img { width: 100%; height: 100%; object-fit: contain; }
.brand-text { min-width: 0; }
.brand-name {
  font-size: 15.5px; font-weight: 750; letter-spacing: 0.02em;
  white-space: nowrap;
}
.brand-tag {
  font-size: 10.5px; color: var(--text-3); letter-spacing: 0.16em;
  white-space: nowrap;
}

.nav { display: flex; flex-direction: column; gap: 3px; }
.nav-group-label {
  padding: 16px 12px 6px; font-size: 10.5px; font-weight: 700;
  letter-spacing: 0.14em; color: var(--text-3); text-transform: uppercase;
}
.nav-item {
  display: flex; align-items: center; gap: 11px;
  padding: 10px 12px; border-radius: var(--radius-sm);
  color: var(--text-2); font-size: 14px; font-weight: 600;
  transition: background 0.16s, color 0.16s;
  text-align: left; width: 100%;
}
.nav-item:hover { background: var(--bg-hover); color: var(--text); }
.nav-item.is-active { background: var(--brand-grad-soft); color: var(--brand-1); }
html[data-theme="dark"] .nav-item.is-active { color: #c9b9ff; }
.nav-item svg { width: 19px; height: 19px; flex: none; }
.nav-item .nav-badge {
  margin-left: auto; font-size: 11px; font-weight: 700;
  background: var(--brand-grad); color: #fff;
  padding: 1px 8px; border-radius: var(--radius-full); min-width: 22px; text-align: center;
}
.sidebar-foot { margin-top: auto; padding-top: 14px; }
.sidebar-card {
  background: var(--brand-grad-soft);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 13px 14px;
  font-size: 12px; color: var(--text-2);
}
.sidebar-card b { color: var(--text); font-size: 12.5px; display: block; margin-bottom: 3px; }
.sidebar-card .meter {
  height: 5px; background: var(--bg-sunken); border-radius: 99px;
  overflow: hidden; margin: 9px 0 6px;
}
.sidebar-card .meter i {
  display: block; height: 100%; background: var(--brand-grad);
  border-radius: 99px; transition: width 0.4s var(--ease);
}

/* Main ------------------------------------------------------------------- */
.main { min-width: 0; display: flex; flex-direction: column; }

.topbar {
  position: sticky; top: 0; z-index: 50;
  height: var(--header-h);
  display: flex; align-items: center; gap: 12px;
  padding: 0 clamp(14px, 3vw, 30px);
  background: color-mix(in srgb, var(--bg) 84%, transparent);
  backdrop-filter: saturate(1.7) blur(18px);
  -webkit-backdrop-filter: saturate(1.7) blur(18px);
  border-bottom: 1px solid var(--border);
}
.topbar-logo {
  width: 30px; height: 30px; border-radius: 9px; display: none; flex: none;
}
.topbar-logo img { width: 100%; height: 100%; object-fit: contain; }

.searchbox {
  flex: 1; max-width: 560px; position: relative;
  display: flex; align-items: center;
}
.searchbox svg.ico {
  position: absolute; left: 13px; width: 17px; height: 17px;
  color: var(--text-3); pointer-events: none;
}
.searchbox input {
  width: 100%; height: 42px;
  padding: 0 84px 0 39px;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius-full);
  font-size: 14px;
  transition: border-color 0.18s, box-shadow 0.18s, background 0.18s;
}
.searchbox input::placeholder { color: var(--text-3); }
.searchbox input:focus {
  outline: none; border-color: var(--brand-2);
  box-shadow: 0 0 0 4px rgba(91, 43, 201, 0.13);
}
.searchbox .search-go {
  position: absolute; right: 5px; height: 32px; padding: 0 15px;
  border-radius: var(--radius-full); background: var(--brand-grad);
  color: #fff; font-size: 13px; font-weight: 650;
  box-shadow: var(--brand-glow);
  transition: transform 0.15s, filter 0.15s;
}
.searchbox .search-go:hover { transform: translateY(-1px); filter: brightness(1.07); }
.searchbox .search-go:active { transform: translateY(0); }

.topbar-actions { margin-left: auto; display: flex; align-items: center; gap: 7px; }

.icon-btn {
  width: 38px; height: 38px; border-radius: 12px;
  display: grid; place-items: center;
  color: var(--text-2);
  transition: background 0.16s, color 0.16s, transform 0.16s;
  position: relative; flex: none;
}
.icon-btn:hover { background: var(--bg-hover); color: var(--text); }
.icon-btn:active { transform: scale(0.94); }
.icon-btn svg { width: 20px; height: 20px; }
.icon-btn .dot {
  position: absolute; top: 7px; right: 7px;
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--err); border: 2px solid var(--bg-elev);
}
.btn-menu { display: none; }

.view {
  flex: 1;
  padding: clamp(18px, 3vw, 32px) clamp(14px, 3vw, 30px) 40px;
  max-width: var(--max-w); width: 100%; margin: 0 auto;
}
.view[hidden] { display: none; }

/* ==========================================================================
   Common components
   ========================================================================== */
.page-head { margin-bottom: 22px; }
.page-title {
  font-size: clamp(21px, 3.4vw, 27px); font-weight: 760;
  letter-spacing: -0.015em; display: flex; align-items: center; gap: 10px;
}
.page-sub { margin-top: 5px; color: var(--text-3); font-size: 13.5px; }

.section-head {
  display: flex; align-items: baseline; gap: 12px; margin: 30px 0 14px;
}
.section-head:first-child { margin-top: 0; }
.section-title { font-size: 17px; font-weight: 720; letter-spacing: -0.01em; }
.section-more {
  margin-left: auto; font-size: 12.5px; font-weight: 620; color: var(--brand-1);
  display: inline-flex; align-items: center; gap: 3px;
}
html[data-theme="dark"] .section-more { color: #b9a6ff; }

.chip-row { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  padding: 7px 15px; border-radius: var(--radius-full);
  background: var(--bg-elev); border: 1px solid var(--border);
  font-size: 13px; font-weight: 600; color: var(--text-2);
  transition: all 0.16s; white-space: nowrap;
}
.chip:hover { border-color: var(--brand-2); color: var(--brand-1); transform: translateY(-1px); }
.chip.is-on {
  background: var(--brand-grad); color: #fff; border-color: transparent;
  box-shadow: var(--brand-glow);
}

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  height: 40px; padding: 0 18px; border-radius: var(--radius-sm);
  font-size: 13.5px; font-weight: 650;
  transition: transform 0.15s, filter 0.15s, background 0.15s, border-color 0.15s;
  white-space: nowrap;
}
.btn svg { width: 17px; height: 17px; }
.btn-primary { background: var(--brand-grad); color: #fff; box-shadow: var(--brand-glow); }
.btn-primary:hover { transform: translateY(-1px); filter: brightness(1.07); }
.btn-ghost {
  background: var(--bg-elev); color: var(--text-2); border: 1px solid var(--border);
}
.btn-ghost:hover { background: var(--bg-hover); color: var(--text); border-color: var(--border-strong); }
.btn-sm { height: 32px; padding: 0 13px; font-size: 12.5px; border-radius: 10px; }
.btn:disabled { opacity: 0.45; pointer-events: none; }

.card {
  background: var(--bg-elev); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 20px; box-shadow: var(--shadow-xs);
}

.empty {
  text-align: center; padding: 52px 20px; color: var(--text-3);
}
.empty-ico {
  width: 62px; height: 62px; margin: 0 auto 15px;
  border-radius: 20px; display: grid; place-items: center;
  background: var(--brand-grad-soft); color: var(--brand-1);
  flex: none;
}
html[data-theme="dark"] .empty-ico { color: #b9a6ff; }
.empty-ico svg { width: 29px !important; height: 29px !important; max-width: 29px; max-height: 29px; display: block; }

/* 任何未指定尺寸的內嵌 SVG 都給一個安全預設，避免撐爆容器 */
.view svg:not([width]) { max-width: 100%; }
.empty h3 { font-size: 15.5px; font-weight: 680; color: var(--text-2); margin-bottom: 5px; }
.empty p { font-size: 13px; max-width: 320px; margin: 0 auto; }

.skeleton {
  background: linear-gradient(100deg, var(--bg-sunken) 30%, var(--bg-hover) 50%, var(--bg-sunken) 70%);
  background-size: 220% 100%;
  animation: sk 1.35s ease-in-out infinite;
  border-radius: var(--radius-sm);
}
@keyframes sk { to { background-position: -220% 0; } }

.spinner {
  width: 17px; height: 17px; border-radius: 50%;
  border: 2.2px solid rgba(255, 255, 255, 0.35);
  border-top-color: #fff; animation: spin 0.72s linear infinite;
}
.spinner.dark { border-color: var(--border-strong); border-top-color: var(--brand-1); }
@keyframes spin { to { transform: rotate(360deg); } }

/* ==========================================================================
   Home hero
   ========================================================================== */
.hero {
  position: relative; overflow: hidden;
  border-radius: var(--radius-xl);
  padding: clamp(24px, 4vw, 40px);
  background: var(--brand-grad);
  color: #fff;
  box-shadow: var(--brand-glow);
  margin-bottom: 8px;
}
.hero::after {
  content: ""; position: absolute; right: -110px; top: -130px;
  width: 380px; height: 380px; border-radius: 50%;
  background: radial-gradient(circle, rgba(22, 224, 189, 0.55), transparent 68%);
  pointer-events: none;
}
.hero::before {
  content: ""; position: absolute; left: -90px; bottom: -150px;
  width: 320px; height: 320px; border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 255, 255, 0.20), transparent 70%);
  pointer-events: none;
}
.hero > * { position: relative; z-index: 1; }
.hero-eyebrow {
  display: inline-flex; align-items: center; gap: 7px;
  font-size: 11.5px; font-weight: 650; letter-spacing: 0.14em;
  background: rgba(255, 255, 255, 0.17);
  border: 1px solid rgba(255, 255, 255, 0.24);
  padding: 5px 13px; border-radius: var(--radius-full);
  backdrop-filter: blur(8px);
}
.hero-eyebrow .pulse {
  width: 7px; height: 7px; border-radius: 50%; background: var(--brand-4);
  box-shadow: 0 0 0 0 rgba(22, 224, 189, 0.8);
  animation: pulse 2s infinite;
}
@keyframes pulse {
  70% { box-shadow: 0 0 0 9px rgba(22, 224, 189, 0); }
  100% { box-shadow: 0 0 0 0 rgba(22, 224, 189, 0); }
}
.hero h1 {
  margin: 15px 0 9px;
  font-size: clamp(24px, 4.6vw, 37px); font-weight: 780;
  letter-spacing: -0.022em; line-height: 1.16;
}
.hero p { font-size: 14.5px; color: rgba(255, 255, 255, 0.87); max-width: 540px; }
.hero-actions { margin-top: 22px; display: flex; flex-wrap: wrap; gap: 10px; }
.hero .btn-ghost {
  background: rgba(255, 255, 255, 0.15); color: #fff;
  border-color: rgba(255, 255, 255, 0.28);
  backdrop-filter: blur(8px);
}
.hero .btn-ghost:hover { background: rgba(255, 255, 255, 0.25); color: #fff; }
.hero .btn-white { background: #fff; color: var(--brand-1); }
.hero .btn-white:hover { filter: brightness(0.97); }

.hero-stats {
  margin-top: 26px; display: flex; flex-wrap: wrap; gap: 10px;
}
.hero-stat {
  background: rgba(255, 255, 255, 0.14);
  border: 1px solid rgba(255, 255, 255, 0.2);
  backdrop-filter: blur(8px);
  border-radius: var(--radius); padding: 10px 16px; min-width: 104px;
}
.hero-stat b { display: block; font-size: 20px; font-weight: 750; line-height: 1.2; }
.hero-stat span { font-size: 11.5px; color: rgba(255, 255, 255, 0.8); }

/* ==========================================================================
   Platform tiles
   ========================================================================== */
.platform-grid {
  display: grid; gap: 12px;
  grid-template-columns: repeat(auto-fill, minmax(158px, 1fr));
}
.platform-tile {
  display: flex; align-items: center; gap: 11px;
  background: var(--bg-elev); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 13px 14px;
  text-align: left; transition: all 0.18s var(--ease);
  box-shadow: var(--shadow-xs);
}
.platform-tile:hover {
  transform: translateY(-2px); box-shadow: var(--shadow);
  border-color: var(--border-strong);
}
.platform-logo {
  width: 38px; height: 38px; border-radius: 11px; flex: none;
  display: grid; place-items: center; color: #fff;
  font-size: 15px; font-weight: 800;
}
.platform-meta { min-width: 0; }
.platform-name {
  font-size: 13.5px; font-weight: 680; white-space: nowrap;
  overflow: hidden; text-overflow: ellipsis;
}
.platform-desc { font-size: 11px; color: var(--text-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tag-mini {
  font-size: 9.5px; font-weight: 700; padding: 2px 6px; border-radius: 6px;
  background: var(--bg-sunken); color: var(--text-3); letter-spacing: 0.03em;
}

/* ==========================================================================
   Track list
   ========================================================================== */
.track-list { display: flex; flex-direction: column; gap: 4px; }

.track {
  display: grid;
  grid-template-columns: 34px 48px minmax(0, 1fr) auto;
  align-items: center; gap: 13px;
  padding: 9px 12px; border-radius: var(--radius);
  transition: background 0.15s;
  position: relative;
}
.track:hover { background: var(--bg-hover); }
.track.is-playing { background: var(--brand-grad-soft); }

.track-index {
  font-size: 13px; font-weight: 650; color: var(--text-3);
  text-align: center; font-variant-numeric: tabular-nums;
}
.track-play {
  width: 34px; height: 34px; border-radius: 50%;
  display: grid; place-items: center;
  background: var(--brand-grad); color: #fff;
  opacity: 0; transform: scale(0.85);
  transition: opacity 0.16s, transform 0.16s;
  grid-column: 1; grid-row: 1;
}
.track:hover .track-play { opacity: 1; transform: scale(1); }
.track:hover .track-index { opacity: 0; }
.track-index, .track-play { align-self: center; }
.track-play svg { width: 15px; height: 15px; }

.track-art {
  width: 48px; height: 48px; border-radius: 10px; flex: none;
  object-fit: cover; background: var(--bg-sunken);
  grid-column: 2;
}
.track-art-wrap { position: relative; width: 48px; height: 48px; grid-column: 2; grid-row: 1; }
.track-art-wrap .track-art { width: 100%; height: 100%; }

.eq { display: flex; align-items: flex-end; gap: 2px; height: 15px; }
.eq i {
  width: 2.5px; background: var(--brand-4); border-radius: 2px;
  animation: eq 0.85s ease-in-out infinite;
}
.eq i:nth-child(1) { height: 40%; animation-delay: -0.5s; }
.eq i:nth-child(2) { height: 95%; animation-delay: -0.15s; }
.eq i:nth-child(3) { height: 60%; animation-delay: -0.72s; }
.eq i:nth-child(4) { height: 82%; animation-delay: -0.32s; }
@keyframes eq { 0%, 100% { transform: scaleY(0.35); } 50% { transform: scaleY(1); } }
.track.is-paused .eq i { animation-play-state: paused; }

.track-meta { min-width: 0; grid-column: 3; }
.track-title {
  font-size: 14px; font-weight: 640;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.track.is-playing .track-title { color: var(--brand-1); }
html[data-theme="dark"] .track.is-playing .track-title { color: #c9b9ff; }
.track-sub {
  font-size: 12px; color: var(--text-3); margin-top: 1px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  display: flex; align-items: center; gap: 7px;
}
.track-badges { display: inline-flex; gap: 4px; align-items: center; }
.src-pill {
  font-size: 9.5px; font-weight: 700; padding: 1.5px 6px; border-radius: 5px;
  letter-spacing: 0.04em;
}
.src-preview { background: rgba(37, 99, 235, 0.12); color: #2563eb; }
.src-full { background: rgba(14, 159, 110, 0.13); color: #0e9f6e; }
.src-link { background: rgba(125, 118, 160, 0.14); color: var(--text-3); }
.src-offline { background: rgba(91, 43, 201, 0.13); color: var(--brand-1); }
html[data-theme="dark"] .src-offline { background: rgba(155, 120, 255, 0.2); color: #c9b9ff; }

.track-actions {
  display: flex; align-items: center; gap: 2px;
  grid-column: 4;
}
.track-actions .icon-btn { width: 33px; height: 33px; border-radius: 10px; }
.track-actions .icon-btn svg { width: 17px; height: 17px; }

/* Track grid (cards) ----------------------------------------------------- */
.track-grid {
  display: grid; gap: 16px;
  grid-template-columns: repeat(auto-fill, minmax(168px, 1fr));
}
.track-card {
  background: var(--bg-elev); border: 1px solid var(--border);
  border-radius: var(--radius-lg); overflow: hidden;
  transition: transform 0.2s var(--ease), box-shadow 0.2s;
  box-shadow: var(--shadow-xs);
  text-align: left; display: flex; flex-direction: column;
}
.track-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-lg); }
.track-card.is-playing { border-color: var(--brand-2); box-shadow: 0 0 0 2px rgba(91, 43, 201, 0.18), var(--shadow); }
.track-card-art {
  position: relative; aspect-ratio: 1; background: var(--bg-sunken);
}
.track-card-art img { width: 100%; height: 100%; object-fit: cover; }
.track-card-art .play-fab {
  position: absolute; right: 11px; bottom: 11px;
  width: 44px; height: 44px; border-radius: 50%;
  background: var(--brand-grad); color: #fff;
  display: grid; place-items: center;
  box-shadow: 0 8px 20px -4px rgba(0, 0, 0, 0.45);
  opacity: 0; transform: translateY(8px) scale(0.9);
  transition: all 0.22s var(--ease);
}
.track-card:hover .play-fab { opacity: 1; transform: none; }
.track-card.is-playing .play-fab { opacity: 1; transform: none; }
.play-fab svg { width: 19px; height: 19px; }
.track-card-body { padding: 13px 14px 15px; display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.track-card-title {
  font-size: 13.5px; font-weight: 660; line-height: 1.35;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
  overflow: hidden; min-height: 2.7em;
}
.track-card-artist {
  font-size: 12px; color: var(--text-3);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.card-pill {
  position: absolute; left: 9px; top: 9px;
  font-size: 9.5px; font-weight: 700; letter-spacing: 0.05em;
  padding: 3px 8px; border-radius: var(--radius-full);
  background: rgba(15, 10, 35, 0.62); color: #fff;
  backdrop-filter: blur(6px);
}

/* ==========================================================================
   Agent
   ========================================================================== */
.agent-wrap {
  display: grid; gap: 20px;
  grid-template-columns: minmax(0, 1fr) 300px;
  align-items: start;
}
.chat {
  background: var(--bg-elev); border: 1px solid var(--border);
  border-radius: var(--radius-xl); box-shadow: var(--shadow-sm);
  display: flex; flex-direction: column;
  height: calc(100dvh - var(--player-h) - var(--header-h) - 96px);
  min-height: 460px; overflow: hidden;
}
.chat-head {
  display: flex; align-items: center; gap: 11px;
  padding: 13px 17px; border-bottom: 1px solid var(--border);
  background: var(--bg-elev); flex: none;
}
.chat-avatar {
  width: 40px; height: 40px; border-radius: 13px; flex: none;
  overflow: hidden; box-shadow: var(--brand-glow);
}
.chat-avatar img { width: 100%; height: 100%; object-fit: contain; }
.chat-head-meta { min-width: 0; }
.chat-head-name { font-size: 14.5px; font-weight: 700; }
.chat-status {
  font-size: 11.5px; color: var(--text-3);
  display: flex; align-items: center; gap: 5px;
}
.chat-status .live {
  width: 6.5px; height: 6.5px; border-radius: 50%; background: var(--ok);
}

.chat-log {
  flex: 1; overflow-y: auto; padding: 20px 18px;
  display: flex; flex-direction: column; gap: 16px;
  scroll-behavior: smooth;
}
.msg { display: flex; gap: 10px; max-width: 100%; }
.msg-avatar {
  width: 31px; height: 31px; border-radius: 10px; flex: none;
  overflow: hidden; background: var(--brand-grad-soft);
  display: grid; place-items: center; font-size: 13px; font-weight: 700;
  color: var(--brand-1);
}
.msg-avatar img { width: 100%; height: 100%; object-fit: contain; }
.msg-bubble {
  background: var(--bg-sunken); border-radius: 4px 16px 16px 16px;
  padding: 11px 15px; font-size: 14px; line-height: 1.62;
  max-width: min(560px, 82%); word-wrap: break-word;
}
html[data-theme="dark"] .msg-bubble { background: #201a38; }
.msg-bubble p + p { margin-top: 8px; }
.msg-bubble ul { margin: 7px 0; padding-left: 4px; }
.msg-bubble li { position: relative; padding-left: 15px; margin: 4px 0; }
.msg-bubble li::before {
  content: ""; position: absolute; left: 2px; top: 9px;
  width: 5px; height: 5px; border-radius: 50%; background: var(--brand-2);
}
.msg-bubble strong { font-weight: 700; }
.msg-bubble code {
  font-family: var(--font-mono); font-size: 12.5px;
  background: var(--bg-hover); padding: 1.5px 6px; border-radius: 6px;
}
.msg.me { flex-direction: row-reverse; }
.msg.me .msg-bubble {
  background: var(--brand-grad); color: #fff;
  border-radius: 16px 4px 16px 16px;
  box-shadow: var(--brand-glow);
}
.msg-time { font-size: 10.5px; color: var(--text-3); margin-top: 6px; }

.chat-slots {
  display: flex; gap: 7px; padding: 0 18px 12px; flex-wrap: wrap;
}
.slot {
  font-size: 12px; font-weight: 620; padding: 6px 12px;
  border-radius: var(--radius-full);
  border: 1px solid var(--border); background: var(--bg-elev);
  color: var(--text-2); transition: all 0.16s;
}
.slot:hover { border-color: var(--brand-2); color: var(--brand-1); transform: translateY(-1px); }

.chat-compose {
  flex: none; display: flex; align-items: flex-end; gap: 9px;
  padding: 13px 16px; border-top: 1px solid var(--border);
  background: var(--bg-elev);
}
.chat-input {
  flex: 1; resize: none; max-height: 130px;
  background: var(--bg-sunken); border: 1px solid transparent;
  border-radius: var(--radius); padding: 11px 14px;
  font-size: 14px; line-height: 1.5;
  transition: border-color 0.18s, background 0.18s;
}
html[data-theme="dark"] .chat-input { background: #201a38; }
.chat-input:focus { outline: none; border-color: var(--brand-2); background: var(--bg-elev); }
.chat-send {
  width: 42px; height: 42px; border-radius: 14px; flex: none;
  background: var(--brand-grad); color: #fff;
  display: grid; place-items: center; box-shadow: var(--brand-glow);
  transition: transform 0.15s, filter 0.15s;
}
.chat-send:hover { transform: translateY(-1px); filter: brightness(1.08); }
.chat-send:disabled { opacity: 0.4; pointer-events: none; }
.chat-send svg { width: 19px; height: 19px; }

.typing { display: flex; gap: 4px; align-items: center; padding: 5px 2px; }
.typing i {
  width: 7px; height: 7px; border-radius: 50%; background: var(--text-3);
  animation: typing 1.3s ease-in-out infinite;
}
.typing i:nth-child(2) { animation-delay: 0.18s; }
.typing i:nth-child(3) { animation-delay: 0.36s; }
@keyframes typing {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.42; }
  30% { transform: translateY(-5px); opacity: 1; }
}

.agent-side { display: flex; flex-direction: column; gap: 14px; position: sticky; top: calc(var(--header-h) + 20px); }
.side-card {
  background: var(--bg-elev); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 16px; box-shadow: var(--shadow-xs);
}
.side-card h4 {
  font-size: 12px; font-weight: 700; letter-spacing: 0.1em;
  color: var(--text-3); text-transform: uppercase; margin-bottom: 12px;
}
.side-row {
  display: flex; align-items: center; justify-content: space-between;
  font-size: 13px; padding: 6px 0; color: var(--text-2);
}
.side-row b { color: var(--text); font-variant-numeric: tabular-nums; }
.toggle-row {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; padding: 8px 0; font-size: 13px; color: var(--text-2);
}
.switch {
  width: 42px; height: 24px; border-radius: 99px; flex: none;
  background: var(--border-strong); position: relative;
  transition: background 0.2s;
}
.switch::after {
  content: ""; position: absolute; top: 3px; left: 3px;
  width: 18px; height: 18px; border-radius: 50%; background: #fff;
  box-shadow: var(--shadow-xs); transition: transform 0.22s var(--ease);
}
.switch.is-on { background: var(--brand-grad); }
.switch.is-on::after { transform: translateX(18px); }

/* ==========================================================================
   Library / Playlists
   ========================================================================== */
.tile-grid {
  display: grid; gap: 14px;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
}
.pl-tile {
  background: var(--bg-elev); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 15px;
  text-align: left; transition: all 0.2s var(--ease);
  box-shadow: var(--shadow-xs); display: flex; gap: 13px; align-items: center;
}
.pl-tile:hover { transform: translateY(-3px); box-shadow: var(--shadow); }
.pl-cover {
  width: 62px; height: 62px; border-radius: var(--radius-sm); flex: none;
  display: grid; place-items: center; color: #fff;
  font-size: 22px; box-shadow: var(--shadow-sm);
}
.pl-meta { min-width: 0; }
.pl-name {
  font-size: 14px; font-weight: 680;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.pl-count { font-size: 12px; color: var(--text-3); margin-top: 2px; }

/* ==========================================================================
   Offline
   ========================================================================== */
.dl-row {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr) 150px auto;
  gap: 13px; align-items: center;
  padding: 11px 13px; border-radius: var(--radius);
  background: var(--bg-elev); border: 1px solid var(--border);
  margin-bottom: 8px;
}
.dl-art { width: 44px; height: 44px; border-radius: 10px; object-fit: cover; background: var(--bg-sunken); }
.dl-meter { height: 6px; background: var(--bg-sunken); border-radius: 99px; overflow: hidden; }
.dl-meter i {
  display: block; height: 100%; background: var(--brand-grad);
  border-radius: 99px; transition: width 0.25s linear;
}
.dl-pct { font-size: 11.5px; color: var(--text-3); margin-top: 4px; font-variant-numeric: tabular-nums; }
.dl-state {
  font-size: 11.5px; font-weight: 650; padding: 3px 10px;
  border-radius: var(--radius-full);
}
.dl-queued { background: rgba(217, 119, 6, 0.13); color: var(--warn); }
.dl-active { background: rgba(37, 99, 235, 0.12); color: var(--info); }
.dl-done { background: rgba(14, 159, 110, 0.13); color: var(--ok); }
.dl-error { background: rgba(220, 38, 38, 0.12); color: var(--err); }

.storage-grid {
  display: grid; gap: 13px;
  grid-template-columns: repeat(auto-fit, minmax(158px, 1fr));
  margin-bottom: 20px;
}
.stat-card {
  background: var(--bg-elev); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 15px 16px; box-shadow: var(--shadow-xs);
}
.stat-card .k { font-size: 11.5px; color: var(--text-3); font-weight: 600; letter-spacing: 0.05em; }
.stat-card .v {
  font-size: 23px; font-weight: 760; margin-top: 5px;
  font-variant-numeric: tabular-nums; letter-spacing: -0.02em;
}
.stat-card .u { font-size: 12px; color: var(--text-3); font-weight: 600; margin-left: 3px; }

/* ==========================================================================
   Modal / Drawer
   ========================================================================== */
.modal-back {
  position: fixed; inset: 0; z-index: 400;
  background: rgba(15, 10, 35, 0.5);
  backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
  display: grid; place-items: center; padding: 18px;
  animation: fade 0.2s ease;
}
@keyframes fade { from { opacity: 0; } }
.modal {
  background: var(--bg-elev); border-radius: var(--radius-xl);
  box-shadow: var(--shadow-xl); width: 100%; max-width: 440px;
  max-height: 86dvh; display: flex; flex-direction: column;
  animation: modalIn 0.3s var(--ease-out); overflow: hidden;
}
@keyframes modalIn { from { opacity: 0; transform: translateY(20px) scale(0.97); } }
.modal-head {
  padding: 19px 21px 13px; display: flex; align-items: center; gap: 11px;
}
.modal-head h3 { font-size: 16.5px; font-weight: 720; flex: 1; }
.modal-body { padding: 0 21px 8px; overflow-y: auto; flex: 1; }
.modal-foot {
  padding: 15px 21px 19px; display: flex; gap: 9px; justify-content: flex-end;
  flex-wrap: wrap;
}
.field { margin-bottom: 15px; }
.field label {
  display: block; font-size: 12.5px; font-weight: 650;
  color: var(--text-2); margin-bottom: 7px;
}
.field input[type="text"], .field input[type="color"], .field select {
  width: 100%; height: 42px; padding: 0 13px;
  background: var(--bg-sunken); border: 1px solid transparent;
  border-radius: var(--radius-sm); font-size: 14px;
  transition: border-color 0.18s, background 0.18s;
}
.field input:focus, .field select:focus {
  outline: none; border-color: var(--brand-2); background: var(--bg-elev);
}
.field input[type="color"] { padding: 5px; cursor: pointer; }
.btn-row { display: flex; flex-wrap: wrap; gap: 8px; }

/* ==========================================================================
   Player bar
   ========================================================================== */
.player {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 300;
  height: var(--player-h);
  display: flex; align-items: center; gap: 16px;
  padding: 0 clamp(12px, 2.4vw, 22px);
  background: color-mix(in srgb, var(--bg-elev) 92%, transparent);
  backdrop-filter: saturate(1.8) blur(22px);
  -webkit-backdrop-filter: saturate(1.8) blur(22px);
  border-top: 1px solid var(--border);
  box-shadow: 0 -6px 26px -14px rgba(27, 21, 51, 0.28);
  transform: translateY(105%);
  transition: transform 0.42s var(--ease);
}
.player.is-up { transform: none; }

.pl-now {
  display: flex; align-items: center; gap: 12px;
  min-width: 0; width: 250px; flex: none;
}
.pl-art {
  width: 52px; height: 52px; border-radius: 12px; flex: none;
  object-fit: cover; background: var(--bg-sunken);
  box-shadow: var(--shadow-sm);
}
.pl-info { min-width: 0; }
.pl-title {
  font-size: 13.5px; font-weight: 660;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.pl-artist {
  font-size: 12px; color: var(--text-3);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.pl-fav { width: 32px; height: 32px; flex: none; }
.pl-fav svg { width: 17px; height: 17px; }
.pl-fav.is-on { color: var(--err); }

.pl-center {
  flex: 1; display: flex; flex-direction: column;
  align-items: center; gap: 5px; min-width: 0;
}
.pl-btns { display: flex; align-items: center; gap: 5px; }
.pl-btns .icon-btn { width: 36px; height: 36px; border-radius: 11px; }
.pl-btns .icon-btn.is-on { color: var(--brand-1); background: var(--brand-grad-soft); }
.pl-btns .icon-btn.is-on::after {
  content: ""; position: absolute; bottom: 3px; left: 50%; transform: translateX(-50%);
  width: 4px; height: 4px; border-radius: 50%; background: var(--brand-1);
}
html[data-theme="dark"] .pl-btns .icon-btn.is-on { color: #c9b9ff; }
.pl-main-btn {
  width: 42px; height: 42px; border-radius: 50%;
  background: var(--brand-grad); color: #fff;
  display: grid; place-items: center; box-shadow: var(--brand-glow);
  transition: transform 0.15s, filter 0.15s; margin: 0 3px;
}
.pl-main-btn:hover { transform: scale(1.06); filter: brightness(1.07); }
.pl-main-btn:active { transform: scale(0.97); }
.pl-main-btn svg { width: 19px; height: 19px; }

.pl-bar { display: flex; align-items: center; gap: 9px; width: 100%; max-width: 560px; }
.pl-time {
  font-size: 11px; color: var(--text-3); font-variant-numeric: tabular-nums;
  min-width: 36px; text-align: center;
}
.seek {
  flex: 1; height: 4px; border-radius: 99px; background: var(--border-strong);
  position: relative; cursor: pointer;
}
.seek:hover { height: 6px; }
.seek-fill {
  position: absolute; left: 0; top: 0; bottom: 0;
  background: var(--brand-grad); border-radius: 99px; width: 0;
}
.seek-thumb {
  position: absolute; top: 50%; left: 0;
  width: 12px; height: 12px; border-radius: 50%;
  background: #fff; border: 2.5px solid var(--brand-1);
  transform: translate(-50%, -50%); opacity: 0;
  transition: opacity 0.15s;
  box-shadow: var(--shadow-xs);
}
.seek:hover .seek-thumb { opacity: 1; }
.seek.is-locked { cursor: not-allowed; opacity: 0.55; }
.seek.is-locked .seek-fill { background: var(--text-3); }

.pl-right { display: flex; align-items: center; gap: 6px; width: 200px; justify-content: flex-end; flex: none; }
.vol-wrap { display: flex; align-items: center; gap: 6px; }
.vol {
  width: 84px; height: 4px; border-radius: 99px; background: var(--border-strong);
  position: relative; cursor: pointer;
}
.vol-fill {
  position: absolute; left: 0; top: 0; bottom: 0;
  background: var(--brand-grad); border-radius: 99px; width: 80%;
}

.pl-center-top { display: flex; align-items: center; gap: 9px; }
.marquee-wrap {
  overflow: hidden; max-width: 200px; display: none;
}
.pl-title-sm {
  font-size: 12.5px; font-weight: 650;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

@keyframes spin { to { transform: rotate(360deg); } }
.icon-btn .spin-ico { animation: spin 1.1s linear infinite; }

/* ==========================================================================
   Toast
   ========================================================================== */
.toasts {
  position: fixed; z-index: 800;
  right: 16px; bottom: calc(var(--player-h) + 16px);
  display: flex; flex-direction: column; gap: 9px; align-items: flex-end;
  pointer-events: none;
}
.toast {
  pointer-events: auto;
  display: flex; align-items: center; gap: 10px;
  background: var(--bg-elev); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 11px 16px;
  box-shadow: var(--shadow-lg); font-size: 13.5px; font-weight: 600;
  max-width: min(360px, calc(100vw - 32px));
  animation: toastIn 0.32s var(--ease-out);
}
.toast.is-out { animation: toastOut 0.26s var(--ease) forwards; }
.toast .t-ico { width: 19px; height: 19px; flex: none; }
.toast.ok .t-ico { color: var(--ok); }
.toast.err .t-ico { color: var(--err); }
.toast.info .t-ico { color: var(--info); }
@keyframes toastIn { from { opacity: 0; transform: translateX(24px) scale(0.96); } }
@keyframes toastOut { to { opacity: 0; transform: translateX(24px) scale(0.96); } }

/* ==========================================================================
   Bottom navigation (mobile)
   ========================================================================== */
.tabbar {
  display: none;
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 310;
  height: calc(58px + env(safe-area-inset-bottom, 0px));
  padding-bottom: env(safe-area-inset-bottom, 0px);
  background: color-mix(in srgb, var(--bg-elev) 94%, transparent);
  backdrop-filter: saturate(1.8) blur(22px);
  -webkit-backdrop-filter: saturate(1.8) blur(22px);
  border-top: 1px solid var(--border);
}
.tabbar-inner { display: flex; height: 58px; }
.tab {
  flex: 1; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 3px;
  color: var(--text-3); font-size: 10.5px; font-weight: 650;
  transition: color 0.16s; position: relative;
}
.tab svg { width: 21px; height: 21px; }
.tab.is-active { color: var(--brand-1); }
html[data-theme="dark"] .tab.is-active { color: #b9a6ff; }
.tab.is-active::before {
  content: ""; position: absolute; top: 0; left: 50%; transform: translateX(-50%);
  width: 24px; height: 2.5px; border-radius: 0 0 3px 3px;
  background: var(--brand-grad);
}

/* ==========================================================================
   Mini player (mobile, above tabbar)
   ========================================================================== */
.mini-player {
  display: none;
  position: fixed; left: 8px; right: 8px; z-index: 305;
  bottom: calc(58px + env(safe-area-inset-bottom, 0px) + 8px);
  background: var(--bg-elev); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 8px 10px;
  box-shadow: var(--shadow-lg);
  align-items: center; gap: 10px;
}
.mini-player .pl-art { width: 40px; height: 40px; border-radius: 10px; }
.mini-player .pl-info { flex: 1; min-width: 0; }
.mini-progress {
  position: absolute; left: 10px; right: 10px; bottom: 2px;
  height: 2px; background: var(--border-strong); border-radius: 99px; overflow: hidden;
}
.mini-progress i { display: block; height: 100%; width: 0; background: var(--brand-grad); }

/* ==========================================================================
   Responsive
   ========================================================================== */
@media (max-width: 1080px) {
  .agent-wrap { grid-template-columns: minmax(0, 1fr); }
  .agent-side { position: static; }
  .agent-side .side-card:first-child { order: -1; }
}

@media (max-width: 900px) {
  :root { --player-h: 72px; }
  .app { grid-template-columns: 1fr; }
  .sidebar {
    position: fixed; left: 0; top: 0; bottom: 0;
    width: 272px; height: 100dvh;
    transform: translateX(-102%);
    transition: transform 0.34s var(--ease);
    box-shadow: var(--shadow-xl); z-index: 500;
  }
  .sidebar.is-open { transform: none; }
  .scrim {
    position: fixed; inset: 0; z-index: 490;
    background: rgba(15, 10, 35, 0.45);
    backdrop-filter: blur(4px);
    animation: fade 0.24s ease;
  }
  .topbar { padding-left: 12px; padding-right: 12px; gap: 8px; }
  .topbar-logo { display: block; }
  .brand { display: none; }
  .btn-menu { display: grid; }
  .player {
    left: 0; right: 0; bottom: calc(58px + env(safe-area-inset-bottom, 0px));
    height: var(--player-h);
    border-radius: 0; border-top: 1px solid var(--border);
    padding: 0 12px; gap: 12px;
  }
  .player.is-mobile-hidden { transform: translateY(105%); }
  .pl-center { display: none; }
  .pl-right { display: none; }
  .pl-now { width: auto; flex: 1; }
  .pl-mobile-controls { display: flex; align-items: center; gap: 4px; }
  .tabbar { display: block; }
  .mini-player { display: flex; }
  .mini-player.is-hidden { display: none; }
  .app { padding-bottom: calc(var(--player-h) + 58px + env(safe-area-inset-bottom, 0px)); }
  .view { padding-left: 14px; padding-right: 14px; padding-bottom: 30px; }
  .chat { height: calc(100dvh - var(--header-h) - 58px - env(safe-area-inset-bottom, 0px) - 20px); }
  .toasts { bottom: calc(var(--player-h) + 58px + env(safe-area-inset-bottom, 0px) + 14px); right: 12px; left: 12px; align-items: stretch; }
  .toast { max-width: 100%; }
  .dl-row { grid-template-columns: 40px minmax(0, 1fr) auto; }
  .dl-row .dl-meter-wrap { grid-column: 2 / 4; }
}

@media (max-width: 560px) {
  body { font-size: 14.5px; }
  .topbar-actions .hide-xs { display: none; }
  .searchbox input { padding-right: 46px; font-size: 15px; }
  .searchbox .search-go { display: none; }
  .track { grid-template-columns: 26px 44px minmax(0, 1fr); gap: 10px; padding: 8px 8px; }
  .track-actions { grid-column: 3; grid-row: 2; justify-content: flex-end; margin-top: 2px; }
  .track-art-wrap, .track-art { width: 44px; height: 44px; }
  .track-grid { grid-template-columns: repeat(auto-fill, minmax(142px, 1fr)); gap: 12px; }
  .tile-grid { grid-template-columns: 1fr; }
  .hero-actions .btn { flex: 1; }
  .modal { border-radius: var(--radius-lg); }
}

@media (min-width: 901px) {
  .pl-mobile-controls { display: none; }
}

/* Standalone PWA tweaks */
@media (display-mode: standalone) {
  .topbar { padding-top: env(safe-area-inset-top, 0px); height: calc(var(--header-h) + env(safe-area-inset-top, 0px)); }
  .sidebar { padding-top: calc(18px + env(safe-area-inset-top, 0px)); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* Print */
@media print {
  .sidebar, .player, .tabbar, .topbar, .mini-player, .toasts { display: none !important; }
  .app { grid-template-columns: 1fr; padding: 0; }
}

/* ================= ICP 備案號頁腳 =================
   備案通過後，取消 index.html 裡 .icp-footer 那段註解即可顯示。
   行動版墊在 tabbar 上方、桌機版墊在播放列上方，不遮擋內容。 */
.icp-footer {
  position: fixed;
  left: 0;
  right: 0;
  bottom: calc(var(--player-h) + env(safe-area-inset-bottom, 0px));
  z-index: 4;
  display: flex;
  justify-content: center;
  align-items: center;
  height: 20px;
  font-size: 11px;
  line-height: 1;
  color: var(--text-3);
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(6px);
  pointer-events: auto;
}
.icp-footer a { color: inherit; text-decoration: none; }
.icp-footer a:hover { color: var(--text-2); text-decoration: underline; }

@media (max-width: 720px) {
  .icp-footer {
    bottom: calc(var(--player-h) + 58px + env(safe-area-inset-bottom, 0px));
  }
}

@media print {
  .icp-footer { position: static; height: auto; padding: 8px 0; }
}
