/* ============================================================
 * 班主任小工具箱 —— 样式
 * 零依赖，不加载任何网络字体/图标库（这也是"数据不上传"承诺的一部分）
 * ============================================================ */

:root {
  --bg: #f6f7fb;
  --card: #ffffff;
  --ink: #1f2430;
  --ink-2: #5a6275;
  --ink-3: #8b92a4;
  --line: #e6e8ef;
  --brand: #3b6ef5;
  --brand-soft: #eef3ff;
  --brand-dark: #2b56c9;
  --ok: #16a34a;
  --warn: #e0a100;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(20, 28, 50, .04), 0 8px 24px rgba(20, 28, 50, .06);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
               "Hiragino Sans GB", "Microsoft YaHei", "Helvetica Neue", sans-serif;
  font-size: 15px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

/* ---------------- 顶栏 ---------------- */
.topbar {
  background: rgba(255, 255, 255, .88);
  backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 50;
}
.topbar-inner {
  max-width: 1180px;
  margin: 0 auto;
  padding: 12px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.brand { display: flex; align-items: center; gap: 9px; font-weight: 700; font-size: 16px; }
.brand-mark {
  display: inline-flex; align-items: center; justify-content: center;
  width: 28px; height: 28px; border-radius: 8px;
  background: var(--brand); color: #fff; font-size: 15px;
}
.privacy-pill {
  font-size: 13px;
  color: var(--ok);
  background: #eafaf0;
  border: 1px solid #c6efd6;
  padding: 5px 12px;
  border-radius: 999px;
  white-space: nowrap;
}

/* ---------------- 工具切换标签 ---------------- */
.tabs {
  display: flex;
  gap: 4px;
  background: #eef0f6;
  padding: 4px;
  border-radius: 10px;
}
.tab {
  font-family: inherit;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--ink-2);
  background: transparent;
  border: 0;
  padding: 7px 16px;
  border-radius: 7px;
  cursor: pointer;
  transition: all .16s;
  white-space: nowrap;
}
.tab:hover { color: var(--ink); }
.tab.active {
  background: #fff;
  color: var(--brand);
  box-shadow: 0 1px 3px rgba(20, 28, 50, .1);
}

.tab-panel.hidden { display: none; }

/* ---------------- 随机点名 ---------------- */
.num-input {
  width: 62px;
  font-family: inherit;
  font-size: 13.5px;
  padding: 5px 8px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: #fbfcfe;
  color: var(--ink);
  text-align: center;
}
.num-input:focus { outline: none; border-color: var(--brand); }

.pick-display {
  border: 2px dashed var(--line);
  border-radius: 16px;
  padding: 42px 20px;
  text-align: center;
  background: #fbfcfe;
  transition: border-color .2s, background .2s, transform .12s;
  min-height: 180px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}
.pick-display:active {
  transform: scale(.985);
  border-color: var(--brand);
}
.pick-display.rolling {
  border-color: var(--brand);
  background: #f2f6ff;
}
.pick-display.has-result {
  border-style: solid;
  border-color: var(--brand);
  background: linear-gradient(180deg, #f7faff 0%, #eef3ff 100%);
}

.pick-result {
  font-size: 46px;
  font-weight: 800;
  letter-spacing: 2px;
  color: var(--ink);
  line-height: 1.25;
  word-break: break-all;
  transition: color .15s;
}
.pick-display.rolling .pick-result { color: var(--ink-3); }
.pick-display.has-result .pick-result {
  color: var(--brand);
  animation: popIn .34s cubic-bezier(.2, 1.4, .5, 1);
}

@keyframes popIn {
  0%   { transform: scale(.6); opacity: 0; }
  60%  { transform: scale(1.08); }
  100% { transform: scale(1); opacity: 1; }
}

.pick-sub {
  margin-top: 10px;
  font-size: 13.5px;
  color: var(--ink-3);
}

.pick-history {
  margin-top: 22px;
  border-top: 1px solid var(--line);
  padding-top: 16px;
  display: none;
}
.pick-history.show { display: block; }

.pick-history-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 13px;
  color: var(--ink-3);
  margin-bottom: 10px;
}
.pick-history-list { display: flex; flex-wrap: wrap; gap: 6px; }

.drawn-tag {
  font-size: 12.5px;
  padding: 4px 10px;
  border-radius: 999px;
  background: #eef0f6;
  color: var(--ink-2);
}

/* ---------------- 学号范围设置 ---------------- */
.range-row {
  display: flex;
  align-items: flex-end;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}
.range-field {
  display: flex;
  flex-direction: column;
  gap: 5px;
}
.range-field > span {
  font-size: 12px;
  color: var(--ink-3);
  font-weight: 600;
}
.range-field .num-input { width: 84px; }
.range-field select { padding: 6px 8px; font-size: 13px; }
.range-dash {
  font-size: 18px;
  color: var(--ink-3);
  padding-bottom: 8px;
}

.names-box { margin-top: 4px; }
.names-box.hidden { display: none; }

.names-status {
  font-size: 12.5px;
  color: var(--ink-3);
}
.names-status.ok { color: var(--ok); }

.switch-strong {
  font-weight: 600;
  color: var(--ink-2);
}

/* ---------------- 评语页的名册摘要 ---------------- */
.roster-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  border: 1px solid #cfdcff;
  background: #f7faff;
  border-radius: 11px;
  padding: 13px 15px;
}
.roster-summary-main { display: flex; flex-direction: column; gap: 3px; }
.roster-summary-count {
  font-size: 17px;
  font-weight: 700;
  color: var(--brand);
}
.roster-summary-sub { font-size: 12.5px; color: var(--ink-3); }

