/* ==========================================================================
   DIKILI - Aplikasi Pembacaan Naskah Klasik Gorontalo (Naskah D)
   Mobile-First Styling with Historical Manuscript Aesthetics
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Amiri:ital,wght@0,400;0,700;1,400&family=Plus+Jakarta+Sans:wght@400;500;600;700&family=Scheherazade+New:wght@400;700&display=swap');

:root {
  /* Theme: Parchment / Naskah Kuno (Default) */
  --bg-primary: #F8F5EE;
  --bg-secondary: #EFE9DC;
  --bg-card: #FFFFFF;
  --bg-card-hover: #FDFBF7;
  --text-primary: #2C241E;
  --text-secondary: #6B5E52;
  --text-muted: #8F8274;
  --text-arabic: #1C1917;
  
  --accent-gold: #C59B27;
  --accent-gold-light: #FBF4DE;
  --accent-gold-dark: #8F6C12;
  
  --accent-green: #1E6B47;
  --accent-green-light: #E8F5EE;
  --accent-green-dark: #124B30;
  
  --border-subtle: #E2DACB;
  --border-strong: #D1C5B0;
  
  --shadow-sm: 0 1px 3px rgba(44, 36, 30, 0.06);
  --shadow-md: 0 4px 12px rgba(44, 36, 30, 0.08);
  --shadow-lg: 0 10px 25px rgba(44, 36, 30, 0.12);
  
  --font-sans: 'Plus Jakarta Sans', system-ui, -apple-system, sans-serif;
  --font-arabic: 'Amiri', 'Scheherazade New', 'Traditional Arabic', serif;
  
  --arabic-size: 24px;
  --latin-size: 15px;
  --trans-size: 14.5px;
}

[data-theme="dark"] {
  --bg-primary: #121417;
  --bg-secondary: #1A1E24;
  --bg-card: #20262E;
  --bg-card-hover: #262D37;
  --text-primary: #F1F5F9;
  --text-secondary: #94A3B8;
  --text-muted: #64748B;
  --text-arabic: #F8FAFC;
  
  --accent-gold: #E5B842;
  --accent-gold-light: #2A2415;
  --accent-gold-dark: #F59E0B;
  
  --accent-green: #22C55E;
  --accent-green-light: #132E1E;
  --accent-green-dark: #16A34A;
  
  --border-subtle: #2D3748;
  --border-strong: #3E4C5F;
  
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.4);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.5);
  --shadow-lg: 0 10px 25px rgba(0, 0, 0, 0.7);
}

[data-theme="light"] {
  --bg-primary: #FAFAFA;
  --bg-secondary: #F0F2F5;
  --bg-card: #FFFFFF;
  --bg-card-hover: #F8FAFC;
  --text-primary: #0F172A;
  --text-secondary: #475569;
  --text-muted: #94A3B8;
  --text-arabic: #0F172A;
  
  --accent-gold: #B45309;
  --accent-gold-light: #FEF3C7;
  --accent-gold-dark: #92400E;
  
  --accent-green: #0D9488;
  --accent-green-light: #CCFBF1;
  --accent-green-dark: #0F766E;
  
  --border-subtle: #E2E8F0;
  --border-strong: #CBD5E1;
  
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

body {
  font-family: var(--font-sans);
  background-color: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  justify-content: center;
  overflow-x: hidden;
  transition: background-color 0.25s ease, color 0.25s ease;
}

/* App Wrapper for Mobile-First experience */
.app-container {
  width: 100%;
  max-width: 680px;
  min-height: 100vh;
  background-color: var(--bg-primary);
  display: flex;
  flex-direction: column;
  position: relative;
  box-shadow: 0 0 35px rgba(0,0,0,0.06);
}

/* Header */
.app-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: var(--bg-primary);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-subtle);
  padding: 10px 16px 8px;
}

.header-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.brand-section {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
}

.brand-logo-icon {
  width: 32px;
  height: 32px;
  background: linear-gradient(135deg, var(--accent-gold), var(--accent-gold-dark));
  color: #FFF;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 16px;
  box-shadow: 0 2px 6px rgba(197, 155, 39, 0.35);
}

.brand-title {
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.3px;
  color: var(--text-primary);
}

