:root {
  --primary: #D61F69;
  --primary-hover: #B8185A;
  --primary-active: #9A1250;
  --primary-soft: #FDF2F7;
  --primary-soft-strong: #FBE0EC;
  --bg: #FFFFFF;
  --surface: #FDF6F9;
  --surface-muted: #F8EEF3;
  --text: #2D1B23;
  --text-secondary: #5A4350;
  --text-muted: #8A7580;
  --text-disabled: #B8A5B0;
  --border: #ECD5DE;
  --success: #52C41A;
  --success-soft: #E8F8E8;
  --warning: #FAAD14;
  --danger: #FF4D4F;
  --info: #0969DA;
  --info-soft: #E8F4FD;
  --radius-sm: 4px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --radius-pill: 999px;
  --font-sans: 'PingFang SC', 'Microsoft YaHei', 'Noto Sans CJK SC', sans-serif;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; -webkit-text-size-adjust: 100%; }
body {
  font-family: var(--font-sans);
  color: var(--text);
  background: #f0e8ec;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  overscroll-behavior: none;
}

#app {
  max-width: 480px;
  margin: 0 auto;
  min-height: 100vh;
  background: var(--bg);
  position: relative;
  display: flex;
  flex-direction: column;
  box-shadow: 0 0 20px rgba(0,0,0,0.06);
}

.page { display: flex; flex-direction: column; min-height: 100vh; }

/* === Header === */
.header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  background: var(--primary);
  color: #fff;
  font-size: 16px;
  font-weight: 600;
  position: sticky;
  top: 0;
  z-index: 100;
}
.header--parent { background: #0969DA; }
.header__left, .header__right { display: flex; align-items: center; gap: 8px; }
.header__logo { font-size: 20px; }
.header__center { position: absolute; left: 50%; transform: translateX(-50%); font-size: 16px; }
.header [data-action] { cursor: pointer; }

.star-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 14px;
  font-weight: 700;
}

/* === Content === */
.content {
  flex: 1;
  padding: 16px;
  padding-bottom: 80px;
}
.content--form { padding-top: 20px; }

/* === Section === */
.section { margin-bottom: 24px; }
.section__title {
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 8px;
  font-weight: 600;
}

/* === Cards === */
.wish-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--bg);
  margin-bottom: 8px;
  cursor: pointer;
  transition: box-shadow 0.15s;
}
.wish-card:active { box-shadow: 0 2px 8px rgba(214,31,105,0.12); }
.wish-card--done { background: var(--success-soft); border-color: #C6E8A0; }
.wish-card__icon {
  width: 44px; height: 44px;
  border-radius: var(--radius-md);
  background: var(--primary-soft-strong);
  display: flex; align-items: center; justify-content: center;
  font-size: 22px;
  flex-shrink: 0;
}
.wish-card--done .wish-card__icon { background: #D5EAC5; }
.wish-card__info { flex: 1; min-width: 0; }
.wish-card__name { font-size: 15px; font-weight: 600; color: var(--text); }
.wish-card__meta { font-size: 12px; color: var(--text-muted); margin-top: 2px; }
.wish-card__action { flex-shrink: 0; }

.info-card {
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface);
  margin-bottom: 16px;
}
.info-card__label { font-size: 12px; color: var(--text-muted); margin-bottom: 4px; }
.info-card__value { font-size: 15px; color: var(--text); }

/* === Progress Bar === */
.progress-section { margin: 16px 0; }
.progress-header {
  display: flex;
  justify-content: space-between;
  font-size: 13px;
  margin-bottom: 6px;
}
.progress-header span:first-child { color: var(--text-muted); }
.progress-percent { font-weight: 700; color: var(--primary); }
.progress-bar {
  height: 12px;
  background: var(--surface-muted);
  border-radius: var(--radius-pill);
  overflow: hidden;
}
.progress-bar__fill {
  height: 100%;
  background: linear-gradient(90deg, var(--primary), #E11D48);
  border-radius: var(--radius-pill);
  transition: width 0.5s ease;
}
.progress-bar--inline { height: 6px; margin-top: 6px; }
.progress-bar--inline .progress-bar__fill { background: var(--primary); }

/* === Buttons === */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 16px;
  border: none;
  border-radius: var(--radius-pill);
  font-size: 14px;
  font-weight: 600;
  font-family: var(--font-sans);
  cursor: pointer;
  transition: all 0.15s;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}
.btn--primary { background: var(--primary); color: #fff; }
.btn--primary:active { background: var(--primary-active); }
.btn--outline { background: transparent; color: var(--primary); border: 1.5px solid var(--primary); }
.btn--outline:active { background: var(--primary-soft); }
.btn--danger { background: var(--danger); color: #fff; }
.btn--danger:active { background: #E3323D; }
.btn--text { background: transparent; color: var(--text-secondary); justify-content: flex-start; padding: 10px 4px; }
.btn--text:active { color: var(--primary); }
.btn--block { display: flex; width: 100%; }
.btn--large { padding: 12px 20px; font-size: 15px; }
.btn--small { padding: 6px 12px; font-size: 12px; }
.btn--icon { width: 36px; height: 36px; padding: 0; border-radius: var(--radius-md); background: var(--surface-muted); color: var(--primary); font-size: 18px; }
.btn--icon:active { background: var(--primary-soft-strong); }
.btn--done { background: var(--surface-muted); color: var(--text-muted); cursor: default; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

.link { color: rgba(255,255,255,0.9); cursor: pointer; font-size: 13px; text-decoration: underline; }

/* === Forms === */
.form-group { margin-bottom: 20px; }
.form-group label {
  display: block;
  font-size: 13px;
  color: var(--text-secondary);
  margin-bottom: 6px;
  font-weight: 600;
}
.form-group input,
.form-group textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-md);
  font-size: 15px;
  font-family: var(--font-sans);
  color: var(--text);
  background: #fff;
  transition: border-color 0.15s;
  -webkit-appearance: none;
}
.form-group input:focus,
.form-group textarea:focus {
  outline: none;
  border-color: var(--primary);
}
.form-group textarea { min-height: 70px; resize: none; }
.form-hint { font-size: 12px; color: var(--text-muted); margin-top: 4px; line-height: 1.5; }
.form-actions { display: flex; gap: 12px; margin-top: 20px; }
.form-actions .btn { flex: 1; }

/* === Icon/Avatar Grid === */
.icon-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 8px;
}
.icon-option {
  aspect-ratio: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-md);
  cursor: pointer;
  background: #fff;
  transition: all 0.15s;
}
.icon-option--selected {
  border-color: var(--primary);
  border-width: 2px;
  background: var(--primary-soft);
}

.avatar-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 8px;
}

