/* ==========================================================
   Biblia Comentada - Mobile App Prototype
   ========================================================== */

/* -- CSS Variables ----------------------------------------- */
:root {
  --color-primary: #8B6914;
  --color-primary-light: #C4992E;
  --color-primary-bg: #FFF8E7;
  --color-secondary: #1B2A4A;
  --color-secondary-light: #2D4373;
  --color-accent: #C0653A;
  --color-bg: #FDF8F0;
  --color-card: #FFFFFF;
  --color-text: #2C2C2C;
  --color-text-light: #6B7280;
  --color-text-lighter: #9CA3AF;
  --color-border: #E5E7EB;
  --color-success: #059669;
  --color-streak: #F59E0B;
  --font-sans: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-serif: Georgia, 'Times New Roman', serif;
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 24px;
  --radius-full: 9999px;
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.08);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.1);
  --shadow-lg: 0 8px 24px rgba(0,0,0,0.12);
  --shadow-phone: 0 0 40px rgba(0,0,0,0.2);
}

/* -- Base Reset -------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }
img { max-width: 100%; display: block; }
button { font-family: inherit; }
a { text-decoration: none; color: inherit; }

body {
  background: linear-gradient(135deg, #1a1a2e 0%, #16213e 50%, #0f3460 100%);
  font-family: var(--font-sans);
  color: var(--color-text);
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* -- App Frame -------------------------------------------- */
.app-frame {
  max-width: 414px;
  width: 100%;
  min-height: 100vh;
  position: relative;
  overflow: hidden;
  background: var(--color-bg);
  border-radius: 40px;
  box-shadow: var(--shadow-phone);
}

/* -- Splash Screen ---------------------------------------- */
#splash-screen {
  position: absolute;
  inset: 0;
  z-index: 1000;
  background: linear-gradient(135deg, var(--color-secondary), var(--color-secondary-light));
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  transition: opacity 0.5s ease, visibility 0.5s ease;
}
#splash-screen.fade-out { opacity: 0; visibility: hidden; }
.splash-icon {
  width: 80px; height: 80px;
  background: var(--color-primary-light);
  border-radius: 20px;
  display: flex; align-items: center; justify-content: center;
}
.splash-icon svg { width: 40px; height: 40px; color: white; }
.splash-title {
  color: var(--color-primary-light);
  font-size: 28px; margin-top: 20px; font-weight: 700;
}
.splash-subtitle { color: rgba(255,255,255,0.6); font-size: 14px; margin-top: 6px; }

/* -- App Header ------------------------------------------- */
.app-header {
  position: sticky; top: 0; z-index: 100;
  background: var(--color-card);
  padding: 12px 20px;
  display: flex; justify-content: space-between; align-items: center;
  border-bottom: 1px solid var(--color-border);
}
.header-title { font-size: 20px; font-weight: 700; color: var(--color-secondary); }
.header-avatar {
  width: 36px; height: 36px; border-radius: 50%;
  background: var(--color-primary); color: white;
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 600; cursor: pointer;
  border: none; transition: transform 0.15s ease;
}
.header-avatar:active { transform: scale(0.93); }
.header-back {
  display: flex; align-items: center; gap: 8px;
  color: var(--color-text); cursor: pointer;
  background: none; border: none;
  font-size: 14px; font-weight: 500; padding: 4px 0;
}
.header-back svg { width: 20px; height: 20px; }

/* -- Screen Container ------------------------------------- */
.screen-container {
  overflow-y: auto;
  padding-bottom: 80px;
  height: calc(100vh - 60px - 64px);
  -webkit-overflow-scrolling: touch;
}

/* -- Screens ---------------------------------------------- */
.screen { display: none; padding: 20px; }
.screen.active { display: block; }

/* -- Tab Bar ---------------------------------------------- */
.tab-bar {
  position: fixed; bottom: 0;
  width: 100%; max-width: 414px;
  display: flex; justify-content: space-around; align-items: center;
  background: var(--color-card);
  border-top: 1px solid var(--color-border);
  padding: 8px 0 env(safe-area-inset-bottom, 8px);
  z-index: 100;
}
.tab-item {
  display: flex; flex-direction: column; align-items: center;
  gap: 4px; cursor: pointer; padding: 4px 12px;
  background: none; border: none; color: var(--color-text-lighter);
  transition: color 0.2s ease;
}
.tab-item-label { font-size: 11px; color: var(--color-text-lighter); transition: color 0.2s ease; }
.tab-item.active { color: var(--color-primary); }
.tab-item.active .tab-item-label { color: var(--color-primary); font-weight: 600; }
.tab-item svg { color: inherit; width: 22px; height: 22px; }

/* -- Cards ------------------------------------------------ */
.card {
  background: var(--color-card);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  padding: 16px; margin-bottom: 16px;
  transition: transform 150ms ease, box-shadow 150ms ease;
}
.card:active { transform: scale(0.98); box-shadow: var(--shadow-md); }

