:root {
  --brand: #4C46D1;
  --brand-hover: #3f39c4;
  --brand-soft: #e4e1ff;
  --bg: #12121a;
  --bg-2: #1a1a24;
  --surface: rgba(26, 26, 36, .55);
  --surface-solid: #1e1e2a;
  --border: rgba(255, 255, 255, .10);
  --text: #e8e6f0;
  --text-2: #a8a5b8;
  --text-3: #6f6c80;
  --radius: 12px;
  --wrap: 1240px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "PingFang SC", "Microsoft YaHei", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 14px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }
img { display: block; max-width: 100%; }
.muted { color: var(--text-3); }
.dot { color: var(--text-3); margin: 0 6px; }

.bg-glow {
  position: fixed;
  inset: 0;
  z-index: -2;
  background:
    radial-gradient(900px 500px at 18% -8%, rgba(76, 70, 209, .28), transparent 62%),
    radial-gradient(760px 460px at 88% 4%, rgba(126, 87, 194, .20), transparent 60%),
    radial-gradient(680px 520px at 50% 108%, rgba(38, 78, 140, .18), transparent 62%);
}

.wrap { max-width: var(--wrap); margin: 0 auto; padding: 0 20px; }

/* 顶栏 */
.topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(18, 18, 26, .72);
  backdrop-filter: blur(16px) saturate(1.3);
  -webkit-backdrop-filter: blur(16px) saturate(1.3);
  border-bottom: 1px solid var(--border);
}
.topbar-inner { display: flex; align-items: center; gap: 26px; height: 60px; }
.brand { display: flex; align-items: baseline; gap: 8px; }
.brand-mark {
  width: 16px; height: 14px; align-self: center; border-radius: 50% 50% 45% 45%;
  background: var(--brand); position: relative;
}
.brand-mark::before, .brand-mark::after {
  content: ""; position: absolute; top: -6px; width: 6px; height: 8px;
  background: var(--brand); border-radius: 50% 50% 0 0;
}
.brand-mark::before { left: 0; transform: rotate(-18deg); }
.brand-mark::after { right: 0; transform: rotate(18deg); }
.brand-name { font-size: 17px; font-weight: 600; letter-spacing: .04em; }
.brand-sub { font-size: 11px; color: var(--text-3); letter-spacing: .22em; }
.nav { display: flex; gap: 18px; font-size: 13px; color: var(--text-2); }
.nav a:hover { color: var(--text); }
.btn-upload {
  padding: 5px 13px; border-radius: 999px; border: 1px solid rgba(255,255,255,.16);
  color: var(--text); transition: .15s;
}
.btn-upload:hover { background: rgba(255,255,255,.07); }
.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 14px; font-size: 13px; }
.avatar-link { display: flex; align-items: center; gap: 8px; }
.uname { color: var(--text-2); }
.link-muted { color: var(--text-3); }
.link-muted:hover { color: var(--text); }
.online { font-size: 12px; color: var(--text-3); }

.avatar { width: 26px; height: 26px; border-radius: 50%; object-fit: cover; }
.avatar-text {
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--brand); color: #fff; font-size: 12px; font-weight: 500;
}
.mini-avatar { width: 22px; height: 22px; border-radius: 50%; object-fit: cover; flex: none; }
.avatar-lg { width: 48px; height: 48px; border-radius: 50%; object-fit: cover; }
.avatar-xl { width: 84px; height: 84px; border-radius: 50%; object-fit: cover; }

.btn-login {
  padding: 6px 16px; border-radius: 999px; font-size: 13px;
  background: var(--brand); color: #fff; transition: .15s;
}
.btn-login:hover { background: var(--brand-hover); }
.btn-primary {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 9px 20px; border-radius: 10px; border: 0; cursor: pointer;
  background: var(--brand); color: #fff; font-size: 14px; transition: .15s;
}
.btn-primary:hover { background: var(--brand-hover); }
.btn-sm { padding: 6px 14px; font-size: 13px; }
.btn-lg { padding: 11px 26px; font-size: 15px; }

