/* WALES 投屏 · 观看端样式表 (深色主题) */
:root {
  --bg-primary: #0d1117;
  --bg-secondary: #161b22;
  --bg-card: #21262d;
  --border-color: #30363d;
  --text-primary: #f0f6fc;
  --text-secondary: #8b949e;
  --text-muted: #6e7681;
  --accent-blue: #388bfd;
  --accent-green: #238636;
  --accent-green-glow: rgba(46, 160, 67, 0.4);
  --status-green: #3fb950;
  --status-amber: #d29922;
  --status-red: #f85149;
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background-color: var(--bg-primary);
  color: var(--text-primary);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

.page-container {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  max-width: 1440px;
  margin: 0 auto;
  width: 100%;
  padding: 16px;
  gap: 16px;
}

/* 顶栏 */
.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 20px;
  background-color: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
}

.brand-icon {
  font-size: 26px;
}

.brand-title {
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.5px;
  color: var(--text-primary);
}

.brand-sub {
  font-size: 13px;
  color: var(--text-secondary);
  background: var(--bg-card);
  padding: 2px 8px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
}

/* 状态灯 (大号胶囊状态指示器) */
.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 8px 16px;
  border-radius: 9999px;
  font-size: 14px;
  font-weight: 600;
  transition: all 0.3s ease;
  user-select: none;
}

.status-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  display: inline-block;
  position: relative;
}

/* 在线状态：投屏中 */
.status-pill.online {
  background-color: rgba(63, 185, 80, 0.15);
  border: 1px solid rgba(63, 185, 80, 0.5);
  color: #56d364;
}

.status-pill.online .status-dot {
  background-color: var(--status-green);
  box-shadow: 0 0 10px var(--status-green);
  animation: pulse-green 2s infinite ease-in-out;
}

@keyframes pulse-green {
  0% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(63, 185, 80, 0.7); }
  70% { transform: scale(1.1); box-shadow: 0 0 0 8px rgba(63, 185, 80, 0); }
  100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(63, 185, 80, 0); }
}

/* 离线状态：无人投屏 */
.status-pill.offline {
  background-color: rgba(210, 153, 34, 0.12);
  border: 1px solid rgba(210, 153, 34, 0.4);
  color: #e3b341;
}

.status-pill.offline .status-dot {
  background-color: var(--status-amber);
  box-shadow: 0 0 6px rgba(210, 153, 34, 0.5);
}

/* 错误断开 */
.status-pill.error {
  background-color: rgba(248, 81, 73, 0.15);
  border: 1px solid rgba(248, 81, 73, 0.4);
  color: #f85149;
}

.status-pill.error .status-dot {
  background-color: var(--status-red);
}

/* 播放器主视区 */
.player-wrapper {
  flex: 1;
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 480px;
}

.player-container {
  position: relative;
  width: 100%;
  height: 100%;
  min-height: 500px;
  background-color: #05070a;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.4);
}

/* 画布 Canvas */
#screenCanvas {
  max-width: 100%;
  max-height: 100%;
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

