/* ===========================================================
   课堂互评系统 · 设计系统 v2
   =========================================================== */
:root {
  --brand: #2563eb;
  --brand-dark: #1d4ed8;
  --brand-soft: #eff6ff;
  --ink: #0f172a;
  --ink-2: #334155;
  --muted: #64748b;
  --line: #e6ebf3;
  --line-soft: #f1f5f9;
  --ok: #16a34a;
  --warn: #d97706;
  --danger: #dc2626;

  --grade-a: #16a34a;
  --grade-b: #22c55e;
  --grade-c: #d97706;
  --grade-d: #f97316;
  --grade-e: #ef4444;
  --grade-f: #991b1b;

  --r-sm: 10px;
  --r-md: 14px;
  --r-lg: 18px;
  --r-xl: 24px;

  --shadow-xs: 0 1px 2px rgba(16, 24, 40, .05);
  --shadow-sm: 0 1px 2px rgba(16, 24, 40, .04), 0 8px 24px -18px rgba(16, 24, 40, .28);
  --shadow-md: 0 2px 6px rgba(16, 24, 40, .05), 0 18px 40px -24px rgba(16, 24, 40, .35);
  --shadow-lg: 0 30px 80px -30px rgba(15, 23, 42, .45);
}

* { -webkit-tap-highlight-color: transparent; }

html { scroll-behavior: smooth; }

