:root {
  color-scheme: dark;
  --bg: #101114;
  --panel: #181a20;
  --panel-2: #20232b;
  --text: #f4f4f5;
  --muted: #a7abb6;
  --line: rgba(255, 255, 255, 0.1);
  --accent: #35d0ba;
  --accent-2: #ffcb66;
  --danger: #ff6b7a;
  --shadow: 0 18px 50px rgba(0, 0, 0, 0.32);
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
}

html.player-open,
body.player-open {
  height: 100%;
  overflow: hidden;
  overscroll-behavior: none;
}

body.player-open {
  position: fixed;
  left: 0;
  right: 0;
  width: 100%;
}

button,
input,
select {
  font: inherit;
}

.app-shell {
  width: min(1480px, 100%);
  margin: 0 auto;
  padding: 22px clamp(14px, 3vw, 32px) 48px;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: grid;
  grid-template-columns: auto minmax(180px, 1fr);
  align-items: center;
  gap: 16px;
  padding: 14px 0 18px;
  background: rgba(16, 17, 20, 0.88);
  backdrop-filter: blur(18px);
}

.eyebrow,
.topbar h1,
.content-head h2,
.player-info h2,
.empty-state h2 {
  margin: 0;
}

.eyebrow {
  color: var(--accent);
  font-size: 13px;
  letter-spacing: 0;
}

.topbar h1 {
  margin-top: 4px;
  font-size: clamp(24px, 4vw, 40px);
  line-height: 1.1;
}

.stats {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
  color: var(--muted);
  font-size: 13px;
}

.main-nav {
  display: grid;
  grid-template-columns: repeat(5, minmax(64px, 1fr));
  gap: 6px;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  min-width: 0;
  max-width: 100%;
}

.nav-tab {
  min-width: 0;
  min-height: 42px;
  padding: 0 10px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  overflow: hidden;
  text-align: center;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.nav-tab.active {
  background: var(--text);
  color: #101114;
  font-weight: 700;
}

.stats span,
.ghost-button,
.toggle,
.select-field,
.search-box {
  border: 1px solid var(--line);
  background: var(--panel);
}

.stats span {
  padding: 8px 10px;
  border-radius: 8px;
}

.toolbar {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) minmax(130px, 180px) auto;
  gap: 10px;
  align-items: stretch;
  margin: 10px 0 24px;
}

.info-panel {
  display: grid;
  gap: 18px;
}

.info-hero {
  padding: clamp(22px, 4vw, 42px);
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.info-hero h1 {
  margin: 6px 0 10px;
  font-size: clamp(28px, 5vw, 52px);
  line-height: 1.05;
}

.info-hero p {
  margin: 0;
  color: var(--muted);
}

.info-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 12px;
}

.info-grid article {
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.info-grid span {
  display: block;
  font-size: 28px;
  font-weight: 800;
}

.info-grid p {
  margin: 6px 0 0;
  color: var(--muted);
}

.search-box,
.select-field {
  display: grid;
  gap: 5px;
  min-height: 64px;
  padding: 9px 12px;
  border-radius: 8px;
}

.search-box span,
.select-field span {
  color: var(--muted);
  font-size: 12px;
}

.search-box input,
.select-field select {
  width: 100%;
  min-width: 0;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--text);
}

.ghost-button {
  min-height: 44px;
  border-radius: 7px;
  color: var(--muted);
  cursor: pointer;
}

.toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 64px;
  padding: 0 14px;
  border-radius: 8px;
  color: var(--muted);
  white-space: nowrap;
}

.content-head {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
}

.content-head h2 {
  font-size: 22px;
}

.content-head p {
  margin: 6px 0 0;
  color: var(--muted);
}

.ghost-button {
  padding: 0 14px;
  background: transparent;
}

.author-rail {
  margin: 0 0 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  overflow: hidden;
}

.mobile-author-picker {
  display: none;
}

.author-rail-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px;
  border-bottom: 1px solid var(--line);
}

.author-rail-head:has(.author-rail-stats) {
  display: block;
}

.author-rail-head h2 {
  margin: 0;
  font-size: 17px;
}

.author-rail-head p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.author-rail-stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 7px;
  width: 100%;
}

.author-rail-stats span {
  display: grid;
  min-width: 62px;
  padding: 7px 9px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.05);
  color: var(--muted);
  font-size: 11px;
}