/* ---------------- 加减器（触摸屏核心控件） ---------------- */
.stepper-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-top: 16px;
  flex-wrap: wrap;
}
.stepper-label {
  font-size: 14px;
  font-weight: 600;
  color: var(--ink-2);
}
.stepper {
  display: flex;
  align-items: center;
  gap: 0;
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow: hidden;
  background: #fff;
}
.step-btn {
  font-family: inherit;
  font-size: 24px;
  font-weight: 600;
  line-height: 1;
  width: 56px;
  height: 52px;
  border: 0;
  background: #f7f9fc;
  color: var(--ink-2);
  cursor: pointer;
  transition: background .12s, color .12s;
  -webkit-tap-highlight-color: transparent;
}
.step-btn:hover { background: #eef2f9; color: var(--brand); }
.step-btn:active { background: var(--brand-soft); color: var(--brand); }
.step-value {
  min-width: 68px;
  text-align: center;
  font-size: 22px;
  font-weight: 700;
  color: var(--ink);
  padding: 0 6px;
}

/* ---------------- 预设快捷按钮 ---------------- */
.preset-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
}
.preset-btn {
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  padding: 10px 16px;
  min-height: 44px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink-2);
  cursor: pointer;
  transition: all .14s;
  -webkit-tap-highlight-color: transparent;
}
.preset-btn:hover { border-color: #b9c4dd; color: var(--ink); }
.preset-btn.active {
  background: var(--brand);
  border-color: var(--brand);
  color: #fff;
}

/* ---------------- 分段切换 ---------------- */
.seg-row {
  display: flex;
  gap: 6px;
  background: #eef0f6;
  padding: 4px;
  border-radius: 11px;
  margin-bottom: 6px;
}
.seg {
  flex: 1;
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  padding: 11px 10px;
  min-height: 46px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--ink-2);
  cursor: pointer;
  transition: all .14s;
  -webkit-tap-highlight-color: transparent;
}
.seg.active {
  background: #fff;
  color: var(--brand);
  box-shadow: 0 1px 3px rgba(20, 28, 50, .1);
}

/* ---------------- 分组结果 ---------------- */
.group-panel {
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-height: 720px;
  overflow-y: auto;
}
.group-card {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 14px 16px;
  background: #fff;
}
.group-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 15px;
  font-weight: 700;
  color: var(--brand);
  margin-bottom: 10px;
}
.group-count {
  font-size: 12.5px;
  font-weight: 400;
  color: var(--ink-3);
}
.group-members {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}
.group-chip {
  font-size: 14px;
  padding: 7px 13px;
  border-radius: 9px;
  background: #f4f6fb;
  color: var(--ink);
}

