:root {
  --bg: #0a0d13;
  --bg-2: #0e131c;
  --panel: #121826;
  --panel-2: #161e2f;
  --line: #222c42;
  --text: #e8eef8;
  --muted: #8d9bb0;
  --accent: #4f8cff;
  --accent-2: #22d3ee;
  --ok: #34d399;
  --warn: #fbbf24;
  --danger: #f87171;
  --radius: 14px;
  --shadow: 0 18px 50px rgba(0, 0, 0, .45);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: radial-gradient(1200px 600px at 20% -10%, #16233c 0%, var(--bg) 55%) fixed;
  color: var(--text);
  font: 15px/1.6 "Inter", "PingFang SC", "Microsoft YaHei", system-ui, -apple-system, sans-serif;
  min-height: 100%;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
code { background: rgba(255, 255, 255, .06); padding: 1px 6px; border-radius: 6px; font-size: .9em; }
.muted { color: var(--muted); }

/* ------------------------------ 顶栏 ------------------------------ */
.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 28px;
  background: rgba(10, 13, 19, .82);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line);
}

.brand { display: flex; align-items: center; gap: 12px; color: var(--text); text-decoration: none; }
.brand:hover { text-decoration: none; }
.brand small { display: block; color: var(--muted); font-size: 12px; font-weight: 400; letter-spacing: .02em; }
.logo {
  width: 34px; height: 34px; border-radius: 10px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  box-shadow: 0 0 24px rgba(79, 140, 255, .45);
  position: relative;
}
.logo::after {
  content: "▶";
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 14px; color: #06101f;
}

nav { display: flex; gap: 6px; }
nav a {
  color: var(--muted);
  padding: 7px 12px;
  border-radius: 9px;
  text-decoration: none;
  font-size: 14px;
}
nav a:hover { color: var(--text); background: rgba(255, 255, 255, .05); text-decoration: none; }
nav a.active { color: var(--text); background: rgba(79, 140, 255, .14); }

/* ------------------------------ 布局 ------------------------------ */
.container { max-width: 1120px; margin: 0 auto; padding: 34px 24px 60px; }

