:root {
  --bg: #0b0d12;
  --bg-soft: #11141c;
  --panel: #161a24;
  --panel-hover: #1c2130;
  --border: #262c3b;
  --border-strong: #343c50;
  --text: #e9ecf3;
  --text-soft: #a7b0c0;
  --muted: #7d8799;
  --accent: #5b8cff;
  --accent-soft: rgba(91, 140, 255, 0.16);
  --accent-strong: #7aa2ff;
  --danger: #ff5c7a;
  --danger-soft: rgba(255, 92, 122, 0.14);
  --ok: #3ddc97;
  --shadow: 0 16px 40px rgba(0, 0, 0, 0.35);
  --radius: 12px;
  --radius-sm: 8px;
  color-scheme: dark;
}

* {
  box-sizing: border-box;
}

html,
body,
#root {
  height: 100%;
}

body {
  margin: 0;
  background: radial-gradient(circle at 12% 0%, #151c2e 0%, var(--bg) 46%);
  color: var(--text);
  font-family:
    "Microsoft YaHei", "PingFang SC", "Segoe UI", system-ui, -apple-system,
    sans-serif;
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

a {
  color: inherit;
  text-decoration: none;
}

button,
input,
select {
  font: inherit;
  color: inherit;
}

button {
  cursor: pointer;
}

.app-shell {
  display: flex;
  flex-direction: column;
  height: 100vh;
}

.topbar-search {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
  max-width: 560px;
}

.topbar-search input {
  flex: 1;
  min-width: 0;
  height: 38px;
  padding: 0 14px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--bg-soft);
  outline: none;
  transition: border-color 0.2s ease, background 0.2s ease;
}

.topbar-search input:focus {
  border-color: var(--accent);
  background: #151a26;
}

.topbar-search button {
  height: 38px;
  padding: 0 18px;
  border: 0;
  border-radius: 999px;
  background: var(--accent);
  color: #fff;
  font-weight: 600;
}

.topbar-search button:hover {
  background: var(--accent-strong);
}

.page-header .topbar-search {
  max-width: 720px;
}

.page-header.search-header {
  justify-content: flex-start;
}

.site-picker {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 12px;
}

.site-picker select {
  height: 34px;
  padding: 0 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-soft);
  outline: none;
}

.app-body {
  display: flex;
  flex: 1;
  min-height: 0;
}

.sidebar {
  display: flex;
  flex-direction: column;
  width: 128px;
  flex: 0 0 128px;
  padding: 6px 6px;
  border-right: 1px solid var(--border);
  background: rgba(17, 20, 28, 0.6);
}

.nav-section-title {
  padding: 4px 12px;
  color: var(--muted);
  font-size: 11px;
  letter-spacing: 0.5px;
}

.nav-platform {
  width: 100%;
  border: 0;
  background: transparent;
  font-family: inherit;
  text-align: left;
  white-space: nowrap;
  cursor: pointer;
}

.nav-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  color: var(--text-soft);
  font-size: 14px;
  transition: background 0.18s ease, color 0.18s ease;
}

.nav-link:hover {
  background: var(--panel-hover);
  color: var(--text);
}

.nav-link.active {
  background: var(--accent-soft);
  color: var(--accent-strong);
  font-weight: 600;
}

.nav-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
  opacity: 0.6;
}

.content {
  flex: 1;
  min-width: 0;
  overflow-y: auto;
  padding: 24px 28px 48px;
}

.page {
  max-width: 1560px;
  margin: 0 auto;
}

.page-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  flex-wrap: wrap;
  margin-bottom: 22px;
}

.page-header h1 {
  margin: 0 0 6px;
  font-size: 24px;
  letter-spacing: 0.2px;
}

.page-header p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

.room-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(224px, 1fr));
  gap: 16px;
}

.room-card {
  display: flex;
  flex-direction: column;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--panel);
  overflow: hidden;
  transition: transform 0.18s ease, border-color 0.18s ease,
    box-shadow 0.18s ease;
}

.room-card:hover {
  transform: translateY(-3px);
  border-color: var(--border-strong);
  box-shadow: var(--shadow);
}

.room-card-cover {
  position: relative;
  aspect-ratio: 16 / 9;
  background: linear-gradient(140deg, #1d2432, #131722);
  overflow: hidden;
}

.room-card-cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.room-card-online {
  position: absolute;
  top: 8px;
  right: 8px;
  padding: 3px 8px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.66);
  color: #fff;
  font-size: 11px;
  backdrop-filter: blur(4px);
}

.room-card-body {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 10px 12px 12px;
  min-width: 0;
}

