/* ============================================================
   入学教育互动平台 - 共享样式
   设计：深空科技风 · 紫色霓虹 · 呼应 selftest.hnxm.top
   ============================================================ */

:root {
  --bg-deep: #0a0618;
  --bg-card: rgba(255, 255, 255, 0.06);
  --primary: #8b5cf6;
  --primary-light: #a78bfa;
  --primary-glow: rgba(139, 92, 246, 0.45);
  --accent-cyan: #22d3ee;
  --accent-pink: #f472b6;
  --accent-gold: #fbbf24;
  --accent-green: #34d399;
  --text-main: #f3f0ff;
  --text-dim: #a29bbb;
  --grad-hero: linear-gradient(135deg, #7c3aed 0%, #a855f7 45%, #22d3ee 100%);
  --grad-btn: linear-gradient(135deg, #8b5cf6, #6d28d9);
  --radius-lg: 20px;
  --radius-md: 14px;
}

* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body { height: 100%; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", "Segoe UI", sans-serif;
  background: var(--bg-deep);
  color: var(--text-main);
  overflow-x: hidden;
}

/* ---------- 背景星云 ---------- */
.nebula-bg {
  position: fixed;
  inset: 0;
  z-index: -2;
  background:
    radial-gradient(ellipse 80% 50% at 20% 0%, rgba(124, 58, 237, 0.25), transparent 60%),
    radial-gradient(ellipse 60% 40% at 85% 15%, rgba(34, 211, 238, 0.15), transparent 60%),
    radial-gradient(ellipse 70% 60% at 50% 100%, rgba(244, 114, 182, 0.12), transparent 60%),
    var(--bg-deep);
}

.starfield {
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
}

/* ---------- 学生端布局 ---------- */
.app-shell {
  max-width: 480px;
  margin: 0 auto;
  min-height: 100vh;
  padding: 20px 18px 90px;
  position: relative;
}

.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 18px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 800;
  font-size: 17px;
}

.brand .logo-dot {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  background: var(--grad-hero);
  display: grid;
  place-items: center;
  font-size: 16px;
  box-shadow: 0 0 18px var(--primary-glow);
}

.user-chip {
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--bg-card);
  border: 1px solid rgba(139, 92, 246, 0.35);
  padding: 6px 12px;
  border-radius: 999px;
  font-size: 12px;
  color: var(--text-dim);
}

/* ---------- 卡片 ---------- */
.card {
  background: var(--bg-card);
  border: 1px solid rgba(255, 255, 255, 0.09);
  border-radius: var(--radius-lg);
  padding: 20px;
  backdrop-filter: blur(12px);
  margin-bottom: 16px;
}

.card-title {
  font-size: 15px;
  font-weight: 700;
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.card-title .tag {
  font-size: 10px;
  padding: 2px 8px;
  border-radius: 99px;
  background: rgba(139, 92, 246, 0.25);
  color: var(--primary-light);
}

/* ---------- 按钮 ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: none;
  cursor: pointer;
  font-family: inherit;
  font-size: 15px;
  font-weight: 700;
  color: #fff;
  padding: 13px 22px;
  border-radius: var(--radius-md);
  background: var(--grad-btn);
  box-shadow: 0 6px 20px rgba(109, 40, 217, 0.4);
  transition: transform 0.15s, box-shadow 0.15s, opacity 0.15s;
  user-select: none;
}

.btn:active { transform: scale(0.96); }

.btn:disabled { opacity: 0.45; box-shadow: none; }

.btn-outline {
  background: transparent;
  border: 1.5px solid rgba(139, 92, 246, 0.55);
  color: var(--primary-light);
  box-shadow: none;
}

.btn-cyan {
  background: linear-gradient(135deg, #06b6d4, #0891b2);
  box-shadow: 0 6px 20px rgba(6, 182, 212, 0.35);
}

.btn-block { width: 100%; }

.btn-sm { padding: 8px 14px; font-size: 13px; border-radius: 10px; }

/* ---------- 表单 ---------- */
.form-group { margin-bottom: 15px; }

.form-label {
  display: block;
  font-size: 13px;
  color: var(--text-dim);
  margin-bottom: 7px;
  font-weight: 600;
}

.form-input, .form-select {
  width: 100%;
  background: rgba(255, 255, 255, 0.07);
  border: 1.5px solid rgba(255, 255, 255, 0.14);
  border-radius: var(--radius-md);
  padding: 13px 15px;
  color: var(--text-main);
  font-size: 15px;
  font-family: inherit;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.form-input:focus, .form-select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.2);
}

