@import url('https://fonts.googleapis.com/css2?family=LXGW+WenKai+TC:wght@300;400;700&family=Outfit:wght@300;400;500;600;700&display=swap');

/* === CSS Variables — Lavender Mist === */
:root {
  --color-bg: #F6F2FA;
  --color-text: #2a2640;
  --color-text-light: #9a94a8;
  --color-primary: #7B6FA0;
  --color-primary-light: #EEEAF4;
  --color-primary-dark: #5C5280;
  --color-border: #DDD8E8;
  --color-card-bg: #FFFFFF;
  --color-success: #6B8F7B;
  --color-sage: #8BAA8E;
  --color-lavender: #C4A7D7;
  --color-warm-cream: #F0ECF6;
  --radius: 16px;
  --radius-sm: 10px;
  --spacing: 16px;
  --nav-height: 68px;
  --header-height: 92px;
  --shadow-sm: 0 2px 8px rgba(42,38,64,0.04), 0 1px 2px rgba(42,38,64,0.06);
  --shadow-md: 0 4px 16px rgba(42,38,64,0.06), 0 2px 4px rgba(42,38,64,0.04);
  --shadow-lg: 0 8px 32px rgba(42,38,64,0.08), 0 4px 8px rgba(42,38,64,0.04);
}

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

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

body {
  font-family: 'Outfit', -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  background: var(--color-bg);
  color: var(--color-text);
  line-height: 1.6;
  padding-top: var(--header-height);
  padding-bottom: calc(var(--nav-height) + 16px);
  min-height: 100vh;
  background-image: radial-gradient(circle at 20% 50%, rgba(123,111,160,0.04) 0%, transparent 50%),
                    radial-gradient(circle at 80% 20%, rgba(139,170,142,0.05) 0%, transparent 50%),
                    radial-gradient(circle at 50% 80%, rgba(196,167,215,0.04) 0%, transparent 50%);
}

/* === Header === */
#app-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  background: linear-gradient(160deg, #9B8EC0 0%, #7B6FA0 40%, #6B8F7B 100%);
  color: #FFF;
  padding: 16px var(--spacing) 20px;
  text-align: center;
  overflow: hidden;
}

#app-header::before {
  content: '';
  position: absolute;
  top: -40px;
  right: -30px;
  width: 140px;
  height: 140px;
  border-radius: 50%;
  background: rgba(255,255,255,0.08);
  pointer-events: none;
}

#app-header::after {
  content: '';
  position: absolute;
  bottom: -12px;
  left: 0;
  right: 0;
  height: 24px;
  background: var(--color-bg);
  border-radius: 50% 50% 0 0 / 100% 100% 0 0;
  background-image: radial-gradient(circle at 20% 50%, rgba(123,111,160,0.04) 0%, transparent 50%),
                    radial-gradient(circle at 80% 20%, rgba(139,170,142,0.05) 0%, transparent 50%);
}

#app-header h1 {
  font-family: 'LXGW WenKai TC', serif;
  font-size: 22px;
  font-weight: 700;
  letter-spacing: 3px;
  position: relative;
}

#baby-info {
  font-size: 12px;
  opacity: 0.75;
  margin-top: 6px;
  letter-spacing: 1px;
  position: relative;
}

/* === Main Content === */
#app-content { padding: var(--spacing); max-width: 480px; margin: 0 auto; }

/* === Bottom Nav === */
#app-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 100;
  display: flex;
  background: rgba(246,242,250,0.92);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-top: 1px solid rgba(123,111,160,0.1);
}

.nav-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 60px;
  padding: 8px 0;
  text-decoration: none;
  color: #9a94a8;
  font-size: 10px;
  font-weight: 500;
  transition: color 0.3s, transform 0.2s;
  -webkit-tap-highlight-color: transparent;
  position: relative;
}

.nav-item.active {
  color: var(--color-primary);
}

.nav-item.active::before {
  content: '';
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 24px;
  height: 3px;
  background: var(--color-primary);
  border-radius: 0 0 3px 3px;
}

.nav-icon { font-size: 22px; margin-bottom: 3px; transition: transform 0.2s; }
.nav-item.active .nav-icon { transform: scale(1.1); }
.nav-label { font-size: 10px; letter-spacing: 0.3px; }

