/* ===================== 全局基础 ===================== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --blue: #4A90E2;
  --blue-light: #EBF3FD;
  --pink: #F06292;
  --pink-light: #FDE8EE;
  --green: #43C59E;
  --green-light: #E6F9F4;
  --orange: #FF9800;
  --orange-light: #FFF3E0;
  --purple: #9C27B0;
  --purple-light: #F3E5F5;
  --yellow: #FFC107;
  --red: #F44336;
  --gray: #9E9E9E;
  --gray-light: #F5F5F5;
  --text: #333;
  --text-light: #666;
  --border: #E0E0E0;
  --shadow: 0 2px 12px rgba(0,0,0,0.08);
  --radius: 16px;
  --radius-sm: 8px;
}

html, body {
  height: 100%;
  font-family: -apple-system, BlinkMacSystemFont, 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;
  background: var(--gray-light);
  color: var(--text);
  overflow-x: hidden;
}

/* 图片自适应 — 防止上传的图片撑破容器 */
img { max-width: 100%; height: auto; }

/* ===================== 页面管理 ===================== */
.page { display: none; min-height: 100vh; }
.page.active { display: flex; flex-direction: column; }

/* ===================== 登录页 ===================== */
.login-bg {
  min-height: 100vh;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  display: flex; align-items: center; justify-content: center;
  padding: 24px;
}

.login-card {
  background: white;
  border-radius: 24px;
  padding: 40px 32px;
  width: 100%; max-width: 420px;
  text-align: center;
  box-shadow: 0 20px 60px rgba(0,0,0,0.2);
}

