/* ==========================================================================
   Pauline Epistles (பவுலின் நிருபங்கள்) - Master Stylesheet
   Modern, responsive, accessible design with multi-theme support
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. Design Tokens & CSS Variables
   -------------------------------------------------------------------------- */
:root {
  /* Default Theme: Biblical Parchment */
  --bg-main: #fbf7ee;
  --bg-card: #ffffff;
  --bg-card-subtle: #f6f0e2;
  --bg-sidebar: #f5eedc;
  --bg-header: rgba(251, 247, 238, 0.94);
  --bg-input: #ffffff;
  --bg-hover: #ece3cf;
  --bg-overlay: rgba(30, 24, 18, 0.65);
  
  --text-primary: #231c15;
  --text-secondary: #584a3d;
  --text-muted: #806e5d;
  --text-on-accent: #ffffff;
  
  --border-color: #e4d7be;
  --border-subtle: #ede2cd;
  --border-focus: #b8860b;
  
  --accent-gold: #c59b27;
  --accent-gold-dark: #9e7a17;
  --accent-gold-light: #fef5d8;
  --accent-leather: #7b3f00;
  --accent-crimson: #8b1e2a;
  --accent-emerald: #1c744f;
  --accent-navy: #1b365d;
  
  --card-shadow: 0 4px 16px rgba(50, 35, 20, 0.07);
  --card-shadow-hover: 0 10px 28px rgba(50, 35, 20, 0.12);
  --modal-shadow: 0 20px 50px rgba(0, 0, 0, 0.25);
  
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --radius-xl: 24px;
  
  --base-font-size: 17px;
  --font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Mukta Malar", "Noto Sans Tamil", "Latha", "Vijaya", Roboto, sans-serif;
  --font-serif: "Georgia", "Palatino Linotype", "Book Antiqua", "Vijaya", serif;
  --header-height: 70px;
  --sidebar-width: 290px;
  --transition-fast: 0.2s ease;
  --transition-normal: 0.3s ease;
}

/* Theme: Modern Light */
body.theme-light {
  --bg-main: #f8fafc;
  --bg-card: #ffffff;
  --bg-card-subtle: #f1f5f9;
  --bg-sidebar: #ffffff;
  --bg-header: rgba(255, 255, 255, 0.94);
  --bg-input: #ffffff;
  --bg-hover: #e2e8f0;
  --bg-overlay: rgba(15, 23, 42, 0.6);
  
  --text-primary: #0f172a;
  --text-secondary: #334155;
  --text-muted: #64748b;
  
  --border-color: #e2e8f0;
  --border-subtle: #edf2f7;
  --border-focus: #2563eb;
  
  --accent-gold: #2563eb;
  --accent-gold-dark: #1d4ed8;
  --accent-gold-light: #eff6ff;
  --accent-leather: #0284c7;
  --accent-crimson: #dc2626;
  --accent-emerald: #059669;
  --accent-navy: #1e293b;
  
  --card-shadow: 0 4px 16px rgba(0, 0, 0, 0.05);
  --card-shadow-hover: 0 12px 28px rgba(0, 0, 0, 0.1);
}

/* Theme: Midnight Dark */
body.theme-dark {
  --bg-main: #0c111d;
  --bg-card: #151d2e;
  --bg-card-subtle: #1c263c;
  --bg-sidebar: #111827;
  --bg-header: rgba(12, 17, 29, 0.94);
  --bg-input: #1b2438;
  --bg-hover: #26334f;
  --bg-overlay: rgba(0, 0, 0, 0.75);
  
  --text-primary: #f8fafc;
  --text-secondary: #cbd5e1;
  --text-muted: #94a3b8;
  
  --border-color: #26334f;
  --border-subtle: #1e2a42;
  --border-focus: #38bdf8;
  
  --accent-gold: #f59e0b;
  --accent-gold-dark: #d97706;
  --accent-gold-light: #2c2514;
  --accent-leather: #e2e8f0;
  --accent-crimson: #f87171;
  --accent-emerald: #34d399;
  --accent-navy: #60a5fa;
  
  --card-shadow: 0 4px 16px rgba(0, 0, 0, 0.35);
  --card-shadow-hover: 0 12px 30px rgba(0, 0, 0, 0.55);
}

/* Theme: Antique Sepia */
body.theme-sepia {
  --bg-main: #f4ecd8;
  --bg-card: #f9f5e9;
  --bg-card-subtle: #ece2c8;
  --bg-sidebar: #ece2c8;
  --bg-header: rgba(244, 236, 216, 0.94);
  --bg-input: #fdfaf3;
  --bg-hover: #dfd2b5;
  --bg-overlay: rgba(45, 34, 20, 0.65);
  
  --text-primary: #2d2214;
  --text-secondary: #534027;
  --text-muted: #796142;
  
  --border-color: #d8c7a2;
  --border-subtle: #e4d7b7;
  --border-focus: #9e6417;
  
  --accent-gold: #a66a1a;
  --accent-gold-dark: #84500c;
  --accent-gold-light: #fbeed2;
  --accent-leather: #6a3a0e;
  --accent-crimson: #912727;
  --accent-emerald: #226f49;
  --accent-navy: #203a5b;
}

/* Font Size Scales */
body.font-sm { --base-font-size: 15px; }
body.font-md { --base-font-size: 17px; }
body.font-lg { --base-font-size: 19px; }
body.font-xl { --base-font-size: 21px; }

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: var(--base-font-size);
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
}

body {
  font-family: var(--font-family);
  background-color: var(--bg-main);
  color: var(--text-primary);
  line-height: 1.75;
  transition: background-color var(--transition-normal), color var(--transition-normal);
  overflow-x: hidden;
}

h1, h2, h3, h4, h5, h6 {
  color: var(--text-primary);
  line-height: 1.35;
  font-weight: 700;
}

p {
  margin-bottom: 1.25rem;
  color: var(--text-secondary);
}

a {
  color: var(--accent-gold);
  text-decoration: none;
  transition: color var(--transition-fast);
}

a:hover {
  text-decoration: underline;
}

button {
  font-family: inherit;
  cursor: pointer;
  border: none;
  background: none;
  font-size: 0.95rem;
}

img {
  max-width: 100%;
  height: auto;
  display: block;
}

/* Reading Progress Bar */
.reading-progress-bar {
  position: fixed;
  top: 0;
  left: 0;
  width: 0%;
  height: 4px;
  background: linear-gradient(90deg, var(--accent-gold), var(--accent-crimson));
  z-index: 1000;
  transition: width 0.1s ease;
}

/* Header */
.site-header {
  position: sticky;
  top: 0;
  min-height: var(--header-height);
  background: var(--bg-header);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-color);
  z-index: 900;
  display: flex;
  align-items: center;
  padding: max(0.4rem, env(safe-area-inset-top, 0px)) 1.5rem 0.4rem;
  box-sizing: border-box;
}

.header-inner {
  width: 100%;
  max-width: 1440px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  min-width: 0;
}

.sidebar-toggle-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: var(--radius-md);
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  transition: background var(--transition-fast);
  flex-shrink: 0;
}

.sidebar-toggle-btn:hover {
  background: var(--bg-hover);
}

.site-logo {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  text-decoration: none;
  min-width: 0;
}

.logo-icon {
  width: 38px;
  height: 38px;
  min-width: 38px;
  background: linear-gradient(135deg, var(--accent-gold), var(--accent-leather));
  color: #fff;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: bold;
  font-size: 1.25rem;
  box-shadow: 0 2px 8px rgba(197, 155, 39, 0.3);
  flex-shrink: 0;
}

.logo-text-wrap {
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-width: 0;
}

.logo-title {
  font-size: 1.15rem;
  font-weight: 800;
  color: var(--text-primary);
  line-height: 1.18;
  white-space: nowrap;
}

.logo-subtitle {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--accent-gold);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  white-space: nowrap;
  line-height: 1.15;
}

/* Header Search */
.header-search {
  flex: 1;
  max-width: 440px;
  position: relative;
}

.search-input-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

.search-icon {
  position: absolute;
  left: 14px;
  color: var(--text-muted);
  pointer-events: none;
}

