/* ==========================================================================
   BOSSI.AV 影视 · 基础样式
   设计基调：浅灰纸面 + 纯白内容板 + 炭黑顶栏，暗红作为唯一强调色
   ========================================================================== */

:root {
  --bg: #f1f2f4;
  --panel: #ffffff;
  --ink: #16181b;
  --ink-2: #4e5359;
  --ink-3: #8d939a;
  --line: #e8e9ec;
  --line-soft: #f2f3f5;
  --dark: #0d0e10;
  --dark-2: #17191c;
  --dark-3: #22252a;
  --accent: #d8402c;
  --accent-soft: rgba(216, 64, 44, 0.09);
  --radius: 4px;
  --shadow: 0 1px 2px rgba(15, 17, 21, 0.04), 0 6px 18px rgba(15, 17, 21, 0.05);
  --header-h: 64px;
  --nav-h: 54px;
  --font: "Noto Sans SC", "PingFang SC", "Microsoft YaHei", "Hiragino Sans GB", system-ui, sans-serif;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

img {
  display: block;
  max-width: 100%;
}

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

button {
  font: inherit;
  color: inherit;
  background: none;
  border: 0;
  cursor: pointer;
}

input,
button,
a {
  -webkit-tap-highlight-color: transparent;
}

ul {
  margin: 0;
  padding: 0;
  list-style: none;
}

.wrap {
  width: 100%;
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 20px;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

/* hidden 属性优先于组件自身的 display 设定 */
[hidden] {
  display: none !important;
}

/* ============================ 顶栏 ============================ */

.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--dark);
}

.header-bar {
  height: var(--header-h);
  display: flex;
  align-items: center;
  gap: 18px;
}

.brand {
  display: inline-flex;
  align-items: baseline;
  gap: 8px;
  color: #fff;
  font-weight: 700;
  font-size: 22px;
  letter-spacing: 0.14em;
  line-height: 1;
  white-space: nowrap;
}

.brand::after {
  content: "影视";
  font-size: 11px;
  font-weight: 400;
  letter-spacing: 0.24em;
  color: rgba(255, 255, 255, 0.45);
  transform: translateY(-1px);
}

.search-form {
  position: relative;
  margin-left: auto;
  width: 300px;
  max-width: 40vw;
}

.search-form input {
  width: 100%;
  height: 38px;
  padding: 0 42px 0 14px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 3px;
  background: rgba(255, 255, 255, 0.07);
  color: #fff;
  font-size: 13.5px;
  outline: none;
  transition: background 0.2s, border-color 0.2s;
}

.search-form input::placeholder {
  color: rgba(255, 255, 255, 0.42);
}

.search-form input:focus {
  background: #fff;
  border-color: #fff;
  color: var(--ink);
}

.search-form input:focus::placeholder {
  color: var(--ink-3);
}

.search-form button {
  position: absolute;
  top: 0;
  right: 0;
  width: 40px;
  height: 38px;
  display: grid;
  place-items: center;
  color: rgba(255, 255, 255, 0.62);
}

.search-form button:hover {
  color: #fff;
}

.search-form input:focus + button,
.search-form:focus-within button {
  color: var(--ink-2);
}

.menu-btn {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 3px;
  color: #fff;
}

.menu-btn:hover {
  background: rgba(255, 255, 255, 0.08);
}

/* ============================ 分类导航 ============================ */

.nav-bar {
  background: var(--dark-2);
  border-top: 1px solid rgba(255, 255, 255, 0.05);
}

.nav-list {
  display: flex;
  align-items: stretch;
  height: var(--nav-h);
}

.nav-item {
  flex: 1 1 0;
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  color: rgba(255, 255, 255, 0.72);
  font-size: 15px;
  letter-spacing: 0.02em;
  position: relative;
  transition: color 0.18s, background 0.18s;
}

.nav-item span {
  display: block;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.nav-item:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.05);
}

.nav-item::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: 0;
  width: 0;
  height: 2px;
  background: var(--accent);
  transform: translateX(-50%);
  transition: width 0.22s ease;
}

.nav-item.is-active {
  color: #fff;
  font-weight: 500;
  background: rgba(255, 255, 255, 0.07);
}

.nav-item.is-active::after {
  width: 34px;
}

/* ============================ 页面骨架 ============================ */

.page {
  display: grid;
  grid-template-columns: 224px minmax(0, 1fr);
  align-items: start;
  gap: 22px;
  padding: 22px 0 46px;
}

.sidebar {
  position: sticky;
  top: calc(var(--header-h) + var(--nav-h) + 22px);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
}

.sidebar-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 15px 16px;
  border-bottom: 1px solid var(--line);
}

.sidebar-head h2 {
  margin: 0;
  font-size: 16px;
  font-weight: 600;
  letter-spacing: 0.06em;
}

