/**
 * desktop.css - 桌面样式（重构版）
 * 6行×4列网格 + 小组件 + Dock + 翻页指示器
 * 保留原有类名：.desktop-icon, .icon-image, .icon-label, .app-container
 */

/* ========== 桌面容器 ========== */
.desktop {
  width: 100%;
  height: 100%;
  position: relative;
  overflow: hidden;
  pointer-events: none;
}

/* ========== 页面容器 - 6行×4列网格系统 ========== */
.pages-container {
  position: absolute;
  left: 0;
  width: 100%;
  --page-top-offset: var(--statusbar-height);
  /* 固定底部偏移: dock高度(95px) + dock底部间距(12px) + 指示器高度(20px) + 额外间距(20px) = 147px */
  --page-bottom-offset: 147px;
  top: var(--page-top-offset);
  height: calc(100% - var(--page-top-offset) - var(--page-bottom-offset));
  min-height: 0;
  max-height: calc(100% - var(--page-top-offset) - var(--page-bottom-offset));
  overflow: hidden;
  pointer-events: none;
  /* 让页面稍微等比缩放 */
  transform: scale(0.96);
  transform-origin: center top;
  /* 透明，让screen-content的背景显示 */
  background: transparent;
}

.pages-wrapper {
  display: flex;
  height: 100%;
  width: 100%;
  transition: transform var(--transition-normal);
  will-change: transform;
  pointer-events: auto;
}

.page {
  min-width: 100%;
  width: 100%;
  height: 100%;
  max-height: 100%;
  /* 增加边距,让图标区域往中间收 */
  padding: clamp(16px, 4vh, 28px) clamp(12px, 3vw, 20px);
  /* 透明，让screen-content的背景显示 */
  background: transparent;
  display: grid;
  /* 网格间距根据可用空间自适应,但图标尺寸固定 */
  --page-gap: clamp(8px, 2vh, 16px);
  grid-template-columns: repeat(var(--desktop-grid-columns), minmax(0, 1fr));
  grid-template-rows: repeat(var(--desktop-grid-rows), minmax(0, 1fr));
  gap: var(--page-gap);
  align-content: stretch;
  justify-items: center;
  align-items: center;
  flex-shrink: 0;
  overflow: hidden;
  box-sizing: border-box;
}

/* ========== 基础图标样式 - 1×1 (保留原有类名) ========== */
.desktop-icon,
.icon {
  background: transparent;
  border: none;
  border-radius: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all var(--transition-fast);
  position: relative;
  overflow: visible;
  /* 图标容器固定最大宽度,防止过大 */
  max-width: 80px;
  width: 100%;
  padding: 4px;
  gap: 6px;
  pointer-events: auto;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

.desktop-icon-badge {
  position: absolute;
  top: 0;
  right: 2px;
  min-width: 22px;
  padding: 3px 7px;
  border-radius: 999px;
  background: #ff3b30;
  color: #fff;
  font-size: 12px;
  font-weight: 800;
  line-height: 1;
  display: none;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
  z-index: 2;
}

.desktop-icon:active,
.icon:active {
  transform: scale(0.95);
}

.desktop-icon:hover,
.icon:hover {
  background: transparent;
}

.desktop-icon:hover .icon-image,
.icon:hover .icon-image {
  transform: scale(1.05);
}

/* ========== 图标图像容器 (保留原有类名) ========== */
.icon-image {
  /* 使用CSS变量，不随格子变化 */
  width: var(--icon-size);
  height: var(--icon-size);
  min-width: var(--icon-size);
  min-height: var(--icon-size);
  max-width: var(--icon-size);
  max-height: var(--icon-size);
  aspect-ratio: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-card);
  border-radius: var(--icon-radius);
  transition: transform var(--transition-fast);
  position: relative;
  overflow: hidden;
  margin: 0 auto;
  flex-shrink: 0;
  box-shadow: 
    0 2px 8px rgba(0, 0, 0, 0.1),
    0 1px 2px rgba(0, 0, 0, 0.06);
}

/* ========== 图标图片样式 ========== */
.icon-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: var(--icon-radius);
}

.desktop-icon:active .icon-image {
  transform: scale(0.9);
}

/* ========== 图标Symbol样式 ========== */
.icon-symbol,
.icon-image i,
.icon-image svg {
  font-size: 32px;
  color: var(--text-on-primary);
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
  filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.2));
}

.icon-image svg {
  width: 32px;
  height: 32px;
  fill: currentColor;
}

/* ========== 图标标签 (保留原有类名) ========== */
.icon-label,
.icon-name {
  font-size: 11px;
  font-weight: 500;
  color: var(--widget-text-strong, var(--text-primary));
  text-align: center;
  line-height: 1.2;
  max-width: 80px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* 日间模式图标标签 */
:root:not([data-theme="dark"]) .icon-label,
:root:not([data-theme="dark"]) .icon-name {
  color: var(--text-primary);
}

/* 夜间模式图标标签 */
[data-theme="dark"] .icon-label,
[data-theme="dark"] .icon-name {
  color: var(--text-white);
  text-shadow: var(--widget-text-shadow);
}

/* ========== 小图轮播 - 2×2 ========== */
.carousel-widget {
  grid-column: span 2;
  grid-row: span 2;
  background: var(--widget-glass-bg);
  backdrop-filter: blur(var(--blur-amount));
  -webkit-backdrop-filter: blur(var(--blur-amount));
  border: none;
  border-radius: var(--widget-border-radius);
  overflow: hidden;
  position: relative;
  cursor: pointer;
  width: 100%;
  height: 100%;
  min-width: 0;
  min-height: 0;
}

.carousel-container {
  width: 100%;
  height: 100%;
  position: relative;
}

.carousel-slide {
  width: 100%;
  height: 100%;
  display: none;
  align-items: center;
  justify-content: center;
  font-size: 56px;
  color: var(--text-white);
  text-shadow: var(--widget-text-shadow);
  position: absolute;
  top: 0;
  left: 0;
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
}

.carousel-slide.active {
  display: flex;
}

.carousel-slide i {
  font-size: 56px;
  color: var(--text-white);
  text-shadow: var(--widget-text-shadow);
}

.carousel-dots {
  position: absolute;
  bottom: 12px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 6px;
  z-index: 10;
}

.carousel-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--widget-carousel-dot);
  transition: all var(--transition-fast);
}

.carousel-dot.active {
  background: var(--widget-carousel-dot-active);
  width: 18px;
  border-radius: 3px;
}

/* ========== 天气组件 2×2 ========== */
.weather-widget {
  grid-column: span 2;
  grid-row: span 2;
  position: relative;
  width: 100%;
  height: 100%;
  --weather-text-strong: #f7fbff;
  --weather-text-muted: rgba(247, 251, 255, 0.85);
  --weather-chip-bg: rgba(255,255,255,0.12);
  --weather-chip-border: rgba(255,255,255,0.12);
  border-radius: var(--widget-border-radius);
  overflow: hidden;
  background: linear-gradient(145deg, var(--widget-card-bg-start), var(--widget-card-bg-end));
  border: 1px solid var(--widget-border);
  box-shadow: 0 15px 45px rgba(0,0,0,0.12);
  cursor: pointer;
  isolation: isolate;
  transition: transform var(--transition-fast), box-shadow var(--transition-fast);
  backdrop-filter: blur(var(--blur-strong));
  -webkit-backdrop-filter: blur(var(--blur-strong));
}

.weather-widget:hover {
  transform: translateY(-2px);
  box-shadow: 0 18px 50px rgba(0,0,0,0.16);
}

.weather-backdrop {
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 20% 20%, rgba(255,255,255,0.15), transparent 40%),
              radial-gradient(circle at 80% 10%, rgba(255,255,255,0.1), transparent 45%);
  opacity: 0.8;
  z-index: 1;
}

.weather-content {
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  height: 100%;
  padding: 12px 14px 12px;
  color: var(--weather-text-strong);
  gap: 4px;
}

.weather-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 11px;
  color: var(--weather-text-muted);
  gap: 6px;
}

.weather-updated {
  font-weight: 600;
}

.weather-date {
  opacity: 0.85;
}

.weather-main {
  display: flex;
  align-items: baseline;
  gap: 2px;
  margin-top: 0;
  transform: translateY(-2px);
}

.weather-temp {
  font-size: 44px;
  font-weight: 700;
  line-height: 1;
  color: var(--text-white);
  text-shadow: 0 8px 24px rgba(0,0,0,0.2);
}

.weather-desc {
  font-size: 10px;
  font-weight: 600;
  color: var(--weather-text-strong);
  padding: 0;
  border-radius: 0;
  background: none;
  border: none;
}

.weather-meta {
  display: flex;
  gap: 6px;
  margin-top: 10px;
}

.weather-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 8px;
  border-radius: 999px;
  background: var(--weather-chip-bg);
  color: var(--weather-text-strong);
  font-size: 11px;
  border: 1px solid var(--weather-chip-border);
  backdrop-filter: blur(12px);
}

.weather-forecast {
  margin-top: 4px;
  display: block;
  color: var(--weather-text-strong);
  min-height: 28px;
}

.weather-summary {
  flex: 1;
  text-align: left;
  font-size: 12px;
  color: var(--weather-text-muted);
  margin-top: 6px;
  padding: 0;
  background: none;
  border: none;
}

.weather-extra {
  display: flex;
  flex-direction: column;
  gap: 2px;
  font-size: 12px;
  color: var(--weather-text-strong);
}

.weather-astro {
  font-weight: 600;
}

.weather-life {
  color: var(--weather-text-muted);
}

.weather-anim {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 0;
}

.weather-anim-cloud {
  opacity: 0;
  transition: opacity var(--transition-normal);
}

