/* ===== 全局 ===== */
* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Helvetica Neue", Arial, sans-serif;
  background: #eef1f6;
  min-height: 100vh;
  color: #2c3e50;
  padding: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ===== 手机框 ===== */
.phone-frame {
  width: 375px;
  height: 720px;
  background: #000;
  border-radius: 40px;
  padding: 12px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.4);
  position: relative;
}
.phone-screen {
  width: 100%;
  height: 100%;
  background: #f5f7fa;
  border-radius: 30px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  position: relative;
}
.status-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 6px 22px 4px;
  font-size: 12px;
  font-weight: 600;
  background: #fff;
  flex-shrink: 0;
}
.app-content {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}
.app-content::-webkit-scrollbar { width: 0; }

/* ===== 底部 Tab ===== */
.tab-bar {
  display: flex;
  background: #fff;
  border-top: 1px solid #eef0f4;
  flex-shrink: 0;
  height: 56px;
}
.tab-item {
  flex: 1;
  border: none;
  background: #fff;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  cursor: pointer;
  color: #999;
  font-size: 11px;
  transition: color 0.2s;
}
.tab-item .tab-icon { font-size: 20px; }
.tab-item.active { color: #7EC699; }
.tab-item.parent-theme.active { color: #8BC9A5; }

/* ===== 通用 ===== */
.page { padding: 16px; }
.page-header {
  display: flex;
  align-items: center;
  padding: 16px;
  background: #fff;
  border-bottom: 1px solid #f0f0f0;
}
.back-btn {
  background: none; border: none; font-size: 20px; color: #333; cursor: pointer; padding: 4px 8px;
}
.page-title { font-size: 17px; font-weight: 600; margin-left: 4px; }
.btn {
  border: none; border-radius: 24px; padding: 14px; font-size: 16px; font-weight: 600;
  cursor: pointer; width: 100%; transition: opacity 0.2s, transform 0.1s;
}
.btn:active { transform: scale(0.98); }
.btn-primary { background: #7EC699; color: #fff; }
.btn-parent { background: #8BC9A5; color: #fff; }
.btn-success { background: #27ae60; color: #fff; }
.btn-ghost { background: #fff; color: #7EC699; border: 1.5px solid #7EC699; }
.btn-danger { background: #fff; color: #e74c3c; border: 1.5px solid #e74c3c; }
.btn:disabled { opacity: 0.5; }

/* ===== 学生端 - 今日 ===== */
.today-hero {
  background: linear-gradient(135deg, #7EC699 0%, #6BB585 100%);
  color: #fff;
  padding: 16px;
  border-radius: 0 0 20px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.today-hero-left { flex: 1; }
.today-greet { font-size: 18px; font-weight: 600; }
.today-date { font-size: 12px; opacity: 0.9; margin-top: 3px; }
.streak-badge {
  display: inline-flex; align-items: center; gap: 4px;
  background: rgba(255,255,255,0.25);
  padding: 3px 8px; border-radius: 10px;
  font-size: 11px; margin-top: 8px;
}
.ring-wrap {
  flex-shrink: 0;
}
.ring {
  width: 80px; height: 80px; border-radius: 50%;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  position: relative;
}
.ring::before {
  content: '';
  position: absolute; inset: 5px;
  border-radius: 50%; background: rgba(255,255,255,0.15);
}
.ring-inner { position: relative; text-align: center; }
.ring-num { font-size: 20px; font-weight: 700; }
.ring-label { font-size: 10px; opacity: 0.85; margin-top: 1px; }

.section-title {
  display: flex; justify-content: space-between; align-items: center;
  margin: 14px 0 10px; font-size: 15px; font-weight: 600;
}
.section-title .more { font-size: 12px; color: #999; font-weight: 400; }

.task-card {
  background: #fff; border-radius: 16px; padding: 14px;
  margin-bottom: 10px; display: flex; align-items: center; gap: 12px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.04);
}
.task-icon {
  width: 44px; height: 44px; border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  font-size: 22px; flex-shrink: 0;
}
.task-info { flex: 1; min-width: 0; }
.task-name { font-size: 15px; font-weight: 600; }
.task-meta { font-size: 12px; color: #999; margin-top: 3px; }
.task-progress { font-size: 13px; font-weight: 600; margin-top: 2px; }
.task-progress.done { color: #27ae60; }
.task-btn {
  border: none; border-radius: 18px; padding: 8px 16px;
  font-size: 13px; font-weight: 600; cursor: pointer; color: #fff;
  flex-shrink: 0;
}
.task-btn.start { background: #7EC699; }
.task-btn.continue { background: #f39c12; }
.task-btn.done { background: #bdc3c7; }
.task-btn:active { transform: scale(0.95); }

/* ===== 打卡进行中 ===== */
.checkin-page {
  display: flex; flex-direction: column; align-items: center;
  padding: 40px 24px; height: 100%; text-align: center;
  background: linear-gradient(180deg, #fff 0%, #f5f7fa 100%);
}
.checkin-icon {
  width: 80px; height: 80px; border-radius: 20px;
  display: flex; align-items: center; justify-content: center;
  font-size: 40px; margin-bottom: 16px;
}
.checkin-task-name { font-size: 18px; font-weight: 600; margin-bottom: 40px; }
.timer {
  font-size: 56px; font-weight: 300; font-variant-numeric: tabular-nums;
  letter-spacing: 2px; color: #2c3e50;
}
.timer-label { font-size: 13px; color: #999; margin-top: 6px; }
.checkin-actions {
  display: flex; gap: 16px; margin-top: 50px; width: 100%;
}
.checkin-actions .btn { flex: 1; }
.btn-pause { background: #fff; color: #f39c12; border: 1.5px solid #f39c12; }
.paused-mask {
  position: absolute; inset: 0; background: rgba(0,0,0,0.4);
  display: none; align-items: center; justify-content: center;
  color: #fff; font-size: 18px; z-index: 10;
}

/* ===== 结算页 ===== */
.settle-page {
  display: flex; flex-direction: column; align-items: center;
  padding: 32px 24px; text-align: center;
}
.settle-title { font-size: 16px; color: #999; }
.settle-icon {
  width: 72px; height: 72px; border-radius: 18px;
  display: flex; align-items: center; justify-content: center;
  font-size: 36px; margin: 16px 0 8px;
}
.settle-task { font-size: 18px; font-weight: 600; }
.settle-duration {
  font-size: 40px; font-weight: 700; color: #7EC699; margin: 20px 0 8px;
}
.settle-progress { font-size: 15px; color: #27ae60; margin-bottom: 24px; }
.rate-block { width: 100%; margin-bottom: 20px; }
.rate-label { font-size: 14px; color: #666; margin-bottom: 10px; text-align: left; }
.star-row, .mood-row {
  display: flex; gap: 12px; justify-content: flex-start;
}
.star, .mood {
  width: 40px; height: 40px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 22px; cursor: pointer; background: #f0f0f0; transition: all 0.15s;
}
.star.active, .mood.active { background: #7EC699; transform: scale(1.1); }

/* ===== 任务管理 ===== */
.task-list-item {
  background: #fff; border-radius: 14px; padding: 14px;
  margin-bottom: 10px; display: flex; align-items: center; gap: 12px;
  box-shadow: 0 2px 6px rgba(0,0,0,0.04);
}
.fab {
  position: absolute; right: 16px; bottom: 72px;
  width: 52px; height: 52px; border-radius: 50%;
  background: #7EC699; color: #fff; border: none;
  font-size: 28px; box-shadow: 0 6px 16px rgba(126,198,153,0.5);
  cursor: pointer; z-index: 5;
}
.fab:active { transform: scale(0.9); }

/* ===== 表单 ===== */
.form-group { margin-bottom: 18px; }
.form-label { display: block; font-size: 13px; color: #666; margin-bottom: 8px; }
.form-input {
  width: 100%; border: 1.5px solid #e0e0e0; border-radius: 12px;
  padding: 12px; font-size: 15px; background: #fff;
}
.form-input:focus { outline: none; border-color: #7EC699; }
.icon-picker, .color-picker {
  display: flex; gap: 10px; flex-wrap: wrap;
}
.icon-opt, .color-opt {
  width: 44px; height: 44px; border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  font-size: 22px; cursor: pointer; border: 2px solid transparent;
  background: #f5f5f5;
}
.icon-opt.active, .color-opt.active { border-color: #7EC699; }
.target-row { display: flex; gap: 10px; }
.target-row .form-input:first-child { flex: 1; }
.target-row .form-input:last-child { width: 90px; }

/* ===== 个人页 ===== */
.profile-card {
  background: linear-gradient(135deg, #7EC699 0%, #6BB585 100%);
  color: #fff; padding: 24px; text-align: center; border-radius: 0 0 24px 24px;
}
.profile-avatar { font-size: 56px; }
.profile-name { font-size: 20px; font-weight: 600; margin-top: 6px; }
.profile-sub { font-size: 13px; opacity: 0.9; margin-top: 2px; }
.menu-list { padding: 16px; }
.menu-item {
  background: #fff; border-radius: 12px; padding: 14px 16px;
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 8px; cursor: pointer; font-size: 15px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.04);
}
.menu-item .arrow { color: #ccc; }

/* ===== 成就 ===== */
.achievement-grid {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; padding: 16px;
}
.ach-card {
  background: #fff; border-radius: 14px; padding: 16px 8px; text-align: center;
  box-shadow: 0 2px 6px rgba(0,0,0,0.04);
}
.ach-icon { font-size: 32px; }
.ach-name { font-size: 12px; font-weight: 600; margin-top: 6px; }
.ach-locked { filter: grayscale(1); opacity: 0.4; }

/* ===== 家长端 ===== */
.parent-hero {
  background: linear-gradient(135deg, #9BD9B0 0%, #7EC699 100%);
  color: #fff; padding: 20px 16px; border-radius: 0 0 24px 24px;
}
.parent-child-row {
  display: flex; align-items: center; gap: 10px; margin-top: 12px;
}
.parent-child-row .pc-avatar { font-size: 32px; }
.parent-child-row .pc-name { font-size: 16px; font-weight: 600; }

.stat-card {
  background: #fff; border-radius: 14px; padding: 14px;
  margin-bottom: 10px; box-shadow: 0 2px 6px rgba(0,0,0,0.04);
}
.stat-card-title {
  font-size: 13px; color: #999; margin-bottom: 8px;
  display: flex; justify-content: space-between;
}
.stat-big-num { font-size: 28px; font-weight: 700; color: #8BC9A5; }
.stat-big-num small { font-size: 14px; color: #999; font-weight: 400; }

.progress-bar {
  height: 8px; background: #f0f0f0; border-radius: 4px; overflow: hidden; margin-top: 8px;
}
.progress-bar-fill { height: 100%; background: #8BC9A5; border-radius: 4px; transition: width 0.5s; }

/* ===== 图表 ===== */
.bar-chart {
  display: flex; align-items: flex-end; gap: 6px;
  height: 120px; padding: 10px 0;
}
.bar-col { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 4px; height: 100%; justify-content: flex-end; }
.bar { width: 100%; max-width: 28px; background: #8BC9A5; border-radius: 4px 4px 0 0; min-height: 2px; transition: height 0.5s; }
.bar.today { background: #e74c3c; }
.bar-label { font-size: 10px; color: #999; }
.bar-val { font-size: 10px; color: #666; }

.tab-switch {
  display: flex; background: #fff; margin: 0 0 12px; border-radius: 12px; padding: 4px; gap: 4px;
}
.tab-switch button {
  flex: 1; border: none; background: transparent; padding: 8px;
  font-size: 13px; color: #666; border-radius: 8px; cursor: pointer;
}
.tab-switch button.active { background: #8BC9A5; color: #fff; font-weight: 600; }

/* ===== 热力图 ===== */
.heatmap-wrap { overflow-x: auto; padding: 4px 0; }
.heatmap {
  display: grid;
  grid-template-columns: 40px repeat(7, 1fr);
  gap: 3px; font-size: 10px; min-width: 300px;
}
.hm-cell {
  height: 24px; border-radius: 4px; display: flex; align-items: center; justify-content: center;
  color: #fff; font-size: 9px;
}
.hm-label { color: #999; }
.hm-legend {
  display: flex; align-items: center; gap: 6px; font-size: 11px; color: #999; margin-top: 8px;
}
.hm-legend .sq { width: 12px; height: 12px; border-radius: 3px; }

/* ===== 周报 ===== */
.weekly-card {
  background: #fff; border-radius: 14px; padding: 16px; margin-bottom: 12px;
  box-shadow: 0 2px 6px rgba(0,0,0,0.04);
}
.weekly-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.weekly-date { font-size: 14px; font-weight: 600; }
.weekly-tag { font-size: 11px; padding: 2px 8px; border-radius: 8px; background: #e8f5ec; color: #5BA882; }
.weekly-row { display: flex; justify-content: space-between; font-size: 13px; padding: 4px 0; color: #555; }
.weekly-row b { color: #2c3e50; }
.weekly-summary { font-size: 13px; color: #666; margin-top: 8px; padding-top: 8px; border-top: 1px solid #f0f0f0; }

/* ===== 提醒 ===== */
.alert-item {
  background: #fff8e1; border-left: 3px solid #ffc107;
  border-radius: 8px; padding: 10px 12px; margin-bottom: 8px;
  font-size: 13px; color: #8d6e63;
}
.alert-item .alert-title { font-weight: 600; margin-bottom: 2px; }

/* ===== 空状态 ===== */
.empty { text-align: center; padding: 40px 20px; color: #bbb; font-size: 14px; }

/* ===== Toast ===== */
.toast {
  position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);
  background: rgba(0,0,0,0.8); color: #fff; padding: 10px 18px;
  border-radius: 8px; font-size: 14px; z-index: 100;
  opacity: 0; transition: opacity 0.25s; pointer-events: none;
}
.toast.show { opacity: 1; }

/* ===== 响应式：手机 & 平板全屏适配（桌面端保留手机框） ===== */
@media (max-width: 1024px) {
  body { padding: 0; background: #f5f7fa; align-items: stretch; }
  /* 应用容器：全屏，去掉手机外框 */
  .phone-frame {
    width: 100%;
    max-width: 500px; /* 平板居中限宽，手机自动占满 */
    flex: 1;
    height: auto;
    border-radius: 0;
    padding: 0;
    background: #f5f7fa;
    box-shadow: none;
  }
  .phone-screen { border-radius: 0; }
  /* 隐藏模拟状态栏（设备自带） */
  .status-bar { display: none; }
  /* 底部 tab 适配 Home 指示条 */
  .tab-bar { padding-bottom: env(safe-area-inset-bottom); }
  /* 登录遮罩全屏 */
  .login-mask { border-radius: 0; }
}

/* ===== 登录页 ===== */
.login-mask {
  position: fixed; inset: 0; z-index: 1000;
  background: linear-gradient(160deg, #D4F0DD 0%, #B8E6CC 100%);
  display: flex; align-items: center; justify-content: center;
}
.login-card {
  width: 280px; text-align: center; padding: 32px 24px;
  background: #fff; border-radius: 24px;
  box-shadow: 0 12px 40px rgba(91, 168, 130, 0.18);
}
.login-logo { font-size: 56px; }
.login-title {
  font-size: 22px; font-weight: 700; color: #5BA882;
  margin-top: 6px; letter-spacing: 1px;
}
.login-sub { font-size: 13px; color: #9aa5b1; margin-top: 4px; margin-bottom: 20px; }
.login-input {
  width: 100%; padding: 14px 16px; font-size: 16px;
  border: 2px solid #E8F0EC; border-radius: 14px;
  text-align: center; letter-spacing: 2px; outline: none;
  transition: border-color 0.2s; box-sizing: border-box;
}
.login-input:focus { border-color: #7EC699; }
.login-btn {
  width: 100%; margin-top: 14px; padding: 14px;
  border: none; border-radius: 14px; font-size: 16px; font-weight: 600;
  background: linear-gradient(135deg, #7EC699 0%, #6BB585 100%);
  color: #fff; cursor: pointer; transition: transform 0.1s;
}
.login-btn:active { transform: scale(0.98); }
.login-hint {
  font-size: 11px; color: #b5bcc6; margin-top: 16px; line-height: 1.6;
}
