/* ============================================================
   统一学习门户 —— 深色「彩色高级」主题 v2
   基调：蓝黑画布 + 极光渐变 + 玻璃质感 + 细发丝描边
   说明：类名与旧版完全一致（index.php / app.js 不需改结构），
        只重做质感层；新增 .hub-nav / .sys-card .bar 等装饰元素。
   ============================================================ */

:root {
  /* ===== 舒适暗色主题（2026-10-12 二次调整）=====
     用户反馈纯亮色太刺眼、最早的近黑太闷。
     这里取中间值：蓝灰画布 #1C2333 + 卡片 #242C3E，文字 #E7ECF6（非纯白）。 */
  --bg: #1C2333;
  --bg-deep: #171D2A;
  --panel: #242C3E;
  --panel-2: #2A3347;
  --surface: rgba(255, 255, 255, .05);
  --surface-2: rgba(255, 255, 255, .09);
  --hairline: rgba(255, 255, 255, .10);
  --hairline-2: rgba(255, 255, 255, .19);

  /* 文字 */
  --text: #E7ECF6;
  --text-2: #A9B4C8;
  --text-3: #7E8AA0;
  --text-dim: #A9B4C8;

  /* 彩色谱（暗底上整体提亮一档，保证可读） */
  --indigo: #818CF8;
  --violet: #A78BFA;
  --fuchsia: #E879F9;
  --cyan: #22D3EE;
  --sky: #38BDF8;
  --teal: #2DD4BF;
  --lime: #A3E635;
  --amber: #FBBF24;
  --coral: #FB7185;

  --accent: #818CF8;
  --accent-2: #22D3EE;
  --green: #34D399;
  --yellow: #FBBF24;
  --red: #FB7185;

  /* 渐变 */
  --g-brand: linear-gradient(115deg, #6366F1 0%, #8B5CF6 42%, #22D3EE 100%);
  --g-code: linear-gradient(135deg, #0EA5E9, #6366F1);
  --g-exam: linear-gradient(135deg, #8B5CF6, #D946EF);
  --g-btn: linear-gradient(115deg, #6366F1, #4F46E5 55%, #7C3AED);

  /* 圆角与阴影 */
  --r-sm: 8px;
  --r: 12px;
  --r-lg: 16px;
  --sh-1: 0 1px 3px rgba(0, 0, 0, .28);
  --sh-2: 0 20px 44px -26px rgba(0, 0, 0, .72);
  --glow-indigo: 0 12px 28px -14px rgba(99, 102, 241, .55);
  --glow-cyan: 0 12px 28px -14px rgba(34, 211, 238, .45);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
  font-family: "Segoe UI", "Microsoft YaHei", "PingFang SC", sans-serif;
  font-size: 13.5px;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  position: relative;
}

/* 极光底纹：固定一层多彩辉光，避免旧版「死黑」的观感 */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background:
    radial-gradient(760px 430px at 10% -10%, rgba(99, 102, 241, .22), transparent 62%),
    radial-gradient(700px 400px at 95% 4%, rgba(34, 211, 238, .12), transparent 64%),
    radial-gradient(820px 520px at 62% 112%, rgba(217, 70, 239, .11), transparent 62%),
    linear-gradient(180deg, #1C2333, #171D2A 60%, #1C2333);
}
body > * { position: relative; z-index: 1; }

button { font-family: inherit; cursor: pointer; }
input, select, textarea { font-family: inherit; }
.hidden { display: none !important; }
a { color: inherit; }

::selection { background: rgba(99, 102, 241, .42); color: #fff; }

/* ================= 登录页 ================= */
.auth-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.auth-card {
  width: 400px;
  background: linear-gradient(180deg, rgba(255, 255, 255, .07), rgba(255, 255, 255, .025));
  border: 1px solid var(--hairline);
  border-radius: var(--r-lg);
  padding: 42px 36px 26px;
  box-shadow: var(--sh-2), inset 0 1px 0 rgba(255, 255, 255, .07);
  backdrop-filter: blur(14px);
  animation: rise .5s cubic-bezier(.22, 1, .36, 1) both;
}
.auth-logo {
  width: 58px; height: 58px;
  margin: 0 auto 16px;
  border-radius: 15px;
  background: var(--g-brand);
  color: #fff;
  font-family: Consolas, monospace;
  font-size: 23px;
  font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  box-shadow: var(--glow-indigo);
}
.auth-card h1 {
  text-align: center; font-size: 21px; font-weight: 650; letter-spacing: .5px;
  background: var(--g-brand); -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent; color: transparent;
}
.auth-sub { text-align: center; color: var(--text-2); margin: 10px 0 26px; font-size: 12.5px; line-height: 1.75; }
.auth-card form { display: flex; flex-direction: column; gap: 15px; }
.auth-card label { display: flex; flex-direction: column; gap: 7px; font-size: 12px; color: var(--text-3); letter-spacing: .3px; }
.auth-card input, .auth-card select {
  height: 40px;
  background: #242C3E;
  border: 1px solid var(--hairline);
  border-radius: var(--r-sm);
  color: var(--text);
  padding: 0 12px;
  font-size: 14px;
  outline: none;
  transition: border-color .18s, box-shadow .18s, background .18s;
}
.auth-card input:focus, .auth-card select:focus {
  border-color: rgba(99, 102, 241, .8);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, .18);
  background: #242C3E;
}
.btn-primary {
  height: 40px;
  border: none; border-radius: var(--r-sm);
  background: var(--g-btn);
  color: #fff;
  font-size: 14.5px; font-weight: 620; letter-spacing: 1px;
  box-shadow: var(--glow-indigo);
  transition: transform .16s, filter .16s, box-shadow .16s;
}
.btn-primary:hover { filter: brightness(1.12); transform: translateY(-1px); }
.btn-primary:active { transform: translateY(0); }
.btn-primary:disabled { opacity: .55; cursor: not-allowed; transform: none; }
.auth-err { color: var(--coral); min-height: 18px; font-size: 12.5px; text-align: center; }
.auth-tip { text-align: center; color: var(--text-3); font-size: 11.5px; margin-top: 20px; line-height: 1.85; }
.auth-tip b { color: var(--text-2); }

/* ================= 顶栏 ================= */
.hub-wrap { min-height: 100vh; display: flex; flex-direction: column; }
.hub-topbar {
  height: 58px;
  background: rgba(28, 35, 51, .84);
  border-bottom: 1px solid var(--hairline);
  backdrop-filter: blur(16px);
  display: flex; align-items: center;
  padding: 0 24px;
  gap: 12px;
  flex: 0 0 auto;
  position: sticky; top: 0; z-index: 40;
}
.hub-logo {
  display: flex; align-items: center; gap: 11px;
  font-size: 15px; font-weight: 640; letter-spacing: .4px;
  color: var(--text);
}
.hub-logo .mark {
  width: 32px; height: 32px;
  border-radius: 9px;
  background: var(--g-brand);
  color: #fff;
  font-family: Consolas, monospace;
  font-size: 15px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 6px 18px -6px rgba(99, 102, 241, .85);
}
.hub-topbar .spacer { flex: 1; }
.hub-user {
  color: var(--text-2); font-size: 12.5px;
  padding: 5px 12px; border-radius: 999px;
  background: var(--surface); border: 1px solid var(--hairline);
}
.btn {
  height: 32px; padding: 0 13px;
  border: 1px solid var(--hairline);
  border-radius: var(--r-sm);
  background: var(--surface);
  color: var(--text-2);
  font-size: 12.5px; font-weight: 500;
  display: inline-flex; align-items: center; gap: 6px;
  text-decoration: none;
  transition: background .16s, color .16s, border-color .16s, transform .16s;
}
.btn:hover { background: var(--surface-2); color: var(--text); border-color: var(--hairline-2); transform: translateY(-1px); }
.btn-danger:hover { background: rgba(251, 113, 133, .14); border-color: rgba(251, 113, 133, .45); color: var(--coral); }

/* ================= 主体 ================= */
.hub-main { flex: 1; padding: 38px 26px 66px; max-width: 1220px; width: 100%; margin: 0 auto; }
.hub-hello { margin-bottom: 26px; }
.hub-hello h2 { font-size: 25px; font-weight: 660; letter-spacing: .3px; }
.hub-hello p { color: var(--text-2); margin-top: 8px; font-size: 13px; }

/* 系统入口卡 */
.sys-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 18px;
}
.sys-card {
  background: #242C3E;
  border: 1px solid var(--hairline);
  border-radius: var(--r-lg);
  padding: 24px 22px 20px;
  display: flex; flex-direction: column; gap: 11px;
  text-decoration: none;
  color: var(--text-2);
  position: relative;
  overflow: hidden;
  box-shadow: var(--sh-1);
  backdrop-filter: blur(10px);
  transition: transform .2s cubic-bezier(.22, 1, .36, 1), border-color .2s, box-shadow .2s;
  animation: rise .55s cubic-bezier(.22, 1, .36, 1) both;
}
.sys-card:nth-child(2) { animation-delay: .07s; }
.sys-card:nth-child(3) { animation-delay: .14s; }
/* 顶部彩条：平时低调，hover 亮起 */
.sys-card::before {
  content: "";
  position: absolute; left: 0; right: 0; top: 0; height: 3px;
  background: var(--card-g, var(--g-brand));
  opacity: .55;
  transition: opacity .2s;
}
.sys-card::after {
  content: "";
  position: absolute; inset: -1px;
  border-radius: inherit;
  background: radial-gradient(420px 180px at 12% -30%, var(--card-glow, rgba(99, 102, 241, .28)), transparent 70%);
  opacity: 0; transition: opacity .25s; pointer-events: none;
}
.sys-card:hover { transform: translateY(-4px); border-color: var(--hairline-2); }
.sys-card:hover::before { opacity: 1; }
.sys-card:hover::after { opacity: 1; }
.sys-icon {
  width: 46px; height: 46px;
  border-radius: 13px;
  display: flex; align-items: center; justify-content: center;
  font-size: 21px;
  color: #fff;
  box-shadow: 0 10px 26px -12px rgba(0, 0, 0, .9);
}
.sys-card h3 { font-size: 16.5px; color: var(--text); font-weight: 640; letter-spacing: .3px; }
.sys-card .desc { font-size: 12.5px; color: var(--text-2); line-height: 1.8; flex: 1; }
.sys-card .go { font-size: 12.5px; font-weight: 620; color: var(--cyan); }
.sys-card:hover .go { color: #E7ECF6; }
.sys-card .role-tag {
  position: absolute; top: 18px; right: 18px;
  font-size: 10.5px; letter-spacing: .5px;
  color: var(--text-2);
  background: #242C3E;
  border: 1px solid var(--hairline);
  border-radius: 999px;
  padding: 3px 10px;
  z-index: 1;
}
.sys-tags { display: flex; flex-wrap: wrap; gap: 6px; }
.sys-tags span {
  font-size: 11px; color: var(--text-2);
  background: var(--surface); border: 1px solid var(--hairline);
  border-radius: 999px; padding: 2.5px 9px;
}

/* ================= 账号管理 ================= */
.admin-wrap { max-width: 1040px; margin: 0 auto; }
.admin-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.admin-head h2 { font-size: 19px; color: var(--text); font-weight: 640; }
.admin-table {
  width: 100%; border-collapse: separate; border-spacing: 0;
  font-size: 12.8px;
  background: #242C3E;
  border: 1px solid var(--hairline);
  border-radius: var(--r);
  overflow: hidden;
}
.admin-table th {
  text-align: left; color: var(--text-3);
  padding: 11px 14px; font-weight: 560; letter-spacing: .4px; font-size: 11.5px;
  text-transform: uppercase;
  border-bottom: 1px solid var(--hairline);
  background: #2D3648;
}
.admin-table td { padding: 11px 14px; border-bottom: 1px solid var(--hairline); color: var(--text-2); }
.admin-table tbody tr:last-child td { border-bottom: none; }
.admin-table tr:hover td { background: rgba(99, 102, 241, .07); color: var(--text); }
.tag {
  display: inline-block; background: var(--g-btn); color: #fff;
  border-radius: 999px; font-size: 10.5px; font-weight: 560;
  padding: 2.5px 9px; letter-spacing: .3px;
}
.tag.parent { background: linear-gradient(135deg, #0EA5E9, #2563EB); }
.tag.admin { background: linear-gradient(135deg, #8B5CF6, #D946EF); }
.mini-btn {
  border: 1px solid var(--hairline);
  background: transparent;
  color: var(--text-3);
  border-radius: 6px;
  font-size: 11.5px;
  padding: 4px 9px;
  margin-right: 6px;
  transition: background .15s, color .15s, border-color .15s;
}
.mini-btn:hover { background: var(--surface-2); color: var(--text); border-color: var(--hairline-2); }
.mini-btn.danger:hover { color: var(--coral); border-color: rgba(251, 113, 133, .45); background: rgba(251, 113, 133, .1); }

/* 模态框 */
.modal-mask {
  position: fixed; inset: 0;
  background: rgba(0, 0, 0, .45);
  backdrop-filter: blur(4px);
  display: flex; align-items: center; justify-content: center;
  z-index: 100;
  animation: fadein .18s ease both;
}
.modal {
  width: 392px;
  background: #242C3E;
  border: 1px solid var(--hairline-2);
  border-radius: var(--r-lg);
  padding: 24px;
  display: flex; flex-direction: column; gap: 13px;
  box-shadow: 0 30px 70px -28px rgba(0, 0, 0, .5);
  animation: rise .28s cubic-bezier(.22, 1, .36, 1) both;
}
.modal h3 { font-size: 15.5px; color: var(--text); font-weight: 640; }
.modal label { display: flex; flex-direction: column; gap: 6px; font-size: 12px; color: var(--text-3); }
.modal input, .modal select {
  height: 36px;
  background: #242C3E;
  border: 1px solid var(--hairline);
  border-radius: var(--r-sm);
  color: var(--text);
  padding: 0 11px;
  font-size: 13.5px;
  outline: none;
  transition: border-color .16s, box-shadow .16s;
}
.modal input:focus, .modal select:focus {
  border-color: rgba(99, 102, 241, .8);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, .16);
}
.modal-btns { display: flex; gap: 10px; justify-content: flex-end; margin-top: 4px; }
.modal-btns .btn, .modal-btns .btn-primary { height: 34px; padding: 0 15px; }
.modal-err { color: var(--coral); font-size: 12px; min-height: 16px; }
.check-row { display: flex; align-items: center; gap: 8px; color: var(--text-2); font-size: 12px; }
.check-row input { width: auto; height: auto; accent-color: var(--indigo); }

/* ================= 提示条 ================= */
.hub-notice {
  margin: 0 auto 20px;
  max-width: 1220px;
  padding: 12px 16px;
  background: linear-gradient(90deg, rgba(56, 189, 248, .13), rgba(99, 102, 241, .07));
  border: 1px solid rgba(56, 189, 248, .26);
  border-left: 3px solid var(--cyan);
  border-radius: var(--r-sm);
  font-size: 12.5px;
  color: var(--text-2);
  line-height: 1.8;
}
.hub-notice b { color: var(--text); font-weight: 620; }

/* ================= 学习情况总览 ================= */
.ov-card {
  background: #242C3E;
  border: 1px solid var(--hairline);
  border-radius: var(--r-lg);
  padding: 20px 22px;
  margin-bottom: 16px;
  box-shadow: var(--sh-1);
}
.ov-head { display: flex; align-items: center; gap: 12px; margin-bottom: 15px; }
.ov-avatar {
  width: 40px; height: 40px; border-radius: 13px;
  background: var(--g-brand);
  color: #fff; font-size: 17px; font-weight: 660;
  display: flex; align-items: center; justify-content: center;
  box-shadow: var(--glow-indigo);
}
.ov-name { font-size: 16.5px; font-weight: 640; color: var(--text); }
.ov-username { font-size: 11.5px; color: var(--text-3); margin-left: 8px; font-weight: 400; }
.ov-cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(228px, 1fr)); gap: 13px; }
.ov-col {
  background: #2A3347;
  border: 1px solid var(--hairline);
  border-radius: var(--r);
  padding: 14px 15px;
}
.ov-col h5 {
  font-size: 12.5px; color: var(--text-2); margin-bottom: 11px; font-weight: 620;
  letter-spacing: .3px;
  padding-bottom: 8px; border-bottom: 1px solid var(--hairline);
}
.ov-row { display: flex; justify-content: space-between; font-size: 12.5px; padding: 5.5px 0; color: var(--text-2); }
.ov-row b { color: var(--text); font-weight: 620; }
.ov-row b.ok { color: var(--green); }
.ov-row b.part { color: var(--yellow); }
.ov-row b.err { color: var(--coral); }

/* ================= 代码块（题库里的程序展示） ================= */
.q-code {
  margin: 10px 0;
  padding: 13px 15px;
  background: #1F2635;
  border: 1px solid var(--hairline);
  border-left: 3px solid var(--indigo);
  border-radius: var(--r-sm);
  font-family: Consolas, "Cascadia Mono", "Courier New", monospace;
  font-size: 12.8px;
  line-height: 1.72;
  color: #D9E3F7;
  white-space: pre;
  overflow-x: auto;
  tab-size: 4;
}

/* ================= 动效 ================= */
@keyframes rise {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes fadein {
  from { opacity: 0; }
  to { opacity: 1; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* ================= 窄屏 ================= */
@media (max-width: 720px) {
  .hub-topbar { padding: 0 14px; gap: 8px; flex-wrap: wrap; height: auto; min-height: 58px; }
  .hub-main { padding: 26px 16px 50px; }
  .auth-card { width: 100%; padding: 34px 24px 22px; }
  .modal { width: calc(100vw - 32px); }
}
