/* Kaizen - style.css */
/* Design System: Deep navy, warm gold, soft white, accent teal */

:root {
  --navy: #1a1a2e;
  --navy-light: #232342;
  --navy-lighter: #2d2d50;
  --gold: #e2b714;
  --gold-light: #f0d060;
  --white: #f5f5f5;
  --white-dim: #c0c0c0;
  --teal: #16a085;
  --bg: var(--navy);
  --card-bg: var(--navy-light);
  --text: var(--white);
  --text-dim: var(--white-dim);
  --nav-height: 64px;
  --progress-height: 3px;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

.light-mode {
  --bg: #f0f0f5;
  --card-bg: #ffffff;
  --text: #1a1a2e;
  --text-dim: #666;
  --navy-light: #ffffff;
  --navy-lighter: #e8e8f0;
}

* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body {
  height: 100%;
  overflow: hidden;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
}

.hidden { display: none !important; }

/* ===== ONBOARDING ===== */
.screen {
  position: fixed; inset: 0;
  display: flex; align-items: center; justify-content: center;
  background: var(--navy);
  z-index: 1000;
  animation: fadeIn 0.5s ease;
}

@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes slideUp { from { transform: translateY(30px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
@keyframes pulse { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.05); } }
@keyframes heartBurst {
  0% { transform: scale(0); opacity: 1; }
  50% { transform: scale(1.3); opacity: 1; }
  100% { transform: scale(1); opacity: 0; }
}
@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-5px); }
  75% { transform: translateX(5px); }
}
@keyframes correctFlash {
  0% { background: var(--teal); transform: scale(1.02); }
  100% { background: transparent; transform: scale(1); }
}
@keyframes slideIn { from { transform: translateX(100%); } to { transform: translateX(0); } }
@keyframes slideOut { from { transform: translateX(0); } to { transform: translateX(-100%); } }

.onboarding-content {
  text-align: center;
  padding: 24px;
  max-width: 420px;
  width: 100%;
  max-height: 100vh;
  overflow-y: auto;
}

.splash-logo { margin-bottom: 8px; animation: slideUp 0.8s ease; }
.logo-img { width: 160px; height: 160px; }

.onboarding-subtitle {
  font-size: 18px; color: var(--gold); font-weight: 300;
  letter-spacing: 4px; text-transform: uppercase;
  margin-bottom: 12px; animation: slideUp 1s ease;
}

.onboarding-desc {
  font-size: 14px; color: var(--text-dim); line-height: 1.6;
  margin-bottom: 24px; animation: slideUp 1.2s ease;
}

.interests-grid {
  display: grid; grid-template-columns: repeat(2, 1fr);
  gap: 10px; margin-bottom: 16px;
  animation: slideUp 1.4s ease;
}

.interest-chip {
  padding: 14px 8px;
  border-radius: 12px;
  background: var(--navy-light);
  border: 2px solid transparent;
  cursor: pointer;
  transition: all 0.2s ease;
  font-size: 13px;
  display: flex; flex-direction: column; align-items: center; gap: 6px;
}

.interest-chip .chip-icon { font-size: 24px; }
.interest-chip.selected {
  border-color: var(--gold);
  background: rgba(226, 183, 20, 0.15);
}
.interest-chip:active { transform: scale(0.95); }

.interest-hint { font-size: 12px; color: var(--text-dim); margin-bottom: 16px; }

.btn-primary {
  width: 100%; padding: 16px; border: none; border-radius: 12px;
  background: var(--gold); color: var(--navy); font-size: 16px;
  font-weight: 600; cursor: pointer; transition: all 0.2s;
}
.btn-primary:disabled { opacity: 0.4; cursor: not-allowed; }
.btn-primary:not(:disabled):active { transform: scale(0.98); }

/* ===== DAILY PROGRESS BAR ===== */
.daily-progress-bar {
  position: fixed; top: var(--safe-top); left: 0; right: 0;
  height: var(--progress-height); background: var(--navy-lighter); z-index: 100;
}
.daily-progress-fill {
  height: 100%; background: linear-gradient(90deg, var(--teal), var(--gold));
  width: 0%; transition: width 0.5s ease;
}

/* ===== STREAK TOAST ===== */
.streak-toast {
  position: fixed; top: calc(var(--safe-top) + 12px); left: 50%; transform: translateX(-50%);
  background: var(--card-bg); padding: 10px 20px; border-radius: 20px;
  font-size: 14px; font-weight: 600; z-index: 200;
  box-shadow: 0 4px 20px rgba(0,0,0,0.3);
  animation: slideUp 0.5s ease;
}
.streak-fire { margin-right: 6px; }

