/* ============================================================
   课签 ClassSign —— 设计系统
   ============================================================ */
:root {
  --primary: #4f46e5;
  --primary-600: #4f46e5;
  --primary-500: #6366f1;
  --primary-100: #eef2ff;
  --primary-50: #f5f7ff;
  --grad: linear-gradient(135deg, #4f46e5 0%, #7c3aed 100%);
  --success: #10b981;
  --success-bg: #ecfdf5;
  --warning: #f59e0b;
  --warning-bg: #fffbeb;
  --danger: #ef4444;
  --danger-bg: #fef2f2;
  --info: #0ea5e9;
  --info-bg: #f0f9ff;
  --text: #1e293b;
  --text-2: #475569;
  --text-3: #94a3b8;
  --line: #e2e8f0;
  --bg: #f4f5fa;
  --card: #ffffff;
  --radius: 14px;
  --radius-sm: 10px;
  --shadow: 0 1px 3px rgba(15, 23, 42, .06), 0 4px 16px rgba(15, 23, 42, .05);
  --shadow-lg: 0 8px 32px rgba(15, 23, 42, .14);
  --font: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", "Segoe UI", sans-serif;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--primary); text-decoration: none; }
button { font-family: inherit; }
h1, h2, h3, h4 { font-weight: 600; }
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 4px; }

/* ============ 通用布局 ============ */
.container { max-width: 1080px; margin: 0 auto; padding: 0 20px; }
.page { padding: 24px 0 48px; }
.page-title { font-size: 22px; margin-bottom: 4px; }
.page-sub { color: var(--text-3); font-size: 13px; margin-bottom: 20px; }
.row { display: flex; align-items: center; gap: 10px; }
.row.between { justify-content: space-between; }
.row.wrap { flex-wrap: wrap; }
.grow { flex: 1; }
.mt8{margin-top:8px}.mt12{margin-top:12px}.mt16{margin-top:16px}.mt24{margin-top:24px}
.mb8{margin-bottom:8px}.mb12{margin-bottom:12px}.mb16{margin-bottom:16px}
.muted { color: var(--text-3); font-size: 13px; }
.small { font-size: 13px; }
.bold { font-weight: 600; }
.center { text-align: center; }

/* ============ 卡片 ============ */
.card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 20px; }
.card.flat { box-shadow: none; border: 1px solid var(--line); }
.card-title { font-size: 16px; font-weight: 600; margin-bottom: 12px; display: flex; align-items: center; gap: 8px; }
.card-title .ic { color: var(--primary); }

