/* Final player experience layer. Loaded after the legacy theme so the player
   can stay focused, responsive, and independent from older card styles. */
:root {
  --live-page: #172127;
  --live-surface: #202c33;
  --live-surface-2: #26343b;
  --live-line: rgba(226, 240, 235, .14);
  --live-text: #f4f8f6;
  --live-muted: #aebdb7;
  --live-accent: #22c7a8;
  --live-danger: #ff5d6c;
}

html, body, .page.home, .content-wrapper {
  background: var(--live-page) !important;
}

.content-wrapper {
  color: var(--live-text);
}

[hidden] {
  display: none !important;
}

.chat-fixed-top {
  width: min(1240px, calc(100% - 32px));
  margin: 0 auto;
  padding: 14px 0 0 !important;
}

.landing-top-banner {
  min-height: 46px !important;
  margin: 0 0 12px !important;
  padding: 0 !important;
  background: var(--live-surface) !important;
  border: 1px solid var(--live-line);
  border-radius: 8px;
  overflow: hidden;
}

.site-notice {
  min-height: 44px;
  padding: 0 12px !important;
  background: transparent !important;
  border: 0 !important;
  box-shadow: none !important;
}

.site-notice-badge {
  background: rgba(34, 199, 168, .14) !important;
  color: #69ead1 !important;
  border: 1px solid rgba(34, 199, 168, .24);
  border-radius: 5px !important;
  font-size: 12px !important;
  font-weight: 700;
}

.site-notice-scroll,
.site-notice-scroll span,
#siteNoticeText {
  color: #dce9e3 !important;
}

.home-top-entry {
  max-width: none !important;
  margin: 0 !important;
  padding: 0 !important;
}

.home-top-entry .game-wrapper {
  display: block !important;
  margin: 0 !important;
  padding: 0 !important;
}

.home-top-entry .game-wrapper .game-wrapper_agbox,
.home-top-entry .game-wrapper .game-wrapper_ag.game-wrapper_agbg.is-player {
  width: 100% !important;
  min-height: 0 !important;
  height: auto !important;
  aspect-ratio: 16 / 9 !important;
  padding: 0 !important;
  background: #02050a !important;
  border: 1px solid rgba(226, 240, 235, .14) !important;
  border-radius: 10px !important;
  box-shadow: 0 14px 34px rgba(0, 0, 0, .22) !important;
}

.live-player-shell {
  width: 100% !important;
  height: 100% !important;
  min-height: 0 !important;
  aspect-ratio: 16 / 9;
  background: #02050a !important;
  border-radius: 9px !important;
  isolation: isolate;
}

.live-player-video,
.live-player-video video,
.live-player-video iframe,
#agoraRemotePlayer,
#agoraRemotePlayer > div,
#agoraRemotePlayer video {
  width: 100% !important;
  height: 100% !important;
  background: #02050a !important;
}

.live-player-video {
  flex: none !important;
  aspect-ratio: 16 / 9 !important;
  border-radius: inherit !important;
}

.live-player-video video,
#agoraRemotePlayer video {
  display: block;
  object-fit: contain !important;
  image-rendering: auto;
}

.live-player-overlay {
  z-index: 8 !important;
  background: rgba(2, 5, 10, .9) !important;
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
}

.player-loading .spinner {
  width: 28px !important;
  height: 28px !important;
  border: 2px solid rgba(244, 248, 246, .18) !important;
  border-top-color: var(--live-accent) !important;
}

.player-loading .loading-text,
.player-placeholder .placeholder-text,
.player-error .error-text {
  margin: 10px 16px 0 !important;
  color: #c9d7d1 !important;
  font-size: 13px !important;
}

.player-placeholder .placeholder-svg {
  opacity: .72 !important;
}

.player-error .retry-btn {
  margin-top: 14px;
  padding: 8px 16px !important;
  border-radius: 6px !important;
  background: var(--live-accent) !important;
  color: #09251f !important;
  box-shadow: none !important;
}

.live-player-titlebar {
  position: absolute !important;
  top: 10px;
  left: 12px;
  right: 12px;
  z-index: 5;
  min-height: 24px;
  padding: 0 !important;
  background: transparent !important;
  border: 0 !important;
  border-radius: 0 !important;
  pointer-events: none;
  opacity: 0;
  transform: translateY(-3px);
  transition: opacity .18s ease, transform .18s ease;
}