.search-input {
  width: 100%;
  padding: 0.65rem 2.5rem 0.65rem 2.6rem;
  border-radius: var(--radius-xl);
  border: 1px solid var(--border-color);
  background: var(--bg-input);
  color: var(--text-primary);
  font-size: 0.95rem;
  outline: none;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.search-input:focus {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px rgba(197, 155, 39, 0.18);
}

.search-clear-btn {
  position: absolute;
  right: 12px;
  color: var(--text-muted);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 4px;
  border-radius: 50%;
}

.search-clear-btn.active {
  display: flex;
}

/* Header Actions */
.header-actions {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.action-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 0.55rem 0.85rem;
  border-radius: var(--radius-md);
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  font-weight: 500;
  transition: all var(--transition-fast);
}

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

.action-btn.icon-only {
  width: 40px;
  height: 40px;
  padding: 0;
  border-radius: 50%;
}

.action-btn .badge-pill {
  background: var(--accent-crimson);
  color: #fff;
  font-size: 0.72rem;
  padding: 2px 7px;
  border-radius: 20px;
  font-weight: bold;
}

/* Theme Dropdown */
.theme-select-wrap {
  position: relative;
}

.theme-dropdown {
  position: absolute;
  top: 110%;
  right: 0;
  min-width: 170px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  box-shadow: var(--card-shadow-hover);
  padding: 0.5rem;
  display: none;
  flex-direction: column;
  gap: 0.35rem;
  z-index: 100;
}

.theme-dropdown.show {
  display: flex;
}

.theme-opt-btn {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.5rem 0.75rem;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  text-align: left;
  font-size: 0.88rem;
  width: 100%;
}

.theme-opt-btn:hover, .theme-opt-btn.active {
  background: var(--bg-hover);
  color: var(--text-primary);
  font-weight: 600;
}

.theme-dot {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 1px solid rgba(0,0,0,0.15);
}
.theme-dot.parchment { background: #fbf7ee; }
.theme-dot.light { background: #ffffff; }
.theme-dot.dark { background: #0c111d; }
.theme-dot.sepia { background: #f4ecd8; }

/* App Layout */
.app-container {
  display: flex;
  max-width: 1440px;
  margin: 0 auto;
  min-height: calc(100vh - var(--header-height));
  position: relative;
}

/* Sidebar */
.app-sidebar {
  width: var(--sidebar-width);
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border-color);
  padding: 1.5rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  position: sticky;
  top: var(--header-height);
  height: calc(100vh - var(--header-height));
  overflow-y: auto;
  flex-shrink: 0;
  transition: transform var(--transition-normal), width var(--transition-normal);
  z-index: 800;
}

.sidebar-section {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.sidebar-section-title {
  font-size: 0.76rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  padding: 0 0.6rem 0.4rem;
  border-bottom: 1px solid var(--border-subtle);
}

.nav-link {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.65rem 0.85rem;
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  font-size: 0.92rem;
  font-weight: 500;
  text-decoration: none;
  transition: all var(--transition-fast);
}

.nav-link:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
  text-decoration: none;
  transform: translateX(3px);
}

.nav-link.active {
  background: var(--bg-card);
  color: var(--accent-gold-dark);
  font-weight: 700;
  border-left: 4px solid var(--accent-gold);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

.nav-link .nav-badge {
  font-size: 0.72rem;
  padding: 2px 7px;
  border-radius: 12px;
  background: var(--bg-card-subtle);
  color: var(--text-muted);
}

.nav-link.active .nav-badge {
  background: var(--accent-gold-light);
  color: var(--accent-gold-dark);
}

/* Main Area */
.app-main {
  flex: 1;
  min-width: 0;
  padding: 2rem 2.5rem 5rem;
}

/* Hero Banner */
.hero-banner {
  background: linear-gradient(135deg, var(--bg-card) 0%, var(--bg-card-subtle) 100%);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-xl);
  padding: 2.75rem 2.25rem;
  margin-bottom: 2.5rem;
  position: relative;
  overflow: hidden;
  box-shadow: var(--card-shadow);
}

.hero-banner::before {
  content: "†";
  position: absolute;
  right: 2rem;
  top: 1rem;
  font-size: 14rem;
  line-height: 1;
  color: var(--accent-gold);
  opacity: 0.05;
  font-family: var(--font-serif);
  pointer-events: none;
}

.hero-tag {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  background: var(--accent-gold-light);
  color: var(--accent-gold-dark);
  font-size: 0.82rem;
  font-weight: 700;
  padding: 0.35rem 0.85rem;
  border-radius: 20px;
  margin-bottom: 1rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border: 1px solid rgba(197, 155, 39, 0.2);
}

.hero-title {
  font-size: 2.65rem;
  font-weight: 800;
  color: var(--text-primary);
  margin-bottom: 0.5rem;
  letter-spacing: -0.02em;
}

.hero-subtitle {
  font-size: 1.25rem;
  color: var(--text-secondary);
  font-weight: 500;
  margin-bottom: 1.25rem;
}

.hero-desc {
  font-size: 1.05rem;
  color: var(--text-muted);
  max-width: 820px;
  line-height: 1.8;
  margin-bottom: 2rem;
}

.hero-stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 1.25rem;
}

.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1.15rem 1rem;
  text-align: center;
  transition: transform var(--transition-fast), box-shadow var(--transition-fast);
}

.stat-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--card-shadow-hover);
}

.stat-val {
  font-size: 1.85rem;
  font-weight: 800;
  color: var(--accent-gold);
  line-height: 1.1;
  margin-bottom: 0.35rem;
}

.stat-label {
  font-size: 0.8rem;
  color: var(--text-secondary);
  font-weight: 600;
}

/* Filter Bar */
.filter-tabs-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
  margin-bottom: 2rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--border-color);
}

.filter-pills {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.filter-pill {
  padding: 0.5rem 1.1rem;
  border-radius: var(--radius-xl);
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  font-size: 0.88rem;
  font-weight: 600;
  transition: all var(--transition-fast);
}

.filter-pill:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.filter-pill.active {
  background: var(--accent-gold);
  border-color: var(--accent-gold);
  color: #fff;
  box-shadow: 0 3px 10px rgba(197, 155, 39, 0.3);
}

/* Epistles Cards Grid */
.epistles-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 1.5rem;
  margin-bottom: 3.5rem;
}

.epistle-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1.65rem;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  box-shadow: var(--card-shadow);
  transition: transform var(--transition-fast), box-shadow var(--transition-fast), border-color var(--transition-fast);
  cursor: pointer;
  position: relative;
  overflow: hidden;
}

.epistle-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--card-shadow-hover);
  border-color: var(--accent-gold);
}

.card-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 1rem;
}

.card-order-badge {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--bg-card-subtle);
  border: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--accent-gold);
}

.card-category-badge {
  font-size: 0.72rem;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: 12px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.badge-early { background: #e0f2fe; color: #0369a1; }
.badge-major { background: #fef3c7; color: #b45309; }
.badge-prison { background: #f3e8ff; color: #7e22ce; }
.badge-pastoral { background: #dcfce7; color: #15803d; }

.card-title-group {
  margin-bottom: 0.75rem;
}

.card-title {
  font-size: 1.45rem;
  font-weight: 800;
  color: var(--text-primary);
  margin-bottom: 0.2rem;
}

.card-subtitle {
  font-size: 0.9rem;
  color: var(--text-muted);
  font-weight: 500;
}

.card-meta-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1rem;
  font-size: 0.82rem;
  color: var(--text-secondary);
  margin-bottom: 1rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px dashed var(--border-subtle);
}

.card-meta-item {
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.card-summary {
  font-size: 0.92rem;
  color: var(--text-secondary);
  line-height: 1.65;
  margin-bottom: 1.25rem;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.card-key-verse {
  background: var(--bg-card-subtle);
  border-left: 3px solid var(--accent-gold);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  padding: 0.65rem 0.85rem;
  font-size: 0.82rem;
  font-style: italic;
  color: var(--text-primary);
  margin-bottom: 1.25rem;
  line-height: 1.55;
}

.card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: auto;
  padding-top: 0.75rem;
  border-top: 1px solid var(--border-subtle);
}

.card-read-link {
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--accent-gold);
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.card-read-link:hover {
  color: var(--accent-gold-dark);
}

/* Detailed Article View */
.epistle-article-container {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-xl);
  padding: 3rem 2.5rem;
  box-shadow: var(--card-shadow);
  margin-bottom: 3.5rem;
  position: relative;
}

.article-header {
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 2rem;
  margin-bottom: 2.5rem;
}

.article-top-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.5rem;
}

.back-to-list-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.45rem 0.9rem;
  border-radius: var(--radius-md);
  background: var(--bg-card-subtle);
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  font-size: 0.88rem;
  font-weight: 600;
  transition: all var(--transition-fast);
}

.back-to-list-btn:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.article-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.article-title {
  font-size: 2.45rem;
  font-weight: 800;
  color: var(--text-primary);
  margin-bottom: 0.35rem;
}

.article-subtitle {
  font-size: 1.2rem;
  color: var(--text-muted);
  margin-bottom: 1.25rem;
}

.article-meta-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 1.25rem;
  font-size: 0.9rem;
  color: var(--text-secondary);
  padding: 0.85rem 1.25rem;
  background: var(--bg-card-subtle);
  border-radius: var(--radius-md);
}

.article-meta-pill {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-weight: 500;
}

.article-key-verse-box {
  margin-top: 1.5rem;
  padding: 1.25rem 1.5rem;
  background: var(--accent-gold-light);
  border-left: 4px solid var(--accent-gold);
  border-radius: 0 var(--radius-md) var(--radius-md) 0;
  font-size: 1.05rem;
  line-height: 1.7;
  color: var(--text-primary);
}

.key-verse-label {
  font-size: 0.76rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--accent-gold-dark);
  margin-bottom: 0.35rem;
}

/* Article Body */
.article-body {
  font-size: 1.05rem;
  line-height: 1.85;
}

.article-subsection {
  margin-bottom: 2.75rem;
}

.subsection-title {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 1rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.subsection-title::before {
  content: "";
  display: inline-block;
  width: 6px;
  height: 1.2rem;
  background: var(--accent-gold);
  border-radius: 2px;
}

.article-subsection p {
  margin-bottom: 1.25rem;
}

/* Figure Container */
.figure-container {
  margin: 2rem 0;
  background: var(--bg-card-subtle);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--card-shadow);
}

.figure-img-wrap {
  position: relative;
  overflow: hidden;
  cursor: pointer;
  background: #111;
  display: flex;
  align-items: center;
  justify-content: center;
}

.figure-img {
  width: 100%;
  max-height: 520px;
  object-fit: contain;
  transition: transform var(--transition-normal);
}

.figure-img-wrap:hover .figure-img {
  transform: scale(1.02);
}

.figure-overlay-hint {
  position: absolute;
  bottom: 14px;
  right: 14px;
  background: rgba(0, 0, 0, 0.7);
  color: #fff;
  padding: 6px 12px;
  border-radius: 20px;
  font-size: 0.78rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 0.35rem;
  pointer-events: none;
  opacity: 0.9;
}

.figure-caption {
  padding: 1rem 1.25rem;
  border-top: 1px solid var(--border-color);
  background: var(--bg-card);
}

.figure-title {
  font-size: 0.98rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 0.25rem;
}

.figure-desc {
  font-size: 0.86rem;
  color: var(--text-muted);
  line-height: 1.5;
  margin-bottom: 0;
}

/* Timeline */
.timeline-section {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-xl);
  padding: 2.75rem 2.25rem;
  margin-bottom: 3.5rem;
  box-shadow: var(--card-shadow);
}

.section-header-wrap {
  margin-bottom: 2.5rem;
  text-align: center;
}

.section-tag {
  display: inline-block;
  background: var(--accent-gold-light);
  color: var(--accent-gold-dark);
  font-size: 0.78rem;
  font-weight: 700;
  padding: 0.3rem 0.8rem;
  border-radius: 16px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 0.6rem;
}

.section-main-title {
  font-size: 2.15rem;
  font-weight: 800;
  color: var(--text-primary);
  margin-bottom: 0.5rem;
}

.section-sub-desc {
  font-size: 1.05rem;
  color: var(--text-muted);
  max-width: 680px;
  margin: 0 auto;
}

.timeline-stepper {
  position: relative;
  max-width: 900px;
  margin: 0 auto;
  padding: 1rem 0;
}