.author-rail-stats strong {
  color: var(--text);
  font-size: 16px;
  line-height: 1.1;
}

.author-list {
  display: grid;
  grid-auto-flow: row;
  grid-auto-columns: auto;
  grid-template-columns: 1fr;
  gap: 8px;
  overflow-x: hidden;
  overflow-y: auto;
  padding: 10px 12px 14px;
  scrollbar-width: thin;
}

body[data-tab="following"] .author-list {
  grid-auto-flow: row;
  grid-auto-columns: auto;
  grid-template-columns: 1fr;
  overflow-x: hidden;
}

.author-chip {
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr) auto;
  gap: 9px;
  align-items: center;
  min-height: 54px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 7px;
  background: var(--panel-2);
  color: var(--text);
  text-align: left;
  cursor: pointer;
}

.author-chip.status-stopped {
  border-color: rgba(255, 107, 122, 0.42);
  background: linear-gradient(90deg, rgba(255, 107, 122, 0.13), var(--panel-2));
}

.author-chip.active {
  border-color: rgba(53, 208, 186, 0.65);
  background: rgba(53, 208, 186, 0.13);
}

.author-chip img,
.author-avatar-fallback {
  width: 38px;
  height: 38px;
  border-radius: 999px;
  object-fit: cover;
  background: #30343e;
}

.author-avatar-fallback {
  display: grid;
  place-items: center;
  color: var(--accent-2);
  font-weight: 700;
}

.author-chip strong,
.author-chip span {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.author-chip strong {
  font-size: 13px;
}

.author-chip span {
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
}

.author-status {
  align-self: center;
  padding: 4px 7px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  color: var(--muted);
  font-style: normal;
  font-size: 12px;
  white-space: nowrap;
}

.status-stopped .author-status {
  background: rgba(255, 107, 122, 0.2);
  color: #ffd6db;
}

.author-toolbar-host {
  margin-bottom: 16px;
}

.author-toolbar-host .toolbar {
  margin: 0;
}

.author-profile {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 14px;
  margin: -6px 0 16px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.author-profile-main {
  display: grid;
  grid-template-columns: 72px minmax(0, 1fr);
  gap: 14px;
  align-items: center;
}

.author-profile-main img {
  width: 72px;
  height: 72px;
  border-radius: 999px;
  object-fit: cover;
  background: var(--panel-2);
}

.author-profile-main p,
.author-profile-main h3 {
  margin: 0;
}

.author-profile-main p {
  color: var(--accent);
  font-size: 13px;
}

.author-profile-main h3 {
  margin-top: 4px;
  font-size: 24px;
}

.author-signature {
  margin-top: 8px;
  color: var(--muted);
  white-space: pre-wrap;
  line-height: 1.45;
}

.author-profile-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(118px, 1fr));
  gap: 8px;
}

.author-profile-stats span {
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-2);
  color: var(--muted);
  font-size: 12px;
}

.author-profile-stats b {
  display: block;
  margin-bottom: 3px;
  color: var(--text);
  font-size: 18px;
}

.author-upload-chart {
  min-width: 0;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-2);
}

.chart-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.chart-head h4 {
  margin: 0;
  font-size: 15px;
}

.chart-head span,
.chart-empty {
  color: var(--muted);
  font-size: 12px;
}

.author-upload-chart svg {
  display: block;
  width: 100%;
  height: auto;
  overflow: visible;
}

.chart-grid line {
  stroke: rgba(255, 255, 255, 0.08);
  stroke-width: 1;
}

.chart-grid text,
.chart-label {
  fill: var(--muted);
  font-size: 11px;
}

.chart-label {
  text-anchor: middle;
}

.chart-area {
  fill: rgba(53, 208, 186, 0.1);
}

.chart-line {
  fill: none;
  stroke: var(--accent);
  stroke-width: 3;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.chart-dot {
  fill: var(--panel-2);
  stroke: var(--accent);
  stroke-width: 2;
}

@media (min-width: 981px) {
  body[data-tab="following"] main {
    display: grid;
    grid-template-columns: minmax(220px, 280px) minmax(0, 1fr);
    gap: 18px;
    align-items: start;
  }

  body[data-tab="following"] .author-rail {
    position: sticky;
    top: 126px;
    grid-row: 1 / span 4;
    max-height: calc(100vh - 148px);
    margin: 0;
    display: grid;
    grid-template-rows: auto minmax(0, 1fr);
  }

  body[data-tab="following"] .author-list {
    grid-auto-flow: row;
    grid-auto-columns: auto;
    grid-template-columns: 1fr;
    overflow-x: hidden;
    overflow-y: auto;
  }
}

.video-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  gap: 14px;
}