.brand-subtitle {
  font-size: 11px;
  color: var(--accent-gold-dark);
  font-weight: 600;
  margin-left: 4px;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.btn-icon {
  background: transparent;
  border: none;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.2s;
}

.btn-icon:hover, .btn-icon:active {
  background-color: var(--bg-secondary);
  color: var(--text-primary);
}

/* Sair Selector Bar */
.sair-selector-pill {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--bg-card);
  border: 1px solid var(--border-strong);
  border-radius: 20px;
  padding: 6px 14px;
  margin-top: 8px;
  cursor: pointer;
  transition: all 0.2s;
  box-shadow: var(--shadow-sm);
}

.sair-selector-pill:active {
  transform: scale(0.98);
}

.sair-pill-left {
  display: flex;
  align-items: center;
  gap: 8px;
  overflow: hidden;
}

.sair-badge {
  background: var(--accent-gold-light);
  color: var(--accent-gold-dark);
  font-size: 11px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 12px;
  white-space: nowrap;
}

.sair-pill-title {
  font-size: 13.5px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sair-pill-arrow {
  color: var(--text-muted);
  font-size: 12px;
}

/* Progress bar */
.progress-bar-container {
  width: 100%;
  height: 3px;
  background-color: var(--border-subtle);
  position: absolute;
  bottom: 0;
  left: 0;
}

.progress-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent-gold), var(--accent-green));
  width: 5%;
  transition: width 0.3s ease;
}

/* Sticky Control Drawer / Quick Toggle Bar */
.control-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 16px;
  background-color: var(--bg-secondary);
  border-bottom: 1px solid var(--border-subtle);
  font-size: 12px;
  overflow-x: auto;
  gap: 8px;
}

.toggle-chips-group {
  display: flex;
  align-items: center;
  gap: 6px;
}

.toggle-chip {
  padding: 4px 10px;
  border-radius: 14px;
  background-color: var(--bg-card);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  user-select: none;
  white-space: nowrap;
}

.toggle-chip.active {
  background-color: var(--accent-gold);
  border-color: var(--accent-gold-dark);
  color: #FFF;
}

.font-size-adjuster {
  display: flex;
  align-items: center;
  gap: 4px;
}

.btn-font-step {
  width: 28px;
  height: 28px;
  border-radius: 6px;
  border: 1px solid var(--border-strong);
  background: var(--bg-card);
  color: var(--text-primary);
  font-weight: 700;
  font-size: 12px;
  cursor: pointer;
}

/* Main Content Area */
.content-area {
  flex: 1;
  padding: 16px 14px 100px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

/* Sair Header Card */
.sair-hero-card {
  background: linear-gradient(145deg, var(--bg-card), var(--bg-secondary));
  border: 1px solid var(--border-strong);
  border-radius: 16px;
  padding: 18px 16px;
  box-shadow: var(--shadow-sm);
  text-align: center;
  position: relative;
  overflow: hidden;
}

.sair-hero-card::before {
  content: '﷽';
  position: absolute;
  top: -15px;
  right: 15px;
  font-size: 55px;
  color: var(--accent-gold);
  opacity: 0.12;
  pointer-events: none;
  font-family: var(--font-arabic);
}

.sair-hero-number {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--accent-gold-dark);
  font-weight: 700;
  margin-bottom: 4px;
}

.sair-hero-title {
  font-size: 20px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 6px;
}

.sair-hero-pages {
  display: inline-block;
  font-size: 11px;
  color: var(--text-muted);
  background: var(--bg-primary);
  padding: 2px 10px;
  border-radius: 10px;
  margin-bottom: 10px;
}

.sair-hero-theme {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.5;
  max-width: 540px;
  margin: 0 auto;
}

/* Navigation Pager */
.sair-pager {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 10px;
  gap: 10px;
}

.btn-pager {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 9px 12px;
  border-radius: 10px;
  background: var(--bg-card);
  border: 1px solid var(--border-strong);
  color: var(--text-primary);
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-pager:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.btn-pager:not(:disabled):hover {
  background: var(--bg-secondary);
  border-color: var(--accent-gold);
}

/* UNIT CARDS */
.unit-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: 14px;
  padding: 16px 15px;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  gap: 12px;
  transition: transform 0.2s, box-shadow 0.2s, border-color 0.2s;
  position: relative;
}

