:root {
  --primary-color: #c2185b;
  --primary-hover: #ad1457;
  --secondary-color: #f8bbd0;
  --accent-color: #0277bd;
  --accent-hover: #01579b;
  --text-color: #212121;
  --text-muted: #666666;
  --bg-gradient: linear-gradient(135deg, #fdfbfb 0%, #ebedee 100%);
  --surface-bg: #ffffff;
  --card-bg: #ffffff;
  --border-color: #f0e6eb;
  --success-color: #2e7d32;
  --success-bg: #e8f5e9;
  --warning-color: #ef6c00;
  --warning-bg: #fff3e0;
  --purple-color: #6a11cb;
  --purple-bg: #f3e8ff;
  --radius-lg: 18px;
  --radius-md: 12px;
  --radius-sm: 8px;
  --shadow-sm: 0 2px 8px rgba(0,0,0,0.04);
  --shadow-md: 0 6px 20px rgba(0,0,0,0.06);
  --shadow-lg: 0 12px 32px rgba(194, 24, 91, 0.12);
  --font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
}

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

body {
  font-family: var(--font-family);
  background: #f8f9fa;
  color: var(--text-color);
  line-height: 1.5;
  padding-top: calc(72px + env(safe-area-inset-top));
  padding-bottom: calc(78px + env(safe-area-inset-bottom));
  min-height: 100vh;
}

/* App Header */
.app-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 64px;
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid rgba(0, 0, 0, 0.06);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  padding-top: env(safe-area-inset-top);
  z-index: 100;
}

.brand-wrapper {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: inherit;
}

.brand-logo {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--primary-color), #880e4f);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  box-shadow: 0 4px 10px rgba(194, 24, 91, 0.25);
}

.brand-title {
  font-size: 1.1rem;
  font-weight: 800;
  color: var(--primary-color);
  line-height: 1.1;
}

.brand-subtitle {
  font-size: 0.75rem;
  color: var(--text-muted);
  font-weight: 500;
}

.header-profile-pill {
  display: flex;
  align-items: center;
  gap: 8px;
  background: #fdf2f6;
  border: 1px solid var(--secondary-color);
  padding: 5px 12px;
  border-radius: 20px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.header-profile-pill:hover {
  background: var(--secondary-color);
}

.profile-avatar {
  font-size: 16px;
}

.profile-name {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--primary-color);
}

.profile-tag {
  font-size: 0.7rem;
  background: var(--primary-color);
  color: white;
  padding: 1px 6px;
  border-radius: 10px;
  font-weight: 600;
}

/* Bottom Navigation Bar */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: 64px;
  background: rgba(255, 255, 255, 0.98);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-top: 1px solid rgba(0, 0, 0, 0.08);
  display: flex;
  align-items: center;
  justify-content: space-around;
  padding-bottom: env(safe-area-inset-bottom);
  z-index: 100;
}

.nav-tab {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  background: none;
  border: none;
  color: #757575;
  font-size: 0.72rem;
  font-weight: 600;
  cursor: pointer;
  padding: 6px 12px;
  border-radius: 12px;
  transition: all 0.2s ease;
  min-width: 68px;
}

.nav-tab .tab-icon {
  font-size: 20px;
  transition: transform 0.2s ease;
}

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

.nav-tab.active .tab-icon {
  transform: translateY(-2px) scale(1.1);
}

/* Main Container */
.app-container {
  max-width: 680px;
  margin: 0 auto;
  padding: 16px;
}

.tab-pane {
  display: none;
  animation: fadeIn 0.25s ease-out;
}

.tab-pane.active {
  display: block;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Common Card Styles */
.card {
  background: var(--card-bg);
  border-radius: var(--radius-lg);
  padding: 20px;
  margin-bottom: 20px;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border-color);
  position: relative;
}

.card-hero {
  background: linear-gradient(135deg, #fff5f8 0%, #ffffff 100%);
  border: 2px solid var(--secondary-color);
}

.card-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}

