/* ===========================================================
   UPKK Sirah Learning App — Design System
   Islamic Scholarly Aesthetic • Mobile-First
   =========================================================== */

/* --- CSS Custom Properties --- */
:root {
  /* Colors */
  --c-primary: #38b2ac;
  --c-primary-light: #5fd0ca;
  --c-primary-dark: #0f766e;
  --c-accent: #f0b44c;
  --c-accent-light: #f6cd7a;
  --c-bg: #07171b;
  --c-bg-alt: #10262b;
  --c-card: #112127;
  --c-card-hover: #183039;
  --c-text: #f3f7f7;
  --c-text-secondary: #bfd0d0;
  --c-text-muted: #7e98a0;
  --c-correct: #4ade80;
  --c-correct-bg: #0f2b1a;
  --c-wrong: #fb7185;
  --c-wrong-bg: #34131a;
  --c-focus: #f59e0b;
  --c-focus-bg: #39280b;
  --c-border: #26434b;

  /* Typography */
  --font-heading: 'Outfit', sans-serif;
  --font-body: 'Inter', sans-serif;

  /* Spacing */
  --space-xs: 4px;
  --space-sm: 8px;
  --space-md: 16px;
  --space-lg: 24px;
  --space-xl: 32px;
  --space-2xl: 48px;

  /* Radius */
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 24px;
  --radius-full: 9999px;

  /* Shadows */
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.28);
  --shadow-md: 0 10px 24px rgba(0,0,0,0.3);
  --shadow-lg: 0 18px 40px rgba(0,0,0,0.38);
  --shadow-glow: 0 0 24px rgba(56,178,172,0.22);

  /* Safe areas for mobile */
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

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

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  color-scheme: dark;
}

body {
  font-family: var(--font-body);
  background: var(--c-bg);
  color: var(--c-text);
  min-height: 100vh;
  min-height: 100dvh;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}

/* Subtle Islamic geometric pattern background */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  background-image:
    radial-gradient(circle at 25% 25%, rgba(56,178,172,0.12) 0%, transparent 50%),
    radial-gradient(circle at 75% 75%, rgba(240,180,76,0.08) 0%, transparent 50%);
  pointer-events: none;
  z-index: 0;
}

#app {
  position: relative;
  z-index: 1;
  max-width: 480px;
  margin: 0 auto;
  padding: var(--space-md);
  padding-bottom: calc(80px + var(--safe-bottom));
  min-height: 100vh;
  min-height: 100dvh;
}

/* View transition */
.view-transition {
  animation: fadeSlideIn 0.25s ease-out;
}

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

/* --- Typography --- */
h1, h2, h3, h4 {
  font-family: var(--font-heading);
  font-weight: 700;
  line-height: 1.3;
}

h1 { font-size: 1.75rem; }
h2 { font-size: 1.375rem; }
h3 { font-size: 1.125rem; }

/* --- Buttons --- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-sm);
  padding: 12px 20px;
  border: none;
  border-radius: var(--radius-md);
  font-family: var(--font-body);
  font-size: 0.938rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  -webkit-tap-highlight-color: transparent;
  min-height: 48px;
  white-space: nowrap;
}

.btn:active { transform: scale(0.97); }

.btn-primary {
  background: linear-gradient(135deg, var(--c-primary), var(--c-primary-light));
  color: white;
  box-shadow: 0 8px 18px rgba(56,178,172,0.28);
}
.btn-primary:hover { box-shadow: 0 10px 22px rgba(56,178,172,0.38); }

.btn-accent {
  background: linear-gradient(135deg, var(--c-accent), var(--c-accent-light));
  color: #1b1204;
  box-shadow: 0 8px 18px rgba(240,180,76,0.25);
}

.btn-outline {
  background: transparent;
  border: 2px solid var(--c-border);
  color: var(--c-text);
}
.btn-outline:hover { border-color: var(--c-primary); color: var(--c-primary); }

.btn-ghost {
  background: transparent;
  color: var(--c-text-secondary);
}

.btn-icon {
  background: var(--c-card);
  color: var(--c-text);
  width: 44px;
  height: 44px;
  padding: 0;
  border-radius: var(--radius-md);
  font-size: 1.25rem;
  box-shadow: var(--shadow-sm);
}

.btn-full { width: 100%; }

.btn-sm {
  padding: 8px 16px;
  font-size: 0.813rem;
  min-height: 36px;
}

/* --- Input --- */
.input-field {
  width: 100%;
  padding: 14px 16px;
  border: 2px solid var(--c-border);
  border-radius: var(--radius-md);
  font-family: var(--font-body);
  font-size: 1rem;
  background: var(--c-card);
  color: var(--c-text);
  transition: border-color 0.2s;
  min-height: 48px;
}