body[data-tab="recommend"] .video-grid {
  margin-top: 10px;
}

.recommend-panel {
  display: flex;
  justify-content: flex-end;
  margin: 0 0 12px;
}

.refresh-recommend {
  min-width: 104px;
  padding: 0 18px;
  background: var(--panel);
  color: var(--text);
}

.video-card {
  overflow: hidden;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
  cursor: pointer;
}

.thumb {
  position: relative;
  display: grid;
  place-items: center;
  aspect-ratio: 9 / 13;
  background:
    radial-gradient(circle at 32% 20%, rgba(53, 208, 186, 0.2), transparent 28%),
    linear-gradient(155deg, #242833, #121317 70%);
}

.thumb img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.thumb img.is-hidden {
  display: none;
}

.thumb::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, transparent 45%, rgba(0, 0, 0, 0.62));
}

.play-mark {
  position: relative;
  z-index: 1;
  width: 54px;
  height: 54px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.32);
  color: var(--text);
  font-size: 24px;
}

.badge-row {
  position: absolute;
  z-index: 1;
  left: 10px;
  right: 10px;
  bottom: 10px;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 8px;
}

.badge-group {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
  min-width: 0;
}

.badge {
  max-width: 100%;
  padding: 5px 7px;
  border-radius: 7px;
  background: rgba(0, 0, 0, 0.5);
  color: #fff;
  font-size: 12px;
  white-space: nowrap;
}

.badge.missing {
  background: rgba(255, 71, 92, 0.92);
  color: #fff;
  font-weight: 700;
  box-shadow: 0 6px 18px rgba(255, 71, 92, 0.26);
}

.missing-corner {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 2;
}

.card-body {
  padding: 12px;
}

.card-title {
  display: -webkit-box;
  min-height: 44px;
  margin: 0 0 10px;
  overflow: hidden;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  color: var(--text);
  line-height: 1.35;
}

.meta-line {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  color: var(--muted);
  font-size: 12px;
}

.author {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.empty-state {
  margin: 42px auto;
  padding: 28px;
  max-width: 460px;
  border: 1px solid var(--line);
  border-radius: 8px;
  text-align: center;
  background: var(--panel);
}

.empty-state p {
  color: var(--muted);
}

.load-more {
  display: block;
  width: min(360px, 100%);
  min-height: 46px;
  margin: 22px auto 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-2);
  color: var(--text);
  cursor: pointer;
}

.player-dialog {
  width: 100vw;
  max-width: 100vw;
  height: 100vh;
  max-height: 100vh;
  padding: 0;
  border: 0;
  background: #030406;
  color: var(--text);
  overflow: hidden;
  overscroll-behavior: contain;
  touch-action: none;
}

.player-dialog::backdrop {
  background: rgba(0, 0, 0, 0.78);
  backdrop-filter: blur(6px);
}

.player-layout {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 72px minmax(260px, 360px);
  align-items: stretch;
  width: 100vw;
  height: 100vh;
  background: #030406;
  overflow: hidden;
  overscroll-behavior: contain;
}

.player-stage {
  position: relative;
  min-width: 0;
  height: 100vh;
  background: #000;
  will-change: transform, opacity, filter;
  backface-visibility: hidden;
  transform: translateZ(0);
}

.player-stage video {
  width: 100%;
  height: 100vh;
  object-fit: contain;
  background: #000;
}

.center-play {
  position: absolute;
  left: 50%;
  top: 50%;
  z-index: 3;
  display: grid;
  place-items: center;
  width: 74px;
  height: 74px;
  border: 1px solid rgba(255, 255, 255, 0.26);
  border-radius: 999px;
  transform: translate(-50%, -50%);
  background: rgba(0, 0, 0, 0.34);
  color: #fff;
  font-size: 27px;
  cursor: pointer;
  opacity: 0.72;
  backdrop-filter: blur(12px);
  transition:
    opacity 160ms ease,
    transform 160ms ease,
    background 160ms ease;
}

