* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html {
  background: var(--cream);
  font-family: 'Plus Jakarta Sans', 'Zen Maru Gothic', -apple-system, sans-serif;
  color: var(--brown);
  line-height: 1.6;
}

body {
  background: transparent;
  font-family: inherit;
  color: inherit;
  overflow: hidden auto;  /* x: hidden (no horizontal scroll), y: auto (vertical scrollable) */
  line-height: inherit;
  position: relative;
  min-height: 100vh;
}

/* === Animated Background === */
.bg-sky {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: 60vh;
  background:
    radial-gradient(ellipse at top right, #FF7849 0%, transparent 50%),
    radial-gradient(ellipse at top left, #4A3F7C 0%, transparent 50%),
    linear-gradient(180deg, #1A1F3A 0%, #4A3F7C 40%, #FF7849 100%);
  z-index: 0;
  transition: opacity 0.6s;
}

.bg-sky::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image:
    radial-gradient(2px 2px at 20% 30%, white, transparent),
    radial-gradient(1px 1px at 60% 70%, white, transparent),
    radial-gradient(2px 2px at 80% 20%, white, transparent),
    radial-gradient(1px 1px at 40% 80%, white, transparent),
    radial-gradient(1.5px 1.5px at 10% 60%, white, transparent),
    radial-gradient(1px 1px at 90% 50%, white, transparent),
    radial-gradient(2px 2px at 30% 90%, white, transparent),
    radial-gradient(1px 1px at 70% 40%, white, transparent);
  background-size: 100% 100%;
  opacity: 0.6;
  animation: twinkle 5s ease-in-out infinite alternate;
}

.bg-mountains {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  height: 40vh;
  z-index: 0;
  background:
    radial-gradient(ellipse at 20% 100%, #2D3561 0%, transparent 60%),
    radial-gradient(ellipse at 80% 100%, #1A1F3A 0%, transparent 60%),
    linear-gradient(180deg, transparent 0%, var(--cream) 100%);
}

/* === Container === */
.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 24px;
  position: relative;
  z-index: 1;
}

/* === Hero === */
.hero {
  padding: 32px 0 40px;
  color: white;
  text-align: center;
  position: relative;
}

.hero-greeting {
  font-family: 'Caveat', cursive;
  font-size: 28px;
  color: var(--gold-deep);
  margin-bottom: 8px;
  letter-spacing: 1px;
  text-shadow: 0 2px 12px rgba(26, 31, 58, 0.4);
}

.hero h1 {
  font-family: 'Bagel Fat One', 'Zen Maru Gothic', sans-serif;
  font-size: clamp(36px, 7vw, 64px);
  line-height: 1;
  letter-spacing: -1px;
  text-shadow:
    0 2px 0 rgba(0, 0, 0, 0.15),
    0 4px 30px rgba(0, 0, 0, 0.4);
  margin-bottom: 12px;
}

.hero h1 .highlight {
  background: linear-gradient(180deg, transparent 60%, var(--gold) 60%);
  padding: 0 8px;
}

.hero-sub {
  font-size: 16px;
  font-weight: 600;
  color: white;
  text-shadow: 0 2px 12px rgba(26, 31, 58, 0.5);
}

/* === Phase Pill === */
.phase-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: rgba(26, 31, 58, 0.55);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.35);
  padding: 12px 22px;
  border-radius: 100px;
  font-size: 14px;
  font-weight: 700;
  color: white;
  margin-top: 24px;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
}

.phase-pill .dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--mint);
  box-shadow: 0 0 10px var(--mint);
  animation: pulse 2s infinite;
}

/* === Stat Cards === */
.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 14px;
  margin: 32px 0;
}

.stat-card {
  background: rgba(255, 255, 255, 0.95);
  border-radius: var(--radius-md);
  padding: 20px;
  box-shadow: var(--shadow-md);
  border: 1px solid rgba(255, 255, 255, 0.5);
  position: relative;
  overflow: hidden;
  transition: transform 0.3s;
}

.stat-card:hover {
  transform: translateY(-4px);
}