.sidebar-head em {
  font-style: normal;
  font-size: 11.5px;
  color: var(--ink-3);
  letter-spacing: 0.02em;
}

.sidebar-list a {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 13px 16px;
  border-bottom: 1px solid var(--line-soft);
  font-size: 14.5px;
  color: var(--ink-2);
  transition: background 0.16s, color 0.16s;
}

.sidebar-list a:last-child {
  border-bottom: 0;
}

.sidebar-list a .count {
  font-size: 12px;
  color: var(--ink-3);
  font-variant-numeric: tabular-nums;
}

.sidebar-list a:hover {
  background: #fafafb;
  color: var(--ink);
}

.sidebar-list a.is-active {
  color: var(--ink);
  font-weight: 600;
  background: var(--accent-soft);
  box-shadow: inset 3px 0 0 var(--accent);
}

.sidebar-foot {
  padding: 13px 16px;
  border-top: 1px solid var(--line);
  font-size: 12px;
  color: var(--ink-3);
}

/* ============================ 内容板 ============================ */

.content {
  display: flex;
  flex-direction: column;
  gap: 22px;
  min-width: 0;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.panel-head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 20px 14px;
  border-bottom: 1px solid var(--line);
}

.panel-head h2 {
  margin: 0;
  font-size: 17px;
  font-weight: 600;
  letter-spacing: 0.03em;
  padding-left: 11px;
  position: relative;
}

.panel-head h2::before {
  content: "";
  position: absolute;
  left: 0;
  top: 4px;
  bottom: 4px;
  width: 3px;
  background: var(--accent);
  border-radius: 2px;
}

.panel-head .sub {
  font-size: 12.5px;
  color: var(--ink-3);
}

.panel-head .more {
  margin-left: auto;
  font-size: 13px;
  color: var(--ink-3);
  display: inline-flex;
  align-items: center;
  gap: 3px;
  min-height: 40px;
  padding: 0 6px;
  margin-right: -6px;
  transition: color 0.16s;
}

.panel-head .more:hover {
  color: var(--accent);
}

.panel-body {
  padding: 18px 20px 20px;
}

/* ============================ 影片卡片 ============================ */

.grid {
  display: grid;
  gap: 18px 16px;
}

.grid--cards {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.grid--rel {
  grid-template-columns: repeat(5, minmax(0, 1fr));
}

.card {
  display: block;
  min-width: 0;
  text-align: center;
}

.card-cover {
  position: relative;
  display: block;
  aspect-ratio: 16 / 10;
  overflow: hidden;
  background: #d6d8dc;
  border-radius: 3px;
  border: 1px solid #e3e5e9;
}

.card-cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.5s cubic-bezier(0.16, 1, 0.3, 1), filter 0.3s;
}

.card-cover::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(10, 11, 13, 0) 38%, rgba(10, 11, 13, 0.62) 100%);
  opacity: 0;
  transition: opacity 0.26s;
}

.card-play {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.92);
  color: var(--dark);
  transform: translate(-50%, -50%) scale(0.82);
  opacity: 0;
  transition: opacity 0.24s, transform 0.24s;
  z-index: 2;
}

.card-play svg {
  width: 15px;
  height: 15px;
}

.card-cat {
  position: absolute;
  top: 8px;
  left: 8px;
  z-index: 2;
  padding: 2px 7px;
  border-radius: 2px;
  background: rgba(13, 14, 16, 0.72);
  color: rgba(255, 255, 255, 0.92);
  font-size: 11px;
  letter-spacing: 0.04em;
}

.card-score {
  position: absolute;
  top: 8px;
  right: 8px;
  z-index: 2;
  font-size: 12px;
  font-weight: 600;
  color: #ffd9a0;
  text-shadow: 0 1px 6px rgba(0, 0, 0, 0.7);
  font-variant-numeric: tabular-nums;
}

.card:hover .card-cover img {
  transform: scale(1.055);
}

.card:hover .card-cover::after {
  opacity: 1;
}

.card:hover .card-play {
  opacity: 1;
  transform: translate(-50%, -50%) scale(1);
}

.card-title {
  margin: 10px 0 0;
  font-size: 14.5px;
  font-weight: 500;
  color: var(--ink);
  line-height: 1.4;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  transition: color 0.16s;
}

.card:hover .card-title {
  color: var(--accent);
}

.card-meta {
  margin-top: 3px;
  font-size: 12.5px;
  color: var(--ink-3);
  font-variant-numeric: tabular-nums;
}

.card-meta .dot {
  margin: 0 5px;
  color: #d3d6da;
}

/* 横向列表卡（侧栏推荐 / 搜索结果） */
.row {
  display: grid;
  grid-template-columns: 132px minmax(0, 1fr);
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--line-soft);
}