.weather-anim-cloud .cloud {
  position: absolute;
  filter: drop-shadow(0 8px 22px rgba(0,0,0,0.12));
  animation: cloudDrift 26s linear infinite, cloudFloat 6s ease-in-out infinite;
}

.weather-anim-cloud .cloud-a {
  width: 200px;
  height: 110px;
  top: 6px;
  left: -30px;
}

.weather-anim-cloud .cloud-b {
  width: 160px;
  height: 90px;
  top: 28px;
  right: -24px;
  opacity: 0.92;
  animation-duration: 30s, 7s;
  animation-delay: -8s, -2s;
}

.weather-anim-cloud .cloud path {
  fill: url(#cloudGrad);
}

.weather-anim-sun {
  opacity: 0;
  transition: opacity var(--transition-normal);
  filter: drop-shadow(0 8px 18px rgba(255,200,120,0.4));
}

.weather-anim-moon {
  position: absolute;
  inset: 0;
  opacity: 0;
  transition: opacity var(--transition-normal);
  filter: drop-shadow(0 8px 18px rgba(180,200,255,0.3));
}

.sun-core {
  position: absolute;
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: radial-gradient(circle, #ffd166 0%, #ffb347 70%, rgba(255,179,71,0.6) 100%);
  top: 14px;
  right: 18px;
  animation: sunPulse 5s ease-in-out infinite;
}

.sun-rays {
  position: absolute;
  width: 120px;
  height: 120px;
  top: -6px;
  right: -12px;
  border-radius: 50%;
  background:
    conic-gradient(
      from 0deg,
      rgba(255, 215, 140, 0.0) 0deg,
      rgba(255, 215, 140, 0.18) 40deg,
      rgba(255, 215, 140, 0.0) 80deg,
      rgba(255, 215, 140, 0.15) 120deg,
      rgba(255, 215, 140, 0.0) 160deg,
      rgba(255, 215, 140, 0.12) 200deg,
      rgba(255, 215, 140, 0.0) 240deg,
      rgba(255, 215, 140, 0.10) 280deg,
      rgba(255, 215, 140, 0.0) 320deg,
      rgba(255, 215, 140, 0.16) 340deg,
      rgba(255, 215, 140, 0.0) 360deg
    );
  animation: sunSpin 14s linear infinite;
  mask: radial-gradient(circle at center, transparent 42%, black 62%);
  -webkit-mask: radial-gradient(circle at center, transparent 42%, black 62%);
  filter: blur(0.3px);
}

.sun-rays::after {
  content: '';
  position: absolute;
  inset: -8px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255,206,120,0.26), rgba(255,206,120,0));
  filter: blur(6px);
}

