* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  margin: 0;
  padding: 0;
  background: #0b0e14;
  color: #e8ecf3;
  font-family: -apple-system, BlinkMacSystemFont, "Helvetica Neue", "PingFang SC", "Microsoft YaHei", sans-serif;
  -webkit-font-smoothing: antialiased;
}

body { overflow: hidden; }

#app {
  position: relative;
  display: flex;
  flex-direction: column;
  height: 100vh;
  height: 100dvh;
  max-width: 720px;
  margin: 0 auto;
  background: #0b0e14;
}

.hidden { display: none !important; }

/* ================= 直播画面 ================= */
#stage {
  position: relative;
  width: 100%;
  height: auto;
  aspect-ratio: 16 / 9;
  flex: none;
  background: #000;
  overflow: hidden;
}

#video {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: block;
  object-fit: contain;
  background: #000;
}

#danmaku-layer {
  position: absolute;
  top: 0; right: 0; bottom: 0; left: 0;
  overflow: hidden;
  pointer-events: none;
  contain: strict;
}

.danmaku-item {
  position: absolute;
  white-space: nowrap;
  font-size: 15px;
  line-height: 24px;
  padding: 2px 10px;
  border-radius: 12px;
  background: rgba(0, 0, 0, 0.42);
  color: #fff;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.6);
  will-change: transform;
  left: 100%;
}

.danmaku-item .nick {
  color: #7fd4ff;
  margin-right: 6px;
}

.danmaku-item.self {
  background: rgba(255, 77, 79, 0.55);
}

.danmaku-item.self .nick { color: #ffe08a; }

#live-badge, #online-badge {
  position: absolute;
  top: 10px;
  height: 24px;
  display: flex;
  align-items: center;
  padding: 0 10px;
  border-radius: 12px;
  background: rgba(0, 0, 0, 0.5);
  font-size: 12px;
  line-height: 1;
  color: #fff;
  backdrop-filter: blur(4px);
}

#live-badge { left: 10px; }

#online-badge { right: 10px; }

#online-badge span { color: #57e6a3; font-weight: 600; margin-right: 3px; }

.dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #ff4d4f;
  margin-right: 6px;
  animation: pulse 1.4s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.35; transform: scale(0.8); }
}

#player-tip {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  font-size: 13px;
  color: rgba(255, 255, 255, 0.75);
  background: rgba(0, 0, 0, 0.45);
  padding: 8px 14px;
  border-radius: 8px;
}

#player-retry {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  border: 1px solid rgba(255, 255, 255, 0.5);
  background: rgba(0, 0, 0, 0.5);
  color: #fff;
  font-size: 14px;
  padding: 9px 20px;
  border-radius: 20px;
}

/* ================= 房间信息 ================= */
#meta {
  padding: 14px 16px 6px;
  flex: none;
}

#room-title {
  margin: 0;
  font-size: 17px;
  font-weight: 600;
  line-height: 1.3;
  color: #f2f5fa;
}

#room-sub {
  margin: 6px 0 0;
  font-size: 13px;
  line-height: 1.4;
  color: #8b96a8;
}

/* ================= 弹幕输入 ================= */
#composer {
  margin-top: auto;
  flex: none;
  display: flex;
  gap: 8px;
  padding: 10px 12px calc(10px + env(safe-area-inset-bottom));
  border-top: 1px solid rgba(255, 255, 255, 0.07);
  background: #0f131b;
}

#danmaku-input {
  flex: 1;
  min-width: 0;
  height: 40px;
  padding: 0 14px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 20px;
  background: #171c26;
  color: #e8ecf3;
  font-size: 15px;
  outline: none;
}

#danmaku-input::placeholder { color: #66707f; }

#danmaku-input:focus { border-color: rgba(88, 170, 255, 0.6); }

#danmaku-send {
  flex: none;
  height: 40px;
  padding: 0 18px;
  border: none;
  border-radius: 20px;
  background: #2f7dff;
  color: #fff;
  font-size: 15px;
  font-weight: 500;
}

#danmaku-send:disabled { background: #2a3241; color: #6b7688; }

/* ================= 进入遮罩 ================= */
#enter {
  position: absolute;
  top: 0; right: 0; bottom: 0; left: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: #0b0e14;
  transition: opacity 0.28s ease, visibility 0.28s ease;
}

#enter.gone { opacity: 0; visibility: hidden; pointer-events: none; }

#enter-inner {
  width: 100%;
  max-width: 380px;
  text-align: center;
}

#enter-cover {
  width: 100%;
  padding-top: 56.25%;
  border-radius: 12px;
  margin-bottom: 22px;
  background:
    radial-gradient(120% 120% at 20% 10%, #1d3f73 0%, rgba(29, 63, 115, 0) 60%),
    radial-gradient(120% 120% at 90% 90%, #6b2b4a 0%, rgba(107, 43, 74, 0) 55%),
    #131826;
  background-size: cover;
  background-position: center;
}

#enter-title {
  margin: 0;
  font-size: 20px;
  font-weight: 600;
  color: #f2f5fa;
}

#enter-sub {
  margin: 8px 0 26px;
  font-size: 14px;
  color: #8b96a8;
}

#enter-btn {
  width: 100%;
  height: 48px;
  border: none;
  border-radius: 24px;
  background: #2f7dff;
  color: #fff;
  font-size: 16px;
  font-weight: 600;
}

#enter-btn:active { background: #2a6fe0; }

.enter-hint {
  margin: 14px 0 0;
  font-size: 12px;
  color: #5f6a7b;
}

/* ================= 提示 ================= */
#toast {
  position: absolute;
  left: 50%;
  bottom: 84px;
  transform: translateX(-50%);
  z-index: 60;
  max-width: 80%;
  padding: 9px 16px;
  border-radius: 18px;
  background: rgba(0, 0, 0, 0.78);
  color: #fff;
  font-size: 13px;
  line-height: 1.3;
  text-align: center;
}
/* ================= 公告栏 ================= */
#meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

#meta-text { min-width: 0; }

#announce {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin: 0 16px 4px;
  padding: 8px 12px;
  border-radius: 8px;
  background: rgba(47, 125, 255, 0.12);
  border: 1px solid rgba(47, 125, 255, 0.25);
  font-size: 13px;
  line-height: 1.45;
  color: #b9c8de;
}

#announce .tag {
  flex: none;
  padding: 1px 6px;
  border-radius: 4px;
  background: #2f7dff;
  color: #fff;
  font-size: 11px;
  line-height: 16px;
}

#share-btn {
  flex: none;
  height: 32px;
  padding: 0 14px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 16px;
  background: #171c26;
  color: #cfd8e6;
  font-size: 13px;
}

#share-btn:active { background: #202836; }

/* ================= 开播页 ================= */
#preview {
  position: absolute;
  top: 0; right: 0; bottom: 0; left: 0;
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
  background: #000;
}

.bc-app #composer { gap: 10px; }

.bc-btn {
  flex: 1;
  height: 44px;
  border: none;
  border-radius: 22px;
  background: #1b2230;
  color: #dfe6f0;
  font-size: 15px;
  font-weight: 500;
}

.bc-btn.primary { background: #ff4d4f; color: #fff; }

.bc-btn:disabled { opacity: 0.45; }