.row:last-child {
  border-bottom: 0;
}

.row-cover {
  position: relative;
  display: block;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  border-radius: 3px;
  background: #d6d8dc;
}

.row-cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.row-body {
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-width: 0;
}

.row-title {
  font-size: 14.5px;
  font-weight: 500;
  color: var(--ink);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  transition: color 0.16s;
}

.row:hover .row-title {
  color: var(--accent);
}

.row-desc {
  margin-top: 4px;
  font-size: 12.5px;
  color: var(--ink-3);
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

/* ============================ 分页 / 空态 ============================ */

.toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  padding: 14px 20px 0;
}

.chip {
  padding: 6px 13px;
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 13px;
  color: var(--ink-2);
  background: #fff;
  transition: all 0.16s;
  white-space: nowrap;
}

.chip:hover {
  border-color: #cfd3d8;
  color: var(--ink);
}

.chip.is-active {
  background: var(--dark);
  border-color: var(--dark);
  color: #fff;
}

.toolbar-right {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12.5px;
  color: var(--ink-3);
}

.empty {
  padding: 60px 20px;
  text-align: center;
  color: var(--ink-3);
}

.empty h3 {
  margin: 0 0 8px;
  font-size: 16px;
  color: var(--ink-2);
  font-weight: 500;
}

.empty p {
  margin: 0;
  font-size: 13.5px;
}

.pager {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 22px 0 4px;
}

.pager button {
  min-width: 34px;
  height: 34px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 3px;
  font-size: 13px;
  color: var(--ink-2);
  background: #fff;
  font-variant-numeric: tabular-nums;
}

.pager button:hover:not(:disabled) {
  border-color: #cfd3d8;
  color: var(--ink);
}

.pager button.is-active {
  background: var(--dark);
  border-color: var(--dark);
  color: #fff;
}

.pager button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

/* ============================ 详情页 ============================ */

/* 详情页：大标题 + 播放器 + 时间 / 播放量 + 相关视频 */

.watch-panel {
  overflow: hidden;
}

.watch-head {
  padding: 20px 22px 16px;
}

.watch-title {
  margin: 0;
  font-size: 26px;
  line-height: 1.34;
  font-weight: 600;
  letter-spacing: 0.01em;
}

.watch-panel .nx-player {
  border-radius: 0;
}

.watch-meta {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 10px 16px;
  padding: 11px 22px;
  border-top: 1px solid var(--line);
  background: #fcfcfd;
  font-size: 13px;
  color: var(--ink-3);
}

.watch-time {
  white-space: nowrap;
}

.watch-plays {
  color: var(--accent);
  font-weight: 500;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

/* 线路切换收成纯文字链接，不跟「时间 / 播放量」抢视线 */
.watch-meta .line-list {
  justify-content: center;
  gap: 14px;
}

.watch-meta .line-btn {
  padding: 2px 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: var(--ink-3);
  font-size: 12.5px;
  line-height: 1.7;
}

.watch-meta .line-btn:hover {
  border-color: transparent;
  color: var(--ink);
}

.watch-meta .line-btn.is-active {
  background: transparent;
  border-bottom: 1px solid var(--accent);
}

.line-btn {
  padding: 7px 14px;
  border: 1px solid var(--line);
  border-radius: 3px;
  font-size: 13px;
  color: var(--ink-2);
  background: #fff;
  white-space: nowrap;
}

.line-btn:hover {
  border-color: #cfd3d8;
}

.line-btn.is-active {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-soft);
  font-weight: 500;
}

/* ============================ 页脚 ============================ */

.site-footer {
  background: var(--dark);
  color: rgba(255, 255, 255, 0.5);
  padding: 26px 0 30px;
  font-size: 12.5px;
}

.footer-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 22px;
}

.footer-brand {
  color: rgba(255, 255, 255, 0.82);
  font-weight: 600;
  letter-spacing: 0.14em;
  font-size: 13.5px;
}

.footer-links {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  margin-left: auto;
}

.footer-links a:hover {
  color: #fff;
}

.footer-note {
  margin-top: 12px;
  line-height: 1.8;
  color: rgba(255, 255, 255, 0.34);
}

/* ============================ 抽屉菜单 ============================ */

.drawer {
  position: fixed;
  inset: 0;
  z-index: 1200;
  display: none;
}

.drawer.is-open {
  display: block;
}

.drawer-mask {
  position: absolute;
  inset: 0;
  background: rgba(8, 9, 11, 0.52);
  opacity: 0;
  transition: opacity 0.24s;
}

.drawer-panel {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  width: min(78vw, 320px);
  background: var(--dark);
  color: #fff;
  padding: 20px 0 30px;
  overflow-y: auto;
  transform: translateX(100%);
  transition: transform 0.28s cubic-bezier(0.22, 1, 0.36, 1);
}

