/* ============================================================
 *  Dynamic Island · 灵动岛
 *  iPhone 官方感设计：纯黑药丸 + 实时活动 + 通知横幅
 * ============================================================ */

.dynamic-island {
  position: fixed;
  top: 12px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 9998;
  width: 124px;
  height: 36px;
  background: #000;
  border-radius: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: width 0.45s cubic-bezier(0.32, 0.72, 0, 1),
              height 0.45s cubic-bezier(0.32, 0.72, 0, 1),
              border-radius 0.45s cubic-bezier(0.32, 0.72, 0, 1),
              background 0.3s ease,
              transform 0.45s cubic-bezier(0.32, 0.72, 0, 1);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.04) inset,
              0 8px 24px rgba(0, 0, 0, 0.4),
              0 0 0 0.5px rgba(255, 255, 255, 0.08);
  user-select: none;
  -webkit-user-select: none;
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "SF Pro Display", "Helvetica Neue", system-ui, sans-serif;
  overflow: hidden;
  isolation: isolate;
}

.dynamic-island::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: linear-gradient(180deg, rgba(40, 40, 42, 0.6) 0%, rgba(0, 0, 0, 1) 50%, rgba(0, 0, 0, 1) 100%);
  z-index: -1;
}

.dynamic-island::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 6px;
  height: 6px;
  background: #1a1a1c;
  border-radius: 50%;
  transform: translate(-50%, -50%);
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.04),
              inset 0 0 2px rgba(0, 0, 0, 0.8);
  z-index: 1;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.3s;
}

.dynamic-island.expanded::after {
  opacity: 0;
}

/* 收起状态 - 时间显示 */
.di-compact {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 12px;
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: -0.2px;
  opacity: 1;
  transition: opacity 0.25s ease;
  z-index: 2;
}

.di-compact-left {
  display: flex;
  align-items: center;
  gap: 4px;
  min-width: 0;
}

.di-compact-time {
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum";
}

.di-compact-dot {
  width: 4px;
  height: 4px;
  background: #fff;
  border-radius: 50%;
  opacity: 0.9;
}

.di-compact-right {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  color: rgba(255, 255, 255, 0.95);
}

.di-signal {
  display: inline-flex;
  align-items: flex-end;
  gap: 1.5px;
  height: 9px;
}

.di-signal-bar {
  width: 2.5px;
  background: #fff;
  border-radius: 0.5px;
  transition: opacity 0.3s;
}

.di-signal-bar:nth-child(1) { height: 3px; }
.di-signal-bar:nth-child(2) { height: 5px; }
.di-signal-bar:nth-child(3) { height: 7px; }
.di-signal-bar:nth-child(4) { height: 9px; opacity: 0.4; }

.dynamic-island.has-signal .di-signal-bar:nth-child(4) { opacity: 1; }

.di-battery {
  width: 22px;
  height: 10px;
  border: 1px solid rgba(255, 255, 255, 0.45);
  border-radius: 2.5px;
  position: relative;
  display: flex;
  align-items: center;
  padding: 1px;
}

.di-battery::after {
  content: '';
  position: absolute;
  right: -2.5px;
  top: 50%;
  transform: translateY(-50%);
  width: 1.5px;
  height: 4px;
  background: rgba(255, 255, 255, 0.45);
  border-radius: 0 1px 1px 0;
}

.di-battery-fill {
  height: 100%;
  background: #fff;
  border-radius: 1px;
  transition: width 0.5s ease;
}

/* 展开状态 - 实时活动 */
.di-expanded {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  padding: 0 16px;
  gap: 10px;
  color: #fff;
  opacity: 0;
  transition: opacity 0.3s ease 0.1s;
  z-index: 2;
  pointer-events: none;
}

.dynamic-island.expanded .di-compact {
  opacity: 0;
}

.dynamic-island.expanded .di-expanded {
  opacity: 1;
  pointer-events: auto;
}

.dynamic-island.expanded {
  width: 320px;
  border-radius: 28px;
  background: #000;
}

.dynamic-island.large {
  width: 360px;
  height: 132px;
  border-radius: 32px;
}

/* 实时活动 - 音乐 */
.di-activity-music {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
}