.room-card-body strong {
  font-size: 14px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.room-card-body span {
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 220px;
  padding: 40px 20px;
  color: var(--text-soft);
  text-align: center;
}

.state p {
  margin: 0;
  color: var(--muted);
  max-width: 480px;
}

.state-error strong {
  color: var(--danger);
}

.state-empty strong {
  font-size: 16px;
}

.spinner {
  width: 26px;
  height: 26px;
  border: 2px solid var(--border-strong);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 36px;
  padding: 0 18px;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  background: var(--accent);
  color: #fff;
  font-weight: 600;
  transition: filter 0.18s ease, background 0.18s ease;
}

.button:hover {
  filter: brightness(1.08);
}

.button:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.button.ghost {
  background: transparent;
  border-color: var(--border);
  color: var(--text-soft);
}

.button.ghost:hover {
  border-color: var(--border-strong);
  color: var(--text);
}

.button.danger {
  background: var(--danger-soft);
  color: var(--danger);
}

.button.active {
  background: var(--accent-soft);
  border-color: var(--accent);
  color: var(--accent-strong);
}

.load-more {
  display: flex;
  justify-content: center;
  padding: 24px 0 8px;
}

.category-nav {
  display: flex;
  flex-direction: column;
  gap: 10px;
  flex: 1;
  min-width: 0;
}

.category-nav .chip-row {
  flex-wrap: nowrap;
  overflow-x: auto;
  padding-bottom: 4px;
  scrollbar-width: thin;
}

.category-nav .chip {
  flex: 0 0 auto;
  white-space: nowrap;
}

.chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.chip {
  padding: 5px 10px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: transparent;
  color: var(--text-soft);
  font-size: 12px;
}

.chip:hover {
  border-color: var(--border-strong);
  color: var(--text);
}

.chip.active {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent-strong);
}

.category-content {
  min-width: 0;
}

.mode-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 18px;
  border-bottom: 1px solid var(--border);
}

.mode-tab {
  padding: 9px 4px;
  margin-bottom: -1px;
  border: 0;
  border-bottom: 2px solid transparent;
  background: transparent;
  color: var(--muted);
  font-size: 14px;
}

.mode-tab.active {
  border-bottom-color: var(--accent);
  color: var(--accent-strong);
  font-weight: 600;
}

.anchor-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 12px;
}

.anchor-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--panel);
  transition: border-color 0.18s ease, transform 0.18s ease;
}

.anchor-card:hover {
  border-color: var(--border-strong);
  transform: translateY(-2px);
}

.anchor-avatar {
  width: 44px;
  height: 44px;
  flex: 0 0 44px;
  border-radius: 50%;
  overflow: hidden;
  background: var(--bg-soft);
}

.anchor-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.anchor-info {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.anchor-info strong {
  font-size: 14px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.anchor-info span {
  color: var(--muted);
  font-size: 12px;
}

.saved-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 12px;
}

.saved-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--panel);
}

.saved-cover {
  width: 108px;
  height: 62px;
  flex: 0 0 108px;
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: var(--bg-soft);
}

.saved-cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.saved-body {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
  flex: 1;
}

.saved-title {
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.saved-body > span {
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.settings-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 16px;
  align-items: start;
}

.panel {
  padding: 18px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--panel);
}

.panel h2 {
  margin: 0 0 14px;
  font-size: 15px;
}

.form-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
  color: var(--text-soft);
}

.form-row:last-child {
  margin-bottom: 0;
}

.form-row > label,
.form-row > span:first-child {
  min-width: 108px;
}

.form-row select,
.form-row input[type="text"] {
  height: 34px;
  padding: 0 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-soft);
  outline: none;
}

.form-row input[type="range"] {
  flex: 1;
  accent-color: var(--accent);
}

.form-row input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: var(--accent);
}

.muted {
  color: var(--muted);
  font-size: 13px;
}

.status-line {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 14px;
  color: var(--text-soft);
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--danger);
}

.status-dot.ok {
  background: var(--ok);
}

.room-page {
  max-width: 1600px;
  margin: 0 auto;
  padding: 20px 24px 40px;
}

.room-main {
  min-width: 0;
}

.room-toolbar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px 12px;
  margin-bottom: 12px;
  color: var(--muted);
  font-size: 13px;
}

.back-link {
  padding: 5px 10px;
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--text-soft);
  font-size: 12px;
}

.back-link:hover {
  border-color: var(--border-strong);
  color: var(--text);
}

