/* ===== MD3 设计系统变量 ===== */
:root {
  --md-sys-color-primary: #006a6a;
  --md-sys-color-on-primary: #ffffff;
  --md-sys-color-primary-container: #9cf1f0;
  --md-sys-color-on-primary-container: #002020;

  --md-sys-color-surface: #f4fbf9;
  --md-sys-color-surface-dim: #d5dbd9;
  --md-sys-color-surface-container: #e8efed;
  --md-sys-color-surface-container-high: #e3e9e7;

  --md-sys-color-on-surface: #171d1c;
  --md-sys-color-outline-variant: #bec9c6;

  /* 阴影 */
  --md-sys-elevation-3:
    0 4px 8px 3px rgba(0, 0, 0, 0.08), 0 1px 3px 0 rgba(0, 0, 0, 0.1);

  /* 动画 */
  --md-sys-motion-duration-medium: 250ms;
  --md-sys-motion-easing-standard: cubic-bezier(0.2, 0, 0, 1);
}

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

body {
  background: linear-gradient(
    135deg,
    var(--md-sys-color-surface) 0%,
    #e8f5f3 50%,
    #f0f7f5 100%
  );
  color: var(--md-sys-color-on-surface);
}

/* ===== 播放器卡片壳 ===== */
.player-card {
  background: var(--md-sys-color-surface-container);
  border-radius: 28px;
  overflow: hidden;
  box-shadow: var(--md-sys-elevation-3);
  transition: box-shadow var(--md-sys-motion-duration-medium)
    var(--md-sys-motion-easing-standard);
}

.player-card:hover {
  box-shadow:
    0 8px 16px 6px rgba(0, 0, 0, 0.08),
    0 2px 4px 0 rgba(0, 0, 0, 0.1);
}

/* ===== 播放器容器 ===== */
.player-container {
  padding: 12px;
  background: var(--md-sys-color-surface-container-high);
}

.player-wrapper {
  position: relative;
  width: 100%;
  padding-top: 56.25%; /* 16:9 比例 */
  border-radius: 20px;
  overflow: hidden;
  background: #000;
}

.player-embed {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

/* ===== 响应式设计 ===== */
@media (max-width: 768px) {
  .player-card {
    border-radius: 20px;
  }

  .player-container {
    padding: 8px;
  }

  .player-wrapper {
    border-radius: 16px;
  }
}

@media (max-width: 480px) {
  .player-card {
    border-radius: 16px;
  }

  .player-container {
    padding: 6px;
  }

  .player-wrapper {
    border-radius: 12px;
  }
}

/* ===== 全屏模式 ===== */
.player-card:fullscreen {
  max-width: 100%;
  border-radius: 0;
}

.player-card:fullscreen .player-container {
  padding: 0;
  height: 100vh;
}

.player-card:fullscreen .player-wrapper {
  border-radius: 0;
  padding-top: 0;
  height: 100%;
}

::selection {
  background: var(--md-sys-color-primary-container);
  color: var(--md-sys-color-on-primary-container);
}

/* ===== MD3 卡片样式 ===== */
.md3-card {
  background: var(--md-sys-color-surface-container);
  border-radius: 16px;
  padding: 16px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
  transition: box-shadow var(--md-sys-motion-duration-medium)
    var(--md-sys-motion-easing-standard);
}

.md3-card:hover {
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
}

.md3-card-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  font-weight: 500;
  color: var(--md-sys-color-on-surface);
  margin-bottom: 12px;
}

.md3-card-title .material-symbols-outlined {
  font-size: 20px;
  color: var(--md-sys-color-primary);
}

/* ===== MD3 按钮样式 ===== */
.md3-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 24px;
  border-radius: 20px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  border: none;
  transition: all var(--md-sys-motion-duration-medium)
    var(--md-sys-motion-easing-standard);
  position: relative;
  overflow: hidden;
}

.md3-btn:disabled {
  opacity: 0.38;
  cursor: not-allowed;
}

.md3-btn .material-symbols-outlined {
  font-size: 18px;
}

.md3-btn-filled {
  background: var(--md-sys-color-primary);
  color: var(--md-sys-color-on-primary);
}

.md3-btn-filled:hover:not(:disabled) {
  box-shadow: 0 1px 3px rgba(0, 106, 106, 0.3);
}

.md3-btn-filled:active:not(:disabled) {
  transform: scale(0.98);
}

.md3-btn-tonal {
  background: var(--md-sys-color-primary-container);
  color: var(--md-sys-color-on-primary-container);
}