.grade-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}
.grade-option {
  padding: 10px;
  text-align: center;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-md);
  font-size: 14px;
  cursor: pointer;
  background: #fff;
  transition: all 0.15s;
}
.grade-option--selected {
  border-color: var(--primary);
  border-width: 2px;
  background: var(--primary-soft);
  color: var(--primary);
  font-weight: 700;
}

/* === Days Selector === */
.days-selector {
  display: flex;
  align-items: center;
  gap: 12px;
}
.days-value { font-size: 24px; font-weight: 700; color: var(--primary); min-width: 30px; text-align: center; }
.days-unit { font-size: 14px; color: var(--text-muted); }

/* === Bonus Options === */
.bonus-options { display: flex; gap: 8px; flex-wrap: wrap; }
.bonus-option {
  padding: 8px 14px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-pill);
  font-size: 13px;
  cursor: pointer;
  background: #fff;
  transition: all 0.15s;
}
.bonus-option--selected {
  border-color: var(--primary);
  background: var(--primary);
  color: #fff;
  font-weight: 600;
}

/* === Tab Bar === */
.tabbar {
  display: flex;
  border-top: 1px solid var(--border);
  background: #fff;
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: 480px;
  z-index: 100;
  padding-bottom: env(safe-area-inset-bottom, 0);
}
.tab {
  flex: 1;
  text-align: center;
  padding: 10px 0 8px;
  font-size: 11px;
  color: var(--text-muted);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.tab--active { color: var(--primary); font-weight: 600; }
.tab__icon { font-size: 20px; display: block; margin-bottom: 2px; }

/* === Badges === */
.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: var(--radius-pill);
  font-size: 11px;
  font-weight: 600;
}
.badge--success { background: var(--success-soft); color: var(--success); }
.badge--parent { background: var(--info-soft); color: var(--info); }
.badge--student { background: var(--primary-soft); color: var(--primary); }

/* === Detail Hero === */
.detail-hero { text-align: center; margin: 8px 0 20px; }
.detail-hero__icon { font-size: 56px; }
.detail-hero__name { font-size: 18px; font-weight: 700; margin-top: 8px; }
.detail-info {
  text-align: center;
  font-size: 14px;
  color: var(--text-secondary);
  margin: 16px 0;
}
.detail-info strong { color: var(--primary); font-size: 18px; }