.center-play:focus-visible {
  opacity: 1;
}

.center-play:active {
  transform: translate(-50%, -50%) scale(0.96);
}

.player-progress {
  position: absolute;
  left: 22px;
  right: 22px;
  bottom: 22px;
  z-index: 4;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  padding: 9px 12px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.34);
  color: rgba(255, 255, 255, 0.84);
  font-size: 12px;
  backdrop-filter: blur(12px);
}

.player-progress input {
  width: 100%;
  accent-color: var(--accent);
  touch-action: pan-x;
}

.player-actions {
  display: grid;
  align-content: center;
  justify-items: center;
  gap: 14px;
  background: #030406;
}

.player-info {
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding: 72px 24px 32px;
  background: linear-gradient(90deg, rgba(3, 4, 6, 0.28), rgba(24, 26, 32, 0.96));
  overflow: auto;
  will-change: transform, opacity;
  backface-visibility: hidden;
  transform: translateZ(0);
}

.player-dialog.is-switching .player-stage,
.player-dialog.is-switching .player-info {
  pointer-events: none;
}

.player-author {
  margin: 0 0 8px;
  color: var(--accent);
}

.player-info h2 {
  font-size: 20px;
  line-height: 1.35;
}

.player-info dl {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 10px 14px;
  margin: 22px 0;
  color: var(--muted);
}

.player-info dd {
  margin: 0;
  color: var(--text);
}

.mobile-player-badges,
.info-toggle {
  display: none;
}

.player-badge {
  padding: 5px 8px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.42);
  color: #fff;
  font-size: 12px;
  backdrop-filter: blur(8px);
}

.icon-button {
  border: 0;
  cursor: pointer;
}

.close-button {
  position: absolute;
  top: 18px;
  right: 18px;
  z-index: 2;
  width: 40px;
  height: 40px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.55);
  color: #fff;
  font-size: 28px;
  line-height: 1;
}

.switch-button {
  width: 48px;
  height: 48px;
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  font-size: 24px;
  cursor: pointer;
  backdrop-filter: blur(8px);
}

.switch-button:disabled {
  opacity: 0.35;
  cursor: default;
}