.input-field:focus {
  outline: none;
  border-color: var(--c-primary);
  box-shadow: 0 0 0 3px rgba(56,178,172,0.18);
}

.input-error { border-color: var(--c-wrong) !important; }

/* --- Bottom Navigation --- */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--c-card);
  border-top: 1px solid var(--c-border);
  display: flex;
  justify-content: space-around;
  padding: 8px 0;
  padding-bottom: calc(8px + var(--safe-bottom));
  z-index: 100;
  box-shadow: 0 -8px 24px rgba(0,0,0,0.28);
}

.bottom-nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 6px 16px;
  border: none;
  background: none;
  color: var(--c-text-muted);
  font-family: var(--font-body);
  font-size: 0.688rem;
  font-weight: 500;
  cursor: pointer;
  transition: color 0.2s;
  -webkit-tap-highlight-color: transparent;
  min-width: 64px;
}

.bottom-nav-item .nav-icon {
  font-size: 1.375rem;
  line-height: 1;
}

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

.bottom-nav-item.active .nav-icon {
  transform: scale(1.1);
}

/* --- Home Screen --- */
.home-screen {
  display: flex;
  flex-direction: column;
  gap: var(--space-lg);
  padding-top: var(--space-lg);
}

.home-header {
  text-align: center;
  padding: var(--space-xl) 0 var(--space-md);
}

.home-logo {
  font-size: 3.5rem;
  margin-bottom: var(--space-sm);
  animation: gentlePulse 3s ease-in-out infinite;
}

@keyframes gentlePulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.05); }
}

.home-title {
  color: var(--c-primary);
  font-size: 2rem;
  margin-bottom: var(--space-xs);
}

.home-subtitle {
  color: var(--c-text-secondary);
  font-size: 0.938rem;
}

.section-title {
  color: var(--c-text);
  font-size: 1rem;
  font-weight: 700;
  margin-bottom: var(--space-md);
}

/* Student Cards */
.student-section {
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
}

.student-list {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--space-md);
}

.student-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-sm);
  padding: var(--space-lg) var(--space-md);
  background: var(--c-card);
  border: 2px solid var(--c-border);
  border-radius: var(--radius-lg);
  cursor: pointer;
  transition: all 0.2s;
  -webkit-tap-highlight-color: transparent;
}

.student-card:hover, .student-card:active {
  border-color: var(--c-primary);
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

.student-avatar { font-size: 2.5rem; }
.student-name {
  font-weight: 600;
  font-size: 0.938rem;
  color: var(--c-text);
}

/* Add Student Form */
.add-student-form {
  background: var(--c-card);
  border-radius: var(--radius-lg);
  padding: var(--space-lg);
  box-shadow: var(--shadow-md);
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
}

.avatar-picker {
  display: flex;
  gap: var(--space-sm);
  flex-wrap: wrap;
  justify-content: center;
}

.avatar-option {
  width: 48px;
  height: 48px;
  font-size: 1.5rem;
  border: 2px solid var(--c-border);
  border-radius: var(--radius-full);
  background: var(--c-bg);
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
}

.avatar-option.selected {
  border-color: var(--c-primary);
  background: rgba(56,178,172,0.16);
  transform: scale(1.1);
}

.form-actions {
  display: flex;
  gap: var(--space-sm);
}
.form-actions .btn { flex: 1; }

.empty-state {
  text-align: center;
  color: var(--c-text-muted);
  padding: var(--space-xl);
  font-style: italic;
}

.hidden { display: none !important; }

/* --- Dashboard --- */
.dashboard {
  display: flex;
  flex-direction: column;
  gap: var(--space-lg);
  padding-top: var(--space-md);
}

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

.dash-student-info {
  display: flex;
  align-items: center;
  gap: var(--space-md);
}

.dash-avatar { font-size: 2.5rem; }
.dash-name { font-size: 1.125rem; }
.dash-subtitle { color: var(--c-text-secondary); font-size: 0.813rem; }

/* Stats Row */
.stats-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-sm);
}

.stat-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: var(--space-md) var(--space-sm);
  background: var(--c-card);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}