/* === Stage Selector === */
.stage-selector {
  display: flex;
  gap: 8px;
  margin-bottom: var(--spacing);
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.stage-btn {
  padding: 8px 18px;
  border: 1.5px solid var(--color-border);
  border-radius: 24px;
  background: var(--color-card-bg);
  color: var(--color-text);
  font-size: 13px;
  font-weight: 500;
  white-space: nowrap;
  cursor: pointer;
  transition: all 0.25s;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  box-shadow: var(--shadow-sm);
}

.stage-btn.active {
  background: var(--color-primary);
  border-color: var(--color-primary);
  color: #FFF;
  box-shadow: 0 4px 14px rgba(123,111,160,0.3);
}

/* === Time Slot Card === */
.slot-card {
  background: var(--color-card-bg);
  border-radius: var(--radius);
  margin-bottom: var(--spacing);
  overflow: hidden;
  box-shadow: var(--shadow-md);
  transition: transform 0.2s, box-shadow 0.2s;
  border-left: 4px solid var(--color-lavender);
}

.slot-card:nth-child(2) { border-left-color: var(--color-sage); }
.slot-card:nth-child(3) { border-left-color: #A0C4E8; }
.slot-card:nth-child(4) { border-left-color: #D4A574; }
.slot-card:nth-child(5) { border-left-color: var(--color-lavender); }
.slot-card:nth-child(6) { border-left-color: #8B9DC8; }
.slot-card:nth-child(7) { border-left-color: #C4A7D7; }

.slot-header {
  padding: 14px var(--spacing);
  display: flex;
  align-items: center;
  gap: 12px;
  border-bottom: 1px solid rgba(0,0,0,0.03);
}

.slot-icon { font-size: 26px; filter: drop-shadow(0 1px 2px rgba(0,0,0,0.1)); }

.slot-title {
  font-family: 'LXGW WenKai TC', serif;
  font-size: 16px;
  font-weight: 700;
  flex: 1;
}

.slot-meta {
  font-size: 12px;
  color: var(--color-text-light);
  text-align: right;
}

.slot-meta .caregiver { font-weight: 600; color: var(--color-text); }

.slot-body { padding: 0 var(--spacing) var(--spacing); }

/* Dark slot for night time */
.slot-card.dark {
  background: linear-gradient(135deg, #1C1A2E 0%, #252340 100%);
  color: #C8C4D8;
  border-left-color: #8B9DC8;
}
.slot-card.dark .slot-header { border-bottom-color: rgba(255,255,255,0.06); }
.slot-card.dark .slot-meta { color: #7A7890; }
.slot-card.dark .slot-meta .caregiver { color: #B0AEC5; }
.slot-card.dark .task-text { color: #C8C4D8; }
.slot-card.dark .task-checkbox { border-color: #4A4860; }
.slot-card.dark .task-item { border-bottom-color: rgba(255,255,255,0.05); }

/* === Checklist === */
.task-list { list-style: none; }

.task-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid rgba(0,0,0,0.05);
  min-height: 44px;
}

.task-item:last-child { border-bottom: none; }

.task-checkbox {
  width: 22px;
  height: 22px;
  border: 2px solid #C4BED4;
  border-radius: 6px;
  flex-shrink: 0;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
  margin-top: 1px;
  -webkit-tap-highlight-color: transparent;
}

.task-checkbox.checked {
  background: var(--color-primary);
  border-color: var(--color-primary);
}

.task-checkbox.checked::after {
  content: "✓";
  color: #FFF;
  font-size: 14px;
  font-weight: bold;
}

.task-text { font-size: 15px; line-height: 1.5; flex: 1; }
.task-text.checked { text-decoration: line-through; opacity: 0.5; }
.task-optional { font-size: 11px; color: var(--color-text-light); }

.slot-card.dark .task-checkbox { border-color: #4A4860; }
.slot-card.dark .task-item { border-bottom-color: rgba(255,255,255,0.08); }

/* === Exercise / Game Section in Routine === */
.activity-section {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px dashed var(--color-border);
}

.activity-section-title {
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 8px;
  color: var(--color-primary);
}

/* === Accordion (expandable detail) === */
.accordion-item {
  border: 1px solid var(--color-border);
  border-radius: 8px;
  margin-bottom: 8px;
  overflow: hidden;
}

.accordion-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px;
  cursor: pointer;
  background: var(--color-warm-cream);
  border-radius: 0;
  min-height: 44px;
  -webkit-tap-highlight-color: transparent;
}

.accordion-header:active { background: #E8E2F0; }
.accordion-name { font-size: 14px; font-weight: 500; flex: 1; }

.accordion-arrow {
  font-size: 12px;
  color: #999;
  transition: transform 0.2s;
}

.accordion-item.open .accordion-arrow { transform: rotate(180deg); }

.accordion-body {
  display: none;
  padding: 12px;
  font-size: 14px;
  background: #FFF;
  border-top: 1px solid var(--color-border);
}

.accordion-item.open .accordion-body { display: block; }

.detail-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--color-primary);
  margin: 10px 0 4px;
}

.detail-label:first-child { margin-top: 0; }
.detail-text { font-size: 14px; white-space: pre-line; line-height: 1.7; }

.safety-list {
  list-style: none;
  padding: 0;
}

.safety-list li {
  padding: 3px 0;
  padding-left: 18px;
  position: relative;
  font-size: 13px;
  color: #9B6B50;
}

.safety-list li::before {
  content: "⚠";
  position: absolute;
  left: 0;
  font-size: 12px;
}

.science-text {
  font-size: 13px;
  color: var(--color-text-light);
  font-style: italic;
  line-height: 1.6;
}

/* === Filter Tags (Exercises Page) === */
.filter-bar {
  display: flex;
  gap: 8px;
  margin-bottom: var(--spacing);
  flex-wrap: wrap;
}

.filter-tag {
  padding: 8px 18px;
  border: 1.5px solid var(--color-border);
  border-radius: 24px;
  background: var(--color-card-bg);
  color: var(--color-text);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.25s;
  -webkit-tap-highlight-color: transparent;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  box-shadow: var(--shadow-sm);
}

.filter-tag.active {
  background: var(--color-primary);
  border-color: var(--color-primary);
  color: #FFF;
  box-shadow: 0 3px 10px rgba(123,111,160,0.3);
}

/* === Exercise Card (Library Page) === */
.exercise-card {
  background: var(--color-card-bg);
  border-radius: var(--radius);
  margin-bottom: 12px;
  box-shadow: var(--shadow-md);
  overflow: hidden;
}

.exercise-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px var(--spacing);
  cursor: pointer;
  min-height: 44px;
  -webkit-tap-highlight-color: transparent;
}

.exercise-card-header:active { background: #F6F2FA; }

.exercise-name { font-size: 15px; font-weight: 600; flex: 1; }

.exercise-type-badge {
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 10px;
  margin-left: 8px;
}

.exercise-type-badge.exercise { background: #E8F0F8; color: #4A7298; }
.exercise-type-badge.game { background: #F3ECF8; color: #7B6FA0; }

.exercise-card-meta {
  padding: 0 var(--spacing) 10px;
  font-size: 13px;
  color: var(--color-text-light);
}

.exercise-card-detail {
  display: none;
  padding: var(--spacing);
  border-top: 1px solid var(--color-border);
  background: #F8F5FC;
}

.exercise-card.open .exercise-card-detail { display: block; }

/* === Night Weaning Page === */
.nw-intro {
  font-size: 15px;
  color: var(--color-text-light);
  margin-bottom: var(--spacing);
  line-height: 1.7;
}

.nw-section-title {
  font-size: 16px;
  font-weight: 600;
  margin: 24px 0 12px;
  padding-bottom: 6px;
  border-bottom: 2px solid var(--color-primary-light);
}

.prereq-list { list-style: none; }

.prereq-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 0;
  font-size: 15px;
  border-bottom: 1px solid rgba(0,0,0,0.05);
}

.prereq-icon { font-size: 20px; }

/* Phase Cards */
.phase-card {
  background: var(--color-card-bg);
  border-radius: var(--radius);
  margin-bottom: 12px;
  padding: var(--spacing);
  box-shadow: var(--shadow-md);
  border-left: 4px solid var(--color-primary);
}

.phase-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}

.phase-icon { font-size: 24px; }
.phase-name { font-size: 16px; font-weight: 600; }
.phase-duration { font-size: 13px; color: var(--color-text-light); }

.phase-steps {
  list-style: none;
  margin: 10px 0;
}

.phase-steps li {
  padding: 4px 0 4px 20px;
  position: relative;
  font-size: 14px;
}

.phase-steps li::before {
  content: "•";
  position: absolute;
  left: 6px;
  color: var(--color-primary);
  font-weight: bold;
}

.phase-tips {
  font-size: 13px;
  color: var(--color-text);
  background: var(--color-warm-cream);
  padding: 10px 12px;
  border-radius: 8px;
  line-height: 1.6;
  margin-top: 8px;
  border-left: 3px solid var(--color-sage);
}

/* Soothing Methods */
.soothing-list { list-style: none; }

.soothing-item {
  padding: 10px 0;
  border-bottom: 1px solid rgba(0,0,0,0.05);
}

.soothing-name { font-weight: 600; font-size: 14px; }
.soothing-desc { font-size: 13px; color: var(--color-text-light); margin-top: 2px; }

/* Pause Conditions */
.pause-list { list-style: none; }

.pause-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 0;
  font-size: 14px;
}

/* FAQ */
.faq-item {
  border: 1px solid var(--color-border);
  border-radius: 8px;
  margin-bottom: 8px;
  overflow: hidden;
}

.faq-question {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  background: #F8F5FC;
  min-height: 44px;
  -webkit-tap-highlight-color: transparent;
}

.faq-answer {
  display: none;
  padding: 12px;
  font-size: 14px;
  line-height: 1.7;
  color: var(--color-text-light);
  border-top: 1px solid var(--color-border);
}

.faq-item.open .faq-answer { display: block; }
.faq-arrow { font-size: 12px; color: #999; transition: transform 0.2s; }
.faq-item.open .faq-arrow { transform: rotate(180deg); }

/* === Error Message === */
.error-msg {
  text-align: center;
  padding: 40px 20px;
  color: #9B6B50;
  font-size: 15px;
}

.fallback-msg {
  text-align: center;
  padding: 12px;
  background: #F0ECF6;
  border-radius: 8px;
  font-size: 13px;
  color: #7B6FA0;
  margin-bottom: var(--spacing);
}

/* === Loading === */
#loading {
  text-align: center;
  padding: 60px 20px;
  color: var(--color-text-light);
  font-size: 15px;
}

/* ============================================================
   NEW V2 STYLES: Action Sheet, Records, Health, Forms, Shared
   ============================================================ */

/* === Shared UI === */

.page-title {
  font-size: 18px;
  font-weight: 700;
  color: var(--color-text);
  margin-bottom: var(--spacing);
}

.back-btn {
  display: inline-block;
  color: var(--color-primary);
  font-size: 15px;
  text-decoration: none;
  padding: 6px 0;
  margin-bottom: 12px;
  min-height: 44px;
  line-height: 32px;
  -webkit-tap-highlight-color: transparent;
}

.back-btn::before {
  content: "‹ ";
  font-size: 20px;
  font-weight: bold;
  vertical-align: middle;
  line-height: 1;
}

.empty-state {
  text-align: center;
  padding: 48px 24px;
  color: var(--color-text-light);
  font-size: 15px;
  line-height: 1.8;
}

.empty-state-icon {
  font-size: 48px;
  display: block;
  margin-bottom: 12px;
}

.month-group-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--color-text-light);
  letter-spacing: 0.05em;
  margin: 16px 0 8px;
  padding-bottom: 4px;
  border-bottom: 1px solid var(--color-border);
}

.overlay-img {
  position: fixed;
  inset: 0;
  z-index: 300;
  background: rgba(0, 0, 0, 0.9);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.overlay-img img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}

/* === Action Sheet (bottom sheet for exercise selection) === */

.action-sheet-overlay {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: rgba(0, 0, 0, 0.45);
}

.action-sheet {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 201;
  background: #FFF;
  border-radius: 16px 16px 0 0;
  max-height: 60vh;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.12);
}

.action-sheet-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px var(--spacing);
  border-bottom: 1px solid var(--color-border);
  position: sticky;
  top: 0;
  background: #FFF;
  z-index: 1;
}

.action-sheet-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--color-text);
}

.action-sheet-close {
  width: 32px;
  height: 32px;
  border: none;
  background: #EEEAF4;
  border-radius: 50%;
  font-size: 18px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #7B6FA0;
  -webkit-tap-highlight-color: transparent;
}

.action-sheet-list {
  list-style: none;
  padding: 8px 0;
}

.action-sheet-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px var(--spacing);
  min-height: 44px;
  cursor: pointer;
  font-size: 15px;
  -webkit-tap-highlight-color: transparent;
  transition: background 0.15s;
}