@media (max-width: 980px) {
  .topbar {
    grid-template-columns: 1fr;
    align-items: start;
  }

  .main-nav {
    width: 100%;
  }

  .toolbar {
    grid-template-columns: minmax(0, 1fr) minmax(112px, 150px) auto;
  }

  .search-box {
    grid-column: auto;
  }

  .player-layout {
    grid-template-columns: 1fr;
  }

  .player-stage,
  .player-stage video {
    height: 100vh;
  }

  .center-play {
    width: 72px;
    height: 72px;
    font-size: 26px;
  }

  .player-progress {
    left: 14px;
    right: 68px;
    top: auto;
    bottom: calc(20px + env(safe-area-inset-bottom));
    padding: 8px 11px;
    background: rgba(0, 0, 0, 0.28);
    font-size: 13px;
  }

  .player-info {
    position: absolute;
    left: 0;
    right: 64px;
    bottom: calc(64px + env(safe-area-inset-bottom));
    max-height: 36vh;
    padding: 20px 16px 0;
    background: transparent;
    pointer-events: none;
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.85);
  }

  .mobile-player-badges {
    display: flex;
    order: 3;
    flex-wrap: wrap;
    gap: 7px;
    margin-top: 9px;
    margin-bottom: 0;
  }

  .player-info dl {
    display: none;
  }

  .player-author {
    order: 1;
    margin-bottom: 7px;
    color: #fff;
    font-weight: 700;
    font-size: 15px;
  }

  .player-info h2 {
    order: 2;
    max-width: 88vw;
    font-size: 16px;
    line-height: 1.45;
    display: -webkit-box;
    overflow: hidden;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
  }

  .info-toggle {
    position: absolute;
    right: 14px;
    bottom: calc(20px + env(safe-area-inset-bottom));
    z-index: 3;
    display: grid;
    place-items: center;
    width: 42px;
    height: 42px;
    border: 1px solid rgba(255, 255, 255, 0.32);
    border-radius: 999px;
    background: rgba(0, 0, 0, 0.34);
    color: #fff;
    font-weight: 700;
    cursor: pointer;
    backdrop-filter: blur(8px);
  }

  .player-dialog.info-expanded .player-info {
    right: 0;
    max-height: 58vh;
    bottom: calc(66px + env(safe-area-inset-bottom));
    padding-right: 64px;
    padding-bottom: 14px;
    overflow: auto;
    pointer-events: auto;
    background: rgba(0, 0, 0, 0.52);
    backdrop-filter: blur(10px);
  }

  .player-dialog.info-expanded .player-info h2 {
    display: block;
    overflow: visible;
  }

  .player-dialog.info-expanded .player-info dl {
    order: 4;
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    gap: 8px 12px;
    margin: 12px 0 0;
    font-size: 12px;
  }

  .player-dialog.info-expanded .info-toggle {
    background: rgba(53, 208, 186, 0.86);
    color: #05100e;
  }

  .player-actions {
    display: none;
  }

  body[data-tab="following"] .content-head {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 10px;
  }

  body[data-tab="following"] .mobile-author-picker {
    position: sticky;
    top: 8px;
    z-index: 12;
    display: inline-flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    width: min(72vw, 320px);
    min-height: 48px;
    margin: 0 0 10px;
    padding: 0 13px;
    border: 1px solid rgba(255, 255, 255, 0.16);
    border-radius: 999px;
    background: rgba(24, 26, 32, 0.86);
    color: var(--text);
    box-shadow: 0 10px 28px rgba(0, 0, 0, 0.28);
    cursor: pointer;
    backdrop-filter: blur(14px);
  }

  body[data-tab="following"] .mobile-author-picker::after {
    content: "";
    width: 8px;
    height: 8px;
    flex: 0 0 auto;
    margin: -4px 1px 0 2px;
    border-right: 2px solid var(--accent);
    border-bottom: 2px solid var(--accent);
    transform: rotate(45deg);
    transition: transform 180ms ease, margin 180ms ease;
  }

  body.author-drawer-open .mobile-author-picker::after {
    margin-top: 4px;
    transform: rotate(225deg);
  }

  body[data-tab="following"] .mobile-author-picker span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  body[data-tab="following"] .author-rail {
    position: fixed;
    left: 14px;
    right: 14px;
    top: 74px;
    z-index: 30;
    display: grid;
    grid-template-rows: auto minmax(0, 1fr);
    max-height: min(68vh, 560px);
    margin: 0;
    border-color: rgba(255, 255, 255, 0.18);
    box-shadow: 0 24px 70px rgba(0, 0, 0, 0.48);
    opacity: 0;
    pointer-events: none;
    transform: translateY(-12px) scale(0.98);
    transform-origin: top left;
    transition:
      opacity 180ms ease,
      transform 180ms ease;
  }

  body.author-drawer-open[data-tab="following"] .author-rail {
    opacity: 1;
    pointer-events: auto;
    transform: translateY(0) scale(1);
  }

  body[data-tab="following"] .author-list {
    grid-auto-flow: row;
    grid-auto-columns: auto;
    grid-template-columns: 1fr;
    max-height: calc(min(68vh, 560px) - 54px);
    overflow-y: auto;
    overflow-x: hidden;
  }
}