.badge {
  font-size: 0.75rem;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 14px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.badge-primary {
  background: #fce4ec;
  color: var(--primary-color);
}

.badge-accent {
  background: #e1f5fe;
  color: var(--accent-color);
}

.badge-success {
  background: var(--success-bg);
  color: var(--success-color);
}

.badge-purple {
  background: var(--purple-bg);
  color: var(--purple-color);
}

/* Week Mission Card */
.week-banner {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 16px;
}

.week-icon-box {
  width: 54px;
  height: 54px;
  border-radius: 16px;
  background: linear-gradient(135deg, var(--secondary-color), #fce4ec);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
  flex-shrink: 0;
}

.week-title {
  font-size: 1.35rem;
  font-weight: 800;
  color: #1a1a1a;
  line-height: 1.2;
}

.week-subtitle {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-top: 3px;
}

.why-box {
  background: #fdf2f6;
  border-left: 4px solid var(--primary-color);
  padding: 14px 16px;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  margin-bottom: 20px;
  font-size: 0.9rem;
  color: #374151;
}

.why-box strong {
  color: var(--primary-color);
}

/* Activities Section */
.section-heading {
  font-size: 1.1rem;
  font-weight: 800;
  color: #212121;
  margin-bottom: 14px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.activity-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 20px;
}

.activity-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  background: #fafafa;
  border: 1px solid #f0f0f0;
  border-radius: var(--radius-md);
  padding: 14px;
  transition: all 0.2s ease;
  cursor: pointer;
}

.activity-item.checked {
  background: #f1f8e9;
  border-color: #c8e6c9;
}

.activity-checkbox {
  width: 22px;
  height: 22px;
  border-radius: 6px;
  border: 2px solid #ccc;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  margin-top: 2px;
  background: white;
  transition: all 0.2s ease;
}

.activity-item.checked .activity-checkbox {
  background: var(--success-color);
  border-color: var(--success-color);
  color: white;
}

.activity-content h4 {
  font-size: 0.95rem;
  font-weight: 700;
  color: #212121;
  margin-bottom: 4px;
}

.activity-item.checked .activity-content h4 {
  text-decoration: line-through;
  color: #689f38;
}

.activity-content p {
  font-size: 0.83rem;
  color: var(--text-muted);
}

/* Kids Scroll Digital CTA Box */
.digital-box {
  background: linear-gradient(135deg, #f5f3ff 0%, #ede9fe 100%);
  border: 2px solid #ddd6fe;
  border-radius: var(--radius-lg);
  padding: 18px;
  margin-bottom: 24px;
  text-align: center;
}

.digital-box h3 {
  color: #5b21b6;
  font-size: 1.1rem;
  font-weight: 800;
  margin-bottom: 6px;
}

.digital-box p {
  font-size: 0.88rem;
  color: #6b21a8;
  margin-bottom: 14px;
}

.digital-stats-preview {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: white;
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 0.8rem;
  font-weight: 600;
  color: #4c1d95;
  margin-bottom: 14px;
  box-shadow: 0 2px 6px rgba(0,0,0,0.04);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 24px;
  border-radius: 30px;
  font-weight: 700;
  font-size: 0.95rem;
  text-decoration: none;
  cursor: pointer;
  border: none;
  transition: all 0.2s ease;
  width: 100%;
}

.btn-primary {
  background: var(--primary-color);
  color: white;
  box-shadow: 0 4px 14px rgba(194, 24, 91, 0.3);
}

.btn-primary:hover {
  background: var(--primary-hover);
  transform: translateY(-1px);
}

.btn-accent {
  background: var(--accent-color);
  color: white;
  box-shadow: 0 4px 14px rgba(2, 119, 189, 0.3);
}

.btn-purple {
  background: linear-gradient(135deg, #7c3aed 0%, #6d28d9 100%);
  color: white;
  box-shadow: 0 4px 14px rgba(109, 40, 217, 0.3);
}

.btn-outline {
  background: white;
  color: var(--primary-color);
  border: 2px solid var(--primary-color);
}

.btn-sm {
  padding: 6px 14px;
  font-size: 0.82rem;
  width: auto;
}

/* Sunday Ritual Hero CTA */
.sunday-cta-card {
  background: linear-gradient(135deg, #fff1f2 0%, #ffe4e6 100%);
  border: 2px dashed var(--primary-color);
  border-radius: var(--radius-lg);
  padding: 22px;
  text-align: center;
  margin-top: 24px;
}

.sunday-cta-card h3 {
  color: var(--primary-color);
  font-size: 1.25rem;
  font-weight: 800;
  margin-bottom: 8px;
}

.sunday-cta-card p {
  font-size: 0.88rem;
  color: #4a5568;
  margin-bottom: 16px;
}

/* Radar Chart & 7 Quotients Tab */
.radar-container {
  background: white;
  border-radius: var(--radius-lg);
  padding: 16px 12px;
  margin-bottom: 20px;
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  align-items: center;
}

.radar-svg {
  width: 100%;
  max-width: 380px;
  height: auto;
  overflow: visible;
}

.quotient-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
  margin-bottom: 24px;
}

@media (min-width: 480px) {
  .quotient-grid {
    grid-template-columns: 1fr 1fr;
  }
}

.quotient-card {
  background: white;
  border-radius: var(--radius-md);
  padding: 14px;
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.quotient-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.quotient-card-title {
  font-size: 0.95rem;
  font-weight: 800;
  color: #1a1a1a;
  display: flex;
  align-items: center;
  gap: 6px;
}

.quotient-tier-badge {
  font-size: 0.72rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 12px;
  background: #f3f4f6;
  color: #374151;
}

.quotient-tier-badge.junior-genius {
  background: #fef3c7;
  color: #92400e;
  border: 1px solid #fde68a;
}

.quotient-tier-badge.achiever {
  background: #e0f2fe;
  color: #0369a1;
}

.quotient-tier-badge.explorer {
  background: #e8f5e9;
  color: #2e7d32;
}

.quotient-progress-bar {
  height: 8px;
  background: #f3f4f6;
  border-radius: 4px;
  overflow: hidden;
  position: relative;
}

.quotient-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--primary-color), var(--accent-color));
  border-radius: 4px;
  transition: width 0.4s ease;
}

.quotient-desc {
  font-size: 0.78rem;
  color: var(--text-muted);
}

/* Trophy & Badges Cabinet */
.badge-cabinet {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(90px, 1fr));
  gap: 12px;
  margin-top: 12px;
}