/* 首页 hero */
.main { padding: 26px 20px 60px; }
.hero { padding: 34px 0 22px; }
.hero-title {
  margin: 0; font-size: 40px; font-weight: 700; letter-spacing: .1em;
  background: linear-gradient(120deg, #fff 10%, #b9b3ff 60%, #8f86ff 100%);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.hero-desc { margin: 4px 0 20px; color: var(--text-2); letter-spacing: .3em; font-size: 13px; }
.search { display: flex; gap: 8px; max-width: 520px; }
.search input {
  flex: 1; padding: 9px 14px; border-radius: 10px; font-size: 14px;
  background: var(--surface); border: 1px solid var(--border); color: var(--text);
  backdrop-filter: blur(10px);
}
.search input:focus { outline: none; border-color: rgba(76,70,209,.6); }
.search button {
  padding: 9px 20px; border-radius: 10px; border: 0; cursor: pointer;
  background: var(--brand); color: #fff; font-size: 14px;
}
.search button:hover { background: var(--brand-hover); }

.channels { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 20px; }
.chip {
  padding: 5px 14px; border-radius: 999px; font-size: 13px; color: var(--text-2);
  background: var(--surface); border: 1px solid var(--border);
  backdrop-filter: blur(10px); transition: .15s;
}
.chip:hover { color: var(--text); border-color: rgba(255,255,255,.2); }
.chip-on { background: var(--brand); color: #fff; border-color: transparent; }
.chip-sep { width: 1px; height: 16px; background: var(--border); margin: 0 4px; }

/* 卡片网格 */
.grid {
  display: grid; gap: 18px;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
}
.grid-sm { grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); }
.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  overflow: hidden; backdrop-filter: blur(14px) saturate(1.2);
  transition: transform .16s ease, border-color .16s ease;
}
.card:hover { transform: translateY(-2px); border-color: rgba(255,255,255,.2); }
.thumb { position: relative; display: block; aspect-ratio: 16/10; background: #23232f; }
.thumb img { width: 100%; height: 100%; object-fit: cover; }
.thumb-fallback {
  display: flex; align-items: center; justify-content: center; height: 100%;
  color: var(--text-3); font-size: 13px; padding: 12px; text-align: center;
}
.duration {
  position: absolute; right: 8px; bottom: 8px; padding: 1px 7px; border-radius: 5px;
  background: rgba(0,0,0,.66); font-size: 12px; color: #fff;
}
.thumb-danmaku {
  position: absolute; left: 8px; bottom: 8px; padding: 1px 7px; border-radius: 5px;
  background: rgba(0,0,0,.5); font-size: 11px; color: #cfd3ff;
}
.card-body { padding: 12px 14px 14px; }
.card-title {
  display: block; font-size: 14px; font-weight: 500; line-height: 1.45;
  max-height: 2.9em; overflow: hidden; margin-bottom: 8px;
}
.card-title:hover { color: #b9b3ff; }
.card-meta { display: flex; align-items: center; gap: 7px; font-size: 12px; color: var(--text-3); margin-bottom: 6px; }
.card-author:hover { color: var(--text-2); }
.card-stats { display: flex; gap: 12px; font-size: 12px; color: var(--text-3); }

.empty { text-align: center; padding: 70px 20px; }
.empty-title { font-size: 18px; margin: 0 0 6px; }
.empty-desc { color: var(--text-3); margin: 0 0 20px; }

/* 播放页 */
.watch { max-width: 1000px; margin: 0 auto; }
.player-wrap {
  background: #000; border-radius: var(--radius); overflow: hidden;
  border: 1px solid var(--border);
}
.player-stage { position: relative; aspect-ratio: 16/9; background: #000; }
.player-stage video { width: 100%; height: 100%; display: block; }
.danmaku-canvas { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.player-center {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  pointer-events: none;
}
.big-play {
  width: 66px; height: 66px; border-radius: 50%; border: 0; cursor: pointer;
  background: rgba(20,20,28,.62); color: #fff; font-size: 24px; padding-left: 5px;
  backdrop-filter: blur(8px); transition: .15s; pointer-events: auto;
}
.big-play:hover { background: rgba(76,70,209,.82); }
.player-bar {
  display: flex; align-items: center; gap: 12px; padding: 10px 14px;
  background: rgba(20,20,28,.92);
}
.pb {
  border: 0; background: transparent; color: var(--text); cursor: pointer;
  font-size: 15px; padding: 2px 4px;
}
.pb:hover { color: #b9b3ff; }
.time { font-size: 12px; color: var(--text-2); min-width: 42px; text-align: center; }
.track { position: relative; flex: 1; height: 4px; background: rgba(255,255,255,.14); border-radius: 2px; cursor: pointer; }
.track-progress { position: absolute; left: 0; top: 0; height: 100%; width: 0; background: var(--brand); border-radius: 2px; }
.track-handle {
  position: absolute; top: 50%; left: 0; width: 11px; height: 11px; border-radius: 50%;
  background: #fff; transform: translate(-50%, -50%); opacity: 0; transition: opacity .15s;
}
.track:hover .track-handle { opacity: 1; }
.rate {
  background: rgba(255,255,255,.08); color: var(--text); border: 1px solid var(--border);
  border-radius: 6px; padding: 3px 6px; font-size: 12px;
}
.dm-toggle { font-size: 12px; color: var(--text-2); display: flex; align-items: center; gap: 4px; cursor: pointer; }

.watch-title { font-size: 20px; margin: 18px 0 6px; font-weight: 600; }
.watch-meta { color: var(--text-3); font-size: 12px; }
.watch-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin: 16px 0; }
.act {
  display: inline-flex; align-items: center; gap: 7px; cursor: pointer;
  padding: 8px 16px; border-radius: 999px; font-size: 13px;
  background: var(--surface); border: 1px solid var(--border); color: var(--text);
  backdrop-filter: blur(10px); transition: .15s;
}
.act:hover { border-color: rgba(255,255,255,.22); }
.act[data-active="true"] { background: var(--brand); border-color: transparent; color: #fff; }
.act-icon { font-size: 14px; }
.act-box { display: flex; gap: 8px; flex: 1; min-width: 240px; }
.act-box input {
  flex: 1; padding: 8px 14px; border-radius: 999px; font-size: 13px;
  background: var(--surface); border: 1px solid var(--border); color: var(--text);
}
.act-box input:focus { outline: none; border-color: rgba(76,70,209,.55); }

.desc {
  padding: 14px 16px; border-radius: var(--radius); font-size: 13px; color: var(--text-2);
  background: var(--surface); border: 1px solid var(--border); white-space: pre-wrap;
}
.up-card {
  display: flex; align-items: center; gap: 12px; margin: 18px 0;
  padding: 14px 16px; border-radius: var(--radius);
  background: var(--surface); border: 1px solid var(--border);
}
.up-name { font-weight: 500; }
.up-name:hover { color: #b9b3ff; }
.up-sub { display: block; font-size: 12px; color: var(--text-3); }

.section-title { font-size: 16px; font-weight: 600; margin: 26px 0 14px; }
.comment-form { display: flex; flex-direction: column; gap: 8px; margin-bottom: 18px; }
.comment-form textarea {
  width: 100%; padding: 10px 14px; border-radius: 10px; resize: vertical;
  background: var(--surface); border: 1px solid var(--border); color: var(--text);
  font-family: inherit; font-size: 13px;
}
.comment-form textarea:focus { outline: none; border-color: rgba(76,70,209,.55); }
.comment-form button { align-self: flex-end; }
.comment { display: flex; gap: 10px; padding: 12px 0; border-bottom: 1px solid rgba(255,255,255,.06); }
.comment-child { padding-left: 32px; }
.comment-main { flex: 1; min-width: 0; }
.comment-head { display: flex; gap: 8px; font-size: 12px; color: var(--text-3); }
.comment-head a { color: var(--text-2); }
.comment-text { margin: 4px 0 0; font-size: 13px; word-break: break-word; }
.related { margin-top: 12px; }

/* 个人主页 */
.profile { margin-bottom: 24px; }
.profile-head { display: flex; gap: 20px; align-items: center; }
.profile-name { margin: 0; font-size: 22px; font-weight: 600; }
.profile-handle { margin: 2px 0 8px; color: var(--text-3); font-size: 13px; }
.profile-bio { color: var(--text-2); font-size: 13px; margin: 0 0 10px; }
.profile-stats { display: flex; gap: 18px; font-size: 13px; color: var(--text-3); }
.profile-stats b { color: var(--text); font-weight: 600; }

/* 投稿 */
.publish { max-width: 640px; margin: 0 auto; }
.publish-form { display: flex; flex-direction: column; gap: 18px; }
.field { display: flex; flex-direction: column; gap: 7px; }
.field-label { font-size: 13px; color: var(--text-2); }
.field input[type="text"], .field textarea, .field select, .field input[type="file"] {
  padding: 10px 14px; border-radius: 10px; font-size: 14px; font-family: inherit;
  background: var(--surface); border: 1px solid var(--border); color: var(--text);
}
.field input:focus, .field textarea:focus, .field select:focus { outline: none; border-color: rgba(76,70,209,.55); }
.field textarea { resize: vertical; }
.hint { font-size: 12px; color: var(--text-3); }
.publish-actions { display: flex; align-items: center; gap: 14px; }
.publish-status { font-size: 13px; color: var(--text-3); }

/* 登录 */
.login-box {
  max-width: 420px; margin: 8vh auto; text-align: center; padding: 40px 30px;
  border-radius: 18px; background: var(--surface); border: 1px solid var(--border);
  backdrop-filter: blur(18px) saturate(1.3);
}
.login-mark {
  width: 46px; height: 40px; margin: 0 auto 14px; border-radius: 50% 50% 45% 45%;
  background: var(--brand); position: relative;
}
.login-mark::before, .login-mark::after {
  content: ""; position: absolute; top: -14px; width: 17px; height: 22px;
  background: var(--brand); border-radius: 50% 50% 0 0;
}
.login-mark::before { left: -2px; transform: rotate(-20deg); }
.login-mark::after { right: -2px; transform: rotate(20deg); }
.login-title { margin: 0; font-size: 26px; font-weight: 700; letter-spacing: .12em; }
.login-sub { margin: 4px 0 18px; color: var(--text-3); font-size: 13px; letter-spacing: .22em; }
.login-desc { color: var(--text-2); font-size: 13px; margin-bottom: 22px; }

.foot { border-top: 1px solid var(--border); padding: 22px 0; color: var(--text-3); font-size: 12px; }
.foot .wrap { display: flex; gap: 8px; justify-content: center; }

@media (max-width: 720px) {
  .hero-title { font-size: 30px; }
  .brand-sub, .uname, .nav a:nth-child(2) { display: none; }
  .grid { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 12px; }
  .comment-child { padding-left: 16px; }
}