/* ============ 按钮 ============ */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  border: none; cursor: pointer; border-radius: 10px;
  padding: 9px 18px; font-size: 14px; font-weight: 500;
  background: #eef1f6; color: var(--text);
  transition: all .18s; white-space: nowrap; user-select: none;
}
.btn:hover { filter: brightness(.96); }
.btn:active { transform: scale(.97); }
.btn:disabled { opacity: .5; cursor: not-allowed; transform: none; }
.btn.primary { background: var(--grad); color: #fff; box-shadow: 0 4px 14px rgba(79, 70, 229, .3); }
.btn.primary:hover { filter: brightness(1.06); }
.btn.ghost { background: transparent; border: 1px solid var(--line); color: var(--text-2); }
.btn.ghost:hover { border-color: var(--primary); color: var(--primary); background: var(--primary-50); }
.btn.danger { background: var(--danger); color: #fff; }
.btn.danger-ghost { background: var(--danger-bg); color: var(--danger); }
.btn.success { background: var(--success); color: #fff; }
.btn.warning { background: var(--warning); color: #fff; }
.btn.lg { padding: 13px 26px; font-size: 16px; border-radius: 12px; }
.btn.sm { padding: 5px 12px; font-size: 13px; border-radius: 8px; }
.btn.block { width: 100%; }
.btn.icon { padding: 8px; border-radius: 8px; }

/* ============ 表单 ============ */
.field { margin-bottom: 16px; }
.field label { display: block; font-size: 13px; font-weight: 500; color: var(--text-2); margin-bottom: 6px; }
.input, .select, .textarea {
  width: 100%; border: 1.5px solid var(--line); border-radius: 10px;
  padding: 10px 14px; font-size: 14px; font-family: inherit; color: var(--text);
  background: #fff; transition: border .15s, box-shadow .15s; outline: none;
}
.input:focus, .select:focus, .textarea:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(79, 70, 229, .12); }
.textarea { min-height: 90px; resize: vertical; }
.field .hint { font-size: 12px; color: var(--text-3); margin-top: 4px; }
.form-row { display: flex; gap: 12px; }
.form-row > * { flex: 1; }

/* ============ 徽章 / 状态 ============ */
.badge { display: inline-flex; align-items: center; gap: 4px; padding: 3px 10px; border-radius: 99px; font-size: 12px; font-weight: 500; }
.badge.gray { background: #f1f5f9; color: var(--text-2); }
.badge.green { background: var(--success-bg); color: #059669; }
.badge.red { background: var(--danger-bg); color: var(--danger); }
.badge.amber { background: var(--warning-bg); color: #d97706; }
.badge.blue { background: var(--info-bg); color: #0284c7; }
.badge.indigo { background: var(--primary-100); color: var(--primary); }
.badge .dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge.pulse .dot { animation: pulse 1.4s infinite; }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: .3; } }

/* ============ 表格 ============ */
.table-wrap { overflow-x: auto; }
table.tb { width: 100%; border-collapse: collapse; font-size: 14px; }
.tb th { text-align: left; padding: 10px 12px; color: var(--text-3); font-weight: 500; font-size: 13px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.tb td { padding: 11px 12px; border-bottom: 1px solid #f1f5f9; vertical-align: middle; }
.tb tr:last-child td { border-bottom: none; }
.tb tr:hover td { background: #f8fafc; }

/* ============ 标签页 ============ */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 18px; overflow-x: auto; }
.tabs .tab {
  padding: 10px 16px; cursor: pointer; color: var(--text-2); font-size: 14px;
  border-bottom: 2px solid transparent; white-space: nowrap; transition: all .15s;
  display: flex; align-items: center; gap: 6px;
}
.tabs .tab:hover { color: var(--primary); }
.tabs .tab.on { color: var(--primary); font-weight: 600; border-bottom-color: var(--primary); }
.tabs .tab .cnt { background: var(--danger); color: #fff; border-radius: 8px; padding: 0 6px; font-size: 11px; min-width: 17px; text-align: center; }

/* ============ 弹窗 ============ */
.mask { position: fixed; inset: 0; background: rgba(15, 23, 42, .45); z-index: 90; display: flex; align-items: center; justify-content: center; padding: 20px; animation: fadeIn .18s; }
.modal { background: #fff; border-radius: 18px; width: 100%; max-width: 520px; max-height: 88vh; display: flex; flex-direction: column; animation: pop .22s cubic-bezier(.3, 1.4, .6, 1); box-shadow: var(--shadow-lg); }
.modal.wide { max-width: 760px; }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 18px 22px 0; }
.modal-head h3 { font-size: 17px; }
.modal-body { padding: 16px 22px; overflow-y: auto; }
.modal-foot { padding: 14px 22px 18px; display: flex; gap: 10px; justify-content: flex-end; }
@keyframes pop { from { transform: scale(.92) translateY(12px); opacity: 0; } }
@keyframes fadeIn { from { opacity: 0; } }

/* ============ Toast ============ */
#toasts { position: fixed; top: 18px; left: 50%; transform: translateX(-50%); z-index: 200; display: flex; flex-direction: column; gap: 8px; align-items: center; }
.toast { background: #1e293b; color: #fff; padding: 10px 20px; border-radius: 12px; font-size: 14px; box-shadow: var(--shadow-lg); animation: pop .25s; display: flex; gap: 8px; align-items: center; max-width: 86vw; }
.toast.ok { background: #059669; }
.toast.err { background: var(--danger); }

/* ============ 头像 ============ */
.avatar { border-radius: 50%; background: var(--grad); color: #fff; display: inline-flex; align-items: center; justify-content: center; font-weight: 600; overflow: hidden; flex-shrink: 0; }
.avatar img { width: 100%; height: 100%; object-fit: cover; }

/* ============ 统计卡 ============ */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 14px; }
.stat { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px 18px; display: flex; flex-direction: column; gap: 2px; }
.stat .v { font-size: 26px; font-weight: 700; font-family: "DIN Alternate", var(--font); }
.stat .l { font-size: 13px; color: var(--text-3); }
.stat .ic { width: 36px; height: 36px; border-radius: 10px; display: flex; align-items: center; justify-content: center; margin-bottom: 8px; }
.stat .ic.i1 { background: var(--primary-100); color: var(--primary); }
.stat .ic.i2 { background: var(--success-bg); color: var(--success); }
.stat .ic.i3 { background: var(--warning-bg); color: var(--warning); }
.stat .ic.i4 { background: var(--info-bg); color: var(--info); }

/* ============ 空状态 ============ */
.empty { text-align: center; padding: 44px 20px; color: var(--text-3); }
.empty .ic { font-size: 44px; margin-bottom: 10px; opacity: .45; }
.empty p { font-size: 14px; }

/* ============ 教师端布局 ============ */
.t-layout { display: flex; min-height: 100vh; }
.t-side { width: 224px; background: #fff; border-right: 1px solid var(--line); display: flex; flex-direction: column; position: fixed; top: 0; bottom: 0; left: 0; z-index: 40; }
.t-logo { display: flex; align-items: center; gap: 10px; padding: 20px 18px 16px; }
.t-logo .mark { width: 34px; height: 34px; border-radius: 9px; background: var(--grad); display: flex; align-items: center; justify-content: center; color: #fff; }
.t-logo b { font-size: 17px; }
.t-nav { flex: 1; padding: 8px 12px; overflow-y: auto; }
.t-nav a { display: flex; align-items: center; gap: 11px; padding: 11px 13px; border-radius: 10px; color: var(--text-2); font-size: 14.5px; margin-bottom: 2px; transition: all .15s; }
.t-nav a:hover { background: #f1f5f9; color: var(--text); }
.t-nav a.on { background: var(--primary-100); color: var(--primary); font-weight: 600; }
.t-nav .grp { font-size: 12px; color: var(--text-3); padding: 14px 13px 6px; }
.t-side .t-foot { padding: 14px; border-top: 1px solid var(--line); }
.t-main { flex: 1; margin-left: 224px; min-width: 0; }
.t-top { height: 60px; background: rgba(255,255,255,.85); backdrop-filter: blur(8px); border-bottom: 1px solid var(--line); display: flex; align-items: center; padding: 0 26px; gap: 14px; position: sticky; top: 0; z-index: 30; }
.t-content { padding: 24px 26px 60px; max-width: 1180px; }
.t-burger { display: none; }

/* ============ 学生端布局 ============ */
.s-shell { padding-bottom: 72px; }
.s-head { background: var(--grad); color: #fff; padding: 22px 20px 58px; position: relative; border-radius: 0 0 26px 26px; }
.s-head .row b { font-size: 17px; }
.s-body { padding: 0 16px; margin-top: -40px; position: relative; z-index: 2; }
.s-tabbar { position: fixed; bottom: 0; left: 0; right: 0; background: #fff; border-top: 1px solid var(--line); display: flex; z-index: 40; padding-bottom: env(safe-area-inset-bottom); }
.s-tabbar a { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 9px 0 7px; color: var(--text-3); font-size: 11px; position: relative; }
.s-tabbar a.on { color: var(--primary); }
.s-tabbar a .bdg { position: absolute; top: 4px; right: calc(50% - 22px); background: var(--danger); color: #fff; border-radius: 8px; min-width: 16px; height: 16px; font-size: 10px; display: flex; align-items: center; justify-content: center; padding: 0 4px; }

/* ============ 课程卡 ============ */
.course-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 16px; }
.course-card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; cursor: pointer; transition: transform .18s, box-shadow .18s; position: relative; }
.course-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); }
.course-card .cover { height: 76px; position: relative; display: flex; align-items: flex-end; padding: 12px 16px; color: #fff; }
.course-card .cover b { font-size: 16px; text-shadow: 0 1px 4px rgba(0,0,0,.25); }
.course-card .cover .code { position: absolute; top: 10px; right: 12px; font-size: 11px; opacity: .85; background: rgba(255,255,255,.22); padding: 2px 8px; border-radius: 8px; }
.course-card .meta { padding: 12px 16px 14px; }
.course-card .meta .row { margin-bottom: 6px; }
.live-dot { position: absolute; top: 10px; left: 12px; background: #fff; color: var(--danger); border-radius: 99px; padding: 3px 10px; font-size: 11px; font-weight: 700; display: flex; align-items: center; gap: 5px; box-shadow: var(--shadow); }
.live-dot i { width: 7px; height: 7px; border-radius: 50%; background: var(--danger); animation: pulse 1.2s infinite; }

/* ============ 签到相关 ============ */
.method-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.method-card { border: 1.5px solid var(--line); border-radius: 12px; padding: 13px 8px; text-align: center; cursor: pointer; transition: all .15s; }
.method-card:hover { border-color: var(--primary-500); }
.method-card.on { border-color: var(--primary); background: var(--primary-50); color: var(--primary); }
.method-card .ic { display: flex; justify-content: center; margin-bottom: 6px; }
.method-card span { font-size: 13px; }
.check-hero { text-align: center; padding: 30px 10px; }
.check-hero .ok-ring { width: 92px; height: 92px; border-radius: 50%; background: var(--success-bg); color: var(--success); display: flex; align-items: center; justify-content: center; margin: 0 auto 16px; animation: pop .4s cubic-bezier(.3, 1.6, .6, 1); }
.code-input { display: flex; gap: 8px; justify-content: center; }
.code-input input { width: 52px; height: 62px; text-align: center; font-size: 28px; font-weight: 700; border: 2px solid var(--line); border-radius: 12px; outline: none; }
.code-input input:focus { border-color: var(--primary); }
.gesture-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; width: 240px; margin: 0 auto; }
.gesture-grid .gdot { width: 64px; height: 64px; border-radius: 50%; background: #eef1f6; border: 2px solid transparent; display: flex; align-items: center; justify-content: center; cursor: pointer; user-select: none; touch-action: manipulation; transition: all .12s; }
.gesture-grid .gdot.on { background: var(--primary); transform: scale(.9); }
.gesture-grid .gdot.on .gi { color: #fff; font-weight: 700; font-size: 18px; }

/* ============ 大屏 ============ */
.live-shell { min-height: 100vh; background: radial-gradient(1200px 600px at 20% -10%, #1e1b4b 0%, #0f172a 55%); color: #e2e8f0; padding: 26px 34px; }
.live-top { display: flex; align-items: center; gap: 18px; margin-bottom: 22px; flex-wrap: wrap; }
.live-top h1 { font-size: 26px; color: #fff; }
.live-badge { background: rgba(239, 68, 68, .15); color: #fca5a5; border: 1px solid rgba(239, 68, 68, .4); padding: 5px 14px; border-radius: 99px; font-size: 13px; display: flex; align-items: center; gap: 7px; }
.live-count { font-size: 40px; font-weight: 800; color: #fff; font-family: "DIN Alternate", var(--font); }
.live-count small { font-size: 16px; color: #94a3b8; font-weight: 400; }
.live-grid { display: grid; grid-template-columns: 360px 1fr; gap: 24px; }
@media (max-width: 900px) { .live-grid { grid-template-columns: 1fr; } }
.live-panel { background: rgba(255, 255, 255, .05); border: 1px solid rgba(255, 255, 255, .09); border-radius: 20px; padding: 22px; text-align: center; backdrop-filter: blur(6px); }
.live-qr { background: #fff; border-radius: 16px; padding: 14px; display: inline-block; }
.live-code { font-size: 66px; font-weight: 800; letter-spacing: 14px; color: #fff; font-family: "DIN Alternate", var(--font); text-indent: 14px; }
.live-tip { color: #94a3b8; font-size: 14px; margin-top: 10px; }
.live-students { display: flex; flex-wrap: wrap; gap: 9px; align-content: flex-start; }
.live-chip { background: rgba(255, 255, 255, .08); border: 1px solid rgba(255, 255, 255, .12); padding: 7px 13px; border-radius: 99px; font-size: 14px; display: flex; align-items: center; gap: 8px; animation: pop .3s cubic-bezier(.3, 1.5, .6, 1); }
.live-chip.late { border-color: rgba(245, 158, 11, .55); color: #fcd34d; }
.live-chip .avatar { width: 22px; height: 22px; font-size: 11px; }
.progress-track { height: 10px; background: rgba(255, 255, 255, .1); border-radius: 99px; overflow: hidden; margin-top: 8px; }
.progress-fill { height: 100%; background: linear-gradient(90deg, #34d399, #10b981); border-radius: 99px; transition: width .5s; }
.live-actions { display: flex; gap: 12px; margin-top: 20px; flex-wrap: wrap; }
.live-actions .btn { background: rgba(255, 255, 255, .09); color: #e2e8f0; border: 1px solid rgba(255, 255, 255, .14); }
.live-actions .btn.primary { background: var(--grad); border: none; }
.live-actions .btn.danger { background: rgba(239, 68, 68, .18); color: #fca5a5; border-color: rgba(239, 68, 68, .35); }

/* 抽奖动画 */
.lucky-name { font-size: 44px; font-weight: 800; color: #fff; text-align: center; padding: 30px 0; min-height: 130px; display: flex; align-items: center; justify-content: center; font-family: "DIN Alternate", var(--font); }
.lucky-name.flash { animation: luckflash .08s infinite alternate; }
@keyframes luckflash { from { opacity: .55; } }

/* ============ 测验 ============ */
.opt-row { display: flex; align-items: center; gap: 10px; border: 1.5px solid var(--line); border-radius: 12px; padding: 12px 14px; margin-bottom: 10px; cursor: pointer; transition: all .15s; }
.opt-row:hover { border-color: var(--primary-500); }
.opt-row.on { border-color: var(--primary); background: var(--primary-50); }
.opt-row .opt-key { width: 30px; height: 30px; border-radius: 50%; background: #eef1f6; display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 14px; flex-shrink: 0; }
.opt-row.on .opt-key { background: var(--primary); color: #fff; }
.dist-bar { height: 24px; background: #f1f5f9; border-radius: 8px; overflow: hidden; position: relative; margin-bottom: 6px; }
.dist-fill { height: 100%; background: var(--primary-500); border-radius: 8px; transition: width .4s; min-width: 2px; }
.dist-fill.ok { background: var(--success); }
.dist-fill span { position: absolute; right: 8px; top: 0; line-height: 24px; font-size: 12px; color: #fff; }

/* ============ 动画 & 其他 ============ */
.fade-enter-active, .fade-leave-active { transition: opacity .18s, transform .18s; }
.fade-enter-from, .fade-leave-to { opacity: 0; transform: translateY(6px); }
.spin { animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.sk { background: linear-gradient(90deg, #f1f5f9 25%, #e9eef5 50%, #f1f5f9 75%); background-size: 200% 100%; animation: sk 1.2s infinite; border-radius: 8px; }
@keyframes sk { to { background-position: -200% 0; } }

/* 手势网格（大屏演示用） */
.qr-wrap svg { display: block; }

/* ============ 响应式 ============ */
@media (max-width: 860px) {
  .t-side { transform: translateX(-100%); transition: transform .22s; }
  .t-side.open { transform: none; box-shadow: var(--shadow-lg); }
  .t-main { margin-left: 0; }
  .t-burger { display: flex; }
  .t-content { padding: 18px 16px 50px; }
  .t-top { padding: 0 16px; }
  .method-grid { grid-template-columns: repeat(2, 1fr); }
  .form-row { flex-direction: column; gap: 0; }
  .page { padding: 16px 0 40px; }
  .code-input input { width: 42px; height: 54px; font-size: 24px; }
  .live-shell { padding: 18px; }
  .live-code { font-size: 44px; letter-spacing: 8px; }
}