.live-player-shell.is-controls-visible .live-player-titlebar,
.live-player-shell.is-needs-user-play .live-player-titlebar,
.live-player-shell.is-error .live-player-titlebar {
  opacity: 1;
  transform: translateY(0);
}

.live-player-titlebar .player-title {
  max-width: min(62vw, 440px);
  color: rgba(255, 255, 255, .92) !important;
  font-size: 12px !important;
  font-weight: 650 !important;
  line-height: 24px;
  text-shadow: 0 1px 2px rgba(0, 0, 0, .68);
}

.live-player-titlebar .player-line-info {
  margin-left: 7px !important;
  padding: 1px 6px !important;
  border: 1px solid rgba(255, 255, 255, .17);
  border-radius: 4px !important;
  background: rgba(3, 8, 12, .55) !important;
  color: rgba(255, 255, 255, .78) !important;
  font-size: 10px !important;
  line-height: 18px;
}

.player-network-status {
  position: absolute;
  top: 11px;
  left: 50%;
  z-index: 9;
  max-width: min(72%, 360px);
  padding: 6px 9px;
  border: 1px solid rgba(226, 240, 235, .16);
  border-radius: 5px;
  background: rgba(4, 10, 14, .84);
  color: #e8f2ed;
  font-size: 12px;
  line-height: 16px;
  text-align: center;
  transform: translateX(-50%);
  box-shadow: 0 6px 18px rgba(0, 0, 0, .18);
}

.player-network-status.is-reconnecting::before,
.player-network-status.is-buffering::before {
  content: '';
  display: inline-block;
  width: 7px;
  height: 7px;
  margin: 0 6px 1px 0;
  border: 1px solid rgba(255, 255, 255, .45);
  border-top-color: var(--live-accent);
  border-radius: 50%;
  vertical-align: middle;
  animation: liveStatusSpin .8s linear infinite;
}

.player-network-status.is-action {
  background: rgba(13, 31, 29, .9);
  color: #85f3dd;
  border-color: rgba(34, 199, 168, .36);
}

@keyframes liveStatusSpin {
  to { transform: rotate(360deg); }
}

.player-corner.top-left {
  top: auto !important;
  left: 10px !important;
  bottom: 10px;
  z-index: 6;
}

.player-live-badge {
  min-height: 19px;
  padding: 0 6px !important;
  border: 0 !important;
  border-radius: 4px !important;
  background: rgba(255, 93, 108, .92) !important;
  box-shadow: none !important;
  color: #fff !important;
  font-size: 10px !important;
  line-height: 19px !important;
  letter-spacing: 0 !important;
}

.player-live-badge i {
  width: 5px !important;
  height: 5px !important;
  margin-right: 4px !important;
  background: #fff !important;
  box-shadow: none !important;
}

.player-controls {
  position: absolute !important;
  right: 9px;
  bottom: 9px;
  z-index: 10;
  align-items: center;
  gap: 2px !important;
  min-height: 38px;
  padding: 3px !important;
  border: 1px solid rgba(255, 255, 255, .16);
  border-radius: 7px !important;
  background: rgba(4, 10, 14, .76) !important;
  box-shadow: 0 6px 18px rgba(0, 0, 0, .24);
  opacity: 0;
  pointer-events: none;
  transform: translateY(4px);
  transition: opacity .18s ease, transform .18s ease;
}

.live-player-shell.is-controls-visible .player-controls,
.live-player-shell.is-paused .player-controls,
.live-player-shell.is-needs-user-play .player-controls,
.live-player-shell:focus-within .player-controls {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}

.player-ctrl-btn {
  width: 32px !important;
  height: 32px !important;
  padding: 0 !important;
  border: 0 !important;
  border-radius: 5px !important;
  background: transparent !important;
  color: #f6fbf8 !important;
  box-shadow: none !important;
}

.player-ctrl-btn:hover,
.player-ctrl-btn:focus-visible {
  background: rgba(255, 255, 255, .12) !important;
  outline: 0;
}

.player-ctrl-btn:active {
  transform: scale(.94);
}

.player-ctrl-btn svg {
  width: 18px !important;
  height: 18px !important;
}

