/* ============ 全局样式 ============ */
:root {
  --primary: #00aeec;        /* B站蓝 */
  --pink: #fb7299;           /* B站粉 */
  --bg: #f1f2f3;
  --card-bg: #fff;
  --text: #18191c;
  --text-2: #61666d;
  --text-3: #9499a0;
  --border: #e3e5e7;
  --hover-bg: #f6f7f8;
  --success: #198754;
  --warning: #ffc107;
  --danger: #dc3545;
  --radius: 8px;
  --shadow: 0 1px 4px rgba(0, 0, 0, .06);
  --nav-h: 56px;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
a { color: var(--primary); text-decoration: none; }
a:hover { color: #00a1d6; }
img { max-width: 100%; display: block; }
button { font-family: inherit; cursor: pointer; }
input, select, textarea { font-family: inherit; font-size: 14px; }

.container { width: 100%; max-width: 1240px; margin: 0 auto; padding: 0 16px; }
.hidden { display: none !important; }

/* ============ 顶部导航 ============ */
.top-nav {
  position: sticky; top: 0; z-index: 100;
  background: #fff;
  border-bottom: 1px solid var(--border);
}
.nav-main {
  height: var(--nav-h);
  display: flex;
  align-items: center;
  gap: 18px;
  position: relative;
}
.logo { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.logo-icon {
  width: 34px; height: 34px;
  background: linear-gradient(135deg, var(--pink), #ff9d5c);
  border-radius: 9px;
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-size: 18px; font-weight: 800;
}
.logo-text { font-size: 19px; font-weight: 800; color: var(--text); letter-spacing: .5px; }
.logo-text em { font-style: normal; color: var(--primary); }

.nav-links { display: flex; align-items: center; gap: 2px; flex-shrink: 0; }
.nav-links a {
  padding: 6px 12px; border-radius: 6px; color: var(--text);
  font-size: 14px; font-weight: 500;
}
.nav-links a:hover { background: var(--hover-bg); color: var(--primary); }
.nav-links a.active { color: var(--primary); font-weight: 600; }
.nav-links a.pink { color: var(--pink); }

.nav-search {
  flex: 1; max-width: 420px; margin-left: auto;
  display: flex; align-items: center;
  height: 36px;
  background: var(--bg);
  border: 1px solid transparent;
  border-radius: 18px;
  padding: 0 6px 0 16px;
  transition: all .2s;
}
.nav-search:focus-within { background: #fff; border-color: var(--primary); box-shadow: 0 0 0 2px rgba(0,174,236,.12); }
.nav-search input {
  flex: 1; border: none; outline: none; background: transparent; font-size: 14px;
}
.nav-search button {
  width: 64px; height: 28px; border: none; border-radius: 14px;
  background: var(--primary); color: #fff; font-size: 13px; flex-shrink: 0;
}
.nav-search button:hover { background: #00a1d6; }

.nav-actions { display: flex; align-items: center; gap: 10px; flex-shrink: 0; }
.btn-publish {
  background: var(--pink); color: #fff; border: none;
  height: 32px; padding: 0 16px; border-radius: 6px;
  font-size: 14px; font-weight: 600;
  display: inline-flex; align-items: center; gap: 5px;
}
.btn-publish:hover { background: #f0608a; color: #fff; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; border: 1px solid var(--border); background: #fff; color: var(--text); border-radius: 6px; height: 34px; padding: 0 16px; font-size: 14px; transition: all .15s; }
.btn:hover { border-color: var(--primary); color: var(--primary); }
.btn-primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn-primary:hover { background: #00a1d6; color: #fff; }
.btn-pink { background: var(--pink); border-color: var(--pink); color: #fff; }
.btn-pink:hover { background: #f0608a; color: #fff; }
.btn-danger { color: var(--danger); border-color: #f0c4cc; }
.btn-danger:hover { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn-sm { height: 28px; padding: 0 12px; font-size: 13px; border-radius: 5px; }
.btn-block { width: 100%; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }

/* 用户菜单 */
.user-menu { position: relative; }
.user-trigger { display: flex; align-items: center; gap: 8px; cursor: pointer; padding: 4px 6px; border-radius: 8px; }
.user-trigger:hover { background: var(--hover-bg); }
.user-dropdown {
  position: absolute; right: 0; top: calc(100% + 8px);
  background: #fff; border: 1px solid var(--border); border-radius: 10px;
  box-shadow: 0 8px 24px rgba(0,0,0,.12);
  min-width: 180px; padding: 6px; display: none;
  z-index: 200;
}
.user-menu.open .user-dropdown { display: block; }
.user-dropdown .ud-name { padding: 10px 12px 6px; font-weight: 600; }
.user-dropdown .ud-role { padding: 0 12px 10px; font-size: 12px; color: var(--text-3); }
.user-dropdown a, .user-dropdown button {
  display: flex; align-items: center; gap: 8px; width: 100%;
  padding: 9px 12px; border: none; background: none; border-radius: 6px;
  color: var(--text); font-size: 14px; text-align: left;
}
.user-dropdown a:hover, .user-dropdown button:hover { background: var(--hover-bg); color: var(--primary); }
.user-dropdown .danger { color: var(--danger); }

/* 头像 */
.avatar {
  width: 34px; height: 34px; border-radius: 50%;
  background: linear-gradient(135deg, #6ec1f0, #9b7bf2);
  color: #fff; font-weight: 700;
  display: inline-flex; align-items: center; justify-content: center;
  flex-shrink: 0; overflow: hidden;
  font-size: 15px;
}
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.avatar.sm { width: 26px; height: 26px; font-size: 12px; }
.avatar.lg { width: 56px; height: 56px; font-size: 22px; }

/* 分类条 */
.cat-bar {
  background: #fff; border-bottom: 1px solid var(--border);
}
.cat-bar-inner { display: flex; align-items: center; gap: 4px; overflow-x: auto; padding: 8px 0; scrollbar-width: none; }
.cat-bar-inner::-webkit-scrollbar { display: none; }
.cat-bar-inner a {
  padding: 5px 14px; border-radius: 15px; color: var(--text-2);
  font-size: 14px; white-space: nowrap; flex-shrink: 0;
}
.cat-bar-inner a:hover { color: var(--primary); background: rgba(0,174,236,.08); }
.cat-bar-inner a.active { color: #fff; background: var(--primary); font-weight: 600; }
.cat-bar-inner .cat-all { color: var(--pink); font-weight: 600; }

/* ============ 卡片网格 ============ */
.video-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 18px 14px;
}
@media (max-width: 1200px) { .video-grid { grid-template-columns: repeat(4, 1fr); } }
@media (max-width: 900px) { .video-grid { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 600px) { .video-grid { grid-template-columns: repeat(2, 1fr); gap: 12px 10px; } }

.v-card { cursor: pointer; }
.v-cover {
  position: relative; border-radius: 8px; overflow: hidden;
  aspect-ratio: 16/9; background: #e8eaec;
}
.v-cover img { width: 100%; height: 100%; object-fit: cover; transition: transform .3s; }
.v-card:hover .v-cover img { transform: scale(1.06); }
.v-duration {
  position: absolute; right: 6px; bottom: 6px;
  background: rgba(0,0,0,.72); color: #fff;
  font-size: 12px; padding: 1px 7px; border-radius: 4px;
}
.v-badge {
  position: absolute; left: 6px; top: 6px;
  background: var(--pink); color: #fff; font-size: 11px;
  padding: 1px 7px; border-radius: 4px;
}
.v-title {
  margin-top: 8px; font-size: 14px; font-weight: 600; color: var(--text);
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
  overflow: hidden; line-height: 1.45; min-height: 40px;
}
.v-card:hover .v-title { color: var(--primary); }
.v-meta { margin-top: 5px; font-size: 12px; color: var(--text-3); display: flex; gap: 10px; flex-wrap: wrap; }
.v-author { display: flex; align-items: center; gap: 6px; margin-top: 7px; font-size: 12px; color: var(--text-2); }
.v-author .avatar { width: 22px; height: 22px; font-size: 11px; }
.v-author span.name { max-width: 120px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.v-author span.time { margin-left: auto; color: var(--text-3); flex-shrink: 0; }

/* ============ 底部 ============ */
footer {
  margin-top: auto;
  background: #fff; border-top: 1px solid var(--border);
  padding: 32px 16px 40px; text-align: center;
  color: var(--text-3); font-size: 13px;
}
footer .f-links { margin-bottom: 12px; display: flex; justify-content: center; gap: 22px; flex-wrap: wrap; }
footer .f-links a { color: var(--text-2); }
footer .f-links a:hover { color: var(--primary); }

/* ============ 表单 ============ */
.form-card {
  background: #fff; border-radius: 12px; box-shadow: var(--shadow);
  padding: 36px 32px; max-width: 420px; margin: 40px auto;
}
.form-card h1 { font-size: 22px; margin-bottom: 6px; }
.form-card .sub { color: var(--text-3); margin-bottom: 24px; font-size: 13px; }
.field { margin-bottom: 18px; }
.field label { display: block; margin-bottom: 7px; font-size: 14px; color: var(--text-2); font-weight: 500; }
.field input[type="text"], .field input[type="password"], .field input[type="email"], .field input[type="url"], .field select, .field textarea {
  width: 100%; height: 40px; border: 1px solid var(--border); border-radius: 8px;
  padding: 0 12px; outline: none; transition: border .15s, box-shadow .15s;
  background: #fff; color: var(--text);
}
.field textarea { height: auto; padding: 10px 12px; resize: vertical; }
.field input:focus, .field select:focus, .field textarea:focus {
  border-color: var(--primary); box-shadow: 0 0 0 3px rgba(0,174,236,.12);
}
.field .hint { font-size: 12px; color: var(--text-3); margin-top: 5px; }
.form-foot { text-align: center; margin-top: 16px; font-size: 13px; color: var(--text-3); }
.alert {
  padding: 10px 14px; border-radius: 8px; margin-bottom: 16px; font-size: 13px;
}
.alert-error { background: #fdecea; color: #c0392b; }
.alert-success { background: #e6f6ec; color: var(--success); }
.alert-info { background: #e8f6fd; color: #0a7fb5; }

/* ============ 通用区块 ============ */
.section-head {
  display: flex; align-items: center; gap: 12px;
  margin: 26px 0 16px;
}
.section-head h2 { font-size: 18px; font-weight: 700; }
.section-head .bar { width: 4px; height: 18px; border-radius: 2px; background: var(--pink); }
.section-head .more { margin-left: auto; font-size: 13px; color: var(--text-3); }
.section-head .tabs { margin-left: auto; display: flex; gap: 6px; }
.section-head .tabs button {
  border: none; background: none; font-size: 14px; color: var(--text-2);
  padding: 4px 12px; border-radius: 15px;
}
.section-head .tabs button.active { background: rgba(0,174,236,.1); color: var(--primary); font-weight: 600; }

.empty-state { text-align: center; padding: 60px 20px; color: var(--text-3); }
.empty-state .icon { font-size: 44px; margin-bottom: 12px; }

.load-more { text-align: center; margin: 30px 0; }
.load-more .btn { width: 240px; }

/* 面包屑 */
.crumb { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--text-3); margin: 18px 0 6px; }
.crumb a { color: var(--text-2); }
.crumb a:hover { color: var(--primary); }

/* 标签 */
.tag {
  display: inline-block; background: rgba(0,174,236,.08); color: var(--primary);
  font-size: 12px; padding: 3px 10px; border-radius: 4px; margin: 0 6px 6px 0;
}
.tag:hover { background: rgba(0,174,236,.16); color: var(--primary); }

/* ============ 平板适配（541-900px） ============ */
@media (max-width: 900px) {
  .nav-links { display: none; }
  .nav-search { flex: 1; min-width: 0; }
}

/* ============ 移动端适配（仅手机宽度 <=540px） ============ */
@media (max-width: 540px) {
  .container { padding: 0 12px; }
  .nav-main { gap: 8px; height: 52px; flex-wrap: nowrap; }
  .nav-links { display: none; }
  .logo { flex-shrink: 0; }
  .logo-text { font-size: 15px; }
  .logo-icon { width: 28px; height: 28px; font-size: 15px; border-radius: 6px; }
  .nav-search { flex: 1; min-width: 0; height: 32px; padding: 0 4px 0 12px; margin: 0; }
  .nav-search input { font-size: 13px; min-width: 0; }
  .nav-search button { width: 40px; height: 24px; font-size: 12px; padding: 0; }
  .nav-actions { gap: 6px; flex-shrink: 0; }
  .btn-publish { height: 30px; padding: 0 9px; font-size: 14px; border-radius: 6px; }
  .btn-publish .pub-text { display: none; }
  .btn-login { height: 30px; padding: 0 12px; font-size: 13px; border-radius: 6px; }
  .btn-register { display: none; }
  .user-trigger { padding: 2px 4px; }
  .user-trigger .uname { display: none; }
  .user-trigger .avatar { width: 28px; height: 28px; font-size: 13px; }
  .cat-bar-inner a { padding: 5px 12px; font-size: 13px; }
  .section-head { margin: 18px 0 12px; }
  .section-head h2 { font-size: 16px; }
  .form-card { padding: 24px 18px; margin: 20px auto; }
  footer { padding: 24px 12px 30px; }
  footer .f-links { gap: 14px; }
}

@media (max-width: 400px) {
  .container { padding: 0 10px; }
  .nav-main { gap: 6px; height: 48px; }
  .logo-text { font-size: 14px; }
  .logo-icon { width: 26px; height: 26px; font-size: 14px; }
  .nav-search { height: 30px; padding: 0 2px 0 10px; }
  .nav-search input { font-size: 12px; }
  .nav-search input::placeholder { font-size: 12px; }
  .nav-search button { width: 36px; height: 22px; font-size: 11px; }
  .btn-publish { height: 28px; padding: 0 8px; font-size: 13px; }
  .btn-login { height: 28px; padding: 0 10px; font-size: 12px; }
  .video-grid { gap: 10px 8px; }
  .v-title { font-size: 13px; min-height: 36px; }
  .v-meta { font-size: 11px; gap: 6px; }
  .v-author { font-size: 11px; }
  .load-more .btn { width: 100%; }
}

/* 滚动条 */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-thumb { background: #c8ccd1; border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: #a8adb3; }