.action-sheet-item:active { background: #F0ECF6; }

.action-sheet-item.selected {
  color: var(--color-primary);
  font-weight: 500;
}

.action-sheet-item.selected::after {
  content: "✓";
  margin-left: auto;
  font-weight: bold;
}

.action-sheet-item-meta {
  font-size: 12px;
  color: var(--color-text-light);
}

.selected-activity {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: #EEEAF4;
  border: 1px solid var(--color-primary-light);
  border-radius: 20px;
  padding: 4px 10px;
  font-size: 13px;
  margin: 4px 4px 4px 0;
  color: var(--color-text);
}

.selected-activity-remove {
  background: none;
  border: none;
  cursor: pointer;
  color: #999;
  font-size: 16px;
  line-height: 1;
  padding: 0;
  display: flex;
  align-items: center;
  -webkit-tap-highlight-color: transparent;
}

.selected-activity-remove:hover { color: #9B6B50; }

.add-activity-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 6px 12px;
  min-height: 36px;
  border: 1px dashed var(--color-primary);
  border-radius: 20px;
  background: none;
  color: var(--color-primary);
  font-size: 13px;
  cursor: pointer;
  margin-top: 4px;
  -webkit-tap-highlight-color: transparent;
}

/* === Records Module === */

.records-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.record-card {
  background: var(--color-card-bg);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow-md);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: transform 0.15s, box-shadow 0.15s;
}