.form-select option { background: #1c1533; }

/* ---------- 底部导航（学生端） ---------- */
.tab-bar {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: 480px;
  background: rgba(12, 8, 26, 0.92);
  backdrop-filter: blur(16px);
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  display: flex;
  z-index: 50;
  padding-bottom: env(safe-area-inset-bottom);
}

.tab-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: 10px 0 8px;
  color: var(--text-dim);
  font-size: 11px;
  cursor: pointer;
  transition: color 0.2s;
  user-select: none;
}

.tab-item .tab-icon { font-size: 21px; }

.tab-item.active { color: var(--primary-light); }

.tab-item.active .tab-icon {
  filter: drop-shadow(0 0 8px var(--primary-glow));
}

/* ---------- 弹幕输入 ---------- */
.danmu-bar {
  position: fixed;
  bottom: 66px;
  left: 50%;
  transform: translateX(-50%);
  width: calc(100% - 24px);
  max-width: 456px;
  display: flex;
  gap: 9px;
  z-index: 49;
}

.danmu-bar .form-input { flex: 1; }

/* ---------- Hero ---------- */
.hero {
  text-align: center;
  padding: 36px 20px 26px;
  position: relative;
}

.hero-title {
  font-size: 30px;
  font-weight: 900;
  line-height: 1.25;
  background: var(--grad-hero);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  margin-bottom: 10px;
}

.hero-sub { color: var(--text-dim); font-size: 13.5px; line-height: 1.7; }

/* ---------- 选项列表 ---------- */
.option-btn {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  background: rgba(255, 255, 255, 0.06);
  border: 1.5px solid rgba(255, 255, 255, 0.12);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  color: var(--text-main);
  font-size: 15px;
  font-family: inherit;
  margin-bottom: 11px;
  cursor: pointer;
  transition: all 0.2s;
  text-align: left;
}

.option-btn:active { transform: scale(0.98); }

.option-btn .opt-key {
  width: 30px;
  height: 30px;
  border-radius: 9px;
  display: grid;
  place-items: center;
  font-weight: 800;
  font-size: 14px;
  background: rgba(139, 92, 246, 0.22);
  color: var(--primary-light);
  flex-shrink: 0;
}

.option-btn.correct {
  border-color: var(--accent-green);
  background: rgba(52, 211, 153, 0.13);
}

.option-btn.correct .opt-key { background: var(--accent-green); color: #06301f; }

.option-btn.wrong {
  border-color: var(--accent-pink);
  background: rgba(244, 114, 182, 0.12);
}

.option-btn.wrong .opt-key { background: var(--accent-pink); color: #4a0c29; }

/* ---------- 进度条 ---------- */
.progress-track {
  height: 8px;
  border-radius: 99px;
  background: rgba(255, 255, 255, 0.09);
  overflow: hidden;
  margin: 12px 0;
}

.progress-fill {
  height: 100%;
  border-radius: 99px;
  background: var(--grad-hero);
  transition: width 0.35s ease;
}

/* ---------- 徽章 / 标签 ---------- */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 11px;
  border-radius: 99px;
  font-size: 12px;
  font-weight: 700;
}

.badge-purple { background: rgba(139, 92, 246, 0.2); color: var(--primary-light); }
.badge-cyan { background: rgba(34, 211, 238, 0.15); color: var(--accent-cyan); }
.badge-gold { background: rgba(251, 191, 36, 0.15); color: var(--accent-gold); }
.badge-green { background: rgba(52, 211, 153, 0.15); color: var(--accent-green); }
.badge-pink { background: rgba(244, 114, 182, 0.15); color: var(--accent-pink); }

/* ---------- 排行榜 ---------- */
.rank-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 14px;
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.05);
  margin-bottom: 8px;
}

.rank-no {
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  font-weight: 900;
  font-size: 14px;
  border-radius: 9px;
  background: rgba(255, 255, 255, 0.09);
  flex-shrink: 0;
}