.stat-icon { font-size: 1.5rem; }
.stat-value { font-family: var(--font-heading); font-size: 1.375rem; font-weight: 800; color: var(--c-primary); }
.stat-label { font-size: 0.688rem; color: var(--c-text-muted); text-align: center; }

/* Chapter Card */
.chapter-card {
  background: var(--c-card);
  border-radius: var(--radius-lg);
  padding: var(--space-lg);
  box-shadow: var(--shadow-md);
  border: 1px solid var(--c-border);
}

.chapter-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--space-sm);
}

.chapter-number {
  font-size: 0.75rem;
  color: var(--c-primary);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.chapter-progress {
  font-family: var(--font-heading);
  font-size: 0.875rem;
  font-weight: 700;
  color: var(--c-primary);
}

.chapter-title {
  font-size: 1.25rem;
  margin-bottom: var(--space-md);
}

.chapter-progress-bar {
  height: 6px;
  background: var(--c-bg-alt);
  border-radius: var(--radius-full);
  overflow: hidden;
  margin-bottom: var(--space-lg);
}

.chapter-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--c-primary), var(--c-accent));
  border-radius: var(--radius-full);
  transition: width 0.5s ease;
}

.chapter-actions {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: var(--space-sm);
}

.chapter-actions .btn {
  font-size: 0.813rem;
  padding: 10px 8px;
}

/* Section Grid */
.section-grid {
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
}

.section-chip {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  padding: var(--space-md);
  background: var(--c-card);
  border: 1px solid var(--c-border);
  border-radius: var(--radius-md);
  cursor: pointer;
  font-family: var(--font-body);
  font-size: 0.875rem;
  color: var(--c-text);
  text-align: left;
  transition: all 0.2s;
  -webkit-tap-highlight-color: transparent;
}

.section-chip:hover, .section-chip:active {
  border-color: var(--c-primary);
  background: rgba(56,178,172,0.08);
}

/* --- Flashcard Screen --- */
.flashcard-screen {
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
  min-height: calc(100vh - 120px);
  min-height: calc(100dvh - 120px);
}

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

.flashcard-counter {
  font-family: var(--font-heading);
  font-weight: 700;
  color: var(--c-text-secondary);
}

.flashcard-mastery {
  font-size: 0.75rem;
  font-weight: 700;
}

.flashcard-section-label {
  text-align: center;
  font-size: 0.813rem;
  color: var(--c-primary);
  font-weight: 600;
}

/* Card Flip */
.flashcard-container {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  perspective: 1000px;
  min-height: 300px;
}

.flashcard-card {
  width: 100%;
  min-height: 280px;
  position: relative;
  transform-style: preserve-3d;
  transition: transform 0.6s cubic-bezier(0.4, 0, 0.2, 1);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.flashcard-card.flipped {
  transform: rotateY(180deg);
}

.flashcard-front, .flashcard-back {
  position: absolute;
  inset: 0;
  backface-visibility: hidden;
  border-radius: var(--radius-xl);
  padding: var(--space-xl);
  display: flex;
  flex-direction: column;
  justify-content: center;
  box-shadow: var(--shadow-lg);
}

.flashcard-front {
  background: linear-gradient(145deg, var(--c-card), var(--c-bg));
  border: 2px solid var(--c-border);
}

.flashcard-back {
  background: linear-gradient(145deg, var(--c-primary-dark), var(--c-primary));
  color: white;
  transform: rotateY(180deg);
}

.flashcard-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: var(--space-md);
}

.flashcard-text {
  font-size: 1.125rem;
  line-height: 1.7;
  text-align: center;
}

.flashcard-hint {
  text-align: center;
  font-size: 0.75rem;
  color: var(--c-text-muted);
  position: absolute;
  bottom: var(--space-md);
  left: 0;
  right: 0;
}

.flashcard-source {
  position: absolute;
  bottom: var(--space-sm);
  right: var(--space-md);
  font-size: 0.625rem;
  opacity: 0.6;
}

/* Mnemonic Tip */
.mnemonic-tip {
  display: flex;
  align-items: flex-start;
  gap: var(--space-sm);
  padding: var(--space-md);
  background: rgba(240,180,76,0.14);
  border-radius: var(--radius-md);
  border-left: 3px solid var(--c-accent);
}

.tip-icon { font-size: 1.25rem; flex-shrink: 0; }
.tip-text { font-size: 0.875rem; line-height: 1.5; }

/* Rating Buttons */
.rating-buttons {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-sm);
}