/* ---------------- 课堂计时 ---------------- */
.timer-display {
  border: 2px solid var(--line);
  border-radius: 16px;
  padding: 40px 20px;
  text-align: center;
  background: #fbfcfe;
  cursor: pointer;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  transition: border-color .2s, background .2s;
}
.timer-display:active { transform: scale(.99); }
.timer-display.running {
  border-color: var(--brand);
  background: linear-gradient(180deg, #f7faff 0%, #eef3ff 100%);
}
.timer-display.warn {
  border-color: #e04f4f;
  background: linear-gradient(180deg, #fff5f5 0%, #ffe9e9 100%);
}
.timer-text {
  font-size: 76px;
  font-weight: 800;
  letter-spacing: 3px;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
  line-height: 1.1;
}
.timer-display.running .timer-text { color: var(--brand); }
.timer-display.warn .timer-text { color: #d93b3b; }
.timer-sub {
  margin-top: 10px;
  font-size: 14px;
  color: var(--ink-3);
}
.timer-btns {
  display: flex;
  gap: 10px;
  margin-top: 20px;
}
.timer-btns .btn-block { margin-top: 0; flex: 1; }
.timer-btns .btn-ghost { flex: none; padding: 0 22px; }

/* ---------------- 布局 ---------------- */
.wrap { max-width: 1180px; margin: 0 auto; padding: 34px 20px 60px; }

.hero { text-align: center; margin-bottom: 30px; }
.hero h1 {
  font-size: 30px;
  margin: 0 0 12px;
  letter-spacing: -.6px;
}
.hero-sub { color: var(--ink-2); margin: 0; font-size: 15px; }
.hero-sub strong { color: var(--brand); }

.grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 22px;
  align-items: start;
}

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 22px;
}

.card-title {
  font-size: 16px;
  font-weight: 700;
  margin: 0 0 10px;
  display: flex;
  align-items: center;
  gap: 9px;
}
.step {
  display: inline-flex; align-items: center; justify-content: center;
  width: 22px; height: 22px; border-radius: 50%;
  background: var(--brand-soft); color: var(--brand);
  font-size: 12px; font-weight: 700; flex: none;
}

.hint { color: var(--ink-3); font-size: 13px; margin: 0 0 10px; }
.hint strong { color: var(--ink-2); }

.divider { border: 0; border-top: 1px solid var(--line); margin: 22px 0; }

/* ---------------- 输入 ---------------- */
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 12px 14px;
  font-family: inherit;
  font-size: 14px;
  line-height: 1.7;
  resize: vertical;
  background: #fbfcfe;
  color: var(--ink);
  transition: border-color .15s, box-shadow .15s;
}
textarea:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 3px var(--brand-soft);
  background: #fff;
}

.row-between {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 10px;
  flex-wrap: wrap;
}
.count-badge {
  font-size: 13px;
  color: var(--brand);
  background: var(--brand-soft);
  padding: 3px 10px;
  border-radius: 999px;
  font-weight: 600;
}

.btn-row { display: flex; gap: 8px; flex-wrap: wrap; }

/* ---------------- 按钮 ---------------- */
.btn {
  font-family: inherit;
  font-size: 13.5px;
  font-weight: 600;
  border-radius: 9px;
  border: 1px solid transparent;
  padding: 8px 14px;
  cursor: pointer;
  transition: background .15s, border-color .15s, transform .06s, color .15s;
  white-space: nowrap;
}
.btn:active { transform: translateY(1px); }

.btn-primary { background: var(--brand); color: #fff; }
.btn-primary:hover { background: var(--brand-dark); }

.btn-ghost {
  background: #fff;
  border-color: var(--line);
  color: var(--ink-2);
}
.btn-ghost:hover { border-color: #c9cfdd; color: var(--ink); background: #fafbfe; }

.btn-block { width: 100%; margin-top: 18px; padding: 13px; font-size: 15px; }

/* ---------------- 学生标签面板 ---------------- */
.student-panel { display: flex; flex-direction: column; gap: 10px; }

.student-item {
  border: 1px solid var(--line);
  border-radius: 11px;
  padding: 11px 13px;
  background: #fbfcfe;
  transition: border-color .15s, background .15s;
}
.student-item.has-label { border-color: #cfdcff; background: #f7faff; }

.student-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
}
.student-name { font-weight: 700; font-size: 14.5px; }
.student-status { font-size: 12px; color: var(--ink-3); }
.student-status.done { color: var(--ok); }

.chip-list { display: flex; flex-wrap: wrap; gap: 6px; }

.chip {
  font-size: 12.5px;
  padding: 4px 11px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink-2);
  cursor: pointer;
  user-select: none;
  transition: all .13s;
}
.chip:hover { border-color: #b9c4dd; color: var(--ink); }
.chip.on {
  background: var(--brand);
  border-color: var(--brand);
  color: #fff;
  font-weight: 600;
}
.chip.on[data-group="neg"] { background: var(--warn); border-color: var(--warn); }

/* ---------------- 选项 ---------------- */
.opt-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}
.opt { display: flex; flex-direction: column; gap: 5px; }
.opt-label { font-size: 12.5px; color: var(--ink-3); font-weight: 600; }
select {
  font-family: inherit;
  font-size: 13.5px;
  padding: 8px 10px;
  border-radius: 9px;
  border: 1px solid var(--line);
  background: #fbfcfe;
  color: var(--ink);
  cursor: pointer;
}
select:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }

.switch-row { display: flex; flex-direction: column; gap: 9px; margin-top: 18px; }
.switch { display: flex; align-items: center; gap: 9px; font-size: 13.5px; color: var(--ink-2); cursor: pointer; }
.switch input { width: 16px; height: 16px; accent-color: var(--brand); cursor: pointer; }

.tiny-note { font-size: 12.5px; color: var(--ink-3); margin: 10px 0 0; text-align: center; }

/* ---------------- 结果区 ---------------- */
.result-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}

.result-panel {
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-height: 760px;
  overflow-y: auto;
  padding-right: 4px;
}