.moon-core {
  position: absolute;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: radial-gradient(circle at 30% 30%, #f7f9ff 0%, #dfe7ff 60%, #b8c4e6 100%);
  top: 18px;
  right: 20px;
  box-shadow:
    inset -6px -6px 12px rgba(0,0,0,0.08),
    0 8px 24px rgba(0,0,0,0.18);
  animation: moonFloat 6s ease-in-out infinite;
}

.moon-craters {
  position: absolute;
  inset: 0;
}

.moon-craters span {
  position: absolute;
  border-radius: 50%;
  background: rgba(128,142,180,0.35);
  box-shadow: inset 3px 3px 6px rgba(0,0,0,0.15);
}

.moon-craters span:nth-child(1) { width: 10px; height: 10px; top: 12px; left: 14px; }
.moon-craters span:nth-child(2) { width: 8px; height: 8px; top: 26px; left: 28px; }
.moon-craters span:nth-child(3) { width: 12px; height: 12px; top: 34px; left: 10px; }
.moon-craters span:nth-child(4) { width: 7px; height: 7px; top: 16px; left: 34px; }

.weather-anim-rain {
  opacity: 0;
  transition: opacity var(--transition-normal);
}

.weather-anim-rain .cloud {
  position: absolute;
  width: 120px;
  height: 60px;
  top: 10px;
  right: 10px;
  background: linear-gradient(145deg, rgba(255,255,255,0.9), rgba(255,255,255,0.6));
  border-radius: 60px;
  box-shadow: -30px 10px 0 10px rgba(255,255,255,0.75);
  filter: drop-shadow(0 10px 25px rgba(0,0,0,0.15));
}

.weather-anim-rain .raindrops {
  position: absolute;
  top: 60px;
  right: 26px;
  display: flex;
  gap: 10px;
}

.weather-anim-rain .raindrops span {
  width: 6px;
  height: 16px;
  background: linear-gradient(180deg, rgba(255,255,255,0.9), rgba(255,255,255,0.2));
  border-radius: 10px;
  display: block;
  animation: rainFall 1.2s infinite ease-in;
}

.weather-anim-rain .raindrops span:nth-child(2) { animation-delay: 0.1s; }
.weather-anim-rain .raindrops span:nth-child(3) { animation-delay: 0.2s; }
.weather-anim-rain .raindrops span:nth-child(4) { animation-delay: 0.3s; }
.weather-anim-rain .raindrops span:nth-child(5) { animation-delay: 0.4s; }

/* 天气状态样式 */
.weather-widget.is-sunny {
  background: linear-gradient(145deg, #6fb8ff 0%, #4c8dff 50%, #2c6bf5 100%);
}

.weather-widget.is-cloudy {
  background: linear-gradient(145deg, #6c7a8c 0%, #4f5b6c 50%, #2f3640 100%);
}

.weather-widget.is-rainy,
.weather-widget.is-snow {
  background: linear-gradient(160deg, #3a4a5d 0%, #253240 60%, #1a2430 100%);
}

.weather-widget.is-rainy .weather-anim-rain,
.weather-widget.is-snow .weather-anim-rain {
  opacity: 1;
}

.weather-widget.is-sunny .weather-anim-sun {
  opacity: 1;
}

.weather-widget.is-rainy .sun-core,
.weather-widget.is-snow .sun-core,
.weather-widget.is-cloudy .sun-core {
  opacity: 0;
}

.weather-widget.is-cloudy .weather-anim-cloud {
  opacity: 1;
}

.weather-widget.is-night {
  background: linear-gradient(145deg, #1a2130 0%, #0f1624 50%, #0a101a 100%);
  --weather-text-strong: #e8edff;
  --weather-text-muted: rgba(232, 237, 255, 0.78);
  --weather-chip-bg: rgba(255,255,255,0.10);
  --weather-chip-border: rgba(255,255,255,0.14);
}

.weather-widget.is-night .weather-desc,
.weather-widget.is-night .weather-chip {
  background: var(--weather-chip-bg);
  border-color: var(--weather-chip-border);
}

.weather-widget.is-night .weather-anim-sun {
  opacity: 0;
}

.weather-widget.is-night .weather-anim-moon {
  opacity: 1;
}

@keyframes cloudDrift {
  0% { transform: translateX(0); }
  100% { transform: translateX(60%); }
}

@keyframes cloudFloat {
  0% { transform: translateY(0); }
  50% { transform: translateY(-6px); }
  100% { transform: translateY(0); }
}

[data-theme="dark"] .weather-widget {
  border-color: var(--widget-border-strong);
  box-shadow: 0 14px 38px rgba(0,0,0,0.4);
}

[data-theme="dark"] .weather-desc,
[data-theme="dark"] .weather-chip {
  background: rgba(255,255,255,0.08);
  border-color: rgba(255,255,255,0.08);
}

/* 天气弹窗 */
.weather-modal.hidden {
  display: none !important;
}

.weather-modal {
  position: fixed;
  inset: 0;
  z-index: 999;
  --wm-bg: linear-gradient(165deg, #f9fbff 0%, #eef3ff 100%);
  --wm-text: #1f2432;
  --wm-border: rgba(0,0,0,0.08);
  --wm-card-bg: rgba(255,255,255,0.9);
  --wm-card-border: rgba(0,0,0,0.06);
  --wm-chip-bg: rgba(0,0,0,0.04);
  --wm-mask: rgba(0,0,0,0.22);
}

.weather-modal-mask {
  position: absolute;
  inset: 0;
  background: var(--wm-mask);
}

.weather-modal-dialog {
  position: absolute;
  inset: 0;
  margin: auto;
  max-width: 420px;
  width: 90%;
  max-height: 540px;
  border-radius: 16px;
  background: var(--wm-bg);
  color: var(--wm-text);
  box-shadow: 0 24px 68px rgba(0,0,0,0.22);
  border: 1px solid var(--wm-border);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.weather-modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 16px;
  border-bottom: 1px solid var(--wm-border);
  gap: 10px;
}

.weather-modal-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
}

.weather-modal-location {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--wm-text);
  opacity: 0.85;
  white-space: nowrap;
}

.weather-modal-actions {
  display: flex;
  gap: 8px;
}

.weather-action-btn {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  border: 1px solid var(--wm-border);
  background: var(--wm-card-bg);
  color: var(--wm-text);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: transform var(--transition-fast), background var(--transition-fast);
}

.weather-action-btn:hover {
  transform: translateY(-1px);
  background: var(--wm-chip-bg);
}

.weather-modal-body {
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  overflow-y: auto;
}

.weather-modal-main {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.wm-temp-row {
  display: flex;
  align-items: baseline;
  gap: 10px;
}

.wm-temp {
  font-size: 48px;
  font-weight: 700;
}

.wm-feels {
  font-size: 14px;
  font-weight: 600;
  color: rgba(31,36,50,0.65);
}

.wm-desc {
  font-size: 16px;
  opacity: 0.9;
}

.wm-meta {
  display: flex;
  gap: 10px;
  font-size: 12px;
  color: rgba(232,237,255,0.75);
}

.weather-modal-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
}

.wm-item {
  background: var(--wm-card-bg);
  border: 1px solid var(--wm-card-border);
  border-radius: 12px;
  padding: 10px;
}

.wm-item-label {
  font-size: 12px;
  opacity: 0.8;
}

.wm-item-value {
  font-size: 16px;
  font-weight: 700;
  margin-top: 4px;
}

.weather-modal-life {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}

.wm-life-item {
  background: var(--wm-card-bg);
  border: 1px solid var(--wm-card-border);
  border-radius: 12px;
  padding: 10px;
}

.wm-life-label {
  font-size: 12px;
  opacity: 0.8;
}

.wm-life-desc {
  margin-top: 4px;
  font-size: 14px;
  font-weight: 600;
}

.weather-modal-forecast {
  background: var(--wm-card-bg);
  border: 1px solid var(--wm-card-border);
  border-radius: 12px;
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.wm-forecast-title {
  font-size: 12px;
  opacity: 0.8;
}

.wm-forecast-text {
  font-size: 14px;
  font-weight: 600;
}

[data-theme="dark"] .wm-feels {
  color: rgba(232,237,255,0.75);
}

[data-theme="dark"] .weather-modal {
  --wm-bg: linear-gradient(160deg, #1f2432 0%, #111827 100%);
  --wm-text: #e8edff;
  --wm-border: rgba(255,255,255,0.12);
  --wm-card-bg: rgba(255,255,255,0.06);
  --wm-card-border: rgba(255,255,255,0.12);
  --wm-chip-bg: rgba(255,255,255,0.10);
  --wm-mask: rgba(0,0,0,0.35);
}
/* 夜间模式调优 */
[data-theme="dark"] .weather-widget {
  border-color: var(--widget-border-strong);
  box-shadow: 0 14px 38px rgba(0,0,0,0.4);
}

[data-theme="dark"] .weather-desc,
[data-theme="dark"] .weather-chip {
  background: rgba(255,255,255,0.08);
  border-color: rgba(255,255,255,0.08);
}

/* ========== 轮播占位（已被天气组件替换，但保留以便复用） ========== */
.carousel-placeholder {
  grid-column: span 2;
  grid-row: span 2;
  width: 100%;
  height: 100%;
  border-radius: var(--widget-border-radius);
  border: 1px dashed var(--widget-border);
  background: transparent;
  opacity: 0.35;
  box-sizing: border-box;
}

[data-theme="dark"] .carousel-placeholder {
  border-color: var(--widget-border-strong);
  opacity: 0.25;
}

/* ========== Weather Animations ========== */
@keyframes sunSpin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

@keyframes sunPulse {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.05); opacity: 0.9; }
}

@keyframes rainFall {
  0% { transform: translateY(0); opacity: 0; }
  20% { opacity: 1; }
  100% { transform: translateY(38px); opacity: 0; }
}

@keyframes moonFloat {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-4px); }
}

/* ========== 自定义文字组件 - 1×2 ========== */
.text-widget {
  grid-column: span 2;
  grid-row: span 1;
  background: transparent;
  backdrop-filter: blur(var(--blur-amount));
  -webkit-backdrop-filter: blur(var(--blur-amount));
  border: none;
  border-radius: var(--widget-border-radius-sm);
  padding: 10px 14px;
  color: var(--widget-text-strong);
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  transition: all var(--transition-fast);
  width: 100%;
  height: 100%;
  min-width: 0;
  min-height: 0;
  box-sizing: border-box;
}

.text-widget:active {
  transform: scale(0.98);
}

.text-widget-icon {
  font-size: var(--font-size-xl);
  color: var(--accent-color);
}

.text-widget-icon i {
  font-size: var(--font-size-xl);
  color: currentColor;
  text-shadow: none;
}

.text-widget-content {
  flex: 1;
}

.text-widget-no-icon .text-widget-content {
  margin-left: 0;
}

.text-widget-title {
  font-size: var(--font-size-sm);
  font-weight: normal;
  margin-bottom: 2px;
  color: var(--widget-text-strong);
}

.text-widget-subtitle {
  font-size: var(--font-size-sm);
  opacity: 1;
  color: var(--widget-text-muted);
}

/* ========== 照片墙 - 2×4 ========== */
.photo-wall {
  grid-column: span 4;
  grid-row: span 2;
  background: transparent;
  backdrop-filter: blur(var(--blur-amount));
  -webkit-backdrop-filter: blur(var(--blur-amount));
  border: 1px solid var(--widget-border);
  border-radius: var(--widget-border-radius);
  padding: 12px;
  display: flex;
  gap: 10px;
  align-items: center;
  justify-content: center;
  overflow: visible;
  width: 100%;
  height: 100%;
  min-width: 0;
  min-height: 0;
  box-sizing: border-box;
}

.polaroid {
  width: 28%;
  background: var(--widget-polaroid-bg);
  padding: 8px 8px 24px 8px;
  border-radius: 4px;
  box-shadow: 0 6px 16px rgba(0,0,0,0.1);
  transform-origin: center;
  transition: transform var(--transition-fast);
  cursor: pointer;
}

.polaroid:nth-child(1) { 
  transform: rotate(-8deg) translateY(-5px); 
}

.polaroid:nth-child(2) { 
  transform: rotate(4deg) scale(1.05); 
  z-index: 2; 
}

.polaroid:nth-child(3) { 
  transform: rotate(-6deg) translateY(5px); 
}

.polaroid:hover {
  transform: rotate(0deg) scale(1.15) !important;
  z-index: 10;
}

.polaroid-image {
  width: 100%;
  aspect-ratio: 1;
  background: linear-gradient(135deg, var(--accent-color), var(--accent-secondary));
  border-radius: 2px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  color: var(--text-white);
  margin-bottom: 6px;
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
}

.polaroid-image i {
  font-size: 28px;
  color: white;
}

.polaroid-caption {
  text-align: center;
  font-size: 8px;
  color: var(--widget-polaroid-text);
  font-family: 'Courier New', monospace;
}

/* ========== 播放器 - 2×2 (一起听样式) ========== */
.music-player {
  --music-expand: clamp(4px, 1vw, 10px);
  --avatar-wave-color-light: rgba(255,255,255,0.75);
  --avatar-wave-glow-light: rgba(255,255,255,0.38);
  --avatar-wave-color-dark: rgba(255,255,255,0.85);
  --avatar-wave-glow-dark: rgba(255,255,255,0.45);
  --heart-glow-light: rgba(255, 107, 177, 0.65);
  --heart-glow-dark: rgba(255, 153, 210, 0.75);
  --heart-icon-light: #ff6f9e;
  --heart-icon-dark: #ffc5e0;
  --heart-glow-color: var(--heart-glow-light);
  --heart-icon-color: var(--heart-icon-light);
  --avatar-wave-color: var(--avatar-wave-color-light);
  --avatar-wave-glow: var(--avatar-wave-glow-light);
  grid-column: span 3;
  grid-row: span 2;
  background: linear-gradient(145deg, var(--widget-card-bg-start) 0%, var(--widget-card-bg-end) 100%);
  backdrop-filter: blur(var(--blur-strong));
  -webkit-backdrop-filter: blur(var(--blur-strong));
  border: none;
  border-radius: var(--widget-border-radius);
  padding: clamp(8px, 1.6vw, 12px);
  color: var(--widget-text-strong);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  cursor: pointer;
  transition: all var(--transition-fast);
  overflow: hidden;
  position: relative;
  width: calc(100% + var(--music-expand) * 2);
  height: calc(100% + var(--music-expand) * 2);
  margin: calc(var(--music-expand) * -1);
  min-width: 0;
  min-height: 0;
  box-sizing: border-box;
  box-shadow: none;
}

.music-player::after {
  content: none;
}

[data-theme="dark"] .music-player {
  --avatar-wave-color: var(--avatar-wave-color-dark);
  --avatar-wave-glow: var(--avatar-wave-glow-dark);
  --heart-glow-color: var(--heart-glow-dark);
  --heart-icon-color: var(--heart-icon-dark);
}

.listen-visualizer {
  position: absolute;
  inset: clamp(6px, 1vw, 10px);
  opacity: 0;
  pointer-events: none;
  display: none; /* 去掉波纹特效 */
}

.music-player.is-playing .listen-visualizer {
  opacity: 0.78;
  transform: scale(1.04);
}

.listen-visualizer .wave {
  animation: none !important;
  opacity: 0;
}

.listen-visualizer .wave-1 {
  animation: none !important;
}

.listen-visualizer .wave-2 {
  animation: none !important;
  opacity: 0;
}

.listen-visualizer .wave-3 {
  animation: none !important;
  opacity: 0;
}

.music-player:active {
  transform: scale(0.98);
}

.player-top {
  display: flex;
  flex-direction: column;
  gap: clamp(4px, 1vw, 8px);
  flex: 1 1 auto;
  position: relative;
  z-index: 2;
}

.player-avatars {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  justify-content: stretch;
  justify-items: center;
  align-items: center;
  width: 84%;
  margin: 0 auto;
  gap: clamp(4px, 2vw, 12px);
  position: relative;
  padding: clamp(2px, 0.8vw, 6px) 0;
  z-index: 2;
}

.player-avatars::before {
  content: none; /* 去掉连接区域发光波纹 */
}

.music-player.is-playing .player-avatars::before {
  animation: none;
}

.avatar-link {
  position: absolute;
  left: 18%;
  right: 18%;
  top: 55%;
  height: clamp(70px, 13vw, 90px);
  transform: translateY(-4%);
  pointer-events: none;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  filter: drop-shadow(0 12px 24px rgba(0,0,0,0.35));
}

.avatar-link::before,
.avatar-link::after {
  content: none !important;
}

.music-player.is-playing .avatar-link {
  animation: avatarLinkFloat 6s ease-in-out infinite;
}

.connection-line {
  position: absolute;
  inset: calc(50% - 1px) 18%;
  height: 2px;
  background: linear-gradient(90deg, transparent 0%, rgba(255,255,255,0.12) 10%, rgba(255,255,255,0.32) 50%, rgba(255,255,255,0.14) 90%, transparent 100%);
  opacity: 0.7; /* 心形下方连线更浅 */
  z-index: 0;
}

.connection-line::before {
  content: none;
}

.spectrum-bars {
  width: 100%;
  height: 100%;
  padding: 0 clamp(12px, 2.4vw, 22px);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: clamp(2px, 0.6vw, 6px);
  position: relative;
  z-index: 1;
}

.spectrum-bar {
  width: clamp(2px, 0.45vw, 4px);
  height: var(--bar-height, 6px);
  border-radius: 999px;
  background: var(--bar-color, rgba(255,255,255,0.85));
  box-shadow: 0 0 12px rgba(255,255,255,0.45);
  opacity: 0.4;
  transition: height 0.22s ease, opacity 0.28s ease, filter 0.28s ease;
  mix-blend-mode: screen;
}

.music-player.is-playing .spectrum-bar {
  filter: drop-shadow(0 0 8px rgba(255,255,255,0.45));
}

.heart-wrapper {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  padding: clamp(4px, 1vw, 8px);
  border-radius: 999px;
  background: transparent; /* 去除灰色背景圆圈 */
  border: none;
  box-shadow: none;
  z-index: 2;
  min-width: clamp(28px, 4vw, 38px);
  min-height: clamp(28px, 4vw, 38px);
  display: flex;
  align-items: center;
  justify-content: center;
}

.heart-wrapper .heart-glow {
  position: absolute;
  inset: clamp(-12px, -1.4vw, -6px);
  border-radius: inherit;
  background: radial-gradient(circle, var(--heart-glow-color, var(--heart-glow-light, rgba(255, 107, 177, 0.65))), rgba(255,107,177,0));
  filter: blur(10px);
  opacity: 0.65;
  animation: heartGlowPulse 3s ease-in-out infinite;
}

.heart-wrapper i {
  position: relative;
  font-size: clamp(16px, 2.6vw, 22px);
  color: var(--heart-icon-color, #ff6f9e);
  text-shadow: 0 0 12px rgba(255,113,180,0.8);
  animation: heartBeatIcon 1.4s ease-in-out infinite;
}

.music-player:not(.is-playing) .heart-wrapper i,
.music-player:not(.is-playing) .heart-wrapper .heart-glow {
  animation-play-state: paused;
  opacity: 0.7;
}

.avatar-wave-svg {
  display: none;
}

.avatar-wave {
  fill: none;
  stroke: var(--avatar-wave-color, var(--avatar-wave-color-light, rgba(255,255,255,0.65)));
  stroke-width: 3.4px;
  stroke-linecap: round;
  stroke-linejoin: round;
  opacity: 0.86;
  stroke-dasharray: 26 18;
  filter: drop-shadow(0 10px 18px rgba(0,0,0,0.2));
  animation: none;
}

.avatar-wave.glow {
  stroke: var(--avatar-wave-glow, var(--avatar-wave-glow-light, rgba(255,255,255,0.35)));
  stroke-width: 7.5px;
  opacity: 0.26;
  filter: blur(14px);
  stroke-dasharray: 34 26;
  animation: none;
}

.player-avatar {
  width: clamp(52px, 6vw, 62px);
  height: clamp(52px, 6vw, 62px);
  border-radius: 50%;
  background: radial-gradient(circle at 30% 30%, rgba(255,255,255,0.18), transparent 55%), linear-gradient(140deg, #ff7b9c, #7c7bff);
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 10px 22px rgba(0,0,0,0.25), 0 0 20px rgba(255,105,180,0.5);
  position: relative;
  --avatar-shift: 18px;
  transform: translateY(var(--avatar-shift));
  transition: transform var(--transition-fast), box-shadow var(--transition-fast);
  z-index: 2;
}

.player-avatar.left {
  background: radial-gradient(circle at 30% 30%, rgba(255,255,255,0.18), transparent 55%), linear-gradient(140deg, #ff7b7b, #ff6fb1);
  box-shadow: 0 10px 22px rgba(0,0,0,0.25), 0 0 22px rgba(255,111,177,0.6);
  border: 2px solid rgba(255,111,177,0.65);
}

.player-avatar.right {
  background: radial-gradient(circle at 30% 30%, rgba(255,255,255,0.18), transparent 55%), linear-gradient(140deg, #6de1ff, #4ecdc4);
  box-shadow: 0 10px 22px rgba(0,0,0,0.25), 0 0 22px rgba(78,205,196,0.6);
  border: 2px solid rgba(78,205,196,0.65);
}

.player-avatar::before,
.player-avatar::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 1px solid rgba(255,255,255,0.28);
  opacity: 0;
  box-shadow: 0 0 18px rgba(255,255,255,0.22);
}

.music-player.is-playing .player-avatar::before {
  animation: avatarRippleExpand 2.6s ease-out infinite;
}

.music-player.is-playing .player-avatar::after {
  animation: avatarRippleExpand 2.6s ease-out infinite 0.85s;
}
.player-avatar.has-img {
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
}

.player-avatar.has-img i {
  display: none;
}

.player-avatar.left {
  justify-self: start;
}

.player-avatar.right {
  justify-self: end;
}

.music-player.is-playing .player-avatar {
  animation: pulse-avatar 2.6s ease-in-out infinite;
}

.avatar-icon {
  font-size: clamp(20px, 2.8vw, 24px);
  color: white;
  text-shadow: var(--widget-text-shadow);
}

.player-cover {
  display: flex;
  align-items: center;
  gap: clamp(6px, 1.2vw, 8px);
  background: transparent;
  border: none;
  border-radius: 0;
  padding: 0;
  min-width: 0;
  justify-self: center;
  position: relative;
  box-shadow: none;
}

.player-cover .cover-img {
  width: clamp(70px, 8vw, 82px);
  height: clamp(70px, 8vw, 82px);
  border-radius: 50%;
  background: radial-gradient(circle at 30% 30%, rgba(255,255,255,0.18), transparent 45%), radial-gradient(circle at 70% 70%, rgba(255,255,255,0.12), transparent 40%), linear-gradient(135deg, var(--widget-gradient-4-start), var(--widget-gradient-4-end));
  border: 3px solid rgba(255,255,255,0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-on-primary);
  overflow: hidden;
  position: relative;
  box-shadow: 0 6px 14px rgba(0,0,0,0.16); /* 缩小转盘底部阴影 */
}

.player-cover .cover-img::after {
  content: "";
  position: absolute;
  inset: 24%;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(0,0,0,0.25) 0 40%, transparent 60%);
  mix-blend-mode: multiply;
}

.player-cover .cover-img::before {
  content: "";
  position: absolute;
  inset: 44%;
  border-radius: 50%;
  background: rgba(255,255,255,0.85);
  box-shadow: inset 0 0 0 2px rgba(0,0,0,0.12);
}

.player-cover .cover-img.has-cover {
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
}

.music-player.is-playing .player-cover .cover-img {
  animation: rotate-record 8s linear infinite;
}

.player-cover .cover-img.has-cover i {
  display: none;
}

.player-meta {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: clamp(2px, 0.5vw, 3px);
  margin-top: clamp(4px, 1vw, 6px);
}

.player-meta .player-song {
  font-size: clamp(13px, 2vw, 15px);
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--widget-text-strong);
}

.player-meta .player-artist {
  font-size: clamp(11px, 1.8vw, 12px);
  opacity: 1;
  color: var(--widget-text-muted);
}

.player-progress {
  width: 100%;
  height: clamp(3px, 0.5vw, 4px);
  background: var(--widget-player-border);
  border-radius: 2px;
  overflow: hidden;
  margin-top: clamp(6px, 1.2vw, 10px);
  margin-bottom: clamp(8px, 1.5vw, 12px);
  position: relative;
  z-index: 2;
  flex-shrink: 0;
  min-height: 3px;
}

.player-progress-bar {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--accent-color), var(--accent-secondary));
  border-radius: 2px;
  transition: width 0.3s ease;
  min-width: 0;
}

.player-controls {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: clamp(10px, 2vw, 16px);
  position: relative;
  z-index: 2;
  flex-shrink: 0;
}

.player-btn {
  width: clamp(28px, 4vw, 32px);
  height: clamp(28px, 4vw, 32px);
  border-radius: 50%;
  background: var(--widget-surface-muted);
  border: none;
  color: var(--widget-text-strong);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all var(--transition-fast);
  font-size: clamp(12px, 1.8vw, var(--font-size-base-lg));
  flex-shrink: 0;
}

.player-btn:active {
  transform: scale(0.9);
  background: var(--widget-glass-bg-hover);
}

.player-btn.play {
  width: clamp(36px, 5vw, 40px);
  height: clamp(36px, 5vw, 40px);
  background: var(--accent-color);
  color: var(--text-on-primary);
  font-size: clamp(14px, 2vw, var(--font-size-lg));
}

.player-btn i {
  font-size: clamp(12px, 1.8vw, 14px);
}

.player-btn.play i {
  font-size: clamp(14px, 2vw, 16px);
}

@keyframes listenWaveFloat {
  0% { transform: translate3d(-3%, -2%, 0) scale(1); }
  50% { transform: translate3d(2%, 3%, 0) scale(1.05); }
  100% { transform: translate3d(-3%, -2%, 0) scale(1); }
}

@keyframes listenWaveBars {
  from { background-position: 0 0, 0 0; }
  to { background-position: 220px 0, 0 0; }
}

@keyframes avatarWaveFlow {
  0% { stroke-dashoffset: 0; }
  50% { stroke-dashoffset: -80; }
  100% { stroke-dashoffset: -160; }
}

@keyframes avatarLinkFloat {
  0%, 100% { transform: translateY(-6%); }
  50% { transform: translateY(-2%); }
}

@keyframes avatarSpectrumShift {
  0% { background-position: 0% 50%, 0 100%; }
  100% { background-position: 100% 50%, 100% 100%; }
}

@keyframes avatarSpectrumPulse {
  0% { background-size: 200% 40%, 10px 30%; }
  50% { background-size: 200% 80%, 10px 90%; }
  100% { background-size: 200% 40%, 10px 30%; }
}

@keyframes heartBeatIcon {
  0% { transform: scale(1); }
  18% { transform: scale(1.25); }
  32% { transform: scale(1); }
  48% { transform: scale(1.18); }
  70% { transform: scale(1); }
  100% { transform: scale(1); }
}

@keyframes heartGlowPulse {
  0% { opacity: 0.4; transform: scale(0.9); }
  50% { opacity: 0.9; transform: scale(1.05); }
  100% { opacity: 0.4; transform: scale(0.9); }
}

@keyframes avatarRippleExpand {
  0% { transform: scale(1); opacity: 0.45; }
  60% { transform: scale(1.6); opacity: 0.1; }
  100% { transform: scale(1.9); opacity: 0; }
}

@keyframes pulse-listen {
  0% { transform: scale(1); box-shadow: 0 0 0 0 rgba(255,255,255,0.35); }
  50% { transform: scale(1.04); box-shadow: 0 0 0 8px rgba(255,255,255,0.08); }
  100% { transform: scale(1); box-shadow: 0 0 0 0 rgba(255,255,255,0); }
}

@keyframes rotate-record {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

@keyframes pulse-line {
  0%,100% { opacity: 0.35; }
  50% { opacity: 0.9; }
}

@keyframes pulse-avatar {
  0%,100% { transform: translateY(var(--avatar-shift, 0)) scale(1); box-shadow: 0 6px 14px rgba(0,0,0,0.18); }
  50% { transform: translateY(calc(var(--avatar-shift, 0) + 1px)) scale(1.05); box-shadow: 0 10px 24px rgba(0,0,0,0.22); }
}

.contacts-modal.music-modal {
  background: rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  align-items: center;
  justify-content: center;
  padding: 0;
}

.contacts-modal.music-modal.hidden {
  display: none;
}

.contacts-modal.music-modal .modal-content {
  width: min(780px, 88vw);
  max-height: 85vh;
  background: var(--widget-surface);
  border: 1px solid var(--widget-border-strong);
  border-radius: clamp(12px, 2.2vw, 16px);
  box-shadow: var(--widget-shadow-strong);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  pointer-events: auto;
  position: relative;
}

.contacts-modal.music-modal .modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: clamp(10px, 1.8vw, 12px) clamp(12px, 2.2vw, 16px);
  border-bottom: 1px solid var(--widget-border-strong);
  background: var(--widget-glass-bg);
  flex-shrink: 0;
}

.contacts-modal.music-modal .music-modal-title {
  display: flex;
  align-items: center;
  gap: clamp(6px, 1.2vw, 8px);
  font-weight: 700;
  color: var(--widget-text-strong);
  font-size: clamp(14px, 2vw, 16px);
}

.contacts-modal.music-modal .music-modal-actions {
  display: flex;
  align-items: center;
  gap: clamp(6px, 1.2vw, 8px);
  flex-wrap: wrap;
}

.contacts-modal.music-modal .modal-close,
.contacts-modal.music-modal .music-chip {
  border: 1px solid var(--widget-border-strong);
  background: var(--widget-surface-muted);
  color: var(--widget-text-strong);
  border-radius: clamp(8px, 1.5vw, 10px);
  padding: clamp(5px, 1vw, 6px) clamp(8px, 1.5vw, 10px);
  cursor: pointer;
  transition: all var(--transition-fast);
  font-size: clamp(12px, 1.8vw, 14px);
  white-space: nowrap;
}

.contacts-modal.music-modal .modal-close:hover,
.contacts-modal.music-modal .music-chip:hover {
  background: var(--widget-glass-bg-hover);
}

.contacts-modal.music-modal .music-chip.ghost {
  background: transparent;
  border-color: var(--widget-border);
  color: var(--widget-text-muted);
}

.contacts-modal.music-modal .music-chip.active {
  background: linear-gradient(120deg, var(--accent-color), var(--accent-secondary));
  border-color: transparent;
  color: var(--text-on-primary);
  box-shadow: 0 8px 20px rgba(0,0,0,0.12);
}

.contacts-modal.music-modal .modal-body {
  padding: clamp(10px, 2vw, 12px) clamp(12px, 2.2vw, 14px) clamp(4px, 1vw, 6px);
}

.music-modal-body {
  display: grid;
  grid-template-columns: 1.15fr 1.1fr;
  gap: clamp(8px, 1.5vw, 12px);
  min-height: 0;
  width: 100%;
}

.music-modal-left,
.music-modal-right {
  display: flex;
  flex-direction: column;
  gap: clamp(10px, 1.8vw, 12px);
  min-width: 0;
}

.music-cover-preview {
  width: 100%;
  max-width: clamp(180px, 36vw, 220px);
  aspect-ratio: 1 / 1;
  border-radius: clamp(12px, 2vw, 14px);
  border: 1px solid var(--widget-border-strong);
  background: linear-gradient(135deg, var(--widget-gradient-2-start, #6d8bff), var(--widget-gradient-3-end, #f06292));
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-on-primary);
  overflow: hidden;
  min-height: 0;
  align-self: center;
}

.music-cover-preview.has-cover {
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
}

.music-meta {
  display: flex;
  flex-direction: column;
  gap: clamp(8px, 1.5vw, 10px);
}

.music-meta-row {
  display: flex;
  flex-direction: column;
  gap: clamp(5px, 1vw, 6px);
  font-size: clamp(12px, 1.8vw, 13px);
}

.music-meta-row.dual {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: clamp(8px, 1.5vw, 10px);
}

.music-meta-row label {
  font-size: clamp(11px, 1.6vw, 12px);
  color: var(--widget-text-muted);
}

.music-meta-row input,
.music-meta-row textarea,
.album-import input,
.avatar-config select {
  width: 100%;
  border: 1px solid var(--widget-border);
  border-radius: clamp(8px, 1.5vw, 10px);
  padding: clamp(6px, 1.2vw, 7px) clamp(8px, 1.5vw, 9px);
  background: var(--widget-surface-muted);
  color: var(--widget-text-strong);
  box-sizing: border-box;
  font-size: clamp(12px, 1.8vw, 14px);
}

.music-meta-row textarea {
  resize: vertical;
  min-height: clamp(60px, 10vw, 80px);
}

.music-meta-row.actions {
  display: flex;
  gap: clamp(8px, 1.5vw, 10px);
  flex-wrap: wrap;
}

.music-primary,
.music-ghost {
  border: 1px solid var(--widget-border-strong);
  border-radius: clamp(8px, 1.5vw, 10px);
  padding: clamp(7px, 1.2vw, 9px) clamp(10px, 1.8vw, 12px);
  cursor: pointer;
  transition: all var(--transition-fast);
  font-size: clamp(12px, 1.8vw, 14px);
  flex: 1;
  min-width: 0;
}

.music-primary {
  background: var(--accent-color);
  color: var(--text-on-primary);
  border-color: transparent;
}

.music-ghost {
  background: transparent;
  color: var(--widget-text-strong);
}

.music-primary.full,
.album-import button.full {
  width: 100%;
}

.music-section {
  border: 1px solid var(--widget-border-strong);
  border-radius: clamp(10px, 1.8vw, 12px);
  padding: clamp(8px, 1.5vw, 10px) clamp(10px, 1.8vw, 12px);
  background: var(--widget-glass-bg);
}

.music-section .section-title {
  font-weight: 700;
  margin-bottom: clamp(6px, 1.2vw, 8px);
  color: var(--widget-text-strong);
  font-size: clamp(13px, 2vw, 15px);
}

.avatar-config {
  display: flex;
  flex-direction: column;
  gap: clamp(6px, 1.2vw, 8px);
}

.avatar-picker-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: clamp(8px, 1.5vw, 10px);
}

.avatar-picker {
  display: flex;
  align-items: center;
  gap: clamp(8px, 1.5vw, 10px);
  padding: clamp(5px, 1vw, 7px);
  border: 1px solid var(--widget-border);
  border-radius: clamp(8px, 1.5vw, 10px);
  background: var(--widget-surface-muted);
}

.avatar-thumb {
  width: clamp(40px, 6vw, 48px);
  height: clamp(40px, 6vw, 48px);
  border-radius: clamp(10px, 1.8vw, 12px);
  background: var(--widget-gradient);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-on-primary);
  overflow: hidden;
  background-size: cover;
  background-position: center;
  flex-shrink: 0;
}