/* -- Daily Verse Card ------------------------------------- */
.daily-verse-card {
  background: linear-gradient(135deg, var(--color-primary-bg), #FFF5DC);
  border-left: 4px solid var(--color-primary);
}
.daily-verse-label {
  font-size: 12px; text-transform: uppercase; letter-spacing: 1px;
  color: var(--color-primary); font-weight: 600; margin-bottom: 12px;
}
.daily-verse-text {
  font-family: var(--font-serif); font-size: 18px; line-height: 1.6;
  color: var(--color-secondary); margin-bottom: 8px; font-style: italic;
}
.daily-verse-ref { font-size: 14px; color: var(--color-primary); font-weight: 600; }
.daily-verse-btn { margin-top: 16px; }

/* -- Buttons ---------------------------------------------- */
.btn {
  padding: 10px 24px; border-radius: var(--radius-full);
  border: none; cursor: pointer; font-weight: 600; font-size: 14px;
  transition: background-color 0.2s ease, transform 0.15s ease;
  font-family: inherit;
}
.btn:active { transform: scale(0.97); }
.btn-primary { background: var(--color-primary); color: white; }
.btn-primary:hover { background: var(--color-primary-light); }
.btn-secondary {
  background: transparent;
  border: 2px solid var(--color-primary); color: var(--color-primary);
}
.btn-secondary:hover { background: var(--color-primary-bg); }
.btn-accent { background: var(--color-accent); color: white; }
.btn-accent:hover { opacity: 0.9; }
.btn-block { width: 100%; display: block; text-align: center; }
.btn-sm { padding: 6px 16px; font-size: 12px; }
.btn-icon { display: inline-flex; align-items: center; gap: 6px; }

/* -- Streak Banner ---------------------------------------- */
.streak-banner {
  background: linear-gradient(135deg, #FEF3C7, #FDE68A);
  border-radius: var(--radius-lg); padding: 16px;
  display: flex; align-items: center; gap: 16px;
}
.streak-number { font-size: 36px; font-weight: 800; color: var(--color-streak); }
.streak-label { font-size: 13px; color: #92400E; }
.streak-flame { font-size: 32px; line-height: 1; }

/* -- Quick Actions ---------------------------------------- */
.quick-actions {
  display: grid; grid-template-columns: repeat(4, 1fr);
  gap: 12px; margin: 20px 0;
}
.quick-action-item {
  display: flex; flex-direction: column; align-items: center;
  gap: 8px; cursor: pointer; background: none; border: none; padding: 0;
  transition: transform 0.15s ease;
}
.quick-action-item:active { transform: scale(0.93); }
.quick-action-icon {
  width: 52px; height: 52px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
}
.quick-action-icon svg { width: 22px; height: 22px; }
.quick-action-icon.devotional { background: #EDE9FE; color: #7C3AED; }
.quick-action-icon.meditation { background: #DBEAFE; color: #2563EB; }
.quick-action-icon.study { background: #D1FAE5; color: #059669; }
.quick-action-icon.bible { background: var(--color-primary-bg); color: var(--color-primary); }
.quick-action-label { font-size: 11px; color: var(--color-text-light); text-align: center; }

/* -- Continue Card ---------------------------------------- */
.continue-card { display: flex; gap: 12px; align-items: center; }
.continue-thumb {
  width: 60px; height: 60px; border-radius: var(--radius-sm);
  background: var(--color-primary-bg);
  display: flex; align-items: center; justify-content: center;
  font-size: 28px; flex-shrink: 0;
}
.continue-info { flex: 1; min-width: 0; }
.continue-title {
  font-size: 14px; font-weight: 600;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.continue-subtitle { font-size: 12px; color: var(--color-text-light); margin-top: 2px; }

/* -- Progress Bar ----------------------------------------- */
.progress-bar {
  height: 6px; background: var(--color-border);
  border-radius: var(--radius-full); overflow: hidden; margin-top: 8px;
}
.progress-bar-fill {
  height: 100%; border-radius: var(--radius-full);
  background: var(--color-primary); transition: width 0.4s ease;
}

/* -- Section Title ---------------------------------------- */
.section-title { font-size: 18px; font-weight: 700; color: var(--color-secondary); margin: 24px 0 12px; }
.section-subtitle { font-size: 13px; color: var(--color-text-light); margin-top: 2px; }

/* -- Trails Scroll ---------------------------------------- */
.trails-scroll {
  display: flex; gap: 12px; overflow-x: auto;
  scroll-snap-type: x mandatory; padding-bottom: 8px;
  -webkit-overflow-scrolling: touch;
  -ms-overflow-style: none; scrollbar-width: none;
}
.trails-scroll::-webkit-scrollbar { display: none; }
.trail-scroll-card { min-width: 180px; scroll-snap-align: start; flex-shrink: 0; }

/* -- Trail Card ------------------------------------------- */
.trail-card {
  background: var(--color-card); border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm); overflow: hidden;
}
.trail-card-thumb {
  height: 100px; border-radius: var(--radius-sm) var(--radius-sm) 0 0;
  background: linear-gradient(135deg, var(--color-secondary), var(--color-secondary-light));
  display: flex; align-items: center; justify-content: center; font-size: 40px;
}
.trail-card-body { padding: 12px; }
.trail-card-title {
  font-size: 14px; font-weight: 600; margin-bottom: 4px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.trail-card-category {
  font-size: 11px; color: var(--color-primary);
  font-weight: 600; text-transform: uppercase;
}
.trail-card-meta { display: flex; gap: 8px; margin-top: 8px; }
.content-type-badge {
  font-size: 10px; padding: 2px 8px;
  border-radius: var(--radius-full); background: var(--color-border); color: var(--color-text-light);
}

/* -- Devocional: Date Navigator --------------------------- */
.date-navigator { display: flex; justify-content: space-between; margin-bottom: 20px; }
.date-item {
  display: flex; flex-direction: column; align-items: center;
  gap: 4px; cursor: pointer; padding: 8px; background: none; border: none;
}
.date-item-day { font-size: 11px; color: var(--color-text-lighter); text-transform: uppercase; }
.date-item-number {
  width: 36px; height: 36px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 14px; font-weight: 600;
  transition: background-color 0.2s ease, color 0.2s ease;
}
.date-item.active .date-item-number { background: var(--color-primary); color: white; }

/* -- Devocional: Audio Player ----------------------------- */
.audio-player {
  background: var(--color-secondary); border-radius: var(--radius-lg);
  padding: 16px; display: flex; align-items: center; gap: 16px; margin-bottom: 24px;
}
.audio-play-btn {
  width: 44px; height: 44px; border-radius: 50%;
  background: var(--color-primary-light);
  display: flex; align-items: center; justify-content: center;
  color: white; cursor: pointer; border: none; flex-shrink: 0;
  transition: transform 0.15s ease;
}
.audio-play-btn:active { transform: scale(0.92); }
.audio-play-btn svg { width: 20px; height: 20px; }
.waveform { display: flex; align-items: center; gap: 2px; flex: 1; height: 32px; }
.waveform-bar { width: 3px; background: rgba(255,255,255,0.4); border-radius: 2px; }
.waveform-bar.active { background: var(--color-primary-light); }
.audio-time { font-size: 12px; color: rgba(255,255,255,0.6); flex-shrink: 0; }

/* -- Devocional: Text & Verse ----------------------------- */
.devotional-text {
  font-family: var(--font-serif); font-size: 16px; line-height: 1.8;
  color: var(--color-text); margin-bottom: 20px;
}
.devotional-verse {
  border-left: 3px solid var(--color-primary);
  padding: 12px 16px; background: var(--color-primary-bg);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  margin: 20px 0; font-family: var(--font-serif);
  font-style: italic; font-size: 15px; line-height: 1.7;
}

/* -- Devocional: Actions ---------------------------------- */
.devotional-actions { display: flex; gap: 12px; margin-top: 24px; }
.action-btn {
  flex: 1; display: flex; align-items: center; justify-content: center;
  gap: 8px; padding: 12px; border-radius: var(--radius-md);
  background: var(--color-bg); border: 1px solid var(--color-border);
  cursor: pointer; font-size: 13px; font-family: inherit; color: var(--color-text);
  transition: transform 0.15s ease;
}
.action-btn:active { transform: scale(0.96); }
.action-btn.read { background: var(--color-success); color: white; border-color: var(--color-success); }
.action-btn svg { width: 18px; height: 18px; }

/* -- Filter Chips ----------------------------------------- */
.filter-chips {
  display: flex; gap: 8px; overflow-x: auto;
  padding-bottom: 12px; margin-bottom: 16px;
  -webkit-overflow-scrolling: touch;
  -ms-overflow-style: none; scrollbar-width: none;
}
.filter-chips::-webkit-scrollbar { display: none; }
.chip {
  padding: 8px 16px; border-radius: var(--radius-full);
  font-size: 13px; white-space: nowrap; cursor: pointer;
  border: 1px solid var(--color-border); background: var(--color-card);
  color: var(--color-text-light); font-family: inherit;
  transition: background-color 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}
.chip.active { background: var(--color-primary); color: white; border-color: var(--color-primary); }

/* -- Featured Trail Banner -------------------------------- */
.featured-banner {
  height: 160px; border-radius: var(--radius-lg);
  position: relative; overflow: hidden; margin-bottom: 20px;
  background: linear-gradient(135deg, var(--color-secondary), var(--color-secondary-light));
}
.featured-banner-content {
  position: absolute; bottom: 0; left: 0; right: 0; padding: 20px; color: white;
}
.featured-banner-title { font-size: 18px; font-weight: 700; }
.featured-banner-desc { font-size: 13px; opacity: 0.85; margin-top: 4px; }
.featured-badge {
  font-size: 11px; background: var(--color-primary-light); color: white;
  padding: 4px 10px; border-radius: var(--radius-full);
  display: inline-block; margin-bottom: 8px; font-weight: 600;
}

/* -- Trail List ------------------------------------------- */
.trail-list { display: flex; flex-direction: column; gap: 12px; }
.trail-list-item {
  display: flex; gap: 12px; padding: 12px;
  background: var(--color-card); border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm); cursor: pointer;
  transition: transform 0.15s ease;
}
.trail-list-item:active { transform: scale(0.98); }
.trail-list-thumb {
  width: 64px; height: 64px; border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  font-size: 28px; flex-shrink: 0;
}
.trail-list-info { flex: 1; min-width: 0; }
.trail-list-title { font-size: 15px; font-weight: 600; }
.trail-list-desc {
  font-size: 12px; color: var(--color-text-light); margin-top: 2px;
  display: -webkit-box; -webkit-line-clamp: 2;
  -webkit-box-orient: vertical; overflow: hidden;
}

/* -- Trail Detail ----------------------------------------- */
.trail-detail-header {
  height: 180px;
  background: linear-gradient(135deg, var(--color-secondary), var(--color-secondary-light));
  border-radius: 0 0 var(--radius-xl) var(--radius-xl);
  padding: 20px; display: flex; flex-direction: column;
  justify-content: flex-end; color: white; margin: -20px -20px 20px -20px;
}
.trail-detail-title { font-size: 22px; font-weight: 700; }
.trail-detail-author { font-size: 13px; opacity: 0.8; margin-top: 4px; }
.trail-detail-meta { display: flex; gap: 16px; margin-top: 8px; font-size: 12px; opacity: 0.7; }
.lesson-item {
  display: flex; align-items: center; gap: 12px;
  padding: 14px 0; border-bottom: 1px solid var(--color-border); cursor: pointer;
}
.lesson-number {
  width: 32px; height: 32px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 14px; font-weight: 600; flex-shrink: 0;
}
.lesson-number.completed { background: var(--color-success); color: white; }
.lesson-number.current { background: var(--color-primary); color: white; }
.lesson-number.locked { background: var(--color-border); color: var(--color-text-lighter); }
.lesson-info { flex: 1; min-width: 0; }
.lesson-title { font-size: 14px; font-weight: 500; }
.lesson-meta {
  font-size: 12px; color: var(--color-text-light);
  display: flex; gap: 8px; align-items: center; margin-top: 2px;
}
.lesson-item.completed .lesson-title { color: var(--color-text-light); }
.lesson-item.locked { opacity: 0.5; cursor: default; }

/* -- Bible: Selector & Navigation ------------------------- */
.bible-selector {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  padding: 12px; background: var(--color-card);
  border-radius: var(--radius-md); cursor: pointer;
  margin-bottom: 16px; border: 1px solid var(--color-border);
  transition: border-color 0.2s ease;
}
.bible-selector:hover { border-color: var(--color-primary); }
.bible-selector-text { font-size: 16px; font-weight: 600; }
.bible-selector svg { width: 18px; height: 18px; color: var(--color-text-light); }
.chapter-nav {
  display: flex; justify-content: space-between;
  align-items: center; margin-bottom: 20px;
}
.chapter-nav-btn {
  width: 36px; height: 36px; border-radius: 50%;
  background: var(--color-bg); border: 1px solid var(--color-border);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; transition: background-color 0.2s ease;
}
.chapter-nav-btn:hover { background: var(--color-border); }
.chapter-nav-btn:disabled { opacity: 0.3; cursor: default; }
.chapter-nav-btn svg { width: 18px; height: 18px; }
.chapter-nav-label { font-size: 16px; font-weight: 600; }

/* -- Bible: Text & Verses --------------------------------- */
.bible-text { font-family: var(--font-serif); font-size: 17px; line-height: 1.9; }
.verse {
  padding: 4px 0; cursor: pointer; border-radius: 4px;
  transition: background-color 0.15s ease;
}
.verse:active { background: var(--color-primary-bg); }
.verse-number {
  color: var(--color-primary); font-weight: 700; font-size: 12px;
  vertical-align: super; margin-right: 4px; font-family: var(--font-sans);
}
.verse.has-comment { border-bottom: 1px dashed var(--color-primary-light); }
.verse.highlighted { background: var(--color-primary-bg); }
.font-size-controls { display: flex; gap: 12px; justify-content: center; margin-bottom: 16px; }
.font-size-controls button {
  width: 36px; height: 36px; border-radius: 50%;
  border: 1px solid var(--color-border); background: var(--color-card);
  cursor: pointer; display: flex; align-items: center; justify-content: center;
  font-size: 16px; font-weight: 600;
}

/* -- Bottom Sheet ----------------------------------------- */
.bottom-sheet {
  position: fixed; bottom: 0; left: 50%;
  transform: translateX(-50%);
  width: 100%; max-width: 414px;
  background: var(--color-card);
  border-radius: var(--radius-xl) var(--radius-xl) 0 0;
  box-shadow: 0 -4px 24px rgba(0,0,0,0.15);
  padding: 24px; z-index: 200;
  transition: transform 0.3s ease;
}
.bottom-sheet.hidden { transform: translateX(-50%) translateY(100%); }
.bottom-sheet-handle {
  width: 40px; height: 4px; background: var(--color-border);
  border-radius: 2px; margin: 0 auto 16px;
}
.bottom-sheet-title { font-size: 18px; font-weight: 700; margin-bottom: 12px; }
.bottom-sheet-text { font-size: 15px; line-height: 1.7; color: var(--color-text); }
.bottom-sheet-author { font-size: 13px; color: var(--color-text-light); margin-top: 12px; }

/* -- Modal Overlay ---------------------------------------- */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,0.5);
  z-index: 300; display: flex; align-items: flex-end; justify-content: center;
  opacity: 1; transition: opacity 0.3s ease;
}
.modal-overlay.hidden { opacity: 0; pointer-events: none; }
.modal-content {
  background: var(--color-card); width: 100%; max-width: 414px;
  max-height: 80vh; overflow-y: auto;
  border-radius: var(--radius-xl) var(--radius-xl) 0 0; padding: 24px;
  transform: translateY(0); transition: transform 0.3s ease;
}
.modal-overlay.hidden .modal-content { transform: translateY(100%); }

/* -- Bible Selector Modal --------------------------------- */
.book-category { margin-bottom: 20px; }
.book-category-title {
  font-size: 13px; color: var(--color-text-light); text-transform: uppercase;
  letter-spacing: 1px; margin-bottom: 8px; font-weight: 600;
}
.book-list { display: flex; flex-wrap: wrap; gap: 8px; }
.book-item {
  padding: 8px 12px; background: var(--color-bg); border-radius: var(--radius-sm);
  font-size: 13px; cursor: pointer; border: 1px solid transparent;
  transition: border-color 0.2s ease, color 0.2s ease;
}
.book-item:hover,
.book-item.active { border-color: var(--color-primary); color: var(--color-primary); }
.chapter-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 8px; }
.chapter-item {
  width: 36px; height: 36px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; cursor: pointer; background: var(--color-bg);
  border: none; font-family: inherit;
  transition: background-color 0.2s ease, color 0.2s ease;
}
.chapter-item:hover { background: var(--color-primary-bg); }
.chapter-item.active { background: var(--color-primary); color: white; }

/* -- Store: Search Bar ------------------------------------ */
.search-bar {
  display: flex; align-items: center; gap: 8px;
  padding: 10px 16px; background: var(--color-bg);
  border-radius: var(--radius-full); margin-bottom: 16px;
  border: 1px solid var(--color-border);
  transition: border-color 0.2s ease;
}
.search-bar:focus-within { border-color: var(--color-primary); }
.search-bar input {
  border: none; background: transparent; flex: 1;
  font-size: 14px; outline: none; font-family: inherit; color: var(--color-text);
}
.search-bar input::placeholder { color: var(--color-text-lighter); }
.search-bar svg { color: var(--color-text-lighter); width: 18px; height: 18px; flex-shrink: 0; }

/* -- Store: Banner ---------------------------------------- */
.store-banner {
  height: 140px; border-radius: var(--radius-lg);
  background: linear-gradient(135deg, var(--color-accent), #E07A50);
  position: relative; overflow: hidden; margin-bottom: 20px;
  padding: 20px; display: flex; flex-direction: column;
  justify-content: center; color: white;
}
.store-banner-title { font-size: 20px; font-weight: 700; }
.store-banner-desc { font-size: 13px; opacity: 0.9; margin-top: 4px; }

/* -- Store: Book Grid ------------------------------------- */
.book-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
.book-grid-item {
  background: var(--color-card); border-radius: var(--radius-md);
  overflow: hidden; box-shadow: var(--shadow-sm); cursor: pointer;
  position: relative; transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.book-grid-item:active { transform: scale(0.97); box-shadow: var(--shadow-md); }
.book-cover {
  height: 140px; display: flex; align-items: center; justify-content: center;
  font-size: 48px; background: linear-gradient(135deg, var(--color-primary-bg), #FFF5DC);
}
.book-info { padding: 12px; }
.book-title {
  font-size: 13px; font-weight: 600;
  display: -webkit-box; -webkit-line-clamp: 2;
  -webkit-box-orient: vertical; overflow: hidden;
}
.book-author { font-size: 11px; color: var(--color-text-light); margin-top: 2px; }
.book-rating { display: flex; align-items: center; gap: 4px; margin-top: 4px; }
.book-rating svg { width: 12px; height: 12px; color: var(--color-streak); }
.book-rating-text { font-size: 11px; color: var(--color-text-light); }
.book-price { margin-top: 6px; }
.book-price-current { font-size: 16px; font-weight: 700; color: var(--color-primary); }
.book-price-original {
  font-size: 12px; color: var(--color-text-lighter);
  text-decoration: line-through; margin-left: 4px;
}
.book-badge-new {
  position: absolute; top: 8px; right: 8px;
  background: var(--color-accent); color: white;
  font-size: 10px; padding: 2px 8px;
  border-radius: var(--radius-full); font-weight: 600; z-index: 1;
}

/* -- Book Detail ------------------------------------------ */
.book-detail-cover {
  width: 160px; height: 220px; margin: 0 auto 20px;
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, var(--color-primary-bg), #FFF5DC);
  display: flex; align-items: center; justify-content: center;
  font-size: 64px; box-shadow: var(--shadow-lg);
}
.book-detail-title { font-size: 22px; font-weight: 700; text-align: center; }
.book-detail-author {
  font-size: 14px; color: var(--color-text-light);
  text-align: center; margin-top: 4px;
}
.book-detail-rating {
  display: flex; justify-content: center; align-items: center;
  gap: 8px; margin-top: 8px;
}
.book-detail-rating svg { width: 16px; height: 16px; color: var(--color-streak); }
.book-detail-rating span { font-size: 14px; color: var(--color-text-light); }
.book-detail-price { text-align: center; margin: 20px 0; }
.book-detail-price .current { font-size: 28px; font-weight: 800; color: var(--color-primary); }
.book-detail-price .original {
  font-size: 16px; color: var(--color-text-lighter);
  text-decoration: line-through; margin-left: 8px;
}
.book-detail-desc { font-size: 15px; line-height: 1.7; margin-top: 16px; color: var(--color-text); }
.book-detail-toc { margin-top: 20px; }
.toc-item {
  padding: 10px 0; border-bottom: 1px solid var(--color-border);
  font-size: 14px; display: flex; gap: 8px; align-items: center;
}
.toc-item-number { color: var(--color-text-lighter); font-size: 12px; min-width: 24px; }

/* -- Profile: Header -------------------------------------- */
.profile-header {
  display: flex; flex-direction: column; align-items: center; padding: 20px 0;
}
.profile-avatar {
  width: 80px; height: 80px; border-radius: 50%;
  background: var(--color-primary); color: white;
  display: flex; align-items: center; justify-content: center;
  font-size: 28px; font-weight: 700;
}
.profile-name { font-size: 22px; font-weight: 700; margin-top: 12px; }
.profile-since { font-size: 13px; color: var(--color-text-light); margin-top: 2px; }

/* -- Profile: Stats Grid ---------------------------------- */
.stats-grid {
  display: grid; grid-template-columns: repeat(3, 1fr);
  gap: 12px; margin: 20px 0;
}
.stat-item {
  text-align: center; padding: 16px 8px;
  background: var(--color-card); border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
}
.stat-number { font-size: 24px; font-weight: 800; color: var(--color-secondary); }
.stat-label { font-size: 11px; color: var(--color-text-light); margin-top: 4px; }

/* -- Profile: Streak Section ------------------------------ */
.streak-section { margin: 20px 0; }
.streak-week { display: flex; justify-content: space-between; margin: 16px 0; }
.streak-day { display: flex; flex-direction: column; align-items: center; gap: 4px; }
.streak-day-label { font-size: 11px; color: var(--color-text-lighter); }
.streak-day-dot {
  width: 12px; height: 12px; border-radius: 50%;
  background: var(--color-border); transition: background-color 0.3s ease;
}
.streak-day-dot.completed { background: var(--color-streak); }

/* -- Profile: Heatmap ------------------------------------- */
.heatmap-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.heatmap-cell {
  width: 100%; aspect-ratio: 1; border-radius: 3px; background: var(--color-border);
}
.heatmap-cell.level-1 { background: #FEF3C7; }
.heatmap-cell.level-2 { background: #FDE68A; }
.heatmap-cell.level-3 { background: var(--color-streak); }

/* -- Profile: Achievements -------------------------------- */
.achievements-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.achievement-item { text-align: center; padding: 16px 8px; }
.achievement-icon { font-size: 32px; margin-bottom: 4px; }
.achievement-title { font-size: 11px; font-weight: 600; }
.achievement-item.locked { opacity: 0.4; filter: grayscale(1); }
.achievement-lock { font-size: 16px; }

/* -- Profile: Activity List ------------------------------- */
.activity-list { margin-top: 16px; }
.activity-item {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 0; border-bottom: 1px solid var(--color-border);
}
.activity-icon { font-size: 20px; flex-shrink: 0; width: 32px; text-align: center; }
.activity-info { flex: 1; }
.activity-title { font-size: 14px; }
.activity-time { font-size: 12px; color: var(--color-text-light); margin-top: 2px; }

/* -- Greeting --------------------------------------------- */
.greeting { margin-bottom: 20px; }
.greeting-text { font-size: 14px; color: var(--color-text-light); }
.greeting-name { font-size: 22px; font-weight: 700; color: var(--color-secondary); margin-top: 2px; }

/* -- Utility Classes -------------------------------------- */
.hidden { display: none !important; }
.font-serif { font-family: var(--font-serif); }
.text-center { text-align: center; }
.text-primary { color: var(--color-primary); }
.text-secondary { color: var(--color-secondary); }
.mb-8 { margin-bottom: 8px; }
.mb-12 { margin-bottom: 12px; }
.mb-16 { margin-bottom: 16px; }
.mb-20 { margin-bottom: 20px; }
.mb-24 { margin-bottom: 24px; }
.mt-12 { margin-top: 12px; }
.mt-16 { margin-top: 16px; }
.mt-20 { margin-top: 20px; }
.flex-center { display: flex; align-items: center; justify-content: center; }
.flex-between { display: flex; align-items: center; justify-content: space-between; }

/* -- Responsiveness --------------------------------------- */
@media (max-width: 414px) {
  .app-frame { border-radius: 0; box-shadow: none; max-width: 100%; }
  .tab-bar { max-width: 100%; }
  .bottom-sheet { max-width: 100%; left: 0; transform: none; }
  .bottom-sheet.hidden { transform: translateY(100%); }
  .modal-overlay .modal-content { max-width: 100%; }
}

/* -- Animations ------------------------------------------- */
@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

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

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

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

@keyframes shimmer {
  0% {
    background-position: -200% 0;
  }
  100% {
    background-position: 200% 0;
  }
}

.screen.active {
  animation: fadeIn 0.3s ease;
}

.streak-flame {
  animation: pulse 2s infinite;
}

/* -- Loading Skeleton ------------------------------------- */
.skeleton {
  background: linear-gradient(
    90deg,
    var(--color-border) 25%,
    #f0f0f0 50%,
    var(--color-border) 75%
  );
  background-size: 200% 100%;
  animation: shimmer 1.5s ease infinite;
  border-radius: var(--radius-sm);
}

.skeleton-text {
  height: 14px;
  margin-bottom: 8px;
  border-radius: 4px;
}

.skeleton-text.short {
  width: 60%;
}

.skeleton-title {
  height: 20px;
  width: 80%;
  margin-bottom: 12px;
  border-radius: 4px;
}

.skeleton-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
}

.skeleton-card {
  height: 120px;
  border-radius: var(--radius-md);
  margin-bottom: 16px;
}

/* -- Toast Notification ----------------------------------- */
.toast {
  position: fixed;
  top: 60px;
  left: 50%;
  transform: translateX(-50%) translateY(-100px);
  max-width: 380px;
  width: calc(100% - 40px);
  padding: 12px 20px;
  border-radius: var(--radius-md);
  background: var(--color-secondary);
  color: white;
  font-size: 14px;
  font-weight: 500;
  z-index: 500;
  box-shadow: var(--shadow-lg);
  transition: transform 0.3s ease;
  text-align: center;
}

.toast.show {
  transform: translateX(-50%) translateY(0);
}

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

.toast.warning {
  background: var(--color-streak);
  color: #2C2C2C;
}

/* -- Divider ---------------------------------------------- */
.divider {
  height: 1px;
  background: var(--color-border);
  margin: 16px 0;
}

.divider-with-text {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 20px 0;
}

.divider-with-text::before,
.divider-with-text::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--color-border);
}

.divider-with-text span {
  font-size: 12px;
  color: var(--color-text-lighter);
  white-space: nowrap;
}

/* -- Empty State ------------------------------------------ */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 48px 20px;
  text-align: center;
}

.empty-state-icon {
  font-size: 48px;
  margin-bottom: 16px;
  opacity: 0.6;
}

.empty-state-title {
  font-size: 18px;
  font-weight: 700;
  color: var(--color-secondary);
  margin-bottom: 8px;
}

.empty-state-desc {
  font-size: 14px;
  color: var(--color-text-light);
  line-height: 1.5;
  max-width: 280px;
}

/* -- Badge / Notification Dot ----------------------------- */
.badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: var(--radius-full);
  background: var(--color-accent);
  color: white;
  font-size: 10px;
  font-weight: 700;
}

.notification-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--color-accent);
  position: absolute;
  top: 0;
  right: 0;
}

/* -- Scroll to Top ---------------------------------------- */
.scroll-to-top {
  position: fixed;
  bottom: 80px;
  right: 20px;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--color-card);
  border: 1px solid var(--color-border);
  box-shadow: var(--shadow-md);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 90;
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.3s ease, transform 0.3s ease;
}