body {
  min-height: 100vh;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  color: var(--ink);
  background:
    radial-gradient(1100px 520px at 8% -12%, #e0e7ff 0%, rgba(224, 231, 255, 0) 60%),
    radial-gradient(900px 460px at 102% -6%, #dbeafe 0%, rgba(219, 234, 254, 0) 55%),
    #f6f8fc;
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

::selection { background: rgba(37, 99, 235, .18); }

.container { max-width: 1200px; }
.pb-5 { padding-bottom: 3.5rem !important; }

/* ---------- 顶部导航 ---------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 1030;
  background: rgba(255, 255, 255, .84);
  -webkit-backdrop-filter: saturate(180%) blur(14px);
  backdrop-filter: saturate(180%) blur(14px);
  border-bottom: 1px solid rgba(15, 23, 42, .07);
  padding: 12px 0;
  margin-bottom: 26px;
}
.topbar .brand {
  font-weight: 800;
  font-size: 17px;
  letter-spacing: -.02em;
  color: var(--ink);
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.topbar .brand::before {
  content: "🎓";
  font-size: 20px;
  filter: drop-shadow(0 2px 4px rgba(37, 99, 235, .25));
}
.topbar .brand span {
  background: linear-gradient(100deg, var(--brand) 10%, #0ea5e9 90%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

/* ---------- 卡片 ---------- */
.card {
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  background: #fff;
  box-shadow: var(--shadow-sm);
  transition: box-shadow .18s ease, transform .18s ease;
}
.card-header {
  background: linear-gradient(180deg, #fbfcff 0%, #f7f9fe 100%);
  border-bottom: 1px solid var(--line);
  font-weight: 650;
  font-size: 15px;
  color: var(--ink);
  padding: 14px 18px;
  border-radius: var(--r-lg) var(--r-lg) 0 0 !important;
}
.card-body { padding: 18px; }
.card-footer { background: #fbfcff; border-top: 1px solid var(--line); }

.list-group-item {
  border-color: var(--line-soft);
  padding: 12px 16px;
  font-size: 14.5px;
  transition: background .15s ease;
}
.list-group-item:hover { background: #f8faff; }
.list-group-item.active {
  background: var(--brand-soft) !important;
  color: var(--brand-dark) !important;
  border-color: var(--line-soft) !important;
  font-weight: 600;
}

/* ---------- 按钮 ---------- */
.btn { border-radius: var(--r-sm); font-weight: 600; letter-spacing: .01em; transition: all .15s ease; }
.btn:focus-visible { box-shadow: 0 0 0 3px rgba(37, 99, 235, .25); outline: none; }
.btn-primary {
  background: linear-gradient(135deg, #3b82f6 0%, var(--brand) 45%, var(--brand-dark) 100%);
  border: 0;
  box-shadow: 0 6px 16px -8px rgba(37, 99, 235, .75);
}
.btn-primary:hover, .btn-primary:focus { background: linear-gradient(135deg, #4089f8 0%, #2a6cf0 50%, #1a46c8 100%); transform: translateY(-1px); }
.btn-primary:active { transform: translateY(0); }
.btn-success {
  background: linear-gradient(135deg, #22c55e 0%, #16a34a 100%);
  border: 0;
  box-shadow: 0 6px 16px -8px rgba(22, 163, 74, .7);
}
.btn-danger {
  background: linear-gradient(135deg, #f05252 0%, #dc2626 100%);
  border: 0;
  box-shadow: 0 6px 16px -8px rgba(220, 38, 38, .7);
}
.btn-outline-secondary { border-color: #d8e0ec; color: var(--ink-2); background: rgba(255, 255, 255, .6); }
.btn-outline-secondary:hover { background: #fff; border-color: #c3cfe2; color: var(--ink); }
.btn-outline-primary { border-color: #bfd3f8; color: var(--brand); background: rgba(255, 255, 255, .7); }
.btn-outline-primary:hover { background: var(--brand-soft); border-color: #93b4f5; color: var(--brand-dark); }
.btn-lg { border-radius: 12px; padding: .7rem 1.35rem; font-size: 17px; }
.btn-sm { border-radius: 8px; }
.btn-link { text-decoration: none; }

/* ---------- 表单 ---------- */
.form-control, .form-select {
  border-radius: var(--r-sm);
  border-color: #dde4ef;
  padding: .58rem .85rem;
  font-size: 14.5px;
  transition: border-color .15s, box-shadow .15s;
}
.form-control:focus, .form-select:focus {
  border-color: #93b4f5;
  box-shadow: 0 0 0 4px rgba(37, 99, 235, .12);
}
.form-control-lg { border-radius: 12px; }
.form-label { font-weight: 600; color: var(--ink-2); }
.input-group > .form-control { border-radius: var(--r-sm) 0 0 var(--r-sm); }

/* ---------- 表格 ---------- */
.table { --bs-table-bg: transparent; margin-bottom: 0; }
.table > :not(caption) > * > * { padding: 11px 14px; }
.table thead th {
  background: #f8fafd;
  color: var(--muted);
  font-size: 12.5px;
  font-weight: 650;
  letter-spacing: .02em;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}
.table tbody td { border-color: var(--line-soft); font-size: 14.5px; color: var(--ink-2); vertical-align: middle; }
.table tbody tr { transition: background .12s ease; }
.table-hover tbody tr:hover > * { background: #f8faff; }
.table-sm > :not(caption) > * > * { padding: 9px 12px; }
.table-responsive { scrollbar-width: thin; }
.table-responsive::-webkit-scrollbar { width: 8px; height: 8px; }
.table-responsive::-webkit-scrollbar-thumb { background: #d9e2ef; border-radius: 8px; }
.table-responsive::-webkit-scrollbar-track { background: transparent; }
.table-light { --bs-table-bg: #f8fafd; }

/* ---------- 徽章 ---------- */
.badge {
  font-weight: 600;
  border-radius: 999px;
  padding: .38em .7em;
  letter-spacing: .01em;
}
.badge.bg-light { background: #f4f7fc !important; color: var(--ink-2) !important; }

/* ---------- 进度条 ---------- */
.progress { background: #eef2f9; border-radius: 999px; overflow: hidden; }
.progress-bar {
  background: linear-gradient(90deg, #3b82f6 0%, #2563eb 55%, #0ea5e9 100%);
  border-radius: 999px;
  transition: width .45s cubic-bezier(.22, .8, .3, 1);
}

/* ---------- 登录页 ---------- */
.login-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  position: relative;
  overflow: hidden;
  background:
    radial-gradient(900px 500px at 15% 0%, rgba(129, 140, 248, .55) 0%, rgba(129, 140, 248, 0) 60%),
    radial-gradient(700px 460px at 95% 10%, rgba(56, 189, 248, .5) 0%, rgba(56, 189, 248, 0) 55%),
    linear-gradient(140deg, #0f1b3d 0%, #172a5c 45%, #1e3a8a 100%);
}
.login-wrap::before, .login-wrap::after {
  content: "";
  position: absolute;
  border-radius: 50%;
  filter: blur(70px);
  opacity: .55;
  pointer-events: none;
}
.login-wrap::before { width: 420px; height: 420px; left: -120px; bottom: -140px; background: #6366f1; animation: float-slow 14s ease-in-out infinite; }
.login-wrap::after { width: 360px; height: 360px; right: -100px; top: -120px; background: #0ea5e9; animation: float-slow 18s ease-in-out infinite reverse; }
@keyframes float-slow { 0%, 100% { transform: translate3d(0, 0, 0) scale(1); } 50% { transform: translate3d(24px, -18px, 0) scale(1.06); } }

.login-card {
  width: 100%;
  max-width: 420px;
  border-radius: var(--r-xl);
  border: 1px solid rgba(255, 255, 255, .7);
  box-shadow: var(--shadow-lg);
  position: relative;
  z-index: 1;
  animation: rise-in .35s cubic-bezier(.22, .8, .3, 1);
}
@keyframes rise-in { from { opacity: 0; transform: translateY(14px) scale(.985); } to { opacity: 1; transform: none; } }
.login-card .logo { font-size: 44px; line-height: 1; filter: drop-shadow(0 10px 20px rgba(37, 99, 235, .3)); }
.login-card .card-body { padding: 2.4rem 2.2rem 2rem !important; }

/* ---------- 评分按钮 ---------- */
.grade-btn {
  position: relative;
  width: 100%;
  min-height: 78px;
  border: 1.5px solid var(--line);
  background: #fff;
  border-radius: var(--r-md);
  padding: 10px 6px;
  font-weight: 800;
  color: var(--ink-2);
  transition: transform .14s cubic-bezier(.22, .8, .3, 1), box-shadow .16s ease, background .16s ease, border-color .16s ease;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  overflow: hidden;
}
.grade-btn .g { font-size: 28px; line-height: 1.05; display: block; letter-spacing: -.02em; }
.grade-btn .s { font-size: 12px; color: var(--muted); font-weight: 600; }
.grade-btn:hover:not(:disabled) { transform: translateY(-3px); box-shadow: 0 12px 26px -14px rgba(15, 23, 42, .45); }
.grade-btn:active:not(:disabled) { transform: translateY(-1px) scale(.99); }
.grade-btn:disabled { opacity: .5; cursor: not-allowed; }
.grade-btn.g-A { color: var(--grade-a); border-color: #c9ecd4; background: linear-gradient(180deg, #fff 0%, #f3fdf6 100%); }
.grade-btn.g-B { color: #15803d; border-color: #cdebd6; background: linear-gradient(180deg, #fff 0%, #f5fdf7 100%); }
.grade-btn.g-C { color: #b45309; border-color: #f2e3bd; background: linear-gradient(180deg, #fff 0%, #fffdf3 100%); }
.grade-btn.g-D { color: #ea580c; border-color: #fbdcc4; background: linear-gradient(180deg, #fff 0%, #fff9f3 100%); }
.grade-btn.g-E { color: var(--grade-e); border-color: #f7d3d3; background: linear-gradient(180deg, #fff 0%, #fff6f6 100%); }
.grade-btn.g-F { color: var(--grade-f); border-color: #efc9c9; background: linear-gradient(180deg, #fff 0%, #fff5f5 100%); }

.grade-btn.active { color: #fff !important; border-color: transparent !important; }
.grade-btn.active .s { color: rgba(255, 255, 255, .88) !important; }
.grade-btn.active.g-A { background: linear-gradient(135deg, #22c55e, #15803d); box-shadow: 0 12px 26px -12px rgba(22, 163, 74, .8); }
.grade-btn.active.g-B { background: linear-gradient(135deg, #4ade80, #16a34a); box-shadow: 0 12px 26px -12px rgba(34, 197, 94, .8); }
.grade-btn.active.g-C { background: linear-gradient(135deg, #fbbf24, #d97706); box-shadow: 0 12px 26px -12px rgba(217, 119, 6, .8); }
.grade-btn.active.g-D { background: linear-gradient(135deg, #fb923c, #ea580c); box-shadow: 0 12px 26px -12px rgba(234, 88, 12, .8); }
.grade-btn.active.g-E { background: linear-gradient(135deg, #f87171, #dc2626); box-shadow: 0 12px 26px -12px rgba(220, 38, 38, .8); }
.grade-btn.active.g-F { background: linear-gradient(135deg, #dc2626, #7f1d1d); box-shadow: 0 12px 26px -12px rgba(127, 29, 29, .8); }

/* ---------- 展示者 ---------- */
.presenter-name {
  font-size: clamp(34px, 5.4vw, 58px);
  font-weight: 800;
  line-height: 1.1;
  letter-spacing: -.02em;
  color: var(--ink);
}
.presenter-seq {
  font-size: 13px;
  color: var(--muted);
  font-weight: 550;
  letter-spacing: .02em;
}
@media (max-width: 768px) {
  .presenter-name { font-size: 32px; }
  .grade-btn { min-height: 68px; }
  .grade-btn .g { font-size: 24px; }
  .host-screen { padding: 24px 22px; border-radius: var(--r-lg); }
  .card-body { padding: 14px; }
}
@media (max-width: 576px) {
  .topbar { padding: 10px 0; margin-bottom: 18px; }
  .topbar .brand { font-size: 15px; }
  .topbar .brand::before { font-size: 17px; }
  .container { padding-left: 14px; padding-right: 14px; }
  .toast-item { min-width: 0; }
  #toast-box { left: 14px; right: 14px; }
}

/* ---------- 深色主持大屏 ---------- */
.host-screen {
  position: relative;
  color: #fff;
  border-radius: var(--r-xl);
  padding: 34px 36px;
  overflow: hidden;
  background:
    radial-gradient(700px 320px at 12% -10%, rgba(99, 102, 241, .55) 0%, rgba(99, 102, 241, 0) 60%),
    radial-gradient(600px 300px at 100% 110%, rgba(14, 165, 233, .38) 0%, rgba(14, 165, 233, 0) 60%),
    linear-gradient(135deg, #0b1220 0%, #101c33 55%, #1b2a4d 100%);
  box-shadow: 0 30px 60px -30px rgba(8, 15, 35, .8), inset 0 1px 0 rgba(255, 255, 255, .06);
}
.host-screen::after {
  content: "";
  position: absolute;
  inset: 0;
  background-image: radial-gradient(rgba(255, 255, 255, .05) 1px, transparent 1px);
  background-size: 22px 22px;
  pointer-events: none;
  opacity: .5;
}
.host-screen .presenter-name { color: #fff; }
.host-screen .presenter-seq { color: #94a3b8; }
.host-screen .host-seq-pill {
  display: inline-block;
  padding: 4px 12px;
  border-radius: 999px;
  background: rgba(255, 255, 255, .08);
  border: 1px solid rgba(255, 255, 255, .12);
  color: #cbd5e1;
  font-size: 13px;
  font-weight: 600;
}
.host-screen .host-score-cnt { color: #94a3b8; font-size: 13px; }
.host-screen .host-score-cnt b { color: #fff; font-size: 22px; font-weight: 800; }
.host-screen .host-btn {
  background: rgba(255, 255, 255, .1);
  border: 1px solid rgba(255, 255, 255, .18);
  color: #e2e8f0;
  border-radius: 10px;
  font-size: 14px;
}
.host-screen .host-btn:hover { background: rgba(255, 255, 255, .18); color: #fff; }

/* ---------- 学生端展示者面板 ---------- */
.presenter-panel {
  background: linear-gradient(120deg, #f7fbff 0%, #eef5ff 55%, #f6faff 100%);
  border: 1px solid #e3ecfb;
  border-radius: var(--r-lg);
  padding: 18px 20px;
  margin-bottom: 18px;
}
.presenter-panel .progress { background: #e3ecfb; }

/* ---------- 状态点 ---------- */
.status-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 7px; }
.dot-done { background: #22c55e; box-shadow: 0 0 0 3px rgba(34, 197, 94, .15); }
.dot-presenting { background: var(--brand); box-shadow: 0 0 0 3px rgba(37, 99, 235, .18); animation: pulse 1.4s infinite; }
.dot-waiting { background: #cbd5e1; }
.dot-leave { background: #94a3b8; }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: .35; } }

/* ---------- Toast ---------- */
#toast-box { position: fixed; top: 18px; right: 18px; z-index: 9999; display: flex; flex-direction: column; gap: 10px; }
.toast-item {
  min-width: 230px;
  max-width: 360px;
  padding: 12px 16px;
  border-radius: 12px;
  color: #fff;
  background: #0f172a;
  box-shadow: 0 16px 40px -16px rgba(15, 23, 42, .55);
  font-size: 14px;
  font-weight: 500;
  animation: slideIn .2s cubic-bezier(.22, .8, .3, 1);
  border: 1px solid rgba(255, 255, 255, .08);
}
.toast-item.success { background: linear-gradient(135deg, #22c55e, #15803d); }
.toast-item.error { background: linear-gradient(135deg, #f05252, #b91c1c); }
.toast-item.info { background: linear-gradient(135deg, #3b82f6, #1d4ed8); }
@keyframes slideIn { from { transform: translateY(-10px) scale(.98); opacity: 0; } to { transform: none; opacity: 1; } }

/* ---------- 图例 / 提示 ---------- */
.grade-legend span { display: inline-block; margin-right: 12px; font-size: 12px; color: var(--muted); }
.alert { border-radius: var(--r-md); border: 1px solid transparent; font-size: 14.5px; }
.alert-secondary { background: #f4f7fc; border-color: var(--line); color: var(--ink-2); }
.alert-success { background: #f0fdf4; border-color: #cfefd8; color: #166534; }
.alert-info { background: #eff6ff; border-color: #d3e2fd; color: #1e40af; }
.alert-warning { background: #fffbeb; border-color: #f7e6b8; color: #92400e; }
.alert-danger { background: #fef2f2; border-color: #f7d2d2; color: #991b1b; }

/* ---------- 小工具 ---------- */
.text-muted { color: var(--muted) !important; }
.fw-semibold { font-weight: 600 !important; }
.sticky-top { z-index: 1020; }
.kbd-hint {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12.5px;
  color: var(--muted);
  background: #f6f9fe;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 4px 12px;
}
.kbd {
  display: inline-block;
  padding: 1px 6px;
  border-radius: 6px;
  background: #fff;
  border: 1px solid #dfe6f1;
  box-shadow: 0 1px 0 #e8eef7;
  font-size: 11.5px;
  font-weight: 700;
  color: var(--ink-2);
}
.skeleton {
  background: linear-gradient(90deg, #eef2f8 25%, #f6f9fd 37%, #eef2f8 63%);
  background-size: 400% 100%;
  animation: shimmer 1.3s ease-in-out infinite;
  border-radius: 8px;
}
@keyframes shimmer { 0% { background-position: 100% 50%; } 100% { background-position: 0 50%; } }

/* ---------- 成绩统计小条 ---------- */
.stat-chip {
  display: inline-flex;
  align-items: baseline;
  gap: 7px;
  padding: 7px 13px;
  border-radius: 999px;
  background: #f7faff;
  border: 1px solid var(--line);
  font-size: 12.5px;
  color: var(--muted);
  font-weight: 550;
}
.stat-chip b { font-size: 15px; font-weight: 800; color: var(--ink); letter-spacing: -.01em; }
.stat-chip .up { color: var(--ok); }
.stat-chip .down { color: var(--danger); }
.rank {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border-radius: 999px;
  background: #f2f6fd;
  color: var(--ink-2);
  font-weight: 700;
  font-size: 13.5px;
}
.rank.rank-1 { background: linear-gradient(135deg, #fde68a, #f59e0b); color: #7c2d12; }
.rank.rank-2 { background: linear-gradient(135deg, #e2e8f0, #94a3b8); color: #1e293b; }
.rank.rank-3 { background: linear-gradient(135deg, #fed7aa, #c2410c); color: #fff; }

/* ---------- 动效降级 ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; }
}

/* ---------- 打印（成绩页） ---------- */
@media print {
  body { background: #fff !important; }
  .topbar, .btn, #toast-box { display: none !important; }
  .card { box-shadow: none !important; border-color: #d8dee9 !important; }
  .table thead th { background: #f1f5f9 !important; }
}