@media (max-width: 620px) {
  .app-shell {
    padding-top: 14px;
    padding-bottom: calc(78px + env(safe-area-inset-bottom));
  }

  .topbar {
    position: static;
    display: block;
    padding: 0 0 12px;
    background: transparent;
    backdrop-filter: none;
  }

  .stats {
    justify-content: flex-start;
  }

  .main-nav {
    position: fixed;
    left: max(8px, env(safe-area-inset-left));
    right: max(8px, env(safe-area-inset-right));
    bottom: calc(8px + env(safe-area-inset-bottom));
    z-index: 20;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    width: auto;
    gap: 3px;
    padding: 5px;
    box-shadow: 0 12px 36px rgba(0, 0, 0, 0.44);
  }

  .nav-tab {
    min-height: 44px;
    padding: 0 2px;
    font-size: 13px;
    line-height: 1;
  }

  .toolbar {
    grid-template-columns: minmax(0, 1fr) 112px 92px;
    gap: 8px;
    margin: 6px 0 18px;
  }

  .search-box,
  .select-field {
    min-height: 58px;
    padding: 8px 11px;
  }

  .content-head {
    align-items: flex-start;
    flex-direction: column;
  }

  body[data-tab="following"] .content-head {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 10px;
  }

  .mobile-author-picker {
    display: none;
  }

  body[data-tab="following"] .mobile-author-picker {
    position: sticky;
    top: 8px;
    z-index: 12;
    display: inline-flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    width: min(72vw, 280px);
    min-height: 48px;
    margin: 0 0 10px;
    padding: 0 13px;
    border: 1px solid rgba(255, 255, 255, 0.16);
    border-radius: 999px;
    background: rgba(24, 26, 32, 0.86);
    color: var(--text);
    box-shadow: 0 10px 28px rgba(0, 0, 0, 0.28);
    cursor: pointer;
    backdrop-filter: blur(14px);
  }

  body[data-tab="following"] .mobile-author-picker::after {
    content: "";
    width: 8px;
    height: 8px;
    flex: 0 0 auto;
    margin: -4px 1px 0 2px;
    border-right: 2px solid var(--accent);
    border-bottom: 2px solid var(--accent);
    transform: rotate(45deg);
    transition: transform 180ms ease, margin 180ms ease;
  }

  body.author-drawer-open .mobile-author-picker::after {
    margin-top: 4px;
    transform: rotate(225deg);
  }

  body[data-tab="following"] .mobile-author-picker span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  body[data-tab="following"] .author-rail {
    position: fixed;
    left: 10px;
    right: 10px;
    top: 62px;
    z-index: 30;
    display: grid;
    grid-template-rows: auto minmax(0, 1fr);
    max-height: min(68vh, 560px);
    margin: 0;
    border-color: rgba(255, 255, 255, 0.18);
    box-shadow: 0 24px 70px rgba(0, 0, 0, 0.48);
    opacity: 0;
    pointer-events: none;
    transform: translateY(-12px) scale(0.98);
    transform-origin: top left;
    transition:
      opacity 180ms ease,
      transform 180ms ease;
  }

  body.author-drawer-open[data-tab="following"] .author-rail {
    opacity: 1;
    pointer-events: auto;
    transform: translateY(0) scale(1);
  }

  body[data-tab="following"] .author-list {
    grid-auto-flow: row;
    grid-auto-columns: auto;
    grid-template-columns: 1fr;
    max-height: calc(min(68vh, 560px) - 54px);
    overflow-y: auto;
    overflow-x: hidden;
  }

  .ghost-button {
    width: auto;
    min-width: 0;
    padding: 0 10px;
    white-space: nowrap;
  }

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

  body[data-tab="recommend"] .video-grid {
    margin-top: 8px;
  }

  .recommend-panel {
    justify-content: stretch;
    margin: 0 0 10px;
  }

  .refresh-recommend {
    width: 100%;
    min-height: 44px;
  }

  .card-body {
    padding: 11px;
  }

  .card-title {
    min-height: 40px;
    font-size: 15px;
  }

  .player-dialog {
    width: 100vw;
    max-height: 100vh;
    border: 0;
    border-radius: 0;
  }

  .player-layout video {
    height: 100vh;
  }
}

