/* ============================================================
   PADU v2 — Dark Interactive Design System
   Glassmorphism + Vibrant Gradients + Micro-interactions
   ============================================================ */

:root {
  /* Dark base theme */
  --bg: #0f1226;
  --bg-elevated: #151a3a;
  --surface: rgba(255,255,255,0.05);
  --surface-hover: rgba(255,255,255,0.08);
  --surface-strong: rgba(255,255,255,0.12);
  --border: rgba(255,255,255,0.1);
  --border-strong: rgba(255,255,255,0.18);
  --text: #f1f5f9;
  --text-muted: #94a3b8;
  --text-dim: #64748b;

  /* Vibrant accents */
  --primary: #8b5cf6;       /* violet */
  --primary-glow: #a78bfa;
  --primary-strong: #7c3aed;
  --cyan: #06b6d4;          /* cyan */
  --cyan-glow: #67e8f9;
  --amber: #f59e0b;         /* amber */
  --amber-glow: #fcd34d;
  --coral: #fb7185;         /* coral/rose */
  --coral-glow: #fda4af;
  --green: #22c55e;         /* success */
  --red: #ef4444;           /* error */

  /* Gradients */
  --grad-primary: linear-gradient(135deg, #8b5cf6 0%, #06b6d4 100%);
  --grad-violet: linear-gradient(135deg, #7c3aed 0%, #a78bfa 100%);
  --grad-cyan: linear-gradient(135deg, #0891b2 0%, #67e8f9 100%);
  --grad-amber: linear-gradient(135deg, #d97706 0%, #fcd34d 100%);
  --grad-coral: linear-gradient(135deg, #e11d48 0%, #fb7185 100%);
  --grad-glass: linear-gradient(135deg, rgba(255,255,255,0.08) 0%, rgba(255,255,255,0.02) 100%);

  /* UI metrics */
  --radius: 20px;
  --radius-sm: 12px;
  --radius-lg: 28px;
  --shadow: 0 8px 32px rgba(0,0,0,0.35);
  --shadow-sm: 0 4px 16px rgba(0,0,0,0.25);
  --shadow-glow: 0 0 24px rgba(139,92,246,0.35);
  --transition: 0.2s cubic-bezier(0.2,0.8,0.2,1);
  --transition-bounce: 0.35s cubic-bezier(0.34,1.56,0.64,1);
  --font-scale: 1rem;

  /* Fonts */
  --font-ui: 'Plus Jakarta Sans', sans-serif;
  --font-display: 'Space Grotesk', sans-serif;
}

/* ===== High Contrast (Light) Override ===== */
body.high-contrast {
  --bg: #ffffff;
  --bg-elevated: #f8fafc;
  --surface: #ffffff;
  --surface-hover: #f1f5f9;
  --surface-strong: #e2e8f0;
  --border: #cbd5e1;
  --border-strong: #94a3b8;
  --text: #0f172a;
  --text-muted: #475569;
  --text-dim: #64748b;
  --primary: #4f46e5;
  --primary-glow: #6366f1;
  --cyan: #06b6d4;
  --amber: #d97706;
  --coral: #e11d48;
  --shadow: 0 4px 16px rgba(0,0,0,0.08);
  --shadow-glow: 0 0 0 3px rgba(79,70,229,0.25);
  --grad-primary: linear-gradient(135deg, #4f46e5, #06b6d4);
  --grad-violet: linear-gradient(135deg, #4f46e5, #818cf8);
  --grad-cyan: linear-gradient(135deg, #06b6d4, #67e8f9);
  --grad-amber: linear-gradient(135deg, #d97706, #fbbf24);
  --grad-coral: linear-gradient(135deg, #e11d48, #fb7185);
  --grad-glass: linear-gradient(135deg, #f8fafc, #e2e8f0);
}
body.high-contrast .topbar,
body.high-contrast .bottomnav { background: rgba(255,255,255,0.92); }
body.high-contrast .blob { opacity: 0.10; }
body.high-contrast .dot.active { background: var(--primary); box-shadow: none; }
body.high-contrast .slide-card h2,
body.high-contrast .slide-body,
body.high-contrast .slide-count { color: var(--text); }
body.high-contrast .badge {
  background: var(--surface-strong); color: var(--text);
  border-color: var(--border-strong);
}
body.high-contrast .progress-line { background: var(--surface-strong); }
body.high-contrast .progress-line i { background: var(--primary); }
body.high-contrast .example-box { background: var(--surface); }
body.high-contrast .btn.ghost {
  background: var(--surface); color: var(--text);
  border-color: var(--border-strong);
}
body.high-contrast .rate-row { color: var(--text-muted); }
body.high-contrast .quiz-question,
body.high-contrast .quiz-opt,
body.high-contrast .quiz-option-btn {
  color: var(--text); background: var(--surface); border-color: var(--border-strong);
}
body.high-contrast .nav-circle { box-shadow: none; }

/* ===== Dyslexia Font ===== */
body.dyslexia-font {
  --font-ui: 'Atkinson Hyperlegible', sans-serif !important;
}

/* ===== Focus Mode ===== */
body.focus-mode .no-focus { display: none !important; }
body.focus-mode .view { max-width: 720px; margin: 0 auto; }
body.focus-mode .hero { text-align: center; }

/* ===== Reduced Motion ===== */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  .blob { animation: none !important; }
}

/* ===== Base Reset ===== */
* { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: var(--font-scale); scroll-behavior: smooth; }
body {
  font-family: var(--font-ui);
  font-size: 1rem;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
  position: relative;
}
.skip-link {
  position: absolute; top: -40px; left: 16px;
  background: var(--grad-primary); color: #fff;
  padding: 10px 16px; border-radius: 0 0 10px 10px;
  font-weight: 700; z-index: 9999; text-decoration: none;
}
.skip-link:focus { top: 0; }

/* ===== Animated Background Blobs ===== */
.bg-blobs { position: fixed; inset: 0; z-index: 0; pointer-events: none; overflow: hidden; }
.blob {
  position: absolute; border-radius: 50%; filter: blur(80px);
  opacity: 0.35; animation: blobFloat 20s ease-in-out infinite;
}
.blob.b1 { width: 420px; height: 420px; background: #8b5cf6; top: -100px; right: -80px; animation-delay: 0s; }
.blob.b2 { width: 360px; height: 360px; background: #06b6d4; bottom: -60px; left: -120px; animation-delay: -7s; }
.blob.b3 { width: 280px; height: 280px; background: #f59e0b; top: 40%; left: 40%; animation-delay: -14s; }
@keyframes blobFloat {
  0%,100% { transform: translate(0,0) scale(1); }
  25% { transform: translate(40px,-30px) scale(1.05); }
  50% { transform: translate(-20px,40px) scale(0.98); }
  75% { transform: translate(-30px,-20px) scale(1.03); }
}

/* ===== Topbar ===== */
.topbar {
  position: sticky; top: 0; z-index: 100;
  background: rgba(15,18,38,0.85);
  backdrop-filter: blur(20px) saturate(180%);
  border-bottom: 1px solid var(--border);
  padding: 12px 20px;
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; flex-wrap: wrap;
}
.topbar-inner { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.brand { display: flex; align-items: center; gap: 10px; }
.logo { font-size: 1.8rem; filter: drop-shadow(0 4px 12px rgba(139,92,246,0.5)); }
.brand-text strong { font-family: var(--font-display); font-size: 1.3rem; background: var(--grad-primary); -webkit-background-clip: text; background-clip: text; color: transparent; }
.brand-text small { color: var(--text-muted); font-size: 0.7rem; letter-spacing: 0.5px; text-transform: uppercase; }
.topbar-actions { display: flex; gap: 6px; }
.icon-btn {
  background: var(--surface); border: 1px solid var(--border);
  color: var(--text); font-family: var(--font-ui);
  font-size: 0.75rem; font-weight: 700;
  padding: 8px 10px; border-radius: 10px;
  min-width: 44px; min-height: 44px;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; transition: var(--transition);
}
.icon-btn:hover, .icon-btn:focus-visible {
  background: var(--surface-hover); border-color: var(--primary);
  transform: translateY(-2px);
}
.icon-btn[aria-pressed="true"] { background: var(--grad-primary); border-color: transparent; color: #fff; box-shadow: var(--shadow-glow); }

/* ===== Main / Views ===== */
#main { flex: 1; padding: 24px 20px 120px; position: relative; z-index: 1; }
.view { display: none; animation: viewIn 0.35s var(--transition-bounce); }
.view.active { display: block; }
@keyframes viewIn { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }

/* ===== Glass Card Base ===== */
.card-glass, .card {
  background: var(--grad-glass);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: var(--shadow-sm);
  backdrop-filter: blur(16px) saturate(180%);
  position: relative;
  transition: var(--transition);
}
.card-glass:hover, .card:hover { border-color: var(--border-strong); box-shadow: var(--shadow); }
.card-glass:focus-within, .card:focus-within { outline: 2px solid var(--primary); outline-offset: 2px; }

/* ===== Hero ===== */
.hero { text-align: center; margin-bottom: 28px; padding: 36px 24px; }
.hero h1 { font-family: var(--font-display); font-size: clamp(1.8rem, 5vw, 2.6rem); line-height: 1.2; margin-bottom: 12px; font-weight: 700; }
.grad-text { background: var(--grad-primary); -webkit-background-clip: text; background-clip: text; color: transparent; }
.hero p { font-size: 1.05rem; color: var(--text-muted); max-width: 560px; margin: 0 auto; }

/* ===== Mood Card ===== */
.mood-card { margin-bottom: 28px; }
.mood-card h2 { font-size: 1.1rem; font-weight: 700; margin-bottom: 16px; color: var(--text); text-align: center; }
.mood-row { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.mood-emoji {
  background: var(--surface); border: 2px solid var(--border);
  border-radius: var(--radius-sm); padding: 16px 6px;
  font-size: 1.9rem; font-weight: 600; color: var(--text);
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  cursor: pointer; transition: var(--transition-bounce);
  min-height: 44px; min-width: 0;
}
.mood-emoji span { font-size: 0.8rem; line-height: 1.2; text-align: center; }
@media (max-width: 480px) { .mood-row { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.mood-emoji:hover { transform: translateY(-4px) scale(1.03); border-color: var(--primary); box-shadow: var(--shadow-glow); }
.mood-emoji:active { transform: scale(0.97); }
.mood-emoji.selected { border-color: var(--primary); background: rgba(139,92,246,0.15); box-shadow: var(--shadow-glow); }
.mood-saved { margin-top: 12px; font-size: 0.85rem; color: var(--green); text-align: center; animation: fadeIn 0.3s; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* ===== Section Title ===== */
.section-title { font-family: var(--font-display); font-size: 1.2rem; font-weight: 700; margin: 28px 0 16px; color: var(--text); display: flex; align-items: center; gap: 10px; }
.section-title::before { content: ""; width: 40px; height: 3px; background: var(--grad-primary); border-radius: 2px; flex-shrink: 0; }

/* ===== Subject Grid ===== */
.subject-grid { display: grid; gap: 16px; grid-template-columns: 1fr; margin-bottom: 28px; }
@media (min-width: 560px) { .subject-grid { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 900px) { .subject-grid { grid-template-columns: repeat(3, 1fr); } }

.subject-card {
  background: var(--grad-glass); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 24px;
  display: flex; flex-direction: column; align-items: center; text-align: center;
  cursor: pointer; position: relative; overflow: hidden;
  transition: var(--transition-bounce);
  min-height: 200px;
}
.subject-card::before { content: ""; position: absolute; inset: 0; background: var(--card-gradient); opacity: 0; transition: opacity 0.3s; }
.sc-math::before { --card-gradient: var(--grad-violet); }
.sc-ipa::before { --card-gradient: var(--grad-cyan); }
.sc-literasi::before { --card-gradient: var(--grad-amber); }
.subject-card:hover { transform: translateY(-8px) scale(1.02); box-shadow: var(--shadow); border-color: var(--border-strong); }
.subject-card:hover::before { opacity: 0.12; }
.subject-card:active { transform: scale(0.98); }
.sc-emoji { font-size: 3rem; margin-bottom: 10px; filter: drop-shadow(0 8px 20px rgba(0,0,0,0.3)); z-index: 1; }
.subject-card h3 { font-family: var(--font-display); font-size: 1.25rem; font-weight: 700; color: var(--text); z-index: 1; margin-bottom: 4px; }
.subject-card p { font-size: 0.85rem; color: var(--text-muted); z-index: 1; margin-bottom: 16px; }
.sc-progress { width: 100%; margin-top: auto; z-index: 1; }
.sc-bar { height: 6px; background: rgba(255,255,255,0.1); border-radius: 3px; overflow: hidden; }
.sc-bar i { display: block; height: 100%; width: var(--p, 0%); background: var(--grad-primary); border-radius: 3px; transition: width 0.6s var(--transition-bounce); }
.sc-progress small { display: block; text-align: right; margin-top: 6px; font-size: 0.7rem; color: var(--text-dim); }
.sc-cta { display: inline-block; margin-top: 14px; padding: 8px 18px; background: var(--grad-primary); color: #fff; font-weight: 700; font-size: 0.8rem; border-radius: 100px; box-shadow: 0 4px 16px rgba(139,92,246,0.4); transition: var(--transition); }
.subject-card:hover .sc-cta { transform: translateX(4px); box-shadow: 0 6px 24px rgba(139,92,246,0.55); }

/* ===== How-to Scroll ===== */
.howto-scroll { display: flex; gap: 14px; overflow-x: auto; padding-bottom: 8px; scroll-snap-type: x mandatory; -webkit-overflow-scrolling: touch; }
.howto-card { flex: 0 0 240px; scroll-snap-align: start; background: var(--grad-glass); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; display: flex; flex-direction: column; align-items: center; text-align: center; gap: 8px; transition: var(--transition); }
.howto-card:hover { border-color: var(--border-strong); transform: translateY(-4px); }
.howto-card span { font-size: 2.2rem; }
.howto-card strong { font-size: 0.9rem; color: var(--text); }
.howto-card small { font-size: 0.75rem; color: var(--text-dim); line-height: 1.4; }

/* ===== Course View ===== */
.chip-row { display: flex; gap: 8px; margin-bottom: 20px; overflow-x: auto; padding-bottom: 4px; }
.chip {
  background: var(--surface); border: 1px solid var(--border);
  color: var(--text-muted); font-weight: 600; font-size: 0.85rem;
  padding: 10px 16px; border-radius: 100px; white-space: nowrap;
  cursor: pointer; transition: var(--transition);
  min-height: 44px; display: inline-flex; align-items: center; gap: 6px;
}
.chip:hover { border-color: var(--primary); color: var(--text); }
.chip.active { background: var(--grad-primary); border-color: transparent; color: #fff; box-shadow: var(--shadow-glow); }

.slide-wrap { position: relative; }
.slide-grad {
  background: var(--slide-grad, var(--grad-violet));
  border-radius: var(--radius-lg); padding: 2px;
  box-shadow: var(--shadow);
}
.sc-math ~ .slide-wrap .slide-grad { --slide-grad: var(--grad-violet); }
.sc-ipa ~ .slide-wrap .slide-grad { --slide-grad: var(--grad-cyan); }
.sc-literasi ~ .slide-wrap .slide-grad { --slide-grad: var(--grad-amber); }

.slide-card { background: var(--bg-elevated); border-radius: calc(var(--radius-lg) - 2px); padding: 28px; position: relative; }

.slide-top { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; }
.badge {
  background: rgba(255,255,255,0.12); border: 1px solid rgba(255,255,255,0.2);
  color: #fff; font-family: var(--font-display); font-size: 0.65rem; font-weight: 700;
  letter-spacing: 0.5px; padding: 6px 12px; border-radius: 100px;
}
.slide-count { font-size: 0.8rem; color: rgba(255,255,255,0.7); font-weight: 600; }

.progress-line { height: 4px; background: rgba(255,255,255,0.12); border-radius: 2px; overflow: hidden; margin-bottom: 20px; }
.progress-line i { display: block; height: 100%; width: var(--p, 0%); background: linear-gradient(90deg, #fff, #fcd34d); border-radius: 2px; transition: width 0.4s var(--transition-bounce); }

.slide-card h2 { font-family: var(--font-display); font-size: 1.5rem; font-weight: 700; color: #fff; margin-bottom: 20px; line-height: 1.3; }
.slide-body { color: rgba(255,255,255,0.92); font-size: 1.05rem; line-height: 1.75; }
.slide-body p { margin-bottom: 14px; }
.slide-body ul { margin: 14px 0 14px 20px; }
.slide-body li { margin-bottom: 8px; }
.example-box { background: rgba(255,255,255,0.06); border-left: 4px solid var(--amber); padding: 14px 18px; border-radius: 10px; margin: 18px 0; }
.example-box strong { color: var(--amber-glow); }

.slide-tools { display: flex; gap: 10px; flex-wrap: wrap; margin: 24px 0 16px; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font-family: var(--font-ui); font-weight: 700; font-size: 0.9rem;
  padding: 12px 20px; border-radius: 12px; border: none;
  cursor: pointer; min-height: 48px; min-width: 48px;
  transition: var(--transition-bounce);
}
.btn:disabled { opacity: 0.45; cursor: not-allowed; transform: none !important; }
.btn.grad { background: var(--grad-primary); color: #fff; box-shadow: 0 4px 16px rgba(139,92,246,0.4); }
.btn.grad:hover:not(:disabled) { transform: translateY(-2px); box-shadow: 0 8px 24px rgba(139,92,246,0.55); }
.btn.ghost { background: rgba(255,255,255,0.08); color: rgba(255,255,255,0.9); border: 1px solid rgba(255,255,255,0.15); }
.btn.ghost:hover:not(:disabled) { background: rgba(255,255,255,0.14); border-color: rgba(255,255,255,0.25); }
.btn.amber { background: var(--grad-amber); color: #0f1226; box-shadow: 0 4px 16px rgba(245,158,11,0.4); }
.btn.amber:hover:not(:disabled) { transform: translateY(-2px); box-shadow: 0 8px 24px rgba(245,158,11,0.55); }
.btn.danger { background: var(--grad-coral); color: #fff; box-shadow: 0 4px 16px rgba(225,29,72,0.4); width: 100%; margin-top: 16px; }
.btn.danger:hover { transform: translateY(-2px); box-shadow: 0 8px 24px rgba(225,29,72,0.55); }

.rate-row { display: flex; align-items: center; gap: 12px; margin-top: 8px; color: rgba(255,255,255,0.7); font-size: 0.85rem; }
.rate-row label { white-space: nowrap; }
.rate-row input[type="range"] { flex: 1; max-width: 180px; accent-color: var(--amber); }
.rate-row span { min-width: 44px; text-align: right; font-variant-numeric: tabular-nums; font-weight: 600; }

/* ===== Quiz ===== */
.quiz { margin-top: 20px; padding-top: 20px; border-top: 1px solid rgba(255,255,255,0.1); }
.quiz h3 { font-size: 1rem; font-weight: 700; color: var(--amber-glow); margin-bottom: 12px; }
.quiz-question { font-size: 1rem; color: rgba(255,255,255,0.9); margin-bottom: 14px; font-weight: 500; }
.quiz-options { display: flex; flex-direction: column; gap: 10px; }
.quiz-opt {
  background: rgba(255,255,255,0.06); border: 1px solid rgba(255,255,255,0.12);
  color: rgba(255,255,255,0.95); font-weight: 600; font-size: 0.95rem;
  padding: 14px 16px; border-radius: 12px; text-align: left;
  cursor: pointer; transition: var(--transition-bounce); min-height: 52px;
  display: flex; align-items: center; gap: 10px;
}
.quiz-opt:hover { background: rgba(255,255,255,0.12); border-color: var(--amber); transform: translateX(4px); }
.quiz-opt.correct { background: var(--green) !important; border-color: var(--green) !important; color: #fff; animation: popIn 0.3s var(--transition-bounce); }
.quiz-opt.incorrect { background: var(--red) !important; border-color: var(--red) !important; color: #fff; animation: shake 0.4s; }
.quiz-opt.disabled { pointer-events: none; opacity: 0.5; }
.quiz-opt-letter { font-family: var(--font-display); font-size: 1.1rem; background: rgba(0,0,0,0.2); width: 32px; height: 32px; border-radius: 8px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
@keyframes popIn { 0% { transform: scale(0.8); opacity: 0; } 100% { transform: scale(1); opacity: 1; } }
@keyframes shake { 0%,100% { transform: translateX(0); } 25% { transform: translateX(-8px); } 75% { transform: translateX(8px); } }
.quiz-feedback { margin-top: 12px; font-weight: 700; padding: 10px 14px; border-radius: 10px; font-size: 0.9rem; animation: fadeIn 0.3s; }
.quiz-feedback.correct { background: rgba(34,197,94,0.2); color: var(--green); }
.quiz-feedback.incorrect { background: rgba(239,68,68,0.2); color: var(--red); }
.retry-btn { margin-top: 12px; padding: 10px 18px; background: transparent; border: 1px solid var(--border); color: var(--text-muted); border-radius: 10px; font-weight: 600; cursor: pointer; transition: var(--transition); }
.retry-btn:hover { border-color: var(--primary); color: var(--text); }

/* ===== Slide Nav ===== */
.slide-nav { display: flex; align-items: center; justify-content: center; gap: 20px; margin-top: 24px; }
.nav-circle {
  width: 56px; height: 56px; border-radius: 50%;
  background: var(--grad-primary); color: #fff; border: none;
  font-size: 1.4rem; font-weight: 700; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 6px 20px rgba(139,92,246,0.45);
  transition: var(--transition-bounce);
}
.nav-circle:hover:not(:disabled) { transform: scale(1.1) translateY(-2px); box-shadow: 0 10px 30px rgba(139,92,246,0.6); }
.nav-circle:active:not(:disabled) { transform: scale(0.95); }
.nav-circle:disabled { opacity: 0.35; cursor: not-allowed; box-shadow: none; background: rgba(255,255,255,0.1); }
.dots { display: flex; gap: 8px; }
.dot {
  width: 10px; height: 10px; border-radius: 50%;
  background: rgba(255,255,255,0.2); border: none; cursor: pointer;
  transition: var(--transition-bounce);
}
.dot.active { background: #fff; transform: scale(1.4); box-shadow: 0 0 12px #fff; }
.dot:hover:not(.active) { background: rgba(255,255,255,0.4); transform: scale(1.2); }

.hint { text-align: center; margin-top: 16px; font-size: 0.8rem; color: var(--text-dim); line-height: 1.5; }
.hint b { color: var(--text-muted); }

/* ===== Stats / Progress ===== */
.stats-grid { display: grid; gap: 16px; grid-template-columns: 1fr; margin-bottom: 24px; }
@media (min-width: 560px) { .stats-grid { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 900px) { .stats-grid { grid-template-columns: repeat(3, 1fr); } }

.stat-card { background: var(--grad-glass); border: 1px solid var(--border); border-radius: var(--radius); padding: 24px; display: flex; flex-direction: column; align-items: center; text-align: center; gap: 10px; position: relative; overflow: hidden; }
.stat-ring { width: 88px; height: 88px; border-radius: 50%; background: conic-gradient(var(--stat-color, var(--primary)) calc(var(--p,0)*1%), rgba(255,255,255,0.08) 0); display: flex; align-items: center; justify-content: center; box-shadow: inset 0 0 0 8px var(--bg-elevated), 0 8px 24px rgba(0,0,0,0.3); position: relative; }
.stat-ring::before { content: ""; position: absolute; inset: 6px; border-radius: 50%; background: var(--bg); }
.stat-ring span { position: relative; font-family: var(--font-display); font-size: 1.5rem; font-weight: 700; color: var(--text); }
.stat-card h4 { font-size: 0.85rem; color: var(--text-muted); font-weight: 600; text-transform: uppercase; letter-spacing: 0.5px; }
.stat-card p { font-size: 0.8rem; color: var(--text-dim); }

/* ===== Bookmark List ===== */
.bm-list { list-style: none; display: flex; flex-direction: column; gap: 8px; max-height: 280px; overflow-y: auto; padding-right: 4px; }
.bm-item { display: flex; align-items: center; justify-content: space-between; gap: 12px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 12px 16px; transition: var(--transition); }
.bm-item:hover { border-color: var(--border-strong); }
.bm-info { flex: 1; min-width: 0; }
.bm-title { font-weight: 600; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bm-meta { font-size: 0.75rem; color: var(--text-dim); display: flex; gap: 10px; margin-top: 2px; }
.bm-actions { display: flex; gap: 6px; flex-shrink: 0; }
.bm-btn { background: var(--surface-hover); border: 1px solid var(--border); color: var(--text-muted); padding: 6px 10px; border-radius: 8px; font-size: 0.7rem; font-weight: 600; cursor: pointer; min-height: 36px; transition: var(--transition); }
.bm-btn:hover { background: var(--grad-primary); border-color: transparent; color: #fff; }
.bm-empty { text-align: center; color: var(--text-dim); padding: 32px; font-style: italic; }

/* ===== Quick Chips ===== */
.quick-chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 16px 0; }
.quick-chips .chip { font-size: 0.8rem; padding: 8px 14px; }

/* ===== Help Row ===== */
.help-row { display: flex; gap: 10px; margin-top: 8px; }
.help-row input { flex: 1; background: var(--surface); border: 1px solid var(--border); color: var(--text); padding: 12px 16px; border-radius: 12px; font-family: var(--font-ui); font-size: 0.95rem; min-height: 48px; transition: var(--transition); }
.help-row input:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(139,92,246,0.2); }
.help-row input::placeholder { color: var(--text-dim); }

/* ===== Help List ===== */
.help-list { list-style: none; margin-top: 16px; display: flex; flex-direction: column; gap: 8px; max-height: 220px; overflow-y: auto; padding-right: 4px; }
.help-item { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 12px 16px; display: flex; flex-direction: column; gap: 4px; animation: slideUp 0.3s var(--transition-bounce); }
@keyframes slideUp { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
.help-item-header { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.help-item-text { font-weight: 500; color: var(--text); flex: 1; }
.help-item-time { font-size: 0.7rem; color: var(--text-dim); white-space: nowrap; }
.help-item-status { font-size: 0.65rem; font-weight: 700; padding: 3px 8px; border-radius: 100px; background: var(--grad-amber); color: #0f1226; white-space: nowrap; }
.help-empty { text-align: center; color: var(--text-dim); padding: 24px; font-style: italic; }

/* ===== Affirmation Card ===== */
.affirm-card { background: linear-gradient(135deg, rgba(139,92,246,0.12), rgba(6,182,212,0.12)); border-color: rgba(139,92,246,0.3); }
.affirm-card h3 { margin-bottom: 12px; }
#affirmText { font-style: italic; font-size: 1rem; color: var(--text); line-height: 1.6; min-height: 48px; display: flex; align-items: center; justify-content: center; text-align: center; }

/* ===== Bottom Nav ===== */
.bottomnav {
  position: fixed; bottom: 0; left: 50%; transform: translateX(-50%);
  width: 100%; max-width: 480px;
  background: rgba(15,18,38,0.95); backdrop-filter: blur(24px) saturate(180%);
  border-top: 1px solid var(--border);
  display: flex; justify-content: space-around; padding: 8px 4px 12px;
  z-index: 200; border-radius: 24px 24px 0 0;
  box-shadow: 0 -8px 32px rgba(0,0,0,0.3);
}
@media (min-width: 900px) {
  .bottomnav {
    bottom: 20px; left: 50%; transform: translateX(-50%);
    width: auto; max-width: none; padding: 10px 18px;
    border-radius: 100px; border: 1px solid var(--border);
    box-shadow: var(--shadow); background: rgba(15,18,38,0.9);
  }
}
.nav-item {
  background: transparent; border: none; color: var(--text-muted);
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  font-size: 0.65rem; font-weight: 600; padding: 6px 12px;
  border-radius: 12px; cursor: pointer; transition: var(--transition-bounce);
  min-height: 44px; min-width: 44px;
}
.nav-item span { font-size: 1.3rem; line-height: 1; }
.nav-item:hover { color: var(--text); background: var(--surface); }
.nav-item.active { color: var(--primary); background: rgba(139,92,246,0.15); }
.nav-item.active span { animation: bounceIn 0.4s var(--transition-bounce); }
@keyframes bounceIn { 0% { transform: scale(0.5); } 60% { transform: scale(1.2); } 100% { transform: scale(1); } }

/* ===== Mic FAB ===== */
.mic-fab {
  position: fixed; bottom: 100px; right: 20px; z-index: 150;
  width: 64px; height: 64px; border-radius: 50%;
  background: var(--grad-primary); border: none; color: #fff;
  font-size: 1.6rem; display: flex; align-items: center; justify-content: center;
  box-shadow: 0 8px 28px rgba(139,92,246,0.5), 0 0 0 4px rgba(139,92,246,0.15);
  cursor: pointer; transition: var(--transition-bounce);
  animation: micPulse 2.5s ease-in-out infinite;
}
@keyframes micPulse { 0%,100% { box-shadow: 0 8px 28px rgba(139,92,246,0.5), 0 0 0 4px rgba(139,92,246,0.15); } 50% { box-shadow: 0 8px 28px rgba(139,92,246,0.5), 0 0 0 10px rgba(139,92,246,0.08); } }
.mic-fab:hover { transform: scale(1.08); }
.mic-fab:active { transform: scale(0.95); }
.mic-fab.listening { background: var(--grad-coral); animation: none; box-shadow: 0 8px 28px rgba(225,29,72,0.5), 0 0 0 10px rgba(225,29,72,0.15); }
.mic-fab.listening span { animation: micSpin 1s linear infinite; }
@keyframes micSpin { to { transform: rotate(360deg); } }
@media (min-width: 900px) { .mic-fab { bottom: 120px; right: 30px; } }

/* ===== STT Bubble ===== */
.stt-bubble {
  position: fixed; bottom: 176px; right: 20px; z-index: 150;
  max-width: 280px; background: var(--bg-elevated); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 12px 16px; color: var(--text);
  font-size: 0.85rem; box-shadow: var(--shadow);
  animation: slideUp 0.25s var(--transition-bounce);
  pointer-events: none;
}
@media (min-width: 900px) { .stt-bubble { bottom: 200px; right: 30px; } }

/* ===== Confetti ===== */
.confetti { position: fixed; top: 0; left: 0; width: 10px; height: 10px; border-radius: 2px; pointer-events: none; z-index: 999; animation: confettiFall 1.2s cubic-bezier(0.2,0.8,0.2,1) forwards; }
@keyframes confettiFall {
  0% { transform: translate(var(--tx,0), 0) rotate(0deg); opacity: 1; }
  100% { transform: translate(var(--tx,0), var(--ty,300px)) rotate(var(--tr,720deg)); opacity: 0; }
}

/* ===== Scrollbar ===== */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--border-strong); }

/* ===== Utilities ===== */
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.text-muted, .muted { color: var(--text-muted); }
.small { font-size: 0.8rem; }
.btn.small { min-height: 40px; padding: 6px 12px; font-size: 0.75rem; }

/* ===== Quiz (dirender JS) ===== */
.quiz-question {
  font-size: 1rem; color: rgba(255,255,255,0.92);
  font-weight: 500; margin-bottom: 14px;
}
.quiz-options { display: flex; flex-direction: column; gap: 10px; }
.quiz-option-btn {
  background: rgba(255,255,255,0.06); border: 1px solid rgba(255,255,255,0.12);
  color: rgba(255,255,255,0.95); font-weight: 600; font-size: 0.95rem;
  font-family: var(--font-ui);
  padding: 14px 16px; border-radius: 12px; text-align: left;
  cursor: pointer; transition: var(--transition-bounce); min-height: 52px;
  display: flex; align-items: center; gap: 10px;
}
.quiz-option-btn:hover:not(:disabled) {
  background: rgba(255,255,255,0.12); border-color: var(--amber);
  transform: translateX(4px);
}
.quiz-option-btn:disabled { cursor: default; opacity: 0.55; }
.quiz-option-btn.correct {
  background: var(--green) !important; border-color: var(--green) !important;
  color: #fff; opacity: 1; animation: popIn 0.3s var(--transition-bounce);
}
.quiz-option-btn.incorrect {
  background: var(--red) !important; border-color: var(--red) !important;
  color: #fff; opacity: 1; animation: shake 0.4s;
}
.feedback-box {
  margin-top: 12px; font-weight: 700; padding: 12px 14px;
  border-radius: 10px; font-size: 0.9rem; animation: fadeIn 0.3s;
}
.feedback-box.correct { background: rgba(34,197,94,0.18); color: var(--green); }
.feedback-box.incorrect { background: rgba(239,68,68,0.18); color: var(--red); }

/* ===== Dots: area sentuh lebih besar ===== */
.dot { position: relative; }
.dot::after { content: ""; position: absolute; inset: -9px; }
.dot.read { box-shadow: 0 0 0 2px rgba(34,197,94,0.55); }

/* ===== Bookmark Item ===== */
.bookmark-item {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 12px 16px;
  transition: var(--transition);
}
.bookmark-item:hover { border-color: var(--border-strong); }

/* ===== Mood Modal ===== */
.modal-overlay {
  position: fixed; inset: 0; z-index: 500;
  background: rgba(5,8,24,0.7); backdrop-filter: blur(12px);
  display: none; align-items: center; justify-content: center; padding: 20px;
}
.modal-overlay.open { display: flex; animation: fadeIn 0.3s; }
.modal-card {
  background: var(--bg-elevated); border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg); padding: 32px 24px;
  max-width: 440px; width: 100%; text-align: center;
  box-shadow: var(--shadow);
  animation: modalIn 0.4s var(--transition-bounce);
}
@keyframes modalIn { from { opacity: 0; transform: translateY(24px) scale(0.95); } to { opacity: 1; transform: none; } }
.modal-emoji { font-size: 3rem; display: block; margin-bottom: 12px; }
.modal-card h2 {
  font-family: var(--font-display); font-size: 1.25rem;
  line-height: 1.35; margin-bottom: 20px;
}
.modal-mood { grid-template-columns: repeat(2, 1fr); }
.modal-skip {
  margin-top: 16px; background: transparent; border: none;
  color: var(--text-muted); font-family: var(--font-ui);
  font-weight: 600; font-size: 0.85rem; cursor: pointer;
  padding: 12px; min-height: 44px;
}
.modal-skip:hover { color: var(--text); }

/* ===== Toast ===== */
.toast {
  position: fixed; left: 50%; bottom: 96px; transform: translateX(-50%);
  z-index: 400; background: var(--bg-elevated); color: var(--text);
  border: 1px solid var(--border-strong); border-radius: 100px;
  padding: 12px 20px; font-size: 0.85rem; font-weight: 600;
  box-shadow: var(--shadow); max-width: calc(100vw - 40px); text-align: center;
  animation: toastIn 0.3s var(--transition-bounce);
}
@keyframes toastIn { from { opacity: 0; transform: translate(-50%, 12px); } to { opacity: 1; transform: translate(-50%, 0); } }

/* ===== Focus Mode ekstra ===== */
body.focus-mode .bg-blobs { display: none; }
body.focus-mode .topbar { background: var(--bg); }

/* ===== Mode Kelas (Live Caption) ===== */
.live-controls { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 12px; }
.live-toggle { flex: 1; min-width: 200px; font-size: 1rem; }
.live-status { font-size: 0.85rem; color: var(--text-muted); margin: 0 0 12px; }
.live-card h3 { margin: 18px 0 10px; font-family: var(--font-display); }
.live-caption-box {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--border-strong, rgba(255, 255, 255, 0.2));
  border-radius: var(--radius);
  min-height: 110px;
  max-height: 38vh;
  overflow-y: auto;
  padding: 18px;
  font-size: 1.45rem;
  line-height: 1.55;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 6px;
  transition: border-color 0.3s, box-shadow 0.3s;
}
.live-caption-box.listening {
  border-color: #fb7185;
  box-shadow: 0 0 26px rgba(251, 113, 133, 0.22);
}
.live-caption-box .interim { color: var(--amber, #fbbf24); }
.live-caption-box .live-placeholder { color: var(--text-muted); font-weight: 400; font-size: 1rem; }
body.high-contrast .live-caption-box { background: var(--surface); color: var(--text); }
body.high-contrast .live-caption-box .interim { color: var(--primary); }
body.high-contrast .live-caption-box.listening { border-color: var(--primary); }
.transcript-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 320px;
  overflow-y: auto;
}
.transcript-list li {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm, 10px);
  padding: 10px 14px;
  font-size: 0.95rem;
  line-height: 1.5;
}
.transcript-list time {
  display: block;
  font-size: 0.72rem;
  color: var(--text-muted);
  margin-bottom: 2px;
}

/* ===== Simpan Sesi Kuliah ===== */
.live-save-row { display: flex; gap: 10px; margin-top: 14px; }
.live-save-row input {
  flex: 1; min-width: 0;
  background: var(--surface); border: 1px solid var(--border); color: var(--text);
  padding: 12px 16px; border-radius: 12px; font-family: var(--font-ui);
  font-size: 0.95rem; min-height: 48px; transition: var(--transition);
}
.live-save-row input:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(139,92,246,0.2); }
.live-save-row input::placeholder { color: var(--text-dim); }
.sessions-card h3 { margin-bottom: 4px; }
.session-list { list-style: none; margin: 12px 0 0; padding: 0; display: flex; flex-direction: column; gap: 10px; max-height: 420px; overflow-y: auto; }
.session-item {
  display: flex; align-items: center; gap: 10px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 12px 14px;
}
.session-info { flex: 1; min-width: 0; }
.session-info strong { display: block; font-size: 0.95rem; overflow-wrap: anywhere; }
.session-info small { color: var(--text-muted); font-size: 0.75rem; }
.session-actions { display: flex; gap: 6px; flex-shrink: 0; }
.session-act {
  width: 40px; height: 40px; border-radius: 10px; border: 1px solid var(--border);
  background: var(--surface); color: var(--text); font-size: 1rem; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
  transition: var(--transition);
}
.session-act:hover { border-color: var(--primary); background: var(--surface-hover); }
.session-act.danger:hover { border-color: #f87171; }
.session-modal-body {
  max-height: 46vh; overflow-y: auto; text-align: left;
  font-size: 0.95rem; line-height: 1.65; white-space: pre-wrap; overflow-wrap: anywhere;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 14px;
}
.modal-actions { display: flex; gap: 10px; justify-content: center; margin-top: 16px; flex-wrap: wrap; }
.modal-card-wide { width: min(92vw, 520px); }
@media (max-width: 480px) { .live-save-row { flex-wrap: wrap; } .live-save-row input { flex: 1 1 100%; } .live-save-row .btn { flex: 1; } }