/* === Calendar === */
.calendar-section { margin: 16px 0; }
.calendar-title { font-size: 13px; color: var(--text-muted); margin-bottom: 8px; font-weight: 600; }
.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 6px;
}
.cal-day {
  aspect-ratio: 1;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  font-weight: 600;
}
.cal-day--done { background: var(--primary); color: #fff; }
.cal-day--miss { background: var(--surface-muted); color: var(--text-disabled); }
.cal-day--today { border: 2px dashed var(--primary); color: var(--primary); background: #fff; }
.cal-day--today-done { background: var(--primary); color: #fff; border: 2px solid var(--primary-active); }
.calendar-meta { font-size: 12px; color: var(--text-muted); margin-top: 8px; }

/* === Empty State === */
.empty-state {
  text-align: center;
  padding: 48px 20px;
}
.empty-state__icon { font-size: 48px; margin-bottom: 12px; }
.empty-state__title { font-size: 16px; font-weight: 600; color: var(--text-secondary); margin-bottom: 6px; }
.empty-state__desc { font-size: 13px; color: var(--text-muted); margin-bottom: 20px; }

/* === Toast === */
.toast {
  position: fixed;
  bottom: 100px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(45,27,35,0.92);
  color: #fff;
  padding: 10px 20px;
  border-radius: var(--radius-pill);
  font-size: 14px;
  z-index: 200;
  animation: toastIn 0.25s ease;
  white-space: nowrap;
}
@keyframes toastIn {
  from { opacity: 0; transform: translate(-50%, 10px); }
  to { opacity: 1; transform: translate(-50%, 0); }
}

/* === Celebration Overlay === */
.celebration {
  position: fixed;
  inset: 0;
  background: rgba(45,27,35,0.85);
  z-index: 300;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}
.celebration__content {
  text-align: center;
  z-index: 2;
  padding: 20px;
  animation: celebPop 0.4s ease;
}
@keyframes celebPop {
  0% { transform: scale(0.5); opacity: 0; }
  60% { transform: scale(1.08); }
  100% { transform: scale(1); opacity: 1; }
}
.celebration__icon { font-size: 72px; animation: celebBounce 0.6s ease 0.3s; }
@keyframes celebBounce {
  0% { transform: translateY(0); }
  50% { transform: translateY(-20px); }
  100% { transform: translateY(0); }
}
.celebration__title {
  font-size: 28px;
  font-weight: 700;
  color: #fff;
  margin: 12px 0 8px;
}
.celebration__summary {
  font-size: 15px;
  color: rgba(255,255,255,0.85);
  margin-bottom: 24px;
}
.celebration__summary strong { color: #FFD700; font-size: 18px; }
.star-rain {
  position: absolute;
  inset: 0;
  pointer-events: none;
}
.star-particle {
  position: absolute;
  font-size: 16px;
  animation: starFall linear forwards;
  top: -20px;
}
@keyframes starFall {
  to { transform: translateY(100vh); }
}

/* === Wish Preview (Condition page) === */
.wish-preview {
  padding: 16px;
  background: var(--surface);
  border-radius: var(--radius-lg);
  margin-bottom: 20px;
  text-align: center;
}
.wish-preview__label { font-size: 12px; color: var(--text-muted); }
.wish-preview__icon { font-size: 40px; margin: 8px 0 4px; }
.wish-preview__name { font-size: 16px; font-weight: 700; }
.wish-preview__desc { font-size: 13px; color: var(--text-secondary); margin-top: 6px; font-style: italic; }
.wish-preview__reject { font-size: 13px; color: var(--danger); margin-top: 8px; background: #FFF0F0; padding: 8px; border-radius: var(--radius-md); }

/* === Profile === */
.profile-card {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 20px;
  background: var(--primary-soft);
  border-radius: var(--radius-lg);
  margin-bottom: 16px;
}
.profile-card__avatar { font-size: 48px; }
.profile-card__info { flex: 1; }
.profile-card__name { font-size: 18px; font-weight: 700; }
.profile-card__grade { font-size: 13px; color: var(--text-muted); }
.profile-card__stars { font-size: 14px; color: var(--primary); font-weight: 700; }

.settings-section { margin: 20px 0; }
.settings-section h3 { font-size: 14px; color: var(--text-muted); margin-bottom: 8px; font-weight: 600; }
.about-section { margin-top: 32px; text-align: center; }
.about-section h3 { font-size: 14px; color: var(--text-muted); margin-bottom: 4px; font-weight: 600; }
.about-section p { font-size: 12px; color: var(--text-muted); line-height: 1.8; }

/* === Onboarding === */
.onboarding { display: flex; flex-direction: column; min-height: 100vh; padding: 0; }
.onboarding__hero {
  text-align: center;
  padding: 48px 20px 24px;
  background: linear-gradient(135deg, var(--primary), #E11D48);
  color: #fff;
}
.onboarding__logo { font-size: 64px; }
.onboarding__title { font-size: 28px; font-weight: 700; margin-top: 8px; }
.onboarding__subtitle { font-size: 14px; opacity: 0.9; margin-top: 8px; }
.onboarding__form { padding: 24px 20px 40px; flex: 1; }

/* === Misc === */
.wall-summary { font-size: 13px; color: var(--text-muted); margin-bottom: 12px; }
.wall-footer { text-align: center; padding: 24px 0; font-size: 13px; color: var(--text-muted); }
.parent-badge { font-size: 11px; color: var(--info); }
.reject-reason { font-size: 13px; color: var(--danger); background: #FFF0F0; padding: 8px 10px; border-radius: var(--radius-md); margin-top: 6px; }
