:root {
  --primary: #2196F3;
  --primary-dark: #1976D2;
  --primary-light: #BBDEFB;
  --accent: #FFC107;
  --bg: #E3F2FD;
  --card-bg: #FFFFFF;
  --text: #1A237E;
  --text-secondary: #546E7A;
  --border: #90CAF9;
  --shadow: 0 8px 24px rgba(33, 150, 243, 0.18);
  --radius: 18px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  min-height: 100%;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  background: linear-gradient(180deg, #E3F2FD 0%, #FFFFFF 100%);
  color: var(--text);
  overflow-x: hidden;
}

body { position: relative; }

/* 乐高积木动画背景 */
.lego-bg {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  overflow: hidden;
}

.lego-block {
  position: absolute;
  width: 48px;
  height: 32px;
  border-radius: 6px;
  opacity: .55;
  box-shadow: 0 4px 0 rgba(0,0,0,0.08), inset 0 -6px 0 rgba(0,0,0,0.05);
  animation: float 6s ease-in-out infinite;
}
.lego-block::before {
  content: '';
  position: absolute;
  top: -10px;
  left: 8px;
  width: 12px;
  height: 10px;
  border-radius: 3px 3px 0 0;
  background: inherit;
  box-shadow: 20px 0 0 inherit;
}

.b1 { left: 6%; top: 10%; background: #F44336; animation-delay: 0s; }
.b2 { left: 86%; top: 18%; background: #FFC107; animation-delay: 1s; }
.b3 { left: 12%; top: 70%; background: #4CAF50; animation-delay: 2s; }
.b4 { left: 80%; top: 62%; background: #2196F3; animation-delay: 1.5s; }
.b5 { left: 4%; top: 40%; background: #9C27B0; animation-delay: 0.5s; }
.b6 { left: 90%; top: 45%; background: #FF9800; animation-delay: 2.5s; }

@keyframes float {
  0%, 100% { transform: translateY(0) rotate(0deg); }
  50% { transform: translateY(-18px) rotate(4deg); }
}

.container {
  position: relative;
  z-index: 1;
  max-width: 720px;
  margin: 0 auto;
  padding: 20px 16px 40px;
}

.header {
  text-align: center;
  padding: 10px 0 20px;
}

.logo-wrap {
  width: 160px;
  height: 160px;
  margin: 0 auto 12px;
  border-radius: 50%;
  overflow: hidden;
  border: 4px solid #fff;
  box-shadow: var(--shadow);
  background: var(--primary);
}
.logo-wrap.small { width: 100px; height: 100px; border-width: 3px; }
.logo-img { width: 100%; height: 100%; object-fit: cover; display: block; }

.mascot {
  width: 120px;
  margin-top: 8px;
  animation: bounce 2.4s ease-in-out infinite;
  filter: drop-shadow(0 6px 10px rgba(0,0,0,0.1));
}

@keyframes bounce {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-10px); }
}

.title {
  font-size: 30px;
  font-weight: 800;
  color: var(--primary-dark);
  letter-spacing: 1px;
}
.subtitle { color: var(--text-secondary); margin-top: 4px; font-size: 16px; }

.card {
  background: var(--card-bg);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 22px;
  margin-top: 16px;
}

.countdown-wrap {
  background: linear-gradient(90deg, var(--primary-light), #E3F2FD);
  border-radius: 14px;
  padding: 14px;
  text-align: center;
  margin-bottom: 18px;
}
.countdown-label { display: block; color: var(--text-secondary); font-size: 13px; }
.countdown {
  font-size: 22px;
  font-weight: 700;
  color: var(--primary-dark);
  margin-top: 4px;
}

.join-form { display: flex; flex-direction: column; gap: 10px; }
.form-label { font-weight: 700; color: var(--text); font-size: 15px; }
.name-input {
  width: 100%;
  padding: 14px 16px;
  border: 2px solid var(--border);
  border-radius: 12px;
  font-size: 16px;
  outline: none;
  transition: border-color .2s, box-shadow .2s;
}
.name-input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(33,150,243,0.12);
}
.hint { font-size: 13px; color: var(--text-secondary); }

.submit-btn {
  background: linear-gradient(90deg, var(--primary), var(--primary-dark));
  color: #fff;
  border: none;
  border-radius: 12px;
  padding: 14px;
  font-size: 17px;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 6px 16px rgba(33,150,243,0.35);
  transition: transform .1s, box-shadow .2s;
}
.submit-btn:active { transform: translateY(2px); box-shadow: 0 3px 10px rgba(33,150,243,0.3); }

.progress-wrap { margin-top: 20px; }
.progress-header {
  display: flex;
  justify-content: space-between;
  font-size: 14px;
  color: var(--text-secondary);
  margin-bottom: 6px;
}
.progress-bar {
  height: 14px;
  background: #E3F2FD;
  border-radius: 7px;
  overflow: hidden;
}
.progress-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #42A5F5, var(--primary));
  border-radius: 7px;
  transition: width .5s ease;
}

.list-section { margin-top: 22px; }
.section-title {
  font-size: 17px;
  font-weight: 700;
  color: var(--primary-dark);
  margin-bottom: 10px;
}
.student-list {
  list-style: none;
  max-height: 420px;
  overflow-y: auto;
}
.student-list li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px;
  margin-bottom: 8px;
  background: #F5FBFF;
  border-radius: 12px;
  border-left: 4px solid var(--primary);
}
.student-list .name { font-weight: 700; font-size: 15px; }
.student-list .time { font-size: 12px; color: var(--text-secondary); }
.empty-tip { text-align: center; color: var(--text-secondary); font-size: 14px; padding: 30px 0; }

.footer {
  text-align: center;
  margin-top: 24px;
  color: var(--text-secondary);
  font-size: 13px;
}
.admin-link { color: var(--primary-dark); text-decoration: none; font-weight: 700; }
.admin-link:hover { text-decoration: underline; }

.toast {
  position: fixed;
  left: 50%;
  bottom: 30px;
  transform: translateX(-50%) translateY(20px);
  background: rgba(26,35,126,0.92);
  color: #fff;
  padding: 12px 20px;
  border-radius: 24px;
  font-size: 14px;
  opacity: 0;
  pointer-events: none;
  transition: all .3s ease;
  z-index: 100;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

.hidden { display: none !important; }

/* 教师页 */
.admin-body .title { font-size: 24px; }
.login-panel { text-align: center; }
.login-icon { font-size: 48px; margin-bottom: 8px; }
.login-form { max-width: 320px; margin: 16px auto 0; display: flex; flex-direction: column; gap: 12px; }

.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 14px;
}
.stats { display: flex; gap: 12px; }
.stat-box {
  background: linear-gradient(135deg, var(--primary-light), #E3F2FD);
  border-radius: 12px;
  padding: 10px 16px;
  min-width: 80px;
  text-align: center;
}
.stat-num { display: block; font-size: 22px; font-weight: 800; color: var(--primary-dark); }
.stat-label { font-size: 12px; color: var(--text-secondary); }
.toolbar-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.action-btn {
  border: none;
  border-radius: 10px;
  padding: 10px 14px;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  transition: transform .1s;
}
.action-btn.secondary { background: #E3F2FD; color: var(--primary-dark); }
.action-btn.danger { background: #FFEBEE; color: #C62828; }
.action-btn:active { transform: translateY(1px); }

.legend {
  display: flex;
  gap: 16px;
  align-items: center;
  flex-wrap: wrap;
  font-size: 13px;
  color: var(--text-secondary);
  margin-bottom: 12px;
}
.dot {
  display: inline-block;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #E0E0E0;
  border: 2px solid #BDBDBD;
  vertical-align: middle;
  margin-right: 4px;
}
.dot.lit { background: var(--accent); border-color: #F57F17; box-shadow: 0 0 6px rgba(255,193,7,0.6); }

.table-wrap { overflow-x: auto; border-radius: 12px; border: 1px solid var(--border); }
.attendance-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
  background: #fff;
}
.attendance-table th, .attendance-table td {
  padding: 12px 8px;
  text-align: center;
  border-bottom: 1px solid #E3F2FD;
  white-space: nowrap;
}
.attendance-table th { background: #F5FBFF; color: var(--primary-dark); font-weight: 700; }
.attendance-table td.col-name { font-weight: 700; text-align: left; padding-left: 14px; }
.attendance-table tr:nth-child(even) { background: #FAFAFA; }

.week-dot {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 2px solid #BDBDBD;
  background: #fff;
  cursor: pointer;
  transition: all .2s;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.week-dot.lit {
  background: var(--accent);
  border-color: #F57F17;
  box-shadow: 0 0 8px rgba(255,193,7,0.5);
  color: #5D4037;
  font-weight: 700;
}
.week-dot:active { transform: scale(0.9); }

.col-num { width: 50px; }
.col-name { min-width: 80px; }
.col-weeks { width: 60px; }
.col-total { width: 60px; font-weight: 700; color: var(--primary-dark); }

/* 上课频次列与下拉框 */
.col-mode { width: 92px; }
.mode-select {
  padding: 4px 6px;
  border: 2px solid var(--border);
  border-radius: 10px;
  background: #fff;
  color: var(--text);
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
}
.mode-select:focus { outline: none; border-color: var(--primary); }
.col-weeks-empty { color: #B0BEC5; font-size: 13px; }

/* 家长端：上课频次选择 */
.mode-group { display: flex; gap: 10px; margin: 10px 0 4px; }
.mode-option {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 14px;
  border: 2px solid var(--border);
  border-radius: 14px;
  background: #fff;
  cursor: pointer;
  transition: all 0.2s ease;
}
.mode-option:has(input:checked) {
  border-color: var(--primary);
  background: var(--primary-light);
  box-shadow: 0 4px 12px rgba(33, 150, 243, 0.18);
}
.mode-option input { width: 18px; height: 18px; accent-color: var(--primary); flex-shrink: 0; }
.mode-text { font-size: 14px; font-weight: 700; color: var(--text); line-height: 1.4; }
.mode-text em { display: block; font-style: normal; font-size: 12px; font-weight: 500; color: var(--text-secondary); margin-top: 2px; }

/* 名单里「每周2次」小标签 */
.badge-twice {
  display: inline-block;
  margin-left: 6px;
  padding: 1px 7px;
  border-radius: 8px;
  background: var(--accent);
  color: #5D4037;
  font-size: 11px;
  font-weight: 700;
  vertical-align: middle;
}

.closed-panel { text-align: center; padding: 40px 10px; }
.closed-icon { font-size: 56px; margin-bottom: 12px; }

@media (max-width: 480px) {
  .title { font-size: 24px; }
  .logo-wrap { width: 120px; height: 120px; }
  .mascot { width: 90px; }
  .card { padding: 18px; }
  .toolbar { flex-direction: column; align-items: stretch; }
  .toolbar-actions { justify-content: flex-start; }
}