.app-logo { font-size: 56px; margin-bottom: 12px; }
.app-title { font-size: 24px; font-weight: 700; color: #333; margin-bottom: 8px; }
.app-sub { color: #888; font-size: 14px; margin-bottom: 32px; }

.role-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.role-btn {
  border: 2px solid var(--border);
  background: white;
  border-radius: 20px;
  padding: 24px 16px;
  cursor: pointer;
  transition: all 0.2s;
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  position: relative;
  overflow: hidden;
}
.role-btn:hover { transform: translateY(-3px); box-shadow: var(--shadow); }
.role-btn.parent { border-color: var(--blue); }
.role-btn.parent:hover { background: var(--blue-light); border-color: var(--blue); }
.role-btn.child { border-color: var(--pink); }
.role-btn.child:hover { background: var(--pink-light); border-color: var(--pink); }

.role-icon { font-size: 36px; }
.role-name { font-size: 15px; font-weight: 600; color: var(--text); }
.role-tag {
  font-size: 11px; color: white;
  background: var(--pink);
  border-radius: 20px; padding: 2px 8px;
}

/* ===================== 顶栏 ===================== */
.topbar {
  box-shadow: 0 1px 6px rgba(0,0,0,0.06);
  position: sticky; top: 0; z-index: 100;
  width: 100%;
}

/* 顶栏容器 */
.topbar-container {
  background: white;
  padding: 12px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  max-width: 480px;
  margin: 0 auto;
}

/* 孩子顶栏容器 - 使用紫色渐变背景 */
.child-topbar .topbar-container {
  background: linear-gradient(90deg, #667eea, #764ba2);
}

.topbar-left { display: flex; align-items: center; gap: 10px; flex: 1; }
.topbar-right { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }

.avatar { font-size: 28px; }
.username { font-size: 16px; font-weight: 600; }

.child-topbar { background: linear-gradient(90deg, #667eea, #764ba2); }
.child-topbar .avatar { color: white; }
.child-topbar .username { color: white; }
.child-topbar .btn-icon { color: white; }

.btn-icon {
  background: none; border: none; font-size: 20px; cursor: pointer;
  width: 36px; height: 36px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  transition: background 0.15s;
}
.btn-icon:hover { background: rgba(0,0,0,0.05); }

.points-badge {
  background: rgba(255,255,255,0.2);
  border-radius: 20px;
  padding: 4px 12px;
  display: flex; align-items: center; gap: 4px;
  color: white; font-weight: 700; font-size: 15px;
}

/* ===================== Tab 导航 ===================== */
.tab-nav {
  border-bottom: 1px solid var(--border);
  overflow-x: auto;
  scrollbar-width: none;
  width: 100%;
}

/* Tab 导航容器 */
.tab-nav-container {
  background: white;
  display: flex;
  width: 100%;
  max-width: 480px;
  margin: 0 auto;
}
.tab-nav-container::-webkit-scrollbar { display: none; }

.tab-btn {
  flex: 1; min-width: 80px;
  background: none; border: none;
  padding: 12px 8px;
  font-size: 13px; font-weight: 500; color: var(--text-light);
  cursor: pointer; white-space: nowrap;
  border-bottom: 3px solid transparent;
  transition: all 0.2s;
  text-align: center;
}
.tab-btn.active { color: var(--blue); border-bottom-color: var(--blue); }
.child-nav .tab-btn.active { color: var(--purple); border-bottom-color: var(--purple); }

.tab-content { display: none; }
.tab-content.active { display: block; }

/* ===================== 内容区域 ===================== */
.content-area { flex: 1; overflow-y: auto; padding: 16px; padding-bottom: 32px; }

/* ===================== 卡片 ===================== */
.card {
  background: white;
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 16px;
  box-shadow: var(--shadow);
}

.card-title {
  font-size: 17px; font-weight: 700;
  margin-bottom: 16px; color: var(--text);
}

/* ===================== 表单 ===================== */
.form-group { margin-bottom: 16px; }
.form-group label {
  display: block; font-size: 14px; font-weight: 600;
  color: var(--text); margin-bottom: 6px;
}
.form-group input[type="text"],
.form-group input[type="date"],
.form-group input[type="time"],
.form-group input[type="number"],
.form-group select,
.form-group textarea {
  width: 100%;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  font-size: 14px;
  color: var(--text);
  background: white;
  outline: none;
  transition: border-color 0.2s;
  font-family: inherit;
}

/* 截止时间输入框字体更大 */
.form-group input[type="time"] {
  font-size: 18px;
  font-weight: 600;
}
.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus { border-color: var(--blue); }

.radio-group { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 4px; }
.radio-item {
  display: flex; align-items: center; gap: 6px;
  cursor: pointer; font-size: 14px;
  background: var(--gray-light); border-radius: 20px;
  padding: 6px 14px;
  border: 1.5px solid transparent;
  transition: all 0.15s;
}
.radio-item input { display: none; }
.radio-item:has(input:checked) {
  background: var(--blue-light); border-color: var(--blue); color: var(--blue);
}

.points-picker {
  display: flex; align-items: center; gap: 16px;
}
.points-btn {
  width: 36px; height: 36px;
  border-radius: 50%; border: none;
  background: var(--blue); color: white;
  font-size: 18px; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: background 0.15s;
}
.points-btn:hover { background: #3579c8; }
#hw-points-val {
  font-size: 22px; font-weight: 700; color: var(--orange);
  min-width: 40px; text-align: center;
}

/* ===================== 按钮 ===================== */
.btn-primary {
  background: linear-gradient(135deg, #667eea, #764ba2);
  color: white; border: none;
  border-radius: 12px; padding: 12px 24px;
  font-size: 15px; font-weight: 600; cursor: pointer;
  transition: opacity 0.15s, transform 0.1s;
  font-family: inherit;
}
.btn-primary:hover { opacity: 0.9; }
.btn-primary:active { transform: scale(0.97); }

.btn-secondary {
  background: var(--gray-light); color: var(--text-light);
  border: none; border-radius: 12px; padding: 12px 24px;
  font-size: 15px; font-weight: 600; cursor: pointer;
  font-family: inherit;
}

.btn-full { width: 100%; }
.btn-sm { padding: 6px 14px; font-size: 13px; border-radius: 8px; }
.btn-lg { padding: 18px 24px; font-size: 16px; }

.btn-green { background: linear-gradient(135deg, #43C59E, #2ecc71); }
.btn-orange { background: linear-gradient(135deg, #FF9800, #F44336); }

/* ===================== 过滤栏 ===================== */
.overview-filter {
  display: flex; flex-wrap: wrap; gap: 12px;
  margin-bottom: 16px;
}
.filter-group {
  display: flex; align-items: center; gap: 6px;
  flex-wrap: wrap;
}
.filter-label {
  font-size: 13px; color: var(--text-light);
  font-weight: 500;
}
.filter-btn {
  background: white; border: 1.5px solid var(--border);
  border-radius: 20px; padding: 6px 14px;
  font-size: 13px; cursor: pointer;
  transition: all 0.15s; font-family: inherit; color: var(--text-light);
}
.filter-btn.active { background: var(--blue); border-color: var(--blue); color: white; }

/* ===================== 作业卡片 ===================== */
.hw-list { display: flex; flex-direction: column; gap: 12px; }

.hw-card {
  background: white;
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: var(--shadow);
  border-left: 4px solid var(--blue);
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.15s;
  position: relative;
}
.hw-card:hover { transform: translateY(-1px); box-shadow: 0 4px 18px rgba(0,0,0,0.12); }
.hw-card.done { border-left-color: var(--green); opacity: 0.75; }
.hw-card.overdue { border-left-color: var(--red); }

.hw-card-top {
  display: flex; align-items: flex-start; justify-content: space-between;
  margin-bottom: 8px; gap: 8px;
}
.hw-card-subject {
  font-size: 12px; font-weight: 600;
  background: var(--blue-light); color: var(--blue);
  border-radius: 20px; padding: 2px 10px;
  white-space: nowrap;
}
.hw-card-title { font-size: 15px; font-weight: 600; flex: 1; line-height: 1.4; }
.hw-card-meta {
  display: flex; align-items: center; gap: 12px;
  font-size: 12px; color: var(--text-light);
  flex-wrap: wrap;
}
.hw-card-meta .date { display: flex; align-items: center; gap: 3px; }
.hw-card-meta .points { color: var(--orange); font-weight: 600; }
.hw-card-meta .assignee { 
  background: var(--pink-light); color: var(--pink);
  border-radius: 20px; padding: 2px 8px; font-size: 11px;
}

.hw-status-badge {
  font-size: 11px; font-weight: 600; border-radius: 20px; padding: 3px 10px;
}
.status-pending { background: var(--orange-light); color: var(--orange); }
.status-done { background: var(--green-light); color: var(--green); }
.status-overdue { background: #FFEBEE; color: var(--red); }

/* 子项操作按钮行 */
.hw-actions {
  display: flex; gap: 8px; margin-top: 12px; flex-wrap: wrap;
}

/* ===================== 进度卡片 ===================== */
.progress-card {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 16px;
  color: white;
}
.progress-title { font-size: 14px; opacity: 0.85; margin-bottom: 6px; }
.progress-count { font-size: 28px; font-weight: 700; margin-bottom: 10px; }
.progress-bar-wrap {
  background: rgba(255,255,255,0.25);
  border-radius: 100px; height: 8px;
  overflow: hidden; margin-bottom: 4px;
}
.progress-bar-fill {
  height: 100%; border-radius: 100px;
  background: white;
  transition: width 0.6s ease;
}
.progress-sub { font-size: 12px; opacity: 0.8; }

/* ===================== 统计卡片 ===================== */
.stats-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 16px; }
.stat-card {
  border-radius: var(--radius);
  padding: 20px 16px;
  text-align: center; box-shadow: var(--shadow);
}
.stat-card.blue { background: linear-gradient(135deg, #4A90E2, #667eea); color: white; }
.stat-card.pink { background: linear-gradient(135deg, #F06292, #e91e63); color: white; }
.stat-icon { font-size: 28px; margin-bottom: 4px; }
.stat-label { font-size: 12px; opacity: 0.85; margin-bottom: 4px; }
.stat-val { font-size: 28px; font-weight: 700; }

/* ===================== 奖励列表 ===================== */
.reward-list { display: flex; flex-direction: column; gap: 12px; }
.reward-card {
  background: white;
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: var(--shadow);
  display: flex; align-items: center; gap: 14px;
}
.reward-icon { font-size: 36px; flex-shrink: 0; }
.reward-info { flex: 1; }
.reward-info-name { font-size: 15px; font-weight: 600; }
.reward-info-cost { font-size: 13px; color: var(--orange); margin-top: 2px; }
.reward-actions { display: flex; gap: 8px; }

/* 观察记录卡片 */
.record-item-card {
  background: white;
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
  cursor: pointer;
  transition: transform 0.2s, box-shadow 0.2s;
  display: flex;
  flex-direction: column;
}
.record-item-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(0,0,0,0.12);
}
.record-item-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}
.record-item-icon {
  font-size: 32px;
  flex-shrink: 0;
}
.record-item-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--text);
  flex: 1;
}
.record-item-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: auto;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}
.record-item-date {
  font-size: 13px;
  color: var(--text-light);
}

/* 积分大展示 */
.points-summary { text-align: center; padding: 28px; }
.big-points {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  margin-bottom: 8px;
}
.big-points-icon { font-size: 36px; }
.big-points-num { font-size: 56px; font-weight: 800; color: var(--orange); line-height: 1; }
.big-points-label { font-size: 18px; color: var(--text-light); align-self: flex-end; padding-bottom: 8px; }
.points-tip { font-size: 13px; color: var(--text-light); }

/* 兑换记录 */
.exchange-history { display: flex; flex-direction: column; gap: 8px; }
.exchange-item {
  display: flex; align-items: center; justify-content: space-between;
  padding: 8px 0; border-bottom: 1px solid var(--border); font-size: 13px;
}
.exchange-item:last-child { border-bottom: none; }
.exchange-item-left { display: flex; align-items: center; gap: 8px; }
.exchange-points { color: var(--red); font-weight: 600; }

/* ===================== 鼓励横幅 ===================== */
.encourage-banner {
  background: linear-gradient(135deg, #f093fb, #f5576c);
  color: white; border-radius: var(--radius);
  padding: 14px 18px; margin-bottom: 12px;
  font-size: 15px; font-weight: 600;
  display: flex; align-items: center; gap: 10px;
  box-shadow: var(--shadow);
  animation: slideDown 0.4s ease;
}
.encourage-banner.hidden { display: none; }

@keyframes slideDown {
  from { opacity: 0; transform: translateY(-10px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ===================== 鼓励预设 ===================== */
.encourage-presets { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 8px; }
.preset-btn {
  background: var(--gray-light); border: 1.5px solid var(--border);
  border-radius: 20px; padding: 6px 12px;
  font-size: 12px; cursor: pointer;
  font-family: inherit; color: var(--text-light);
  transition: all 0.15s;
}
.preset-btn:hover, .preset-btn.selected {
  background: var(--purple-light); border-color: var(--purple); color: var(--purple);
}

/* emoji 选择器 */
.emoji-picker { display: flex; flex-wrap: wrap; gap: 8px; }
.emoji-opt {
  font-size: 24px; width: 40px; height: 40px;
  border-radius: 8px; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  border: 2px solid transparent; transition: all 0.15s;
}
.emoji-opt:hover, .emoji-opt.selected {
  border-color: var(--blue); background: var(--blue-light);
}

/* ===================== 模态框 ===================== */
.modal {
  position: fixed; inset: 0; z-index: 1000;
  display: flex; align-items: flex-end; justify-content: center;
}
.modal.hidden { display: none; }

/* 模态框内容居中 */
.modal-body-centered {
  text-align: center;
}

/* 大密码输入框 */
.password-input-large {
  width: 100%;
  padding: 24px 20px;
  border: 2px solid var(--border);
  border-radius: 16px;
  font-size: 28px;
  font-weight: bold;
  text-align: center;
  letter-spacing: 8px;
  box-sizing: border-box;
}

.password-input-large:focus {
  outline: none;
  border-color: var(--blue);
}

.password-input-large::placeholder {
  color: #999;
  font-weight: normal;
  font-size: 20px;
  letter-spacing: normal;
}

.modal-error {
  color: var(--red);
  font-size: 14px;
  margin-top: 12px;
  text-align: center;
}

.modal-overlay {
  position: absolute; inset: 0;
  background: rgba(0,0,0,0.45);
}

.modal-box {
  position: relative; z-index: 1;
  background: white;
  border-radius: 24px 24px 0 0;
  width: 100%; max-width: 520px;
  max-height: 90vh;
  overflow-y: auto;
  animation: slideUp 0.3s ease;
}

@keyframes slideUp {
  from { transform: translateY(100%); }
  to { transform: translateY(0); }
}

.modal-header {
  padding: 20px 20px 0;
  display: flex; align-items: center; justify-content: space-between;
  border-bottom: 1px solid var(--border);
  padding-bottom: 14px;
}
.modal-header h3 { font-size: 17px; font-weight: 700; }
.modal-close {
  background: var(--gray-light); border: none;
  width: 30px; height: 30px; border-radius: 50%;
  cursor: pointer; font-size: 14px; color: var(--text-light);
}

.modal-body { padding: 20px; }
.modal-actions { display: flex; gap: 10px; margin-top: 16px; }
.modal-actions button { flex: 1; }

/* 作业详情 */
.detail-row {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 10px 0; border-bottom: 1px solid var(--border);
  font-size: 14px;
}
.detail-row:last-child { border-bottom: none; }
.detail-label { color: var(--text-light); min-width: 70px; }
.detail-val { color: var(--text); font-weight: 500; flex: 1; line-height: 1.5; }

.detail-photo {
  width: 100%; border-radius: 12px; margin-top: 12px;
  max-height: 280px; object-fit: cover; display: block;
}

/* ===================== 通用图片上传组件 ===================== */
.img-uploader {
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  background: var(--gray-light);
  transition: border-color 0.2s, background 0.2s;
  position: relative;
  overflow: hidden;
  min-height: 130px;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
}
.img-uploader:hover,
.img-uploader.drag-over {
  border-color: var(--blue);
  background: var(--blue-light);
}
.img-uploader.drag-over::after {
  content: '松开即可上传 📥';
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 16px; font-weight: 600; color: var(--blue);
  background: rgba(235,243,253,0.92);
  border-radius: var(--radius);
  pointer-events: none;
}

.img-uploader-hint {
  text-align: center; padding: 24px 20px;
}
.upload-icon { font-size: 38px; display: block; margin-bottom: 8px; }
.uploader-main-tip { font-size: 15px; font-weight: 600; color: var(--text); margin-bottom: 4px; }
.uploader-sub-tip  { font-size: 13px; color: var(--text-light); }
.uploader-link {
  color: var(--blue); cursor: pointer; text-decoration: underline;
  text-underline-offset: 2px;
}
.uploader-link:hover { color: #3579c8; }

/* 图片上传组件隐藏类 */
.img-uploader-hint.hidden { display: none !important; }
.img-uploader-preview.hidden { display: none !important; }

.img-uploader-preview {
  width: 100%; height: 100%;
  min-height: 130px;
  display: flex; align-items: center; justify-content: center;
  padding: 8px;
  position: relative;
}
.img-uploader-preview img {
  max-width: 100%; max-height: 240px;
  border-radius: 10px; object-fit: contain;
  display: block;
}

/* 大尺寸上传器预览 (观察记录) */
.img-uploader-large .img-uploader-preview {
  min-height: 300px;
  padding: 16px;
}
.img-uploader-large .preview-item {
  width: 100% !important;
  height: 100% !important;
  min-height: 300px;
}
.img-uploader-large .preview-item img {
  max-height: 100%;
}
.uploader-remove-btn {
  position: absolute; top: 8px; right: 8px;
  width: 28px; height: 28px;
  border-radius: 50%; border: none;
  background: rgba(0,0,0,0.5); color: white;
  font-size: 13px; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: background 0.15s;
  z-index: 2;
}
.uploader-remove-btn:hover { background: rgba(244,67,54,0.85); }

/* paste 高亮提示 */
.uploader-paste-tip {
  position: absolute; inset: 0;
  background: rgba(102,126,234,0.12);
  border: 2px solid var(--blue);
  border-radius: var(--radius);
  display: flex; align-items: center; justify-content: center;
  font-size: 15px; font-weight: 600; color: var(--blue);
  pointer-events: none;
  animation: pastePulse 1s ease infinite alternate;
}
@keyframes pastePulse {
  from { opacity: 0.7; }
  to   { opacity: 1; }
}

/* ===================== 拍照上传（旧兼容保留） ===================== */

/* ===================== 庆祝弹窗 ===================== */
.celebrate-box {
  border-radius: 24px !important;
  margin: auto !important;
  width: calc(100% - 48px) !important;
  max-width: 360px !important;
  text-align: center;
  overflow: hidden;
}
.celebrate-content { padding: 24px; position: relative; z-index: 2; }
.celebrate-icon { font-size: 64px; animation: bounce 0.6s ease; }
.celebrate-box h2 { font-size: 24px; font-weight: 800; margin: 12px 0 8px; color: var(--text); }
.celebrate-box p { font-size: 15px; color: var(--text-light); margin-bottom: 12px; }
.celebrate-points {
  font-size: 20px; font-weight: 700; color: var(--orange);
  margin-bottom: 20px;
}

.fireworks {
  position: absolute; top: 0; left: 0; right: 0; bottom: 0;
  overflow: hidden; pointer-events: none; z-index: 1;
}

@keyframes bounce {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.15); }
}

/* ===================== Toast ===================== */
.toast {
  position: fixed; bottom: 80px; left: 50%; transform: translateX(-50%);
  background: rgba(50,50,50,0.9); color: white;
  border-radius: 24px; padding: 10px 20px;
  font-size: 14px; z-index: 9999;
  animation: toastIn 0.25s ease;
  white-space: nowrap;
}
.toast.hidden { display: none; }

@keyframes toastIn {
  from { opacity: 0; transform: translateX(-50%) translateY(10px); }
  to { opacity: 1; transform: translateX(-50%) translateY(0); }
}

/* ===================== 空状态 ===================== */
.empty-state {
  text-align: center; padding: 48px 24px;
  color: var(--text-light);
}
.empty-state .empty-icon { font-size: 56px; margin-bottom: 12px; }
.empty-state p { font-size: 15px; }
.empty-state .empty-sub { font-size: 13px; margin-top: 6px; }

/* ===================== 删除按钮 ===================== */
.btn-danger {
  background: #FFEBEE; color: var(--red);
  border: none; border-radius: 8px; padding: 6px 14px;
  font-size: 13px; cursor: pointer;
  font-family: inherit;
  transition: background 0.15s;
}
.btn-danger:hover { background: #FFCDD2; }

/* ===================== 响应式 ===================== */
/* 手机端（默认）全宽显示 */
@media (max-width: 599px) {
  .topbar-container, .tab-nav-container {
    max-width: 100%;
    margin: 0;
  }

  /* 窄屏 Tab 按钮缩小字号防止溢出 */
  .tab-btn {
    font-size: 12px;
    padding: 10px 4px;
    min-width: 60px;
  }

  /* 日期导航器紧凑布局 */
  .date-navigator {
    gap: 4px;
  }
  .nav-date-display {
    min-width: 100px;
    font-size: 13px;
  }
  .nav-btn {
    font-size: 12px;
    padding: 6px 10px;
  }

  /* 筛选项紧凑 */
  .overview-filter {
    gap: 6px;
  }
  .filter-btn {
    font-size: 12px;
    padding: 4px 10px;
  }

  /* 统计卡片 */
  .stats-row {
    gap: 8px;
  }

  /* 作业卡片操作按钮 */
  .hw-actions {
    gap: 6px;
  }
  .hw-actions .btn-sm {
    font-size: 12px;
    padding: 5px 10px;
  }
}

/* 超窄屏（< 360px，如旧款 iPhone SE） */
@media (max-width: 359px) {
  .tab-btn {
    font-size: 11px;
    padding: 8px 2px;
    min-width: 50px;
  }
  .content-area {
    padding: 10px;
  }
  .card {
    padding: 14px;
  }
  .login-card {
    padding: 24px 16px;
  }
  .role-grid {
    gap: 8px;
  }
  .role-btn {
    padding: 16px 8px;
  }
}

/* 平板和电脑限制宽度，模拟手机效果 */
@media (min-width: 600px) {
  /* 家长页面保持480px宽度，使用容器包裹 */
  #page-parent .content-area {
    padding: 0;
  }
  #page-parent .content-area > * {
    max-width: 480px;
    margin: 0 auto;
    padding-left: 16px;
    padding-right: 16px;
  }

  /* 孩子页面也限制480px宽度，跟顶栏一致 */
  #page-child .content-area {
    padding: 0;
  }
  #page-child .content-area > * {
    max-width: 480px;
    margin: 0 auto;
    padding-left: 16px;
    padding-right: 16px;
  }

  /* 特殊处理：进度卡片不需要左右padding，让它占满480px */
  #page-child .progress-card {
    max-width: 480px;
    margin: 0 auto 16px auto;
    padding: 20px 16px;
  }

  /* 容器宽度已在基础样式中设置为 480px */
  .modal {
    align-items: center;
  }
  .modal-box {
    border-radius: 24px !important;
    margin: auto !important;
    width: calc(100% - 32px) !important;
    max-width: 440px !important;
  }

  /* 登录页保持居中 */
  .login-card {
    padding: 40px 32px;
    max-width: 420px;
  }
}

/* ── 批量布置：星期选择 ── */
.weekday-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 4px;
}
.weekday-label {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 6px 14px;
  border-radius: 20px;
  background: #f5f5f5;
  font-size: 13px;
  cursor: pointer;
  user-select: none;
  transition: all 0.15s;
  border: 2px solid transparent;
}
.weekday-label:has(input:checked) {
  background: #E3F2FD;
  border-color: #4A90E2;
  color: #1976D2;
  font-weight: 600;
}
/* ── 版本号 ── */
.version-info {
  text-align: center;
  font-size: 11px;
  color: #aaa;
  margin-top: 20px;
}

/* ── Git风格活跃图 ── */
.activity-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 3px;
}
.activity-cell {
  width: 14px;
  height: 14px;
  border-radius: 3px;
  cursor: pointer;
  position: relative;
}
.activity-cell:hover {
  outline: 2px solid #333;
  outline-offset: -1px;
}
.level-0 { background: #ebedf0; }
.level-1 { background: #dbeafe; }
.level-2 { background: #93c5fd; }
.level-3 { background: #818cf8; }
.level-4 { background: #c084fc; }
.level-5 { background: #f472b6; }
.level-6 { background: #fb923c; }
.activity-legend {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-top: 10px;
  font-size: 12px;
  color: #666;
}
.activity-legend .activity-cell { cursor: default; }
