/* ============================================
   711班 — 平板端教室模式专用样式
   触控优先：≥44px 目标、卡片布局、16px+ 字号
   ============================================ */

/* ----- 重置与基础 ----- */
.tablet-app {
  max-width: 100%;
  min-height: 100vh;
  min-height: 100dvh;
  background: var(--bg);
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  user-select: none;
  -webkit-user-select: none;
}

/* ----- 顶部栏 ----- */
.tablet-header {
  background: var(--card);
  padding: 12px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
  min-height: 56px;
}
.tablet-header h1 {
  font-size: 18px;
  font-weight: 800;
  color: var(--primary);
}
.tablet-header .sync-btn {
  width: 44px; height: 44px;
  border: none; background: transparent;
  font-size: 24px; cursor: pointer;
  border-radius: 12px; line-height: 44px;
  text-align: center;
  transition: background .15s, transform .1s;
}
.tablet-header .sync-btn:active { transform: scale(.85); background: var(--blue-bg); }

.tablet-header .role-badge {
  font-size: 13px;
  background: var(--blue-bg);
  color: var(--primary);
  padding: 6px 14px;
  border-radius: 16px;
  font-weight: 700;
  cursor: default;
  min-height: 44px;
  display: flex;
  align-items: center;
}

/* ----- 搜索栏 ----- */
.search-bar {
  padding: 10px 16px;
  background: var(--card);
  position: sticky;
  top: 56px;
  z-index: 99;
  border-bottom: 1px solid var(--border);
}
.search-bar input {
  width: 100%;
  padding: 12px 16px;
  border: 2px solid var(--border);
  border-radius: 24px;
  font-size: 16px;
  background: var(--bg);
  color: var(--text);
  outline: none;
  -webkit-appearance: none;
  min-height: 48px;
}
.search-bar input:focus {
  border-color: var(--primary);
}

/* ----- 内容区 ----- */
.tablet-content {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 12px;
  padding-bottom: 80px; /* 底部 Tab 高度 */
}

/* ----- 学生卡片网格 ----- */
.student-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 8px;
}
.student-card {
  background: var(--card);
  border-radius: 16px;
  padding: 14px 8px;
  text-align: center;
  cursor: pointer;
  box-shadow: var(--shadow);
  transition: transform .1s;
  min-height: 96px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  -webkit-tap-highlight-color: transparent;
}
.student-card:active {
  transform: scale(.94);
  background: var(--blue-bg);
}
.student-card .avatar {
  width: 54px;
  height: 54px;
  border-radius: 50%;
  background: var(--blue-bg);
  color: var(--primary);
  font-size: 22px;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 6px;
}
.student-card .avatar.female {
  background: #fce4ec;
  color: #c2185b;
}
.student-card .name {
  font-size: 18px;
  font-weight: 700;
  color: var(--text);
  line-height: 1.25;
  white-space: nowrap;
}
.student-card .name .no {
  color: var(--muted);
  font-weight: 600;
  margin-right: 2px;
}
.student-card .pts {
  font-size: 14px;
  font-weight: 700;
  margin-top: 5px;
  padding: 3px 10px;
  border-radius: 10px;
}
.student-card .pts.positive { background: var(--green-bg); color: var(--green); }
.student-card .pts.zero { background: #f5f5f5; color: var(--muted); }
.student-card .pts.negative { background: var(--red-bg); color: var(--red); }

/* ----- 底部操作面板（Bottom Sheet）----- */
.sheet-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.35);
  z-index: 200;
  display: none;
  animation: fadeIn .2s;
}
.sheet-overlay.show { display: block; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

.sheet-panel {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--card);
  border-radius: 20px 20px 0 0;
  z-index: 201;
  padding: 20px 16px 32px;
  transform: translateY(100%);
  transition: transform .25s cubic-bezier(.4,0,.2,1);
  max-height: 70vh;
  overflow-y: auto;
}
.sheet-panel.show { transform: translateY(0); }