.rank-1 .rank-no { background: linear-gradient(135deg, #fbbf24, #d97706); color: #3b2103; }
.rank-2 .rank-no { background: linear-gradient(135deg, #cbd5e1, #94a3b8); color: #1e293b; }
.rank-3 .rank-no { background: linear-gradient(135deg, #d97706, #b45309); color: #3b1c03; }

.rank-info { flex: 1; min-width: 0; }
.rank-name { font-weight: 700; font-size: 14.5px; }
.rank-class { font-size: 11.5px; color: var(--text-dim); }
.rank-score { font-weight: 800; color: var(--accent-gold); font-size: 16px; }

/* ---------- 弹幕展示（教师端/学生端墙） ---------- */
.danmu-wall {
  position: relative;
  height: 100%;
  overflow: hidden;
}

.danmu-item {
  position: absolute;
  white-space: nowrap;
  padding: 7px 16px;
  border-radius: 99px;
  font-size: 15px;
  font-weight: 600;
  background: rgba(139, 92, 246, 0.18);
  border: 1px solid rgba(139, 92, 246, 0.4);
  animation: danmuFly linear forwards;
  backdrop-filter: blur(6px);
}

@keyframes danmuFly {
  from { transform: translateX(100vw); }
  to { transform: translateX(-130%); }
}

/* ---------- 开场白播放器（教师投屏） ---------- */
.intro-player {
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: #000;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.intro-matrix {
  position: absolute;
  inset: 0;
  opacity: 0.25;
}

.intro-stage {
  position: relative;
  max-width: 900px;
  width: 92%;
  max-height: 86vh;         /* 超出后滚动，保证新幕始终可见 */
  overflow-y: auto;
  scrollbar-width: none;     /* Firefox 隐藏滚动条 */
  -ms-overflow-style: none;  /* IE/Edge 隐藏滚动条 */
  text-align: center;
  z-index: 2;
  padding: 4vh 20px;
}
.intro-stage::-webkit-scrollbar { display: none; }

/* 终幕二维码（播放器内，学生扫码入口） */
.intro-qr {
  position: absolute;
  bottom: 5vh;
  left: 50%;
  transform: translateX(-50%);
  z-index: 3;
  background: rgba(255,255,255,0.97);
  padding: 16px 16px 12px;
  border-radius: 18px;
  box-shadow: 0 0 50px rgba(139,92,246,0.55);
  opacity: 0;
  visibility: hidden;
  transition: opacity 1.2s ease, visibility 1.2s;
}
.intro-qr.show { opacity: 1; visibility: visible; }
.intro-qr canvas { display: block; width: min(30vh, 230px); height: auto; image-rendering: pixelated; }
.intro-qr-tip {
  font-size: 14px;
  color: #1a1035;
  text-align: center;
  margin-top: 9px;
  font-weight: 800;
  letter-spacing: 1px;
  max-width: min(36vh, 280px);
  word-break: break-all;
}

.intro-line {
  font-size: clamp(18px, 3.2vw, 34px);
  font-weight: 800;
  line-height: 1.9;
  color: #e9e4ff;
  opacity: 0;
  transform: translateY(18px);
  transition: opacity 0.7s ease, transform 0.7s ease;
  text-shadow: 0 0 30px rgba(139, 92, 246, 0.55);
}

.intro-line.show { opacity: 1; transform: translateY(0); }

.intro-line.accent {
  background: var(--grad-hero);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  font-size: clamp(24px, 4.2vw, 46px);
}

.intro-line.typing {
  font-family: "Cascadia Code", Consolas, monospace;
  color: #34d399;
  font-size: clamp(15px, 2.2vw, 24px);
  letter-spacing: 2px;
}

.intro-skip {
  position: fixed;
  right: 28px;
  bottom: 24px;
  z-index: 1001;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: rgba(255, 255, 255, 0.7);
  padding: 9px 20px;
  border-radius: 99px;
  font-size: 13px;
  cursor: pointer;
}

/* ---------- 教师端大屏 ---------- */
.teacher-shell {
  display: grid;
  grid-template-columns: 260px 1fr;
  height: 100vh;
  overflow: hidden;
}

.side-nav {
  background: rgba(12, 8, 26, 0.85);
  border-right: 1px solid rgba(255, 255, 255, 0.07);
  padding: 20px 14px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  overflow-y: auto;
}

.side-title {
  font-size: 16px;
  font-weight: 900;
  padding: 8px 12px 16px;
  display: flex;
  align-items: center;
  gap: 9px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  border-radius: 12px;
  color: var(--text-dim);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  user-select: none;
}

.nav-item:hover { background: rgba(255, 255, 255, 0.05); color: var(--text-main); }

.nav-item.active {
  background: linear-gradient(135deg, rgba(139, 92, 246, 0.3), rgba(139, 92, 246, 0.12));
  color: #fff;
  box-shadow: inset 0 0 0 1px rgba(139, 92, 246, 0.4);
}

.main-area {
  flex: 1;
  overflow-y: auto;
  padding: 26px 30px;
}

.screen-panel { display: none; height: 100%; }
.screen-panel.active { display: block; }

.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 14px;
  margin-bottom: 22px;
}

.stat-card {
  background: var(--bg-card);
  border: 1px solid rgba(255, 255, 255, 0.09);
  border-radius: var(--radius-lg);
  padding: 18px;
  position: relative;
  overflow: hidden;
}

.stat-card::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: var(--grad-hero);
}

.stat-num {
  font-size: 34px;
  font-weight: 900;
  background: var(--grad-hero);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.stat-label { font-size: 12.5px; color: var(--text-dim); margin-top: 4px; }

/* ---------- 答题统计条形图 ---------- */
.bar-row { display: flex; align-items: center; gap: 12px; margin-bottom: 13px; }

.bar-label { width: 190px; font-size: 13.5px; color: var(--text-dim); text-align: right; flex-shrink: 0; }

.bar-track {
  flex: 1;
  height: 30px;
  background: rgba(255, 255, 255, 0.06);
  border-radius: 8px;
  overflow: hidden;
  position: relative;
}

.bar-fill {
  height: 100%;
  background: var(--grad-hero);
  border-radius: 8px;
  display: flex;
  align-items: center;
  padding-left: 10px;
  font-size: 12.5px;
  font-weight: 700;
  min-width: 34px;
  transition: width 0.5s ease;
}

/* ---------- 表格（教师端） ---------- */
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13.5px;
}

.data-table th {
  text-align: left;
  padding: 11px 14px;
  color: var(--text-dim);
  font-weight: 700;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  white-space: nowrap;
}

.data-table td {
  padding: 11px 14px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.data-table tr:hover td { background: rgba(255, 255, 255, 0.03); }

/* ---------- 反应力游戏 ---------- */
.game-arena {
  position: relative;
  height: 62vh;
  min-height: 380px;
  border-radius: var(--radius-lg);
  background:
    radial-gradient(ellipse 70% 60% at 50% 0%, rgba(139, 92, 246, 0.13), transparent 70%),
    rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.1);
  overflow: hidden;
  touch-action: none;
}

.bubble {
  position: absolute;
  width: 68px;
  height: 68px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 24px;
  font-weight: 800;
  cursor: pointer;
  animation: bubblePop 0.25s ease;
  user-select: none;
}

@keyframes bubblePop {
  0% { transform: scale(0); }
  70% { transform: scale(1.12); }
  100% { transform: scale(1); }
}

.bubble.violet { background: linear-gradient(135deg, #8b5cf6, #6d28d9); box-shadow: 0 0 22px var(--primary-glow); }
.bubble.cyan { background: linear-gradient(135deg, #22d3ee, #0891b2); box-shadow: 0 0 22px rgba(34, 211, 238, 0.4); }
.bubble.gold { background: linear-gradient(135deg, #fbbf24, #d97706); box-shadow: 0 0 22px rgba(251, 191, 36, 0.45); }
.bubble.bomb { background: linear-gradient(135deg, #475569, #1e293b); box-shadow: 0 0 22px rgba(71, 85, 105, 0.6); }

.game-hud {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.hud-pill {
  background: var(--bg-card);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 99px;
  padding: 7px 16px;
  font-size: 14px;
  font-weight: 800;
}

.hud-pill.time { color: var(--accent-cyan); min-width: 86px; text-align: center; }
.hud-pill.score { color: var(--accent-gold); }

/* ---------- 猜词游戏 ---------- */
.guess-word {
  font-size: 42px;
  font-weight: 900;
  text-align: center;
  padding: 40px 10px;
  background: var(--grad-hero);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  letter-spacing: 4px;
}

/* ---------- 职业卡片 ---------- */
.career-card {
  border-radius: var(--radius-lg);
  padding: 24px 20px;
  background: linear-gradient(145deg, rgba(139, 92, 246, 0.18), rgba(34, 211, 238, 0.08));
  border: 1px solid rgba(139, 92, 246, 0.35);
  margin-bottom: 14px;
}

.career-emoji { font-size: 46px; text-align: center; margin-bottom: 10px; }

.career-name { font-size: 20px; font-weight: 900; text-align: center; margin-bottom: 6px; }

.career-salary { text-align: center; color: var(--accent-gold); font-weight: 800; font-size: 14px; margin-bottom: 10px; }

.career-desc { font-size: 13.5px; color: var(--text-dim); line-height: 1.8; text-align: center; }

/* ---------- Toast ---------- */
.toast-wrap {
  position: fixed;
  top: 24px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 2000;
  display: flex;
  flex-direction: column;
  gap: 10px;
  align-items: center;
  pointer-events: none;
  width: 92%;
  max-width: 420px;
}

.toast {
  background: rgba(20, 14, 40, 0.95);
  border: 1px solid rgba(139, 92, 246, 0.5);
  color: var(--text-main);
  padding: 12px 22px;
  border-radius: 99px;
  font-size: 14px;
  font-weight: 600;
  box-shadow: 0 10px 32px rgba(0, 0, 0, 0.5);
  animation: toastIn 0.3s ease;
  backdrop-filter: blur(10px);
}

.toast.success { border-color: var(--accent-green); }
.toast.error { border-color: var(--accent-pink); }

@keyframes toastIn {
  from { opacity: 0; transform: translateY(-14px) scale(0.92); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

/* ---------- AI 环节 ---------- */
.ai-chat-bubble {
  max-width: 85%;
  padding: 13px 16px;
  border-radius: 16px;
  font-size: 14px;
  line-height: 1.75;
  margin-bottom: 12px;
}

.ai-chat-bubble.bot {
  background: rgba(139, 92, 246, 0.16);
  border: 1px solid rgba(139, 92, 246, 0.35);
  border-top-left-radius: 4px;
}

.ai-chat-bubble.user {
  background: rgba(34, 211, 238, 0.12);
  border: 1px solid rgba(34, 211, 238, 0.3);
  margin-left: auto;
  border-top-right-radius: 4px;
}

.typing-dots { display: inline-flex; gap: 5px; align-items: center; }

.typing-dots span {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--primary-light);
  animation: dotBounce 1s infinite;
}

.typing-dots span:nth-child(2) { animation-delay: 0.18s; }
.typing-dots span:nth-child(3) { animation-delay: 0.36s; }

@keyframes dotBounce {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.5; }
  30% { transform: translateY(-7px); opacity: 1; }
}

/* ---------- 二维码占位 ---------- */
.qr-box {
  background: #fff;
  border-radius: 16px;
  padding: 12px;
  display: inline-block;
}

/* ---------- 动画工具 ---------- */
@keyframes floatY {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-9px); }
}

.float { animation: floatY 3.2s ease-in-out infinite; }

@keyframes pulseGlow {
  0%, 100% { box-shadow: 0 0 16px var(--primary-glow); }
  50% { box-shadow: 0 0 34px var(--primary-glow); }
}

.pulse { animation: pulseGlow 2.4s ease-in-out infinite; }

.fade-in { animation: fadeInUp 0.45s ease both; }

@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(16px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ---------- 滚动条 ---------- */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(139, 92, 246, 0.35); border-radius: 99px; }
::-webkit-scrollbar-thumb:hover { background: rgba(139, 92, 246, 0.6); }

/* ---------- 响应式 ---------- */
@media (max-width: 768px) {
  .teacher-shell { grid-template-columns: 1fr; }
  .side-nav {
    flex-direction: row;
    overflow-x: auto;
    border-right: none;
    border-bottom: 1px solid rgba(255, 255, 255, 0.07);
  }
  .side-title { display: none; }
  .nav-item { white-space: nowrap; }
  .main-area { padding: 18px 14px; }
  .bar-label { width: 110px; font-size: 12px; }
}