/* ===== PAGES ===== */
.screens-container {
  position: fixed;
  top: calc(var(--safe-top) + var(--progress-height));
  left: 0; right: 0;
  bottom: calc(var(--nav-height) + var(--safe-bottom));
  overflow: hidden;
}
.page {
  position: absolute; inset: 0;
  overflow-y: auto; overflow-x: hidden;
  opacity: 0; pointer-events: none;
  transition: opacity 0.25s ease;
  -webkit-overflow-scrolling: touch;
}
.page.active { opacity: 1; pointer-events: auto; }

.page-header {
  padding: 20px 20px 12px;
  position: sticky; top: 0; z-index: 10;
  background: var(--bg);
}
.page-header h1 { font-size: 28px; font-weight: 700; }
.page-subtitle { font-size: 13px; color: var(--text-dim); margin-top: 4px; }

/* ===== HOME FEED (TikTok style) ===== */
.feed-container {
  height: 100%;
  overflow-y: scroll;
  scroll-snap-type: y mandatory;
  -webkit-overflow-scrolling: touch;
}

.feed-card {
  height: 100%;
  scroll-snap-align: start;
  position: relative;
  display: flex; flex-direction: column;
  background: #000;
}

.feed-card iframe {
  flex: 1;
  width: 100%; height: 100%;
  border: none;
}

.feed-card-overlay {
  position: absolute; bottom: 0; left: 0; right: 0;
  padding: 60px 16px 16px;
  background: linear-gradient(transparent, rgba(0,0,0,0.8));
  pointer-events: none;
}

.feed-card-title {
  font-size: 15px; font-weight: 600; color: #fff;
  margin-bottom: 8px;
}

.feed-card-meta {
  display: flex; align-items: center; gap: 8px;
}

.category-pill {
  padding: 4px 10px; border-radius: 12px;
  font-size: 11px; font-weight: 600;
  color: #fff;
}

.feed-card-channel {
  font-size: 12px; color: rgba(255,255,255,0.7);
}

.feed-card-actions {
  position: absolute; right: 12px; bottom: 80px;
  display: flex; flex-direction: column; gap: 16px;
  pointer-events: auto;
}

.feed-action-btn {
  width: 44px; height: 44px;
  border-radius: 50%; border: none;
  background: rgba(255,255,255,0.15);
  backdrop-filter: blur(10px);
  display: flex; align-items: center; justify-content: center;
  font-size: 20px; cursor: pointer;
  transition: all 0.2s;
}
.feed-action-btn:active { transform: scale(0.9); }
.feed-action-btn.saved { background: rgba(226, 183, 20, 0.3); }

/* ===== DISCOVER ===== */
.discover-grid {
  display: grid; grid-template-columns: repeat(2, 1fr);
  gap: 12px; padding: 0 16px 100px;
}