.unit-card:hover {
  box-shadow: var(--shadow-md);
  border-color: var(--border-strong);
}

/* Unit Header */
.unit-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px dashed var(--border-subtle);
  padding-bottom: 8px;
}

.unit-tag {
  font-size: 11px;
  font-weight: 700;
  padding: 2px 9px;
  border-radius: 10px;
  text-transform: capitalize;
}

.tag-puisi {
  background: var(--bg-secondary);
  color: var(--text-secondary);
}

.tag-jabu {
  background: var(--accent-gold-light);
  color: var(--accent-gold-dark);
  border: 1px solid var(--accent-gold);
}

.tag-gorontalo {
  background: var(--accent-green-light);
  color: var(--accent-green-dark);
  border: 1px solid var(--accent-green);
}

.tag-quran, .tag-hadits, .tag-hikayat {
  background: #E0F2FE;
  color: #0369A1;
  border: 1px solid #BAE6FD;
}

.tag-doa {
  background: #F3E8FF;
  color: #7E22CE;
  border: 1px solid #E9D5FF;
}

.unit-actions {
  display: flex;
  align-items: center;
  gap: 4px;
}

.btn-unit-action {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px;
  border-radius: 6px;
  font-size: 13px;
  transition: all 0.2s;
}

.btn-unit-action:hover {
  color: var(--accent-gold);
  background: var(--bg-secondary);
}

.btn-unit-action.active {
  color: var(--accent-gold-dark);
}

/* Card Themes for specific types */
.unit-card.is-jabu {
  border: 1.5px solid var(--accent-gold);
  background: linear-gradient(180deg, var(--accent-gold-light) 0%, var(--bg-card) 60px);
}

.unit-card.is-gorontalo {
  border-left: 4px solid var(--accent-green);
  background: linear-gradient(180deg, var(--accent-green-light) 0%, var(--bg-card) 50px);
}

.unit-card.is-hikayat {
  border-left: 4px solid #0284c7;
  background: linear-gradient(180deg, rgba(2, 132, 199, 0.08) 0%, var(--bg-card) 50px);
}

.unit-card.is-doa {
  border-left: 4px solid #9333ea;
  background: linear-gradient(180deg, rgba(147, 51, 234, 0.08) 0%, var(--bg-card) 50px);
}

/* Text Sections */
.unit-arabic {
  font-family: var(--font-arabic);
  font-size: var(--arabic-size);
  line-height: 1.9;
  color: var(--text-arabic);
  direction: rtl;
  text-align: right;
  word-spacing: 2px;
  letter-spacing: 0;
  padding: 4px 2px;
  white-space: pre-line;
}

.unit-latin {
  font-size: var(--latin-size);
  color: var(--text-secondary);
  font-style: italic;
  line-height: 1.6;
  white-space: pre-line;
}

.unit-translation {
  font-size: var(--trans-size);
  color: var(--text-primary);
  line-height: 1.6;
  border-top: 1px dotted var(--border-subtle);
  padding-top: 8px;
  white-space: pre-line;
}

.unit-gorontalo-box {
  background: var(--accent-green-light);
  border-radius: 8px;
  padding: 10px 12px;
  margin-top: 4px;
  border-left: 3px solid var(--accent-green);
}

.gorontalo-label {
  font-size: 11px;
  font-weight: 700;
  color: var(--accent-green-dark);
  text-transform: uppercase;
  margin-bottom: 4px;
  display: flex;
  align-items: center;
  gap: 4px;
}

.gorontalo-text {
  font-size: 14.5px;
  color: #113624;
  line-height: 1.6;
}

[data-theme="dark"] .gorontalo-text {
  color: #D1FAE5;
}

.unit-note-box {
  background: var(--bg-secondary);
  border-radius: 8px;
  padding: 8px 10px;
  font-size: 11.5px;
  color: var(--text-muted);
  line-height: 1.45;
  margin-top: 4px;
}

/* BOTTOM NAVIGATION */
.app-bottom-nav {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: 680px;
  background: var(--bg-card);
  border-top: 1px solid var(--border-strong);
  display: flex;
  align-items: center;
  justify-content: space-around;
  padding: 8px 0 12px;
  z-index: 40;
  box-shadow: 0 -4px 16px rgba(0, 0, 0, 0.06);
}

.nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  color: var(--text-muted);
  background: none;
  border: none;
  cursor: pointer;
  font-size: 11px;
  font-weight: 600;
  padding: 4px 12px;
  border-radius: 8px;
  transition: all 0.2s;
}

.nav-item svg {
  width: 20px;
  height: 20px;
  stroke-width: 2;
}

.nav-item.active, .nav-item:active {
  color: var(--accent-gold-dark);
}

/* MODALS & BOTTOM SHEETS */
.modal-overlay {
  position: fixed;
  inset: 0;
  background-color: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(4px);
  z-index: 100;
  display: flex;
  justify-content: center;
  align-items: flex-end;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
}

.modal-overlay.open {
  opacity: 1;
  pointer-events: auto;
}

.bottom-sheet {
  width: 100%;
  max-width: 680px;
  max-height: 85vh;
  background-color: var(--bg-card);
  border-radius: 20px 20px 0 0;
  display: flex;
  flex-direction: column;
  transform: translateY(100%);
  transition: transform 0.28s cubic-bezier(0.16, 1, 0.3, 1);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
}

.modal-overlay.open .bottom-sheet {
  transform: translateY(0);
}

.sheet-header {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: relative;
}

.sheet-grabber {
  width: 40px;
  height: 4px;
  background-color: var(--border-strong);
  border-radius: 2px;
  position: absolute;
  top: 6px;
  left: 50%;
  transform: translateX(-50%);
}

.sheet-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-primary);
}

.sheet-content {
  flex: 1;
  overflow-y: auto;
  padding: 14px 16px 30px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* Sair Item in Sheet */
.sair-sheet-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px;
  border-radius: 12px;
  background: var(--bg-primary);
  border: 1px solid var(--border-subtle);
  cursor: pointer;
  transition: all 0.15s ease;
}

.sair-sheet-item:hover, .sair-sheet-item:active {
  background: var(--bg-secondary);
  border-color: var(--accent-gold);
}

.sair-sheet-item.active {
  background: var(--accent-gold-light);
  border-color: var(--accent-gold);
}

.sair-sheet-left {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 1;
  overflow: hidden;
}

.sair-sheet-num {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--bg-card);
  border: 1px solid var(--border-strong);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  color: var(--text-primary);
}

.sair-sheet-item.active .sair-sheet-num {
  background: var(--accent-gold);
  color: #FFF;
  border-color: var(--accent-gold);
}

.sair-sheet-info {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.sair-sheet-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
}

