/* Self-hosted Fredoka font for Kids Scroll Brand & Footer consistency */
@font-face {
  font-family: 'Fredoka';
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url('/assets/fonts/fredoka-variable.woff2') format('woff2');
}

:root {
  --primary-color: #6a11cb;
  --primary-hover: #580ebd;
  --secondary-color: #e9d5ff;
  --accent-color: #2575fc;
  --accent-hover: #1b5ed9;
  --text-color: #212121;
  --text-muted: #666666;
  --bg-gradient: linear-gradient(135deg, #6a11cb 0%, #2575fc 100%);
  --surface-bg: #ffffff;
  --card-bg: #ffffff;
  --border-color: #e2e8f0;
  --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(106, 17, 203, 0.15);
  --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: #f5f7fa;
  color: var(--text-color);
  line-height: 1.5;
  padding-top: 64px;
  padding-bottom: 24px;
  min-height: 100vh;
}

/* App Header */
.app-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 64px;
  min-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;
  z-index: 100;
}

.brand-wrapper {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: inherit;
  cursor: pointer;
  background: none;
  border: none;
  padding: 0;
  text-align: left;
}

.brand-wrapper:focus-visible {
  outline: 2px solid var(--primary-color);
  outline-offset: 4px;
  border-radius: var(--radius-sm);
}

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

.brand-title {
  font-family: 'Fredoka', var(--font-family);
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--primary-color);
  line-height: 1.1;
}

.brand-subtitle {
  font-family: 'Fredoka', var(--font-family);
  font-size: 0.75rem;
  color: var(--text-muted);
  font-weight: 600;
}

.header-profile-pill {
  display: flex;
  align-items: center;
  gap: 8px;
  background: #f3e8ff;
  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;
}

/* Navigation Tabs (All Browsers: Mobile & Desktop sticky top below header) */
.bottom-nav {
  position: sticky;
  top: 64px;
  z-index: 99;
  height: auto;
  background: rgba(245, 247, 250, 0.95);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-top: none;
  border-bottom: 1px solid rgba(0, 0, 0, 0.08);
  margin: 0 auto;
  width: 100%;
  padding: 8px 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.nav-tab {
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: center;
  gap: 6px;
  background: #ffffff;
  border: 1.5px solid #e2e8f0;
  color: #4b5563;
  font-size: 0.82rem;
  font-weight: 700;
  cursor: pointer;
  padding: 8px 12px;
  border-radius: 20px;
  transition: all 0.2s ease;
  min-width: 0;
  flex: 1 1 auto;
  max-width: 130px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.03);
}

.nav-tab:hover {
  border-color: #cbd5e1;
  transform: translateY(-1px);
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.06);
}

.nav-tab.active {
  background: linear-gradient(135deg, #6a11cb 0%, #2575fc 100%);
  color: #ffffff;
  border-color: transparent;
  box-shadow: 0 4px 14px rgba(106, 17, 203, 0.28);
}

.nav-tab .tab-icon {
  font-size: 18px;
  line-height: 1;
  transition: transform 0.2s ease;
}

.nav-tab.active .tab-icon {
  transform: none;
}

/* 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, #f8f5ff 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: #f3e8ff;
  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), #f3e8ff);
  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: #f8f5ff;
  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;
  white-space: nowrap;
}

.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(106, 17, 203, 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(106, 17, 203, 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: #f3e8ff;
  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(106, 17, 203, 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: #f3e8ff;
}

.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);
}

/* ==========================================
   Kids Scroll Settings Toggles & Badges
   ========================================== */
.toggle-switch {
  position: relative;
  display: inline-block;
  width: 50px;
  height: 28px;
  flex-shrink: 0;
}

.toggle-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.toggle-slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: #cbd5e0;
  transition: all 0.25s ease-in-out;
  border-radius: 28px;
}

.toggle-slider::before {
  position: absolute;
  content: "";
  height: 22px;
  width: 22px;
  left: 3px;
  bottom: 3px;
  background-color: white;
  transition: all 0.25s ease-in-out;
  border-radius: 50%;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.toggle-switch input:checked + .toggle-slider {
  background-color: var(--primary-color);
}

.toggle-switch input:checked + .toggle-slider::before {
  transform: translateX(22px);
}

.perm-badge {
  display: inline-block;
  margin-top: 6px;
  font-size: 0.75rem;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: 12px;
  background: #e2e8f0;
  color: #4a5568;
}

.perm-badge.active {
  background: #dcfce7;
  color: #166534;
}

.perm-badge.blocked {
  background: #fee2e2;
  color: #991b1b;
}

.btn-xs {
  padding: 4px 10px;
  font-size: 0.75rem;
  border-radius: 6px;
}

/* ==========================================
   Stats Sub-Mode Selector Pills
   ========================================== */
.sub-mode-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 20px;
  padding: 4px 0;
  width: 100%;
}

