:root {
  --pri: #4f46e5;
  --pri2: #7c3aed;
  --grad: linear-gradient(135deg, #4f46e5, #7c3aed);
  --danger: #e11d48;
  --ok: #16a34a;
  --bg: #eef1f8;
  --card: #ffffff;
  --line: #e5e9f2;
  --text: #1e2434;
  --muted: #6b7280;
  --radius: 14px;
  --shadow: 0 6px 24px rgba(30, 41, 90, .08);
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
}
button { font-family: inherit; cursor: pointer; }
input, textarea, select { font-family: inherit; }
a { color: var(--pri); text-decoration: none; }

/* ---------- 通用按钮 ---------- */
.btn {
  border: none; border-radius: 10px; padding: 9px 16px; font-size: 14px;
  background: #eef0f6; color: var(--text); transition: all .15s; white-space: nowrap;
}
.btn:hover { background: #e2e6f0; }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn-pri { background: var(--grad); color: #fff; box-shadow: 0 4px 14px rgba(79, 70, 229, .28); }
.btn-pri:hover { filter: brightness(1.08); }
.btn-danger { background: #fde8ec; color: var(--danger); }
.btn-danger:hover { background: #fbd3db; }
.btn-sm { padding: 5px 10px; font-size: 13px; border-radius: 8px; }
.btn-block { width: 100%; padding: 12px; font-size: 15px; }
.btn-ghost { background: transparent; color: var(--pri); }
.btn-ghost:hover { background: #eef0ff; }

/* ---------- 输入 ---------- */
.inp, .sel, textarea.inp {
  width: 100%; border: 1px solid var(--line); background: #fbfcff;
  border-radius: 10px; padding: 10px 12px; font-size: 14px; outline: none;
  transition: border .15s, box-shadow .15s; color: var(--text);
}
.inp:focus, .sel:focus, textarea.inp:focus {
  border-color: var(--pri); box-shadow: 0 0 0 3px rgba(79, 70, 229, .12); background: #fff;
}
.lbl { display: block; font-size: 13px; margin: 12px 0 6px; color: #374151; }
.sel { width: auto; }

/* ---------- 卡片 ---------- */
.card {
  background: var(--card); border-radius: var(--radius);
  box-shadow: var(--shadow); border: 1px solid var(--line);
}

/* ---------- 徽章 / 圆点 ---------- */
.badge {
  display: inline-flex; align-items: center; gap: 4px; font-size: 12px;
  padding: 2px 8px; border-radius: 999px; background: #f0f0f5; color: #4b5563;
}
.badge-ok { background: #e7f7ee; color: var(--ok); }
.badge-off { background: #f1f2f5; color: #9ca3af; }
.badge-warn { background: #fef3e2; color: #b45309; }
.badge-red { background: #fde8ec; color: var(--danger); }
.badge-pri { background: #eceafe; color: var(--pri); }
.dot { width: 8px; height: 8px; border-radius: 50%; background: #cbd5e1; display: inline-block; }
.dot.on { background: #22c55e; box-shadow: 0 0 0 4px rgba(34, 197, 94, .18); }
.dot.off { background: #cbd5e1; }
.muted { color: var(--muted); }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; letter-spacing: 1px; }
.row { display: flex; align-items: center; gap: 8px; }
.spread { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.grow { flex: 1; }
.hide { display: none !important; }

/* ---------- Toast ---------- */
#toastBox {
  position: fixed; top: 18px; left: 50%; transform: translateX(-50%);
  z-index: 9999; display: flex; flex-direction: column; gap: 8px; align-items: center;
  pointer-events: none;
}
.toast {
  background: #1f2430; color: #fff; padding: 10px 18px; border-radius: 10px;
  font-size: 14px; box-shadow: 0 8px 24px rgba(0,0,0,.2); opacity: 0;
  transform: translateY(-6px); transition: all .25s; max-width: 82vw;
}
.toast.show { opacity: 1; transform: translateY(0); }
.toast.ok { background: #0e7a3d; }
.toast.err { background: #c22347; }

/* ---------- 认证页 ---------- */
.auth-bg {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  padding: 24px; background: radial-gradient(1100px 500px at 10% -10%, #e4e2ff 0%, transparent 60%),
    radial-gradient(900px 500px at 110% 10%, #ffe4ec 0%, transparent 55%), var(--bg);
}
.auth-box { width: 100%; max-width: 420px; }
.brand {
  display: flex; align-items: center; gap: 10px; justify-content: center;
  margin-bottom: 18px; color: var(--text);
}
.brand .logo {
  width: 42px; height: 42px; border-radius: 12px; background: var(--grad);
  color: #fff; display: flex; align-items: center; justify-content: center; font-size: 20px;
  box-shadow: 0 6px 16px rgba(79,70,229,.35);
}
.brand h1 { font-size: 19px; margin: 0; }
.brand p { margin: 2px 0 0; font-size: 12px; color: var(--muted); }
.tabs { display: flex; background: #f1f2f8; padding: 4px; border-radius: 12px; margin-bottom: 16px; }
.tabs button {
  flex: 1; border: none; background: transparent; padding: 9px 0; border-radius: 9px;
  font-size: 14px; color: var(--muted); transition: all .15s;
}
.tabs button.on { background: #fff; color: var(--text); font-weight: 600; box-shadow: 0 2px 8px rgba(0,0,0,.06); }
.auth-pane { padding: 20px 22px 22px; }
.auth-pane h2 { margin: 0 0 4px; font-size: 17px; }
.auth-pane .sub { color: var(--muted); font-size: 13px; margin: 0 0 6px; }

/* ---------- 顶栏 ---------- */
.topbar {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  background: #fff; border-bottom: 1px solid var(--line);
  padding: 0 18px; height: 56px; position: sticky; top: 0; z-index: 50;
}
.topbar .mini-logo { display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: 15px; }
.topbar .mini-logo .logo {
  width: 28px; height: 28px; border-radius: 8px; background: var(--grad); color: #fff;
  display: flex; align-items: center; justify-content: center; font-size: 14px;
}

/* ---------- 管理端布局 ---------- */
.layout { display: flex; gap: 18px; padding: 18px; max-width: 1240px; margin: 0 auto; align-items: flex-start; }
.side { width: 270px; flex: 0 0 270px; display: flex; flex-direction: column; gap: 10px; }
.content { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 16px; }
.class-item {
  display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 12px;
  cursor: pointer; border: 1px solid transparent; background: #fff;
}
.class-item:hover { background: #f7f8fc; }
.class-item.on { background: #fff; border-color: var(--pri); box-shadow: 0 3px 12px rgba(79,70,229,.12); }
.class-item .cname { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.class-item .tag { font-size: 11px; color: var(--muted); }

/* 通知弹层消息卡片 */
.msg-item { display: flex; gap: 12px; padding: 12px; border-bottom: 1px solid var(--line); align-items: flex-start; }
.msg-item:last-child { border-bottom: none; }
.msg-bar { width: 4px; border-radius: 4px; flex: 0 0 4px; height: 44px; margin-top: 2px; }

/* ---------- 教室端 ---------- */
.room-stage {
  min-height: 100vh; background: radial-gradient(1000px 600px at 80% -20%, #1e1b4b 0%, transparent 55%),
    radial-gradient(800px 500px at -10% 110%, #312e81 0%, transparent 50%), #111827;
  color: #fff; display: flex; flex-direction: column;
}
.room-top {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 14px 20px; background: rgba(255,255,255,.04); border-bottom: 1px solid rgba(255,255,255,.08);
  position: sticky; top: 0; z-index: 10; backdrop-filter: blur(6px);
}
.room-main { flex: 1; display: flex; align-items: center; justify-content: center; flex-direction: column; gap: 18px; padding: 30px; }
.waiting h2 { font-size: clamp(24px, 5vw, 42px); margin: 0; letter-spacing: 2px; }
.pulse { animation: pulse 2s infinite; }
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: .45; } }
.big-clock { font-size: clamp(52px, 10vw, 96px); font-weight: 700; letter-spacing: 4px; line-height: 1; }
.chip {
  display: inline-flex; align-items: center; gap: 8px; border: 1px solid rgba(255,255,255,.18);
  padding: 8px 14px; border-radius: 999px; font-size: 14px; color: #e5e7eb;
  background: rgba(255,255,255,.05); backdrop-filter: blur(4px);
}
.chip .dot { background: #22c55e; box-shadow: 0 0 0 4px rgba(34,197,94,.25); }
.chip .dot.gray { background: #6b7280; box-shadow: none; }

/* 绑定面板 */
.bind-card {
  background: rgba(255,255,255,.06); border: 1px solid rgba(255,255,255,.16);
  border-radius: 20px; padding: 34px 30px; max-width: 460px; width: 100%;
  backdrop-filter: blur(8px);
}
.bind-card h2 { margin: 0 0 6px; font-size: 22px; }
.bind-card .sub { color: #b3b9c9; margin: 0 0 20px; }
.bind-card .inp { background: rgba(255,255,255,.1); border-color: rgba(255,255,255,.25); color: #fff; text-align: center; letter-spacing: 3px; font-size: 18px; }
.bind-card .inp::placeholder { color: #9aa1b3; letter-spacing: 0; font-size: 14px; }
.bind-card .btn-pri { background: var(--grad); }

/* 全屏通知弹层 */
.ov {
  position: fixed; inset: 0; z-index: 500; display: flex; align-items: center; justify-content: center;
  background: #000; padding: 3vh;
}
.ov .ov-inner {
  width: 100%; height: 100%; border-radius: 18px; background: #fff; color: #111;
  display: flex; flex-direction: column; overflow: hidden;
  box-shadow: 0 30px 90px rgba(0,0,0,.5);
}
.ov-head {
  display: flex; align-items: center; justify-content: space-between; padding: 12px 22px; color: #fff;
}
.ov-tag { font-size: 18px; font-weight: 700; letter-spacing: 2px; display:flex; align-items:center; gap:10px;}
.ov-x {
  background: rgba(255,255,255,.2); color: #fff; border: none; border-radius: 50%;
  width: 38px; height: 38px; font-size: 20px; line-height: 1;
}
.ov-body { flex: 1; display: flex; align-items: center; justify-content: center; padding: 8px 6vw; text-align: center; }
.ov-body .txt {
  font-size: clamp(26px, 6vw, 64px); font-weight: 800; line-height: 1.35; word-break: break-word;
  max-height: 60vh; overflow: auto; text-shadow: 0 2px 10px rgba(0,0,0,.05);
}
.ov-foot {
  padding: 10px 22px; display: flex; justify-content: space-between; color: #6b7280; font-size: 13px;
}

/* 响应式 */
@media (max-width: 860px) {
  .layout { flex-direction: column; padding: 12px; }
  .side { width: 100%; flex: none; }
  .side-scroll { display: flex; gap: 8px; overflow-x: auto; }
  .side-scroll .class-item { min-width: 180px; }
  .topbar { padding: 0 10px; }
  .ov-body .txt { font-size: 26px; }
}

.swatches { display: flex; gap: 8px; align-items: center; }
.sw { width: 24px; height: 24px; border-radius: 50%; cursor: pointer; border: 2px solid transparent; }
.sw.on { border-color: #1f2430; box-shadow: 0 0 0 2px #fff inset; }
.empty-state { text-align: center; padding: 60px 20px; color: var(--muted); }
.empty-state .big { font-size: 44px; }

/* ---------- 语言切换 ---------- */
.language-list { display: inline-flex; align-items: center; gap: 4px; font-size: 13px; }
.language-list a { color: #6b7280; text-decoration: none; padding: 3px 9px; border-radius: 8px; white-space: nowrap; }
.language-list a:hover { color: #247a8c; }
.language-list a.curr { color: #111827; font-weight: 700; background: #eef1f7; }
.language-list.floating { position: fixed; top: 14px; right: 16px; z-index: 60; background: #fff; padding: 4px 6px; border-radius: 10px; box-shadow: 0 2px 10px rgba(0,0,0,.08); }
.language-list.on-dark a { color: rgba(255,255,255,.65); }
.language-list.on-dark a:hover { color: #fff; }
.language-list.on-dark a.curr { color: #fff; background: rgba(255,255,255,.16); }

/* ---------- 返回首页 ---------- */
.back-home { position: fixed; top: 16px; left: 18px; z-index: 60; font-size: 13px; color: var(--muted); }
.back-home:hover { color: var(--pri); }

/* ---------- 申请激活卡号 ---------- */
.req-box { margin-top: 16px; border: 1px dashed #f0c98a; background: #fffaf1; border-radius: 12px; padding: 13px 15px; }
.req-box.hl { animation: reqHl 1.3s ease 2; }
@keyframes reqHl {
  0%, 100% { box-shadow: 0 0 0 0 rgba(245, 158, 11, 0); }
  50% { box-shadow: 0 0 0 4px rgba(245, 158, 11, .28); }
}
.req-h { font-weight: 700; font-size: 13.5px; color: #b45309; margin-bottom: 6px; }
.req-p { margin: 0 0 9px; font-size: 12.5px; line-height: 1.75; color: #7c5a1e; }
.req-p .mono { font-size: 12.5px; color: #92400e; }