.stat-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 4px;
}

.stat-card.s1::before { background: var(--sunset); }
.stat-card.s2::before { background: var(--gold); }
.stat-card.s3::before { background: var(--mint); }
.stat-card.s4::before { background: var(--sunset); }

.stat-card.highlight-card {
  background: rgba(255, 255, 255, 0.95);
  border: 1px solid rgba(255, 255, 255, 0.5);
}

.stat-card.highlight-card .stat-value {
  color: var(--sunset-deep);
  font-size: 42px;
  margin-bottom: 12px;
}

.stat-progress-track {
  height: 8px;
  background: rgba(255, 120, 73, 0.12);
  border-radius: 100px;
  overflow: hidden;
  margin-bottom: 12px;
}

.stat-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--sunset), var(--gold-deep));
  border-radius: 100px;
  transition: width 0.6s cubic-bezier(0.16, 1, 0.3, 1);
  min-width: 0;
}

.stat-card.highlight-card .school-detail-text {
  color: var(--brown);
  font-weight: 600;
  font-size: 13px;
}

.stat-label {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--gray);
  margin-bottom: 8px;
}

.stat-value {
  font-family: 'Bagel Fat One', sans-serif;
  font-size: 36px;
  color: var(--night);
  line-height: 1;
  margin-bottom: 4px;
}

.stat-value .unit {
  font-size: 14px;
  font-family: 'Plus Jakarta Sans', sans-serif;
  color: var(--gray);
  margin-left: 4px;
  font-weight: 500;
}

.stat-detail {
  font-size: 13px;
  color: var(--gray);
}

/* === Tabs === */
.tabs {
  display: flex;
  gap: 4px;
  background: rgba(255, 255, 255, 0.6);
  backdrop-filter: blur(10px);
  padding: 6px;
  border-radius: 100px;
  margin: 32px 0;
  overflow-x: auto;
  scrollbar-width: none;
}

.tabs::-webkit-scrollbar { display: none; }

.tab {
  flex: 1;
  min-width: max-content;
  padding: 12px 24px;
  border-radius: 100px;
  font-size: 15px;
  font-weight: 700;
  color: var(--gray);
  cursor: pointer;
  border: none;
  background: transparent;
  transition: all 0.3s;
  white-space: nowrap;
  font-family: inherit;
}

.tab.active {
  background: var(--night);
  color: white;
  box-shadow: 0 4px 12px rgba(26, 31, 58, 0.2);
}

.tab:not(.active):hover {
  background: rgba(0, 0, 0, 0.05);
}

/* === Section Title === */
.section-title {
  font-family: 'Bagel Fat One', 'Zen Maru Gothic', sans-serif;
  font-size: 32px;
  color: var(--night);
  margin: 32px 0 8px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.section-subtitle {
  font-size: 15px;
  color: var(--gray);
  margin-bottom: 24px;
}

/* === Date Navigator === */
.date-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: white;
  border-radius: var(--radius-md);
  padding: 16px 20px;
  box-shadow: var(--shadow-sm);
  margin-bottom: 24px;
}

.date-info {
  text-align: center;
  flex: 1;
}

.date-day {
  font-family: 'Bagel Fat One', sans-serif;
  font-size: 28px;
  color: var(--night);
  line-height: 1;
}

.date-ymd {
  font-size: 13px;
  color: var(--gray);
  margin-top: 4px;
}

.date-phase-tag {
  display: inline-block;
  background: var(--mint);
  color: white;
  padding: 2px 10px;
  border-radius: 100px;
  font-size: 11px;
  font-weight: 700;
  margin-top: 6px;
}

.nav-btn {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 2px solid var(--cream-2);
  background: white;
  font-size: 20px;
  color: var(--night);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}

.nav-btn:hover:not(:disabled) {
  background: var(--sunset);
  border-color: var(--sunset);
  color: white;
  transform: scale(1.05);
}

.nav-btn:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