.trophy-badge {
  background: #fafafa;
  border: 1px solid #eee;
  border-radius: var(--radius-md);
  padding: 12px 6px;
  text-align: center;
  transition: all 0.2s ease;
}

.trophy-badge.unlocked {
  background: #fffbeb;
  border-color: #fde68a;
  box-shadow: 0 4px 10px rgba(245, 158, 11, 0.12);
}

.trophy-icon {
  font-size: 30px;
  margin-bottom: 4px;
  filter: grayscale(1);
  opacity: 0.4;
}

.trophy-badge.unlocked .trophy-icon {
  filter: none;
  opacity: 1;
}

.trophy-name {
  font-size: 0.72rem;
  font-weight: 700;
  color: #4b5563;
  line-height: 1.1;
}

/* Kids Scroll Stats Tab */
.stats-sync-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #f5f3ff;
  border: 1px solid #ddd6fe;
  padding: 12px 16px;
  border-radius: var(--radius-md);
  margin-bottom: 20px;
}

.sync-status {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.85rem;
  color: #5b21b6;
  font-weight: 600;
}

.metric-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 20px;
}

.metric-card {
  background: white;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 14px;
  text-align: center;
}

.metric-value {
  font-size: 1.6rem;
  font-weight: 800;
  color: var(--primary-color);
  line-height: 1.1;
  margin-bottom: 2px;
}

.metric-label {
  font-size: 0.75rem;
  color: var(--text-muted);
  font-weight: 600;
  text-transform: uppercase;
}

/* Roadmap Tab */
.timeline {
  position: relative;
  padding-left: 28px;
  margin-top: 16px;
}