.record-card:active {
  transform: scale(0.97);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.1);
}

.record-card.first-time {
  border: 2px solid var(--color-lavender);
  box-shadow: 0 2px 12px rgba(196,167,215,0.3);
}

.record-thumb {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  background: #F5F5F5;
  display: block;
}

.record-thumb-placeholder {
  width: 100%;
  aspect-ratio: 1;
  background: linear-gradient(135deg, #F0ECF6, #E0DAF0);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 36px;
}

.record-card-body {
  padding: 8px 10px 10px;
}

.record-card-title {
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 4px;
  line-height: 1.4;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.record-card-date {
  font-size: 11px;
  color: var(--color-text-light);
  margin-bottom: 6px;
}

.record-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.record-tag {
  font-size: 10px;
  padding: 2px 6px;
  border-radius: 10px;
  background: var(--color-primary-light);
  color: var(--color-primary);
  font-weight: 500;
}

.record-tag.first-time-tag {
  background: var(--color-lavender);
  color: #FFF;
}

/* Floating Action Button */
.fab {
  position: fixed;
  bottom: calc(var(--nav-height) + 20px);
  right: 20px;
  z-index: 50;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--color-primary), var(--color-primary-dark));
  color: #FFF;
  border: none;
  font-size: 28px;
  line-height: 1;
  cursor: pointer;
  box-shadow: 0 6px 20px rgba(123,111,160,0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  -webkit-tap-highlight-color: transparent;
  transition: transform 0.2s, box-shadow 0.2s;
}

.fab:active {
  transform: scale(0.93);
  box-shadow: 0 2px 8px rgba(123,111,160,0.4);
}

/* Record Detail Page */
.record-detail {
  width: 100%;
}

.record-detail-title {
  font-size: 20px;
  font-weight: 700;
  margin-bottom: 6px;
}

.record-detail-meta {
  font-size: 13px;
  color: var(--color-text-light);
  margin-bottom: 12px;
}

.record-detail-desc {
  font-size: 15px;
  line-height: 1.7;
  color: var(--color-text);
  margin-bottom: var(--spacing);
  white-space: pre-line;
}

.photo-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 4px;
  margin-bottom: var(--spacing);
}

