/* ========================================
   暑业王者 v2.0 - Stylesheet
   新增：PC端适配 · 管理员面板 · 邮箱注册
   ======================================== */

/* ---- CSS Variables ---- */
:root {
  --c-primary: #3B82F6;
  --c-primary-dark: #2563EB;
  --c-primary-light: #60A5FA;
  --c-primary-bg: #EFF6FF;
  --c-secondary: #10B981;
  --c-secondary-dark: #059669;
  --c-secondary-bg: #ECFDF5;
  --c-gold: #FBBF24;
  --c-gold-dark: #D97706;
  --c-orange: #F97316;
  --c-purple: #8B5CF6;
  --c-pink: #EC4899;
  --c-red: #EF4444;
  --c-danger: #EF4444;
  --c-success: #10B981;
  --c-warning: #F59E0B;

  --c-text: #1E293B;
  --c-text-secondary: #64748B;
  --c-text-light: #94A3B8;
  --c-bg: #F0F4FF;
  --c-card: #FFFFFF;
  --c-border: #E2E8F0;

  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 20px;
  --radius-xl: 28px;

  --shadow-sm: 0 1px 3px rgba(0,0,0,0.06);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.08);
  --shadow-lg: 0 8px 30px rgba(0,0,0,0.12);
  --shadow-glow: 0 0 20px rgba(59,130,246,0.3);

  --font: 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', 'Helvetica Neue', sans-serif;
  --transition: all 0.3s cubic-bezier(0.23, 1, 0.32, 1);

  /* Desktop */
  --app-max-width: 480px;
  --desktop-screen-width: 520px;
}

/* ---- Reset ---- */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  font-family: var(--font);
  background: var(--c-bg);
  color: var(--c-text);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
  min-height: 100vh;
}

button { font-family: inherit; cursor: pointer; border: none; background: none; }
input, textarea, select { font-family: inherit; outline: none; }

.hidden { display: none !important; }

/* ---- Confetti Canvas ---- */
#confettiCanvas {
  position: fixed; top: 0; left: 0; width: 100%; height: 100%;
  pointer-events: none; z-index: 9999;
}

/* ---- Toast ---- */
#toastContainer {
  position: fixed; top: 16px; left: 50%; transform: translateX(-50%);
  z-index: 10000; display: flex; flex-direction: column; gap: 8px; align-items: center;
  pointer-events: none;
}
.toast {
  background: var(--c-text); color: #fff; padding: 10px 20px;
  border-radius: 100px; font-size: 14px; font-weight: 500;
  box-shadow: var(--shadow-lg); animation: toastIn 0.4s cubic-bezier(0.34,1.56,0.64,1);
  display: flex; align-items: center; gap: 6px; white-space: nowrap;
}
.toast.success { background: var(--c-secondary); }
.toast.error { background: var(--c-danger); }
.toast.info { background: var(--c-primary); }
.toast.gold { background: linear-gradient(135deg, var(--c-gold), var(--c-orange)); }
@keyframes toastIn { from { opacity:0; transform: translateY(-20px) scale(0.8); } to { opacity:1; transform: translateY(0) scale(1); } }
@keyframes toastOut { to { opacity:0; transform: translateY(-20px) scale(0.8); } }

/* ---- Celebration Overlay ---- */
.celebration-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,0.7);
  display: flex; align-items: center; justify-content: center; z-index: 10001;
  animation: fadeIn 0.3s ease;
}
.celebration-content {
  background: linear-gradient(135deg, #fff, #f0f4ff);
  border-radius: var(--radius-xl); padding: 40px 32px; text-align: center;
  max-width: 340px; width: 90%; box-shadow: var(--shadow-lg);
  animation: celebratePop 0.6s cubic-bezier(0.34,1.56,0.64,1);
}
.celebration-icon { font-size: 72px; animation: bounce 0.8s ease infinite; }
.celebration-title { font-size: 24px; font-weight: 700; margin: 12px 0 8px; color: var(--c-text); }
.celebration-desc { font-size: 15px; color: var(--c-text-secondary); margin-bottom: 24px; }
.celebration-btn {
  background: linear-gradient(135deg, var(--c-primary), var(--c-primary-dark));
  color: #fff; padding: 14px 40px; border-radius: 100px; font-size: 16px; font-weight: 600;
  box-shadow: 0 4px 15px rgba(59,130,246,0.4); transition: var(--transition);
}
.celebration-btn:hover { transform: translateY(-2px) scale(1.03); box-shadow: 0 6px 20px rgba(59,130,246,0.5); }
.celebration-btn:active { transform: translateY(0) scale(0.98); }

/* ---- Views ---- */
.view { display: none; min-height: 100vh; }
.view.active { display: block; }

/* ============================
   AUTH VIEW
   ============================ */
#authView {
  background: linear-gradient(135deg, #3B82F6 0%, #8B5CF6 50%, #EC4899 100%);
  display: flex; align-items: center; justify-content: center; padding: 20px;
}
#authView.active { display: flex; }
.login-container {
  background: rgba(255,255,255,0.95); backdrop-filter: blur(20px);
  border-radius: var(--radius-xl); padding: 40px 28px;
  max-width: 400px; width: 100%;
  box-shadow: 0 20px 60px rgba(0,0,0,0.2); text-align: center;
  animation: cardFloat 0.6s cubic-bezier(0.34,1.56,0.64,1);
}
@keyframes cardFloat { from { opacity:0; transform: translateY(30px); } to { opacity:1; transform: translateY(0); } }
.login-logo { margin-bottom: 28px; }
.logo-icon {
  width: 80px; height: 80px; margin: 0 auto 12px;
  background: linear-gradient(135deg, var(--c-primary), var(--c-purple));
  border-radius: var(--radius-lg); display: flex; align-items: center; justify-content: center;
  font-size: 40px; box-shadow: 0 8px 25px rgba(59,130,246,0.3);
  animation: logoBounce 2s ease-in-out infinite;
}
@keyframes logoBounce { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-6px); } }
.login-logo h1 { font-size: 28px; font-weight: 800; color: var(--c-text); letter-spacing: 1px; }
.login-logo p { font-size: 14px; color: var(--c-text-secondary); margin-top: 4px; }