.sair-sheet-snippet {
  font-size: 11.5px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Special Doa Khatam Item in Drawer */
.sair-sheet-item.special-doa-item {
  margin-top: 10px;
  background: linear-gradient(135deg, rgba(217, 119, 6, 0.08), rgba(147, 51, 234, 0.08));
  border: 1.5px dashed var(--accent-gold);
}

.sair-sheet-item.special-doa-item:hover, .sair-sheet-item.special-doa-item:active {
  background: linear-gradient(135deg, rgba(217, 119, 6, 0.16), rgba(147, 51, 234, 0.16));
  border-color: #9333ea;
}

.special-doa-item .sair-sheet-num {
  background: linear-gradient(135deg, #d97706, #9333ea);
  color: #fff;
  border: none;
  font-size: 13px;
}

.special-doa-badge-pill {
  font-size: 11px;
  font-weight: 700;
  color: #9333ea;
  background: rgba(147, 51, 234, 0.12);
  padding: 3px 8px;
  border-radius: 12px;
  border: 1px solid rgba(147, 51, 234, 0.25);
  white-space: nowrap;
}

/* Doa Jump Banner inside Sair Hero Card */
.doa-jump-banner {
  margin-top: 14px;
  padding: 11px 14px;
  background: linear-gradient(135deg, rgba(217, 119, 6, 0.09), rgba(147, 51, 234, 0.09));
  border: 1px solid rgba(147, 51, 234, 0.35);
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.doa-jump-banner:hover {
  background: linear-gradient(135deg, rgba(217, 119, 6, 0.15), rgba(147, 51, 234, 0.15));
  border-color: #9333ea;
  transform: translateY(-1px);
}

.doa-jump-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
  text-align: left;
}

.doa-jump-badge {
  font-size: 12.5px;
  font-weight: 700;
  color: #7e22ce;
  display: flex;
  align-items: center;
  gap: 6px;
}

[data-theme="dark"] .doa-jump-badge {
  color: #c084fc;
}

.doa-jump-desc {
  font-size: 11px;
  color: var(--text-secondary);
}

.btn-jump-action {
  background: linear-gradient(135deg, #d97706, #9333ea);
  color: #fff;
  border: none;
  padding: 6px 12px;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  box-shadow: 0 2px 6px rgba(147, 51, 234, 0.3);
  transition: all 0.15s ease;
}

.btn-jump-action:hover {
  filter: brightness(1.1);
  transform: scale(1.03);
}

/* Search Box */
.search-input-box {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-strong);
  border-radius: 12px;
  padding: 8px 12px;
  margin-bottom: 12px;
}

.search-input-box input {
  flex: 1;
  background: none;
  border: none;
  outline: none;
  font-family: var(--font-sans);
  font-size: 14px;
  color: var(--text-primary);
}

.search-results-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.search-result-item {
  padding: 10px 12px;
  border-radius: 10px;
  background: var(--bg-primary);
  border: 1px solid var(--border-subtle);
  cursor: pointer;
  transition: all 0.2s;
}

.search-result-item:hover {
  border-color: var(--accent-gold);
  background: var(--bg-card);
}

.result-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 11px;
  color: var(--accent-gold-dark);
  font-weight: 700;
  margin-bottom: 4px;
}

.result-text {
  font-size: 13px;
  color: var(--text-primary);
  line-height: 1.4;
}

/* Toast */
.toast-msg {
  position: fixed;
  bottom: 75px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background-color: var(--text-primary);
  color: var(--bg-primary);
  padding: 8px 16px;
  border-radius: 20px;
  font-size: 12.5px;
  font-weight: 600;
  z-index: 200;
  opacity: 0;
  pointer-events: none;
  transition: all 0.25s ease;
  box-shadow: 0 4px 12px rgba(0,0,0,0.2);
}

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

/* Codicology Info Layout */
.info-section {
  display: flex;
  flex-direction: column;
  gap: 12px;
  font-size: 13.5px;
  color: var(--text-secondary);
}

.info-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 6px;
}

.info-table td {
  padding: 6px 8px;
  border-bottom: 1px solid var(--border-subtle);
  font-size: 12.5px;
}

.info-table td:first-child {
  font-weight: 600;
  color: var(--text-primary);
  width: 38%;
}

/* ==========================================================================
   Kajian Riset & Kearifan Lokal Dikili Styles
   ========================================================================== */
.bottom-sheet.research-sheet {
  max-height: 90vh;
}

.research-header-title {
  display: flex;
  flex-direction: column;
  gap: 2px;
  overflow: hidden;
}

.sheet-subtitle {
  font-size: 11px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.research-tabs-nav {
  display: flex;
  overflow-x: auto;
  gap: 6px;
  padding: 8px 14px;
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border-subtle);
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}

.research-tabs-nav::-webkit-scrollbar {
  display: none;
}

.research-tab-btn {
  background: var(--bg-primary);
  border: 1px solid var(--border-subtle);
  padding: 6px 12px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  white-space: nowrap;
  cursor: pointer;
  transition: all 0.2s ease;
}

.research-tab-btn:hover {
  color: var(--text-primary);
  border-color: var(--accent-gold);
}

.research-tab-btn.active {
  background: var(--accent-gold);
  color: #fff;
  border-color: var(--accent-gold);
  box-shadow: 0 2px 6px rgba(217, 119, 6, 0.25);
}

.research-sheet-content {
  padding: 14px 16px 36px 16px;
}

.research-tab-pane {
  display: none;
  flex-direction: column;
  gap: 14px;
}

.research-tab-pane.active {
  display: flex;
}

.research-card {
  background: var(--bg-primary);
  border: 1px solid var(--border-subtle);
  border-radius: 14px;
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  font-size: 13px;
  line-height: 1.65;
  color: var(--text-secondary);
}

.research-card-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 2px;
}