.timeline-stepper::before {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  left: 28px;
  width: 3px;
  background: linear-gradient(180deg, var(--accent-gold), var(--accent-crimson));
  border-radius: 2px;
}

.timeline-step-item {
  position: relative;
  padding-left: 70px;
  margin-bottom: 2.5rem;
}

.timeline-marker {
  position: absolute;
  left: 14px;
  top: 4px;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--accent-gold);
  border: 4px solid var(--bg-card);
  box-shadow: 0 0 0 2px var(--accent-gold);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: bold;
  font-size: 0.82rem;
  z-index: 2;
}

.timeline-step-card {
  background: var(--bg-card-subtle);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1.5rem 1.75rem;
  box-shadow: var(--card-shadow);
  transition: transform var(--transition-fast), border-color var(--transition-fast);
}

.timeline-step-card:hover {
  transform: translateX(4px);
  border-color: var(--accent-gold);
}

.timeline-step-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 0.85rem;
}

.timeline-step-title {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text-primary);
}

.timeline-period-badge {
  font-size: 0.78rem;
  font-weight: 700;
  background: var(--accent-gold);
  color: #fff;
  padding: 3px 10px;
  border-radius: 12px;
}

.timeline-event-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.timeline-event-item {
  position: relative;
  padding-left: 1.25rem;
  font-size: 0.95rem;
  color: var(--text-secondary);
  line-height: 1.6;
}

.timeline-event-item::before {
  content: "•";
  position: absolute;
  left: 0;
  color: var(--accent-gold);
  font-size: 1.2rem;
  line-height: 1;
}

/* Quiz */
.quiz-section {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-xl);
  padding: 2.75rem 2.25rem;
  margin-bottom: 3.5rem;
  box-shadow: var(--card-shadow);
}

.quiz-card-box {
  max-width: 780px;
  margin: 0 auto;
  background: var(--bg-card-subtle);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 2rem 2.25rem;
  box-shadow: var(--card-shadow);
}

.quiz-progress-bar-wrap {
  width: 100%;
  height: 8px;
  background: var(--border-color);
  border-radius: 4px;
  margin-bottom: 1.5rem;
  overflow: hidden;
}

.quiz-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent-gold), var(--accent-emerald));
  width: 10%;
  transition: width var(--transition-normal);
}

.quiz-q-count {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 0.5rem;
}

.quiz-question-text {
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 1.75rem;
  line-height: 1.5;
}

.quiz-options-list {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  margin-bottom: 1.75rem;
}

.quiz-opt-btn {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.95rem 1.25rem;
  border-radius: var(--radius-md);
  background: var(--bg-card);
  border: 2px solid var(--border-color);
  color: var(--text-primary);
  font-size: 0.98rem;
  text-align: left;
  transition: all var(--transition-fast);
}

.quiz-opt-btn:hover:not(:disabled) {
  border-color: var(--accent-gold);
  background: var(--bg-hover);
  transform: translateX(3px);
}

.opt-letter-badge {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--bg-card-subtle);
  border: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.82rem;
  color: var(--text-secondary);
  flex-shrink: 0;
}

.quiz-opt-btn.correct {
  border-color: var(--accent-emerald);
  background: rgba(28, 116, 79, 0.1);
}

.quiz-opt-btn.correct .opt-letter-badge {
  background: var(--accent-emerald);
  color: #fff;
  border-color: var(--accent-emerald);
}

.quiz-opt-btn.wrong {
  border-color: var(--accent-crimson);
  background: rgba(139, 30, 42, 0.1);
}

.quiz-opt-btn.wrong .opt-letter-badge {
  background: var(--accent-crimson);
  color: #fff;
  border-color: var(--accent-crimson);
}

.quiz-feedback-box {
  margin-top: 1.5rem;
  padding: 1.25rem;
  border-radius: var(--radius-md);
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  display: none;
}

.quiz-feedback-box.show {
  display: block;
}

.feedback-status {
  font-size: 1.05rem;
  font-weight: 700;
  margin-bottom: 0.4rem;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.feedback-status.correct { color: var(--accent-emerald); }
.feedback-status.wrong { color: var(--accent-crimson); }

.feedback-expl {
  font-size: 0.92rem;
  color: var(--text-secondary);
  line-height: 1.6;
  margin-bottom: 0.5rem;
}

.feedback-ref {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--accent-gold);
}

.quiz-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 1.5rem;
}

.quiz-score-indicator {
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--text-muted);
}

.quiz-next-btn {
  padding: 0.65rem 1.5rem;
  background: var(--accent-gold);
  color: #fff;
  font-weight: 700;
  border-radius: var(--radius-md);
  transition: all var(--transition-fast);
  display: none;
}

.quiz-next-btn.show {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}

.quiz-next-btn:hover {
  background: var(--accent-gold-dark);
}

/* Quiz Final Score */
.quiz-final-summary {
  text-align: center;
  padding: 2rem 1rem;
  display: none;
}

.quiz-final-summary.show {
  display: block;
}

.final-trophy {
  font-size: 4rem;
  margin-bottom: 1rem;
}

.final-score-title {
  font-size: 2rem;
  font-weight: 800;
  color: var(--text-primary);
  margin-bottom: 0.5rem;
}

.final-score-text {
  font-size: 1.15rem;
  color: var(--text-secondary);
  margin-bottom: 2rem;
}

.restart-quiz-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1.8rem;
  background: var(--accent-gold);
  color: #fff;
  font-weight: 700;
  border-radius: var(--radius-md);
}

/* Gallery Section */
.gallery-section {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-xl);
  padding: 2.75rem 2.25rem;
  margin-bottom: 3.5rem;
  box-shadow: var(--card-shadow);
}

.gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 1.5rem;
}

.gallery-card {
  background: var(--bg-card-subtle);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--card-shadow);
  cursor: pointer;
  transition: transform var(--transition-fast), box-shadow var(--transition-fast);
}

.gallery-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--card-shadow-hover);
}

.gallery-thumb-wrap {
  height: 200px;
  background: #111;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

.gallery-thumb {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform var(--transition-normal);
}

.gallery-card:hover .gallery-thumb {
  transform: scale(1.05);
}

.gallery-info {
  padding: 1.1rem;
}

.gallery-tag {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--accent-gold-dark);
  text-transform: uppercase;
  margin-bottom: 0.35rem;
}

.gallery-card-title {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 0.35rem;
  line-height: 1.35;
}

.gallery-card-caption {
  font-size: 0.84rem;
  color: var(--text-muted);
  line-height: 1.5;
  margin-bottom: 0;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* Lightbox Modal */
.lightbox-modal {
  position: fixed;
  inset: 0;
  background: var(--bg-overlay);
  backdrop-filter: blur(8px);
  z-index: 2000;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  opacity: 0;
  transition: opacity var(--transition-normal);
}

.lightbox-modal.show {
  display: flex;
  opacity: 1;
}

.lightbox-content {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-xl);
  max-width: 1100px;
  width: 100%;
  max-height: 92vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: var(--modal-shadow);
  position: relative;
}

.lightbox-header {
  padding: 1rem 1.5rem;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.lightbox-title {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text-primary);
}

.lightbox-close-btn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--bg-card-subtle);
  color: var(--text-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background var(--transition-fast);
}

.lightbox-close-btn:hover {
  background: var(--bg-hover);
}

.lightbox-body {
  flex: 1;
  overflow-y: auto;
  padding: 1rem;
  background: #111;
  display: flex;
  align-items: center;
  justify-content: center;
}

.lightbox-full-img {
  max-width: 100%;
  max-height: 70vh;
  object-fit: contain;
  transition: transform var(--transition-fast);
}

.lightbox-footer {
  padding: 1.1rem 1.5rem;
  border-top: 1px solid var(--border-color);
  background: var(--bg-card);
}

.lightbox-caption-text {
  font-size: 0.95rem;
  color: var(--text-secondary);
  line-height: 1.6;
  margin-bottom: 0;
}

/* Notes & Bookmarks Drawer */
.notes-drawer-overlay {
  position: fixed;
  inset: 0;
  background: var(--bg-overlay);
  backdrop-filter: blur(4px);
  z-index: 1500;
  display: none;
  opacity: 0;
  transition: opacity var(--transition-normal);
}

.notes-drawer-overlay.show {
  display: block;
  opacity: 1;
}

.notes-drawer {
  position: fixed;
  top: 0;
  right: 0;
  width: 100%;
  max-width: 440px;
  height: 100vh;
  background: var(--bg-card);
  border-left: 1px solid var(--border-color);
  box-shadow: var(--modal-shadow);
  z-index: 1600;
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  transition: transform var(--transition-normal);
}

.notes-drawer.open {
  transform: translateX(0);
}

.drawer-header {
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.drawer-title {
  font-size: 1.25rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.drawer-close-btn {
  padding: 0.4rem;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
}

.drawer-close-btn:hover {
  color: var(--text-primary);
  background: var(--bg-hover);
}

.drawer-tabs {
  display: flex;
  border-bottom: 1px solid var(--border-color);
  background: var(--bg-card-subtle);
}

.drawer-tab-btn {
  flex: 1;
  padding: 0.85rem;
  font-weight: 600;
  font-size: 0.92rem;
  color: var(--text-secondary);
  border-bottom: 2px solid transparent;
  transition: all var(--transition-fast);
}

.drawer-tab-btn.active {
  color: var(--accent-gold);
  border-bottom-color: var(--accent-gold);
  background: var(--bg-card);
}

.drawer-body {
  flex: 1;
  overflow-y: auto;
  padding: 1.5rem;
}

.note-input-wrap {
  margin-bottom: 1.5rem;
}

.note-textarea {
  width: 100%;
  height: 120px;
  padding: 0.85rem;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  background: var(--bg-input);
  color: var(--text-primary);
  font-family: inherit;
  font-size: 0.92rem;
  resize: vertical;
  margin-bottom: 0.75rem;
  outline: none;
}

.note-textarea:focus {
  border-color: var(--border-focus);
}

.save-note-btn {
  width: 100%;
  padding: 0.65rem;
  background: var(--accent-gold);
  color: #fff;
  font-weight: 700;
  border-radius: var(--radius-md);
}

.notes-list {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.note-card {
  background: var(--bg-card-subtle);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1rem;
  position: relative;
}

.note-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.4rem;
}

.note-date {
  font-size: 0.76rem;
  color: var(--text-muted);
}

.note-delete-btn {
  color: var(--text-muted);
  font-size: 0.8rem;
}

.note-delete-btn:hover {
  color: var(--accent-crimson);
}

.note-text {
  font-size: 0.92rem;
  color: var(--text-secondary);
  line-height: 1.6;
  margin-bottom: 0;
}

/* Bookmarks List */
.bookmarks-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.bookmark-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 1rem;
  background: var(--bg-card-subtle);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
}

.bookmark-title {
  font-weight: 600;
  color: var(--text-primary);
  font-size: 0.95rem;
}

.bookmark-del-btn {
  color: var(--text-muted);
  padding: 4px;
}

.bookmark-del-btn:hover {
  color: var(--accent-crimson);
}

/* Empty State */
.empty-state {
  text-align: center;
  padding: 2.5rem 1rem;
  color: var(--text-muted);
}

.empty-icon {
  font-size: 2.5rem;
  margin-bottom: 0.75rem;
  opacity: 0.6;
}

/* Toast Notifications */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 3000;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  pointer-events: none;
}

