/* ========== 直播页面样式 ========== */
/* CSS 变量 - 深色模式（默认） */
:root {
  --live-bg: #0e0e10;
  --live-surface: #18181b;
  --live-surface-hover: #26262c;
  --live-border: #2f2f35;
  --live-text: #efeff1;
  --live-text-secondary: #adadb8;
  --live-accent: #9147ff;
  --live-accent-hover: #772ce8;
  --live-accent-active: #5c16c5;
  --live-username: #bf94ff;
  --live-input-bg: #3a3a3d;
  --live-input-bg-focus: #464649;
  --live-scrollbar: #3a3a3d;
  --live-scrollbar-hover: #464649;
  --live-modal-overlay: rgba(0,0,0,0.8);
  --live-shadow: rgba(0,0,0,0.4);
}
/* 亮色模式 */
@media (prefers-color-scheme: light) {
  :root {
    --live-bg: #f7f7f8;
    --live-surface: #fff;
    --live-surface-hover: #f0f0f0;
    --live-border: #d3d3d3;
    --live-text: #0e0e10;
    --live-text-secondary: #868686;
    --live-accent: #9147ff;
    --live-accent-hover: #772ce8;
    --live-accent-active: #5c16c5;
    --live-username: #9147ff;
    --live-input-bg: #fff;
    --live-input-bg-focus: #fff;
    --live-scrollbar: #d3d3d3;
    --live-scrollbar-hover: #b3b3b3;
    --live-modal-overlay: rgba(0,0,0,0.5);
    --live-shadow: rgba(0,0,0,0.1);
  }
}
/* 主容器 */
.live-container {
  display: flex;
  margin-top: 44px;
  height: calc(100vh - 44px);
  background: var(--live-bg);
}
/* 左侧视频区域 */
.live-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
}
/* 视频包装器 */
.video-wrapper {
  position: relative;
  flex: 1;
  background: #000;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}
.live-video {
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #000;
}
/* 全屏按钮 */
.fullscreen-btn {
  position: absolute;
  bottom: 60px;
  right: 20px;
  background: rgba(0,0,0,0.6);
  border: none;
  border-radius: 8px;
  padding: 8px;
  cursor: pointer;
  color: #fff;
  opacity: 0;
  transition: opacity 0.3s ease;
  z-index: 10;
}
/* 返回选择按钮 */
.back-btn {
  position: absolute;
  top: 20px;
  left: 20px;
  background: rgba(0,0,0,0.6);
  border: none;
  border-radius: 8px;
  padding: 8px 12px;
  cursor: pointer;
  color: #fff;
  opacity: 0;
  transition: opacity 0.3s ease;
  z-index: 10;
}
.video-wrapper:hover .fullscreen-btn,
.video-wrapper:hover .back-btn {
  opacity: 1;
}
.fullscreen-btn:hover,
.back-btn:hover {
  background: rgba(0,0,0,0.8);
}
/* 视频选择器 */
.video-selector {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  width: 100%;
  height: 100%;
  padding: 40px 20px;
  overflow-y: auto;
  background: var(--live-bg);
}
.video-selector h3 {
  color: var(--live-text);
  font-size: 24px;
  font-weight: 600;
  margin: 0 0 30px 0;
}
.video-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 20px;
  width: 100%;
  max-width: 1000px;
}
.video-item {
  cursor: pointer;
  border-radius: 12px;
  overflow: hidden;
  background: var(--live-surface);
  box-shadow: 0 2px 8px var(--live-shadow);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.video-item:hover {
  transform: translateY(-4px);
  box-shadow: 0 8px 24px var(--live-shadow);
}
.video-cover {
  position: relative;
  width: 100%;
  padding-top: 56.25%;
  background-size: cover;
  background-position: center;
  background-color: var(--live-surface-hover);
}
.video-cover .no-cover {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  color: var(--live-text-secondary);
  font-size: 14px;
}
.video-cover .play-icon {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  color: rgba(255,255,255,0.8);
  opacity: 0;
  transition: opacity 0.2s ease;
}
.video-item:hover .play-icon {
  opacity: 1;
}
.video-name {
  padding: 12px;
  color: var(--live-text);
  font-size: 14px;
  font-weight: 500;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.no-videos {
  color: var(--live-text-secondary);
  font-size: 16px;
  text-align: center;
  padding: 40px;
}
/* 弹幕层 */
.danmaku-layer {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  pointer-events: none;
  overflow: hidden;
  z-index: 5;
}
.danmaku-item {
  position: absolute;
  white-space: nowrap;
  font-size: 24px;
  font-weight: 500;
  color: #fff;
  text-shadow: 1px 1px 2px rgba(0,0,0,0.8), -1px -1px 2px rgba(0,0,0,0.8);
  animation: danmaku-scroll linear forwards;
  will-change: transform;
}
/* 输入区域 */
.chat-input-area {
  display: flex;
  gap: 12px;
  padding: 16px;
  background: var(--live-surface);
  border-top: 1px solid var(--live-border);
  align-items: center;
}
/* 麦克风按钮 */
.mic-btn,
.mute-btn {
  width: 44px;
  height: 44px;
  border: none;
  border-radius: 50%;
  background: var(--live-surface-hover);
  color: var(--live-text);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s, color 0.2s, transform 0.1s;
  flex-shrink: 0;
}
.mic-btn:hover,
.mute-btn:hover {
  background: var(--live-border);
}
.mic-btn.active {
  background: #e53935;
  color: #fff;
  animation: mic-pulse 1.5s infinite;
}
.mic-btn.connecting {
  background: #ff9800;
  color: #fff;
}
.mute-btn.active {
  background: #757575;
  color: #fff;
}
.mute-btn.active svg {
  opacity: 0.6;
}
.chat-input {
  flex: 1;
  padding: 12px 16px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: var(--live-input-bg);
  color: var(--live-text);
  font-size: 14px;
  outline: none;
  transition: background 0.2s ease, border-color 0.2s ease;
}
.chat-input::placeholder {
  color: var(--live-text-secondary);
}
.chat-input:focus {
  background: var(--live-input-bg-focus);
  border-color: var(--live-accent);
}
.send-btn {
  padding: 12px 24px;
  border: none;
  border-radius: 8px;
  background: var(--live-accent);
  color: #fff;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s ease;
}
.send-btn:hover {
  background: var(--live-accent-hover);
}
.send-btn:active {
  background: var(--live-accent-active);
}
/* 右侧聊天面板 */
.chat-panel {
  width: 340px;
  display: flex;
  flex-direction: column;
  background: var(--live-surface);
  border-left: 1px solid var(--live-border);
}
.chat-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px;
  border-bottom: 1px solid var(--live-border);
}
.chat-header h3 {
  color: var(--live-text);
  font-size: 16px;
  font-weight: 600;
  margin: 0;
}
.header-right {
  display: flex;
  align-items: center;
  gap: 12px;
}
.voice-indicator {
  display: none;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  color: #e53935;
}
.voice-indicator.active {
  display: flex;
}
.voice-indicator::before {
  content: '';
  width: 8px;
  height: 8px;
  background: #e53935;
  border-radius: 50%;
  animation: voice-blink 1s infinite;
}
.viewer-count {
  color: var(--live-text-secondary);
  font-size: 13px;
}
/* 我的昵称栏 */
.my-nickname {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 10px 16px;
  background: var(--live-surface-hover);
  border-bottom: 1px solid var(--live-border);
  font-size: 13px;
  color: var(--live-text-secondary);
}
.my-nickname .nickname-text {
  color: var(--live-username);
  font-weight: 600;
}
.edit-nickname-btn {
  background: none;
  border: none;
  padding: 4px;
  cursor: pointer;
  color: var(--live-text-secondary);
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 0.2s, background 0.2s;
}
.edit-nickname-btn:hover {
  color: var(--live-accent);
  background: var(--live-surface);
}
/* 聊天消息区域 */
.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.chat-messages::-webkit-scrollbar {
  width: 6px;
}
.chat-messages::-webkit-scrollbar-track {
  background: transparent;
}
.chat-messages::-webkit-scrollbar-thumb {
  background: var(--live-scrollbar);
  border-radius: 3px;
}
.chat-messages::-webkit-scrollbar-thumb:hover {
  background: var(--live-scrollbar-hover);
}
/* 单条消息 */
.chat-message {
  padding: 8px 12px;
  border-radius: 8px;
  background: var(--live-surface-hover);
  animation: message-fade-in 0.3s ease;
}
.chat-message .meta {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 4px;
}
.chat-message .username {
  color: var(--live-username);
  font-size: 13px;
  font-weight: 600;
}
.chat-message .username.is-me {
  text-decoration: underline;
  text-decoration-style: dotted;
  text-underline-offset: 2px;
}
.chat-message .username.is-me:hover {
  opacity: 0.8;
}
.chat-message .time {
  color: var(--live-text-secondary);
  font-size: 11px;
}
.chat-message .content {
  color: var(--live-text);
  font-size: 14px;
  line-height: 1.5;
  word-break: break-word;
}
/* 昵称修改弹窗 */
.nickname-modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  width: 100%;
  height: 100%;
  background: var(--live-modal-overlay);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 10000;
}
.nickname-modal.show {
  display: flex;
}
.nickname-dialog {
  background: var(--live-surface);
  border-radius: 12px;
  padding: 24px;
  width: 320px;
  max-width: 90vw;
  box-shadow: 0 8px 32px var(--live-shadow);
}
.nickname-dialog h4 {
  color: var(--live-text);
  font-size: 18px;
  font-weight: 600;
  margin: 0 0 16px 0;
}
.nickname-dialog input {
  width: 100%;
  padding: 12px 16px;
  border: 1px solid var(--live-border);
  border-radius: 8px;
  background: var(--live-input-bg);
  color: var(--live-text);
  font-size: 14px;
  outline: none;
  box-sizing: border-box;
  transition: border-color 0.2s ease;
}
.nickname-dialog input:focus {
  border-color: var(--live-accent);
}
.nickname-actions {
  display: flex;
  gap: 12px;
  margin-top: 16px;
  justify-content: flex-end;
}
.nickname-cancel,
.nickname-confirm {
  padding: 10px 20px;
  border: none;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.2s ease;
}
.nickname-cancel {
  background: var(--live-surface-hover);
  color: var(--live-text);
}
.nickname-cancel:hover {
  background: var(--live-border);
}
.nickname-confirm {
  background: var(--live-accent);
  color: #fff;
}
.nickname-confirm:hover {
  background: var(--live-accent-hover);
}
/* 全屏模式 */
.video-wrapper.fullscreen {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 9999;
  background: #000;
}
.video-wrapper.fullscreen .fullscreen-btn {
  bottom: 80px;
  right: 30px;
}
.video-wrapper.fullscreen .danmaku-item {
  font-size: 32px;
}
/* 响应式设计 */
@media (max-width: 900px) {
  .live-container {
    flex-direction: column;
    height: auto;
    min-height: calc(100vh - 44px);
  }
  .live-main {
    height: 60vh;
    min-height: 300px;
  }
  .chat-panel {
    width: 100%;
    height: 40vh;
    min-height: 250px;
    border-left: none;
    border-top: 1px solid var(--live-border);
  }
  .video-grid {
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 16px;
  }
}
@media (max-width: 600px) {
  .chat-input-area {
    padding: 12px;
  }
  .chat-input {
    padding: 10px 12px;
    font-size: 13px;
  }
  .send-btn {
    padding: 10px 16px;
    font-size: 13px;
  }
  .danmaku-item {
    font-size: 18px;
  }
  .video-wrapper.fullscreen .danmaku-item {
    font-size: 24px;
  }
  .video-selector {
    padding: 24px 16px;
  }
  .video-selector h3 {
    font-size: 20px;
    margin-bottom: 20px;
  }
  .nickname-dialog {
    padding: 20px;
  }
}
@-moz-keyframes danmaku-scroll {
  from {
    transform: translateX(100vw);
  }
  to {
    transform: translateX(-100%);
  }
}
@-webkit-keyframes danmaku-scroll {
  from {
    transform: translateX(100vw);
  }
  to {
    transform: translateX(-100%);
  }
}
@-o-keyframes danmaku-scroll {
  from {
    transform: translateX(100vw);
  }
  to {
    transform: translateX(-100%);
  }
}
@keyframes danmaku-scroll {
  from {
    transform: translateX(100vw);
  }
  to {
    transform: translateX(-100%);
  }
}
@-moz-keyframes mic-pulse {
  0%, 100% {
    transform: scale(1);
    box-shadow: 0 0 0 0 rgba(229,57,53,0.4);
  }
  50% {
    transform: scale(1.05);
    box-shadow: 0 0 0 8px rgba(229,57,53,0);
  }
}
@-webkit-keyframes mic-pulse {
  0%, 100% {
    transform: scale(1);
    box-shadow: 0 0 0 0 rgba(229,57,53,0.4);
  }
  50% {
    transform: scale(1.05);
    box-shadow: 0 0 0 8px rgba(229,57,53,0);
  }
}
@-o-keyframes mic-pulse {
  0%, 100% {
    transform: scale(1);
    box-shadow: 0 0 0 0 rgba(229,57,53,0.4);
  }
  50% {
    transform: scale(1.05);
    box-shadow: 0 0 0 8px rgba(229,57,53,0);
  }
}
@keyframes mic-pulse {
  0%, 100% {
    transform: scale(1);
    box-shadow: 0 0 0 0 rgba(229,57,53,0.4);
  }
  50% {
    transform: scale(1.05);
    box-shadow: 0 0 0 8px rgba(229,57,53,0);
  }
}
@-moz-keyframes voice-blink {
  0%, 100% {
    opacity: 1;
  }
  50% {
    opacity: 0.3;
  }
}
@-webkit-keyframes voice-blink {
  0%, 100% {
    opacity: 1;
  }
  50% {
    opacity: 0.3;
  }
}
@-o-keyframes voice-blink {
  0%, 100% {
    opacity: 1;
  }
  50% {
    opacity: 0.3;
  }
}
@keyframes voice-blink {
  0%, 100% {
    opacity: 1;
  }
  50% {
    opacity: 0.3;
  }
}
@-moz-keyframes message-fade-in {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}
@-webkit-keyframes message-fade-in {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}
@-o-keyframes message-fade-in {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}
@keyframes message-fade-in {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}