.hero { margin: 6px 0 26px; }
.hero h1 {
  margin: 0 0 10px;
  font-size: 30px;
  letter-spacing: -.02em;
  background: linear-gradient(100deg, #fff 10%, #9ec1ff 60%, #7ef0ff 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.hero p { margin: 0; max-width: 760px; color: var(--muted); }

.card {
  background: linear-gradient(180deg, var(--panel), var(--bg-2));
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px 22px;
}

.section-head {
  display: flex; align-items: baseline; justify-content: space-between; gap: 12px;
  margin-bottom: 14px;
}
.section-head h2 { margin: 0; font-size: 17px; letter-spacing: .01em; }
.library { margin-top: 34px; }

/* ------------------------------ 上传 ------------------------------ */
.upload-form { display: flex; flex-direction: column; gap: 14px; }
.row { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 14px; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field label { font-size: 13px; color: var(--muted); }

input[type="text"], input[type="password"], select {
  width: 100%;
  padding: 11px 13px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: #0b111c;
  color: var(--text);
  font: inherit;
  outline: none;
  transition: border-color .15s, box-shadow .15s;
}
input:focus, select:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(79, 140, 255, .16); }

.dropzone {
  border: 1.5px dashed #2c3a56;
  border-radius: 12px;
  padding: 26px;
  text-align: center;
  cursor: pointer;
  transition: border-color .15s, background .15s;
  background: rgba(255, 255, 255, .015);
}
.dropzone:hover, .dropzone.drag { border-color: var(--accent); background: rgba(79, 140, 255, .07); }
.dz-icon { font-size: 26px; color: var(--accent); margin-bottom: 6px; }
.dz-title { font-weight: 600; }
.dz-hint { color: var(--muted); font-size: 13px; margin-top: 4px; }

.btn {
  appearance: none;
  border: 1px solid var(--line);
  background: var(--panel-2);
  color: var(--text);
  border-radius: 10px;
  padding: 9px 16px;
  font: inherit;
  font-size: 14px;
  cursor: pointer;
  transition: transform .05s, border-color .15s, background .15s;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}
.btn:hover { border-color: #35507f; background: #1a2440; text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn.primary {
  background: linear-gradient(135deg, var(--accent), #3a6fe0);
  border-color: transparent;
  color: #fff;
  font-weight: 600;
  box-shadow: 0 8px 24px rgba(79, 140, 255, .28);
}
.btn.primary:hover { background: linear-gradient(135deg, #639bff, #4479ee); }
.btn.ghost { background: transparent; }

.progress { margin-top: 14px; display: flex; align-items: center; gap: 12px; }
.bar { flex: 1; height: 8px; border-radius: 999px; background: #0a101b; overflow: hidden; border: 1px solid var(--line); }
.bar span { display: block; height: 100%; width: 0%; background: linear-gradient(90deg, var(--accent), var(--accent-2)); transition: width .2s; }
.progress-text { font-size: 13px; color: var(--muted); white-space: nowrap; }

.notice {
  margin-top: 14px;
  padding: 11px 14px;
  border-radius: 10px;
  font-size: 14px;
  border: 1px solid var(--line);
  background: var(--panel-2);
}
.notice.ok { border-color: rgba(52, 211, 153, .4); background: rgba(52, 211, 153, .1); color: #a7f3d0; }
.notice.error { border-color: rgba(248, 113, 113, .4); background: rgba(248, 113, 113, .1); color: #fecaca; }
.notice.warn { border-color: rgba(251, 191, 36, .4); background: rgba(251, 191, 36, .1); color: #fde68a; }

/* ------------------------------ 视频库 ------------------------------ */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 18px; }

.video-card {
  display: block;
  color: var(--text);
  text-decoration: none;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--panel);
  transition: transform .16s, border-color .16s, box-shadow .16s;
}
.video-card:hover { transform: translateY(-3px); border-color: #35507f; box-shadow: 0 16px 40px rgba(0, 0, 0, .5); text-decoration: none; }
.video-card.disabled { opacity: .75; cursor: default; }

.poster {
  position: relative;
  aspect-ratio: 16 / 9;
  background: #0b111c center / cover no-repeat;
  display: flex; align-items: center; justify-content: center;
}
.poster .play {
  width: 46px; height: 46px; border-radius: 50%;
  background: rgba(6, 12, 22, .62);
  border: 1px solid rgba(255, 255, 255, .25);
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-size: 15px;
  backdrop-filter: blur(4px);
}
.poster .dur {
  position: absolute; right: 8px; bottom: 8px;
  background: rgba(0, 0, 0, .72); color: #fff;
  font-size: 12px; padding: 2px 7px; border-radius: 6px;
}
.meta { padding: 11px 13px 13px; }
.meta .title { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.meta .sub { color: var(--muted); font-size: 12.5px; margin-top: 3px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.meta .bar { margin-top: 10px; height: 5px; }

.empty { text-align: center; padding: 46px 20px; border: 1px dashed var(--line); border-radius: var(--radius); }

.footer {
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 28px; border-top: 1px solid var(--line);
  color: var(--muted); font-size: 13px;
}

/* ------------------------------ 播放页 ------------------------------ */
.watch-page { background: #05070b; }
.watch-topbar { justify-content: flex-start; gap: 18px; }
.back { color: var(--muted); font-size: 14px; }
.watch-title { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.p2p-badge {
  margin-left: auto;
  display: inline-flex; align-items: center; gap: 8px;
  font-size: 12.5px; color: #c7d7ff;
  border: 1px solid rgba(79, 140, 255, .45);
  background: rgba(79, 140, 255, .12);
  padding: 5px 11px; border-radius: 999px;
}
.pulse {
  width: 8px; height: 8px; border-radius: 50%; background: var(--ok);
  box-shadow: 0 0 0 0 rgba(52, 211, 153, .7);
  animation: pulse 1.8s infinite;
}
@keyframes pulse {
  0% { box-shadow: 0 0 0 0 rgba(52, 211, 153, .65); }
  70% { box-shadow: 0 0 0 9px rgba(52, 211, 153, 0); }
  100% { box-shadow: 0 0 0 0 rgba(52, 211, 153, 0); }
}

.watch { max-width: 1180px; margin: 0 auto; padding: 24px; }
.player-shell { position: relative; border-radius: 14px; overflow: hidden; background: #000; border: 1px solid var(--line); }
.player-mount { width: 100%; aspect-ratio: 16 / 9; }
.wphl { width: 100%; height: 100%; }
.wphl-video { width: 100%; height: 100%; display: block; background: #000; }

.play-overlay {
  position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%);
  width: 78px; height: 78px; border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, .35);
  background: rgba(8, 14, 24, .72);
  color: #fff; font-size: 26px; cursor: pointer;
  backdrop-filter: blur(6px);
}

.stats-grid {
  margin-top: 16px;
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 10px;
}
.stat {
  background: var(--panel); border: 1px solid var(--line);
  border-radius: 12px; padding: 11px 13px;
  display: flex; flex-direction: column; gap: 2px;
}
.stat span { color: var(--muted); font-size: 12px; }
.stat b { font-size: 16px; font-weight: 600; letter-spacing: .01em; }
.stat select { margin-top: 2px; padding: 6px 8px; font-size: 13px; }

.watch-actions { margin-top: 14px; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }

.ws-note { margin-top: 12px; font-size: 13px; line-height: 1.7; }
.ws-note code { font-size: 12px; }
.ws-note b { color: #cfe0ff; font-weight: 600; }

.p2p-note { margin-top: 22px; }
.p2p-note h3 { margin: 0 0 8px; font-size: 15px; }
.p2p-note p { margin: 0 0 8px; color: var(--muted); font-size: 14px; }

/* ------------------------------ 文档页 ------------------------------ */
.doc { max-width: 900px; margin: 0 auto; padding: 34px 24px 70px; }
.doc h1 { font-size: 26px; margin: 0 0 6px; }
.doc h2 { margin: 34px 0 10px; font-size: 19px; padding-bottom: 6px; border-bottom: 1px solid var(--line); }
.doc h3 { margin: 22px 0 8px; font-size: 15px; color: #cfe0ff; }
.doc p { color: #b9c6d8; }
.doc pre {
  background: #070b12; border: 1px solid var(--line); border-radius: 12px;
  padding: 14px 16px; overflow: auto; font-size: 13px; line-height: 1.55;
}
.doc code { background: transparent; padding: 0; }
.doc table { width: 100%; border-collapse: collapse; margin: 12px 0; font-size: 14px; }
.doc th, .doc td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
.doc th { color: var(--muted); font-weight: 500; }
.doc .tag { display: inline-block; font-size: 12px; padding: 1px 8px; border-radius: 999px; border: 1px solid var(--line); color: var(--muted); margin-left: 8px; }

@media (max-width: 820px) {
  .row { grid-template-columns: 1fr; }
  .stats-grid { grid-template-columns: repeat(3, 1fr); }
  .hero h1 { font-size: 24px; }
  .topbar { padding: 12px 16px; }
  .container, .watch { padding: 18px 16px 46px; }
  .watch-title { max-width: 45vw; }
}

@media (max-width: 520px) {
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .watch-topbar { flex-wrap: wrap; }
}