.sub-mode-pill {
  flex: 1 1 calc(33.333% - 8px);
  min-width: 105px;
  padding: 10px 8px;
  border-radius: 20px;
  background: #ffffff;
  border: 1.5px solid #e2e8f0;
  color: #4a5568;
  font-size: 0.82rem;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  white-space: normal;
  text-align: center;
  line-height: 1.25;
  transition: all 0.2s ease;
  box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}

.sub-mode-pill:hover {
  border-color: #cbd5e0;
}

.sub-mode-pill.active {
  background: linear-gradient(135deg, #6a11cb 0%, #2575fc 100%);
  color: #ffffff;
  border-color: transparent;
  box-shadow: 0 3px 10px rgba(106, 17, 203, 0.25);
}

/* Filter Tabs (Daily / Weekly) */
.filter-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
  background: #edf2f7;
  padding: 4px;
  border-radius: 24px;
  width: fit-content;
}

.filter-tab {
  padding: 6px 18px;
  border-radius: 20px;
  border: none;
  background: transparent;
  color: #718096;
  font-weight: 700;
  font-size: 0.82rem;
  cursor: pointer;
  transition: all 0.2s;
}

.filter-tab.active {
  background: #ffffff;
  color: #6a11cb;
  box-shadow: 0 2px 6px rgba(0,0,0,0.08);
}

/* Summary Grid & Items */
.summary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 12px;
  margin-bottom: 20px;
}

.summary-item {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  padding: 14px 12px;
  border-radius: 12px;
  text-align: center;
}

.summary-value {
  display: block;
  font-size: 1.5rem;
  font-weight: 800;
  color: #6a11cb;
  line-height: 1.2;
}

.summary-label {
  font-size: 0.78rem;
  color: #718096;
  font-weight: 600;
  margin-top: 2px;
}

/* Bar Chart */
.chart-container {
  width: 100%;
  height: 220px;
  position: relative;
  margin: 16px 0 10px 0;
}

.bar-chart {
  display: flex;
  align-items: flex-end;
  justify-content: space-around;
  height: 180px;
  padding-bottom: 24px;
  border-bottom: 2px solid #edf2f7;
}

.bar-wrapper {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  height: 100%;
  justify-content: flex-end;
}

.bar {
  width: 50%;
  max-width: 32px;
  min-height: 4px;
  background: linear-gradient(to top, #6a11cb, #2575fc);
  border-radius: 6px 6px 0 0;
  transition: height 0.4s ease;
  position: relative;
}

.bar:hover::after {
  content: attr(data-value);
  position: absolute;
  top: -24px;
  left: 50%;
  transform: translateX(-50%);
  background: #2d3748;
  color: white;
  font-size: 0.7rem;
  padding: 2px 6px;
  border-radius: 4px;
  white-space: nowrap;
}

.bar-label {
  font-size: 0.72rem;
  font-weight: 600;
  color: #718096;
  white-space: nowrap;
  text-align: center;
}

/* Skill Development Grid */
.skill-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 12px;
  margin-top: 12px;
}

.skill-card {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  padding: 14px;
  border-radius: 12px;
  transition: transform 0.15s ease;
}

.skill-card:hover {
  transform: translateY(-2px);
}

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

.skill-title {
  font-weight: 700;
  font-size: 0.9rem;
  color: #2d3748;
}

.skill-improvement {
  font-size: 0.75rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 10px;
}

.improvement-positive {
  background: #dcfce7;
  color: #15803d;
}

.improvement-neutral {
  background: #edf2f7;
  color: #4a5568;
}

/* Breakdown Lists */
.breakdown-list {
  list-style: none;
  padding: 0;
  margin: 12px 0 0 0;
}

.breakdown-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 6px;
  border-bottom: 1px solid #edf2f7;
}

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

.breakdown-name {
  font-weight: 600;
  font-size: 0.88rem;
  color: #2d3748;
}

.breakdown-value {
  font-weight: 700;
  color: #6a11cb;
  font-size: 0.88rem;
}

.breakdown-sub {
  color: #718096;
  font-size: 0.78rem;
  margin-left: 8px;
}