.toast {
  background: var(--text-primary);
  color: var(--bg-card);
  padding: 0.8rem 1.25rem;
  border-radius: var(--radius-md);
  box-shadow: var(--modal-shadow);
  font-size: 0.9rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  animation: toastIn 0.3s ease forwards;
  pointer-events: auto;
}

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

/* Audio Player Bar */
.audio-player-bar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--bg-card);
  border-top: 1px solid var(--border-color);
  box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.1);
  padding: 0.75rem 1.5rem;
  z-index: 1000;
  display: none;
  align-items: center;
  justify-content: space-between;
  backdrop-filter: blur(10px);
}

.audio-player-bar.show {
  display: flex;
}

.audio-info {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.audio-icon-pulse {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--accent-gold);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.9rem;
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0% { box-shadow: 0 0 0 0 rgba(197, 155, 39, 0.6); }
  70% { box-shadow: 0 0 0 10px rgba(197, 155, 39, 0); }
  100% { box-shadow: 0 0 0 0 rgba(197, 155, 39, 0); }
}

.audio-text-title {
  font-weight: 700;
  font-size: 0.92rem;
  color: var(--text-primary);
}

.audio-text-subtitle {
  font-size: 0.78rem;
  color: var(--text-muted);
}

.audio-controls {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.audio-btn {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: var(--bg-card-subtle);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition-fast);
}

.audio-btn:hover {
  background: var(--accent-gold);
  color: #fff;
  border-color: var(--accent-gold);
}

/* Footer */
.site-footer {
  border-top: 1px solid var(--border-color);
  background: var(--bg-sidebar);
  padding: 3.5rem 1.5rem 3rem;
  text-align: center;
  color: var(--text-muted);
}

.footer-quote {
  font-size: 1.15rem;
  font-style: italic;
  color: var(--text-primary);
  max-width: 650px;
  margin: 0 auto 0.6rem;
  line-height: 1.55;
}

.footer-verse {
  font-weight: 700;
  color: var(--accent-gold);
  margin-bottom: 1.25rem;
  font-size: 0.95rem;
  letter-spacing: 0.5px;
}

.footer-author-notice {
  font-size: 0.9rem;
  color: var(--text-secondary);
  margin-bottom: 0.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  align-items: center;
}

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

.footer-author-tamil {
  font-size: 0.82rem;
  color: var(--text-muted);
}

.footer-copy {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-top: 0.5rem;
  opacity: 0.85;
}

/* Responsive */
@media (max-width: 1024px) {
  :root {
    --sidebar-width: 260px;
  }
  .app-main {
    padding: 1.5rem 1.5rem 4rem;
  }
  .hero-title {
    font-size: 2.25rem;
  }
}

@media (max-width: 820px) {
  .app-sidebar {
    position: fixed;
    top: var(--header-height);
    left: 0;
    bottom: 0;
    transform: translateX(-100%);
    box-shadow: var(--modal-shadow);
  }
  .app-sidebar.open {
    transform: translateX(0);
  }
  .hero-title {
    font-size: 1.85rem;
  }
  .epistle-article-container {
    padding: 2rem 1.5rem;
  }
  .article-title {
    font-size: 1.95rem;
  }
}

@media (max-width: 560px) {
  .header-search {
    display: none;
  }
  .header-search.mobile-open {
    display: block;
    position: absolute;
    top: var(--header-height);
    left: 0;
    right: 0;
    background: var(--bg-card);
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--border-color);
    box-shadow: var(--card-shadow);
  }
  .hero-stats-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .timeline-step-item {
    padding-left: 55px;
  }
  .timeline-stepper::before {
    left: 20px;
  }
  .timeline-marker {
    left: 8px;
    width: 26px;
    height: 26px;
  }
}

@media print {
  body {
    background: #fff !important;
    color: #000 !important;
    font-size: 12pt !important;
  }
  .site-header,
  .app-sidebar,
  .reading-progress-bar,
  .header-actions,
  .filter-tabs-bar,
  .audio-player-bar,
  .notes-drawer,
  .quiz-section,
  .gallery-section,
  .lightbox-modal,
  .toast-container {
    display: none !important;
  }
  .app-container {
    display: block !important;
  }
  .app-main {
    padding: 0 !important;
    max-width: 100% !important;
  }
  .epistle-article-container {
    box-shadow: none !important;
    border: none !important;
    padding: 0 !important;
    page-break-after: always;
  }
  .figure-container {
    page-break-inside: avoid;
  }
}

/* ==========================================================================
   Virtual World Experience (3D மெய்நிகர் உலகம்) Styles
   ========================================================================== */

/* Experience Mode Switcher */
.mode-switcher-bar {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-xl);
  padding: 3px;
}

.mode-toggle-btn {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 1rem;
  border-radius: var(--radius-xl);
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--text-secondary);
  transition: all var(--transition-fast);
}

.mode-toggle-btn:hover {
  color: var(--text-primary);
  background: var(--bg-hover);
}

.mode-toggle-btn.active {
  background: var(--accent-gold);
  color: #fff;
  box-shadow: 0 3px 10px rgba(197, 155, 39, 0.35);
}

/* Virtual World Container */
.virtual-world-container {
  position: relative;
  width: 100%;
  height: calc(100vh - var(--header-height));
  background: #000;
  overflow: hidden;
  display: none;
}

.virtual-world-container.active {
  display: block;
}

#virtualWorldCanvas {
  width: 100%;
  height: 100%;
  display: block;
  cursor: grab;
}

#virtualWorldCanvas:active {
  cursor: grabbing;
}

/* World HUD Overlays */
.world-hud-top-left {
  position: absolute;
  top: 1.5rem;
  left: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  z-index: 50;
}

.world-hud-badge {
  background: rgba(20, 16, 12, 0.82);
  backdrop-filter: blur(12px);
  border: 1px solid rgba(197, 155, 39, 0.4);
  padding: 0.85rem 1.25rem;
  border-radius: var(--radius-lg);
  color: #fff;
  box-shadow: 0 10px 25px rgba(0,0,0,0.5);
}

.world-hud-title {
  font-size: 1.25rem;
  font-weight: 800;
  color: #fef08a;
  margin-bottom: 0.15rem;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.world-hud-desc {
  font-size: 0.82rem;
  color: #d1d5db;
  margin-bottom: 0;
}

/* World Atmosphere & Sound Controls */
.world-hud-top-right {
  position: absolute;
  top: 1.5rem;
  right: 1.5rem;
  display: flex;
  align-items: center;
  gap: 0.6rem;
  z-index: 50;
  flex-wrap: wrap;
}

.hud-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.55rem 0.95rem;
  border-radius: var(--radius-xl);
  background: rgba(20, 16, 12, 0.82);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: #fff;
  font-size: 0.84rem;
  font-weight: 600;
  transition: all var(--transition-fast);
}

.hud-btn:hover {
  background: rgba(197, 155, 39, 0.4);
  border-color: var(--accent-gold);
  transform: translateY(-2px);
}

.hud-btn.active {
  background: var(--accent-gold);
  border-color: var(--accent-gold);
  color: #000;
  font-weight: 800;
  box-shadow: 0 4px 14px rgba(197, 155, 39, 0.4);
}

.hud-group {
  display: flex;
  background: rgba(20, 16, 12, 0.82);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: var(--radius-xl);
  padding: 3px;
}

.atmo-btn {
  padding: 0.45rem 0.8rem;
  border-radius: var(--radius-xl);
  font-size: 0.8rem;
  font-weight: 600;
  color: #cbd5e1;
  transition: all var(--transition-fast);
}

.atmo-btn:hover {
  color: #fff;
}

.atmo-btn.active {
  background: rgba(255, 255, 255, 0.25);
  color: #fff;
  font-weight: 700;
}

/* Journey Selector Toolbar (Bottom) */
.world-journey-toolbar {
  position: absolute;
  bottom: 2rem;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(15, 23, 42, 0.88);
  backdrop-filter: blur(14px);
  border: 1px solid rgba(197, 155, 39, 0.4);
  border-radius: var(--radius-xl);
  padding: 0.5rem 0.75rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  z-index: 50;
  max-width: 94vw;
  overflow-x: auto;
  box-shadow: 0 16px 36px rgba(0, 0, 0, 0.6);
}

.journey-tab-btn {
  white-space: nowrap;
  padding: 0.55rem 0.95rem;
  border-radius: var(--radius-lg);
  color: #e2e8f0;
  font-size: 0.84rem;
  font-weight: 600;
  transition: all var(--transition-fast);
}

.journey-tab-btn:hover {
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
}

.journey-tab-btn.active {
  background: linear-gradient(135deg, var(--accent-gold), #b45309);
  color: #fff;
  font-weight: 700;
  box-shadow: 0 2px 10px rgba(197, 155, 39, 0.4);
}

.journey-ctrl-btn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--accent-gold);
  color: #000;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: bold;
  font-size: 0.95rem;
  flex-shrink: 0;
  transition: transform var(--transition-fast);
}

.journey-ctrl-btn:hover {
  transform: scale(1.1);
}