.player-center-toggle,
.player-tap-feedback,
.player-buffering,
.player-danmaku-toggle,
.player-volume-bar,
.play-overlay {
  display: none !important;
}

.live-player-shell:fullscreen,
.live-player-shell:-webkit-full-screen {
  width: 100vw !important;
  height: 100vh !important;
  aspect-ratio: auto !important;
  border: 0 !important;
  border-radius: 0 !important;
  background: #000 !important;
}

.live-player-shell:fullscreen .live-player-video,
.live-player-shell:-webkit-full-screen .live-player-video {
  width: 100% !important;
  height: 100% !important;
  aspect-ratio: auto !important;
  border-radius: 0 !important;
}

.chat-tabs {
  width: min(1240px, calc(100% - 32px));
  height: 42px !important;
  margin: 14px auto 0;
  background: var(--live-surface) !important;
  border: 1px solid var(--live-line) !important;
  border-radius: 7px 7px 0 0;
}

.chat-tab {
  color: var(--live-muted) !important;
  font-size: 13px !important;
}

.chat-tab.is-active {
  color: #f6fbf8 !important;
  box-shadow: inset 0 -2px 0 var(--live-accent);
}

#chatRoom,
.schedule-panel,
.contact-panel {
  background: var(--live-surface) !important;
  border-color: var(--live-line) !important;
}

@media (max-width: 768px) {
  body {
    /* The legacy theme applies env(safe-area-inset-top) to the entire body.
       It is unreliable in embedded H5 webviews and can create a large empty
       strip above the live player, so the content owns its own spacing. */
    padding-top: 0 !important;
  }

  .chat-fixed-top {
    width: 100% !important;
    margin: 0 !important;
    padding: 0 !important;
  }

  .landing-top-banner {
    min-height: 48px !important;
    margin: 0 !important;
    border-width: 0 0 1px !important;
    border-radius: 0 !important;
  }

  .site-notice {
    min-height: 48px;
    padding: 0 12px !important;
  }

  .home-top-entry,
  .home-top-entry .game-wrapper,
  .home-top-entry .game-wrapper .game-wrapper_agbox,
  .home-top-entry .game-wrapper .game-wrapper_ag.game-wrapper_agbg.is-player {
    width: 100% !important;
    margin: 0 !important;
    padding: 0 !important;
    border: 0 !important;
    border-radius: 0 !important;
    box-shadow: none !important;
  }

  .home-top-entry .game-wrapper .game-wrapper_agbox,
  .home-top-entry .game-wrapper .game-wrapper_ag.game-wrapper_agbg.is-player {
    height: 56.25vw !important;
    min-height: 0 !important;
    aspect-ratio: auto !important;
  }

  .live-player-shell {
    width: 100vw !important;
    height: 56.25vw !important;
    min-height: 0 !important;
    margin-left: calc(50% - 50vw) !important;
    border-radius: 0 !important;
  }

  .live-player-video {
    position: absolute !important;
    inset: 0 !important;
    width: 100% !important;
    height: 100% !important;
    margin-left: 0 !important;
    aspect-ratio: 16 / 9 !important;
  }

  .live-player-titlebar {
    display: none !important;
  }

  .player-network-status {
    top: 8px;
    max-width: calc(100% - 94px);
    padding: 5px 7px;
    font-size: 11px;
    line-height: 15px;
  }

  .player-corner.top-left {
    left: 8px !important;
    bottom: 8px;
  }

  .player-controls {
    right: 7px;
    bottom: 7px;
    min-height: 36px;
  }

  .player-ctrl-btn {
    width: 30px !important;
    height: 30px !important;
  }

  .chat-tabs {
    width: 100%;
    margin: 0;
    border-width: 1px 0 0 !important;
    border-radius: 0;
  }

  /* The legacy fixed chat panel reserved space for the old three-tab bar.
     With optional tabs hidden, keep one calm 8px separation below video. */
  #chatRoom {
    top: calc(56.25vw + 56px) !important;
  }

  #chatTabs:not([hidden]) ~ #chatRoom {
    top: calc(56.25vw + 98px) !important;
  }
}

@media (prefers-reduced-motion: reduce) {
  .player-network-status.is-reconnecting::before,
  .player-network-status.is-buffering::before {
    animation: none;
  }
  .player-controls,
  .live-player-titlebar {
    transition: none;
  }
}