/* Card Share Button */
.share-btn {
  background: #f0f4f8;
  border: none;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s;
  color: #666;
}

.share-btn:hover {
  background: #e2e8f0;
  color: #6a11cb;
  transform: scale(1.1);
}

/* Settings Tab Styling */
.settings-group {
  margin-bottom: 24px;
}

.settings-item {
  background: white;
  padding: 16px;
  border-radius: 14px;
  margin-bottom: 12px;
  border: 1px solid var(--border-color);
  box-shadow: 0 1px 4px rgba(0,0,0,0.03);
}

.settings-item-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.settings-item-info {
  flex: 1;
}

.settings-item-title {
  display: block;
  font-size: 0.98rem;
  font-weight: 700;
  color: #1a1a1a;
  margin-bottom: 2px;
}

.settings-item-desc {
  font-size: 0.82rem;
  color: #718096;
  line-height: 1.4;
}

.no-data-notice {
  text-align: center;
  padding: 30px 16px;
  color: #a0aec0;
  font-style: italic;
  font-size: 0.88rem;
}

/* ==========================================
   Parent App Web Footer (Desktop & Mobile Web Only)
   Strictly hidden in PWA & Android TWA
   ========================================== */
.parent-footer {
  font-family: 'Fredoka', var(--font-family);
  background: #333333;
  color: #ffffff;
  text-align: center;
  padding: 2rem 1rem 3rem 1rem;
  margin-top: 2rem;
  width: 100%;
}

.parent-footer p {
  font-family: 'Fredoka', var(--font-family);
  font-size: 0.85rem;
  opacity: 0.8;
  margin-top: 0.75rem;
  color: #e2e8f0;
}

.parent-footer .footer-nav {
  margin-bottom: 0.75rem;
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 0.5rem 1rem;
}

.parent-footer .footer-nav a {
  font-family: 'Fredoka', var(--font-family);
  color: #dddddd;
  text-decoration: none;
  font-size: 1.05rem;
  font-weight: 500;
  transition: color 0.2s ease;
}

.parent-footer .footer-nav a:hover {
  color: #ffffff;
  text-decoration: underline;
}