.btn-rating {
  flex-direction: column;
  padding: var(--space-md) var(--space-sm);
  border-radius: var(--radius-lg);
  font-size: 0.75rem;
  min-height: 64px;
}

.rating-icon { font-size: 1.5rem; }

.btn-rating-fail {
  background: var(--c-wrong-bg);
  color: var(--c-wrong);
  border: 2px solid var(--c-wrong);
}

.btn-rating-ok {
  background: var(--c-focus-bg);
  color: var(--c-focus);
  border: 2px solid var(--c-focus);
}

.btn-rating-good {
  background: var(--c-correct-bg);
  color: var(--c-correct);
  border: 2px solid var(--c-correct);
}

/* Progress bar */
.flashcard-progress-bar, .quiz-progress-bar {
  height: 4px;
  background: var(--c-bg-alt);
  border-radius: var(--radius-full);
  overflow: hidden;
}

.flashcard-progress-fill, .quiz-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--c-primary), var(--c-accent));
  border-radius: var(--radius-full);
  transition: width 0.4s ease;
}

/* --- Quiz Screen --- */
.quiz-screen {
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
  min-height: calc(100vh - 120px);
  min-height: calc(100dvh - 120px);
}

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

.quiz-counter {
  font-family: var(--font-heading);
  font-weight: 700;
  color: var(--c-text-secondary);
}

.quiz-score {
  font-family: var(--font-heading);
  font-weight: 700;
  color: var(--c-accent);
}

.quiz-question-card {
  background: var(--c-card);
  border-radius: var(--radius-lg);
  padding: var(--space-xl) var(--space-lg);
  box-shadow: var(--shadow-md);
  border-left: 4px solid var(--c-primary);
}

.quiz-question {
  font-size: 1.063rem;
  line-height: 1.7;
  font-weight: 500;
}

/* Quiz Options */
.quiz-options {
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
}

.quiz-option {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  padding: var(--space-md) var(--space-lg);
  background: var(--c-card);
  border: 2px solid var(--c-border);
  border-radius: var(--radius-md);
  cursor: pointer;
  font-family: var(--font-body);
  font-size: 0.938rem;
  color: var(--c-text);
  text-align: left;
  transition: all 0.2s;
  -webkit-tap-highlight-color: transparent;
  min-height: 52px;
}

.quiz-option:hover:not(.option-disabled) {
  border-color: var(--c-primary);
  background: rgba(56,178,172,0.08);
}

.option-letter {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: var(--radius-full);
  background: var(--c-bg-alt);
  font-weight: 700;
  font-size: 0.813rem;
  flex-shrink: 0;
  transition: all 0.2s;
}

.option-text {
  flex: 1;
  line-height: 1.5;
}

.option-correct {
  border-color: var(--c-correct) !important;
  background: var(--c-correct-bg) !important;
}

.option-correct .option-letter {
  background: var(--c-correct);
  color: white;
}

.option-wrong {
  border-color: var(--c-wrong) !important;
  background: var(--c-wrong-bg) !important;
}

.option-wrong .option-letter {
  background: var(--c-wrong);
  color: white;
}

.option-disabled {
  pointer-events: none;
  opacity: 0.85;
}

/* Quiz Feedback */
.quiz-feedback {
  animation: slideUp 0.3s ease-out;
}

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

.feedback-correct, .feedback-wrong {
  display: flex;
  gap: var(--space-md);
  padding: var(--space-lg);
  border-radius: var(--radius-lg);
}

.feedback-correct {
  background: var(--c-correct-bg);
  border: 1px solid var(--c-correct);
}

.feedback-wrong {
  background: var(--c-focus-bg);
  border: 1px solid var(--c-focus);
}

.feedback-icon {
  font-size: 1.5rem;
  flex-shrink: 0;
}

.feedback-title {
  font-weight: 700;
  margin-bottom: var(--space-xs);
  font-size: 0.938rem;
}

.feedback-message {
  font-size: 0.875rem;
  line-height: 1.6;
  color: var(--c-text);
  margin-bottom: var(--space-sm);
}

.feedback-correct-answer {
  font-size: 0.813rem;
  font-weight: 600;
  color: var(--c-correct);
}

.quiz-next-area {
  padding-top: var(--space-sm);
}

/* --- Results Screen --- */
.results-screen {
  display: flex;
  flex-direction: column;
  gap: var(--space-lg);
  padding-top: var(--space-lg);
}

.results-header {
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-md);
}