@media (max-width: 980px) {
  .app-shell {
    padding-bottom: calc(94px + env(safe-area-inset-bottom));
  }

  .topbar {
    position: static;
    display: block;
    padding: 0 0 14px;
    background: transparent;
    backdrop-filter: none;
  }

  .main-nav {
    position: fixed;
    left: max(10px, env(safe-area-inset-left));
    right: max(10px, env(safe-area-inset-right));
    bottom: calc(10px + env(safe-area-inset-bottom));
    z-index: 40;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    width: auto;
    gap: 4px;
    padding: 6px;
    border-color: rgba(255, 255, 255, 0.16);
    background: rgba(24, 26, 32, 0.9);
    box-shadow: 0 18px 48px rgba(0, 0, 0, 0.45);
    backdrop-filter: blur(18px);
  }

  .nav-tab {
    min-height: 44px;
    padding: 0 2px;
    font-size: 13px;
    line-height: 1;
  }

  body[data-tab="following"] .stats {
    display: none;
  }

  body[data-tab="following"] .mobile-author-picker {
    position: fixed;
    left: max(16px, env(safe-area-inset-left));
    bottom: calc(78px + env(safe-area-inset-bottom));
    top: auto;
    z-index: 39;
    display: grid;
    place-items: center;
    justify-content: center;
    width: 92px;
    height: 48px;
    min-height: 0;
    margin: 0;
    padding: 0;
    border: 1px solid rgba(255, 255, 255, 0.14);
    border-radius: 8px;
    background: rgba(32, 35, 43, 0.94);
    color: var(--text);
    box-shadow:
      0 14px 34px rgba(0, 0, 0, 0.42),
      inset 0 0 0 1px rgba(255, 255, 255, 0.04);
    cursor: pointer;
    backdrop-filter: blur(16px);
    transition:
      transform 180ms ease,
      box-shadow 180ms ease,
      filter 180ms ease;
  }

  body[data-tab="following"] .mobile-author-picker:hover,
  body[data-tab="following"] .mobile-author-picker:focus-visible {
    transform: translateY(-2px);
    border-color: rgba(53, 208, 186, 0.45);
  }

  body[data-tab="following"] .mobile-author-picker:active {
    transform: translateY(0) scale(0.96);
  }

  body[data-tab="following"] .mobile-author-picker span {
    display: block;
    width: 100%;
    font-size: 14px;
    font-weight: 700;
    line-height: 1;
    color: var(--text);
    text-align: center;
  }

  body[data-tab="following"] .mobile-author-picker::before {
    content: none;
  }

  body[data-tab="following"] .mobile-author-picker::after {
    content: none;
  }

  body.author-drawer-open[data-tab="following"] .mobile-author-picker {
    border-color: rgba(53, 208, 186, 0.48);
    background: rgba(35, 42, 49, 0.96);
    box-shadow:
      0 20px 46px rgba(0, 0, 0, 0.5),
      0 0 0 4px rgba(53, 208, 186, 0.12);
  }

  body.author-drawer-open[data-tab="following"] .mobile-author-picker::after {
    content: none;
  }

  body[data-tab="following"] .author-rail {
    position: fixed;
    left: max(16px, env(safe-area-inset-left));
    right: auto;
    top: auto;
    bottom: calc(150px + env(safe-area-inset-bottom));
    z-index: 38;
    display: grid;
    grid-template-rows: auto minmax(0, 1fr);
    width: min(420px, calc(100vw - 32px));
    max-height: min(70vh, 620px);
    margin: 0;
    border-color: rgba(255, 255, 255, 0.18);
    background: rgba(24, 26, 32, 0.94);
    box-shadow: 0 28px 80px rgba(0, 0, 0, 0.54);
    opacity: 0;
    pointer-events: none;
    transform: translateY(18px) scale(0.96);
    transform-origin: bottom left;
    backdrop-filter: blur(20px);
    transition:
      opacity 200ms ease,
      transform 220ms cubic-bezier(0.16, 1, 0.3, 1);
  }

  body.author-drawer-open[data-tab="following"] .author-rail {
    opacity: 1;
    pointer-events: auto;
    transform: translateY(0) scale(1);
  }

  body[data-tab="following"] .author-rail-head {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 10px;
    padding: 14px;
  }

  body[data-tab="following"] .author-rail-stats {
    justify-content: stretch;
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  body[data-tab="following"] .author-rail-stats span {
    min-width: 0;
  }

  body[data-tab="following"] .author-list {
    grid-auto-flow: row;
    grid-auto-columns: auto;
    grid-template-columns: 1fr;
    max-height: calc(min(70vh, 620px) - 132px);
    overflow-x: hidden;
    overflow-y: auto;
    padding: 10px 12px 14px;
  }
}

@media (max-width: 620px) {
  body[data-tab="following"] .mobile-author-picker {
    left: max(14px, env(safe-area-inset-left));
    bottom: calc(76px + env(safe-area-inset-bottom));
    width: 88px;
    height: 46px;
  }

  body[data-tab="following"] .author-rail {
    left: 12px;
    right: 12px;
    bottom: calc(142px + env(safe-area-inset-bottom));
    width: auto;
    max-height: min(68vh, 560px);
  }

  body[data-tab="following"] .author-list {
    max-height: calc(min(68vh, 560px) - 132px);
  }
}