.avatar-thumb.has-img span {
  display: none;
}

.avatar-thumb.small {
  width: clamp(32px, 5vw, 40px);
  height: clamp(32px, 5vw, 40px);
  border-radius: clamp(8px, 1.5vw, 10px);
}

.avatar-legend {
  font-size: clamp(11px, 1.6vw, 12px);
  color: var(--widget-text-muted);
}

.avatar-picker-modal {
  position: fixed;
  inset: 0;
  z-index: 5000;
  display: flex;
  align-items: center;
  justify-content: center;
}

.avatar-picker-mask {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.45);
  backdrop-filter: blur(6px);
}

.avatar-picker-dialog {
  position: relative;
  width: min(720px, 92vw);
  max-height: 80vh;
  background: var(--widget-surface);
  border: 1px solid var(--widget-border-strong);
  border-radius: 14px;
  box-shadow: var(--widget-shadow-strong);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  z-index: 1;
}

.avatar-picker-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 12px;
  border-bottom: 1px solid var(--widget-border-strong);
}

.avatar-picker-header .title {
  font-weight: 700;
}

.avatar-picker-header .close-btn {
  border: none;
  background: var(--widget-surface-muted);
  border-radius: 8px;
  padding: 6px 8px;
  cursor: pointer;
}

.avatar-picker-body {
  padding: 12px;
  overflow: auto;
}