.discover-card {
  border-radius: 16px; padding: 20px 14px;
  text-align: center; cursor: pointer;
  transition: all 0.2s; position: relative; overflow: hidden;
}
.discover-card:active { transform: scale(0.96); }
.discover-card-icon { font-size: 36px; margin-bottom: 8px; }
.discover-card h3 { font-size: 14px; font-weight: 600; color: #fff; }
.discover-card p { font-size: 11px; color: rgba(255,255,255,0.7); margin-top: 4px; }

.category-detail-header {
  display: flex; align-items: center; gap: 12px;
  padding: 20px 16px 12px;
  position: sticky; top: 0; background: var(--bg); z-index: 10;
}

.btn-back {
  width: 36px; height: 36px; border-radius: 50%;
  border: none; background: var(--navy-lighter);
  color: var(--text); font-size: 18px; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
}

.subcategory-pills {
  display: flex; gap: 8px; padding: 0 16px 12px;
  overflow-x: auto;
  -ms-overflow-style: none; scrollbar-width: none;
}
.subcategory-pills::-webkit-scrollbar { display: none; }

.sub-pill {
  padding: 6px 14px; border-radius: 16px;
  background: var(--navy-lighter); font-size: 12px;
  white-space: nowrap; cursor: pointer; border: none;
  color: var(--text); transition: all 0.2s;
}
.sub-pill.active { background: var(--gold); color: var(--navy); }

.category-feed { padding: 0 16px 100px; }

.category-video-card {
  display: flex; gap: 12px; padding: 12px 0;
  border-bottom: 1px solid var(--navy-lighter);
  cursor: pointer;
}
.category-video-thumb {
  width: 120px; height: 68px; border-radius: 8px;
  background: var(--navy-lighter); flex-shrink: 0;
  overflow: hidden;
}
.category-video-thumb img { width: 100%; height: 100%; object-fit: cover; }
.category-video-info h4 { font-size: 13px; font-weight: 500; line-height: 1.4; }
.category-video-info p { font-size: 11px; color: var(--text-dim); margin-top: 4px; }

/* ===== NEWS ===== */
.news-tabs {
  display: flex; gap: 0; padding: 0 16px 12px;
  overflow-x: auto;
  -ms-overflow-style: none; scrollbar-width: none;
}
.news-tabs::-webkit-scrollbar { display: none; }

.news-tab {
  padding: 8px 16px; border: none; background: none;
  color: var(--text-dim); font-size: 13px; font-weight: 500;
  cursor: pointer; white-space: nowrap; position: relative;
  transition: color 0.2s;
}
.news-tab.active { color: var(--gold); }
.news-tab.active::after {
  content: ''; position: absolute; bottom: 0; left: 16px; right: 16px;
  height: 2px; background: var(--gold); border-radius: 1px;
}

.news-feed { padding: 0 16px 100px; }

.news-card {
  display: flex; gap: 12px; padding: 14px 0;
  border-bottom: 1px solid var(--navy-lighter);
  cursor: pointer; text-decoration: none; color: var(--text);
}
.news-card:active { opacity: 0.7; }
.news-thumb {
  width: 90px; height: 90px; border-radius: 10px;
  background: var(--navy-lighter); flex-shrink: 0;
  overflow: hidden;
}
.news-thumb img { width: 100%; height: 100%; object-fit: cover; }
.news-info { flex: 1; display: flex; flex-direction: column; justify-content: center; }
.news-info h4 { font-size: 14px; font-weight: 500; line-height: 1.4; margin-bottom: 6px; }
.news-meta { font-size: 11px; color: var(--text-dim); }
.news-meta span { margin-right: 8px; }

/* Skeleton loader */
.skeleton-card {
  height: 90px; border-radius: 10px;
  background: var(--navy-lighter);
  margin-bottom: 12px;
  animation: pulse 1.5s ease infinite;
}

/* ===== BRAIN TRAINING ===== */
.brain-sections {
  display: grid; grid-template-columns: repeat(2, 1fr);
  gap: 12px; padding: 0 16px 100px;
}

.brain-card {
  background: var(--card-bg); border-radius: 16px;
  padding: 20px 14px; text-align: center;
  cursor: pointer; transition: all 0.2s;
  border: 1px solid var(--navy-lighter);
}
.brain-card:active { transform: scale(0.96); }
.brain-card:nth-child(5) { grid-column: span 2; }
.brain-card-icon { font-size: 32px; margin-bottom: 8px; }
.brain-card h3 { font-size: 14px; font-weight: 600; margin-bottom: 4px; }
.brain-card p { font-size: 11px; color: var(--text-dim); }

.brain-view-header {
  display: flex; align-items: center; gap: 12px;
  padding: 20px 16px 12px;
  position: sticky; top: 0; background: var(--bg); z-index: 10;
}
.brain-view-header h2 { flex: 1; font-size: 20px; }
.brain-streak {
  font-size: 14px; font-weight: 600;
  background: var(--navy-lighter); padding: 4px 12px;
  border-radius: 16px;
}

.brain-view-content { padding: 0 16px 100px; }

/* Math game */
.math-problem {
  text-align: center; padding: 30px 0;
}
.math-expression {
  font-size: 42px; font-weight: 700; margin-bottom: 20px;
  color: var(--gold);
}
.math-timer {
  font-size: 14px; color: var(--text-dim); margin-bottom: 20px;
}
.math-input {
  width: 120px; padding: 12px; font-size: 24px; text-align: center;
  border: 2px solid var(--navy-lighter); border-radius: 12px;
  background: var(--card-bg); color: var(--text);
  outline: none; font-family: inherit;
}
.math-input:focus { border-color: var(--gold); }
.math-input.correct { border-color: var(--teal); animation: correctFlash 0.5s ease; }
.math-input.wrong { border-color: #e74c3c; animation: shake 0.3s ease; }
.math-score {
  margin-top: 16px; font-size: 14px; color: var(--text-dim);
}

/* Quiz */
.quiz-question {
  font-size: 18px; font-weight: 600; text-align: center;
  padding: 24px 0 20px; line-height: 1.4;
}
.quiz-options { display: flex; flex-direction: column; gap: 10px; }
.quiz-option {
  padding: 14px 16px; border-radius: 12px;
  background: var(--card-bg); border: 2px solid var(--navy-lighter);
  font-size: 15px; cursor: pointer; transition: all 0.2s;
  text-align: left; color: var(--text); font-family: inherit;
}
.quiz-option:active { transform: scale(0.98); }
.quiz-option.correct { border-color: var(--teal); background: rgba(22, 160, 133, 0.15); }
.quiz-option.wrong { border-color: #e74c3c; background: rgba(231, 76, 60, 0.15); }
.quiz-progress {
  text-align: center; font-size: 12px; color: var(--text-dim);
  margin-bottom: 8px;
}
.quiz-score-final {
  text-align: center; padding: 40px 0;
}
.quiz-score-final .score-number { font-size: 64px; font-weight: 700; color: var(--gold); }
.quiz-score-final p { font-size: 16px; color: var(--text-dim); margin-top: 8px; }
.quiz-score-final .btn-primary { margin-top: 24px; }

/* Word of the day */
.word-card {
  background: var(--card-bg); border-radius: 16px;
  padding: 32px 20px; text-align: center;
  border: 1px solid var(--navy-lighter);
}
.word-main { font-size: 32px; font-weight: 700; color: var(--gold); margin-bottom: 4px; }
.word-origin { font-size: 12px; color: var(--text-dim); margin-bottom: 16px; font-style: italic; }
.word-meaning { font-size: 16px; line-height: 1.6; color: var(--text); }

/* Facts */
.fact-card {
  background: var(--card-bg); border-radius: 16px;
  padding: 24px 20px; text-align: center;
  border: 1px solid var(--navy-lighter);
  margin-bottom: 16px;
}
.fact-icon { font-size: 40px; margin-bottom: 12px; }
.fact-text { font-size: 15px; line-height: 1.6; }
.btn-next-fact {
  display: block; margin: 0 auto;
  padding: 10px 24px; border: none; border-radius: 20px;
  background: var(--gold); color: var(--navy);
  font-size: 14px; font-weight: 600; cursor: pointer;
  margin-top: 16px; transition: transform 0.2s;
}
.btn-next-fact:active { transform: scale(0.95); }

/* ===== LEARN ===== */
.learn-subjects {
  display: grid; grid-template-columns: repeat(2, 1fr);
  gap: 12px; padding: 0 16px 100px;
}
.learn-subject-card {
  background: var(--card-bg); border-radius: 16px;
  padding: 18px 14px; text-align: center;
  cursor: pointer; transition: all 0.2s;
  border: 1px solid var(--navy-lighter);
}
.learn-subject-card:active { transform: scale(0.96); }
.learn-subject-icon { font-size: 32px; margin-bottom: 6px; }
.learn-subject-card h4 { font-size: 14px; font-weight: 600; }
.learn-subject-card .progress-mini {
  height: 3px; background: var(--navy-lighter); border-radius: 2px;
  margin-top: 8px; overflow: hidden;
}
.learn-subject-card .progress-mini-fill {
  height: 100%; background: var(--teal); border-radius: 2px;
  transition: width 0.3s;
}

.lesson-card {
  background: var(--card-bg); border-radius: 16px;
  padding: 24px 20px; border: 1px solid var(--navy-lighter);
  margin-bottom: 16px;
}
.lesson-card h3 { font-size: 18px; font-weight: 600; color: var(--gold); margin-bottom: 12px; }
.lesson-card p { font-size: 14px; line-height: 1.7; color: var(--text); }
.lesson-nav {
  display: flex; justify-content: space-between; align-items: center;
  margin-top: 16px;
}
.lesson-nav button {
  padding: 10px 20px; border: none; border-radius: 10px;
  font-size: 13px; font-weight: 600; cursor: pointer;
  transition: transform 0.2s;
}
.lesson-nav button:active { transform: scale(0.95); }
.lesson-prev { background: var(--navy-lighter); color: var(--text); }
.lesson-next { background: var(--gold); color: var(--navy); }
.lesson-progress { font-size: 12px; color: var(--text-dim); }

/* ===== PROFILE ===== */
.profile-content { padding: 0 20px 100px; text-align: center; }

.profile-avatar {
  width: 80px; height: 80px; border-radius: 50%;
  background: var(--navy-lighter); display: flex;
  align-items: center; justify-content: center;
  font-size: 40px; margin: 0 auto 12px;
}

.profile-name {
  background: none; border: none; border-bottom: 2px solid var(--navy-lighter);
  color: var(--text); font-size: 20px; font-weight: 600;
  text-align: center; padding: 8px; width: 100%; max-width: 240px;
  font-family: inherit; outline: none;
}
.profile-name:focus { border-bottom-color: var(--gold); }

.stats-grid {
  display: grid; grid-template-columns: repeat(2, 1fr);
  gap: 10px; margin: 24px 0;
}
.stat-card {
  background: var(--card-bg); border-radius: 12px;
  padding: 16px 8px; border: 1px solid var(--navy-lighter);
}
.stat-number { font-size: 28px; font-weight: 700; color: var(--gold); }
.stat-label { font-size: 11px; color: var(--text-dim); margin-top: 2px; }

.profile-section {
  text-align: left; margin-top: 24px;
}
.profile-section h3 { font-size: 16px; font-weight: 600; margin-bottom: 12px; }

.goal-setting {
  display: flex; justify-content: space-between; align-items: center;
  padding: 10px 0; border-bottom: 1px solid var(--navy-lighter);
}
.goal-setting label { font-size: 14px; }
.goal-stepper {
  display: flex; align-items: center; gap: 12px;
}
.stepper-btn {
  width: 32px; height: 32px; border-radius: 50%;
  border: none; background: var(--navy-lighter);
  color: var(--text); font-size: 16px; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
}
.stepper-btn:active { background: var(--gold); color: var(--navy); }
.goal-stepper span { font-size: 18px; font-weight: 600; min-width: 24px; text-align: center; }

.profile-interests {
  display: flex; flex-wrap: wrap; gap: 8px;
}
.profile-interest-tag {
  padding: 6px 12px; border-radius: 16px;
  font-size: 12px; font-weight: 500;
  cursor: pointer; transition: all 0.2s;
  border: 2px solid transparent;
}
.profile-interest-tag.active { border-color: var(--gold); }

.saved-videos { min-height: 60px; }
.empty-state { font-size: 13px; color: var(--text-dim); text-align: center; padding: 20px; }

.saved-video-item {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 0; border-bottom: 1px solid var(--navy-lighter);
}
.saved-video-item .thumb {
  width: 60px; height: 34px; border-radius: 6px;
  background: var(--navy-lighter); overflow: hidden;
}
.saved-video-item .thumb img { width: 100%; height: 100%; object-fit: cover; }
.saved-video-item span { font-size: 13px; flex: 1; }
.saved-video-item .remove-btn {
  background: none; border: none; color: var(--text-dim);
  font-size: 16px; cursor: pointer; padding: 4px;
}

.toggle-row {
  display: flex; justify-content: space-between; align-items: center;
  padding: 12px 0;
}
.toggle {
  position: relative; width: 48px; height: 26px;
}
.toggle input { display: none; }
.toggle-slider {
  position: absolute; inset: 0; border-radius: 13px;
  background: var(--navy-lighter); cursor: pointer;
  transition: all 0.3s;
}
.toggle-slider::before {
  content: ''; position: absolute;
  width: 20px; height: 20px; border-radius: 50%;
  background: var(--white); top: 3px; left: 3px;
  transition: transform 0.3s;
}
.toggle input:checked + .toggle-slider { background: var(--gold); }
.toggle input:checked + .toggle-slider::before { transform: translateX(22px); }

/* ===== BOTTOM NAV ===== */
.bottom-nav {
  position: fixed; bottom: var(--safe-bottom); left: 0; right: 0;
  height: var(--nav-height);
  background: var(--card-bg);
  border-top: 1px solid var(--navy-lighter);
  display: flex; justify-content: space-around; align-items: center;
  z-index: 100;
  backdrop-filter: blur(20px);
}

.nav-btn {
  display: flex; flex-direction: column; align-items: center;
  gap: 2px; background: none; border: none;
  color: var(--text-dim); cursor: pointer;
  padding: 8px 12px; transition: color 0.2s;
  -webkit-tap-highlight-color: transparent;
}
.nav-btn.active { color: var(--gold); }
.nav-icon { font-size: 22px; }
.nav-label { font-size: 10px; font-weight: 500; }

/* ===== HEART OVERLAY ===== */
.heart-overlay {
  position: fixed; inset: 0; z-index: 500;
  display: flex; align-items: center; justify-content: center;
  pointer-events: none;
}
.heart-anim {
  font-size: 100px;
  animation: heartBurst 0.6s ease forwards;
}

/* ===== SCROLLBAR ===== */
::-webkit-scrollbar { width: 0; }

/* ===== RESPONSIVE ===== */
@media (min-width: 480px) {
  .interests-grid { grid-template-columns: repeat(3, 1fr); }
  .discover-grid { grid-template-columns: repeat(3, 1fr); }
}