.sheet-handle {
  width: 40px;
  height: 4px;
  background: var(--border);
  border-radius: 2px;
  margin: 0 auto 16px;
}
.sheet-student-info {
  text-align: center;
  margin-bottom: 16px;
}
.sheet-student-info .big-avatar {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: var(--blue-bg);
  color: var(--primary);
  font-size: 24px;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 8px;
}
.sheet-student-info .big-name {
  font-size: 26px;
  font-weight: 800;
  color: var(--text);
}
.sheet-student-info .big-meta {
  display: flex;
  justify-content: center;
  gap: 10px;
  margin-top: 8px;
  flex-wrap: wrap;
}
.sheet-student-info .meta-tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 16px;
  font-weight: 700;
  padding: 5px 16px;
  border-radius: 18px;
  line-height: 1.3;
}
.sheet-student-info .meta-tag.seat-tag {
  background: #e3ecff;
  color: #2b5cc4;
}
.sheet-student-info .meta-tag.no-tag {
  background: #f0f0f0;
  color: var(--text);
}
.sheet-student-info .big-pts {
  font-size: 16px;
  color: var(--muted);
  margin-top: 8px;
}

/* 操作按钮组 */
.sheet-section {
  margin-bottom: 16px;
}
.sheet-section-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--muted);
  margin-bottom: 8px;
  padding-left: 4px;
  text-transform: uppercase;
  letter-spacing: .5px;
}
.action-btns {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
}
.action-btn {
  padding: 14px 10px;
  border: 2px solid var(--border);
  border-radius: 14px;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  text-align: center;
  background: var(--card);
  transition: all .12s;
  min-height: 52px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  font-family: inherit;
  -webkit-tap-highlight-color: transparent;
}
.action-btn:active { transform: scale(.95); }
.action-btn .pts-val {
  font-size: 11px;
  font-weight: 400;
  opacity: .7;
}
.action-btn.positive { border-color: var(--green); color: var(--green); }
.action-btn.positive:active { background: var(--green-bg); }
.action-btn.negative { border-color: var(--red); color: var(--red); }
.action-btn.negative:active { background: var(--red-bg); }

/* 查看积分变动明细（point_log.js 弹窗入口） */
.view-point-detail {
  display: block; width: 100%;
  margin-top: 14px; padding: 13px 0;
  border: none; border-radius: 14px;
  background: var(--primary); color: #fff;
  font-size: 16px; font-weight: 800;
  cursor: pointer; font-family: inherit;
  min-height: 48px;
  transition: transform .1s;
}
.view-point-detail:active { transform: scale(.97); }

/* ----- 底部 Tab 导航 ----- */
.tab-bar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--card);
  border-top: 1px solid var(--border);
  display: flex;
  z-index: 150;
  padding-bottom: env(safe-area-inset-bottom, 0);
}
.tab-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 8px 4px;
  cursor: pointer;
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
  transition: color .15s;
  min-height: 56px;
  gap: 2px;
  -webkit-tap-highlight-color: transparent;
}
.tab-item .tab-icon { font-size: 22px; }
.tab-item.active { color: var(--primary); }

/* ----- Toast 提示（平板版，更大）----- */
.tablet-toast {
  position: fixed;
  bottom: 100px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(0,0,0,.85);
  color: #fff;
  padding: 12px 28px;
  border-radius: 24px;
  font-size: 16px;
  font-weight: 600;
  z-index: 999;
  pointer-events: none;
  transition: opacity .3s;
  opacity: 0;
}
.tablet-toast.show { opacity: 1; }

/* ----- 角色选择页 ----- */
.role-select-page {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 24px;
  text-align: center;
}
.role-select-page h2 {
  font-size: 22px;
  font-weight: 800;
  color: var(--primary);
  margin-bottom: 8px;
}
.role-select-page .subtitle {
  font-size: 14px;
  color: var(--muted);
  margin-bottom: 28px;
}
.role-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  width: 100%;
  max-width: 100%;
}
.role-card {
  background: var(--card);
  border: 2px solid var(--border);
  border-radius: 16px;
  padding: 20px 12px;
  text-align: center;
  cursor: pointer;
  transition: all .12s;
  min-height: 100px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  -webkit-tap-highlight-color: transparent;
}
.role-card:active {
  transform: scale(.95);
  border-color: var(--primary);
  background: var(--blue-bg);
}
.role-card .icon { font-size: 36px; }
.role-card .label { font-size: 15px; font-weight: 700; color: var(--text); }
.role-card .hint { font-size: 11px; color: var(--muted); }