.avatar-picker-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 10px;
}

.avatar-option {
  border: 1px solid var(--widget-border);
  border-radius: 10px;
  padding: 10px;
  background: var(--widget-glass-bg);
  cursor: pointer;
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 8px;
  align-items: center;
}

.avatar-option:hover {
  border-color: var(--accent-color);
  box-shadow: 0 6px 18px rgba(0,0,0,0.08);
}

.avatar-option-name {
  font-weight: 600;
  color: var(--widget-text-strong);
}

.avatar-option-tag {
  font-size: 12px;
  color: var(--widget-text-muted);
}

.avatar-empty {
  text-align: center;
  color: var(--widget-text-muted);
}

.album-import {
  display: flex;
  flex-direction: column;
  gap: clamp(6px, 1.2vw, 8px);
}

.album-import label {
  font-size: clamp(11px, 1.6vw, 12px);
  color: var(--widget-text-muted);
  display: flex;
  flex-direction: column;
  gap: clamp(3px, 0.8vw, 4px);
}

.lrc-preview {
  max-height: clamp(180px, 30vh, 220px);
  border: 1px solid var(--widget-border);
  border-radius: clamp(8px, 1.5vw, 10px);
  padding: clamp(6px, 1.2vw, 8px);
  background: var(--widget-surface-muted);
  overflow-y: auto;
}