/* MJPEG 兜底图 */
.fallback-img {
  max-width: 100%;
  max-height: 100%;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.hidden {
  display: none !important;
}

/* 离线占位层 */
.placeholder-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: radial-gradient(circle at center, #131922 0%, #080b0f 80%);
  padding: 32px;
  text-align: center;
  z-index: 10;
  transition: opacity 0.3s ease;
}

.radar-box {
  position: relative;
  width: 100px;
  height: 100px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 24px;
}

.radar-icon {
  font-size: 38px;
  z-index: 2;
}

.radar-circle {
  position: absolute;
  border-radius: 50%;
  border: 1px solid rgba(56, 139, 253, 0.4);
  animation: radar-spread 3s infinite cubic-bezier(0.2, 0.8, 0.2, 1);
}

.circle-1 { width: 40px; height: 40px; animation-delay: 0s; }
.circle-2 { width: 70px; height: 70px; animation-delay: 0.8s; }
.circle-3 { width: 100px; height: 100px; animation-delay: 1.6s; }

@keyframes radar-spread {
  0% { transform: scale(0.6); opacity: 0.8; }
  100% { transform: scale(1.6); opacity: 0; }
}

.placeholder-title {
  font-size: 20px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 8px;
}

.placeholder-desc {
  font-size: 14px;
  color: var(--text-secondary);
  max-width: 440px;
}

/* HUD 浮层 */
.player-hud {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 18px;
  background: linear-gradient(to top, rgba(13, 17, 23, 0.95), rgba(13, 17, 23, 0));
  z-index: 20;
  pointer-events: none;
}

.hud-left, .hud-right {
  display: flex;
  align-items: center;
  gap: 10px;
  pointer-events: auto;
}

.hud-tag {
  background-color: rgba(22, 27, 34, 0.85);
  border: 1px solid rgba(48, 54, 61, 0.7);
  color: var(--text-secondary);
  font-size: 12px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  backdrop-filter: blur(4px);
}

.viewers-tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--text-primary);
}

.viewer-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background-color: var(--accent-blue);
  box-shadow: 0 0 6px var(--accent-blue);
}

.hud-btn {
  background-color: rgba(22, 27, 34, 0.85);
  border: 1px solid rgba(48, 54, 61, 0.7);
  color: var(--text-primary);
  font-size: 13px;
  padding: 4px 12px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.2s ease;
  backdrop-filter: blur(4px);
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.hud-btn:hover {
  background-color: var(--bg-card);
  border-color: var(--accent-blue);
}

/* 下载与使用指南卡片 */
.app-footer {
  margin-top: auto;
}

.download-card {
  background-color: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 20px 24px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 16px;
}

.card-title-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.card-title {
  font-size: 17px;
  font-weight: 600;
  color: var(--text-primary);
}

.platform-badge {
  font-size: 13px;
  color: var(--text-secondary);
}

/* 大字下载按钮 */
.btn-download {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  background-color: var(--accent-green);
  color: #ffffff;
  text-decoration: none;
  font-size: 15px;
  font-weight: 600;
  padding: 10px 22px;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: 0 4px 12px rgba(35, 134, 54, 0.3);
  transition: all 0.2s ease;
}

.btn-download:hover {
  background-color: #2ea043;
  box-shadow: 0 4px 18px rgba(46, 160, 67, 0.5);
  transform: translateY(-1px);
}

.btn-download:active {
  transform: translateY(0);
}

.download-icon {
  font-size: 18px;
}

/* 三步指引栅格 */
.steps-grid {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background-color: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 14px 18px;
}

.step-item {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 1;
}

.step-num {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background-color: var(--bg-card);
  border: 1px solid var(--accent-blue);
  color: var(--accent-blue);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 14px;
  flex-shrink: 0;
}

.step-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
}

.step-desc {
  font-size: 12px;
  color: var(--text-secondary);
  margin-top: 2px;
}

.step-arrow {
  color: var(--text-muted);
  font-size: 16px;
  user-select: none;
}

.footer-meta {
  text-align: center;
  padding-top: 12px;
  font-size: 12px;
  color: var(--text-muted);
}

/* 手机端响应式适配 */
@media (max-width: 768px) {
  .page-container {
    padding: 8px;
    gap: 10px;
  }

  .app-header {
    padding: 10px 14px;
  }

  .brand-title {
    font-size: 17px;
  }

  .brand-sub {
    display: none;
  }

  .player-wrapper {
    min-height: 240px;
  }

  .player-container {
    min-height: 260px;
    border-radius: var(--radius-md);
  }

  .steps-grid {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }

  .step-arrow {
    display: none;
  }

  .card-header {
    flex-direction: column;
    align-items: stretch;
  }

  .btn-download {
    justify-content: center;
  }

  .hud-tag {
    font-size: 11px;
    padding: 3px 6px;
  }
}
