:root {
  --bg: #f5f7fa;
  --card: #ffffff;
  --ink: #1f2937;
  --muted: #6b7280;
  --line: #e5e7eb;
  --brand: #2563eb;
  --brand-d: #1d4ed8;
  --green: #16a34a;
  --red: #dc2626;
  --amber: #d97706;
  --radius: 12px;
  --shadow: 0 1px 3px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.04);
}
* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  background: var(--bg);
  color: var(--ink);
  line-height: 1.6;
}
a { color: var(--brand); text-decoration: none; }
header.topbar {
  background: var(--card);
  border-bottom: 1px solid var(--line);
  padding: 12px 16px;
  display: flex; align-items: center; gap: 16px; flex-wrap: wrap;
  position: sticky; top: 0; z-index: 20;
}
header.topbar .logo { font-weight: 700; font-size: 17px; }
header.topbar nav { display: flex; gap: 6px; flex-wrap: wrap; }
header.topbar nav a {
  padding: 6px 12px; border-radius: 8px; color: var(--muted); font-size: 14px;
}
header.topbar nav a.active, header.topbar nav a:hover { background: #eef2ff; color: var(--brand-d); }
header.topbar .who { margin-left: auto; font-size: 13px; color: var(--muted); display: flex; gap: 10px; align-items: center; }
main { max-width: 960px; margin: 0 auto; padding: 20px 16px 60px; }
.card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 18px; box-shadow: var(--shadow); margin-bottom: 16px;
}
h1 { font-size: 22px; margin: 4px 0 16px; }
h2 { font-size: 17px; margin: 0 0 12px; }
.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
label { font-size: 13px; color: var(--muted); display: block; margin: 10px 0 4px; }
input, select, textarea {
  width: 100%; padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px;
  font-size: 14px; font-family: inherit; background: #fff; color: var(--ink);
}
textarea { min-height: 90px; resize: vertical; }
button, .btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 10px 16px; border: 1px solid transparent; border-radius: 8px;
  background: var(--brand); color: #fff; font-size: 14px; cursor: pointer; font-family: inherit;
}
button:hover { background: var(--brand-d); }
button.ghost { background: #fff; color: var(--brand-d); border-color: var(--line); }
button.ghost:hover { background: #f8fafc; }
button.danger { background: #fff; color: var(--red); border-color: #fecaca; }
button.sm { padding: 6px 10px; font-size: 13px; }
.muted { color: var(--muted); font-size: 13px; }
.tag { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 12px; background: #eef2ff; color: var(--brand-d); }
.tag.green { background: #dcfce7; color: var(--green); }
.tag.amber { background: #fef3c7; color: var(--amber); }
.tag.red { background: #fee2e2; color: var(--red); }
.grid { display: grid; gap: 12px; }
.list { list-style: none; margin: 0; padding: 0; }
.list li { padding: 12px 0; border-bottom: 1px solid var(--line); display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.list li:last-child { border-bottom: none; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { text-align: left; padding: 9px 8px; border-bottom: 1px solid var(--line); }
th { color: var(--muted); font-weight: 600; font-size: 13px; }
.att-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; }
.att-cell {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; background: #fff;
}
.att-cell.present { background: #f0fdf4; border-color: #bbf7d0; }
.att-cell.absent { background: #fef2f2; border-color: #fecaca; }
.dot { width: 12px; height: 12px; border-radius: 50%; border: 2px solid var(--line); flex: 0 0 auto; }
.dot.on { background: var(--green); border-color: var(--green); }
.center { text-align: center; padding: 40px 0; }
.notice { background: #fffbeb; border: 1px solid #fde68a; color: #92400e; padding: 10px 12px; border-radius: 8px; font-size: 13px; margin-bottom: 12px; }
.hidden { display: none !important; }
.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%);
  background: #111827; color: #fff; padding: 10px 16px; border-radius: 10px; font-size: 14px;
  opacity: 0; transition: opacity .2s; z-index: 50; pointer-events: none;
}
.toast.show { opacity: .95; }
.toast.err { background: #b91c1c; }
.hero { text-align: center; padding: 8px 0 18px; }
.hero p { color: var(--muted); margin: 6px 0; }
.roles { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }

/* ---------- 随机点名 ---------- */
.roll-stage {
  margin-top: 14px; border-radius: 14px; padding: 30px 16px; text-align: center;
  background: linear-gradient(150deg, #2563eb, #1d4ed8); color: #fff;
}
.roll-name {
  font-size: 42px; font-weight: 800; letter-spacing: 4px; min-height: 62px;
  display: flex; align-items: center; justify-content: center;
  text-shadow: 0 3px 10px rgba(0,0,0,.22);
}
.roll-name.rolling { opacity: .72; }
.roll-stage .muted { color: rgba(255,255,255,.86); }
.rc-btn {
  padding: 14px 48px; font-size: 17px; font-weight: 700; border-radius: 12px;
  background: #111827; color: #fff; letter-spacing: 5px;
}
.rc-btn:hover { background: #000; }
.rc-btn.stop { background: var(--red); letter-spacing: 5px; }
.rc-btn.stop:hover { background: #b91c1c; }
.rate-btn {
  background: #fff; color: var(--green); border: 2px solid #bbf7d0;
  font-weight: 700; padding: 11px 30px; font-size: 15px;
}
.rate-btn:hover { background: #dcfce7; }
.rate-btn.sel { background: var(--green); color: #fff; border-color: var(--green); }
.chk { display: flex; align-items: center; gap: 6px; margin: 0; font-size: 14px; color: var(--ink); }
.chk input { width: auto; }

/* ---------- 作业选题 ---------- */
.topic-list { display: grid; gap: 6px; margin-top: 4px; }
.topic-item {
  display: flex; align-items: center; gap: 8px; margin: 0; padding: 10px 12px;
  border: 1px solid var(--line); border-radius: 8px; background: #fff;
  font-size: 14px; color: var(--ink); cursor: pointer;
}
.topic-item:hover { border-color: var(--brand); background: #f8fafc; }
.topic-item input { width: auto; }
.topic-item.on { border-color: var(--brand); background: #eef2ff; }

@media (max-width: 560px) { .roles { grid-template-columns: 1fr; } header.topbar nav a { padding: 6px 8px; } }
