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

html, body {
  width: 100%;
  height: 100%;
  background: #111;
  color: #fff;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  overflow: hidden;
}

.page {
  display: flex;
  flex-direction: column;
  height: 100%;
}

.player-wrap {
  position: relative;
  width: 100%;
  flex: 1;
  min-height: 0;
  background: #000;
  display: flex;
  flex-direction: column;
}

.room-page .player-wrap {
  flex: 1;
  height: 100%;
}

.player-media {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  background: #000;
  z-index: 1;
  overflow: visible;
}

#liveVideo,
.player-media video,
.player-media .tcp-vjs-player,
.player-media .video-js {
  position: absolute !important;
  inset: 0 !important;
  width: 100% !important;
  height: 100% !important;
  object-fit: contain;
  object-position: center center;
  background: #000;
  z-index: 1;
}

/* 移动端 HLS：视频在 #mobilePlayLayer，须隐藏同级的 #playerMedia，否则会盖住画面 */
.player-wrap.mobile-hls-mode .player-media {
  display: none !important;
}

.mobile-play-layer {
  position: absolute;
  inset: 0;
  z-index: 2;
  background: #000;
}

.mobile-play-layer video {
  position: absolute !important;
  inset: 0 !important;
  width: 100% !important;
  height: 100% !important;
  object-fit: contain;
  object-position: center center;
  background: #000;
}

.mobile-play-gate {
  position: absolute;
  inset: 0;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  background: rgba(0, 0, 0, 0.72);
  color: #fff;
  text-align: center;
  padding: 20px;
}

.mobile-play-gate.hidden { display: none !important; }

.mobile-play-gate button {
  border: 0;
  border-radius: 999px;
  padding: 14px 36px;
  background: #ff4d4f;
  color: #fff;
  font-size: 17px;
  font-weight: 600;
}

.mobile-play-gate .dbg {
  max-width: 92%;
  font-size: 11px;
  color: rgba(255,255,255,0.55);
  word-break: break-all;
}

.player-media .vjs-control-bar,
.player-media .vjs-big-play-button,
.player-media .vjs-loading-spinner,
.player-media .vjs-error-display,
.player-media .vjs-modal-dialog,
.player-media .tcp-right-click-popup-menu,
.player-media .vjs-poster {
  display: none !important;
}

.room-stage {
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  /* 留出底部 comment-bar，评论不得超出直播画面区域 */
  bottom: calc(56px + env(safe-area-inset-bottom));
  z-index: 10;
  pointer-events: none;
  background: transparent;
  overflow: hidden;
}

.room-stage > * {
  pointer-events: auto;
}

.live-badge {
  position: absolute;
  top: calc(12px + env(safe-area-inset-top));
  left: 12px;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(255, 77, 79, 0.92);
  font-size: 12px;
  z-index: 60;
}

.live-badge .dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #fff;
  animation: pulse 1.2s infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

.reward-panel {
  /* above video */
  position: absolute;
  top: calc(12px + env(safe-area-inset-top));
  right: 12px;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
  z-index: 60;
  max-width: 62%;
}

.reward-card {
  min-width: 168px;
  padding: 10px 12px;
  border-radius: 12px;
  background: rgba(0, 0, 0, 0.58);
  backdrop-filter: blur(6px);
  color: #fff;
}

.reward-title {
  margin-bottom: 8px;
  font-size: 12px;
  font-weight: 600;
  color: #fff;
}

.reward-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: 8px;
}

.reward-desc {
  flex: 1;
  font-size: 11px;
  line-height: 1.4;
  color: rgba(255, 255, 255, 0.92);
}

.reward-tip {
  font-size: 11px;
  color: rgba(255, 255, 255, 0.8);
  line-height: 1.4;
}

.reward-tip-btn,
.reward-claim-btn {
  border: none;
  border-radius: 999px;
  padding: 6px 12px;
  font-size: 12px;
  color: #fff;
  cursor: pointer;
  flex-shrink: 0;
}

.reward-tip-btn {
  width: 100%;
  background: rgba(255, 255, 255, 0.16);
}

.reward-claim-btn {
  background: linear-gradient(135deg, #ff6b3d, #ff3b30);
  box-shadow: 0 4px 12px rgba(255, 59, 48, 0.35);
  font-weight: 600;
}

.reward-done,
.reward-wait {
  font-size: 11px;
  white-space: nowrap;
}

.reward-done {
  color: #95d475;
}

.reward-wait {
  color: rgba(255, 255, 255, 0.65);
}

.lucky-bag-panel {
  position: absolute;
  left: 12px;
  top: 76px;
  z-index: 60;
  max-width: 42%;
}

.lucky-bag-panel.hidden {
  display: none;
}

.lucky-bag-card {
  padding: 10px 12px;
  border-radius: 12px;
  background: rgba(0, 0, 0, 0.58);
  backdrop-filter: blur(6px);
}

.lucky-bag-title {
  font-size: 11px;
  color: #ffd666;
  margin-bottom: 4px;
}

.lucky-bag-prize {
  font-size: 14px;
  font-weight: 600;
  line-height: 1.3;
  margin-bottom: 4px;
}

.lucky-bag-meta {
  font-size: 11px;
  color: rgba(255, 255, 255, 0.75);
  line-height: 1.4;
}

.lucky-bag-joined {
  margin-top: 8px;
  font-size: 12px;
  color: #95de64;
}

.lucky-bag-join {
  margin-top: 8px;
  width: 100%;
  border: none;
  border-radius: 999px;
  padding: 8px 0;
  background: linear-gradient(135deg, #ffd666, #fa8c16);
  color: #422006;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
}

.unmute-hint {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  z-index: 4;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 20px;
  border: none;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.72);
  color: #fff;
  font-size: 15px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.35);
}

