/* hao-clone: single shared stylesheet, mobile-first, dark video-site theme. */
* { box-sizing: border-box; margin: 0; padding: 0; }
:root {
  --bg: #141414;
  --bg2: #1f1f1f;
  --card: #222;
  --text: #eee;
  --muted: #999;
  --accent: #e50914;
  --accent2: #ff5c5c;
  --border: #333;
}
html { -webkit-text-size-adjust: 100%; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  font-size: 14px;
  line-height: 1.5;
  min-height: 100vh;
}
a { color: var(--text); text-decoration: none; }
a:hover { color: var(--accent2); }
img { display: block; max-width: 100%; }

/* ---- header / nav ----
   手机端两行：第一行 logo + 放大镜，第二行导航横滑（右缘渐隐提示可滑）。
   桌面端恢复单行：logo | 导航 | 搜索框。 */
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: rgba(20, 20, 20, .97);
  border-bottom: 1px solid var(--border);
}
.header-inner {
  max-width: 1200px; margin: 0 auto; padding: 8px 12px;
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
}
.logo { font-size: 20px; font-weight: 700; color: var(--accent2); white-space: nowrap; }
.logo span { color: var(--text); font-weight: 400; font-size: 13px; }
.search-toggle {
  display: flex; align-items: center; justify-content: center;
  width: 36px; height: 36px; margin-left: auto; flex: 0 0 auto;
  border: none; border-radius: 50%; background: transparent; color: var(--text);
  cursor: pointer;
}
.search-toggle svg { width: 20px; height: 20px; }
.search-toggle:active { background: var(--bg2); }
.main-nav {
  display: flex; gap: 2px; overflow-x: auto; scrollbar-width: none;
  flex: 1 1 100%; order: 2;
  -webkit-mask-image: linear-gradient(to right, #000 90%, transparent 100%);
  mask-image: linear-gradient(to right, #000 90%, transparent 100%);
}
.main-nav::-webkit-scrollbar { display: none; }
.main-nav a {
  padding: 8px 12px; border-radius: 16px; white-space: nowrap; font-size: 14px;
}
.main-nav a.active { background: var(--accent); color: #fff; }
.main-nav a:hover { color: var(--accent2); }
.main-nav a.active:hover { color: #fff; }
/* 搜索框：手机端默认收起，点放大镜展开成整行；桌面端常驻 */
.search-form { display: none; flex: 1 1 100%; order: 3; margin-left: 0; }
.site-header.search-open .search-form { display: flex; }
.search-form input {
  flex: 1; min-width: 0; padding: 7px 10px; border: 1px solid var(--border);
  border-right: none; border-radius: 6px 0 0 6px; background: var(--bg2); color: var(--text);
  font-size: 14px; outline: none;
}
.search-form input:focus { border-color: var(--accent); }
.search-form button[type="submit"] {
  padding: 7px 14px; border: 1px solid var(--accent);
  background: var(--accent); color: #fff; font-size: 14px; cursor: pointer;
  border-radius: 0; /* 右边还有 × 关闭按钮时不圆角；桌面端隐藏 × 后在媒体查询里恢复圆角 */
}
.search-close {
  padding: 7px 12px; border: 1px solid var(--border); border-left: none;
  border-radius: 0 6px 6px 0; background: var(--bg2); color: var(--muted);
  font-size: 16px; cursor: pointer;
}
@media (min-width: 768px) {
  .header-inner { flex-wrap: nowrap; gap: 12px; }
  .search-toggle { display: none; }
  .main-nav { flex: 1; order: 0; -webkit-mask-image: none; mask-image: none; }
  .search-form { display: flex; flex: 0 1 260px; order: 0; }
  .search-close { display: none; }
  .search-form button[type="submit"] { border-radius: 0 6px 6px 0; }
}

/* ---- layout ---- */
.container { max-width: 1200px; margin: 0 auto; padding: 12px; }
.section { margin-bottom: 24px; }
.section-head {
  display: flex; align-items: baseline; justify-content: space-between;
  border-left: 3px solid var(--accent); padding-left: 10px; margin-bottom: 10px;
}
.section-head h2 { font-size: 17px; }
.section-head a { color: var(--muted); font-size: 13px; }
.section-head a:hover { color: var(--accent2); }

/* ---- video grid / cards ---- */
.grid {
  display: grid; gap: 12px;
  grid-template-columns: repeat(2, 1fr);
}
@media (min-width: 640px) { .grid { grid-template-columns: repeat(3, 1fr); } }
@media (min-width: 900px) { .grid { grid-template-columns: repeat(4, 1fr); } }
@media (min-width: 1200px) { .grid { grid-template-columns: repeat(6, 1fr); } }
.card { background: var(--card); border-radius: 8px; overflow: hidden; }
.card a { display: block; }
.thumb { position: relative; aspect-ratio: 16 / 9; background: #000; overflow: hidden; }
.thumb img { width: 100%; height: 100%; object-fit: cover; }
.thumb .dur {
  position: absolute; right: 6px; bottom: 6px;
  background: rgba(0, 0, 0, .75); color: #fff; font-size: 11px;
  padding: 1px 5px; border-radius: 4px;
}
.card-body { padding: 8px 9px 10px; }
.card-title {
  font-size: 13px; line-height: 1.35; height: 2.7em; overflow: hidden;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
}
.card-meta { color: var(--muted); font-size: 12px; margin-top: 4px; }
.empty, .status { color: var(--muted); padding: 28px 12px; text-align: center; }
.error { color: var(--accent2); padding: 28px 12px; text-align: center; }
.error small { display: block; color: var(--muted); margin-top: 6px; }

/* ---- tab bar ---- */
.tabbar { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; margin-bottom: 12px; padding-bottom: 2px; }
.tabbar::-webkit-scrollbar { display: none; }
.tabbar a {
  padding: 5px 12px; border-radius: 16px; background: var(--bg2); white-space: nowrap; font-size: 13px;
}
.tabbar a.active { background: var(--accent); color: #fff; }

/* ---- pagination ---- */
.pager { display: flex; gap: 8px; justify-content: center; margin: 18px 0 6px; flex-wrap: wrap; }
.pager a, .pager span {
  padding: 6px 12px; border-radius: 6px; background: var(--bg2); font-size: 13px;
}
.pager a:hover { color: var(--accent2); }
.pager .current { background: var(--accent); color: #fff; }
.pager .disabled { opacity: .4; pointer-events: none; }
.load-more-wrap { text-align: center; margin: 20px 0 8px; }
.load-more {
  display: inline-block; padding: 10px 28px; border: 1px solid var(--border);
  border-radius: 20px; background: var(--bg2); color: var(--text);
  font-size: 14px; cursor: pointer;
}
.load-more:disabled { opacity: .6; cursor: default; }

/* ---- player page ---- */
.player-wrap {
  position: relative; background: #000; border-radius: 8px; overflow: hidden;
  aspect-ratio: 16 / 9; max-width: 960px; margin: 0 auto;
}
.player-wrap video { width: 100%; height: 100%; object-fit: contain; background: #000; }
.big-play {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  background: rgba(0, 0, 0, .35); border: none; cursor: pointer; width: 100%;
}
.big-play .btn {
  width: 72px; height: 72px; border-radius: 50%; background: rgba(229, 9, 20, .9);
  color: #fff; font-size: 28px; display: flex; align-items: center; justify-content: center;
}
.player-title { font-size: 17px; margin: 12px 0 4px; }
.player-meta { color: var(--muted); font-size: 13px; margin-bottom: 18px; }
.player-error { color: var(--accent2); text-align: center; padding: 16px 0; }

/* ---- search page ---- */
.hot { margin: 6px 0 16px; color: var(--muted); font-size: 13px; }
.hot a {
  display: inline-block; margin: 3px 4px 0 0; padding: 3px 10px;
  background: var(--bg2); border-radius: 14px; font-size: 13px;
}
.search-count { color: var(--muted); font-size: 13px; margin-bottom: 10px; }

/* ---- shorts feed (TikTok-style vertical swipe, melonshort only) ---- */
.shorts-page { overflow: hidden; background: #000; }
.shorts-feed {
  height: 100vh; height: 100dvh;
  overflow-y: auto; overflow-x: hidden;
  scroll-snap-type: y mandatory;
  scrollbar-width: none;
  overscroll-behavior: contain;
}
.shorts-feed::-webkit-scrollbar { display: none; }
.shorts-status {
  height: 100vh; height: 100dvh;
  display: flex; align-items: center; justify-content: center;
  color: var(--muted); text-align: center; padding: 20px;
}
.short-slide {
  position: relative;
  height: 100vh; height: 100dvh;
  scroll-snap-align: start; scroll-snap-stop: always;
  background: #000; overflow: hidden;
}
.short-bg {
  position: absolute; inset: -5%;
  width: 110%; height: 110%; object-fit: cover;
  filter: blur(18px) brightness(.45);
}
.short-stage { position: absolute; inset: 0; }
.short-stage video {
  width: 100%; height: 100%; object-fit: contain; background: transparent;
}
.short-tap { position: absolute; inset: 0; z-index: 2; cursor: pointer; }
.short-info {
  position: absolute; left: 0; right: 64px; bottom: 0; z-index: 3;
  padding: 16px 14px 26px;
  background: linear-gradient(transparent, rgba(0, 0, 0, .72));
  pointer-events: none;
}
.short-info .short-sound { pointer-events: auto; }
.short-author { font-size: 14px; font-weight: 700; margin-bottom: 4px; }
.short-title {
  font-size: 14px; line-height: 1.4;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.short-meta { color: #bbb; font-size: 12px; margin-top: 4px; }
.short-sound {
  margin-top: 8px; padding: 4px 10px; border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, .5); background: rgba(0, 0, 0, .45);
  color: #fff; font-size: 12px; cursor: pointer;
}
.short-progress {
  position: absolute; left: 0; right: 0; bottom: 0; z-index: 4;
  height: 14px; cursor: pointer;
  display: flex; align-items: flex-end;
}
.short-progress-fill {
  height: 3px; width: 0;
  background: var(--accent2);
}
.short-bigplay {
  position: absolute; inset: 0; z-index: 2;
  display: flex; align-items: center; justify-content: center;
  pointer-events: none;
}
.short-bigplay span {
  width: 64px; height: 64px; border-radius: 50%;
  background: rgba(0, 0, 0, .55); color: #fff; font-size: 24px;
  display: flex; align-items: center; justify-content: center;
}
.short-error {
  position: absolute; left: 0; right: 0; top: 45%; z-index: 5;
  text-align: center; color: #ffb3b3; font-size: 14px;
  text-shadow: 0 1px 4px rgba(0, 0, 0, .8);
}
.shorts-topbar {
  position: fixed; top: 0; left: 0; right: 0; z-index: 20;
  display: flex; align-items: center; gap: 10px;
  padding: calc(8px + env(safe-area-inset-top, 0px)) 12px 8px;
  background: linear-gradient(rgba(0, 0, 0, .55), transparent);
  pointer-events: none;
}
.shorts-topbar .shorts-topbtn { pointer-events: auto; }
.shorts-topbtn {
  min-width: 34px; height: 34px; padding: 0 10px; border-radius: 17px;
  border: 1px solid rgba(255, 255, 255, .35); background: rgba(0, 0, 0, .45);
  color: #fff; font-size: 16px; cursor: pointer;
}
.shorts-title { font-size: 15px; font-weight: 700; text-shadow: 0 1px 4px rgba(0, 0, 0, .8); }
.shorts-pos { color: #ccc; font-size: 12px; text-shadow: 0 1px 4px rgba(0, 0, 0, .8); }
.shorts-rail {
  position: fixed; right: 10px; top: 50%; transform: translateY(-50%); z-index: 20;
  display: flex; flex-direction: column; gap: 10px;
}
.shorts-railbtn {
  width: 44px; height: 44px; border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, .35); background: rgba(0, 0, 0, .5);
  color: #fff; font-size: 15px; cursor: pointer;
}
.shorts-toast {
  position: fixed; left: 50%; bottom: 64px; transform: translateX(-50%); z-index: 30;
  padding: 8px 16px; border-radius: 18px; background: rgba(0, 0, 0, .75);
  color: #fff; font-size: 13px; white-space: nowrap;
}
.short-endcap { display: flex; align-items: center; justify-content: center; }
.short-end { text-align: center; }
.short-end-title { font-size: 18px; margin-bottom: 18px; }
.short-endbtn {
  display: block; margin: 10px auto; padding: 10px 22px; border-radius: 20px;
  border: 1px solid var(--accent); background: var(--accent); color: #fff;
  font-size: 14px; cursor: pointer;
}
.short-endbtn:last-child { background: transparent; border-color: rgba(255, 255, 255, .4); }