.input-group {
  position: relative; background: var(--c-bg); border-radius: var(--radius-md);
  border: 2px solid transparent; transition: var(--transition); margin-bottom: 12px;
}
.input-group:focus-within { border-color: var(--c-primary); background: #fff; }
.input-group input {
  width: 100%; padding: 14px 16px; background: transparent; border: none;
  font-size: 16px; color: var(--c-text); border-radius: var(--radius-md);
}
.input-group input::placeholder { color: var(--c-text-light); }

.btn-primary {
  background: linear-gradient(135deg, var(--c-primary), var(--c-primary-dark));
  color: #fff; padding: 14px; border-radius: var(--radius-md);
  font-size: 17px; font-weight: 600; transition: var(--transition);
  box-shadow: 0 4px 15px rgba(59,130,246,0.3); width: 100%;
}
.btn-primary:hover { transform: translateY(-2px); box-shadow: 0 6px 20px rgba(59,130,246,0.4); }
.btn-primary:active { transform: translateY(0); }
.btn-primary:disabled { opacity: 0.6; cursor: not-allowed; transform: none; }

.auth-switch { margin-top: 16px; font-size: 13px; color: var(--c-text-light); }
.auth-switch a { color: var(--c-primary); font-weight: 600; text-decoration: none; }
.auth-switch a:hover { text-decoration: underline; }

/* ============================
   MAIN APP LAYOUT
   ============================ */
#appView {
  max-width: var(--app-max-width); margin: 0 auto;
  background: var(--c-bg); min-height: 100vh; position: relative;
  box-shadow: 0 0 40px rgba(0,0,0,0.05);
}