.di-album-art {
  width: 40px;
  height: 40px;
  border-radius: 8px;
  background: linear-gradient(135deg, #c9a876, #6e6e78);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  flex-shrink: 0;
  position: relative;
  overflow: hidden;
}

.di-album-art::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, transparent 30%, rgba(255, 255, 255, 0.15) 50%, transparent 70%);
  animation: diShine 4s ease-in-out infinite;
}

@keyframes diShine {
  0%, 100% { transform: translateX(-100%); }
  50% { transform: translateX(100%); }
}

.di-track-info {
  flex: 1;
  min-width: 0;
}

.di-track-title {
  font-size: 13px;
  font-weight: 600;
  color: #fff;
  letter-spacing: -0.2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.di-track-artist {
  font-size: 11px;
  color: rgba(255, 255, 255, 0.55);
  margin-top: 1px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.di-music-controls {
  display: flex;
  align-items: center;
  gap: 14px;
  color: #fff;
  flex-shrink: 0;
}

.di-music-btn {
  background: none;
  border: none;
  color: #fff;
  cursor: pointer;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity 0.2s, transform 0.2s;
  font-size: 0;
}

.di-music-btn:hover { opacity: 0.7; }
.di-music-btn:active { transform: scale(0.9); }
.di-music-btn svg { display: block; }

.di-music-btn-play {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: #fff;
  color: #000;
  font-size: 0;
}

.dynamic-island.large .di-music-btn-play {
  width: 44px;
  height: 44px;
}

/* 实时活动 - 计时器 */
.di-activity-timer {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
}

.di-timer-icon {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: linear-gradient(180deg, #ff453a 0%, #c9342a 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  flex-shrink: 0;
  position: relative;
  font-size: 16px;
  font-weight: 500;
  box-shadow: 0 0 0 2px rgba(255, 69, 58, 0.2);
  animation: diTimerPulse 1s ease-in-out infinite;
}

@keyframes diTimerPulse {
  0%, 100% { box-shadow: 0 0 0 2px rgba(255, 69, 58, 0.2); }
  50% { box-shadow: 0 0 0 6px rgba(255, 69, 58, 0); }
}

.di-timer-info {
  flex: 1;
  min-width: 0;
}

.di-timer-label {
  font-size: 11px;
  color: rgba(255, 255, 255, 0.55);
  letter-spacing: 0.2px;
}

.di-timer-value {
  font-size: 17px;
  font-weight: 600;
  color: #fff;
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum";
  letter-spacing: -0.3px;
  margin-top: 1px;
}

.di-timer-progress {
  height: 3px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 2px;
  margin-top: 6px;
  overflow: hidden;
}

.di-timer-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #ff453a, #ff7a5c);
  border-radius: 2px;
  transition: width 1s linear;
}

/* 实时活动 - 来电 */
.di-activity-call {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
}

.di-call-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 600;
  color: #fff;
  flex-shrink: 0;
  position: relative;
}

.di-call-avatar::before {
  content: '';
  position: absolute;
  inset: -4px;
  border-radius: 50%;
  border: 1.5px solid #30d158;
  animation: diCallRing 1.5s ease-in-out infinite;
}

@keyframes diCallRing {
  0%, 100% { transform: scale(1); opacity: 0.6; }
  50% { transform: scale(1.15); opacity: 0; }
}

.di-call-info { flex: 1; min-width: 0; }
.di-call-name { font-size: 13px; font-weight: 600; color: #fff; letter-spacing: -0.2px; }
.di-call-status { font-size: 11px; color: #30d158; margin-top: 1px; }

.di-call-actions { display: flex; gap: 8px; }

.di-call-btn {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: #fff;
  transition: transform 0.2s;
}

.di-call-btn:hover { transform: scale(1.08); }
.di-call-btn:active { transform: scale(0.92); }
.di-call-btn.decline { background: #ff453a; }
.di-call-btn.accept { background: #30d158; }
.di-call-btn svg { width: 14px; height: 14px; fill: currentColor; }

/* 大展开 - 完整实时活动 */
.di-large-content {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  padding: 14px 18px;
  opacity: 0;
  transition: opacity 0.3s ease 0.1s;
  pointer-events: none;
  z-index: 2;
}

.dynamic-island.large .di-compact,
.dynamic-island.large .di-expanded {
  opacity: 0;
  pointer-events: none;
}

.dynamic-island.large .di-large-content {
  opacity: 1;
  pointer-events: auto;
}

.di-large-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}

.di-large-title {
  font-size: 12px;
  font-weight: 500;
  color: rgba(255, 255, 255, 0.55);
  text-transform: uppercase;
  letter-spacing: 0.4px;
}

.di-large-time {
  font-size: 11px;
  color: rgba(255, 255, 255, 0.4);
  font-variant-numeric: tabular-nums;
}

.di-large-main {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 1;
}

.di-large-icon {
  width: 56px;
  height: 56px;
  border-radius: 12px;
  background: linear-gradient(135deg, #c9a876, #8a6e3e);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 26px;
  flex-shrink: 0;
  position: relative;
  overflow: hidden;
}

.di-large-icon::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, transparent 40%, rgba(255, 255, 255, 0.18) 50%, transparent 60%);
  animation: diShine 5s ease-in-out infinite;
}

.di-large-text { flex: 1; min-width: 0; }
.di-large-label { font-size: 11px; color: rgba(255, 255, 255, 0.55); margin-bottom: 2px; }
.di-large-value { font-size: 18px; font-weight: 600; color: #fff; letter-spacing: -0.3px; }
.di-large-sub { font-size: 12px; color: rgba(255, 255, 255, 0.6); margin-top: 2px; }

.di-large-progress {
  height: 3px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 2px;
  margin-top: 8px;
  overflow: hidden;
}

.di-large-progress-fill {
  height: 100%;
  background: #fff;
  border-radius: 2px;
  transition: width 0.3s linear;
}

/* 通知横幅 - 从灵动岛弹出 */
.di-notification {
  position: fixed;
  top: 56px;
  left: 50%;
  transform: translateX(-50%) translateY(-30px);
  width: 360px;
  max-width: calc(100vw - 32px);
  background: rgba(28, 28, 30, 0.92);
  backdrop-filter: blur(40px) saturate(2);
  -webkit-backdrop-filter: blur(40px) saturate(2);
  border-radius: 16px;
  padding: 12px 14px;
  display: flex;
  align-items: center;
  gap: 10px;
  z-index: 9997;
  color: #fff;
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", system-ui, sans-serif;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5),
              0 0 0 0.5px rgba(255, 255, 255, 0.08);
  opacity: 0;
  transition: opacity 0.35s cubic-bezier(0.32, 0.72, 0, 1),
              transform 0.45s cubic-bezier(0.32, 0.72, 0, 1);
  pointer-events: none;
}

.di-notification.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
  pointer-events: auto;
}

.di-notification-icon {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  flex-shrink: 0;
  background: linear-gradient(135deg, #c9a876, #8a6e3e);
}

.di-notification-content { flex: 1; min-width: 0; }
.di-notification-title { font-size: 12px; font-weight: 500; color: rgba(255, 255, 255, 0.6); margin-bottom: 1px; letter-spacing: 0.1px; }
.di-notification-body { font-size: 13.5px; font-weight: 600; color: #fff; line-height: 1.3; letter-spacing: -0.2px; }
.di-notification-time { font-size: 11px; color: rgba(255, 255, 255, 0.5); flex-shrink: 0; margin-left: 4px; align-self: flex-start; }

/* 点击动画 */
.dynamic-island:active {
  transform: translateX(-50%) scale(0.96);
  transition: transform 0.15s ease;
}

/* 隐藏摄像头/传感器装饰（视觉细节） */
.dynamic-island .di-sensor {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 5px;
  height: 5px;
  background: #1a1a1c;
  border-radius: 50%;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.04);
  opacity: 0;
  transition: opacity 0.3s;
}

.dynamic-island:not(.expanded):not(.large) .di-sensor {
  opacity: 1;
}

/* 响应式 */
@media (max-width: 480px) {
  .dynamic-island { width: 110px; height: 32px; }
  .dynamic-island.expanded { width: calc(100vw - 40px); max-width: 320px; }
  .dynamic-island.large { width: calc(100vw - 24px); max-width: 380px; height: 120px; }
  .di-notification { width: calc(100vw - 24px); top: 50px; }
}

/* 暗色下与背景融合 */
body {
  --di-bg: #000;
}