/* === Floating Action === */
.fab {
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--sunset), var(--sunset-deep));
  color: white;
  border: none;
  font-size: 28px;
  cursor: pointer;
  box-shadow: var(--shadow-lg), 0 0 30px rgba(255, 120, 73, 0.3);
  z-index: 100;
  transition: all 0.3s;
  display: flex;
  align-items: center;
  justify-content: center;
}

.fab:hover {
  transform: scale(1.1) rotate(90deg);
}

.fab:active {
  transform: scale(0.95);
}

/* === Footer === */
.footer {
  text-align: center;
  padding: 40px 20px;
  color: var(--gray);
  font-size: 13px;
}

.footer .signature {
  font-family: 'Caveat', cursive;
  font-size: 20px;
  color: var(--sunset);
  margin-top: 8px;
}

/* === Tablet (iPad 横屏等) === */
@media (max-width: 1024px) {
  .stats { grid-template-columns: repeat(2, 1fr); gap: 14px; }
  .stat-card.s4.highlight-card { grid-column: 1 / -1; max-width: 360px; justify-self: center; width: 100%; }
}

/* === Tablet / 大手机 (768px 以下) === */
@media (max-width: 768px) {
  html { font-size: 16px; }
  .container { padding: 0 16px; }
  .hero { padding: 24px 0 32px; }
  .hero h1 { font-size: clamp(36px, 11vw, 56px); }
  .hero-greeting { font-size: 22px; }
  .hero-sub { font-size: 15px; }
  .phase-pill { padding: 10px 18px; font-size: 13px; }
  .stats { gap: 12px; }
  .stat-card { padding: 16px; }
  .stat-value { font-size: 28px; }
  .section-title { font-size: 24px; }
  .tab { padding: 10px 16px; font-size: 13px; }
  .task-card { padding: 14px 16px; gap: 12px; }
  .task-title { font-size: 15px; }
  .subject-detail { padding: 20px; }
  .subject-detail-icon { width: 56px; height: 56px; font-size: 28px; }
  .subject-detail-title { font-size: 24px; }
  .fab { width: 56px; height: 56px; font-size: 24px; bottom: 16px; right: 16px; }
}

