:root {
  --ink: #111827;
  --ink-soft: #2d3748;
  --muted: #7a8493;
  --line: #e8ebf0;
  --surface: #ffffff;
  --surface-soft: #f6f7f9;
  --gold: #ffd400;
  --gold-dark: #9f7600;
  --red: #e53935;
  --blue: #3b82f6;
  --gray: #697386;
  --shadow: 0 24px 70px rgba(15, 23, 42, 0.16);
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
}

body {
  min-height: 100dvh;
  margin: 0;
  color: var(--ink);
  background: #eef1f5;
  font-family: "Noto Sans SC", "PingFang SC", "Microsoft YaHei", sans-serif;
  letter-spacing: 0;
  text-rendering: geometricPrecision;
}

a {
  color: inherit;
  text-decoration: none;
}

button {
  font: inherit;
}

.live-shell {
  position: relative;
  width: min(100%, 480px);
  min-height: 100dvh;
  margin: 0 auto;
  padding-bottom: 92px;
  background: var(--surface-soft);
  box-shadow: var(--shadow);
}

.live-topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 58px;
  padding: 0 16px;
  background: rgba(255, 255, 255, 0.92);
  border-bottom: 1px solid rgba(232, 235, 240, 0.86);
  backdrop-filter: blur(16px);
}

.live-brand {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  min-width: 0;
  font-size: 16px;
  font-weight: 900;
}

.live-brand img {
  width: 34px;
  height: 34px;
  border-radius: 8px;
}

.download-pill,
.download-bar a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  background: var(--gold);
  color: #151515;
  font-size: 13px;
  font-weight: 900;
  white-space: nowrap;
}

.download-pill {
  min-height: 34px;
  padding: 0 14px;
}

.live-main {
  padding-bottom: 18px;
}

.live-carousel {
  position: relative;
  aspect-ratio: 21 / 9;
  min-height: 156px;
  margin: 12px 16px 0;
  overflow: hidden;
  border-radius: 16px;
  background: #121722;
}

.carousel-track {
  display: flex;
  width: 100%;
  height: 100%;
  min-height: inherit;
  transition: transform 0.32s ease;
}

.carousel-slide,
.carousel-loading {
  position: relative;
  flex: 0 0 100%;
  min-height: inherit;
}

.carousel-slide img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.carousel-loading {
  display: grid;
  place-items: center;
  background:
    linear-gradient(135deg, rgba(255, 212, 0, 0.34), transparent 42%),
    linear-gradient(145deg, #181f2b 0%, #111827 58%, #07090d 100%);
  color: rgba(255, 255, 255, 0.78);
  font-size: 13px;
  font-weight: 800;
}

.carousel-shade {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(180deg, transparent 44%, rgba(0, 0, 0, 0.46));
}

.carousel-title {
  position: absolute;
  left: 16px;
  bottom: 16px;
  right: 76px;
  color: #fff;
  font-size: 15px;
  font-weight: 900;
  line-height: 1.35;
  text-shadow: 0 1px 8px rgba(0, 0, 0, 0.44);
}

.carousel-title[hidden] {
  display: none;
}

.carousel-dots {
  position: absolute;
  right: 16px;
  bottom: 18px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.carousel-dot {
  width: 6px;
  height: 6px;
  padding: 0;
  border: 0;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.52);
  cursor: pointer;
}

.carousel-dot.is-active {
  width: 16px;
  background: var(--gold);
}

.live-search {
  padding: 12px 16px 10px;
  background: rgba(255, 255, 255, 0.94);
  border-bottom: 1px solid rgba(232, 235, 240, 0.9);
}

.live-search-field {
  display: flex;
  align-items: center;
  gap: 9px;
  min-height: 42px;
  padding: 0 12px;
  border-radius: 12px;
  background: #eef1f5;
  color: #8490a1;
}

.live-search-field > span {
  font-size: 23px;
  line-height: 1;
  transform: rotate(-18deg);
}

.live-search-field input {
  width: 100%;
  min-width: 0;
  padding: 0;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--ink);
  font: inherit;
  font-size: 14px;
}