.comment-card {
  border: 1px solid var(--line);
  border-radius: 11px;
  padding: 13px 15px;
  background: #fff;
  position: relative;
}
.comment-card:hover { border-color: #cfd7ea; }

.comment-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 6px;
}
.comment-name { font-weight: 700; font-size: 14px; }
.comment-name .tags { font-weight: 400; font-size: 12px; color: var(--ink-3); margin-left: 7px; }

.comment-body {
  font-size: 13.8px;
  color: var(--ink);
  line-height: 1.85;
  white-space: pre-wrap;
  word-break: break-word;
}
.comment-body .hl { color: var(--brand); }

.mini-btn {
  font-size: 11.5px;
  padding: 3px 9px;
  border-radius: 7px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink-3);
  cursor: pointer;
}
.mini-btn:hover { color: var(--brand); border-color: var(--brand); }

.empty-state {
  color: var(--ink-3);
  font-size: 13.5px;
  text-align: center;
  padding: 34px 16px;
  border: 1px dashed var(--line);
  border-radius: 11px;
  background: #fbfcfe;
}

/* ---------------- 底部 ---------------- */
.footer {
  margin-top: 46px;
  text-align: center;
  color: var(--ink-3);
  font-size: 13px;
  line-height: 1.9;
}
.footer strong { color: var(--ink-2); }
.footer-small { margin-top: 14px; font-size: 12.5px; }
kbd {
  font-family: inherit;
  background: #eef0f6;
  border: 1px solid var(--line);
  border-radius: 5px;
  padding: 1px 6px;
  font-size: 12px;
}

/* ---------------- Toast ---------------- */
.toast {
  position: fixed;
  left: 50%;
  bottom: 34px;
  transform: translate(-50%, 20px);
  background: #1f2430;
  color: #fff;
  font-size: 13.5px;
  padding: 10px 20px;
  border-radius: 10px;
  opacity: 0;
  pointer-events: none;
  transition: opacity .22s, transform .22s;
  z-index: 999;
  box-shadow: 0 10px 30px rgba(0, 0, 0, .2);
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ---------------- 响应式 ---------------- */
@media (max-width: 900px) {
  .grid { grid-template-columns: 1fr; }
  .hero h1 { font-size: 24px; }
  .opt-grid { grid-template-columns: 1fr; }
  .result-panel { max-height: none; }
  .topbar-inner { padding: 10px 14px; flex-wrap: wrap; }
  .tabs { order: 3; width: 100%; }
  .tab { flex: 1; padding: 7px 8px; }
  .privacy-pill { font-size: 11.5px; padding: 4px 9px; }
  .wrap { padding: 22px 14px 44px; }
  .card { padding: 17px; }
  .pick-result { font-size: 34px; }
  .pick-display { padding: 32px 14px; min-height: 150px; }
}

/* ============================================================
 * 触摸屏 / 教室一体机优化
 * 一体机是手指点击，没有鼠标悬停，且点按需要更大的目标
 * ============================================================ */

/* 手指点击目标最小 44px（Apple/Google 无障碍建议） */
@media (pointer: coarse) {
  .btn {
    min-height: 46px;
    padding: 12px 18px;
    font-size: 15px;
  }
  .btn-block { padding: 16px; font-size: 17px; }
  .mini-btn {
    min-height: 36px;
    padding: 6px 14px;
    font-size: 13px;
  }
  .tab {
    min-height: 44px;
    padding: 10px 16px;
    font-size: 15px;
  }
  .chip {
    min-height: 40px;
    padding: 8px 16px;
    font-size: 14px;
  }
  .switch {
    min-height: 44px;
    font-size: 15px;
  }
  .switch input[type="checkbox"] {
    width: 24px;
    height: 24px;
  }
  .num-input,
  select {
    min-height: 44px;
    font-size: 16px;   /* 16px 以上才不会触发 iOS/部分一体机的自动放大 */
  }
  .num-input { width: 96px; }
  .drawn-tag {
    padding: 7px 14px;
    font-size: 14px;
  }
  .pick-display { min-height: 220px; }
  .pick-result { font-size: 52px; }
  .step-btn { width: 64px; height: 60px; font-size: 28px; }
  .step-value { min-width: 76px; font-size: 24px; }
  .preset-btn { min-height: 50px; padding: 12px 18px; font-size: 15px; }
  .seg { min-height: 52px; font-size: 15px; }
  .group-chip { font-size: 15px; padding: 9px 15px; }
}

/* 大屏一体机（1920x1080 全屏）时，把结果字号再放大，后排也能看清 */
@media (min-width: 1400px) and (pointer: coarse) {
  .pick-result { font-size: 72px; }
  .pick-display { min-height: 280px; }
  .timer-text { font-size: 108px; }
}

/* 用 @media (hover: none) 处理"没有鼠标悬停"的设备
   （悬停样式在一体机上不会触发，但不影响功能） */