.lrc-list {
  display: flex;
  flex-direction: column;
  gap: clamp(3px, 0.8vw, 4px);
}

.lrc-line {
  font-size: clamp(11px, 1.6vw, 12px);
  color: var(--widget-text-muted);
  padding: clamp(3px, 0.8vw, 4px) clamp(5px, 1vw, 6px);
  border-radius: clamp(5px, 1vw, 6px);
}

.lrc-line.active {
  color: var(--widget-text-strong);
  background: var(--widget-glass-bg-hover);
}

.playlist-controls {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 6px;
}

.playlist-list {
  max-height: clamp(200px, 32vh, 240px);
  overflow-y: auto;
  border: 1px solid var(--widget-border);
  border-radius: clamp(8px, 1.5vw, 10px);
  background: var(--widget-surface-muted);
  padding: clamp(6px, 1.2vw, 8px);
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.playlist-item {
  padding: clamp(6px, 1.2vw, 8px);
  border-radius: clamp(6px, 1.2vw, 8px);
  background: var(--widget-glass-bg);
  border: 1px solid var(--widget-border);
  cursor: pointer;
  transition: all var(--transition-fast);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.playlist-meta {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.playlist-item:hover {
  background: var(--widget-glass-bg-hover);
}

.playlist-item.active {
  border-color: var(--accent-color);
  box-shadow: 0 6px 16px rgba(0,0,0,0.12);
}

.playlist-title {
  font-weight: 700;
  color: var(--widget-text-strong);
  font-size: clamp(12px, 1.8vw, 14px);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.playlist-artist {
  font-size: clamp(11px, 1.6vw, 12px);
  color: var(--widget-text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.playlist-delete {
  border: none;
  background: transparent;
  color: var(--widget-text-muted);
  cursor: pointer;
  padding: 4px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition-fast);
  flex-shrink: 0;
}

.playlist-delete:hover {
  color: var(--widget-text-strong);
  background: var(--widget-glass-bg-hover);
}

.contacts-modal.music-modal .modal-footer {
  border-top: 1px solid var(--widget-border-strong);
  padding: clamp(8px, 1.5vw, 10px) clamp(12px, 2.2vw, 14px);
  background: var(--widget-glass-bg);
  flex-shrink: 0;
}

.contacts-modal.music-modal.lyrics-layer-open .modal-content {
  transform: translateY(-6px) scale(0.985);
  transition: transform var(--transition-fast);
}

.contacts-modal.music-modal.lyrics-layer-open .music-modal-body,
.contacts-modal.music-modal.lyrics-layer-open .modal-footer {
  filter: blur(1px);
  opacity: 0.9;
}

.music-floating-panel {
  position: absolute;
  top: clamp(18px, 3vw, 22px);
  right: clamp(10px, 1.8vw, 12px);
  width: clamp(200px, 30vw, 300px);
  display: block;
  pointer-events: none;
  opacity: 0;
  transform: translate3d(clamp(24px, 4vw, 32px), clamp(18px, 3vw, 24px), 0) scale(0.94);
  transition: opacity var(--transition-fast), transform var(--transition-fast);
  z-index: 5;
}

.music-floating-panel.active {
  opacity: 1;
  pointer-events: auto;
  transform: translate3d(0, 0, 0) scale(1);
}

.music-floating-panel.is-pinned {
  position: fixed;
  top: clamp(52px, 16vh, 120px);
  right: clamp(10px, 5vw, 38px);
  z-index: 5000;
}

.floating-panel-card {
  background: linear-gradient(145deg, rgba(30, 34, 58, 0.96), rgba(13, 17, 34, 0.9));
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: clamp(12px, 2.2vw, 16px);
  padding: clamp(10px, 1.8vw, 12px);
  box-shadow: 0 18px 40px rgba(13, 17, 34, 0.45);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  color: var(--text-on-primary);
  display: flex;
  flex-direction: column;
  gap: clamp(10px, 1.8vw, 12px);
}

.music-floating-panel.is-pinned .floating-panel-card {
  box-shadow: 0 35px 70px rgba(0, 0, 0, 0.45);
  border-color: rgba(255, 255, 255, 0.2);
}

.floating-panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: clamp(10px, 1.8vw, 12px);
}

.floating-panel-title {
  display: flex;
  flex-direction: column;
  gap: clamp(3px, 0.8vw, 4px);
}

.floating-song {
  font-size: clamp(13px, 2vw, 15px);
  font-weight: 700;
  color: #fff;
}

.floating-artist {
  font-size: clamp(11px, 1.6vw, 12px);
  color: rgba(255, 255, 255, 0.65);
}

.floating-panel-actions .music-chip {
  padding: clamp(3px, 0.8vw, 4px) clamp(6px, 1.2vw, 8px);
  font-size: clamp(11px, 1.6vw, 12px);
}

.floating-panel-body {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: clamp(10px, 1.8vw, 12px);
  align-items: stretch;
}

.floating-cover {
  width: clamp(80px, 12vw, 96px);
  height: clamp(80px, 12vw, 96px);
  border-radius: clamp(12px, 2.2vw, 16px);
  background: linear-gradient(135deg, var(--widget-gradient-3-start, #6d8bff), var(--widget-gradient-4-end, #ff9eb8));
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.35);
  overflow: hidden;
  position: relative;
  flex-shrink: 0;
}

.floating-cover.has-cover {
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
}

.floating-cover i {
  font-size: clamp(24px, 4vw, 30px);
  color: var(--text-on-primary);
}

.floating-cover.has-cover i {
  display: none;
}

.floating-lyrics-list {
  max-height: clamp(180px, 30vh, 220px);
  overflow-y: auto;
  padding: clamp(3px, 0.8vw, 4px) 0;
  display: flex;
  flex-direction: column;
  gap: clamp(3px, 0.8vw, 4px);
  scrollbar-width: thin;
}

.floating-lyrics-list::-webkit-scrollbar {
  width: 4px;
}

.floating-lyrics-list::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.2);
  border-radius: 4px;
}

.floating-lyrics-list .lrc-line {
  font-size: clamp(12px, 1.8vw, 13px);
  color: rgba(255, 255, 255, 0.75);
  padding: clamp(5px, 1vw, 6px) clamp(8px, 1.5vw, 10px);
  border-radius: clamp(8px, 1.5vw, 10px);
  transition: background var(--transition-fast), color var(--transition-fast);
}

.floating-lyrics-list .lrc-line.active {
  color: #fff;
  background: rgba(255, 255, 255, 0.18);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.2);
}

.time-info {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: clamp(8px, 1.5vw, 10px);
  align-items: center;
  color: var(--widget-text-muted);
  font-size: clamp(11px, 1.6vw, 13px);
}

.modal-progress {
  width: 100%;
  height: clamp(4px, 0.8vw, 6px);
  background: var(--widget-player-border);
  border-radius: clamp(3px, 0.6vw, 4px);
  overflow: hidden;
}

.modal-progress-bar {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--accent-color), var(--accent-secondary));
  transition: width 0.25s ease;
}