.photo-item {
  aspect-ratio: 1;
  cursor: pointer;
  overflow: hidden;
  border-radius: 6px;
  -webkit-tap-highlight-color: transparent;
}

.photo-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.2s;
}

.photo-item:active img { transform: scale(0.95); }

.video-player {
  width: 100%;
  border-radius: var(--radius);
  margin-bottom: 8px;
  background: #000;
  max-height: 280px;
}

/* === Form Styles (shared by records and health) === */

.form-group {
  margin-bottom: 16px;
}

.form-label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--color-text-light);
  margin-bottom: 6px;
}

.form-input {
  width: 100%;
  height: 44px;
  padding: 0 12px;
  border: 1px solid var(--color-border);
  border-radius: 8px;
  background: #FFF;
  font-size: 15px;
  color: var(--color-text);
  appearance: none;
  -webkit-appearance: none;
  outline: none;
  transition: border-color 0.2s;
}

.form-input:focus { border-color: var(--color-primary); }

.form-textarea {
  width: 100%;
  min-height: 100px;
  padding: 10px 12px;
  border: 1px solid var(--color-border);
  border-radius: 8px;
  background: #FFF;
  font-size: 15px;
  color: var(--color-text);
  font-family: inherit;
  line-height: 1.6;
  resize: vertical;
  outline: none;
  transition: border-color 0.2s;
}