.parent-footer .social-media {
  margin: 1.25rem 0;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.parent-footer .social-label {
  font-family: 'Fredoka', var(--font-family);
  font-size: 0.9rem;
  opacity: 0.9;
  margin: 0;
}

/* Floating Share Widget is explicitly disabled on the Parent App */
.share-widget {
  display: none !important;
}

.parent-footer .social-icons {
  display: flex;
  justify-content: center;
  gap: 1rem;
  align-items: center;
  flex-wrap: wrap;
}

.parent-footer .social-icon {
  display: inline-flex;
  transition: transform 0.2s ease;
}

.parent-footer .social-icon:hover {
  transform: scale(1.15);
}

/* Desktop Web Layout Adjustments */
@media (min-width: 768px) {
  .app-container {
    max-width: 780px;
    padding-bottom: 24px;
  }
  .bottom-nav {
    padding: 12px 16px;
    gap: 16px;
  }
  .nav-tab {
    gap: 8px;
    font-size: 0.95rem;
    padding: 10px 22px;
    border-radius: 24px;
    min-width: 130px;
    flex: 0 0 auto;
    max-width: none;
  }
  .nav-tab .tab-icon {
    font-size: 20px;
  }
}

/* ========================================================= */
/* PWA & TWA APP MODE: PIN NAVIGATION STICKY/FIXED AT BOTTOM */
/* ========================================================= */
@media all and (display-mode: standalone), (display-mode: fullscreen), (display-mode: minimal-ui) {
  html, body {
    height: 100% !important;
    height: 100dvh !important;
    overflow: hidden !important;
    margin: 0 !important;
    padding: 0 !important;
    user-select: none;
    -webkit-user-select: none;
    -webkit-touch-callout: none;
  }
  body *:not(input):not(textarea) {
    user-select: none;
    -webkit-user-select: none;
    -webkit-touch-callout: none;
  }
  input, textarea {
    user-select: text !important;
    -webkit-user-select: text !important;
  }
  .app-header {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    height: 64px !important;
    z-index: 100 !important;
  }
  .app-container {
    height: 100% !important;
    height: 100dvh !important;
    overflow-y: auto !important;
    -webkit-overflow-scrolling: touch !important;
    overscroll-behavior-y: contain !important;
    box-sizing: border-box !important;
    padding-top: 64px !important;
    padding-bottom: calc(72px + env(safe-area-inset-bottom)) !important;
  }
  .bottom-nav {
    position: fixed !important;
    bottom: 0 !important;
    top: auto !important;
    left: 0 !important;
    right: 0 !important;
    height: 64px !important;
    background: rgba(255, 255, 255, 0.98) !important;
    backdrop-filter: blur(16px) !important;
    -webkit-backdrop-filter: blur(16px) !important;
    border-top: 1px solid rgba(0, 0, 0, 0.08) !important;
    border-bottom: none !important;
    margin: 0 !important;
    width: 100% !important;
    padding: 0 0 env(safe-area-inset-bottom) 0 !important;
    justify-content: space-around !important;
    gap: 0 !important;
    z-index: 100 !important;
  }
  .nav-tab {
    flex-direction: column !important;
    gap: 3px !important;
    background: none !important;
    border: none !important;
    color: #757575 !important;
    font-size: 0.72rem !important;
    font-weight: 600 !important;
    padding: 6px 12px !important;
    border-radius: 12px !important;
    min-width: 68px !important;
    max-width: none !important;
    flex: 1 1 auto !important;
    box-shadow: none !important;
  }
  .nav-tab:hover {
    transform: none !important;
    border-color: transparent !important;
    box-shadow: none !important;
  }
  .nav-tab.active {
    background: none !important;
    color: var(--primary-color) !important;
    box-shadow: none !important;
  }
  .nav-tab .tab-icon {
    font-size: 20px !important;
  }
  .nav-tab.active .tab-icon {
    transform: translateY(-2px) scale(1.1) !important;
  }
  .parent-footer {
    display: none !important;
  }
}

html.is-standalone,
html.is-standalone body,
html.is-twa,
html.is-twa body,
body.is-standalone,
body.is-twa {
  height: 100% !important;
  height: 100dvh !important;
  overflow: hidden !important;
  margin: 0 !important;
  padding: 0 !important;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
}

body.is-standalone *:not(input):not(textarea),
body.is-twa *:not(input):not(textarea),
html.is-standalone body *:not(input):not(textarea),
html.is-twa body *:not(input):not(textarea) {
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
}

body.is-standalone input,
body.is-standalone textarea,
body.is-twa input,
body.is-twa textarea,
html.is-standalone input,
html.is-standalone textarea,
html.is-twa input,
html.is-twa textarea {
  user-select: text !important;
  -webkit-user-select: text !important;
}

body.is-standalone .app-header,
body.is-twa .app-header,
html.is-standalone .app-header,
html.is-twa .app-header {
  position: fixed !important;
  top: 0 !important;
  left: 0 !important;
  right: 0 !important;
  height: 64px !important;
  z-index: 100 !important;
}

body.is-standalone .app-container,
body.is-twa .app-container,
html.is-standalone .app-container,
html.is-twa .app-container {
  height: 100% !important;
  height: 100dvh !important;
  overflow-y: auto !important;
  -webkit-overflow-scrolling: touch !important;
  overscroll-behavior-y: contain !important;
  box-sizing: border-box !important;
  padding-top: 64px !important;
  padding-bottom: calc(72px + env(safe-area-inset-bottom)) !important;
}

body.is-standalone .bottom-nav,
body.is-twa .bottom-nav,
html.is-standalone .bottom-nav,
html.is-twa .bottom-nav {
  position: fixed !important;
  bottom: 0 !important;
  top: auto !important;
  left: 0 !important;
  right: 0 !important;
  height: 64px !important;
  background: rgba(255, 255, 255, 0.98) !important;
  backdrop-filter: blur(16px) !important;
  -webkit-backdrop-filter: blur(16px) !important;
  border-top: 1px solid rgba(0, 0, 0, 0.08) !important;
  border-bottom: none !important;
  margin: 0 !important;
  width: 100% !important;
  padding: 0 0 env(safe-area-inset-bottom) 0 !important;
  justify-content: space-around !important;
  gap: 0 !important;
  z-index: 100 !important;
}

body.is-standalone .nav-tab,
body.is-twa .nav-tab,
html.is-standalone .nav-tab,
html.is-twa .nav-tab {
  flex-direction: column !important;
  gap: 3px !important;
  background: none !important;
  border: none !important;
  color: #757575 !important;
  font-size: 0.72rem !important;
  font-weight: 600 !important;
  padding: 6px 12px !important;
  border-radius: 12px !important;
  min-width: 68px !important;
  max-width: none !important;
  flex: 1 1 auto !important;
  box-shadow: none !important;
}

body.is-standalone .nav-tab:hover,
body.is-twa .nav-tab:hover,
html.is-standalone .nav-tab:hover,
html.is-twa .nav-tab:hover {
  transform: none !important;
  border-color: transparent !important;
  box-shadow: none !important;
}

body.is-standalone .nav-tab.active,
body.is-twa .nav-tab.active,
html.is-standalone .nav-tab.active,
html.is-twa .nav-tab.active {
  background: none !important;
  color: var(--primary-color) !important;
  box-shadow: none !important;
}

body.is-standalone .nav-tab .tab-icon,
body.is-twa .nav-tab .tab-icon,
html.is-standalone .nav-tab .tab-icon,
html.is-twa .nav-tab .tab-icon {
  font-size: 20px !important;
}

body.is-standalone .nav-tab.active .tab-icon,
body.is-twa .nav-tab.active .tab-icon,
html.is-standalone .nav-tab.active .tab-icon,
html.is-twa .nav-tab.active .tab-icon {
  transform: translateY(-2px) scale(1.1) !important;
}

body.is-standalone .parent-footer,
body.is-twa .parent-footer,
html.is-standalone .parent-footer,
html.is-twa .parent-footer {
  display: none !important;
}

/* ========================================== */
/* ACCORDION CARDS (QUOTIENTS SUB-VIEW)       */
/* ========================================== */
.accordion-card {
  margin-bottom: 16px;
  border-radius: var(--radius-lg);
  transition: box-shadow 0.2s ease, border-color 0.2s ease;
}

.accordion-header {
  cursor: pointer;
  user-select: none;
  padding: 4px 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.accordion-toggle-btn {
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  color: #6a11cb;
  transition: background 0.2s ease;
}

.accordion-toggle-btn:hover {
  background: rgba(106, 17, 203, 0.08);
}

.accordion-chevron {
  transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  stroke: #6a11cb;
}

/* Collapsed state */
.accordion-card:not(.active) .accordion-chevron {
  transform: rotate(-90deg);
}

.accordion-card:not(.active) .accordion-content {
  display: none !important;
}

/* Expanded state */
.accordion-card.active .accordion-chevron {
  transform: rotate(0deg);
}

.accordion-card.active .accordion-content {
  display: block;
  animation: accordionSlideDown 0.25s ease-out;
}

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

/* ========================================================= */
/* COMPANION PROMO CARD (STATS & SETTINGS TABS)              */
/* ========================================================= */
.companion-promo-card {
  background: linear-gradient(135deg, #f8f5ff 0%, #edf2ff 100%);
  border: 1.5px solid #d8b4fe;
  border-radius: var(--radius-md);
  padding: 16px;
  margin-bottom: 20px;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.companion-promo-body {
  display: flex;
  gap: 12px;
  align-items: flex-start;
}

.companion-promo-icon {
  font-size: 1.8rem;
  background: #ffffff;
  border-radius: 12px;
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 6px rgba(106, 17, 203, 0.12);
  flex-shrink: 0;
}

.companion-promo-content {
  flex: 1;
}

.companion-promo-header {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 4px;
}

.companion-promo-title {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--primary-color);
}

.companion-promo-desc {
  font-size: 0.85rem;
  color: #4b5563;
  line-height: 1.45;
  margin: 0;
}

.companion-promo-actions {
  display: flex;
  justify-content: flex-end;
}

/* ========================================================= */
/* MODAL: ONE-TIME ONBOARDING & APP FEATURE TOUR             */
/* ========================================================= */
.tour-dialog {
  border: none;
  border-radius: 20px;
  padding: 0;
  max-width: 460px;
  width: 90vw;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.2);
  margin: auto;
  overflow: hidden;
  background: #ffffff;
}

.tour-dialog::backdrop {
  background: rgba(15, 23, 42, 0.65);
  backdrop-filter: blur(4px);
}

.tour-modal-content {
  padding: 24px 20px 20px 20px;
  display: flex;
  flex-direction: column;
}

.tour-step-pill {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--primary-color);
  background: var(--purple-bg);
  padding: 4px 10px;
  border-radius: 12px;
  letter-spacing: 0.5px;
  text-transform: uppercase;
}

.tour-carousel-viewport {
  position: relative;
  min-height: 280px;
  margin-top: 12px;
}

.tour-slide {
  display: none;
  flex-direction: column;
  align-items: center;
  text-align: center;
  animation: fadeInTour 0.3s ease;
}

.tour-slide.active {
  display: flex;
}

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

.tour-icon-bubble {
  font-size: 2.5rem;
  width: 72px;
  height: 72px;
  border-radius: 20px;
  background: linear-gradient(135deg, #f3e8ff 0%, #e0e7ff 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 14px;
  box-shadow: 0 6px 16px rgba(106, 17, 203, 0.15);
}

.tour-title {
  font-family: 'Fredoka', var(--font-family);
  font-size: 1.25rem;
  font-weight: 700;
  color: #1f2937;
  margin-bottom: 6px;
}

.tour-subtitle {
  font-size: 0.85rem;
  color: #6b7280;
  margin-bottom: 16px;
  line-height: 1.4;
}

.tour-bullets {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 10px;
  text-align: left;
}

.tour-bullet-item {
  display: flex;
  gap: 10px;
  background: #f9fafb;
  border: 1px solid #e5e7eb;
  padding: 10px 12px;
  border-radius: 12px;
  font-size: 0.82rem;
  line-height: 1.4;
}

.tour-bullet-item .bullet-icon {
  font-size: 1.2rem;
  flex-shrink: 0;
  line-height: 1.2;
}

.tour-bullet-item strong {
  display: block;
  color: #111827;
  font-size: 0.85rem;
  margin-bottom: 2px;
}

.tour-bullet-item span {
  color: #4b5563;
}

.tour-dots {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin: 18px 0 16px 0;
}

.tour-dot {
  width: 8px;
  height: 8px;
  border-radius: 4px;
  background: #d1d5db;
  cursor: pointer;
  transition: all 0.25s ease;
}

.tour-dot.active {
  width: 24px;
  background: var(--primary-color);
}

.tour-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  border-top: 1px solid #f3f4f6;
  padding-top: 14px;
}

.tour-footer button {
  min-width: 80px;
}

.tour-next-btn {
  margin-left: auto;
}

/* ========================================================= */
/* MODAL: BADGE DETAIL & EXPLANATION                         */
/* ========================================================= */
.badge-dialog {
  border: none;
  border-radius: 20px;
  padding: 0;
  max-width: 420px;
  width: 90vw;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.2);
  margin: auto;
  overflow: hidden;
  background: #ffffff;
}