/* World City Details Pop-up Card */
.world-city-card {
  position: absolute;
  bottom: 6.5rem;
  right: 2rem;
  width: 360px;
  background: rgba(15, 23, 42, 0.92);
  backdrop-filter: blur(16px);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: var(--radius-xl);
  padding: 1.5rem;
  color: #fff;
  box-shadow: 0 20px 45px rgba(0, 0, 0, 0.7);
  z-index: 60;
  display: none;
  transform: translateY(20px);
  opacity: 0;
  transition: all 0.3s ease;
}

.world-city-card.show {
  display: block;
  transform: translateY(0);
  opacity: 1;
}

.world-card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  border-left: 4px solid var(--accent-gold);
  padding-left: 0.75rem;
  margin-bottom: 0.85rem;
}

.world-card-tag {
  font-size: 0.72rem;
  font-weight: 700;
  color: #fef08a;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.world-card-title {
  font-size: 1.35rem;
  font-weight: 800;
  color: #fff;
  line-height: 1.2;
}

.world-card-subtitle {
  font-size: 0.85rem;
  color: #94a3b8;
}

.world-card-close {
  color: #94a3b8;
  font-size: 1.1rem;
  padding: 2px 6px;
  border-radius: 50%;
}

.world-card-close:hover {
  color: #fff;
}

.world-card-desc {
  font-size: 0.88rem;
  color: #cbd5e1;
  line-height: 1.6;
  margin-bottom: 1rem;
}

.world-card-epistles {
  margin-bottom: 1.25rem;
}

.world-card-epistles strong {
  font-size: 0.82rem;
  color: #94a3b8;
  display: block;
  margin-bottom: 0.4rem;
}

