/* ===== 星际漫游指南 · 星空主题 ===== */
:root {
  --bg-deep: #050617;
  --bg-panel: rgba(18, 22, 48, 0.78);
  --bg-panel-2: rgba(30, 36, 74, 0.9);
  --accent: #6c8cff;
  --accent-2: #b06cff;
  --accent-glow: rgba(108, 140, 255, 0.45);
  --text: #e8ecff;
  --text-dim: #9aa3c8;
  --line: rgba(140, 160, 255, 0.18);
  --ok: #4ade80;
  --warn: #fbbf24;
  --danger: #f87171;
  --radius: 14px;
  --shadow: 0 10px 40px rgba(0, 0, 0, 0.45);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  font-family: "PingFang SC", "Microsoft YaHei", "Segoe UI", system-ui, sans-serif;
  color: var(--text);
  background: var(--bg-deep);
  min-height: 100vh;
}

/* 星空背景 */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -2;
  background:
    radial-gradient(1200px 600px at 80% -10%, rgba(108,140,255,0.18), transparent 60%),
    radial-gradient(900px 500px at 10% 110%, rgba(176,108,255,0.16), transparent 60%),
    linear-gradient(180deg, #050617 0%, #0a0d24 55%, #070a1b 100%);
}
body::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  background-image:
    radial-gradient(1.5px 1.5px at 20% 30%, #fff, transparent),
    radial-gradient(1.5px 1.5px at 70% 60%, #cfe, transparent),
    radial-gradient(1px 1px at 40% 80%, #fff, transparent),
    radial-gradient(1.5px 1.5px at 90% 20%, #fff, transparent),
    radial-gradient(1px 1px at 55% 15%, #bcd, transparent),
    radial-gradient(1px 1px at 15% 65%, #fff, transparent);
  background-repeat: no-repeat;
  opacity: 0.7;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

.wrap { max-width: 1180px; margin: 0 auto; padding: 0 20px; }

/* ===== 页眉 Header ===== */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  backdrop-filter: blur(10px);
  background: linear-gradient(180deg, rgba(8,10,28,0.92), rgba(8,10,28,0.6));
  border-bottom: 1px solid var(--line);
}
.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 20px;
  max-width: 1180px;
  margin: 0 auto;
}
.brand { display: flex; align-items: center; gap: 12px; }
.brand .logo {
  width: 40px; height: 40px; border-radius: 50%;
  background: radial-gradient(circle at 30% 30%, #fff, #6c8cff 40%, #2a3a8f 100%);
  box-shadow: 0 0 18px var(--accent-glow);
}
.brand .title { font-size: 20px; font-weight: 700; letter-spacing: 1px; }
.brand .title small {
  display: block; font-size: 12px; font-weight: 400;
  color: var(--text-dim); letter-spacing: 2px;
}
.header-actions { display: flex; align-items: center; gap: 10px; }
.btn {
  cursor: pointer;
  border: 1px solid var(--line);
  background: var(--bg-panel-2);
  color: var(--text);
  padding: 8px 16px;
  border-radius: 999px;
  font-size: 14px;
  transition: all .18s ease;
}
.btn:hover { border-color: var(--accent); box-shadow: 0 0 14px var(--accent-glow); }
.btn-primary {
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  border: none; color: #fff; font-weight: 600;
}
.btn-primary:hover { filter: brightness(1.08); }
.btn-ghost { background: transparent; }
.user-chip {
  display: flex; align-items: center; gap: 8px;
  padding: 6px 12px; border-radius: 999px;
  background: var(--bg-panel-2); border: 1px solid var(--line);
  font-size: 13px;
}
.badge {
  font-size: 11px; padding: 2px 8px; border-radius: 999px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2)); color: #fff;
}
.badge.member { background: rgba(140,160,255,0.25); color: var(--text); }

/* ===== 导航栏 Navigation ===== */
.navbar {
  border-bottom: 1px solid var(--line);
  background: rgba(8,10,28,0.55);
}
.nav-inner { display: flex; flex-wrap: wrap; gap: 4px; max-width: 1180px; margin: 0 auto; padding: 0 12px; }
.nav-item {
  position: relative;
  padding: 14px 18px;
  cursor: pointer;
  font-size: 15px;
  color: var(--text);
  border-bottom: 2px solid transparent;
  white-space: nowrap;
}
.nav-item:hover { color: #fff; background: rgba(108,140,255,0.12); }
.nav-item.active { color: #fff; border-bottom-color: var(--accent); }
.nav-item .caret { font-size: 10px; margin-left: 6px; color: var(--text-dim); }

/* 下拉：年级 */
.dropdown {
  display: none;
  position: absolute;
  top: 100%; left: 0;
  min-width: 200px;
  background: var(--bg-panel-2);
  border: 1px solid var(--line);
  border-radius: 0 0 var(--radius) var(--radius);
  box-shadow: var(--shadow);
  padding: 6px;
  z-index: 40;
}
.nav-item.has-dropdown:hover .dropdown { display: block; }
.dropdown .grade-item {
  display: flex; align-items: center; justify-content: space-between;
  padding: 9px 12px; border-radius: 8px; font-size: 14px;
}
.dropdown .grade-item:hover { background: rgba(108,140,255,0.18); }
.dropdown .grade-item .units-count { font-size: 11px; color: var(--text-dim); }

/* ===== 主内容 Main ===== */
main { padding: 28px 0 60px; min-height: 60vh; }
.hero {
  text-align: center;
  padding: 40px 20px 30px;
}
.hero h1 {
  font-size: 30px; margin: 0 0 10px;
  background: linear-gradient(135deg, #fff, var(--accent));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.hero p { color: var(--text-dim); margin: 0 auto; max-width: 680px; line-height: 1.7; }

.breadcrumb { color: var(--text-dim); font-size: 13px; margin: 6px 0 18px; }
.breadcrumb b { color: var(--text); }

.section-title {
  font-size: 18px; margin: 22px 0 12px; font-weight: 700;
  display: flex; align-items: center; gap: 10px;
}
.section-title::before {
  content: ""; width: 6px; height: 18px; border-radius: 3px;
  background: linear-gradient(var(--accent), var(--accent-2));
}

.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 14px;
}
.card {
  background: var(--bg-panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px 16px;
  cursor: pointer;
  transition: all .18s ease;
  text-align: center;
}
.card:hover {
  transform: translateY(-3px);
  border-color: var(--accent);
  box-shadow: 0 0 20px var(--accent-glow);
}
.card .icon { font-size: 26px; margin-bottom: 8px; }
.card .name { font-size: 15px; font-weight: 600; }
.card .sub { font-size: 12px; color: var(--text-dim); margin-top: 4px; }

/* 资源列表 */
.resource-list { display: flex; flex-direction: column; gap: 10px; }

/* 分页条 */
.pager {
  display: flex; align-items: center; justify-content: center; gap: 8px; flex-wrap: wrap;
  margin-top: 18px; padding: 10px 0;
}
.pager-info { font-size: 13px; color: #9aa; margin-right: 6px; }
.pager .btn { padding: 6px 12px; font-size: 13px; }
.pager .pager-num { min-width: 34px; text-align: center; }
.pager .pager-num.active { background: var(--primary); color: #fff; border-color: var(--primary); }
.pager .pager-dots { color: #9aa; font-size: 13px; padding: 0 2px; }
.pager .btn[disabled] { opacity: .4; cursor: not-allowed; }
.resource {
  display: flex; align-items: center; gap: 14px;
  background: var(--bg-panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px 16px;
}
.resource .pdf-icon {
  width: 42px; height: 42px; border-radius: 10px; flex: 0 0 auto;
  display: grid; place-items: center; font-weight: 700; color: #fff;
  background: linear-gradient(135deg, #f87171, #b06cff);
}
.resource .meta { flex: 1; min-width: 0; }
.resource .meta .t { font-size: 15px; font-weight: 600; }
.resource .meta .d { font-size: 12px; color: var(--text-dim); margin-top: 3px; }
.resource .acts { display: flex; gap: 8px; flex: 0 0 auto; }

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

/* ===== 表单（登录/注册/上传） ===== */
.auth-box {
  max-width: 440px; margin: 50px auto; background: var(--bg-panel);
  border: 1px solid var(--line); border-radius: 18px; padding: 30px;
  box-shadow: var(--shadow);
}
.auth-box h2 { margin: 0 0 6px; }
.auth-box .hint { color: var(--text-dim); font-size: 13px; margin-bottom: 20px; }
.field { margin-bottom: 16px; }
.field label { display: block; font-size: 13px; margin-bottom: 6px; color: var(--text-dim); }
.field input, .field select, .field textarea {
  width: 100%; padding: 11px 12px; border-radius: 10px;
  border: 1px solid var(--line); background: var(--bg-deep); color: var(--text);
  font-size: 14px; outline: none;
}
.field input:focus, .field select:focus, .field textarea:focus {
  border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-glow);
}
.msg { font-size: 13px; margin-top: 8px; min-height: 18px; }
.msg.err { color: var(--danger); }
.msg.ok { color: var(--ok); }
.center { text-align: center; }
.muted { color: var(--text-dim); }
.row { display: flex; gap: 12px; }
.row > * { flex: 1; }

/* 上传页专用 */
.upload-wrap { max-width: 640px; margin: 40px auto; }
.drop {
  border: 2px dashed var(--line); border-radius: var(--radius);
  padding: 30px; text-align: center; cursor: pointer; color: var(--text-dim);
}
.drop:hover { border-color: var(--accent); color: var(--text); }
.drop b { color: var(--accent); }

/* ===== 页脚 Footer ===== */
.site-footer {
  border-top: 1px solid var(--line);
  background: rgba(8,10,28,0.75);
  padding: 26px 0;
  margin-top: 30px;
}
.footer-inner {
  max-width: 1180px; margin: 0 auto; padding: 0 20px;
  display: flex; flex-wrap: wrap; gap: 24px; justify-content: space-between;
}
.footer-col h4 { margin: 0 0 10px; font-size: 14px; color: var(--text); }
.footer-col a, .footer-col span { display: block; font-size: 13px; color: var(--text-dim); margin-bottom: 6px; }
.footer-bottom {
  text-align: center; color: var(--text-dim); font-size: 12px;
  margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--line);
}

/* 响应式 */
@media (max-width: 720px) {
  .header-inner { flex-wrap: wrap; }
  .nav-item { padding: 12px 12px; font-size: 14px; }
  .hero h1 { font-size: 24px; }
}

/* ===== 资源缩略图 ===== */
.resource .thumb {
  width: 64px; height: 84px; border-radius: 8px; flex: 0 0 auto;
  overflow: hidden; background: linear-gradient(135deg, #2a3a8f, #6c8cff);
  display: grid; place-items: center; cursor: pointer;
  box-shadow: 0 4px 12px rgba(0,0,0,0.35);
}
.resource .thumb canvas { width: 64px; height: 84px; object-fit: cover; display: block; }
.resource .thumb .cover {
  color: #fff; font-weight: 700; font-size: 12px; text-align: center; padding: 4px;
  line-height: 1.3;
}

/* ===== 在线预览弹窗 ===== */
.modal { position: fixed; inset: 0; z-index: 100; display: flex; align-items: center; justify-content: center; }
.modal-backdrop { position: absolute; inset: 0; background: rgba(3,5,15,0.78); backdrop-filter: blur(4px); }
.modal-box {
  position: relative; z-index: 1; width: min(960px, 94vw); height: min(88vh, 900px);
  background: var(--bg-panel-2); border: 1px solid var(--line); border-radius: 16px;
  display: flex; flex-direction: column; overflow: hidden; box-shadow: var(--shadow);
}
.modal-head {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 12px 16px; border-bottom: 1px solid var(--line);
}
.modal-head .pt { font-size: 15px; font-weight: 600; }
.modal-head .ph-acts { display: flex; gap: 8px; }
.modal-box iframe { flex: 1; border: 0; background: #fff; }

/* 预览内容区：PDF iframe / 音频 / 视频 */
.modal-body {
  flex: 1; overflow: auto; display: flex; align-items: center; justify-content: center;
  background: #0b0e22; padding: 10px;
}
.modal-body iframe { width: 100%; height: 100%; border: 0; background: #fff; }
.modal-body audio { width: 92%; outline: none; }
.modal-body video { max-width: 100%; max-height: 100%; background: #000; border-radius: 8px; }
/* 部分预览（PDF / docx）：竖排，横幅在上，内容填充剩余高度 */
.modal-body.partial { flex-direction: column; align-items: stretch; justify-content: flex-start; }
.modal-body.partial iframe { flex: 1; height: auto; min-height: 0; }
.preview-banner { background: rgba(255,179,71,.15); color: #ffd9a0; border: 1px solid rgba(255,179,71,.4); border-radius: 8px; padding: 8px 12px; font-size: 13px; margin-bottom: 8px; flex: 0 0 auto; }
.docx-preview { flex: 1; min-height: 0; overflow: auto; background: #fff; color: #1a1a1a; border-radius: 8px; padding: 16px 20px; font-size: 14px; line-height: 1.7; word-break: break-word; margin: 0; }

/* PPTX 在线预览 */
.pptx-tip { color: #aaa; font-size: 14px; padding: 24px 0; }
.pptx-canvas {
  max-width: 100%; max-height: 62vh; display: none;
  background: #fff; border-radius: 8px; box-shadow: 0 2px 14px rgba(0,0,0,.35);
}
.pptx-ctrl { display: flex; align-items: center; gap: 14px; margin-top: 10px; }
.pptx-page { font-size: 14px; color: #ccc; min-width: 64px; text-align: center; }

/* 压缩包内容清单 */
.archive-head { font-size: 14px; color: #bbb; margin: 2px 0 10px; text-align: left; width: 100%; }
.archive-list {
  width: 100%; max-height: 48vh; overflow: auto; text-align: left;
  background: rgba(255,255,255,.04); border: 1px solid rgba(255,255,255,.1); border-radius: 8px;
}
.archive-item { display: flex; align-items: center; gap: 8px; padding: 8px 12px; border-bottom: 1px solid rgba(255,255,255,.06); font-size: 14px; color: #ddd; cursor: pointer; }
.archive-item:hover { background: rgba(255,255,255,.07); }
.archive-item .ai-name { flex: 1; word-break: break-all; }
.archive-item .ai-dl { color: #6c8cff; font-size: 13px; text-decoration: none; flex-shrink: 0; }
.archive-item .ai-dl:hover { text-decoration: underline; }
.archive-item.dim { color: #888; cursor: default; }

/* 压缩包在线解压预览区 */
.archive-preview {
  width: 100%; margin-top: 12px; padding: 14px;
  border: 1px solid rgba(255,255,255,.1); border-radius: 8px;
  background: rgba(255,255,255,.03); text-align: center;
  color: #aaa; font-size: 14px; max-height: 55vh; overflow: auto;
  box-sizing: border-box;
}
.archive-preview img.archive-img { max-width: 100%; max-height: 48vh; border-radius: 6px; }
.archive-preview pre.archive-text { text-align: left; font-size: 13px; line-height: 1.7; white-space: pre-wrap; word-break: break-all; color: #ddd; margin: 0; }
.archive-preview audio, .archive-preview video { max-width: 100%; }

/* 视频缩略图（16:9） */
.resource .thumb.video { width: 116px; height: 65px; background: #0b0e22; }
.resource .thumb.video .vid-thumb { width: 100%; height: 100%; object-fit: cover; display: block; border-radius: 8px; }
.resource .thumb.audio { background: linear-gradient(135deg, #6c8cff, #b06cff); }

/* ===== 上传文件列表与进度 ===== */
.file-list { margin-top: 14px; display: flex; flex-direction: column; gap: 10px; }
.file-item {
  position: relative; display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  background: var(--bg-deep); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px;
}
.file-item .fi-icon { font-size: 18px; }
.file-item .fi-name { flex: 1; min-width: 120px; font-size: 13px; word-break: break-all; }
.file-item .fi-size { font-size: 12px; color: var(--text-dim); }
.file-item .fi-status { font-size: 12px; }
.file-item .fi-status.ok { color: var(--ok); }
.file-item .fi-status.err { color: var(--danger); }
.file-item .fi-del {
  border: none; background: transparent; color: var(--text-dim); cursor: pointer;
  font-size: 18px; line-height: 1; padding: 2px 6px; border-radius: 6px;
}
.file-item .fi-del:hover { color: var(--danger); background: rgba(248,113,113,0.12); }
.file-item .fi-bar { flex-basis: 100%; height: 6px; border-radius: 4px; background: var(--bg-panel); overflow: hidden; }
  .file-item .fi-prog { height: 100%; width: 0%; background: linear-gradient(90deg, var(--accent), var(--accent-2)); transition: width .2s; }


/* ===== 充值中心 ===== */
.points-chip {
  cursor: pointer; padding: 6px 12px; border-radius: 999px;
  background: linear-gradient(135deg, #2a3a8f, var(--accent));
  color: #fff !important; font-size: 13px; font-weight: 600; white-space: nowrap;
  border: 1px solid rgba(255,255,255,0.15); box-shadow: 0 0 12px var(--accent-glow);
}
.points-chip:hover { text-decoration: none; filter: brightness(1.1); }

.recharge-wrap { max-width: 880px; }
.rc-section { margin-top: 26px; }

/* 余额卡 */
.balance-card {
  display: flex; align-items: center; justify-content: space-between; gap: 18px; flex-wrap: wrap;
  margin-top: 24px; padding: 22px 26px;
  background: linear-gradient(135deg, rgba(108,140,255,0.18), rgba(176,108,255,0.14));
  border: 1px solid var(--line); border-radius: 18px; box-shadow: var(--shadow);
}
.bc-left .bc-label { font-size: 13px; color: var(--text-dim); }
.bc-left .bc-points { font-size: 44px; font-weight: 800; line-height: 1.1;
  background: linear-gradient(135deg, #fff, var(--accent)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.bc-left .bc-sub { font-size: 12px; color: var(--text-dim); margin-top: 4px; }
.bc-right { display: flex; flex-direction: column; align-items: flex-end; gap: 8px; }
.bc-right .btn-primary { font-size: 15px; padding: 10px 22px; }
.bc-right .btn-primary:disabled { opacity: .6; cursor: default; filter: none; }
.bc-streak { font-size: 12px; color: var(--text-dim); }

/* 渠道切换 */
.channel-row { display: flex; gap: 10px; margin: 14px 0 16px; }
.channel {
  cursor: pointer; padding: 9px 18px; border-radius: 999px; font-size: 14px;
  border: 1px solid var(--line); background: var(--bg-panel-2); color: var(--text); transition: all .18s;
}
.channel:hover { border-color: var(--accent); }
.channel.active { background: linear-gradient(135deg, var(--accent), var(--accent-2)); border: none; color: #fff; font-weight: 600; }

/* 档位卡 */
.tier-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 14px; }
.tier-card {
  position: relative; display: flex; flex-direction: column; align-items: center; gap: 8px;
  padding: 20px 14px; cursor: pointer; text-align: center;
  background: var(--bg-panel); border: 1px solid var(--line); border-radius: var(--radius); transition: all .18s;
}
.tier-card:hover { transform: translateY(-3px); border-color: var(--accent); box-shadow: 0 0 20px var(--accent-glow); }
.tier-card .tier-label { font-size: 13px; color: var(--text-dim); }
.tier-card .tier-amount { font-size: 26px; font-weight: 800; }
.tier-card .tier-get { font-size: 14px; color: var(--accent); font-weight: 600; }
.tier-card .tier-bonus {
  font-size: 12px; color: #fff; background: linear-gradient(135deg, #f59e0b, #ef4444);
  padding: 2px 10px; border-radius: 999px;
}
.tier-card .tier-btn { margin-top: 6px; width: 100%; }
.rc-tip { font-size: 12px; line-height: 1.7; margin-top: 14px; }

/* Tab */
.tabs { display: flex; gap: 6px; border-bottom: 1px solid var(--line); margin-bottom: 14px; }
.tab { cursor: pointer; padding: 10px 16px; font-size: 14px; color: var(--text-dim); border-bottom: 2px solid transparent; }
.tab:hover { color: var(--text); }
.tab.active { color: #fff; border-bottom-color: var(--accent); }
.tab-panel { min-height: 60px; }

/* 流水 / 订单 */
.ledger-row {
  display: flex; align-items: center; gap: 12px; padding: 12px 14px;
  border-bottom: 1px solid var(--line); background: var(--bg-panel); border-radius: 10px; margin-bottom: 8px;
}
.ledger-row .lr-main { flex: 1; min-width: 0; }
.ledger-row .lr-type { font-size: 14px; font-weight: 600; }
.ledger-row .lr-remark { font-size: 12px; color: var(--text-dim); margin-top: 2px; word-break: break-all; }
.ledger-row .lr-amt { font-size: 15px; font-weight: 700; flex: 0 0 auto; }
.ledger-row .lr-amt.pos { color: var(--ok); }
.ledger-row .lr-amt.neg { color: var(--danger); }
.ledger-row .lr-amt.muted { color: var(--text-dim); font-weight: 500; }
.ledger-row .lr-time { font-size: 12px; color: var(--text-dim); flex: 0 0 auto; text-align: right; }
.ledger-more { width: 100%; margin-top: 4px; }

/* 支付弹层 */
.pay-box { width: min(420px, 92vw); height: auto; max-height: 90vh; }
.pay-body { flex-direction: column; gap: 14px; padding: 22px; text-align: center; }
.pay-note { font-size: 13px; color: var(--text-dim); line-height: 1.6; }
.pay-qr { width: 220px; height: 220px; object-fit: contain; border-radius: 10px; background: #fff; padding: 8px; align-self: center; }
.pay-mock-btn { font-size: 16px; padding: 12px 20px; align-self: center; }
.pay-status { font-size: 14px; color: var(--text-dim); }
.pay-status.ok { color: var(--ok); font-weight: 600; }
.pay-status.err { color: var(--danger); font-weight: 600; }

/* toast */
.toast {
  position: fixed; left: 50%; bottom: 40px; transform: translateX(-50%) translateY(20px);
  background: rgba(20,24,52,0.96); color: var(--text); border: 1px solid var(--line);
  padding: 12px 20px; border-radius: 12px; font-size: 14px; box-shadow: var(--shadow);
  opacity: 0; pointer-events: none; transition: all .25s; z-index: 200; max-width: 86vw; text-align: center;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast.ok { border-color: var(--ok); }
.toast.err { border-color: var(--danger); }

/* 撒花 */
.confetti { position: fixed; inset: 0; pointer-events: none; z-index: 300; overflow: hidden; }
.confetti-piece {
  position: absolute; top: -12px; width: 9px; height: 14px; border-radius: 2px;
  animation: confetti-fall linear forwards;
}
@keyframes confetti-fall {
  0% { transform: translateY(-10px) rotate(0deg); opacity: 1; }
  100% { transform: translateY(105vh) rotate(540deg); opacity: 0.9; }
}

@media (max-width: 720px) {
  .balance-card { flex-direction: column; align-items: flex-start; }
  .bc-right { align-items: flex-start; width: 100%; }
  .bc-right .btn-primary { width: 100%; }
  .ledger-row .lr-time { display: none; }
}