/* ---- App Title Bar ---- */
.app-title-bar {
  background: linear-gradient(135deg, #1E40AF, #3B82F6, #6366F1);
  padding: 10px 18px;
  display: flex; align-items: center; justify-content: center; gap: 8px;
  box-shadow: 0 2px 8px rgba(30,64,175,0.3);
  position: sticky; top: 0; z-index: 101;
}
.app-title-icon { font-size: 22px; animation: logoBounce 2s ease-in-out infinite; }
.app-title-text {
  color: #fff; font-size: 16px; font-weight: 800;
  letter-spacing: 1px; text-shadow: 0 1px 3px rgba(0,0,0,0.2);
}

/* ---- Top Bar ---- */
.top-bar {
  position: sticky; top: 0; z-index: 100;
  background: linear-gradient(135deg, var(--c-primary), var(--c-primary-dark));
  padding: 12px 18px 10px; display: flex; align-items: center; justify-content: space-between;
  box-shadow: 0 2px 12px rgba(59,130,246,0.2);
}
.user-info { display: flex; align-items: center; gap: 10px; }
.avatar {
  width: 44px; height: 44px; border-radius: 50%; background: rgba(255,255,255,0.25);
  display: flex; align-items: center; justify-content: center; font-size: 24px;
  border: 2px solid rgba(255,255,255,0.4); transition: var(--transition);
}
.avatar:active { transform: scale(0.9); }
.user-meta { color: #fff; }
.user-name { font-size: 16px; font-weight: 700; }
.user-level { display: flex; align-items: center; gap: 6px; margin-top: 2px; }
.level-badge {
  background: var(--c-gold); color: #78350F; font-size: 11px; font-weight: 700;
  padding: 2px 8px; border-radius: 100px;
}
.level-title { font-size: 12px; opacity: 0.9; }
.points-display {
  background: rgba(255,255,255,0.2); padding: 8px 14px; border-radius: 100px;
  display: flex; align-items: center; gap: 4px; color: #fff; font-weight: 700; font-size: 15px;
  transition: var(--transition); cursor: pointer;
}
.points-display.pulse { animation: pulse 0.5s ease; }
@keyframes pulse { 0%,100% { transform: scale(1); } 50% { transform: scale(1.12); } }

/* ---- Screens ---- */
.main-content { padding-bottom: 80px; }
.screen { display: none; animation: screenIn 0.3s ease; }
.screen.active { display: block; }
@keyframes screenIn { from { opacity:0; transform: translateY(10px); } to { opacity:1; transform: translateY(0); } }

/* ---- Card Base ---- */
.card {
  background: var(--c-card); border-radius: var(--radius-lg); padding: 18px;
  margin: 12px 16px; box-shadow: var(--shadow-sm);
}

/* ---- Streak Banner ---- */
.streak-banner {
  margin: 12px 16px; border-radius: var(--radius-lg); padding: 20px;
  background: linear-gradient(135deg, #F97316, #EF4444);
  position: relative; overflow: hidden; box-shadow: 0 4px 15px rgba(249,115,22,0.3);
}
.streak-banner::before {
  content: ''; position: absolute; top: -20px; right: -20px; width: 100px; height: 100px;
  background: rgba(255,255,255,0.1); border-radius: 50%;
}
.streak-banner::after {
  content: ''; position: absolute; bottom: -30px; left: -10px; width: 80px; height: 80px;
  background: rgba(255,255,255,0.08); border-radius: 50%;
}
.streak-content { position: relative; z-index: 1; display: flex; align-items: center; gap: 14px; }
.streak-fire {
  font-size: 48px; line-height: 1;
  animation: fireFlicker 1.5s ease-in-out infinite;
  filter: drop-shadow(0 0 8px rgba(255,200,0,0.5));
}
@keyframes fireFlicker { 0%,100% { transform: scale(1) rotate(-2deg); } 50% { transform: scale(1.1) rotate(2deg); } }
.streak-info { color: #fff; flex: 1; }
.streak-count { font-size: 32px; font-weight: 800; line-height: 1; }
.streak-count .unit { font-size: 14px; font-weight: 500; opacity: 0.9; margin-left: 4px; }
.streak-label { font-size: 13px; opacity: 0.9; margin-top: 4px; }
.streak-warning {
  font-size: 12px; color: rgba(255,255,255,0.85); margin-top: 6px;
  display: flex; align-items: center; gap: 4px;
}

/* ---- Progress Ring ---- */
.progress-ring-card { text-align: center; }
.progress-ring-wrap {
  position: relative; width: 140px; height: 140px; margin: 8px auto;
}
.progress-ring-svg { transform: rotate(-90deg); width: 100%; height: 100%; }
.progress-ring-bg { fill: none; stroke: var(--c-border); stroke-width: 10; }
.progress-ring-fill {
  fill: none; stroke: url(#progressGradient); stroke-width: 10;
  stroke-linecap: round; transition: stroke-dashoffset 1s cubic-bezier(0.23,1,0.32,1);
}
.progress-ring-center {
  position: absolute; top: 50%; left: 50%; transform: translate(-50%,-50%); text-align: center;
}
.progress-ring-num { font-size: 32px; font-weight: 800; color: var(--c-text); }
.progress-ring-label { font-size: 12px; color: var(--c-text-light); }
.progress-bonus {
  margin-top: 8px; font-size: 13px; color: var(--c-gold-dark);
  background: #FEF3C7; padding: 6px 14px; border-radius: 100px; display: inline-block; font-weight: 500;
}

/* ---- Section Title ---- */
.section-title {
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 16px; margin: 20px 0 8px;
}
.section-title h3 { font-size: 16px; font-weight: 700; color: var(--c-text); display: flex; align-items: center; gap: 6px; }
.section-title .more { font-size: 13px; color: var(--c-text-light); cursor: pointer; }
.section-title .more:hover { color: var(--c-primary); }

/* ---- Daily Challenges ---- */
.challenges-scroll { display: flex; gap: 10px; overflow-x: auto; padding: 4px 16px 8px; scrollbar-width: none; }
.challenges-scroll::-webkit-scrollbar { display: none; }
.challenge-card {
  min-width: 200px; border-radius: var(--radius-md); padding: 14px; position: relative;
  overflow: hidden; transition: var(--transition); flex-shrink: 0;
}
.challenge-card.active { background: linear-gradient(135deg, var(--c-purple), #6D28D9); color: #fff; box-shadow: 0 4px 15px rgba(139,92,246,0.3); }
.challenge-card.done { background: var(--c-secondary-bg); border: 1px solid var(--c-secondary); }
.challenge-card.locked { background: #F1F5F9; opacity: 0.6; }
.challenge-icon { font-size: 28px; margin-bottom: 6px; }
.challenge-title { font-size: 14px; font-weight: 700; margin-bottom: 2px; }
.challenge-desc { font-size: 12px; opacity: 0.85; margin-bottom: 8px; }
.challenge-reward {
  font-size: 12px; font-weight: 600; display: inline-flex; align-items: center; gap: 3px;
  background: rgba(255,255,255,0.25); padding: 3px 10px; border-radius: 100px;
}
.challenge-card.done .challenge-reward { background: var(--c-secondary); color: #fff; }
.challenge-card.done .challenge-title, .challenge-card.done .challenge-desc { color: var(--c-secondary-dark); }

/* ---- Task List ---- */
.task-card {
  background: var(--c-card); border-radius: var(--radius-md); padding: 16px;
  margin: 8px 16px; display: flex; align-items: center; gap: 14px;
  box-shadow: var(--shadow-sm); transition: var(--transition); position: relative; overflow: hidden;
}
.task-card:active { transform: scale(0.98); }
.task-card::before {
  content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 4px;
}
.task-card.subject-math::before { background: var(--c-primary); }
.task-card.subject-chinese::before { background: var(--c-orange); }
.task-card.subject-english::before { background: var(--c-purple); }
.task-card.subject-science::before { background: var(--c-secondary); }
.task-card.subject-other::before { background: var(--c-pink); }
.task-icon {
  width: 48px; height: 48px; border-radius: var(--radius-sm); display: flex;
  align-items: center; justify-content: center; font-size: 24px; flex-shrink: 0;
}
.task-icon.math { background: #DBEAFE; }
.task-icon.chinese { background: #FFEDD5; }
.task-icon.english { background: #EDE9FE; }
.task-icon.science { background: #D1FAE5; }
.task-icon.other { background: #FCE7F3; }
.task-info { flex: 1; min-width: 0; }
.task-name { font-size: 15px; font-weight: 600; color: var(--c-text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.task-detail { font-size: 13px; color: var(--c-text-light); margin-top: 2px; }
.task-status { flex-shrink: 0; }
.status-badge {
  font-size: 12px; font-weight: 600; padding: 5px 12px; border-radius: 100px; white-space: nowrap;
}
.status-pending { background: var(--c-primary-bg); color: var(--c-primary); }
.status-submitted { background: #FEF3C7; color: var(--c-warning); }
.status-approved { background: var(--c-secondary-bg); color: var(--c-secondary-dark); }
.status-rejected { background: #FEE2E2; color: var(--c-danger); }
.btn-complete {
  background: linear-gradient(135deg, var(--c-primary), var(--c-primary-dark));
  color: #fff; padding: 8px 16px; border-radius: 100px; font-size: 13px; font-weight: 600;
  box-shadow: 0 2px 8px rgba(59,130,246,0.3); transition: var(--transition);
}
.btn-complete:hover { transform: translateY(-1px); box-shadow: 0 4px 12px rgba(59,130,246,0.4); }
.btn-complete:active { transform: scale(0.95); }

.task-progress-wrap {
  height: 8px;
  background: var(--c-bg);
  border-radius: 100px;
  overflow: hidden;
  margin-top: 8px;
  position: relative;
}
.task-progress-bar {
  height: 100%;
  background: linear-gradient(90deg, var(--c-primary), var(--c-secondary));
  border-radius: 100px;
  transition: width 1s cubic-bezier(0.23, 1, 0.32, 1);
  position: relative;
}
.task-progress-bar::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.3), transparent);
  animation: shimmer 2s infinite;
}
.task-progress-text {
  font-size: 11px;
  color: var(--c-text-light);
  margin-top: 4px;
  font-weight: 500;
}
.task-pct-label {
  font-size: 12px;
  font-weight: 700;
  color: var(--c-text-light);
  background: var(--c-bg);
  padding: 2px 8px;
  border-radius: 100px;
  margin-top: 4px;
}
.task-status .task-pct-label {
  font-size: 11px;
}

/* ---- Daily Quote ---- */
.daily-quote {
  margin: 20px 16px; padding: 18px; background: linear-gradient(135deg, #FEF3C7, #FDE68A);
  border-radius: var(--radius-md); text-align: center; position: relative;
}
.daily-quote .quote-icon { font-size: 24px; margin-bottom: 6px; }
.daily-quote p { font-size: 14px; color: #92400E; font-weight: 500; line-height: 1.6; }

/* ---- Empty State ---- */
.empty-state { text-align: center; padding: 40px 20px; }
.empty-state .empty-icon { font-size: 56px; margin-bottom: 12px; opacity: 0.5; }
.empty-state p { font-size: 14px; color: var(--c-text-light); }

/* ============================
   ACHIEVEMENTS SCREEN
   ============================ */
.level-progress-card { margin: 12px 16px; text-align: center; }
.level-current {
  display: inline-flex; align-items: center; gap: 8px; margin-bottom: 12px;
  background: linear-gradient(135deg, var(--c-gold), var(--c-orange));
  padding: 6px 18px; border-radius: 100px; color: #fff; font-weight: 700;
}
.level-bar-wrap { height: 12px; background: var(--c-bg); border-radius: 100px; overflow: hidden; position: relative; }
.level-bar-fill {
  height: 100%; background: linear-gradient(90deg, var(--c-gold), var(--c-orange));
  border-radius: 100px; transition: width 1s cubic-bezier(0.23,1,0.32,1); position: relative;
}
.level-bar-fill::after {
  content: ''; position: absolute; inset: 0;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.3), transparent);
  animation: shimmer 2s infinite;
}
@keyframes shimmer { 0% { transform: translateX(-100%); } 100% { transform: translateX(100%); } }
.level-info { display: flex; justify-content: space-between; margin-top: 8px; font-size: 12px; color: var(--c-text-light); }

.badge-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; padding: 8px 16px; }
.badge-item {
  background: var(--c-card); border-radius: var(--radius-md); padding: 14px 8px;
  text-align: center; box-shadow: var(--shadow-sm); transition: var(--transition); position: relative;
}
.badge-item:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); }
.badge-item.locked { opacity: 0.4; }
.badge-icon-img {
  width: 56px; height: 56px; border-radius: 50%; margin: 0 auto 6px;
  display: flex; align-items: center; justify-content: center; font-size: 28px;
}
.badge-item.unlocked .badge-icon-img {
  background: linear-gradient(135deg, #FEF3C7, #FDE68A);
  box-shadow: 0 0 12px rgba(251,191,36,0.3);
}
.badge-item.locked .badge-icon-img { background: #F1F5F9; }
.badge-name { font-size: 11px; font-weight: 600; color: var(--c-text); line-height: 1.3; }
.badge-item.locked .badge-name { color: var(--c-text-light); }
.badge-rarity {
  position: absolute; top: 4px; right: 4px; font-size: 9px; font-weight: 700;
  padding: 1px 6px; border-radius: 100px;
}
.rarity-common { background: #E0E7FF; color: #4338CA; }
.rarity-rare { background: #FCE7F3; color: #BE185D; }
.rarity-epic { background: #F3E8FF; color: #7C2D12; }
.rarity-legendary { background: linear-gradient(135deg, #FBBF24, #F97316); color: #fff; }

.stats-row { display: flex; gap: 8px; padding: 8px 16px; }
.stat-card {
  flex: 1; background: var(--c-card); border-radius: var(--radius-md); padding: 14px 10px;
  text-align: center; box-shadow: var(--shadow-sm);
}
.stat-num { font-size: 22px; font-weight: 800; }
.stat-num.blue { color: var(--c-primary); }
.stat-num.green { color: var(--c-secondary); }
.stat-num.gold { color: var(--c-gold-dark); }
.stat-num.purple { color: var(--c-purple); }
.stat-label { font-size: 11px; color: var(--c-text-light); margin-top: 2px; }

/* ============================
   LEADERBOARD SCREEN
   ============================ */
.leaderboard-tabs { display: flex; gap: 6px; padding: 12px 16px 4px; overflow-x: auto; scrollbar-width: none; }
.leaderboard-tabs::-webkit-scrollbar { display: none; }
.lb-tab {
  flex-shrink: 0; padding: 8px 16px; border-radius: 100px; font-size: 13px; font-weight: 600;
  background: var(--c-card); color: var(--c-text-secondary); transition: var(--transition); white-space: nowrap;
}
.lb-tab.active { background: var(--c-primary); color: #fff; box-shadow: 0 2px 8px rgba(59,130,246,0.3); }

.lb-podium { display: flex; align-items: flex-end; justify-content: center; gap: 10px; padding: 16px; }
.podium-item { text-align: center; flex: 1; max-width: 100px; }
.podium-avatar {
  width: 56px; height: 56px; border-radius: 50%; margin: 0 auto 6px;
  display: flex; align-items: center; justify-content: center; font-size: 28px;
  border: 3px solid; box-shadow: var(--shadow-md);
}
.podium-item:nth-child(1) .podium-avatar { border-color: var(--c-gold); }
.podium-item:nth-child(2) .podium-avatar { border-color: #CBD5E1; }
.podium-item:nth-child(3) .podium-avatar { border-color: #FB923C; }
.podium-name { font-size: 12px; font-weight: 600; color: var(--c-text); margin-bottom: 4px; }
.podium-score { font-size: 13px; font-weight: 700; color: var(--c-primary); margin-bottom: 6px; }
.podium-bar {
  border-radius: var(--radius-sm) var(--radius-sm) 0 0; padding: 8px 4px; text-align: center;
  font-size: 18px; font-weight: 800; color: #fff;
}
.podium-item:nth-child(1) .podium-bar { background: linear-gradient(180deg, #FBBF24, #D97706); height: 56px; }
.podium-item:nth-child(2) .podium-bar { background: linear-gradient(180deg, #CBD5E1, #94A3B8); height: 42px; }
.podium-item:nth-child(3) .podium-bar { background: linear-gradient(180deg, #FB923C, #EA580C); height: 32px; }

.lb-list { padding: 0 16px; }
.lb-row {
  display: flex; align-items: center; gap: 12px; padding: 12px; margin-bottom: 6px;
  background: var(--c-card); border-radius: var(--radius-md); box-shadow: var(--shadow-sm); transition: var(--transition);
}
.lb-row:hover { box-shadow: var(--shadow-md); transform: translateX(4px); }
.lb-row.me { background: var(--c-primary-bg); border: 2px solid var(--c-primary-light); }
.lb-rank { width: 28px; text-align: center; font-size: 16px; font-weight: 800; color: var(--c-text-light); }
.lb-row:nth-child(1) .lb-rank { color: var(--c-gold-dark); }
.lb-avatar {
  width: 40px; height: 40px; border-radius: 50%; background: var(--c-bg);
  display: flex; align-items: center; justify-content: center; font-size: 20px; flex-shrink: 0;
}
.lb-info { flex: 1; min-width: 0; }
.lb-name { font-size: 14px; font-weight: 600; }
.lb-meta { font-size: 11px; color: var(--c-text-light); display: flex; align-items: center; gap: 4px; }
.lb-score { font-size: 16px; font-weight: 800; color: var(--c-primary); }
.lb-score .unit { font-size: 11px; font-weight: 500; color: var(--c-text-light); }

/* ============================
   CALENDAR SCREEN
   ============================ */
.calendar-header { display: flex; align-items: center; justify-content: space-between; padding: 16px; }
.calendar-header h3 { font-size: 18px; font-weight: 700; }
.cal-nav-btn {
  width: 36px; height: 36px; border-radius: 50%; background: var(--c-card);
  display: flex; align-items: center; justify-content: center; font-size: 18px; color: var(--c-text-secondary);
  box-shadow: var(--shadow-sm); transition: var(--transition);
}
.cal-nav-btn:active { transform: scale(0.9); }
.calendar-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; padding: 0 12px; }
.cal-weekday { text-align: center; font-size: 12px; color: var(--c-text-light); padding: 8px 0; font-weight: 600; }
.cal-day {
  aspect-ratio: 1; border-radius: var(--radius-sm); display: flex; flex-direction: column;
  align-items: center; justify-content: center; font-size: 14px; position: relative; transition: var(--transition);
}
.cal-day.empty { visibility: hidden; }
.cal-day.today { border: 2px solid var(--c-primary); font-weight: 700; }
.cal-day.complete { background: var(--c-secondary); color: #fff; font-weight: 600; }
.cal-day.partial { background: #FEF3C7; color: #92400E; }
.cal-day.incomplete { background: #FEE2E2; color: var(--c-danger); }
.cal-day.future { color: var(--c-text-light); }
.cal-day .cal-dot { width: 4px; height: 4px; border-radius: 50%; margin-top: 2px; }
.cal-day.complete .cal-dot { background: #fff; }
.cal-day.partial .cal-dot { background: var(--c-warning); }
.cal-legend { display: flex; gap: 14px; padding: 12px 16px; flex-wrap: wrap; }
.cal-legend-item { display: flex; align-items: center; gap: 4px; font-size: 12px; color: var(--c-text-secondary); }
.cal-legend-dot { width: 12px; height: 12px; border-radius: 4px; }

.cal-detail { margin: 8px 16px; }
.cal-detail-date { font-size: 15px; font-weight: 700; margin-bottom: 8px; color: var(--c-text); }
.cal-detail-tasks { display: flex; flex-direction: column; gap: 6px; }
.cal-detail-task {
  display: flex; align-items: center; gap: 8px; padding: 10px 12px;
  background: var(--c-card); border-radius: var(--radius-sm); box-shadow: var(--shadow-sm);
}
.cal-detail-task .task-mini-icon { font-size: 18px; }
.cal-detail-task .task-mini-name { flex: 1; font-size: 13px; }
.cal-detail-task .task-mini-status { font-size: 12px; font-weight: 600; }

/* ============================
   PARENT SCREEN
   ============================ */
.parent-header {
  background: linear-gradient(135deg, var(--c-secondary), var(--c-secondary-dark));
  padding: 20px 16px; color: #fff;
}
.parent-header h2 { font-size: 20px; font-weight: 700; margin-bottom: 4px; }
.parent-header p { font-size: 13px; opacity: 0.9; }
.parent-child-card {
  margin: 12px 16px; background: var(--c-card); border-radius: var(--radius-lg);
  padding: 16px; box-shadow: var(--shadow-sm);
}
.parent-child-info { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; }
.parent-child-avatar {
  width: 48px; height: 48px; border-radius: 50%; background: var(--c-primary-bg);
  display: flex; align-items: center; justify-content: center; font-size: 24px;
}
.parent-child-name { font-size: 16px; font-weight: 700; }
.parent-child-level { font-size: 12px; color: var(--c-text-light); }
.parent-child-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.parent-stat { text-align: center; }
.parent-stat .num { font-size: 20px; font-weight: 800; }
.parent-stat .label { font-size: 11px; color: var(--c-text-light); }

.review-card {
  margin: 8px 16px; background: var(--c-card); border-radius: var(--radius-md);
  padding: 14px; box-shadow: var(--shadow-sm);
}
.review-card-header { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.review-student { font-size: 14px; font-weight: 600; }
.review-task { font-size: 13px; color: var(--c-text-secondary); margin-bottom: 8px; }
.review-image-placeholder {
  width: 100%; height: 120px; background: var(--c-bg); border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center; font-size: 36px; margin-bottom: 8px;
  border: 2px dashed var(--c-border);
}
.review-text { font-size: 13px; color: var(--c-text-secondary); margin-bottom: 10px; font-style: italic; }
.review-actions { display: flex; gap: 8px; }
.btn-approve { flex: 1; background: var(--c-secondary); color: #fff; padding: 10px; border-radius: var(--radius-sm); font-size: 14px; font-weight: 600; }
.btn-reject { flex: 1; background: #FEE2E2; color: var(--c-danger); padding: 10px; border-radius: var(--radius-sm); font-size: 14px; font-weight: 600; }

/* ---- Task Create Form ---- */
.task-create-card { margin: 12px 16px; }
.form-group { margin-bottom: 14px; }
.form-label { font-size: 13px; font-weight: 600; color: var(--c-text); margin-bottom: 6px; display: block; }
.form-input {
  width: 100%; padding: 12px 14px; background: var(--c-bg); border: 2px solid transparent;
  border-radius: var(--radius-sm); font-size: 15px; transition: var(--transition);
}
.form-input:focus { border-color: var(--c-primary); background: #fff; }
.form-select {
  width: 100%; padding: 12px 14px; background: var(--c-bg); border: 2px solid transparent;
  border-radius: var(--radius-sm); font-size: 15px; appearance: none; cursor: pointer;
}

.form-row-2 { display: flex; gap: 12px; }
.form-row-2 .form-col { flex: 1; }
.form-hint { font-size: 12px; color: var(--c-text-secondary); margin: -6px 0 10px 0; }

/* --- Task date range --- */
.task-date-range {
  font-size: 11px; color: var(--c-text-secondary); margin-top: 2px;
}

/* --- Edit task button (parents) --- */
.btn-edit-task {
  width: 28px; height: 28px; border-radius: 50%; border: 1px solid var(--c-border);
  background: var(--c-bg); font-size: 13px; cursor: pointer; transition: var(--transition);
  display: flex; align-items: center; justify-content: center; margin-top: 4px;
}
.btn-edit-task:hover { background: var(--c-primary); color: #fff; border-color: var(--c-primary); }

/* ============================
   ADMIN SCREEN
   ============================ */
.admin-detail-panel {
  position: fixed; inset: 0; background: #fff; z-index: 500;
  overflow-y: auto; padding: 20px; animation: slideInRight 0.3s ease;
}
@keyframes slideInRight { from { transform: translateX(100%); } to { transform: translateX(0); } }
.admin-detail-header {
  display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px;
  padding-bottom: 12px; border-bottom: 1px solid var(--c-border);
}
.admin-detail-header h3 { font-size: 18px; font-weight: 700; }
.admin-user-row {
  display: flex; align-items: center; gap: 12px; padding: 12px;
  background: var(--c-card); border-radius: var(--radius-md);
  margin-bottom: 8px; box-shadow: var(--shadow-sm); cursor: pointer; transition: var(--transition);
}
.admin-user-row:hover { box-shadow: var(--shadow-md); transform: translateX(4px); }
.admin-user-avatar {
  width: 40px; height: 40px; border-radius: 50%; background: var(--c-bg);
  display: flex; align-items: center; justify-content: center; font-size: 20px; flex-shrink: 0;
}
.admin-user-info { flex: 1; min-width: 0; }
.admin-user-name { font-size: 14px; font-weight: 600; }
.admin-user-email { font-size: 12px; color: var(--c-text-light); }
.admin-user-stats { display: flex; gap: 8px; }
.admin-user-stat { text-align: center; }
.admin-user-stat .val { font-size: 18px; font-weight: 800; color: var(--c-primary); }
.admin-user-stat .lbl { font-size: 10px; color: var(--c-text-light); }

/* ============================
   MODALS
   ============================ */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,0.6); z-index: 1000;
  display: flex; align-items: flex-end; justify-content: center;
  animation: fadeIn 0.25s ease;
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.modal-content {
  background: #fff; border-radius: var(--radius-xl) var(--radius-xl) 0 0;
  width: 100%; max-width: 480px; max-height: 85vh; overflow-y: auto;
  animation: modalSlideUp 0.35s cubic-bezier(0.34,1.56,0.64,1);
  padding: 24px 20px 32px;
}
@keyframes modalSlideUp { from { transform: translateY(100%); } to { transform: translateY(0); } }
.modal-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.modal-title { font-size: 18px; font-weight: 700; }
.modal-close {
  width: 32px; height: 32px; border-radius: 50%; background: var(--c-bg);
  display: flex; align-items: center; justify-content: center; font-size: 18px; color: var(--c-text-light);
}

/* ---- Check-in Modal ---- */
.checkin-task-info {
  display: flex; align-items: center; gap: 12px; padding: 14px;
  background: var(--c-bg); border-radius: var(--radius-md); margin-bottom: 16px;
}
.checkin-task-icon { width: 48px; height: 48px; border-radius: var(--radius-sm); display: flex; align-items: center; justify-content: center; font-size: 24px; }
.checkin-task-name { font-size: 15px; font-weight: 600; }
.checkin-task-detail { font-size: 13px; color: var(--c-text-light); }
.upload-area {
  width: 100%; min-height: 160px; border: 2px dashed var(--c-border); border-radius: var(--radius-md);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px;
  background: var(--c-bg); cursor: pointer; transition: var(--transition); margin-bottom: 12px; position: relative;
}
.upload-area:hover { border-color: var(--c-primary); background: var(--c-primary-bg); }
.upload-area.has-image { border-style: solid; padding: 0; }
.upload-icon { font-size: 40px; opacity: 0.5; }
.upload-text { font-size: 14px; color: var(--c-text-light); }
.upload-hint { font-size: 12px; color: var(--c-text-light); }
.upload-preview { width: 100%; max-height: 200px; object-fit: cover; border-radius: var(--radius-md); }
.checkin-textarea {
  width: 100%; min-height: 80px; padding: 12px 14px; background: var(--c-bg); border: 2px solid transparent;
  border-radius: var(--radius-md); font-size: 14px; resize: vertical; transition: var(--transition); margin-bottom: 12px;
}
.checkin-textarea:focus { border-color: var(--c-primary); background: #fff; }
.checkin-reward-preview {
  display: flex; align-items: center; gap: 8px; padding: 10px 14px;
  background: #FEF3C7; border-radius: var(--radius-sm); margin-bottom: 16px;
}
.checkin-reward-preview .reward-icon { font-size: 20px; }
.checkin-reward-preview .reward-text { font-size: 13px; color: #92400E; }
.checkin-reward-preview .reward-points { font-weight: 700; }

/* ============================
   BOTTOM NAV
   ============================ */
.bottom-nav {
  position: fixed; bottom: 0; left: 50%; transform: translateX(-50%);
  max-width: var(--app-max-width); width: 100%; background: rgba(255,255,255,0.95); backdrop-filter: blur(20px);
  display: flex; padding: 6px 0 env(safe-area-inset-bottom, 6px); z-index: 100;
  border-top: 1px solid var(--c-border); box-shadow: 0 -2px 12px rgba(0,0,0,0.05);
}
.nav-item {
  flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px;
  padding: 6px 0; color: var(--c-text-light); transition: var(--transition); position: relative;
}
.nav-item .nav-icon { font-size: 22px; transition: var(--transition); }
.nav-item .nav-label { font-size: 10px; font-weight: 500; }
.nav-item.active { color: var(--c-primary); }
.nav-item.active .nav-icon { transform: scale(1.15) translateY(-2px); }
.nav-item.active::before {
  content: ''; position: absolute; top: 0; width: 24px; height: 3px;
  background: var(--c-primary); border-radius: 100px;
}
.nav-item:active .nav-icon { transform: scale(0.85); }
.nav-badge {
  position: absolute; top: 2px; right: 50%; margin-right: -20px;
  width: 16px; height: 16px; border-radius: 50%; background: var(--c-danger); color: #fff;
  font-size: 10px; display: flex; align-items: center; justify-content: center; font-weight: 700;
}

/* ---- Logout Button ---- */
.logout-btn {
  position: fixed; bottom: 90px; right: calc(50% - 230px); z-index: 200;
  width: 40px; height: 40px; border-radius: 50%; background: var(--c-card);
  display: flex; align-items: center; justify-content: center; font-size: 18px;
  box-shadow: var(--shadow-md); transition: var(--transition);
}
.logout-btn:hover { transform: scale(1.1); box-shadow: var(--shadow-lg); }

/* ============================
   PC NAVIGATION ARROWS
   ============================ */
.pc-nav-arrows { display: none; }
@media (min-width: 769px) {
  .pc-nav-arrows {
    display: flex; position: fixed; top: 50%; transform: translateY(-50%);
    pointer-events: none; z-index: 150;
    left: 50%; margin-left: calc(var(--app-max-width) / -2 - 80px);
    right: auto; width: calc(var(--app-max-width) + 160px); justify-content: space-between;
  }
  .pc-nav-arrow {
    pointer-events: auto; width: 48px; height: 48px; border-radius: 50%;
    background: var(--c-card); color: var(--c-text-secondary); font-size: 28px; font-weight: 300;
    display: flex; align-items: center; justify-content: center;
    box-shadow: var(--shadow-md); transition: var(--transition);
    line-height: 1;
  }
  .pc-nav-arrow:hover { background: var(--c-primary); color: #fff; box-shadow: var(--shadow-lg); transform: scale(1.1); }
  .pc-nav-arrow:active { transform: scale(0.9); }
}

/* ============================
   ANIMATIONS
   ============================ */
@keyframes bounce { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-8px); } }
@keyframes celebratePop {
  0% { opacity: 0; transform: scale(0.5) rotate(-5deg); }
  60% { transform: scale(1.05) rotate(2deg); }
  100% { opacity: 1; transform: scale(1) rotate(0); }
}
@keyframes floatUp {
  0% { opacity: 1; transform: translateY(0) scale(1); }
  100% { opacity: 0; transform: translateY(-60px) scale(1.5); }
}
.float-points {
  position: fixed; z-index: 9998; pointer-events: none;
  font-size: 24px; font-weight: 800; color: var(--c-gold);
  text-shadow: 0 2px 4px rgba(0,0,0,0.2);
  animation: floatUp 1.2s ease-out forwards;
}

/* ---- Lucky Draw ---- */
.lucky-draw-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,0.8); z-index: 10001;
  display: flex; align-items: center; justify-content: center; flex-direction: column; gap: 20px;
}
.lucky-draw-box {
  width: 200px; height: 200px; border-radius: var(--radius-xl); position: relative;
  display: flex; align-items: center; justify-content: center; font-size: 80px;
  background: linear-gradient(135deg, var(--c-gold), var(--c-orange));
  animation: luckyShake 0.3s ease-in-out infinite, luckyGlow 1s ease-in-out infinite;
  box-shadow: 0 0 40px rgba(251,191,36,0.5);
}
@keyframes luckyShake { 0%,100% { transform: rotate(-3deg); } 50% { transform: rotate(3deg); } }
@keyframes luckyGlow { 0%,100% { box-shadow: 0 0 30px rgba(251,191,36,0.4); } 50% { box-shadow: 0 0 50px rgba(251,191,36,0.7); } }
.lucky-draw-text { color: #fff; font-size: 18px; font-weight: 700; text-align: center; }
.lucky-draw-reward { color: var(--c-gold); font-size: 28px; font-weight: 800; }

/* ---- Reduced Motion ---- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}

/* ---- Reward Progress (Student Dashboard) ---- */

.reward-progress-card {
  margin: 12px 16px; padding: 16px; border-radius: var(--radius-lg);
  background: linear-gradient(135deg, #FEF3C7, #FDE68A);
  box-shadow: 0 4px 15px rgba(251,191,36,0.2);
}
.reward-progress-header {
  display: flex; align-items: center; gap: 12px; margin-bottom: 12px;
}
.reward-goal-icon {
  width: 48px; height: 48px; border-radius: 50%;
  background: rgba(255,255,255,0.6); display: flex; align-items: center; justify-content: center;
  font-size: 28px; flex-shrink: 0;
}
.reward-goal-info { flex: 1; min-width: 0; }
.reward-goal-title { font-size: 12px; color: #92400E; font-weight: 600; margin-bottom: 2px; }
.reward-goal-name { font-size: 15px; font-weight: 700; color: #78350F; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.reward-progress-bar-wrap {
  height: 14px; background: rgba(255,255,255,0.6); border-radius: 100px; overflow: hidden; margin-bottom: 6px;
}
.reward-progress-bar-fill {
  height: 100%; background: linear-gradient(90deg, var(--c-primary), var(--c-purple));
  border-radius: 100px; transition: width 1s cubic-bezier(0.23,1,0.32,1);
  position: relative;
}
.reward-progress-bar-fill::after {
  content: ''; position: absolute; inset: 0;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.3), transparent);
  animation: shimmer 2s infinite;
}
.reward-progress-text {
  display: flex; justify-content: space-between; font-size: 12px; color: #92400E; font-weight: 500;
}
.reward-pct { font-weight: 700; }

/* ---- Reward Setting (Parent) ---- */

.reward-setting-card {
  margin: 8px 16px; padding: 16px; background: var(--c-card);
  border-radius: var(--radius-lg); box-shadow: var(--shadow-sm);
}
.reward-icon-picker {
  display: flex; gap: 6px; flex-wrap: wrap;
}
.reward-icon-option {
  width: 42px; height: 42px; border-radius: 50%; display: flex; align-items: center; justify-content: center;
  font-size: 22px; cursor: pointer; border: 2px solid transparent;
  background: var(--c-bg); transition: var(--transition);
}
.reward-icon-option:hover { border-color: var(--c-primary-light); transform: scale(1.12); }
.reward-icon-option.selected {
  border-color: var(--c-gold); background: #FEF3C7;
  box-shadow: 0 0 0 3px rgba(251,191,36,0.2);
}

/* ---- Enhanced Calendar Detail ---- */

.cal-detail {
  margin: 8px 16px; padding: 16px; background: var(--c-card);
  border-radius: var(--radius-lg); box-shadow: var(--shadow-sm);
}
.cal-detail-date {
  font-size: 16px; font-weight: 700; margin-bottom: 4px; color: var(--c-text);
  display: flex; align-items: center; gap: 6px;
}
.cal-detail-summary { font-size: 13px; color: var(--c-text-secondary); margin-bottom: 12px; }
.cal-detail-tasks { display: flex; flex-direction: column; gap: 8px; }

.cal-detail-task {
  display: flex; align-items: center; gap: 10px; padding: 12px 14px;
  background: var(--c-bg); border-radius: var(--radius-sm); transition: var(--transition);
}
.cal-detail-task.done { background: var(--c-secondary-bg); }
.cal-detail-task.pending { background: #FFFBEB; }
.cal-detail-task.rejected { background: #FEE2E2; }
.cal-detail-task .task-mini-icon { font-size: 22px; width: 36px; height: 36px; border-radius: 50%; background: var(--c-card); display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.cal-detail-task .task-mini-info { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.cal-detail-task .task-mini-name { font-size: 14px; font-weight: 600; color: var(--c-text); }
.cal-detail-task .task-mini-meta { font-size: 11px; color: var(--c-text-light); margin-top: 2px; }
.cal-detail-task .task-mini-status { font-size: 12px; font-weight: 600; white-space: nowrap; }

/* ============================
   RESPONSIVE - DESKTOP
   ============================ */
@media (min-width: 769px) {
  body { background: #e0e7ff; }
  #appView {
    max-width: 960px;
    border-radius: 0;
  }

  /* Desktop: show screens side-by-side */
  .main-content {
    display: flex; flex-wrap: wrap; gap: 0;
    padding: 16px; padding-bottom: 80px;
  }

  .screen {
    width: 100%;
    /* On desktop, screens take full width inside the wider container */
  }

  /* Cards get bigger on desktop */
  .card { margin: 12px 0; }
  .task-card { margin: 8px 0; }
  .streak-banner { margin: 12px 0; }

  .section-title { padding: 0; }

  /* Wider stats row */
  .stats-row { padding: 8px 0; gap: 12px; }
  .stat-card { padding: 18px 14px; }
  .stat-num { font-size: 26px; }

  /* Two-column dashboard on desktop */
  .dashboard-desktop-grid {
    display: grid; grid-template-columns: 1fr 1fr; gap: 16px;
  }

  /* Larger badge grid */
  .badge-grid { grid-template-columns: repeat(5, 1fr); padding: 8px 0; }

  /* Leaderboard podium larger */
  .lb-podium { max-width: 500px; margin: 0 auto; }
  .podium-item { max-width: 140px; }

  /* Calendar larger */
  .calendar-grid { padding: 0; }

  /* PC arrow navigation */
  .pc-nav-arrows {
    display: flex;
    position: fixed; top: 50%; transform: translateY(-50%);
    z-index: 150; pointer-events: none;
    left: 50%; margin-left: -520px;
    width: 1040px; justify-content: space-between;
  }
  .pc-nav-arrow {
    pointer-events: auto; width: 48px; height: 48px; border-radius: 50%;
    background: var(--c-card); color: var(--c-text-secondary); font-size: 28px;
    display: flex; align-items: center; justify-content: center;
    box-shadow: var(--shadow-md); transition: var(--transition);
    line-height: 1;
  }
  .pc-nav-arrow:hover { background: var(--c-primary); color: #fff; box-shadow: var(--shadow-lg); transform: scale(1.1); }
  .pc-nav-arrow:active { transform: scale(0.9); }

  .logout-btn { right: calc(50% - 500px); bottom: 20px; }
  .bottom-nav { max-width: 960px; }
}

/* ---- Family Registration ---- */

.family-reg-section {
  background: var(--c-card);
  border-radius: var(--radius-md);
  padding: 16px;
  margin-bottom: 12px;
  border: 1px solid var(--c-border);
}
.family-reg-section h4 {
  margin: 0 0 12px 0;
  font-size: 15px;
  color: var(--c-text);
  display: flex;
  align-items: center;
  gap: 6px;
}
.family-reg-section .input-group {
  margin-bottom: 8px;
}
.family-reg-section .input-group:last-of-type {
  margin-bottom: 0;
}

.family-children-list {
  margin-bottom: 8px;
}

.family-child-form {
  background: var(--c-bg);
  border-radius: var(--radius-sm);
  padding: 12px;
  margin-bottom: 8px;
  border: 1px dashed var(--c-border);
}
.family-child-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
  font-size: 13px;
  font-weight: 600;
  color: var(--c-text-secondary);
}

.btn-remove-child {
  background: none;
  border: none;
  color: var(--c-danger);
  cursor: pointer;
  font-size: 14px;
  padding: 2px 8px;
  border-radius: 4px;
}
.btn-remove-child:hover {
  background: #FEE2E2;
}

.family-avatar-picker {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-top: 4px;
}
.family-avatar-option {
  width: 36px; height: 36px;
  display: flex; align-items: center; justify-content: center;
  font-size: 20px;
  border-radius: 50%;
  cursor: pointer;
  border: 2px solid transparent;
  transition: var(--transition);
  background: var(--c-card);
}
.family-avatar-option:hover {
  border-color: var(--c-primary-light);
  transform: scale(1.15);
}
.family-avatar-option.selected {
  border-color: var(--c-primary);
  background: var(--c-primary-bg);
  box-shadow: 0 0 0 2px rgba(59,130,246,0.2);
}

.btn-add-child {
  width: 100%;
  padding: 10px;
  border: 2px dashed var(--c-border);
  border-radius: var(--radius-sm);
  background: var(--c-bg);
  color: var(--c-primary);
  font-size: 14px;
  cursor: pointer;
  transition: var(--transition);
  font-weight: 500;
}
.btn-add-child:hover {
  border-color: var(--c-primary);
  background: var(--c-primary-bg);
}

.family-tip-card {
  display: flex;
  gap: 10px;
  background: #FFFBEB;
  border: 1px solid #FDE68A;
  border-radius: var(--radius-sm);
  padding: 12px;
  font-size: 12px;
  color: #92400E;
  line-height: 1.6;
  margin-bottom: 8px;
}
.family-tip-card .tip-icon {
  font-size: 24px; flex-shrink: 0; padding-top: 2px;
}
.family-tip-card .tip-text strong {
  color: #78350F;
}

/* ---- Role Badges ---- */

.role-badge {
  display: inline-block;
  padding: 1px 8px;
  border-radius: 100px;
  font-size: 10px;
  font-weight: 600;
  margin-right: 6px;
  vertical-align: middle;
}
.role-badge.role-parent {
  background: #FEF3C7;
  color: #92400E;
}
.role-badge.role-student {
  background: var(--c-primary-bg);
  color: var(--c-primary-dark);
}
.role-badge.role-admin {
  background: #EDE9FE;
  color: #5B21B6;
}

/* ---- Child Selector ---- */

.child-selector-card {
  background: var(--c-card);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  margin: 0 16px 12px;
  box-shadow: var(--shadow-sm);
}
.child-selector-label {
  font-size: 12px;
  color: var(--c-text-light);
  margin-bottom: 8px;
  font-weight: 500;
}
.child-selector-buttons {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.child-select-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border-radius: 100px;
  border: 2px solid var(--c-border);
  background: var(--c-card);
  cursor: pointer;
  transition: var(--transition);
  font-size: 14px;
  font-weight: 500;
}
.child-select-btn:hover {
  border-color: var(--c-primary-light);
  background: var(--c-primary-bg);
}
.child-select-btn.selected {
  border-color: var(--c-primary);
  background: var(--c-primary);
  color: #fff;
  box-shadow: 0 2px 8px rgba(59,130,246,0.3);
}
.child-select-avatar {
  font-size: 18px;
}
.child-select-name {
  white-space: nowrap;
}

/* ---- Task Create Modal: Child Select ---- */

#taskChildSelectGroup {
  margin-bottom: 12px;
}
#taskChildSelect {
  width: 100%;
  padding: 10px 12px;
  border: 2px solid var(--c-border);
  border-radius: var(--radius-sm);
  font-size: 14px;
  background: var(--c-card);
  color: var(--c-text);
  appearance: auto;
}
#taskChildSelect option {
  padding: 8px;
}

/* Tablet / Medium screen */
@media (min-width: 481px) and (max-width: 768px) {
  body { background: #e0e7ff; }
  #appView { max-width: 100%; }
  .bottom-nav { max-width: 100%; }
  .logout-btn { right: 12px; bottom: 90px; }
}