.md3-btn-tonal:hover:not(:disabled) {
  background: #8be4e3;
}

.md3-btn-tonal:active:not(:disabled) {
  transform: scale(0.98);
}

.md3-btn-tonal.active {
  background: var(--md-sys-color-primary);
  color: var(--md-sys-color-on-primary);
}

.md3-btn-error {
  background: #ba1a1a;
  color: #ffffff;
}

.md3-btn-error:hover:not(:disabled) {
  background: #a31717;
}

/* ===== MD3 输入框样式 ===== */
.md3-input-group {
  position: relative;
}

.md3-input {
  width: 100%;
  padding: 12px 16px;
  border: 1px solid var(--md-sys-color-outline-variant);
  border-radius: 12px;
  background: var(--md-sys-color-surface-container-high);
  font-size: 14px;
  color: var(--md-sys-color-on-surface);
  transition: all var(--md-sys-motion-duration-medium)
    var(--md-sys-motion-easing-standard);
}

.md3-input:focus {
  outline: none;
  border-color: var(--md-sys-color-primary);
  box-shadow: 0 0 0 1px var(--md-sys-color-primary);
}

.md3-input::placeholder {
  color: var(--md-sys-color-outline-variant);
}

/* ===== MD3 选择框样式 ===== */
.md3-select-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.md3-select {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--md-sys-color-outline-variant);
  border-radius: 12px;
  background: var(--md-sys-color-surface-container-high);
  font-size: 13px;
  color: var(--md-sys-color-on-surface);
  cursor: pointer;
  transition: all var(--md-sys-motion-duration-medium)
    var(--md-sys-motion-easing-standard);
}

.md3-select:focus {
  outline: none;
  border-color: var(--md-sys-color-primary);
}

.md3-select:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

/* ===== MD3 开关样式 ===== */
.md3-toggle-group {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 14px;
}

.md3-toggle {
  position: relative;
  width: 52px;
  height: 32px;
  cursor: pointer;
}

.md3-toggle input {
  opacity: 0;
  width: 0;
  height: 0;
}

.md3-toggle-slider {
  position: absolute;
  inset: 0;
  background: var(--md-sys-color-surface-container-high);
  border: 2px solid var(--md-sys-color-outline-variant);
  border-radius: 16px;
  transition: all var(--md-sys-motion-duration-medium)
    var(--md-sys-motion-easing-standard);
}

.md3-toggle-slider::before {
  content: "";
  position: absolute;
  width: 16px;
  height: 16px;
  left: 6px;
  top: 50%;
  transform: translateY(-50%);
  background: var(--md-sys-color-outline-variant);
  border-radius: 50%;
  transition: all var(--md-sys-motion-duration-medium)
    var(--md-sys-motion-easing-standard);
}

.md3-toggle input:checked + .md3-toggle-slider {
  background: var(--md-sys-color-primary);
  border-color: var(--md-sys-color-primary);
}

.md3-toggle input:checked + .md3-toggle-slider::before {
  left: 26px;
  width: 24px;
  height: 24px;
  background: var(--md-sys-color-on-primary);
}

/* ===== MD3 状态指示器 ===== */
.md3-status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 12px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 500;
}

.md3-status::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 50%;
}

.md3-status-idle {
  background: var(--md-sys-color-surface-container-high);
  color: var(--md-sys-color-on-surface);
}

.md3-status-idle::before {
  background: var(--md-sys-color-outline-variant);
}

.md3-status-connecting {
  background: #fff3e0;
  color: #e65100;
}

.md3-status-connecting::before {
  background: #ff9800;
  animation: pulse 1s infinite;
}

.md3-status-live {
  background: #e8f5e9;
  color: #2e7d32;
}

.md3-status-live::before {
  background: #4caf50;
  animation: pulse 2s infinite;
}

.md3-status-error {
  background: var(--md-sys-color-error-container, #ffdad6);
  color: #ba1a1a;
}

.md3-status-error::before {
  background: #ba1a1a;
}

@keyframes pulse {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0.5;
  }
}

/* ===== Toast 提示 ===== */
.md3-toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(100px);
  background: var(--md-sys-color-on-surface);
  color: var(--md-sys-color-surface);
  padding: 14px 24px;
  border-radius: 12px;
  font-size: 14px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  z-index: 1000;
  opacity: 0;
  transition: all 0.3s ease;
}

.md3-toast.show {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
}