.timeline::before {
  content: '';
  position: absolute;
  left: 9px;
  top: 10px;
  bottom: 10px;
  width: 2px;
  background: #e5e7eb;
}

.timeline-item {
  position: relative;
  margin-bottom: 20px;
}

.timeline-dot {
  position: absolute;
  left: -28px;
  top: 4px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #e5e7eb;
  border: 3px solid white;
  box-shadow: 0 0 0 1px #d1d5db;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
}

.timeline-item.completed .timeline-dot {
  background: var(--success-color);
  box-shadow: 0 0 0 1px var(--success-color);
}

.timeline-item.active .timeline-dot {
  background: var(--primary-color);
  box-shadow: 0 0 0 3px rgba(194, 24, 91, 0.2);
}

.timeline-card {
  background: white;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 14px;
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  transition: all 0.2s ease;
}

.timeline-item.active .timeline-card {
  border: 2px solid var(--primary-color);
  background: #fffbfe;
}

.timeline-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 4px;
}

.timeline-week-num {
  font-size: 0.75rem;
  font-weight: 800;
  color: var(--primary-color);
  text-transform: uppercase;
}

.timeline-card-title {
  font-size: 0.95rem;
  font-weight: 700;
  color: #1a1a1a;
}

/* Modal Dialogs */
dialog {
  border: none;
  border-radius: var(--radius-lg);
  padding: 0;
  max-width: 520px;
  width: 90%;
  margin: auto;
  box-shadow: var(--shadow-lg);
  background: white;
}

dialog::backdrop {
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
}

.modal-content {
  padding: 24px;
  max-height: 85vh;
  overflow-y: auto;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 18px;
}

.modal-header h3 {
  font-size: 1.25rem;
  font-weight: 800;
  color: #1a1a1a;
}

.modal-close-btn {
  background: #f3f4f6;
  border: none;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  cursor: pointer;
  color: #4b5563;
}

.question-block {
  background: #f9fafb;
  border: 1px solid #e5e7eb;
  border-radius: var(--radius-md);
  padding: 14px;
  margin-bottom: 14px;
}

.question-title {
  font-size: 0.92rem;
  font-weight: 700;
  color: #1f2937;
  margin-bottom: 10px;
}

.option-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.option-label {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  background: white;
  border: 1px solid #e5e7eb;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  cursor: pointer;
  transition: all 0.2s ease;
}

.option-label:hover {
  background: #fdf2f6;
  border-color: var(--secondary-color);
}

.option-label input[type="radio"]:checked + span {
  font-weight: 700;
  color: var(--primary-color);
}

/* Report Card Preview in Modal */
.report-card-canvas-container {
  width: 100%;
  display: flex;
  justify-content: center;
  margin: 16px 0;
  border-radius: var(--radius-md);
  overflow: hidden;
  box-shadow: 0 4px 15px rgba(0,0,0,0.1);
}

#reportCardCanvas {
  max-width: 100%;
  height: auto;
  border-radius: var(--radius-md);
  display: block;
}

/* Form Inputs for Profile Onboarding */
.form-group {
  margin-bottom: 16px;
}

.form-group label {
  display: block;
  font-size: 0.85rem;
  font-weight: 700;
  color: #374151;
  margin-bottom: 6px;
}

.form-control {
  width: 100%;
  padding: 12px 14px;
  border: 1.5px solid #d1d5db;
  border-radius: var(--radius-sm);
  font-size: 0.95rem;
  font-family: inherit;
  outline: none;
}

.form-control:focus {
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px rgba(194, 24, 91, 0.15);
}

.age-radio-group {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.age-card-option {
  border: 2px solid #e5e7eb;
  border-radius: var(--radius-md);
  padding: 12px;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s ease;
}

.age-card-option.selected {
  border-color: var(--primary-color);
  background: #fdf2f6;
}

.age-card-option h4 {
  font-size: 0.95rem;
  font-weight: 700;
  color: #1a1a1a;
  margin-bottom: 2px;
}

.age-card-option p {
  font-size: 0.75rem;
  color: var(--text-muted);
}