.city-epistles-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.city-epistle-chip {
  background: rgba(197, 155, 39, 0.25);
  border: 1px solid var(--accent-gold);
  color: #fef08a;
  font-size: 0.78rem;
  font-weight: 700;
  padding: 3px 9px;
  border-radius: 12px;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.city-epistle-chip:hover {
  background: var(--accent-gold);
  color: #000;
}

.world-card-actions {
  display: flex;
  gap: 0.5rem;
}

.world-card-btn {
  flex: 1;
  padding: 0.6rem;
  border-radius: var(--radius-md);
  font-size: 0.84rem;
  font-weight: 700;
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  transition: all var(--transition-fast);
}

.world-card-btn:hover {
  background: rgba(255, 255, 255, 0.22);
}

.world-card-btn.primary {
  background: var(--accent-gold);
  color: #000;
}

.world-card-btn.primary:hover {
  background: #facc15;
}

/* Journey Overview Card */
.world-journey-card {
  position: absolute;
  top: 6.5rem;
  left: 1.5rem;
  max-width: 420px;
  background: rgba(15, 23, 42, 0.92);
  backdrop-filter: blur(14px);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  color: #fff;
  box-shadow: 0 16px 36px rgba(0,0,0,0.6);
  z-index: 55;
  display: none;
}

.world-journey-card.show {
  display: block;
}

.journey-card-top {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin-bottom: 0.4rem;
}

.journey-card-badge {
  font-size: 0.72rem;
  font-weight: 800;
  padding: 2px 8px;
  border-radius: 10px;
  color: #fff;
}

.journey-card-title {
  font-size: 1.1rem;
  font-weight: 800;
  color: #fff;
}

.journey-card-desc {
  font-size: 0.85rem;
  color: #cbd5e1;
  line-height: 1.55;
  margin-bottom: 0.85rem;
}

.journey-route-steps {
  font-size: 0.78rem;
  color: #facc15;
  line-height: 1.8;
}

.journey-step-chip {
  background: rgba(255, 255, 255, 0.12);
  padding: 2px 7px;
  border-radius: 6px;
  cursor: pointer;
  color: #fff;
  font-weight: 600;
}

.journey-step-chip:hover {
  background: var(--accent-gold);
  color: #000;
}

/* Scriptorium Modal (பவுலின் எழுத்துக்கூடம்) */
.scriptorium-modal {
  position: fixed;
  inset: 0;
  background: rgba(10, 7, 5, 0.88);
  backdrop-filter: blur(12px);
  z-index: 2500;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
}

.scriptorium-modal.show {
  display: flex;
}

.scriptorium-chamber {
  background: radial-gradient(circle at top, #2c1a0e 0%, #150c06 100%);
  border: 2px solid #b8860b;
  border-radius: var(--radius-xl);
  max-width: 1200px;
  width: 100%;
  max-height: 92vh;
  box-shadow: 0 25px 60px rgba(0, 0, 0, 0.9);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  position: relative;
}

.scriptorium-chamber::before {
  content: ;
  position: absolute;
  top: 0; left: 0; right: 0; height: 6px;
  background: linear-gradient(90deg, #b8860b, #e11d48, #b8860b);
}

.scriptorium-header {
  padding: 1.5rem 2rem;
  border-bottom: 1px solid rgba(184, 134, 11, 0.3);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.scriptorium-title-group h2 {
  font-size: 1.85rem;
  font-weight: 800;
  color: #fef08a;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.scriptorium-title-group p {
  font-size: 0.92rem;
  color: #d1b18a;
  margin-bottom: 0;
}

.scriptorium-close-btn {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.1);
  color: #fef08a;
  font-size: 1.25rem;
  display: flex;
  align-items: center;
  justify-content: center;
}

.scriptorium-close-btn:hover {
  background: rgba(184, 134, 11, 0.4);
}

.scriptorium-scrolls-grid {
  flex: 1;
  overflow-y: auto;
  padding: 2rem;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 1.75rem;
}

/* Ancient Papyrus Scroll Card */
.ancient-scroll-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  cursor: pointer;
  transition: transform var(--transition-fast);
}

.ancient-scroll-card:hover {
  transform: translateY(-8px);
}

.scroll-rod-top, .scroll-rod-bottom {
  width: 92%;
  height: 12px;
  background: linear-gradient(90deg, #503117, #a0683a, #503117);
  border-radius: 6px;
  box-shadow: 0 3px 8px rgba(0,0,0,0.5);
  border: 1px solid #c99347;
}

.scroll-papyrus-body {
  width: 85%;
  background: #f6ecdc;
  border-left: 2px solid #d8c3a5;
  border-right: 2px solid #d8c3a5;
  padding: 1.5rem 1.25rem;
  box-shadow: 0 8px 20px rgba(0,0,0,0.3);
  text-align: center;
  position: relative;
  transition: all var(--transition-fast);
}

.ancient-scroll-card:hover .scroll-papyrus-body {
  background: #fff8eb;
  box-shadow: 0 14px 28px rgba(184, 134, 11, 0.35);
}

.scroll-seal {
  position: absolute;
  top: -10px;
  right: 14px;
  width: 26px;
  height: 26px;
  background: #8b1e2a; /* Red sealing wax */
  border-radius: 50%;
  color: #fff;
  font-weight: bold;
  font-size: 0.8rem;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 6px rgba(0,0,0,0.4);
}

.scroll-order {
  font-size: 0.76rem;
  font-weight: 800;
  color: #a16207;
  letter-spacing: 0.05em;
  margin-bottom: 0.25rem;
}

.scroll-title {
  font-size: 1.35rem;
  font-weight: 800;
  color: #2b1f14;
  margin-bottom: 0.2rem;
}

.scroll-greek {
  font-size: 0.85rem;
  color: #785a3c;
  font-weight: 600;
  margin-bottom: 0.6rem;
}

.scroll-date {
  font-size: 0.78rem;
  color: #8c6d48;
  margin-bottom: 0.65rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px dashed #d5c3aa;
}

.scroll-theme {
  font-size: 0.82rem;
  color: #4a3825;
  font-style: italic;
  line-height: 1.45;
  margin-bottom: 0.85rem;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.scroll-open-action {
  font-size: 0.82rem;
  font-weight: 800;
  color: #8b1e2a;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

/* Virtual World Mobile Responsive */
@media (max-width: 768px) {
  .world-hud-top-left {
    top: 1rem;
    left: 1rem;
  }
  .world-hud-badge {
    padding: 0.6rem 0.9rem;
  }
  .world-hud-title {
    font-size: 1.05rem;
  }
  .world-hud-top-right {
    top: 1rem;
    right: 1rem;
  }
  .world-city-card {
    left: 1rem;
    right: 1rem;
    bottom: 5.5rem;
    width: auto;
  }
  .world-journey-toolbar {
    bottom: 1rem;
    padding: 0.4rem 0.6rem;
  }
}

/* ==========================================================================
   Real Geographic Map & Historical GIS Engine (உண்மை வரைபடம்) Styles
   ========================================================================== */
.real-map-container {
  position: relative;
  width: 100%;
  height: calc(100vh - var(--header-height));
  background: #0f172a;
  overflow: hidden;
  display: none;
}

.real-map-container.active {
  display: block;
}

#realMapCanvas {
  width: 100%;
  height: 100%;
  display: block;
  cursor: grab;
}

#realMapCanvas:active {
  cursor: grabbing;
}

/* Real Map Top-Left HUD */
.real-map-hud-top-left {
  position: absolute;
  top: 1.5rem;
  left: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  z-index: 50;
  max-width: 440px;
  pointer-events: none;
}

.real-map-badge {
  pointer-events: auto;
  background: rgba(15, 23, 42, 0.88);
  backdrop-filter: blur(14px);
  border: 1px solid rgba(197, 155, 39, 0.45);
  padding: 0.85rem 1.25rem;
  border-radius: var(--radius-lg);
  color: #fff;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5);
}

.real-map-title {
  font-size: 1.25rem;
  font-weight: 800;
  color: #fef08a;
  margin-bottom: 0.2rem;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.real-map-desc {
  font-size: 0.82rem;
  color: #cbd5e1;
  margin-bottom: 0;
  line-height: 1.45;
}

.real-distance-hud {
  pointer-events: auto;
  background: rgba(15, 23, 42, 0.92);
  backdrop-filter: blur(14px);
  border: 1px solid rgba(197, 155, 39, 0.5);
  border-left: 4px solid var(--accent-gold);
  padding: 0.75rem 1.1rem;
  border-radius: var(--radius-md);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.5);
}

/* Real Map Top-Right HUD */
.real-map-hud-top-right {
  position: absolute;
  top: 1.5rem;
  right: 1.5rem;
  display: flex;
  align-items: center;
  gap: 0.6rem;
  z-index: 50;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.map-style-group {
  display: flex;
  background: rgba(15, 23, 42, 0.88);
  backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: var(--radius-xl);
  padding: 3px;
  gap: 3px;
}

.map-style-btn {
  padding: 0.45rem 0.85rem;
  border-radius: var(--radius-xl);
  font-size: 0.82rem;
  font-weight: 700;
  color: #cbd5e1;
  transition: all var(--transition-fast);
}

.map-style-btn:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.12);
}

.map-style-btn.active {
  background: linear-gradient(135deg, var(--accent-gold), #b45309);
  color: #fff;
  box-shadow: 0 2px 10px rgba(197, 155, 39, 0.4);
}

.real-layers-group {
  display: flex;
  background: rgba(15, 23, 42, 0.88);
  backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: var(--radius-xl);
  padding: 3px 6px;
  gap: 4px;
}

.layer-toggle-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.4rem 0.7rem;
  font-size: 0.78rem;
  font-weight: 600;
  color: #cbd5e1;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all var(--transition-fast);
  user-select: none;
}

.layer-toggle-chip:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
}

.layer-toggle-chip input[type="checkbox"] {
  accent-color: var(--accent-gold);
  cursor: pointer;
}

/* Real Map Journey Selector Toolbar (Bottom) */
.real-journey-toolbar {
  position: absolute;
  bottom: 2rem;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(15, 23, 42, 0.92);
  backdrop-filter: blur(14px);
  border: 1px solid rgba(197, 155, 39, 0.45);
  border-radius: var(--radius-xl);
  padding: 0.5rem 0.75rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  z-index: 50;
  max-width: 94vw;
  overflow-x: auto;
  box-shadow: 0 16px 36px rgba(0, 0, 0, 0.6);
}

.real-journey-btn {
  white-space: nowrap;
  padding: 0.55rem 0.95rem;
  border-radius: var(--radius-lg);
  color: #e2e8f0;
  font-size: 0.84rem;
  font-weight: 600;
  transition: all var(--transition-fast);
}

.real-journey-btn:hover {
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
}

.real-journey-btn.active {
  background: linear-gradient(135deg, var(--accent-gold), #b45309);
  color: #fff;
  font-weight: 700;
  box-shadow: 0 2px 10px rgba(197, 155, 39, 0.4);
}

/* Archaeological & Biblical Intelligence Slide-in Drawer */
.archaeological-drawer {
  position: absolute;
  top: 1.5rem;
  right: 1.5rem;
  width: 440px;
  max-height: calc(100% - 3rem);
  background: rgba(15, 23, 42, 0.96);
  backdrop-filter: blur(20px);
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: var(--radius-xl);
  box-shadow: 0 25px 50px rgba(0, 0, 0, 0.8);
  z-index: 65;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transform: translateX(110%);
  opacity: 0;
  pointer-events: none;
  transition: transform 0.35s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.35s ease;
}

.archaeological-drawer.show {
  transform: translateX(0);
  opacity: 1;
  pointer-events: auto;
}

.arch-drawer-header {
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
  background: rgba(0, 0, 0, 0.25);
}

.arch-tag {
  font-size: 0.72rem;
  font-weight: 700;
  color: #fef08a;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  display: block;
  margin-bottom: 0.25rem;
}

.arch-title {
  font-size: 1.45rem;
  font-weight: 800;
  color: #fff;
  line-height: 1.2;
  margin-bottom: 0.2rem;
}

.arch-subtitle {
  font-size: 0.85rem;
  color: #94a3b8;
}

.arch-close-btn {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.1);
  color: #94a3b8;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  flex-shrink: 0;
  transition: all var(--transition-fast);
}

.arch-close-btn:hover {
  background: rgba(255, 255, 255, 0.2);
  color: #fff;
}

.arch-drawer-body {
  padding: 1.5rem;
  overflow-y: auto;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.arch-section {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.arch-section-title {
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--accent-gold);
  text-transform: uppercase;
  letter-spacing: 0.03em;
  margin-bottom: 0.2rem;
}

.arch-text {
  font-size: 0.9rem;
  color: #e2e8f0;
  line-height: 1.6;
  margin-bottom: 0;
}

.arch-discovery-card {
  background: rgba(180, 83, 9, 0.18);
  border: 1px solid rgba(245, 158, 11, 0.35);
  border-radius: var(--radius-md);
  padding: 0.9rem 1rem;
}

/* Real Map Mobile Responsiveness */
@media (max-width: 768px) {
  .real-map-hud-top-left {
    top: 0.75rem;
    left: 0.75rem;
    right: 0.75rem;
    max-width: none;
  }
  .real-map-hud-top-right {
    top: auto;
    bottom: 5.5rem;
    left: 0.75rem;
    right: 0.75rem;
    justify-content: center;
  }
  .archaeological-drawer {
    top: auto;
    bottom: 0;
    left: 0;
    right: 0;
    width: 100%;
    max-height: 75vh;
    border-radius: var(--radius-xl) var(--radius-xl) 0 0;
    transform: translateY(110%);
  }
  .archaeological-drawer.show {
    transform: translateY(0);
  }
  .real-journey-toolbar {
    bottom: 1rem;
    padding: 0.35rem 0.5rem;
  }
  .map-style-group, .real-layers-group {
    padding: 2px;
  }
  .map-style-btn {
    padding: 0.35rem 0.6rem;
    font-size: 0.75rem;
  }
}

/* ==========================================================================
   Leaflet Google Earth Satellite GIS Styles
   ========================================================================== */
#realLeafletMap {
  width: 100%;
  height: 100%;
  background: #020617;
}

/* Custom Pin Markers */
.custom-real-map-pin {
  background: transparent !important;
  border: none !important;
}

.pin-marker {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  transform: translate(-50%, -50%);
  cursor: pointer;
}

.pin-dot {
  width: 15px;
  height: 15px;
  background: var(--pin-color, #e11d48);
  border: 2.5px solid #ffffff;
  border-radius: 50%;
  box-shadow: 0 0 12px rgba(0, 0, 0, 0.9);
  z-index: 2;
  transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.pin-marker:hover .pin-dot {
  transform: scale(1.4);
  border-color: #fef08a;
}

.pin-pulse {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 32px;
  height: 32px;
  margin-top: -16px;
  margin-left: -16px;
  background: var(--pin-color, #e11d48);
  opacity: 0.5;
  border-radius: 50%;
  animation: pinPulseAnimation 2s infinite cubic-bezier(0.25, 1, 0.5, 1);
  pointer-events: none;
}

@keyframes pinPulseAnimation {
  0% { transform: scale(0.4); opacity: 0.9; }
  100% { transform: scale(2.6); opacity: 0; }
}

.pin-label {
  margin-top: 5px;
  background: rgba(15, 23, 42, 0.88);
  backdrop-filter: blur(6px);
  color: #ffffff;
  font-size: 11px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 4px;
  border: 1px solid rgba(255, 255, 255, 0.35);
  white-space: nowrap;
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.7);
  pointer-events: none;
  letter-spacing: 0.02em;
}

/* Moving Traveler Marker */
.traveler-marker {
  background: transparent !important;
  border: none !important;
}

.traveler-pulse {
  background: #dc2626;
  color: #fff;
  border: 2px solid #fff;
  border-radius: 20px;
  padding: 3px 9px;
  font-size: 12px;
  font-weight: 800;
  box-shadow: 0 0 16px rgba(220, 38, 38, 0.95);
  display: flex;
  align-items: center;
  gap: 4px;
  white-space: nowrap;
  transform: translate(-50%, -50%);
  animation: travelerBounce 1.2s infinite alternate ease-in-out;
}

@keyframes travelerBounce {
  0% { transform: translate(-50%, -50%) translateY(0); }
  100% { transform: translate(-50%, -50%) translateY(-5px); }
}

/* Leaflet Popup Customization */
.leaflet-popup-content-wrapper {
  background: rgba(15, 23, 42, 0.96) !important;
  backdrop-filter: blur(16px);
  border: 1px solid rgba(255, 255, 255, 0.2) !important;
  border-radius: var(--radius-lg) !important;
  color: #f1f5f9 !important;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.75) !important;
  padding: 0 !important;
}

.leaflet-popup-content {
  margin: 1rem !important;
  line-height: 1.5 !important;
}

.leaflet-popup-tip {
  background: rgba(15, 23, 42, 0.96) !important;
}

.leaflet-container a.leaflet-popup-close-button {
  color: #94a3b8 !important;
  padding: 8px !important;
}

.leaflet-container a.leaflet-popup-close-button:hover {
  color: #fff !important;
}

/* ==========================================================================
   EXECUTIVE WELCOME PORTAL STYLES (Professional & Scholarly)
   ========================================================================== */
.welcome-portal {
  display: flex;
  flex-direction: column;
  gap: 2.75rem;
  padding: 0.5rem 0 3rem;
  width: 100%;
}

/* Welcome Hero */
.welcome-hero {
  background: linear-gradient(145deg, var(--bg-card), var(--bg-card-subtle));
  border: 1px solid var(--border-color);
  border-radius: var(--radius-xl);
  padding: 3rem 2.5rem;
  text-align: center;
  position: relative;
  overflow: hidden;
  box-shadow: var(--card-shadow);
}

.welcome-hero::before {
  content: '';
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 60%;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--accent-gold), transparent);
}

.welcome-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.35rem 1rem;
  border-radius: 9999px;
  background: rgba(197, 155, 39, 0.1);
  border: 1px solid rgba(197, 155, 39, 0.3);
  color: var(--accent-gold-dark);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  margin-bottom: 1.25rem;
}

.welcome-title {
  font-family: var(--font-serif);
  font-size: 2.6rem;
  font-weight: 800;
  color: var(--text-primary);
  line-height: 1.15;
  margin-bottom: 0.5rem;
  letter-spacing: -0.02em;
}

.welcome-subtitle {
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--accent-gold-dark);
  margin-bottom: 1.25rem;
  line-height: 1.4;
}

.welcome-lead {
  font-size: 1.05rem;
  line-height: 1.7;
  color: var(--text-secondary);
  max-width: 820px;
  margin: 0 auto;
}

/* Section Header */
.welcome-section-header {
  margin-bottom: 1.25rem;
}

.welcome-section-title {
  font-family: var(--font-serif);
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 0.25rem;
}