.results-emoji {
  font-size: 3rem;
  animation: bounceIn 0.5s ease;
}

@keyframes bounceIn {
  0% { transform: scale(0.3); opacity: 0; }
  50% { transform: scale(1.05); }
  70% { transform: scale(0.9); }
  100% { transform: scale(1); opacity: 1; }
}

.results-title {
  font-size: 1.25rem;
  color: var(--c-text);
}

/* Score Ring */
.results-score-circle {
  position: relative;
  width: 140px;
  height: 140px;
}

.score-ring {
  width: 100%;
  height: 100%;
  transform: rotate(-90deg);
}

.score-ring-bg {
  fill: none;
  stroke: var(--c-bg-alt);
  stroke-width: 8;
}

.score-ring-fill {
  fill: none;
  stroke: var(--c-primary);
  stroke-width: 8;
  stroke-linecap: round;
  transition: stroke-dasharray 1s ease;
}

.score-text {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.score-number {
  font-family: var(--font-heading);
  font-size: 2.5rem;
  font-weight: 800;
  color: var(--c-primary);
  line-height: 1;
}

.score-total {
  font-size: 0.875rem;
  color: var(--c-text-muted);
}

.results-stars {
  color: var(--c-accent);
  font-weight: 600;
}

/* Result Items */
.results-details {
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
}

.result-item {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: var(--space-sm) var(--space-md);
  border-radius: var(--radius-sm);
  font-size: 0.813rem;
}

.result-correct { background: var(--c-correct-bg); }
.result-wrong { background: var(--c-wrong-bg); }
.result-icon { flex-shrink: 0; }
.result-question { line-height: 1.4; }

.results-actions {
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
}

/* --- Guru Pintar AI --- */
.guru-ai-section {
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
  margin-top: var(--space-md);
}

.btn-guru-ai {
  background: linear-gradient(135deg, #6366f1, #8b5cf6);
  color: white;
  border: none;
  border-radius: var(--radius-md);
  box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-sm);
  padding: 14px;
  font-weight: 700;
  font-size: 1rem;
}

.btn-guru-ai:hover:not(:disabled) {
  box-shadow: 0 6px 16px rgba(99, 102, 241, 0.4);
  transform: translateY(-1px);
}

.btn-guru-ai:disabled {
  opacity: 0.8;
  cursor: wait;
}

.guru-ai-icon {
  font-size: 1.25rem;
}

.guru-ai-icon.spinner {
  animation: spin 2s linear infinite;
}

@keyframes spin {
  100% { transform: rotate(360deg); }
}

.guru-ai-badge {
  background: rgba(255, 255, 255, 0.2);
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 0.688rem;
  font-weight: 800;
  letter-spacing: 0.05em;
}

.guru-ai-loading {
  background: var(--c-card);
  border: 1px solid var(--c-border);
  border-radius: var(--radius-lg);
  padding: var(--space-xl);
  text-align: center;
  color: var(--c-text-muted);
  box-shadow: var(--shadow-sm);
}

.loading-dots {
  font-size: 2rem;
  line-height: 1;
  margin-bottom: var(--space-sm);
  color: #8b5cf6;
}

.loading-dots span {
  animation: bounce 1.4s infinite ease-in-out both;
  display: inline-block;
}

.loading-dots span:nth-child(1) { animation-delay: -0.32s; }
.loading-dots span:nth-child(2) { animation-delay: -0.16s; }

@keyframes bounce {
  0%, 80%, 100% { transform: scale(0); }
  40% { transform: scale(1); }
}

.guru-ai-card {
  background: var(--c-card);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  border-top: 4px solid #8b5cf6;
  animation: slideUp 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.guru-ai-header {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: var(--space-md) var(--space-lg);
  background: rgba(139, 92, 246, 0.05);
  border-bottom: 1px solid var(--c-border);
}

.guru-ai-header h4 {
  color: #6366f1;
  font-family: var(--font-heading);
  margin: 0;
}

.guru-ai-content {
  padding: var(--space-lg);
  font-size: 0.938rem;
  line-height: 1.7;
}

.guru-ai-disclaimer {
  display: flex;
  align-items: flex-start;
  gap: var(--space-sm);
  padding: var(--space-md) var(--space-lg);
  background: var(--c-bg-alt);
  border-top: 1px solid var(--c-border);
  font-size: 0.75rem;
  color: var(--c-text-muted);
  line-height: 1.5;
}

.guru-ai-error {
  padding: var(--space-md);
  background: var(--c-wrong-bg);
  color: var(--c-wrong);
  border-radius: var(--radius-md);
  text-align: center;
  font-size: 0.875rem;
}

/* --- Recommendations --- */
.results-recommendations, .guru-pintar-section {
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
}

.recommendation-card {
  background: var(--c-card);
  border-radius: var(--radius-lg);
  padding: var(--space-lg);
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
}

.rec-high {
  border-left: 4px solid var(--c-wrong);
}

.rec-medium {
  border-left: 4px solid var(--c-focus);
}

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

.rec-severity-badge {
  font-size: 0.75rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: var(--radius-full);
}

.rec-severity-badge.high {
  background: var(--c-wrong-bg);
  color: var(--c-wrong);
}

.rec-severity-badge.medium {
  background: var(--c-focus-bg);
  color: var(--c-focus);
}

.rec-count {
  font-size: 0.75rem;
  color: var(--c-text-muted);
}

.rec-text {
  font-size: 0.875rem;
  line-height: 1.7;
}

.rec-source {
  font-size: 0.688rem;
  color: var(--c-text-muted);
}

.no-recommendations {
  text-align: center;
  padding: var(--space-lg);
  color: var(--c-text-muted);
  background: var(--c-card);
  border-radius: var(--radius-lg);
}

/* --- Progress Screen --- */
.progress-screen {
  display: flex;
  flex-direction: column;
  gap: var(--space-lg);
}

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

.progress-header h2 {
  flex: 1;
  text-align: center;
}

/* Readiness Card */
.readiness-card {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: var(--c-card);
  border-radius: var(--radius-lg);
  padding: var(--space-lg);
  box-shadow: var(--shadow-md);
}

.readiness-info h3 {
  font-size: 0.813rem;
  color: var(--c-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.readiness-label {
  font-size: 1.125rem;
  font-weight: 700;
}

.readiness-score {
  font-family: var(--font-heading);
  font-size: 2rem;
  font-weight: 800;
}

/* Stats Grid */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--space-sm);
}

.stat-mini {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: var(--space-md) var(--space-xs);
  background: var(--c-card);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
}

.stat-mini-value {
  font-family: var(--font-heading);
  font-weight: 800;
  font-size: 1.125rem;
  color: var(--c-primary);
}

.stat-mini-label {
  font-size: 0.625rem;
  color: var(--c-text-muted);
  text-align: center;
}

/* Section Mastery */
.section-mastery {
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
}

.mastery-item {
  background: var(--c-card);
  border-radius: var(--radius-md);
  padding: var(--space-md);
  box-shadow: var(--shadow-sm);
}

.mastery-header {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  margin-bottom: var(--space-sm);
}

.mastery-icon { font-size: 1.25rem; }
.mastery-name { flex: 1; font-size: 0.813rem; font-weight: 600; }
.mastery-percent { font-family: var(--font-heading); font-weight: 800; font-size: 0.875rem; color: var(--c-primary); }

.mastery-bar {
  height: 4px;
  background: var(--c-bg-alt);
  border-radius: var(--radius-full);
  overflow: hidden;
  margin-bottom: var(--space-xs);
}

.mastery-bar-fill {
  height: 100%;
  border-radius: var(--radius-full);
  transition: width 0.5s ease;
}

.mastery-detail {
  display: flex;
  justify-content: space-between;
  font-size: 0.688rem;
  color: var(--c-text-muted);
}

/* Due Cards */
.due-cards-section {
  background: var(--c-card);
  border-radius: var(--radius-lg);
  padding: var(--space-lg);
  box-shadow: var(--shadow-sm);
}

.due-count {
  font-size: 0.875rem;
  color: var(--c-text-secondary);
  margin-bottom: var(--space-md);
}

.progress-actions {
  margin-top: var(--space-md);
}

/* --- Complete Screen --- */
.complete-screen {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: calc(100vh - 160px);
  min-height: calc(100dvh - 160px);
  gap: var(--space-xl);
  text-align: center;
}

.complete-celebration {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-md);
}

.celebration-icon {
  font-size: 4rem;
  animation: bounceIn 0.6s ease;
}

.complete-encouragement {
  color: var(--c-text-secondary);
  font-size: 0.875rem;
}

.complete-actions {
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
  width: 100%;
  max-width: 300px;
}

/* --- Responsive --- */
@media (min-width: 481px) {
  #app {
    padding: var(--space-xl);
  }
}

/* Reduce motion for accessibility */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