.scroll-to-top.visible {
  opacity: 1;
  transform: translateY(0);
}

.scroll-to-top svg {
  width: 18px;
  height: 18px;
  color: var(--color-text);
}

/* -- Mic FAB (Floating Action Button) -------------------- */
.mic-fab {
  position: fixed;
  bottom: 10px;
  left: calc(50% - 25px);
  transform: translateX(-50%);
  width: 56px;
  height: 56px;
  border-radius: 50%;
  border: 3px solid var(--color-bg);
  background: linear-gradient(135deg, #C4992E, #8B6914);
  color: #fff;
  cursor: pointer;
  z-index: 110;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 20px rgba(196, 153, 46, 0.45);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  animation: mic-idle-pulse 2.5s ease-in-out infinite;
}
.mic-fab:active {
  transform: translateX(-50%) scale(0.92);
}
.mic-fab .mic-fab-icon {
  position: relative;
  z-index: 2;
  transition: transform 0.2s ease;
}

/* Idle subtle pulse */
@keyframes mic-idle-pulse {
  0%, 100% { box-shadow: 0 4px 20px rgba(196, 153, 46, 0.45); }
  50% { box-shadow: 0 4px 28px rgba(196, 153, 46, 0.7); }
}

/* Listening waves (hidden by default) */
.mic-fab-wave {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 2px solid rgba(196, 153, 46, 0.5);
  opacity: 0;
  pointer-events: none;
  z-index: 1;
}

/* Active "listening" state */
.mic-fab.listening {
  animation: none;
  background: linear-gradient(135deg, #E0A82E, #D4960A);
  box-shadow: 0 4px 24px rgba(224, 168, 46, 0.6);
}
.mic-fab.listening .mic-fab-wave {
  animation: mic-wave-expand 1.6s ease-out infinite;
}
.mic-fab.listening .mic-fab-wave-2 {
  animation-delay: 0.4s;
}
.mic-fab.listening .mic-fab-wave-3 {
  animation-delay: 0.8s;
}

@keyframes mic-wave-expand {
  0% {
    transform: scale(1);
    opacity: 0.6;
  }
  100% {
    transform: scale(2.2);
    opacity: 0;
  }
}

/* Tab bar spacer for FAB */
.tab-spacer {
  width: 60px;
  flex-shrink: 0;
}

/* -- Voice Toast ----------------------------------------- */
.voice-toast {
  position: fixed;
  top: 72px;
  left: 50%;
  transform: translateX(-50%) translateY(-80px);
  max-width: 360px;
  width: calc(100% - 48px);
  padding: 14px 20px;
  border-radius: 14px;
  background: rgba(27, 42, 74, 0.95);
  color: #fff;
  font-size: 14px;
  font-weight: 500;
  z-index: 600;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.25);
  text-align: center;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  opacity: 0;
  pointer-events: none;
  transition: transform 0.35s cubic-bezier(0.34, 1.56, 0.64, 1), opacity 0.3s ease;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}
.voice-toast.show {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
  pointer-events: auto;
}
.voice-toast .voice-toast-dots {
  display: inline-flex;
  gap: 4px;
}
.voice-toast .voice-toast-dots span {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: rgba(255,255,255,0.7);
  animation: voice-dot-bounce 1.2s ease-in-out infinite;
}
.voice-toast .voice-toast-dots span:nth-child(2) { animation-delay: 0.2s; }
.voice-toast .voice-toast-dots span:nth-child(3) { animation-delay: 0.4s; }

@keyframes voice-dot-bounce {
  0%, 80%, 100% { transform: translateY(0); opacity: 0.5; }
  40% { transform: translateY(-6px); opacity: 1; }
}

/* -- Lesson Detail ---------------------------------------- */
.lesson-detail-video {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  background: linear-gradient(135deg, #0f1f3a, #1a1a2e);
  border-radius: var(--radius-lg);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  overflow: hidden;
  margin-bottom: 20px;
}
.lesson-detail-video::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at center, rgba(255,255,255,0.05) 0%, transparent 70%);
}
.lesson-detail-play-btn {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.15);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  border: 2px solid rgba(255, 255, 255, 0.3);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  z-index: 1;
  transition: transform 0.2s ease, background 0.2s ease;
}
.lesson-detail-play-btn:active {
  transform: scale(0.92);
  background: rgba(255, 255, 255, 0.25);
}
.lesson-detail-video-label {
  position: absolute;
  bottom: 12px;
  right: 12px;
  font-size: 12px;
  color: rgba(255, 255, 255, 0.6);
  background: rgba(0, 0, 0, 0.4);
  padding: 4px 10px;
  border-radius: var(--radius-full);
  z-index: 1;
}
.lesson-detail-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}
.lesson-detail-badge {
  font-size: 11px;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: var(--radius-full);
  text-transform: uppercase;
}
.lesson-detail-badge.video { background: #DBEAFE; color: #2563EB; }
.lesson-detail-badge.audio { background: #EDE9FE; color: #7C3AED; }
.lesson-detail-badge.texto { background: #D1FAE5; color: #059669; }
.lesson-detail-body {
  font-family: var(--font-serif);
  font-size: 16px;
  line-height: 1.8;
  color: var(--color-text);
  margin-bottom: 24px;
  white-space: pre-line;
}
.lesson-detail-quote {
  border-left: 3px solid var(--color-primary);
  padding: 12px 16px;
  background: var(--color-primary-bg);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  margin: 20px 0;
}
.lesson-detail-quote p {
  font-family: var(--font-serif);
  font-style: italic;
  font-size: 15px;
  line-height: 1.7;
  margin: 0 0 6px;
}
.lesson-detail-quote cite {
  font-size: 13px;
  font-weight: 600;
  color: var(--color-primary);
  font-style: normal;
}
.lesson-detail-image {
  border-radius: var(--radius-md);
  padding: 24px 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
  background: linear-gradient(135deg, var(--color-primary-bg), #FFF5DC);
}
.lesson-detail-image-emoji {
  font-size: 3rem;
}
.lesson-detail-image-caption {
  font-size: 13px;
  color: var(--color-text-light);
  text-align: center;
  font-style: italic;
}
.lesson-nav-footer {
  display: flex;
  gap: 10px;
  margin-top: 24px;
  padding-top: 20px;
  border-top: 1px solid var(--color-border);
}
.lesson-nav-footer .btn {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}
.lesson-nav-footer .btn:disabled {
  opacity: 0.35;
  pointer-events: none;
}
.lesson-detail-progress {
  font-size: 13px;
  color: var(--color-text-light);
  margin-bottom: 12px;
}

/* Mic FAB responsive safe-area */
@media (max-width: 414px) {
  .mic-fab {
    bottom: calc(10px + env(safe-area-inset-bottom, 0px));
  }
}