.live-search-field input::placeholder {
  color: #9ca5b2;
}

.live-search-field button {
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  padding: 0;
  border: 0;
  border-radius: 999px;
  background: #aab3c0;
  color: #fff;
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
}

.live-search-field button[hidden] {
  display: none;
}

.live-search-summary {
  margin: 8px 2px 0;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.35;
}

.status-tabs {
  position: sticky;
  top: 58px;
  z-index: 8;
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 10px 16px;
  background: rgba(255, 255, 255, 0.94);
  border-bottom: 1px solid rgba(232, 235, 240, 0.9);
  backdrop-filter: blur(16px);
  scrollbar-width: none;
}

.status-tabs::-webkit-scrollbar {
  display: none;
}

.status-tabs button {
  flex: 0 0 auto;
  min-height: 30px;
  padding: 0 16px;
  border: 0;
  border-radius: 999px;
  background: #eef1f5;
  color: #687384;
  font-size: 13px;
  font-weight: 800;
  cursor: pointer;
}

.status-tabs button.is-active {
  background: var(--gold);
  color: #151515;
}

.stream-section {
  padding: 16px;
}

.stream-section + .stream-section {
  padding-top: 4px;
}

.stream-heading {
  display: flex;
  align-items: center;
  margin-bottom: 12px;
}

.stream-heading h2 {
  margin: 0;
  font-size: 17px;
  font-weight: 900;
}

.stream-count {
  margin-left: 7px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.stream-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.stream-card {
  display: block;
  overflow: hidden;
  border-radius: 12px;
  background: var(--surface);
  box-shadow: 0 2px 10px rgba(15, 23, 42, 0.07);
  transition: transform 0.18s ease, box-shadow 0.18s ease;
}

.stream-card:active {
  transform: scale(0.985);
}

.stream-card.is-signal-pending {
  box-shadow: 0 2px 10px rgba(15, 23, 42, 0.07), inset 0 0 0 1px rgba(59, 130, 246, 0.12);
}

.stream-thumb {
  position: relative;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  background:
    linear-gradient(135deg, rgba(255, 212, 0, 0.22), transparent 48%),
    #dfe4eb;
}

.stream-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.status-badge,
.viewer-badge,
.time-badge {
  position: absolute;
  left: 8px;
  display: inline-flex;
  align-items: center;
  border-radius: 5px;
  color: #fff;
  font-size: 10px;
  font-weight: 900;
  line-height: 1;
}

.status-badge {
  top: 8px;
  min-height: 18px;
  padding: 0 6px;
}

.status-badge.is-live {
  background: var(--red);
}

.status-badge.is-upcoming {
  background: var(--blue);
}

.status-badge.is-ended {
  background: var(--gray);
}

.viewer-badge,
.time-badge {
  bottom: 8px;
  min-height: 18px;
  padding: 0 6px;
  background: rgba(0, 0, 0, 0.48);
  backdrop-filter: blur(10px);
}

.time-badge.is-signal-pending {
  background: rgba(59, 130, 246, 0.82);
}

.stream-card-body {
  padding: 8px;
}

.stream-card h3 {
  min-height: 36px;
  margin: 0;
  color: var(--ink);
  font-size: 13px;
  line-height: 1.38;
  font-weight: 900;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  overflow: hidden;
}

.stream-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 7px;
  min-width: 0;
}