/* === Phone (≤ 640px) === */
@media (max-width: 640px) {
  html { font-size: 15px; }
  body { -webkit-text-size-adjust: 100%; }
  .container { padding: 0 12px; }
  .hero { padding: 18px 0 28px; }
  .hero h1 { font-size: 36px; }
  .hero-greeting { font-size: 18px; margin-bottom: 4px; }
  .hero-sub { font-size: 13px; }
  .phase-pill { padding: 8px 14px; font-size: 12px; margin-top: 16px; }

  /* 统计卡：2x2 紧凑 */
  .stats { grid-template-columns: repeat(2, 1fr); gap: 10px; margin: 24px 0; }
  .stat-card { padding: 14px; border-radius: 12px; }
  .stat-card.s4.highlight-card { grid-column: 1 / -1; max-width: none; justify-self: stretch; }
  .stat-label { font-size: 10px; letter-spacing: 0.5px; }
  .stat-value { font-size: 24px; }
  .stat-value .unit { font-size: 12px; }
  .stat-detail { font-size: 11px; }
  .stat-card.highlight-card .stat-value { font-size: 28px; }
  .stat-progress-track { height: 6px; margin-bottom: 8px; }

  .section-title { font-size: 22px; margin-top: 28px; }
  .section-subtitle { font-size: 13px; }

  /* Tabs: 横向滚动 */
  .tabs { padding: 4px; margin: 20px 0; }
  .tab { padding: 10px 14px; font-size: 12px; }

  /* 日期导航 */
  .date-nav { padding: 12px 16px; }
  .date-day { font-size: 22px; }
  .date-ymd { font-size: 11px; }
  .date-phase-tag { font-size: 10px; padding: 1px 8px; }
  .nav-btn { width: 38px; height: 38px; font-size: 18px; }

  /* 任务卡 */
  .task-card { padding: 12px 14px; gap: 10px; margin-bottom: 10px; }
  .task-checkbox { width: 24px; height: 24px; border-radius: 6px; }
  .task-checkbox::after { font-size: 14px; }
  .task-title { font-size: 14px; line-height: 1.4; }
  .task-meta { flex-wrap: wrap; gap: 6px; }
  .task-time { font-size: 11px; }
  .task-tag { font-size: 10px; padding: 2px 6px; }
  .subject-header { gap: 10px; margin-bottom: 12px; }
  .subject-icon { width: 36px; height: 36px; font-size: 18px; border-radius: 10px; }
  .subject-name { font-size: 18px; }
  .subject-progress { font-size: 12px; padding: 4px 10px; }

  /* 学科详情 */
  .subject-detail { padding: 16px; margin-bottom: 16px; border-radius: 18px; }
  .subject-detail-header { padding-bottom: 14px; margin-bottom: 14px; gap: 12px; }
  .subject-detail-icon { width: 48px; height: 48px; font-size: 24px; border-radius: 14px; }
  .subject-detail-title { font-size: 20px; }
  .subject-detail-sub { font-size: 12px; }
  .phase-list-item { padding: 12px; gap: 10px; }
  .phase-list-num { width: 28px; height: 28px; font-size: 13px; }
  .phase-list-title { font-size: 14px; }
  .phase-list-content { font-size: 13px; }
  .phase-list-content ul { padding-left: 18px !important; }
  .cat-item { padding: 5px 0; font-size: 13px; gap: 6px; }
  .cat-mini { font-size: 9px; padding: 1px 5px; }
  .cat-bar { width: 3px; min-height: 14px; margin-top: 3px; }
  .legend-school, .legend-extra { font-size: 11px; margin-left: 0; display: inline-block; margin-right: 4px; }

  /* 特殊 alert */
  .special-alert { padding: 12px 14px; gap: 10px; }
  .alert-icon { font-size: 20px; }
  .alert-title { font-size: 13px; }
  .alert-text { font-size: 12px; }

  /* 记录区 */
  .records-section { padding: 18px; margin-top: 24px; border-radius: 18px; }
  .records-header { gap: 10px; margin-bottom: 14px; }
  .records-title { font-size: 19px; }
  .records-subtitle { font-size: 11px; }
  .notes-area { min-height: 100px; padding: 12px; font-size: 14px; }
  .notes-meta { font-size: 10px; flex-direction: row; }
  .upload-buttons { grid-template-columns: 1fr 1fr; gap: 10px; }
  .upload-btn { padding: 14px 12px; font-size: 13px; }

  /* 图片网格 */
  .image-grid { grid-template-columns: repeat(3, 1fr); gap: 8px; }

  /* 记录 controls */
  .records-controls { flex-direction: column; align-items: stretch; padding: 12px; gap: 10px; }
  .records-filter { flex-wrap: wrap; }
  .export-btn { padding: 10px 16px; font-size: 13px; }

  /* 记录日卡 */
  .record-day-card { padding: 14px; margin-bottom: 12px; border-radius: 14px; }
  .record-day-date { font-size: 16px; }
  .record-day-tags { gap: 4px; }
  .record-tag { font-size: 10px; padding: 2px 8px; }
  .record-day-content { font-size: 13px; line-height: 1.6; }
  .record-day-images { grid-template-columns: repeat(3, 1fr); gap: 6px; }

  /* 成就 */
  .achievement-grid { grid-template-columns: repeat(2, 1fr); gap: 12px; }

  /* FAB */
  .fab { width: 52px; height: 52px; font-size: 22px; bottom: 12px; right: 12px; }

  /* Footer */
  .footer { padding: 24px 16px; font-size: 12px; }
  .footer .signature { font-size: 18px; }
}

/* === 小屏手机 (≤ 380px) === */
@media (max-width: 380px) {
  .hero h1 { font-size: 30px; }
  .stat-value { font-size: 20px; }
  .stat-card.highlight-card .stat-value { font-size: 24px; }
  .section-title { font-size: 20px; }
  .tab { padding: 8px 12px; font-size: 11px; }
  .image-grid { grid-template-columns: repeat(2, 1fr); }
}