/* ========== Dock栏样式 ========== */
.desktop-dock {
  position: absolute;
  bottom: var(--dock-bottom);
  left: 50%;
  transform: translateX(-50%);
  width: min(calc(100% - 24px), 420px);
  /* 固定高度,不随内容缩放 */
  height: var(--dock-height);
  min-height: var(--dock-height);
  max-height: var(--dock-height);
  /* 透明背景，让screen-content的背景显示 */
  background: var(--dock-bg);
  backdrop-filter: var(--dock-backdrop);
  -webkit-backdrop-filter: var(--dock-backdrop);
  border: 1px solid var(--dock-border);
  border-radius: var(--dock-border-radius);
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px clamp(12px, 3vw, 18px);
  gap: clamp(8px, 2vw, 12px);
  z-index: var(--z-tabbar);
  box-shadow: var(--dock-shadow);
  pointer-events: auto;
  flex-shrink: 0;
}

/* dock显示/隐藏由JavaScript控制，不再使用:has()选择器（兼容性更好） */

.dock-icon {
  /* 固定宽度,确保不被压扁 */
  width: var(--dock-icon-size);
  height: var(--dock-icon-size);
  min-width: var(--dock-icon-size);
  min-height: var(--dock-icon-size);
  max-width: var(--dock-icon-size);
  max-height: var(--dock-icon-size);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all var(--transition-fast);
  border-radius: 14px;
  pointer-events: auto;
  flex-shrink: 0;
  position: relative;
  overflow: visible;
}

.dock-icon:active {
  transform: scale(0.9);
  background: rgba(255, 255, 255, 0.15);
}

.dock-icon .icon-image {
  /* 固定尺寸,与上方图标一致 */
  width: var(--dock-icon-size);
  height: var(--dock-icon-size);
  min-width: var(--dock-icon-size);
  min-height: var(--dock-icon-size);
  max-width: var(--dock-icon-size);
  max-height: var(--dock-icon-size);
  aspect-ratio: 1;
  border-radius: var(--icon-radius-dock);
  margin: 0 auto;
  flex-shrink: 0;
}

.dock-icon-symbol {
  font-size: var(--font-size-xxl);
  color: var(--text-on-primary);
  margin-bottom: 4px;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

.dock-icon-name {
  font-size: var(--font-size-xs);
  color: var(--text-primary);
  text-align: center;
  font-weight: 500;
  text-shadow: none;
}

.desktop-icon-badge.dock {
  top: -6px;
  right: -4px;
  min-width: 22px;
  padding: 3px 7px;
  font-size: 12px;
}

/* 夜间模式dock文字颜色 */
[data-theme="dark"] .dock-icon-name {
  color: var(--text-primary);
}

/* Dock栏中的图标隐藏标签 */
.desktop-dock .desktop-icon .icon-label {
  display: none;
}

/* ========== 翻页指示器 ========== */
.page-indicator {
  position: absolute;
  bottom: calc(var(--dock-height) + var(--dock-bottom) + 16px);
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 12px;
  z-index: calc(var(--z-tabbar) + 1);
  height: var(--page-indicator-height);
  align-items: center;
  padding: 6px 16px;
  /* 透明背景，让screen-content的背景显示 */
  background: var(--page-indicator-bg);
  border-radius: 999px;
  border: 1px solid var(--page-indicator-border);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  pointer-events: auto;
  transition: opacity var(--transition-normal);
}

/* 隐藏指示器（单页面时） */
.page-indicator.hidden {
  opacity: 0;
  pointer-events: none;
}

.page-indicator .page-dot {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--page-dot-bg);
  border: none;
  padding: 6px;
  cursor: pointer;
  transition: all var(--transition-fast);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.page-indicator .page-dot:focus-visible {
  outline: 2px solid rgba(255,255,255,0.6);
  outline-offset: 2px;
}

.page-indicator .page-dot.active {
  background: var(--page-dot-active-bg);
  width: 32px;
  border-radius: 999px;
}

/* ========== 夜间模式适配 ========== */
[data-theme="dark"] .desktop-icon,
[data-theme="dark"] .icon {
  background: transparent;
}

[data-theme="dark"] .icon-image {
  box-shadow: 
    0 2px 8px rgba(0, 0, 0, 0.3),
    0 1px 2px rgba(0, 0, 0, 0.2);
}

[data-theme="dark"] .desktop-dock {
  background: var(--dock-bg);
  border-color: var(--dock-border);
  box-shadow: var(--dock-shadow);
}

[data-theme="dark"] .page-indicator {
  background: var(--page-indicator-bg);
}

[data-theme="dark"] .page-indicator .page-dot {
  background: var(--page-dot-bg);
}

[data-theme="dark"] .page-indicator .page-dot.active {
  background: var(--page-dot-active-bg);
}

/* ========== 动画效果 ========== */
@keyframes pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.05); }
}

.pulse {
  animation: pulse 0.4s ease-in-out;
}

@keyframes slideIn {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.slide-in {
  animation: slideIn 0.4s ease-out;
}

@keyframes iconBounce {
  0%, 100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-8px);
  }
}

.desktop-icon.bounce .icon-image {
  animation: iconBounce 0.6s ease-in-out;
}

/* ========== 响应式适配 ========== */
@media (max-width: 414px) {
  .page {
    /* 移动设备上保持适当的边距 */
    padding: clamp(16px, 4vw, 24px) clamp(12px, 3vw, 16px);
  }
  
  /* 确保dock在移动设备上也不被压扁 */
  .desktop-dock {
    width: calc(100% - 16px);
    height: var(--dock-height);
    min-height: var(--dock-height);
    max-height: var(--dock-height);
    padding: 16px 12px;
    gap: 8px;
  }
  
  .dock-icon {
    width: var(--dock-icon-size);
    height: var(--dock-icon-size);
    min-width: var(--dock-icon-size);
    min-height: var(--dock-icon-size);
  }
  
  .dock-icon .icon-image {
    width: var(--dock-icon-size);
    height: var(--dock-icon-size);
    min-width: var(--dock-icon-size);
    min-height: var(--dock-icon-size);
  }

  /* 音乐组件响应式优化 */
  .music-modal-body {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .contacts-modal.music-modal .modal-content {
    width: min(95vw, 100%);
    max-height: 95vh;
  }

  .music-modal-actions {
    flex-wrap: wrap;
  }

  .music-chip span {
    display: none;
  }

  .floating-panel-body {
    grid-template-columns: 1fr;
  }

  .floating-cover {
    width: 100%;
    aspect-ratio: 1 / 1;
    max-width: 120px;
    margin: 0 auto;
  }
}

@media (max-height: 800px) {
  .pages-container {
    --page-bottom-offset: 147px;
    height: calc(100% - var(--page-top-offset) - var(--page-bottom-offset));
    max-height: calc(100% - var(--page-top-offset) - var(--page-bottom-offset));
  }
}

@media (max-width: 375px) {
  .desktop-dock {
    width: calc(100% - 12px);
    padding: 16px 8px;
    gap: 6px;
    height: var(--dock-height);
    min-height: var(--dock-height);
    max-height: var(--dock-height);
  }
  
  .dock-icon {
    width: var(--dock-icon-size);
    height: var(--dock-icon-size);
    min-width: var(--dock-icon-size);
    min-height: var(--dock-icon-size);
  }
  
  .dock-icon .icon-image {
    width: var(--dock-icon-size);
    height: var(--dock-icon-size);
  }

  /* 音乐组件小屏幕优化 */
  .music-modal-header {
    padding: 10px 12px;
    flex-wrap: wrap;
  }

  .music-modal-title {
    font-size: 14px;
  }

  .music-modal-actions {
    gap: 6px;
  }

  .music-chip {
    padding: 5px 8px;
    font-size: 12px;
  }

  .music-meta-row.dual {
    grid-template-columns: 1fr;
  }

  .avatar-picker-row {
    grid-template-columns: 1fr;
  }
}

/* ========== AI 队列悬浮球（原灵动岛） ========== */
/* 悬浮球本体：固定在屏幕右下方，始终悬浮在所有界面最外层，可拖动调整位置 */
.floating-island-wrapper {
  position: fixed;
  right: 16px;
  bottom: calc(var(--dock-height) + var(--dock-bottom) + 24px);
  z-index: var(--z-island);
  pointer-events: none; /* 只让悬浮球本身可点击 */
}

.dynamic-island {
  width: 52px;
  height: 52px;
  border-radius: 999px;
  background: rgba(var(--float-ball-bg-rgb), var(--float-ball-bg-alpha));
  border: 1px solid var(--float-ball-border);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  position: relative;
  overflow: hidden;
  box-shadow: var(--shadow-md);
  pointer-events: auto;
  transition: transform var(--transition-normal), box-shadow var(--transition-normal), background var(--transition-normal), border-color var(--transition-normal);
}

.dynamic-island:hover {
  transform: scale(1.04) !important;
}

.dynamic-island:active {
  transform: scale(0.96) !important;
}

/* 悬浮球内部内容容器 */
.dynamic-island .island-content {
  color: var(--island-text);
  font-size: var(--font-size-xs);
  font-weight: 500;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 0 6px;
  position: relative;
}

/* 无任务时，默认隐藏占位文本，使用内置图标 */
.dynamic-island .island-content > span {
  display: none;
}

/* 有任务时的悬浮球内容：图标 + 数量徽标 */
.floating-ball-status {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* 队列有内容时：悬浮球本身的呼吸动画效果 */
.dynamic-island.island-active {
  background: linear-gradient(135deg, var(--accent-color) 0%, var(--accent-secondary) 100%);
  opacity: 0.9;
  animation: islandBreathing 2s ease-in-out infinite;
}

@keyframes islandBreathing {
  0%, 100% {
    transform: scale(1);
    box-shadow:
      0 8px 22px rgba(var(--accent-color-rgb), 0.45),
      0 4px 12px rgba(0, 0, 0, var(--float-ball-shadow-alpha)),
      0 0 20px rgba(var(--accent-color-rgb), 0.3);
  }
  50% {
    transform: scale(1.05);
    box-shadow:
      0 8px 22px rgba(var(--accent-color-rgb), 0.45),
      0 4px 12px rgba(0, 0, 0, var(--float-ball-shadow-alpha)),
      0 0 28px rgba(var(--accent-color-rgb), 0.5);
  }
}

.floating-ball-status i {
  font-size: 18px;
  position: relative;
}

.floating-ball-badge {
  position: absolute;
  right: -4px;
  top: -4px;
  min-width: 16px;
  height: 16px;
  border-radius: 999px;
  background: var(--float-ball-badge-bg);
  color: #fff;
  font-size: 10px;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 3px;
  box-shadow: 0 0 6px rgba(var(--accent-color-rgb), 0.5);
  transform: translate(25%, -25%);
}

/* 有任务时：悬浮球激活态和呼吸特效（外发光已在上面定义） */

.dynamic-island.island-pulse::after {
  content: '';
  position: absolute;
  inset: -4px;
  border-radius: inherit;
  border: 2px solid var(--float-ball-pulse-border);
  opacity: 0;
  animation: islandPulse 1.8s ease-in-out infinite;
}

@keyframes islandPulse {
  0% {
    transform: scale(1);
    opacity: 0;
  }
  40% {
    transform: scale(1.18);
    opacity: 1;
  }
  100% {
    transform: scale(1.4);
    opacity: 0;
  }
}

/* 展开为居中弹窗时：悬浮球放大并固定在屏幕中央 */
.dynamic-island.island-expanded {
  position: fixed;
  right: auto;
  bottom: auto;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%) !important;
  width: 90%;
  max-width: 360px;
  height: auto;
  min-height: 120px;
  border-radius: 24px;
  background: transparent;
  box-shadow: none;
  z-index: var(--z-island);
  animation: none !important; /* 展开时停止呼吸动画 */
}

.dynamic-island.island-expanded .island-content {
  width: 100%;
  height: 100%;
  padding: 0;
  display: block;
}

.island-task-info {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: var(--font-size-xs);
  color: white;
}

.island-progress-bar {
  width: 40px;
  height: 3px;
  background: rgba(255, 255, 255, 0.3);
  border-radius: 2px;
  overflow: hidden;
}

.island-progress-fill {
  height: 100%;
  background: white;
  transition: width 0.3s ease;
}

.island-task-count {
  min-width: 16px;
  height: 16px;
  background: rgba(255, 255, 255, 0.3);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--font-size-xxs);
  font-weight: 600;
  padding: 0 4px;
}