.welcome-section-subtitle {
  font-size: 0.88rem;
  color: var(--text-muted);
  margin-bottom: 0;
}

/* Experience Gateways Grid */
.portal-gateways-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.25rem;
}

.portal-gateway-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-xl);
  padding: 1.75rem;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  cursor: pointer;
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  box-shadow: var(--card-shadow);
  position: relative;
}

.portal-gateway-card:hover {
  transform: translateY(-4px);
  border-color: var(--accent-gold);
  box-shadow: 0 12px 30px rgba(197, 155, 39, 0.15);
}

.portal-gateway-card.active-gateway {
  border-color: rgba(197, 155, 39, 0.6);
  background: linear-gradient(170deg, var(--bg-card), var(--bg-card-subtle));
}

.gateway-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.25rem;
}

.gateway-icon-badge {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-lg);
  background: rgba(197, 155, 39, 0.12);
  border: 1px solid rgba(197, 155, 39, 0.3);
  color: var(--accent-gold-dark);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
}

.gateway-status-pill {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 0.25rem 0.65rem;
  border-radius: 9999px;
  background: rgba(16, 185, 129, 0.12);
  border: 1px solid rgba(16, 185, 129, 0.35);
  color: #059669;
}

.gateway-badge-accent {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 0.25rem 0.65rem;
  border-radius: 9999px;
  background: rgba(197, 155, 39, 0.1);
  border: 1px solid rgba(197, 155, 39, 0.25);
  color: var(--accent-gold-dark);
}

.gateway-card-title {
  font-family: var(--font-serif);
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 0.5rem;
}

.gateway-card-desc {
  font-size: 0.88rem;
  line-height: 1.6;
  color: var(--text-secondary);
  margin-bottom: 1.25rem;
  flex: 1;
}

.gateway-action-link {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.86rem;
  font-weight: 700;
  color: var(--accent-gold-dark);
  margin-top: auto;
  transition: gap 0.2s ease;
}

.portal-gateway-card:hover .gateway-action-link {
  gap: 0.65rem;
}

/* Executive Metrics Bar */
.executive-metrics-bar {
  display: flex;
  align-items: center;
  justify-content: space-around;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-xl);
  padding: 1.5rem 1.75rem;
  box-shadow: var(--card-shadow);
  flex-wrap: wrap;
  gap: 1rem;
}

.metric-block {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

.metric-num {
  font-family: var(--font-serif);
  font-size: 1.75rem;
  font-weight: 800;
  color: var(--accent-gold-dark);
  line-height: 1.1;
  margin-bottom: 0.2rem;
}

.metric-title {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 0.15rem;
}

.metric-sub {
  font-size: 0.74rem;
  color: var(--text-muted);
}

.metric-divider {
  width: 1px;
  height: 40px;
  background: var(--border-color);
}

/* Pathways Section */
.welcome-pathways-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1.15rem;
}

.pathway-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1.35rem;
  display: flex;
  flex-direction: column;
  cursor: pointer;
  transition: all 0.2s ease;
}

.pathway-card:hover {
  transform: translateY(-3px);
  border-color: var(--accent-gold);
  box-shadow: var(--card-shadow-hover);
}

.pathway-icon {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-md);
  background: rgba(197, 155, 39, 0.12);
  color: var(--accent-gold-dark);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 0.85rem;
}

.pathway-body {
  display: flex;
  flex-direction: column;
  flex: 1;
}

.pathway-title {
  font-size: 0.98rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 0.45rem;
}

.pathway-desc {
  font-size: 0.82rem;
  line-height: 1.55;
  color: var(--text-secondary);
  margin-bottom: 0.85rem;
  flex: 1;
}

.pathway-link {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--accent-gold-dark);
  margin-top: auto;
}

/* Epistles Directory Section */
.epistles-directory-section {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.directory-header-row {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
}

/* Responsive adjustments */
@media (max-width: 1100px) {
  .portal-gateways-grid {
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  }
  .welcome-pathways-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 768px) {
  .welcome-hero {
    padding: 2rem 1.25rem;
  }
  .welcome-title {
    font-size: 2rem;
  }
  .welcome-subtitle {
    font-size: 1.1rem;
  }
  .portal-gateways-grid {
    grid-template-columns: 1fr;
  }
  .welcome-pathways-grid {
    grid-template-columns: 1fr;
  }
  .metric-divider {
    display: none;
  }
  .executive-metrics-bar {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1.25rem;
  }
}

/* ==========================================================================
   PORTAL AUTHENTICATION GATE (Password: Jseeds)
   ========================================================================== */
html.portal-locked body {
  overflow: hidden !important;
  height: 100vh !important;
}

.auth-gate-overlay {
  position: fixed;
  inset: 0;
  z-index: 100000;
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(circle at center, rgba(30, 41, 59, 0.98), rgba(10, 14, 23, 0.99));
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  padding: 1.5rem;
  transition: opacity 0.35s ease, visibility 0.35s ease;
}

.auth-gate-overlay.unlocking {
  opacity: 0;
  pointer-events: none;
}

.auth-gate-overlay.unlocked {
  display: none !important;
  pointer-events: none;
}

.auth-gate-card {
  width: 100%;
  max-width: 440px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-xl);
  padding: 2.75rem 2.25rem 2.25rem;
  text-align: center;
  box-shadow: 0 25px 60px rgba(0, 0, 0, 0.75), 0 0 0 1px rgba(197, 155, 39, 0.25);
  position: relative;
  animation: authCardPop 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes authCardPop {
  0% { transform: scale(0.94) translateY(12px); opacity: 0; }
  100% { transform: scale(1) translateY(0); opacity: 1; }
}

.auth-gate-emblem {
  width: 58px;
  height: 58px;
  border-radius: 50%;
  background: rgba(197, 155, 39, 0.12);
  border: 1.5px solid var(--accent-gold);
  color: var(--accent-gold-dark);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 1.25rem;
  box-shadow: 0 0 25px rgba(197, 155, 39, 0.2);
}

.auth-gate-tag {
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.1em;
  color: var(--accent-gold-dark);
  text-transform: uppercase;
  margin-bottom: 0.6rem;
}

.auth-gate-title {
  font-family: var(--font-serif);
  font-size: 1.85rem;
  font-weight: 800;
  color: var(--text-primary);
  margin-bottom: 0.3rem;
  line-height: 1.2;
}

.auth-gate-subtitle {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--accent-gold-dark);
  margin-bottom: 1.15rem;
  line-height: 1.4;
}

.auth-gate-desc {
  font-size: 0.88rem;
  color: var(--text-secondary);
  line-height: 1.55;
  margin-bottom: 1.75rem;
}

.auth-gate-form {
  display: flex;
  flex-direction: column;
  gap: 1.15rem;
  width: 100%;
}

.auth-field-wrap {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  text-align: left;
}

.auth-field-label {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--text-secondary);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.auth-input-group {
  position: relative;
  display: flex;
  align-items: center;
}

.auth-input-icon,
.auth-lock-icon {
  position: absolute;
  left: 14px;
  color: var(--text-muted);
  pointer-events: none;
}

.auth-text-input,
.auth-password-input {
  width: 100%;
  padding: 0.8rem 2.75rem 0.8rem 2.6rem;
  border-radius: var(--radius-lg);
  border: 1.5px solid var(--border-color);
  background: var(--bg-input);
  color: var(--text-primary);
  font-size: 16px; /* Prevents auto zoom in iOS Safari */
  outline: none;
  transition: all 0.2s ease;
  letter-spacing: 0.03em;
  box-sizing: border-box;
}

.auth-text-input:focus,
.auth-password-input:focus {
  border-color: var(--accent-gold);
  box-shadow: 0 0 0 3px rgba(197, 155, 39, 0.2);
}

.auth-text-input.auth-input-error,
.auth-password-input.auth-input-error {
  border-color: #ef4444;
  animation: authShake 0.4s ease;
}

@keyframes authShake {
  0%, 100% { transform: translateX(0); }
  20%, 60% { transform: translateX(-6px); }
  40%, 80% { transform: translateX(6px); }
}

.auth-toggle-visibility-btn {
  position: absolute;
  right: 12px;
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 0.2s ease;
}

.auth-toggle-visibility-btn:hover {
  color: var(--text-primary);
}

.auth-error-msg {
  display: none;
  font-size: 0.82rem;
  color: #ef4444;
  font-weight: 600;
  text-align: left;
  margin-top: -0.3rem;
}

.auth-submit-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  width: 100%;
  padding: 0.85rem 1.5rem;
  background: var(--accent-gold);
  color: #000;
  font-weight: 800;
  font-size: 0.95rem;
  border: none;
  border-radius: var(--radius-lg);
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 4px 15px rgba(197, 155, 39, 0.35);
}

.auth-submit-btn:hover {
  background: #d4a933;
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(197, 155, 39, 0.45);
}

.auth-footer-notice {
  margin-top: 1.75rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--border-subtle);
  font-size: 0.75rem;
  color: var(--text-muted);
}

/* ==========================================================================
   AUTHOR ATTRIBUTION STYLES (Notes prepared by Ps. R. Mohanraj)
   ========================================================================== */
.welcome-author-banner {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  background: rgba(197, 155, 39, 0.12);
  border: 1.5px solid var(--accent-gold);
  padding: 0.5rem 1.25rem;
  border-radius: 9999px;
  color: var(--accent-gold-dark);
  font-size: 0.95rem;
  font-weight: 600;
  margin-bottom: 1.25rem;
  box-shadow: 0 3px 12px rgba(197, 155, 39, 0.15);
}

.welcome-author-banner strong {
  color: var(--text-primary);
  font-weight: 800;
}

.article-author-pill,
.author-attribution-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  background: rgba(197, 155, 39, 0.12);
  border: 1px solid var(--accent-gold);
  padding: 0.35rem 0.9rem;
  border-radius: 9999px;
  color: var(--accent-gold-dark);
  font-size: 0.84rem;
  font-weight: 600;
  margin-bottom: 0.85rem;
}

.article-author-pill strong,
.author-attribution-pill strong {
  color: var(--text-primary);
  font-weight: 800;
}

.auth-author-banner {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  background: rgba(197, 155, 39, 0.1);
  border: 1px solid rgba(197, 155, 39, 0.35);
  padding: 0.45rem 1rem;
  border-radius: var(--radius-md);
  color: var(--accent-gold-dark);
  font-size: 0.85rem;
  margin-bottom: 1.25rem;
}