.badge-dialog::backdrop {
  background: rgba(15, 23, 42, 0.65);
  backdrop-filter: blur(4px);
}

.badge-modal-content {
  padding: 24px 20px 20px 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

.badge-modal-icon {
  font-size: 3.5rem;
  width: 90px;
  height: 90px;
  border-radius: 24px;
  background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 14px;
  box-shadow: 0 8px 20px rgba(245, 158, 11, 0.25);
  transition: transform 0.3s ease;
}

.badge-modal-icon.locked {
  background: linear-gradient(135deg, #f3f4f6 0%, #e5e7eb 100%);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
  filter: grayscale(1);
  opacity: 0.7;
}

.badge-modal-title {
  font-family: 'Fredoka', var(--font-family);
  font-size: 1.3rem;
  font-weight: 700;
  color: #1f2937;
  margin-bottom: 6px;
}

.badge-modal-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
  flex-wrap: wrap;
  justify-content: center;
}

.badge-modal-status {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 12px;
  border-radius: 12px;
  font-size: 0.78rem;
  font-weight: 700;
  margin-bottom: 14px;
}

.badge-modal-status.unlocked {
  background: #dcfce7;
  color: #166534;
  border: 1px solid #bbf7d0;
}

.badge-modal-status.locked {
  background: #f1f5f9;
  color: #64748b;
  border: 1px solid #e2e8f0;
}

.badge-modal-desc {
  font-size: 0.88rem;
  color: #4b5563;
  line-height: 1.5;
  margin-bottom: 16px;
  background: #f8fafc;
  padding: 12px;
  border-radius: 12px;
  border: 1px solid #e2e8f0;
  width: 100%;
  text-align: left;
}

.badge-modal-criterion {
  font-size: 0.82rem;
  color: #6b7280;
  line-height: 1.4;
  margin-bottom: 18px;
  width: 100%;
  text-align: left;
}

.badge-modal-criterion strong {
  color: #1e293b;
  display: block;
  margin-bottom: 3px;
}

.trophy-badge {
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.trophy-badge:hover {
  transform: translateY(-2px);
}

.trophy-badge:active {
  transform: scale(0.96);
}



