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

body {
  font-family: "Segoe UI", "Microsoft JhengHei", sans-serif;
  min-height: 100vh;
  color: #fff;
  overflow-x: hidden;
  overflow-y: auto;
  position: relative;
}

.bg {
  position: fixed;
  inset: 0;
  background: linear-gradient(135deg, #1a1030 0%, #2d1b5e 50%, #6b3fa0 100%);
  background-size: cover;
  background-repeat: no-repeat;
  background-position: center;
  z-index: -2;
  transition: background-image 0.5s ease-in-out;
}

.bg::after {
  content: "";
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(2px);
}

.wrap {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 24px;
  padding: 24px;
}

.card {
  width: 100%;
  max-width: 520px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 24px;
  padding: 40px 32px;
  backdrop-filter: blur(16px);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.4);
  text-align: center;
}

.avatar {
  width: 120px;
  height: 120px;
  border-radius: 50%;
  border: 4px solid rgba(255, 255, 255, 0.3);
  margin: 0 auto 20px;
  object-fit: cover;
  background: rgba(255, 255, 255, 0.1);
}

.subline {
  font-size: 16px;
  opacity: 0.85;
  margin-bottom: 8px;
}

.status {
  font-size: 24px;
  font-weight: 700;
  margin: 16px 0 8px;
}

.status.live { color: #4ade80; }
.status.offline { color: #f87171; }

.status-desc {
  font-size: 14px;
  opacity: 0.75;
  margin-bottom: 28px;
}

.timer-box {
  background: rgba(0, 0, 0, 0.25);
  border-radius: 16px;
  padding: 20px;
  margin-bottom: 24px;
}

.timer-label {
  font-size: 14px;
  opacity: 0.8;
  margin-bottom: 8px;
}

.timer {
  font-size: 28px;
  font-weight: 700;
  letter-spacing: 1px;
  font-variant-numeric: tabular-nums;
  margin-bottom: 8px;
}

.timer-desc {
  font-size: 12px;
  opacity: 0.6;
}

.channel-link {
  display: inline-block;
  padding: 12px 32px;
  background: #9147ff;
  color: #fff;
  text-decoration: none;
  border-radius: 999px;
  font-weight: 600;
  transition: transform 0.15s, background 0.15s;
}

.channel-link:hover {
  background: #772ce8;
  transform: translateY(-2px);
}

.danmaku-layer {
  position: fixed;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
  z-index: 10;
}

.danmaku {
  position: absolute;
  left: 100%;
  white-space: nowrap;
  font-size: 20px;
  font-weight: 600;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.8);
  will-change: transform;
  animation: danmaku-fly linear forwards;
}

.danmaku-nick {
  color: #c4b5fd;
  margin-right: 6px;
}

.danmaku-nick::after {
  content: "：";
}

.danmaku-emote {
  height: 28px;
  vertical-align: middle;
  margin: 0 2px;
}

.danmaku-layer.danmaku-off {
  display: none;
}

.stream-info {
  background: rgba(0, 0, 0, 0.25);
  border-radius: 16px;
  padding: 14px 18px;
  margin-bottom: 24px;
  text-align: left;
}

.stream-title {
  font-size: 15px;
  font-weight: 600;
  line-height: 1.4;
}

.stream-meta {
  font-size: 13px;
  opacity: 0.7;
  margin-top: 6px;
}

.controls {
  margin-top: 16px;
  display: flex;
  gap: 10px;
  justify-content: center;
}

.ctrl-btn {
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: #fff;
  padding: 8px 16px;
  border-radius: 999px;
  font-size: 13px;
  font-family: inherit;
  cursor: pointer;
  transition: background 0.15s;
}

.ctrl-btn:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.2);
}

.ctrl-btn:disabled {
  cursor: default;
  opacity: 0.7;
}

.visit-count {
  margin-top: 14px;
  font-size: 12px;
  opacity: 0.5;
}

.player-box {
  width: min(100%, 860px);
  aspect-ratio: 16 / 9;
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

.player-box iframe {
  display: block;
  width: 100%;
  height: 100%;
  border: 0;
}

/* ===== 開台/關台氛圍 ===== */
body.live .avatar {
  border-color: rgba(74, 222, 128, 0.8);
  animation: live-ring 2.4s ease-in-out infinite;
}

@keyframes live-ring {
  0%, 100% { box-shadow: 0 0 0 0 rgba(74, 222, 128, 0.55); }
  50% { box-shadow: 0 0 0 14px rgba(74, 222, 128, 0); }
}

body.live .card {
  animation: card-breathe 5s ease-in-out infinite;
}

@keyframes card-breathe {
  0%, 100% { box-shadow: 0 20px 60px rgba(0, 0, 0, 0.4); }
  50% { box-shadow: 0 20px 72px rgba(145, 71, 255, 0.5); }
}

body.live .bg {
  animation: bg-drift 40s ease-in-out infinite alternate;
}

@keyframes bg-drift {
  from { transform: scale(1); }
  to { transform: scale(1.08); }
}

body.offline .bg {
  filter: grayscale(0.35) brightness(0.8);
}

@keyframes danmaku-fly {
  from { transform: translateX(0); }
  to { transform: translateX(calc(-100vw - 100%)); }
}