/* === 悬浮球展开状态 === */
/* === 展开视图容器 === */
.island-expanded-view {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  background: var(--bg-secondary);
  border-radius: 24px;
  overflow: hidden;
  box-shadow: 
    0 10px 40px rgba(0, 0, 0, 0.2),
    0 4px 12px rgba(0, 0, 0, 0.1);
}

/* === 展开视图头部 === */
.island-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  background: linear-gradient(135deg, var(--accent-color) 0%, var(--accent-secondary) 100%);
  border-bottom: 1px solid rgba(255, 255, 255, 0.18);
}

.island-header h3 {
  font-size: var(--font-size-sm);
  font-weight: 600;
  color: var(--text-on-primary);
  margin: 0;
  letter-spacing: -0.3px;
}

.island-close-btn {
  width: 24px;
  height: 24px;
  background: rgba(255, 255, 255, 0.15);
  border: none;
  color: var(--text-on-primary);
  font-size: var(--font-size-base-lg);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 12px;
  transition: all 0.2s;
}

.island-close-btn:hover {
  background: rgba(255, 255, 255, 0.25);
  transform: scale(1.1);
}

.island-close-btn:active {
  transform: scale(0.95);
}

/* === 空状态 === */
.island-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px 20px;
  color: var(--text-secondary);
  min-height: 150px;
}

.island-empty i {
  font-size: var(--font-size-4xl);
  margin-bottom: 12px;
  opacity: 0.4;
  color: var(--text-tertiary);
}

.island-empty p {
  font-size: var(--font-size-sm);
  margin: 0;
  color: var(--text-secondary);
}

/* === 任务列表容器 === */
.island-tasks-list {
  max-height: 400px;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* 滚动条样式 */
.island-tasks-list::-webkit-scrollbar {
  width: 4px;
}

.island-tasks-list::-webkit-scrollbar-track {
  background: transparent;
}

.island-tasks-list::-webkit-scrollbar-thumb {
  background: var(--border-color);
  border-radius: 2px;
}

.island-tasks-list::-webkit-scrollbar-thumb:hover {
  background: var(--text-tertiary);
}

/* === 单个任务项 === */
.island-task-item {
  background: var(--bg-card);
  border-radius: 14px;
  padding: 12px;
  border: 1px solid var(--border-color);
  transition: all 0.2s ease;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.island-task-item:hover {
  background: var(--bg-hover);
  border-color: var(--accent-color);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
  transform: translateY(-1px);
}

.island-task-item.cancelling {
  opacity: 0.5;
  transform: scale(0.95);
}

/* 任务头部 */
.island-task-header {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 10px;
}

.island-task-icon {
  width: 32px;
  height: 32px;
  background: linear-gradient(135deg, var(--accent-color) 0%, var(--accent-secondary) 100%);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  flex-shrink: 0;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.island-task-icon i {
  font-size: var(--font-size-base-lg);
}

.island-task-info-detail {
  flex: 1;
  min-width: 0;
}

.island-task-title {
  font-size: var(--font-size-sm);
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 3px;
  letter-spacing: -0.2px;
}

.island-task-status {
  font-size: var(--font-size-xs);
  color: var(--text-secondary);
  font-weight: 500;
}

.island-task-status.pending {
  color: var(--text-tertiary);
}

.island-task-status.running {
  color: var(--accent-color);
  font-weight: 600;
}

.island-task-status.failed {
  color: var(--error-color);
  font-weight: 600;
}

.island-task-status.completed {
  color: var(--success-color);
  font-weight: 600;
}

.island-task-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.island-task-retry {
  width: 26px;
  height: 26px;
  background: rgba(46, 204, 113, 0.12);
  border: none;
  color: var(--success-color);
  cursor: pointer;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
  flex-shrink: 0;
  font-size: var(--font-size-md);
}

.island-task-retry:hover {
  background: var(--success-color);
  color: white;
  transform: scale(1.1);
}

.island-task-retry:active {
  transform: scale(0.95);
}

.island-task-cancel {
  width: 26px;
  height: 26px;
  background: var(--error-bg-light);
  border: none;
  color: var(--error-color);
  cursor: pointer;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
  flex-shrink: 0;
  font-size: var(--font-size-md);
}

.island-task-cancel:hover {
  background: var(--error-color);
  color: white;
  transform: scale(1.1);
}

.island-task-cancel:active {
  transform: scale(0.95);
}

.island-task-error {
  margin-top: 6px;
  color: var(--error-color);
  font-size: var(--font-size-sm, 12px);
  line-height: 1.4;
}

/* === 任务进度 === */
.island-task-progress {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
}

.island-task-progress-bar {
  flex: 1;
  height: 5px;
  background: rgba(0, 0, 0, 0.08);
  border-radius: 3px;
  overflow: hidden;
}

[data-theme="dark"] .island-task-progress-bar {
  background: rgba(255, 255, 255, 0.08);
}

.island-task-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent-color) 0%, var(--accent-secondary) 100%);
  transition: width 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  border-radius: 3px;
  box-shadow: 0 0 8px rgba(var(--accent-color-rgb), 0.4);
}

.island-task-progress-text {
  font-size: var(--font-size-xs);
  font-weight: 700;
  color: var(--text-secondary);
  min-width: 32px;
  text-align: right;
  letter-spacing: -0.3px;
}

/* === 任务描述 === */
.island-task-description {
  font-size: var(--font-size-xs);
  color: var(--text-tertiary);
  margin-top: 8px;
  line-height: 1.5;
  padding-top: 8px;
  border-top: 1px solid var(--border-color);
  font-weight: 400;
  letter-spacing: -0.1px;
}

/* ========== 音乐组件响应式优化 ========== */
@media (max-width: 768px) {
  .music-modal-body {
    grid-template-columns: 1fr;
  }

  .contacts-modal.music-modal .modal-content {
    width: min(92vw, 100%);
    margin: 2vh auto;
    max-height: 88vh;
  }

  .music-modal-header {
    flex-wrap: wrap;
  }

  .music-chip span {
    display: none;
  }
}

@media (max-width: 480px) {
  .music-player {
    padding: clamp(6px, 1.5vw, 10px);
  }

  .player-avatars {
    gap: clamp(4px, 1vw, 6px);
  }

  .player-controls {
    gap: clamp(8px, 1.8vw, 12px);
  }

  .contacts-modal.music-modal .modal-content {
    width: 94vw;
    max-height: 94vh;
    border-radius: clamp(10px, 2vw, 14px);
  }

  .music-modal-body {
    padding: clamp(8px, 1.8vw, 10px) clamp(10px, 2vw, 12px);
  }

  .floating-panel-body {
    grid-template-columns: 1fr;
  }

  .floating-cover {
    width: 100%;
    aspect-ratio: 1 / 1;
    max-width: 100px;
    margin: 0 auto;
  }
}

@media (max-height: 600px) {
  .contacts-modal.music-modal .modal-content {
    max-height: 90vh;
  }

  .music-modal-body {
    max-height: calc(90vh - 120px);
  }

  .lrc-preview {
    max-height: clamp(120px, 20vh, 150px);
  }

  .floating-lyrics-list {
    max-height: clamp(120px, 20vh, 150px);
  }
}