/* ----- 课节选择器（纪律委员用）----- */
.period-selector {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}
.period-btn {
  padding: 10px 16px;
  border: 2px solid var(--border);
  border-radius: 12px;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  background: var(--card);
  color: var(--text);
  min-height: 44px;
  font-family: inherit;
  -webkit-tap-highlight-color: transparent;
}
.period-btn.active {
  border-color: var(--primary);
  background: var(--blue-bg);
  color: var(--primary);
}

/* ----- 记录列表 ----- */
.record-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.record-item {
  background: var(--card);
  border-radius: 12px;
  padding: 14px;
  display: flex;
  align-items: center;
  gap: 10px;
  box-shadow: var(--shadow);
}
.record-item .rec-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--blue-bg);
  color: var(--primary);
  font-size: 16px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.record-item .rec-info {
  flex: 1;
  min-width: 0;
}
.record-item .rec-name {
  font-size: 15px;
  font-weight: 700;
}
.record-item .rec-detail {
  font-size: 12px;
  color: var(--muted);
  margin-top: 2px;
}
.record-item .rec-pts {
  font-size: 16px;
  font-weight: 800;
  min-width: 40px;
  text-align: right;
}
/* 迷你榜双值块（本周 / 总积分） */
.record-item .rec-pts.mini2 {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}
.record-item .rec-pts.mini2 span {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  line-height: 1.05;
  font-weight: 800;
  font-size: 14px;
}
.record-item .rec-pts.mini2 span.w { color: var(--primary); }
.record-item .rec-pts.mini2 span.t { font-size: 17px; }
.record-item .rec-pts.mini2.good span.t { color: var(--green); }
.record-item .rec-pts.mini2.warn span.t { color: var(--red); }
.record-item .rec-pts.mini2 em {
  font-style: normal;
  font-size: 9px;
  color: var(--muted);
  font-weight: 600;
  margin-top: 2px;
}
.record-item .rec-delete {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: none;
  background: var(--red-bg);
  color: var(--red);
  font-size: 16px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ----- 座位图（固定8列 + 红蓝性别 + 座位号）----- */
.seat-legend {
  display: flex;
  justify-content: center;
  gap: 24px;
  font-size: 16px;
  font-weight: 700;
  margin-bottom: 2px;
}
.seat-legend .lg-m { color: #2b5cc4; }
.seat-legend .lg-f { color: #d63031; }
.seat-legend .lg-t { color: #4a6ba8; }
.seat-tip {
  text-align: center;
  font-size: 15px;
  color: var(--muted);
  margin: 0 0 4px;
}
.seat-podium {
  text-align: center;
  font-size: 16px;
  font-weight: 700;
  color: var(--muted);
  margin: 2px 0 10px;
}
.seat-grid {
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  gap: 8px;
}
.seat-cell {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  border-radius: 12px;
  padding: 10px 3px;
  min-height: 80px;
  box-shadow: 0 1px 3px rgba(0,0,0,.06);
  -webkit-tap-highlight-color: transparent;
  transition: transform .1s;
}
.seat-cell.seat-m { background: #e3ecff; color: #2b5cc4; cursor: pointer; }
.seat-cell.seat-f { background: #fde2e2; color: #d63031; cursor: pointer; }
.seat-cell.seat-empty { background: #f2f2f2; color: #bbb; }
/* 空位（多余座位，只在最后一排）与教师办公处（恒不坐人）—— 2026-09-21 新布局。
   ⚠️ 这是顶层规则（无缩进），别加缩进 —— 缩进版会在媒体查询外也生效但风格不一致。 */
.seat-cell.seat-blank { background: #f2f2f2; color: #b9bec7; border: 1px dashed #cfd6de; }
.seat-cell.seat-teach { background: #e7eefc; color: #4a6ba8; border: 1px dashed #b9cdf0; }
.seat-cell.seat-teach .seat-name { font-size: 15px; }
.seat-cell:active { transform: scale(.94); }
.seat-cell .seat-no {
  font-size: 15px;
  font-weight: 800;
  opacity: .7;
  line-height: 1.15;
  margin-bottom: 3px;
}
.seat-cell .seat-name {
  font-size: 18px;
  font-weight: 800;
  line-height: 1.25;
  white-space: nowrap;
}
@media (max-width: 640px) {
  .seat-grid { gap: 5px; }
  .seat-cell { min-height: 62px; padding: 7px 1px; }
  .seat-cell .seat-no { font-size: 12px; }
  .seat-cell .seat-name { font-size: 14px; }
  .seat-tip { font-size: 12px; }
}

/* ----- 排行榜卡片 ----- */
.rank-section-title {
  font-size: 16px;
  font-weight: 800;
  color: var(--primary);
  margin: 6px 4px 10px;
}
.rank-card {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--card);
  border-radius: 16px;
  padding: 14px 16px;
  margin-bottom: 10px;
  box-shadow: var(--shadow);
  cursor: pointer;
  min-height: 68px;
  transition: transform .1s;
  -webkit-tap-highlight-color: transparent;
}
.rank-card:active { transform: scale(.98); background: var(--blue-bg); }
.rank-card.rank-top1 { background: linear-gradient(90deg, rgba(251,191,36,.16), var(--card)); }
.rank-card.rank-top2 { background: linear-gradient(90deg, rgba(203,213,225,.14), var(--card)); }
.rank-card.rank-top3 { background: linear-gradient(90deg, rgba(245,158,11,.12), var(--card)); }
.rank-badge {
  min-width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  font-weight: 800;
  flex-shrink: 0;
  padding: 0 6px;
  box-sizing: border-box;
}
.rank-badge.gold { background: linear-gradient(135deg,#fde68a,#fbbf24); color:#92400e; }
.rank-badge.silver { background: linear-gradient(135deg,#f1f5f9,#cbd5e1); color:#475569; }
.rank-badge.bronze { background: linear-gradient(135deg,#fdba74,#f59e0b); color:#7c2d12; }
.rank-badge.plain { background: var(--blue-bg); color: var(--primary); }
.rank-avatar {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: var(--blue-bg);
  color: var(--primary);
  font-size: 20px;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.rank-avatar.female { background: #fce4ec; color: #c2185b; }
.rank-info { flex: 1; min-width: 0; }
.rank-name {
  font-size: 18px;
  font-weight: 800;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.rank-name .no { color: var(--muted); font-weight: 600; margin-right: 3px; }
.rank-scores {
  display: flex;
  align-items: stretch;
  gap: 6px;
  flex-shrink: 0;
}
.rank-scores .rs {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-width: 56px;
  padding: 4px 8px;
  border-radius: 12px;
  background: var(--blue-bg);
}
.rank-scores .rs .v {
  font-size: 17px;
  font-weight: 800;
  line-height: 1.1;
  color: var(--primary);
  font-variant-numeric: tabular-nums;
}
.rank-scores .rs .k {
  font-size: 10px;
  color: var(--muted);
  margin-top: 2px;
  font-weight: 600;
}
.rank-scores .rs-total {
  background: rgba(0, 0, 0, .045);
}
.rank-scores .rs-total .v {
  font-size: 21px;
  color: var(--text);
}
.rank-scores .rs-total.positive .v { color: var(--green); }
.rank-scores .rs-total.zero .v { color: var(--muted); }
.rank-scores .rs-total.negative .v { color: var(--red); }

/* ----- 清洁任务卡片 ----- */
.cleaning-card {
  background: var(--card);
  border-radius: 14px;
  padding: 16px;
  margin-bottom: 10px;
  box-shadow: var(--shadow);
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  min-height: 60px;
  transition: background .12s;
  -webkit-tap-highlight-color: transparent;
}
.cleaning-card:active { background: var(--blue-bg); }
.cleaning-card.done { opacity: .6; }
.cleaning-card .clean-left { display: flex; align-items: center; gap: 12px; }
.cleaning-card .clean-check {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 3px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  transition: all .15s;
}
.cleaning-card.done .clean-check {
  border-color: var(--green);
  background: var(--green);
  color: #fff;
}
.cleaning-card .clean-name { font-size: 16px; font-weight: 700; }
.cleaning-card .clean-group { font-size: 12px; color: var(--muted); }

/* ----- 空状态 ----- */
.tablet-empty {
  text-align: center;
  padding: 60px 20px;
  color: var(--muted);
  font-size: 15px;
}
.tablet-empty .icon { font-size: 48px; margin-bottom: 12px; }

/* ----- 同步状态指示灯 ----- */
.sync-indicator {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  display: inline-block;
  margin-left: 6px;
}
.sync-indicator.online { background: var(--green); }
.sync-indicator.offline { background: var(--orange); }
.sync-indicator.syncing { background: var(--primary); animation: pulse 1s infinite; }
@keyframes pulse { 0%,100%{opacity:1} 50%{opacity:.3} }

/* ----- iPad 横屏适配 (1024px+) ----- */
@media (min-width: 768px) {
  .student-grid { grid-template-columns: repeat(6, 1fr); }
  .action-btns { grid-template-columns: repeat(4, 1fr); }
  .role-grid { grid-template-columns: repeat(3, 1fr); max-width: 100%; }
}

/* ----- iPad 12.9" 适配 ----- */
@media (min-width: 1024px) {
  .student-grid { grid-template-columns: repeat(8, 1fr); gap: 10px; }
}

/* ----- 确认对话框 ----- */
.confirm-dialog {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.4);
  z-index: 300;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: fadeIn .2s;
}
.confirm-dialog .dialog-box {
  background: var(--card);
  border-radius: 16px;
  padding: 24px;
  width: 280px;
  text-align: center;
  box-shadow: 0 8px 30px rgba(0,0,0,.15);
}
.confirm-dialog .dialog-msg { font-size: 16px; font-weight: 600; margin: 12px 0 20px; }
.confirm-dialog .dialog-btns { display: flex; gap: 10px; }
.confirm-dialog .dialog-btn {
  flex: 1;
  padding: 12px;
  border-radius: 12px;
  border: none;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  min-height: 48px;
  font-family: inherit;
}
.confirm-dialog .dialog-btn.cancel { background: #f0f0f0; color: var(--text); }
.confirm-dialog .dialog-btn.confirm { background: var(--primary); color: #fff; }

/* ----- 密码弹窗 ----- */
.pwd-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.45);
  z-index: 300;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: fadeIn .2s;
}
.pwd-dialog {
  background: var(--card);
  border-radius: 20px;
  padding: 28px 24px;
  width: 300px;
  text-align: center;
  box-shadow: 0 12px 40px rgba(0,0,0,.2);
}
.pwd-dialog .pwd-role-icon {
  font-size: 48px;
  margin-bottom: 8px;
}
.pwd-dialog .pwd-title {
  font-size: 18px;
  font-weight: 800;
  color: var(--text);
  margin-bottom: 4px;
}
.pwd-dialog .pwd-subtitle {
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 20px;
}
.pwd-dialog .pwd-input {
  width: 100%;
  padding: 14px 16px;
  border: 2px solid var(--border);
  border-radius: 14px;
  font-size: 20px;
  text-align: center;
  letter-spacing: 8px;
  color: var(--text);
  background: var(--bg);
  outline: none;
  -webkit-appearance: none;
  margin-bottom: 8px;
  box-sizing: border-box;
  font-family: -apple-system, monospace;
}
.pwd-dialog .pwd-input:focus {
  border-color: var(--primary);
}
.pwd-dialog .pwd-error {
  font-size: 13px;
  color: var(--red);
  font-weight: 600;
  margin-bottom: 8px;
  display: none;
}
.pwd-dialog .pwd-error.show { display: block; animation: shake .4s; }
@keyframes shake {
  0%,100% { transform: translateX(0); }
  20%,60% { transform: translateX(-8px); }
  40%,80% { transform: translateX(8px); }
}
.pwd-dialog .pwd-btn {
  width: 100%;
  min-height: 50px;
  font-size: 17px;
  font-weight: 700;
  margin-top: 8px;
}
.pwd-dialog .pwd-cancel {
  width: 100%;
  min-height: 44px;
  font-size: 14px;
  font-weight: 600;
  margin-top: 6px;
  background: transparent;
  border: none;
  color: var(--muted);
}