.drawer.is-visible .drawer-mask {
  opacity: 1;
}

.drawer.is-visible .drawer-panel {
  transform: translateX(0);
}

.drawer-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 18px 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.drawer-head h3 {
  margin: 0;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 0.08em;
}

.drawer-close {
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  border-radius: 3px;
  color: rgba(255, 255, 255, 0.6);
}

.drawer-close:hover {
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
}

.drawer-search {
  padding: 16px 18px;
  display: flex;
  gap: 8px;
}

.drawer-search input {
  flex: 1;
  min-width: 0;
  height: 38px;
  padding: 0 12px;
  border-radius: 3px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.06);
  color: #fff;
  font-size: 13.5px;
  outline: none;
}

.drawer-search button {
  height: 38px;
  padding: 0 14px;
  border-radius: 3px;
  background: var(--accent);
  color: #fff;
  font-size: 13.5px;
}

.drawer-links {
  padding: 4px 0 0;
}

.drawer-links a {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 13px 18px;
  font-size: 14.5px;
  color: rgba(255, 255, 255, 0.72);
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.drawer-links a:hover {
  background: rgba(255, 255, 255, 0.05);
  color: #fff;
}

.drawer-links a .count {
  font-size: 12px;
  color: rgba(255, 255, 255, 0.36);
}

.drawer-links a.is-active {
  color: #fff;
  box-shadow: inset 3px 0 0 var(--accent);
  background: rgba(255, 255, 255, 0.06);
}

/* ============================ 响应式 ============================ */

@media (max-width: 1024px) {
  .page {
    grid-template-columns: minmax(0, 1fr);
    gap: 16px;
    padding-top: 16px;
  }

  .sidebar {
    position: static;
    border-radius: var(--radius);
  }

  .sidebar-head {
    display: none;
  }

  .sidebar-list {
    display: flex;
    gap: 0;
    overflow-x: auto;
    scrollbar-width: none;
  }

  .sidebar-list::-webkit-scrollbar {
    display: none;
  }

  .sidebar-list a {
    flex: 0 0 auto;
    border-bottom: 0;
    border-right: 1px solid var(--line-soft);
    padding: 13px 18px;
    font-size: 14px;
    white-space: nowrap;
  }

  .sidebar-list a .count {
    display: none;
  }

  .sidebar-list a.is-active {
    box-shadow: inset 0 -2px 0 var(--accent);
  }

  .sidebar-foot {
    display: none;
  }

  /* 分类页顶部的分类 chips 与目录条重复，小屏收起目录条，避免两排一样的分类按钮 */
  body[data-page="browse"] .sidebar {
    display: none;
  }

  .grid--rel {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

}

@media (max-width: 900px) {
  :root {
    --header-h: 58px;
    --nav-h: 0px;
  }

  .nav-bar {
    display: none;
  }

  .search-form {
    width: 220px;
  }

  .grid--cards {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .grid--rel {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .panel-body {
    padding: 15px 14px 16px;
  }

  .panel-head {
    padding: 14px 14px 12px;
  }

  .toolbar {
    padding: 12px 14px 0;
  }
}

@media (max-width: 600px) {
  .wrap {
    padding: 0 12px;
  }

  .header-bar {
    gap: 10px;
  }

  .brand {
    font-size: 17px;
    letter-spacing: 0.1em;
  }

  .brand::after {
    font-size: 9.5px;
  }

  .search-form {
    width: 100%;
    max-width: none;
  }

  .menu-btn {
    width: 42px;
    height: 42px;
    flex: 0 0 auto;
  }

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

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

  .watch-head {
    padding: 16px 16px 13px;
  }

  .watch-title {
    font-size: 19px;
  }

  .watch-meta {
    grid-template-columns: 1fr auto;
    padding: 10px 16px;
  }

  .watch-time {
    grid-column: 1;
    grid-row: 1;
  }

  .watch-plays {
    grid-column: 2;
    grid-row: 1;
    text-align: right;
  }

  .watch-meta .line-list {
    grid-column: 1 / -1;
    grid-row: 2;
    justify-content: flex-start;
  }

  .card-title {
    font-size: 13.5px;
  }

  .card-meta {
    font-size: 12px;
  }

  .row {
    grid-template-columns: 108px minmax(0, 1fr);
  }

  .watch {
    padding-top: 14px;
  }

  .footer-links {
    margin-left: 0;
  }
}

@media (max-width: 380px) {
  .grid--cards {
    gap: 12px 10px;
  }
}

/* ============================ 补充组件 ============================ */

.chip-group {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.toolbar--tight {
  padding-top: 8px;
}

.toolbar-label {
  font-size: 12.5px;
  color: var(--ink-3);
  align-self: center;
}

.line-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.001ms !important;
    transition-duration: 0.001ms !important;
  }
}