.stream-desc {
  min-width: 0;
  flex: 1;
  color: var(--muted);
  font-size: 11px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.category-tag {
  flex: 0 0 auto;
  max-width: 58px;
  padding: 2px 5px;
  border: 1px solid #f3e2a6;
  border-radius: 5px;
  background: #fff9dc;
  color: var(--gold-dark);
  font-size: 10px;
  font-weight: 800;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.stream-state {
  grid-column: 1 / -1;
  min-height: 210px;
  display: grid;
  place-items: center;
  padding: 28px;
  border-radius: 16px;
  background: var(--surface);
  color: var(--muted);
  text-align: center;
}

.stream-state strong {
  display: block;
  margin-bottom: 8px;
  color: var(--ink);
  font-size: 16px;
}

.skeleton-card {
  overflow: hidden;
  border-radius: 12px;
  background: var(--surface);
}

.skeleton-cover,
.skeleton-line {
  background: linear-gradient(90deg, #eef1f5 0%, #f7f8fa 48%, #eef1f5 100%);
  background-size: 220% 100%;
  animation: skeletonMove 1.2s ease-in-out infinite;
}

.skeleton-cover {
  aspect-ratio: 16 / 9;
}

.skeleton-body {
  padding: 8px;
}

.skeleton-line {
  height: 12px;
  border-radius: 999px;
}

.skeleton-line + .skeleton-line {
  margin-top: 8px;
}

.skeleton-line.is-short {
  width: 62%;
}

.download-bar {
  position: fixed;
  left: 50%;
  bottom: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: min(100%, 480px);
  min-height: 72px;
  padding: 10px 16px calc(10px + env(safe-area-inset-bottom));
  transform: translateX(-50%);
  background: rgba(255, 255, 255, 0.96);
  border-top: 1px solid rgba(232, 235, 240, 0.92);
  backdrop-filter: blur(16px);
}

.download-bar strong,
.download-bar span {
  display: block;
}

.download-bar strong {
  font-size: 14px;
  font-weight: 900;
}

.download-bar span {
  margin-top: 2px;
  color: var(--muted);
  font-size: 12px;
}

.download-bar a {
  min-width: 74px;
  min-height: 36px;
  padding: 0 16px;
}

.room-body {
  background: #11151d;
}

.room-shell {
  background: #f5f6f8;
}

.room-main {
  padding-bottom: 18px;
}

.player-stage {
  position: relative;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  background: #07090d;
  user-select: none;
}

.live-player,
.player-poster {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.live-player {
  z-index: 1;
  background: #07090d;
  filter: blur(0.85px) saturate(0.82) contrast(0.92);
  transform: scale(1.008);
}

.player-poster {
  z-index: 0;
  opacity: 0.46;
}

.player-shade {
  position: absolute;
  inset: 0;
  z-index: 2;
  pointer-events: none;
  background:
    linear-gradient(180deg, rgba(0, 0, 0, 0.7), transparent 34%),
    linear-gradient(0deg, rgba(0, 0, 0, 0.38), transparent 42%);
}

.player-shade,
.player-topbar {
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.player-topbar {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  z-index: 4;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 12px 8px;
  color: #fff;
}

.player-back {
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  width: 34px;
  height: 34px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.34);
  color: #fff;
  font-size: 28px;
  line-height: 1;
}

.player-title {
  min-width: 0;
  flex: 1;
}

.player-title h1 {
  margin: 0;
  font-size: 14px;
  line-height: 1.35;
  font-weight: 900;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.player-title span {
  display: block;
  margin-top: 2px;
  color: rgba(255, 255, 255, 0.78);
  font-size: 10px;
  font-weight: 700;
}

.quality-badge {
  flex: 0 0 auto;
  min-height: 28px;
  padding: 0 9px;
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.38);
  color: #fff;
  font-size: 11px;
  font-weight: 900;
}

.player-controls {
  position: absolute;
  left: 12px;
  right: 12px;
  bottom: 10px;
  z-index: 4;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.player-control-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 54px;
  height: 34px;
  padding: 0 13px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.48);
  color: #fff;
  font: inherit;
  font-size: 12px;
  font-weight: 900;
  cursor: pointer;
}

.player-control-button.is-primary {
  min-width: 62px;
  border-color: rgba(255, 212, 0, 0.9);
  background: rgba(255, 212, 0, 0.94);
  color: #161616;
}

.player-stage.controls-hidden .player-shade {
  opacity: 0;
}

.player-stage.controls-hidden .player-topbar {
  opacity: 0;
  pointer-events: none;
  transform: translateY(-8px);
}

.player-stage.controls-hidden .player-controls {
  opacity: 0;
  pointer-events: none;
  transform: translateY(8px);
}

.player-stage.has-player-state .player-shade {
  opacity: 1;
  transform: none;
}

.player-stage.has-player-state .player-topbar {
  opacity: 1;
  pointer-events: auto;
  transform: none;
}

.player-stage.has-player-state .player-controls {
  display: none;
}

.player-state {
  position: absolute;
  inset: 0;
  z-index: 3;
  display: grid;
  place-items: center;
  padding: 74px 28px 28px;
  color: #fff;
  text-align: center;
  background: rgba(7, 9, 13, 0.44);
}

.player-state[hidden],
.live-player[hidden] {
  display: none;
}

.player-state strong {
  display: block;
  font-size: 17px;
  line-height: 1.35;
}

.player-state span {
  display: block;
  margin-top: 8px;
  color: rgba(255, 255, 255, 0.74);
  font-size: 12px;
  line-height: 1.6;
}

.room-info {
  margin: 12px 16px 0;
  padding: 14px;
  border-radius: 14px;
  background: var(--surface);
  box-shadow: 0 2px 10px rgba(15, 23, 42, 0.07);
}

.room-status-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.room-status,
.room-category {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 0 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 900;
}

.room-status {
  background: #fee2e2;
  color: #b91c1c;
}

.room-status.is-upcoming {
  background: #dbeafe;
  color: #1d4ed8;
}

.room-status.is-ended,
.room-status.is-empty {
  background: #eef1f5;
  color: #5d6675;
}

.room-category {
  max-width: 42%;
  background: #fff9dc;
  color: var(--gold-dark);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.room-info h2 {
  margin: 12px 0 0;
  font-size: 18px;
  line-height: 1.35;
  font-weight: 900;
}

.room-info p {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.65;
}

@keyframes skeletonMove {
  from {
    background-position: 100% 0;
  }
  to {
    background-position: -100% 0;
  }
}

@media (hover: hover) {
  .stream-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 28px rgba(15, 23, 42, 0.13);
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
  }
}

@media (prefers-color-scheme: dark) {
  :root {
    --ink: #f4f6fa;
    --ink-soft: #d7dde7;
    --muted: #9ba6b6;
    --line: #2d3542;
    --surface: #171d26;
    --surface-soft: #0f141c;
    --shadow: 0 24px 70px rgba(0, 0, 0, 0.34);
  }

  body {
    background: #080c12;
  }

  .live-topbar,
  .status-tabs,
  .download-bar {
    background: rgba(18, 24, 32, 0.92);
    border-color: rgba(255, 255, 255, 0.08);
  }

  .status-tabs button {
    background: #222a36;
    color: #aab4c2;
  }

  .stream-thumb {
    background:
      linear-gradient(135deg, rgba(255, 212, 0, 0.18), transparent 48%),
      #202733;
  }

  .category-tag,
  .room-category {
    border-color: rgba(255, 212, 0, 0.22);
    background: rgba(255, 212, 0, 0.12);
  }

  .room-status.is-ended,
  .room-status.is-empty {
    background: #222a36;
    color: #aab4c2;
  }

  .skeleton-cover,
  .skeleton-line {
    background: linear-gradient(90deg, #202733 0%, #2a3442 48%, #202733 100%);
    background-size: 220% 100%;
  }
}

@media (max-width: 360px) {
  .live-shell,
  .download-bar {
    width: 100%;
  }

  .stream-grid {
    gap: 10px;
  }

  .stream-section {
    padding: 14px;
  }

  .live-carousel {
    margin-right: 14px;
    margin-left: 14px;
  }

  .stream-card h3 {
    font-size: 12px;
  }
}

@media (min-width: 760px) {
  .live-shell {
    margin-top: 24px;
    margin-bottom: 24px;
    min-height: calc(100dvh - 48px);
    border-radius: 28px;
    overflow: hidden;
  }

  .download-bar {
    bottom: 24px;
    border-radius: 0 0 28px 28px;
  }
}
