/* ============ 全局基础 ============ */
* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

:root {
  --bg: #0b1020;
  --panel: rgba(255, 255, 255, 0.05);
  --panel-2: rgba(255, 255, 255, 0.09);
  --line: rgba(255, 255, 255, 0.1);
  --txt: #e8ecf8;
  --txt-2: #9aa6c4;
  --txt-3: #6b7694;
  --primary: #6366f1;
  --primary-2: #a855f7;
  --green: #22c55e;
  --red: #ef4444;
  --orange: #f59e0b;
  --cyan: #22d3ee;
  --grad: linear-gradient(135deg, #6366f1, #a855f7);
  --radius: 18px;
  --shadow: 0 10px 34px rgba(0, 0, 0, 0.35);
}

html, body { height: 100%; }
body {
  font-family: "PingFang SC", "Microsoft YaHei", "Segoe UI", system-ui, sans-serif;
  background: var(--bg);
  color: var(--txt);
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}
button { font-family: inherit; border: none; background: none; color: inherit; cursor: pointer; }
input, select, textarea { font-family: inherit; color: inherit; }
img { display: block; }

::-webkit-scrollbar { width: 9px; height: 9px; }
::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, 0.14); border-radius: 6px; }
::-webkit-scrollbar-track { background: transparent; }

.icon { width: 1em; height: 1em; fill: currentColor; flex: none; }

/* ============ 按钮 ============ */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 11px 20px; border-radius: 13px;
  font-size: 15px; font-weight: 600; line-height: 1;
  transition: transform 0.12s, filter 0.15s, background 0.15s, opacity 0.15s;
  user-select: none; white-space: nowrap;
}
.btn:active { transform: scale(0.96); }
.btn .icon { font-size: 1.1em; }
.btn.primary { background: var(--grad); color: #fff; box-shadow: 0 6px 18px rgba(124, 92, 246, 0.35); }
.btn.primary:hover { filter: brightness(1.1); }
.btn.ghost { background: var(--panel-2); color: var(--txt); border: 1px solid var(--line); }
.btn.ghost:hover { background: rgba(255, 255, 255, 0.14); }
.btn.danger { background: rgba(239, 68, 68, 0.16); color: #fca5a5; border: 1px solid rgba(239, 68, 68, 0.4); }
.btn.danger:hover { background: rgba(239, 68, 68, 0.3); }
.btn.success { background: rgba(34, 197, 94, 0.16); color: #86efac; border: 1px solid rgba(34, 197, 94, 0.4); }
.btn.success:hover { background: rgba(34, 197, 94, 0.3); }
.btn.warn { background: rgba(245, 158, 11, 0.15); color: #fcd34d; border: 1px solid rgba(245, 158, 11, 0.4); }
.btn.sm { padding: 7px 13px; font-size: 13px; border-radius: 10px; }
.btn.lg { padding: 16px 30px; font-size: 17px; border-radius: 16px; }
.btn:disabled { opacity: 0.45; pointer-events: none; }

/* ============ 输入 ============ */
.ipt, .sel, textarea.ipt {
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 11px 14px;
  font-size: 15px;
  color: var(--txt);
  outline: none;
  transition: border 0.15s, background 0.15s;
  width: 100%;
}
.ipt:focus, .sel:focus { border-color: rgba(129, 110, 247, 0.7); background: rgba(255, 255, 255, 0.1); }
.ipt::placeholder { color: var(--txt-3); }
.sel option { background: #141a30; color: var(--txt); }

/* ============ 头像 ============ */
.av {
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 50%; overflow: hidden; flex: none;
  color: #fff; font-weight: 700;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.18);
}
.av img { width: 100%; height: 100%; object-fit: cover; }
.av-txt { line-height: 1; transform: translateY(0.02em); }

/* ============ Toast ============ */
.toast-wrap {
  position: fixed; top: 24px; left: 50%; transform: translateX(-50%);
  display: flex; flex-direction: column; align-items: center; gap: 10px;
  z-index: 4000; pointer-events: none;
}
.toast {
  display: flex; align-items: center; gap: 9px;
  background: rgba(22, 28, 52, 0.92); backdrop-filter: blur(12px);
  border: 1px solid var(--line);
  padding: 12px 20px; border-radius: 14px;
  font-size: 15px; font-weight: 500;
  box-shadow: var(--shadow);
  opacity: 0; transform: translateY(-12px);
  transition: all 0.25s;
  max-width: 84vw;
}
.toast.show { opacity: 1; transform: translateY(0); }
.toast .icon { font-size: 18px; }
.toast.success .icon { color: var(--green); }
.toast.error .icon { color: var(--red); }
.toast.info .icon { color: var(--cyan); }

/* ============ 模态框 ============ */
.modal-mask {
  position: fixed; inset: 0; z-index: 3000;
  background: rgba(5, 8, 18, 0.66); backdrop-filter: blur(6px);
  display: flex; align-items: center; justify-content: center;
  opacity: 0; transition: opacity 0.2s;
  padding: 20px;
}
.modal-mask.show { opacity: 1; }
.modal {
  width: min(440px, 92vw);
  background: #161c33;
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 26px;
  box-shadow: var(--shadow);
  transform: scale(0.94); transition: transform 0.2s;
}
.modal-mask.show .modal { transform: scale(1); }
.modal-title { display: flex; align-items: center; gap: 10px; font-size: 17px; font-weight: 700; margin-bottom: 16px; }
.modal-title .icon { font-size: 21px; color: #a5b4fc; }
.modal-text { color: var(--txt-2); font-size: 14.5px; line-height: 1.7; margin-bottom: 22px; }
.modal-ipt { margin-bottom: 20px; }
.modal-btns { display: flex; gap: 12px; justify-content: flex-end; }

/* ============ 大模态（面板用）============ */
.modal.wide { width: min(680px, 94vw); max-height: 88vh; overflow: auto; }

/* ============ 通用页面头 ============ */
.page-head { display: flex; align-items: center; gap: 14px; margin-bottom: 22px; }
.page-head h2 { font-size: 21px; display: flex; align-items: center; gap: 10px; }
.page-head h2 .icon { font-size: 24px; color: #a5b4fc; }
.page-head .sp { flex: 1; }

/* ============ 浅色主题（body.light，适合明亮教室投影/班班通） ============ */
body.light {
  --bg: #eef1f8;
  --panel: #ffffff;
  --panel-2: #f2f4fc;
  --line: rgba(15, 23, 42, 0.12);
  --txt: #1f2637;
  --txt-2: #59617a;
  --txt-3: #8b93a9;
  --shadow: 0 10px 30px rgba(15, 23, 42, 0.08);
}
body.light ::-webkit-scrollbar-thumb { background: rgba(15, 23, 42, 0.18); }
body.light .btn.ghost:hover { background: rgba(15, 23, 42, 0.07); }
body.light .ipt, body.light .sel, body.light textarea.ipt { background: #fff; }
body.light .ipt:focus, body.light .sel:focus { background: #fff; border-color: rgba(99, 102, 241, 0.55); }
body.light .sel option { background: #fff; color: var(--txt); }
body.light .toast { background: #fff; }
body.light .modal { background: #fff; }
body.light .modal-title .icon { color: #6366f1; }
body.light .page-head h2 .icon { color: #6366f1; }