.unmute-hint.hidden {
  display: none;
}

.unmute-icon {
  font-size: 18px;
  line-height: 1;
}

.info-bar {
  position: absolute;
  left: 12px;
  right: 12px;
  bottom: 12px;
  z-index: 2;
}

.live-title {
  font-size: 16px;
  font-weight: 600;
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.6);
}

.anchor-name {
  margin-top: 4px;
  font-size: 12px;
  color: rgba(255, 255, 255, 0.85);
}

.comment-list {
  position: absolute;
  left: 12px;
  bottom: 8px;
  width: min(72%, 280px);
  /* 限制在画面中下部，不盖住顶部徽章/奖励，也不超出视频区 */
  max-height: min(28vh, 32%);
  overflow-x: hidden;
  overflow-y: auto;
  z-index: 60;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  gap: 6px;
  pointer-events: none;
}

.comment-item {
  align-self: flex-start;
  max-width: 100%;
  padding: 6px 10px;
  border-radius: 12px;
  background: rgba(0, 0, 0, 0.45);
  font-size: 13px;
  line-height: 1.45;
  word-break: break-word;
}

.comment-name {
  color: #ffd666;
}

.comment-text {
  color: #fff;
}

.room-dock {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 41;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
}

.comment-bar {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px calc(10px + env(safe-area-inset-bottom));
  background: linear-gradient(to top, rgba(0, 0, 0, 0.72), rgba(0, 0, 0, 0.28));
  border-top: none;
}

.comment-input {
  flex: 1;
  height: 36px;
  border: none;
  border-radius: 18px;
  padding: 0 14px;
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  font-size: 14px;
  outline: none;
}

.comment-input::placeholder {
  color: rgba(255, 255, 255, 0.55);
}

.comment-send {
  flex-shrink: 0;
  height: 36px;
  padding: 0 16px;
  border: none;
  border-radius: 18px;
  background: #ff4d4f;
  color: #fff;
  font-size: 14px;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 120px;
  transform: translateX(-50%) translateY(12px);
  z-index: 99;
  max-width: 80%;
  padding: 10px 16px;
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.78);
  color: #fff;
  font-size: 13px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.status-mask {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  background: rgba(0, 0, 0, 0.55);
  z-index: 15;
  text-align: center;
  padding: 24px;
}

.status-mask.hidden {
  display: none;
}

.status-mask .msg {
  font-size: 14px;
  color: rgba(255, 255, 255, 0.85);
  line-height: 1.6;
}

.btn {
  border: none;
  border-radius: 999px;
  padding: 10px 18px;
  background: #ff4d4f;
  color: #fff;
  font-size: 14px;
}

.products-panel {
  flex-shrink: 0;
  max-height: 26vh;
  margin: 0 8px 6px;
  background: rgba(255, 255, 255, 0.96);
  color: #333;
  border-radius: 14px;
  overflow: hidden;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.25);
}

.products-panel.hidden {
  display: none;
}

.products-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px 6px;
  font-size: 14px;
  font-weight: 600;
}

.products-list {
  overflow-y: auto;
  max-height: calc(26vh - 40px);
  padding: 0 10px 10px;
}

.product-item {
  display: flex;
  gap: 10px;
  padding: 10px 0;
  border-bottom: 1px solid #f0f0f0;
}

.product-item:last-child {
  border-bottom: none;
}

.product-item img {
  width: 72px;
  height: 72px;
  border-radius: 8px;
  object-fit: cover;
  background: #f5f5f5;
}

.product-meta {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.product-name {
  font-size: 14px;
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.product-price {
  color: #ff4d4f;
  font-size: 16px;
  font-weight: 600;
}

.product-price small {
  margin-left: 6px;
  color: #999;
  font-size: 12px;
  font-weight: 400;
  text-decoration: line-through;
}

.empty-products {
  padding: 16px;
  text-align: center;
  color: #999;
  font-size: 13px;
}

.list-page {
  min-height: 100%;
  background: #f7f7f7;
  color: #333;
  overflow-y: auto;
}

.list-header {
  padding: 20px 16px 12px;
  font-size: 24px;
  font-weight: 600;
}

.course-list {
  padding: 0 12px 24px;
}

.course-card {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 12px;
  margin-bottom: 16px;
  padding: 20px;
  border-radius: 14px;
  background: #fff;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.06);
}

.course-card-title {
  font-size: 20px;
  font-weight: 700;
  color: #222;
  line-height: 1.5;
  word-break: break-all;
}

.course-card-status {
  font-size: 16px;
  font-weight: 600;
  line-height: 1.5;
}

.course-card-status--living {
  color: #ff4d4f;
}

.course-card-status--ended {
  color: #999;
}

.course-card-status--pending {
  color: #fa8c16;
}

.course-card-range,
.course-card-content {
  font-size: 16px;
  color: #555;
  line-height: 1.7;
  word-break: break-all;
}

.course-card-content {
  color: #666;
}

.course-enter-btn {
  align-self: flex-end;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 108px;
  padding: 12px 22px;
  border-radius: 999px;
  background: #ff4d4f;
  color: #fff;
  font-size: 16px;
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
}

.live-cards {
  padding: 0 12px 24px;
}

.live-card {
  display: block;
  margin-bottom: 12px;
  border-radius: 12px;
  overflow: hidden;
  background: #fff;
  text-decoration: none;
  color: inherit;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

.live-card-cover {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  background: #ddd;
}

.live-card-cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.live-card-body {
  padding: 12px;
}

.live-card-title {
  font-size: 15px;
  font-weight: 600;
}

.live-card-sub {
  margin-top: 6px;
  font-size: 12px;
  color: #999;
}