.research-list {
  padding-left: 18px;
  margin: 4px 0 0 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.manuscript-item {
  background: var(--bg-secondary);
  border: 1px solid var(--border-subtle);
  border-radius: 10px;
  padding: 10px 12px;
  margin-top: 6px;
  font-size: 12.5px;
  line-height: 1.55;
}

.manuscript-item.featured-ms {
  border: 1.5px solid var(--accent-gold);
  background: linear-gradient(135deg, rgba(217, 119, 6, 0.06), var(--bg-secondary));
}

.manuscript-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
}

.manuscript-tag {
  font-size: 10.5px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 6px;
}

.tag-ms-a { background: #fee2e2; color: #b91c1c; }
.tag-ms-b { background: #fef3c7; color: #b45309; }
.tag-ms-c { background: #e0f2fe; color: #0369a1; }
.tag-ms-d { background: #dcfce7; color: #15803d; border: 1px solid #86efac; }

/* Jabu specimens */
.jabu-specimens-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 4px;
}

.jabu-box {
  background: var(--bg-secondary);
  border-left: 3px solid var(--accent-gold);
  border-radius: 0 10px 10px 0;
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.jabu-ar {
  font-family: var(--font-arabic);
  font-size: 17px;
  direction: rtl;
  text-align: right;
  color: var(--text-arabic);
  line-height: 1.8;
}

.jabu-la {
  font-size: 12px;
  font-style: italic;
  font-weight: 600;
  color: var(--accent-gold-dark);
}

.jabu-id {
  font-size: 12px;
  color: var(--text-secondary);
}

/* Pegon Grid */
.pegon-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
  margin-top: 4px;
}

.pegon-cell {
  background: var(--bg-secondary);
  border: 1px solid var(--border-subtle);
  border-radius: 10px;
  padding: 10px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}

.pegon-char {
  font-family: var(--font-arabic);
  font-size: 28px;
  color: var(--accent-gold-dark);
  line-height: 1.2;
}

.pegon-name {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-primary);
}

.pegon-val {
  font-size: 11px;
  color: var(--text-muted);
}

/* Vowel Demo Box */
.vowel-demo-box {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 6px;
}

.vowel-item {
  background: var(--bg-secondary);
  border: 1.5px dashed var(--accent-green);
  border-radius: 10px;
  padding: 12px 10px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.vowel-symbol {
  font-family: var(--font-arabic);
  font-size: 32px;
  color: var(--accent-green-dark);
  line-height: 1.2;
}

.vowel-title {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-primary);
}

.vowel-desc {
  font-size: 11px;
  color: var(--text-secondary);
  line-height: 1.4;
}

/* Glossary list */
.glossary-items-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.glossary-card {
  background: var(--bg-primary);
  border: 1px solid var(--border-subtle);
  border-radius: 10px;
  padding: 10px 12px;
  display: flex;
  gap: 10px;
  align-items: flex-start;
  font-size: 12.5px;
  line-height: 1.5;
}

.glossary-num {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--accent-gold);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  margin-top: 2px;
}

.glossary-body {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.glossary-body strong {
  color: var(--text-primary);
}

.glossary-body p {
  color: var(--text-secondary);
  margin: 0;
}

/* Hide helper classes */
.hide-arabic .unit-arabic { display: none !important; }
.hide-latin .unit-latin { display: none !important; }
.hide-translation .unit-translation { display: none !important; }
.hide-gorontalo .unit-gorontalo-box { display: none !important; }

/* ==========================================================================
   Splash Screen
   ========================================================================== */
.splash-screen {
  position: fixed;
  inset: 0;
  z-index: 99999;
  background: var(--bg-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  padding: 24px;
  transition: opacity 0.6s cubic-bezier(0.4, 0, 0.2, 1), visibility 0.6s ease;
  user-select: none;
}

.splash-screen.fade-out {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.splash-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  max-width: 320px;
  animation: splashFadeUp 0.8s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.splash-emblem {
  position: relative;
  width: 96px;
  height: 96px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 20px;
}

.splash-logo-circle {
  width: 80px;
  height: 80px;
  border-radius: 24px;
  background: linear-gradient(135deg, var(--accent-gold) 0%, var(--accent-gold-dark) 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 12px 30px rgba(197, 155, 39, 0.35);
  position: relative;
  z-index: 2;
  transform: rotate(-3deg);
  animation: logoFloat 3s ease-in-out infinite alternate;
}

.splash-logo-arabic {
  font-family: var(--font-arabic);
  font-size: 42px;
  font-weight: 700;
  color: #FFFFFF;
  line-height: 1;
  margin-top: -6px;
}

.splash-ring {
  position: absolute;
  inset: 0;
  border-radius: 30px;
  border: 1.5px dashed var(--accent-gold);
  opacity: 0.5;
  animation: ringRotate 16s linear infinite;
}

.splash-brand {
  margin-bottom: 18px;
}

.splash-title {
  font-family: var(--font-sans);
  font-size: 36px;
  font-weight: 800;
  letter-spacing: -0.5px;
  color: var(--text-primary);
  margin: 0 0 6px 0;
  line-height: 1.1;
}

.splash-subtitle {
  font-size: 13px;
  color: var(--text-muted);
  margin: 0;
  font-weight: 500;
  letter-spacing: 0.2px;
}

.splash-meta {
  margin-bottom: 26px;
}

.splash-creator-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: linear-gradient(135deg, rgba(217, 119, 6, 0.12), rgba(16, 185, 129, 0.1));
  border: 1.5px solid rgba(217, 119, 6, 0.4);
  padding: 8px 18px;
  border-radius: 24px;
  box-shadow: 0 4px 18px rgba(217, 119, 6, 0.15);
  backdrop-filter: blur(8px);
  animation: badgePulse 3s ease-in-out infinite alternate;
}

.splash-sparkle {
  color: var(--accent-gold);
  font-size: 11px;
  animation: sparkleRotate 4s linear infinite;
}

.splash-project-name {
  font-family: var(--font-sans);
  font-size: 14px;
  font-weight: 800;
  letter-spacing: 0.6px;
  color: var(--accent-gold-dark);
  text-transform: uppercase;
}

[data-theme="dark"] .splash-project-name {
  color: #fbbf24;
}

.splash-loader {
  width: 160px;
  height: 4px;
  background: var(--border-subtle);
  border-radius: 4px;
  overflow: hidden;
  position: relative;
  margin-top: 4px;
}

.splash-bar {
  width: 50%;
  height: 100%;
  background: linear-gradient(90deg, var(--accent-gold), var(--accent-green));
  border-radius: 4px;
  position: absolute;
  animation: loaderSlide 1.5s ease-in-out infinite;
}

.splash-footer {
  position: absolute;
  bottom: 28px;
  left: 0;
  right: 0;
  text-align: center;
  font-size: 13px;
  color: var(--text-muted);
  letter-spacing: 0.3px;
  animation: splashFadeUp 1s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.splash-author {
  font-weight: 700;
  color: var(--text-primary);
  background: linear-gradient(135deg, var(--accent-gold), var(--accent-green));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

/* App Reader Footer */
.app-reader-footer {
  margin: 36px 0 20px 0;
  padding: 24px 16px;
  text-align: center;
  border-top: 1px dashed var(--border-subtle);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}

.footer-decor {
  font-size: 10px;
  color: var(--accent-gold);
  letter-spacing: 6px;
}

.footer-title {
  font-size: 13.5px;
  font-weight: 700;
  color: var(--text-primary);
}

.footer-author {
  font-size: 12.5px;
  color: var(--text-muted);
}

.footer-author strong {
  color: var(--accent-gold-dark);
}

@keyframes badgePulse {
  0% { transform: scale(0.98); box-shadow: 0 4px 14px rgba(217, 119, 6, 0.12); }
  100% { transform: scale(1.02); box-shadow: 0 6px 20px rgba(217, 119, 6, 0.25); }
}

@keyframes sparkleRotate {
  0% { transform: rotate(0deg) scale(0.9); }
  50% { transform: rotate(180deg) scale(1.15); }
  100% { transform: rotate(360deg) scale(0.9); }
}

@keyframes splashFadeUp {
  0% {
    opacity: 0;
    transform: translateY(20px) scale(0.96);
  }
  100% {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes logoFloat {
  0% {
    transform: rotate(-3deg) translateY(0);
  }
  100% {
    transform: rotate(3deg) translateY(-4px);
  }
}

@keyframes ringRotate {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

@keyframes loaderSlide {
  0% {
    left: -50%;
    width: 30%;
  }
  50% {
    left: 30%;
    width: 60%;
  }
  100% {
    left: 100%;
    width: 30%;
  }
}