.form-textarea:focus { border-color: var(--color-primary); }

.tag-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.tag-chip {
  padding: 6px 14px;
  min-height: 36px;
  border: 1.5px solid var(--color-border);
  border-radius: 24px;
  background: var(--color-card-bg);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  color: var(--color-text);
  transition: all 0.25s;
  -webkit-tap-highlight-color: transparent;
  display: inline-flex;
  align-items: center;
  box-shadow: var(--shadow-sm);
}

.tag-chip.selected {
  background: var(--color-primary);
  border-color: var(--color-primary);
  color: #FFF;
  font-weight: 500;
  box-shadow: 0 3px 10px rgba(123,111,160,0.3);
}

.upload-area {
  border: 2px dashed var(--color-border);
  border-radius: var(--radius);
  padding: 24px var(--spacing);
  text-align: center;
  cursor: pointer;
  color: var(--color-text-light);
  font-size: 14px;
  transition: border-color 0.2s, background 0.2s;
  min-height: 80px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  -webkit-tap-highlight-color: transparent;
}

.upload-area:active { background: #EEEAF4; border-color: var(--color-primary); }
.upload-area-icon { font-size: 28px; }
.upload-area input[type="file"] { display: none; }

.upload-preview {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.upload-preview-item {
  position: relative;
  width: 72px;
  height: 72px;
  border-radius: 8px;
  overflow: hidden;
  background: #F0F0F0;
}

.upload-preview-item img,
.upload-preview-item video {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.upload-preview-remove {
  position: absolute;
  top: 2px;
  right: 2px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.6);
  color: #FFF;
  border: none;
  font-size: 14px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  -webkit-tap-highlight-color: transparent;
}

/* Buttons */
.btn-primary {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 48px;
  background: linear-gradient(135deg, var(--color-primary), var(--color-primary-dark));
  color: #FFF;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: opacity 0.15s, transform 0.15s;
  box-shadow: 0 4px 12px rgba(123,111,160,0.3);
  letter-spacing: 0.5px;
}

.btn-primary:active { opacity: 0.85; transform: scale(0.98); }
.btn-primary:disabled { opacity: 0.5; }

.btn-danger {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 44px;
  padding: 0 20px;
  background: #FFEBEE;
  color: #C62828;
  border: 1px solid #FFCDD2;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: background 0.15s;
}

.btn-danger:active { background: #FFCDD2; }

.btn-outline {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 44px;
  padding: 0 20px;
  background: #FFF;
  color: var(--color-primary);
  border: 1px solid var(--color-primary);
  border-radius: 10px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: background 0.15s;
}

.btn-outline:active { background: #EEEAF4; }

.btn-row {
  display: flex;
  gap: 12px;
  margin-top: var(--spacing);
}

.btn-row .btn-outline,
.btn-row .btn-danger { flex: 1; }

/* === Health Module === */

.health-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: var(--spacing);
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.health-tab {
  padding: 8px 18px;
  border: 1.5px solid var(--color-border);
  border-radius: 24px;
  background: var(--color-card-bg);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  color: var(--color-text);
  transition: all 0.25s;
  -webkit-tap-highlight-color: transparent;
  box-shadow: var(--shadow-sm);
}

.health-tab.active {
  background: var(--color-primary);
  border-color: var(--color-primary);
  color: #FFF;
  font-weight: 500;
  box-shadow: 0 3px 10px rgba(123,111,160,0.3);
}

.growth-chart-container {
  background: var(--color-card-bg);
  border-radius: var(--radius);
  padding: var(--spacing);
  margin-bottom: var(--spacing);
  box-shadow: var(--shadow-md);
}

.growth-chart-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--color-text);
  margin-bottom: 10px;
}

.growth-chart-container canvas {
  max-height: 220px;
}

.growth-form {
  background: var(--color-card-bg);
  border-radius: var(--radius);
  padding: var(--spacing);
  margin-bottom: var(--spacing);
  box-shadow: var(--shadow-md);
}

.growth-form-title {
  font-size: 15px;
  font-weight: 600;
  margin-bottom: 12px;
  color: var(--color-text);
}

.growth-inline-fields {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 12px;
}

.growth-data-list {
  list-style: none;
  margin-bottom: var(--spacing);
}

.growth-data-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 0;
  border-bottom: 1px solid rgba(0, 0, 0, 0.05);
  font-size: 14px;
}

.growth-data-item:last-child { border-bottom: none; }

.growth-data-date {
  font-size: 12px;
  color: var(--color-text-light);
  min-width: 80px;
}

.growth-data-values {
  flex: 1;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.growth-data-val {
  font-size: 13px;
  background: #EEEAF4;
  padding: 2px 8px;
  border-radius: 10px;
  color: var(--color-text);
}

.growth-data-del {
  background: none;
  border: none;
  font-size: 18px;
  color: #CCC;
  cursor: pointer;
  padding: 4px;
  min-width: 32px;
  min-height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  -webkit-tap-highlight-color: transparent;
}

.growth-data-del:active { color: #9B6B50; }

.percentile-card {
  background: linear-gradient(135deg, #F0ECF6, #E8E2F0);
  border-radius: var(--radius);
  padding: var(--spacing);
  margin-bottom: 12px;
  border-left: 4px solid var(--color-lavender);
}

.percentile-card-title {
  font-size: 13px;
  color: var(--color-text-light);
  margin-bottom: 4px;
}

.percentile-value {
  font-size: 28px;
  font-weight: 700;
  color: var(--color-primary);
  line-height: 1.2;
  margin-bottom: 4px;
}

.percentile-desc {
  font-size: 13px;
  color: var(--color-text);
  line-height: 1.6;
}

.percentile-trend {
  font-size: 12px;
  color: var(--color-text-light);
  margin-top: 4px;
}

.medical-card {
  background: var(--color-card-bg);
  border-radius: var(--radius);
  margin-bottom: 12px;
  box-shadow: var(--shadow-md);
  overflow: hidden;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.medical-card:active { opacity: 0.85; }

.medical-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px var(--spacing);
  border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}

.medical-card-date {
  font-size: 13px;
  color: var(--color-text-light);
}

.medical-type-badge {
  font-size: 11px;
  padding: 3px 10px;
  border-radius: 10px;
  font-weight: 500;
}

.medical-type-badge.checkup {
  background: #E8F2E8;
  color: #4A7A50;
}

.medical-type-badge.medical {
  background: #F3ECF8;
  color: #7B6FA0;
}

.medical-card-body {
  padding: 12px var(--spacing);
}

.medical-card-field {
  font-size: 14px;
  color: var(--color-text);
  margin-bottom: 6px;
  line-height: 1.5;
}

.medical-card-field:last-child { margin-bottom: 0; }

.medical-card-label {
  font-size: 12px;
  color: var(--color-text-light);
  font-weight: 600;
  margin-right: 4px;
}

/* === Animations === */
@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes slideUp {
  from { transform: translateY(100%); }
  to { transform: translateY(0); }
}

#app-content > * {
  animation: fadeInUp 0.35s ease-out;
}

.slot-card { animation: fadeInUp 0.4s ease-out backwards; }
.slot-card:nth-child(1) { animation-delay: 0s; }
.slot-card:nth-child(2) { animation-delay: 0.04s; }
.slot-card:nth-child(3) { animation-delay: 0.08s; }
.slot-card:nth-child(4) { animation-delay: 0.12s; }
.slot-card:nth-child(5) { animation-delay: 0.16s; }
.slot-card:nth-child(6) { animation-delay: 0.2s; }
.slot-card:nth-child(7) { animation-delay: 0.24s; }

.action-sheet { animation: slideUp 0.3s ease-out; }
.action-sheet-overlay { animation: fadeIn 0.2s ease-out; }

.record-card { animation: fadeInUp 0.35s ease-out backwards; }
.record-card:nth-child(1) { animation-delay: 0s; }
.record-card:nth-child(2) { animation-delay: 0.03s; }
.record-card:nth-child(3) { animation-delay: 0.06s; }
.record-card:nth-child(4) { animation-delay: 0.09s; }

.exercise-card { animation: fadeInUp 0.35s ease-out backwards; }
.percentile-card { animation: fadeInUp 0.4s ease-out; }

/* Loading pulse */
#loading {
  text-align: center;
  padding: 60px 20px;
  color: var(--color-text-light);
  font-size: 15px;
  animation: fadeIn 0.6s ease-out;
}

/* LXGW WenKai TC for key headings */
.page-title,
.nw-section-title,
.phase-name,
.record-detail-title,
.growth-chart-title,
.growth-form-title {
  font-family: 'LXGW WenKai TC', serif;
}

/* Refined accordion */
.accordion-header {
  background: var(--color-warm-cream);
  border-radius: 0;
}
.accordion-header:active { background: #E8E2F0; }

/* Refined phase card */
.phase-card {
  border-left: 4px solid var(--color-primary);
  box-shadow: var(--shadow-md);
}

.phase-tips {
  background: var(--color-warm-cream);
  border-left: 3px solid var(--color-sage);
  color: var(--color-text);
}

/* Record "first time" card glow */
.record-card.first-time {
  border: 2px solid var(--color-lavender);
  box-shadow: 0 4px 20px rgba(196,167,215,0.25);
}

/* Percentile card gradient refinement */
.percentile-card {
  background: linear-gradient(135deg, var(--color-warm-cream), var(--color-primary-light));
  border-left: 4px solid var(--color-lavender);
  box-shadow: var(--shadow-sm);
}

/* Form focus ring */
.form-input:focus,
.form-textarea:focus {
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(123,111,160,0.12);
}

/* Upload area refined */
.upload-area {
  border-color: var(--color-border);
  border-radius: var(--radius);
  background: var(--color-warm-cream);
}

.upload-area:active {
  background: var(--color-primary-light);
  border-color: var(--color-primary);
}

/* Smooth scrollbar */
::-webkit-scrollbar { width: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--color-border); border-radius: 2px; }

/* Night weaning button in routine */
.nw-link-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px;
  margin-bottom: var(--spacing);
  background: var(--color-warm-cream);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  color: var(--color-text);
  font-size: 14px;
  text-decoration: none;
  transition: background 0.2s;
  box-shadow: var(--shadow-sm);
}

.nw-link-btn:active { background: var(--color-primary-light); }

/* === Health Lock Screen === */
.health-lock {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px 32px;
  text-align: center;
}
.health-lock-icon {
  font-size: 48px;
  margin-bottom: 16px;
}
.health-lock-title {
  font-size: 20px;
  font-weight: 700;
  color: var(--color-text);
  margin-bottom: 8px;
}
.health-lock-desc {
  font-size: 14px;
  color: var(--color-text-light);
  margin-bottom: 24px;
}
.health-lock-input {
  width: 200px;
  padding: 12px 16px;
  font-size: 18px;
  text-align: center;
  letter-spacing: 4px;
  border: 2px solid var(--color-border);
  border-radius: var(--radius-sm);
  background: var(--color-card-bg);
  color: var(--color-text);
  outline: none;
  transition: border-color 0.2s;
}
.health-lock-input:focus {
  border-color: var(--color-primary);
}
.health-lock-error {
  min-height: 20px;
  margin: 12px 0;
  font-size: 13px;
  color: #D32F2F;
}
.health-lock .btn-primary {
  width: 200px;
}