.room-toolbar-title {
  flex: 1;
  min-width: 0;
  color: var(--text);
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.room-status-badge {
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  color: var(--muted);
  font-size: 11px;
  white-space: nowrap;
}

.room-status-badge.live {
  background: var(--danger-soft);
  color: var(--danger);
}

.room-toolbar-meta {
  color: var(--muted);
  white-space: nowrap;
}

.room-toolbar-meta strong {
  color: var(--text);
  font-weight: 500;
}

.room-toolbar-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.room-toolbar-actions .button {
  height: 30px;
  padding: 0 14px;
  font-size: 12px;
}

.room-stage {
  position: relative;
  aspect-ratio: 16 / 9;
  width: 100%;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: #000;
  overflow: hidden;
}

.room-stage:fullscreen {
  aspect-ratio: auto;
  width: 100vw;
  height: 100vh;
  border: 0;
  border-radius: 0;
}

.web-video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #000;
  z-index: 1;
}

.danmaku-layer {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 2;
}

.play-overlay {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  border: 0;
  background: rgba(0, 0, 0, 0.42);
  color: #fff;
  font-size: 16px;
  font-weight: 600;
  letter-spacing: 1px;
  z-index: 4;
}

.play-overlay[hidden] {
  display: none;
}

.play-overlay:hover {
  background: rgba(0, 0, 0, 0.28);
}

.room-placeholder {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: var(--muted);
  font-size: 14px;
  background: radial-gradient(circle at 50% 30%, #171d2a, #080a0f 70%);
}

.player-controls {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 18px 14px 12px;
  background: linear-gradient(transparent, rgba(0, 0, 0, 0.82));
}

.player-controls-left,
.player-controls-right {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.control-button {
  height: 32px;
  padding: 0 12px;
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: var(--radius-sm);
  background: rgba(15, 18, 26, 0.6);
  color: #e9ecf3;
  font-size: 12px;
  backdrop-filter: blur(6px);
}

.control-button:hover {
  border-color: rgba(255, 255, 255, 0.45);
}

.control-button.primary {
  background: rgba(91, 140, 255, 0.9);
  border-color: transparent;
  font-weight: 600;
}

.control-button.active {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent-strong);
}

.control-select {
  height: 32px;
  max-width: 180px;
  padding: 0 8px;
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: var(--radius-sm);
  background: rgba(15, 18, 26, 0.75);
  font-size: 12px;
  outline: none;
}

.volume-slider {
  width: 96px;
  accent-color: var(--accent);
}

.player-error {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-top: 12px;
  padding: 12px 14px;
  border: 1px solid rgba(255, 92, 122, 0.4);
  border-radius: var(--radius-sm);
  background: var(--danger-soft);
  color: var(--danger);
  font-size: 13px;
}

.player-error span {
  color: var(--text-soft);
}

.room-under {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  margin-top: 16px;
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--panel);
}

.room-owner {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.room-owner img {
  width: 46px;
  height: 46px;
  flex: 0 0 46px;
  border-radius: 50%;
  object-fit: cover;
  background: var(--bg-soft);
}

.room-owner div {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.room-owner strong {
  font-size: 14px;
}

.room-owner span {
  color: var(--muted);
  font-size: 12px;
  max-width: 640px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.room-stats {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  color: var(--text-soft);
  font-size: 12px;
}

.room-stats span {
  padding: 3px 9px;
  border: 1px solid var(--border);
  border-radius: 999px;
}

.room-notice-panel {
  margin-top: 14px;
}

kbd {
  min-width: 52px;
  padding: 2px 8px;
  border: 1px solid var(--border-strong);
  border-radius: 6px;
  background: var(--bg-soft);
  color: var(--text-soft);
  font-family: inherit;
  font-size: 12px;
  text-align: center;
}

@media (max-width: 900px) {
  .sidebar {
    width: 168px;
    flex-basis: 168px;
  }
}

@media (max-width: 720px) {
  .topbar-search {
    flex-basis: 100%;
    max-width: none;
  }

  .app-body {
    flex-direction: column;
  }

  .sidebar {
    width: auto;
    flex-basis: auto;
    flex-direction: row;
    overflow-x: auto;
    border-right: 0;
    border-bottom: 1px solid var(--border);
    padding: 8px 12px;
  }

  .nav-list {
    flex-direction: row;
    gap: 6px;
  }

  .nav-link {
    white-space: nowrap;
    padding: 8px 10px;
  }

  .content {
    padding: 16px 14px 40px;
  }

  .room-page {
    padding: 14px;
  }

  .player-controls {
    flex-direction: column;
    align-items: stretch;
  }

  .player-controls-left,
  .player-controls-right {
    justify-content: space-between;
  }
}