.auth-author-banner strong {
  color: #fff;
  font-weight: 800;
}

.sidebar-author-card {
  margin-top: 1rem;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  box-shadow: var(--card-shadow);
}

.author-avatar-badge {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: rgba(197, 155, 39, 0.15);
  border: 1px solid var(--accent-gold);
  color: var(--accent-gold-dark);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.author-details {
  display: flex;
  flex-direction: column;
}

.author-role-label {
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--accent-gold-dark);
}

.author-name {
  font-size: 0.84rem;
  font-weight: 800;
  color: var(--text-primary);
  line-height: 1.25;
}

.author-tamil {
  font-size: 0.76rem;
  color: var(--text-muted);
  margin-top: 2px;
}

/* ==========================================================================
   AUTOMATIC RESPONSIVE SYSTEM (Mobile View & Desktop View)
   ========================================================================== */

/* Mobile Bottom Navigation Dock (Default hidden on desktop) */
.mobile-bottom-nav {
  display: none;
}

.sidebar-backdrop {
  display: none;
}

/* --------------------------------------------------------------------------
   Desktop View Enhancements (Screens > 820px)
   -------------------------------------------------------------------------- */
@media (min-width: 821px) {
  .mobile-bottom-nav {
    display: none !important;
  }
  .sidebar-backdrop {
    display: none !important;
  }
  .mode-switcher-bar {
    display: flex !important;
  }
  .app-sidebar {
    position: sticky !important;
    top: var(--header-height) !important;
    height: calc(100vh - var(--header-height)) !important;
    transform: none !important;
    box-shadow: none !important;
    z-index: 800 !important;
  }
}

/* --------------------------------------------------------------------------
   Mobile View Enhancements (Screens <= 820px: Phones & Small Tablets)
   -------------------------------------------------------------------------- */
@media (max-width: 820px) {
  :root {
    --header-height: 56px;
    --sidebar-width: 300px;
  }

  body {
    padding-bottom: env(safe-area-inset-bottom, 0px);
  }

  /* Header adjustments on mobile */
  .site-header {
    padding: max(0.35rem, env(safe-area-inset-top, 0px)) 0.75rem 0.35rem;
    min-height: var(--header-height);
    height: auto;
    overflow: visible;
  }

  .header-inner {
    gap: 0.4rem;
    align-items: center;
  }

  .header-left {
    gap: 0.45rem;
    min-width: 0;
    flex: 1;
    overflow: hidden;
  }

  .sidebar-toggle-btn {
    width: 36px;
    height: 36px;
    min-width: 36px;
    padding: 0;
    flex-shrink: 0;
  }

  .logo-icon {
    width: 32px;
    height: 32px;
    min-width: 32px;
    flex-shrink: 0;
  }

  .logo-title {
    font-size: 0.95rem;
    line-height: 1.15;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .logo-subtitle {
    font-size: 0.62rem;
    line-height: 1.1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  /* Hide top mode switcher on mobile (handled by Mobile Bottom Nav dock) */
  .mode-switcher-bar {
    display: none !important;
  }

  /* Compact header actions on mobile */
  .header-actions {
    gap: 0.3rem;
    flex-shrink: 0;
    align-items: center;
  }

  .action-btn {
    height: 36px;
    min-width: 36px;
    padding: 0 0.5rem;
    font-size: 0.85rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }

  .action-btn.icon-only {
    width: 36px;
    min-width: 36px;
    padding: 0;
  }

  .action-btn span:not(.badge-pill) {
    display: none; /* Icon-only on mobile for space */
  }

  /* Site Footer on mobile */
  .site-footer {
    padding: 2.25rem 1rem calc(80px + env(safe-area-inset-bottom, 0px)) !important;
    font-size: 0.85rem;
  }

  .footer-quote {
    font-size: 1rem;
    line-height: 1.45;
  }

  .footer-verse {
    font-size: 0.88rem;
    margin-bottom: 0.9rem;
  }

  .footer-author-notice {
    font-size: 0.82rem;
  }

  .footer-author-tamil {
    font-size: 0.74rem;
  }

  .footer-copy {
    font-size: 0.72rem;
  }

  /* Mobile Bottom Navigation Dock */
  .mobile-bottom-nav {
    display: flex;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: calc(56px + env(safe-area-inset-bottom, 0px));
    padding-bottom: env(safe-area-inset-bottom, 0px);
    background: rgba(15, 23, 42, 0.96);
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
    border-top: 1px solid rgba(255, 255, 255, 0.12);
    z-index: 950;
    align-items: center;
    justify-content: space-around;
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.6);
  }

  .mobile-nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    background: transparent;
    border: none;
    color: #94a3b8;
    font-size: 0.68rem;
    font-weight: 700;
    padding: 5px 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    flex: 1;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
  }

  .mobile-nav-item svg {
    transition: transform 0.2s ease, stroke 0.2s ease;
  }

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

  .mobile-nav-item.active svg {
    stroke: var(--accent-gold);
    transform: scale(1.1);
  }

  /* Mobile Sidebar Off-Canvas Drawer */
  .sidebar-backdrop {
    display: block;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    z-index: 960;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s cubic-bezier(0.16, 1, 0.3, 1), visibility 0.3s ease;
  }

  .sidebar-backdrop.show {
    opacity: 1;
    visibility: visible;
  }

  .app-sidebar {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    bottom: 0 !important;
    width: min(320px, 84vw) !important;
    height: 100vh !important;
    z-index: 970 !important;
    background: var(--bg-card) !important;
    box-shadow: 0 0 50px rgba(0, 0, 0, 0.8) !important;
    transform: translateX(-100%) !important;
    transition: transform 0.32s cubic-bezier(0.16, 1, 0.3, 1) !important;
    padding: 1.5rem 1rem calc(2rem + env(safe-area-inset-bottom, 0px)) !important;
  }

  .app-sidebar.open {
    transform: translateX(0) !important;
  }

  /* App main content padding for bottom nav */
  .app-main {
    padding: 1rem 1rem calc(72px + env(safe-area-inset-bottom, 0px)) !important;
    width: 100% !important;
    max-width: 100% !important;
  }

  /* Welcome Portal Mobile */
  .welcome-hero {
    padding: 2rem 1.25rem;
  }

  .welcome-title {
    font-size: 1.85rem;
  }

  .welcome-subtitle {
    font-size: 1.05rem;
  }

  .welcome-author-banner {
    font-size: 0.8rem;
    padding: 0.4rem 0.9rem;
    flex-wrap: wrap;
    justify-content: center;
  }

  .welcome-lead {
    font-size: 0.92rem;
    line-height: 1.6;
  }

  .portal-gateways-grid {
    grid-template-columns: 1fr;
    gap: 1rem;
  }

  .welcome-pathways-grid {
    grid-template-columns: 1fr;
    gap: 1rem;
  }

  .executive-metrics-bar {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1.15rem;
    padding: 1.25rem 1rem;
  }

  .metric-divider {
    display: none;
  }

  .filter-pills {
    display: flex;
    overflow-x: auto;
    white-space: nowrap;
    padding-bottom: 0.5rem;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }

  .filter-pills::-webkit-scrollbar {
    display: none;
  }

  .epistles-grid {
    grid-template-columns: 1fr;
    gap: 1rem;
  }

  /* Real Map on Mobile */
  .real-map-container {
    height: calc(100vh - var(--header-height) - 56px - env(safe-area-inset-bottom, 0px));
  }

  .real-map-hud-top-left {
    top: 0.5rem;
    left: 0.5rem;
    right: 0.5rem;
  }

  .real-map-badge {
    padding: 0.5rem 0.75rem;
  }

  .real-map-title {
    font-size: 0.92rem;
  }

  .real-map-desc {
    display: none;
  }

  .real-distance-hud {
    padding: 0.35rem 0.65rem;
    font-size: 0.8rem;
  }

  .real-journey-toolbar {
    bottom: calc(64px + env(safe-area-inset-bottom, 0px));
  }

  .real-map-hud-top-right {
    bottom: calc(115px + env(safe-area-inset-bottom, 0px));
    top: auto;
    left: 0.5rem;
    right: 0.5rem;
    justify-content: center;
  }

  .archaeological-drawer {
    z-index: 960;
    max-height: 75vh;
  }

  /* 3D Virtual World on Mobile */
  .virtual-world-container {
    height: calc(100vh - var(--header-height) - 56px - env(safe-area-inset-bottom, 0px));
  }

  .world-hud-top-left {
    top: 0.5rem;
    left: 0.5rem;
  }

  .world-hud-desc {
    display: none;
  }

  .world-journey-toolbar {
    bottom: calc(64px + env(safe-area-inset-bottom, 0px));
  }

  .world-city-card {
    bottom: calc(115px + env(safe-area-inset-bottom, 0px));
    left: 0.5rem;
    right: 0.5rem;
    width: auto;
  }

  /* Reader View on Mobile */
  .epistle-article-container {
    padding: 1.5rem 1rem;
  }

  .article-title {
    font-size: 1.75rem;
  }

  .article-subtitle {
    font-size: 1.05rem;
  }

  .article-meta-bar {
    gap: 0.5rem;
  }

  .article-meta-pill {
    font-size: 0.8rem;
    padding: 0.35rem 0.65rem;
  }

  /* Auth Gate Card on Mobile */
  .auth-gate-card {
    max-width: 94vw;
    padding: 2rem 1.25rem 1.5rem;
  }

  .auth-gate-title {
    font-size: 1.5rem;
  }

  /* Extra-small mobile screens (<= 390px) */
  @media (max-width: 390px) {
    .site-header {
      padding: max(0.3rem, env(safe-area-inset-top, 0px)) 0.55rem 0.3rem;
    }
    .header-left {
      gap: 0.35rem;
    }
    .logo-title {
      font-size: 0.88rem;
    }
    .logo-subtitle {
      font-size: 0.58rem;
      letter-spacing: 0.02em;
    }
    .header-actions {
      gap: 0.2rem;
    }
    .action-btn {
      height: 34px;
      min-width: 34px;
      padding: 0 0.4rem;
    }
    .action-btn.icon-only {
      width: 34px;
      min-width: 34px;
    }
  }
}
