/* Root Theme - Optimized for performance */
:root {
  --bg: #0b0e13;
  --panel: #121722;
  --card-bg: #1a1f2e;
  --hover-bg: #2a2f3e;
  --muted-bg: #1f2430;
  --text: #e7edf3;
  --muted: #9fb0c3;
  --brand: #22c1c3;
  --brand-2: #2a9d8f;
  --ring: #2dd4bf55;
  --border: #1f2430;
  --shadow: 0 10px 30px rgba(0,0,0,.25);
}

[data-theme="light"] {
  --bg: #ffffff;
  --panel: #f5f7fb;
  --card-bg: #ffffff;
  --hover-bg: #f0f4f8;
  --muted-bg: #e6e9ef;
  --text: #0b1320;
  --muted: #5b6b7a;
  --brand: #1e88e5;
  --brand-2: #3f51b5;
  --ring: #60a5fa66;
  --border: #e6e9ef;
  --shadow: 0 10px 30px rgba(0,0,0,.12);
}

/* Reset and base styles - optimized */
*, *::before, *::after { 
  box-sizing: border-box; 
  margin: 0; 
  padding: 0; 
}

html { 
  font-size: 16px; 
  line-height: 1.6; 
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  scroll-behavior: smooth;
  height: 100%;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  height: 100%;
  overflow-x: hidden;
  will-change: auto;
}

.container { width: min(1100px, 92%); margin: 0 auto; }

/* Header */
.site-header { position: sticky; top: 0; z-index: 50; background: rgba(10,13,18,.6); backdrop-filter: blur(10px); border-bottom: 1px solid var(--border); }
[data-theme="light"] .site-header { background: rgba(255,255,255,.7); }
.header-inner { display: flex; align-items: center; justify-content: space-between; padding: 14px 0; }
.brand { display: inline-flex; align-items: center; gap: 12px; text-decoration: none; color: var(--text); font-weight: 700; letter-spacing: .2px; }
.brand-mark { font-size: 22px; background: linear-gradient(120deg, var(--brand), var(--brand-2)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.brand-text { font-size: 18px; }

/* Home button and surah title in header */
.home-btn { 
  display: flex; 
  align-items: center; 
  justify-content: center; 
  width: 40px; 
  height: 40px; 
  border-radius: 8px; 
  background: var(--panel); 
  border: 1px solid var(--border); 
  color: var(--text); 
  text-decoration: none; 
  transition: all 0.2s ease;
  box-shadow: var(--shadow);
}
.home-btn:hover { 
  background: var(--brand); 
  color: white; 
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}
.home-icon { 
  font-size: 18px; 
}
.surah-title { 
  font-size: 20px; 
  margin: 0; 
  color: var(--text); 
  font-weight: 600;
}

.header-actions { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.search { position: relative; }
.search input { width: 240px; max-width: 52vw; padding: 10px 32px 10px 12px; border-radius: 12px; border: 1px solid var(--border); background: var(--panel); color: var(--text); outline: none; box-shadow: var(--shadow); }
.search .kbd { position: absolute; right: 8px; top: 50%; transform: translateY(-50%); font-size: 12px; color: var(--muted); border: 1px solid var(--border); padding: 2px 6px; border-radius: 6px; }
.icon-btn { display: inline-flex; align-items: center; justify-content: center; width: 38px; height: 38px; border-radius: 12px; border: 1px solid var(--border); background: var(--panel); color: var(--text); cursor: pointer; transition: transform .1s ease; }
.icon-btn:active { transform: translateY(1px); }
.icon { width: 18px; height: 18px; display: inline-block; }

/* Minimalist theme icon */
.theme-icon {
  font-size: 18px;
  transition: transform 0.2s ease;
}

[data-theme="light"] .theme-icon {
  content: "☀";
}

[data-theme="dark"] .theme-icon {
  content: "☽";
}

/* Icon button styles */
.icon-btn {
  font-size: 16px;
  font-weight: normal;
}
.lang-select { padding: 10px 12px; border-radius: 12px; border: 1px solid var(--border); background: var(--panel); color: var(--text); }

/* Hero */
.hero { text-align: center; padding: 60px 0 30px; }
.hero h1 { font-size: clamp(28px, 4vw, 46px); margin: 0 0 8px; letter-spacing: .3px; }
.hero .sub { color: var(--muted); margin: 0 0 18px; }
.hero .ayah { 
  margin: 0 auto 18px; 
  max-width: 800px; 
  color: var(--text); 
  background: var(--panel); 
  border: 1px solid var(--border); 
  padding: 20px 24px; 
  border-radius: 16px; 
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
  font-size: 18px;
  line-height: 1.6;
  font-style: italic;
  position: relative;
  overflow: hidden;
}
.hero .ayah::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--brand), var(--brand-2));
}
.cta { display: inline-block; background: linear-gradient(135deg, var(--brand), var(--brand-2)); color: #fff; text-decoration: none; padding: 12px 18px; border-radius: 12px; font-weight: 600; box-shadow: var(--shadow); }

/* Surah list */
.surahs { padding: 20px 0 60px; }
.continue { display:flex; align-items:center; justify-content: space-between; gap:12px; border:1px solid var(--border); background: linear-gradient(180deg, var(--panel), transparent 140%); border-radius:14px; padding:12px 14px; box-shadow: var(--shadow); margin-bottom:14px; }
.continue-text { display:flex; flex-direction: column; gap:4px; }
.continue-text .title { font-weight: 700; }
.continue-text .meta { color: var(--muted); font-size: 14px; }
.continue-text a { color: var(--brand); text-decoration: none; font-weight: 600; }
.continue .arrow { background: linear-gradient(135deg, var(--brand), var(--brand-2)); color:#fff; border: none; }

/* Notifier */
.toast { position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%); background: var(--panel); color: var(--text); border: 1px solid var(--border); border-radius: 12px; padding: 10px 14px; box-shadow: var(--shadow); opacity: 0; pointer-events: none; transition: opacity .2s ease, transform .2s ease; }
.toast.show { opacity: 1; transform: translateX(-50%) translateY(-6px); }

/* Loader */
.loader { 
  position: fixed; 
  top: 0; 
  left: 0; 
  width: 100%; 
  height: 100%; 
  background: var(--bg); 
  color: var(--text);
  z-index: 9999; 
  display: flex; 
  align-items: center; 
  justify-content: center; 
  opacity: 1; 
  transition: opacity .3s ease, background-color .3s ease, color .3s ease; 
  will-change: opacity, background-color, color; 
}
.loader.hidden { opacity: 0; pointer-events: none; }
.loader-content { text-align: center; }
.loader-spinner { 
  font-size: 80px; 
  margin: 0 auto 30px; 
  background: linear-gradient(45deg, var(--brand), var(--brand-2), #ff6b6b, #4ecdc4); 
  background-size: 400% 400%; 
  -webkit-background-clip: text; 
  background-clip: text; 
  color: transparent; 
  animation: gradientShift 2s ease-in-out infinite, float 3s ease-in-out infinite; 
  will-change: transform, background-position; 
}
.progress-container { width: 200px; margin: 0 auto; }
.progress-bar { 
  width: 100%; 
  height: 6px; 
  background: var(--border); 
  border-radius: 3px; 
  overflow: hidden; 
  margin-bottom: 10px; 
  transition: background-color .3s ease;
}
.progress-fill { 
  height: 100%; 
  background: linear-gradient(90deg, var(--brand), var(--brand-2)); 
  border-radius: 3px; 
  width: 0%; 
  transition: width 0.3s ease; 
  will-change: width; 
}
.progress-text { 
  color: var(--text); 
  font-size: 16px; 
  font-weight: 600; 
  text-align: center; 
  transition: color .3s ease;
}
@keyframes gradientShift { 0% { background-position: 0% 50%; } 50% { background-position: 100% 50%; } 100% { background-position: 0% 50%; } }

/* Mobile loader adjustments */
@media (max-width: 900px) {
  .loader-spinner { 
    font-size: 60px; 
    margin: 0 auto 20px; 
  }
  .progress-container { width: 160px; }
  .progress-text { font-size: 14px; }
}

@media (max-width: 600px) {
  .loader-spinner { 
    font-size: 50px; 
    margin: 0 auto 16px; 
  }
  .progress-container { width: 140px; }
  .progress-text { font-size: 13px; }
}
@keyframes float { 0%, 100% { transform: translateY(0px) scale(1); } 50% { transform: translateY(-10px) scale(1.05); } }
.surah-toolbar { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.legend .pill { background: var(--panel); border: 1px solid var(--border); color: var(--muted); padding: 6px 10px; border-radius: 999px; }
.grid { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 12px; }
.surah-card-wrapper { display: contents; }
/* Info Menu */
.info-menu { position: relative; }
.info-toggle { display: flex; align-items: center; gap: 6px; padding: 8px 12px; background: var(--panel); border: 1px solid var(--border); border-radius: 8px; color: var(--text); cursor: pointer; transition: all 0.2s ease; }
.info-toggle:hover { background: var(--brand); color: white; }
.info-text { font-size: 14px; font-weight: 500; }
.info-icon { font-size: 16px; }
.info-dropdown { position: absolute; top: 100%; right: 0; background: var(--panel); border: 1px solid var(--border); border-radius: 8px; box-shadow: var(--shadow); min-width: 200px; z-index: 1000; margin-top: 4px; }
.info-dropdown a { display: block; padding: 12px 16px; color: var(--text); text-decoration: none; border-bottom: 1px solid var(--border); transition: background 0.2s ease; }
.info-dropdown a:last-child { border-bottom: none; }
.info-dropdown a:hover { background: var(--brand); color: white; }

/* Modals */
.modal { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.8); display: flex; align-items: center; justify-content: center; z-index: 10000; }
.modal-content { background: var(--panel); border-radius: 12px; max-width: 600px; max-height: 80vh; width: 90%; margin: 20px; overflow: hidden; }
.modal-header { display: flex; align-items: center; justify-content: space-between; padding: 20px; border-bottom: 1px solid var(--border); }
.modal-header h2 { margin: 0; color: var(--text); }
.close-btn { background: none; border: none; font-size: 24px; color: var(--muted); cursor: pointer; padding: 0; width: 30px; height: 30px; display: flex; align-items: center; justify-content: center; }
.close-btn:hover { color: var(--text); }
.modal-body { padding: 20px; max-height: 60vh; overflow-y: auto; }

/* Contact Form */
.contact-form-section { margin-top: 20px; padding-top: 20px; border-top: 1px solid var(--border); }
.contact-form-section h4 { color: var(--text); margin-bottom: 16px; font-size: 16px; }
.form-group { margin-bottom: 16px; }
.form-group label { display: block; margin-bottom: 6px; color: var(--text); font-weight: 500; font-size: 14px; }
.form-group input, .form-group select, .form-group textarea { width: 100%; padding: 10px; border: 1px solid var(--border); border-radius: 6px; background: var(--bg); color: var(--text); font-size: 14px; }
.form-group input:focus, .form-group select:focus, .form-group textarea:focus { outline: none; border-color: var(--brand); }
.form-group textarea { resize: vertical; min-height: 80px; }
.contact-form-section button[type="submit"] { background: var(--brand); color: white; border: none; padding: 10px 20px; border-radius: 6px; cursor: pointer; font-size: 14px; transition: background 0.2s ease; }
.contact-form-section button[type="submit"]:hover { background: var(--brand-2); }
.share-btn, .add-home-btn, .telegram-link { display: inline-block; padding: 10px 16px; background: var(--brand); color: white; text-decoration: none; border-radius: 6px; margin: 4px; transition: background 0.2s ease; }
.share-btn:hover, .add-home-btn:hover, .telegram-link:hover { background: var(--brand-2); }

/* Mobile App Section */
.mobile-app-section {
  background: var(--card-bg);
  background: linear-gradient(135deg, var(--card-bg) 0%, var(--panel) 100%);
  -webkit-background: linear-gradient(135deg, var(--card-bg) 0%, var(--panel) 100%);
  padding: 60px 0;
  margin: 40px 0;
  border-radius: 20px;
  position: relative;
  overflow: hidden;
  /* Safari-specific fixes */
  -webkit-backface-visibility: hidden;
  backface-visibility: hidden;
  -webkit-transform: translateZ(0);
  transform: translateZ(0);
}

.mobile-app-section::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(255, 255, 255, 0.02);
  background: linear-gradient(45deg, transparent 30%, rgba(255, 255, 255, 0.05) 50%, transparent 70%);
  -webkit-background: linear-gradient(45deg, transparent 30%, rgba(255, 255, 255, 0.05) 50%, transparent 70%);
  pointer-events: none;
}

.app-promo {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 60px;
  align-items: center;
  position: relative;
  z-index: 1;
}

.app-content h2 {
  font-size: 2.5rem;
  font-weight: 700;
  color: var(--brand);
  margin-bottom: 16px;
  background: linear-gradient(135deg, var(--brand), #6366f1);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  /* Fallback for Safari */
  -webkit-text-fill-color: transparent;
}

.app-description {
  font-size: 1.2rem;
  color: var(--muted);
  margin-bottom: 40px;
  line-height: 1.6;
}

.app-features {
  display: flex;
  flex-direction: column;
  gap: 24px;
  margin-bottom: 40px;
}

.feature {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  padding: 20px;
  background: var(--card-bg);
  background-color: var(--card-bg);
  border-radius: 12px;
  border: 1px solid var(--border);
  transition: all 0.3s ease;
  -webkit-transition: all 0.3s ease;
}

.feature:hover {
  transform: translateY(-2px);
  -webkit-transform: translateY(-2px);
  box-shadow: var(--shadow);
  border-color: var(--brand);
}

.feature-icon {
  font-size: 2rem;
  flex-shrink: 0;
  margin-top: 4px;
}

.feature-text h3 {
  font-size: 1.2rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 8px;
}

.feature-text p {
  color: var(--muted);
  line-height: 1.5;
  margin: 0;
}

.app-download {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.download-btn {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 20px 24px;
  background: linear-gradient(135deg, var(--brand), #6366f1);
  color: white;
  text-decoration: none;
  border-radius: 12px;
  transition: all 0.3s ease;
  box-shadow: 0 4px 20px rgba(99, 102, 241, 0.3);
}

.download-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 30px rgba(99, 102, 241, 0.4);
}

.download-icon {
  flex-shrink: 0;
  color: white;
}

.download-text {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.download-title {
  font-size: 1.1rem;
  font-weight: 600;
}

.download-subtitle {
  font-size: 0.9rem;
  opacity: 0.9;
}

.coming-soon-apps {
  display: flex;
  gap: 16px;
}

.coming-soon-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 16px;
  background: var(--muted-bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s ease;
  color: var(--muted);
  font-size: 0.9rem;
}

.coming-soon-item:hover {
  background: var(--hover-bg);
  border-color: var(--brand);
  color: var(--text);
}

.store-icon {
  flex-shrink: 0;
  color: var(--muted);
}

.app-preview {
  display: flex;
  justify-content: center;
  align-items: center;
}

.phone-mockup {
  width: 280px;
  height: 560px;
  background: #1a1a1a;
  border-radius: 40px;
  padding: 20px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
  position: relative;
  transition: transform 0.3s ease;
  animation: fadeInUp 0.6s ease-out;
}

.phone-mockup:hover {
  transform: translateY(-10px);
}

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

.phone-mockup::before {
  content: '';
  position: absolute;
  top: 10px;
  left: 50%;
  transform: translateX(-50%);
  width: 60px;
  height: 4px;
  background: #333;
  border-radius: 2px;
}

.phone-screen {
  width: 100%;
  height: 100%;
  background: var(--bg);
  border-radius: 30px;
  overflow: hidden;
  position: relative;
}

.app-screenshot-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 30px;
  transition: transform 0.3s ease;
}

.phone-mockup:hover .app-screenshot-img {
  transform: scale(1.02);
}

/* Footer */
.footer-content { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 30px; margin-bottom: 30px; }
.footer-section h3 { color: var(--text); margin-bottom: 12px; font-size: 18px; }
.footer-section p { color: var(--muted); line-height: 1.6; margin-bottom: 12px; }
.social-links { display: flex; flex-wrap: wrap; gap: 8px; }
.app-links { display: flex; flex-direction: column; gap: 8px; }
.app-link { 
    display: flex; 
    align-items: center; 
    gap: 8px; 
    padding: 8px 12px; 
    border-radius: 6px; 
    text-decoration: none; 
    color: var(--text); 
    background: var(--card-bg);
    background-color: var(--card-bg);
    border: 1px solid var(--border); 
    transition: all 0.2s ease;
    -webkit-transition: all 0.2s ease;
    font-size: 14px;
}
.app-link:hover { 
    background: var(--hover-bg);
    background-color: var(--hover-bg);
    border-color: var(--brand); 
    transform: translateY(-1px);
    -webkit-transform: translateY(-1px);
}
.app-link.disabled { 
    opacity: 0.6; 
    cursor: not-allowed; 
    background: var(--muted-bg); 
}
.app-link.disabled:hover { 
    transform: none; 
    background: var(--muted-bg); 
    border-color: var(--border); 
}
.app-icon { 
    flex-shrink: 0; 
    color: var(--brand); 
}
.coming-soon { 
    font-size: 12px; 
    color: var(--muted); 
    font-style: italic; 
    margin-left: auto; 
}
.footer-bottom { display: flex; justify-content: space-between; align-items: center; padding-top: 20px; border-top: 1px solid var(--border); }
.footer-links { display: flex; flex-direction: column; gap: 8px; }
.footer-links a { color: var(--muted); text-decoration: none; transition: color 0.2s ease; }
.footer-links a:hover { color: var(--text); }

/* Toast */
.toast { position: fixed; bottom: 20px; right: 20px; background: var(--brand); color: white; padding: 12px 20px; border-radius: 8px; box-shadow: var(--shadow); z-index: 10001; transform: translateX(100%); opacity: 0; transition: all 0.3s ease; }
.toast.show { transform: translateX(0); opacity: 1; }

/* Info content */
.info-content { line-height: 1.6; color: var(--text); }

/* Page content */
.page-content { max-width: 800px; margin: 0 auto; padding: 40px 20px; }
.page-header { text-align: center; margin-bottom: 40px; }
.page-header h1 { color: var(--text); font-size: 2.5rem; margin-bottom: 16px; }
.page-description { color: var(--muted); font-size: 1.1rem; line-height: 1.6; max-width: 600px; margin: 0 auto; }

/* Contact form */
.contact-form-container { background: var(--panel); border-radius: 12px; padding: 30px; margin-bottom: 40px; border: 1px solid var(--border); }
.contact-form { max-width: 600px; margin: 0 auto; }
.contact-form .form-group { margin-bottom: 24px; }
.contact-form .form-group label { display: block; margin-bottom: 8px; color: var(--text); font-weight: 600; font-size: 16px; }
.contact-form .form-group input, .contact-form .form-group select, .contact-form .form-group textarea { 
  width: 100%; padding: 12px 16px; border: 2px solid var(--border); border-radius: 8px; 
  background: var(--bg); color: var(--text); font-size: 16px; transition: border-color 0.2s ease; 
}
.contact-form .form-group input:focus, .contact-form .form-group select:focus, .contact-form .form-group textarea:focus { 
  outline: none; border-color: var(--brand); 
}
.contact-form .form-group textarea { resize: vertical; min-height: 120px; }
.submit-btn { 
  background: var(--brand); color: white; border: none; padding: 14px 32px; 
  border-radius: 8px; cursor: pointer; font-size: 16px; font-weight: 600; 
  transition: background 0.2s ease; width: 100%; 
}
.submit-btn:hover { background: var(--brand-2); }

/* Contact info */
.contact-info { text-align: center; }
.contact-info h2 { color: var(--text); margin-bottom: 24px; font-size: 1.5rem; }
.contact-methods { display: flex; gap: 20px; justify-content: center; flex-wrap: wrap; }
.contact-method { 
  display: flex; align-items: center; gap: 12px; padding: 16px 24px; 
  background: var(--panel); border: 1px solid var(--border); border-radius: 8px; 
  text-decoration: none; color: var(--text); transition: all 0.2s ease; 
}
.contact-method:hover { background: var(--brand); color: white; transform: translateY(-2px); }
.contact-method .icon { font-size: 20px; }

/* About page */
.about-content { max-width: 900px; margin: 0 auto; }
.mission-section, .team-section, .project-info, .contact-section { 
  margin-bottom: 50px; padding: 30px; background: var(--panel); 
  border-radius: 12px; border: 1px solid var(--border); 
}
.mission-section h2, .team-section h2, .project-info h2, .contact-section h2 { 
  color: var(--text); margin-bottom: 20px; font-size: 1.8rem; 
}
.mission-text p, .team-text p { 
  color: var(--muted); line-height: 1.7; margin-bottom: 16px; font-size: 1.1rem; 
}
.hadith-quote { 
  background: var(--bg); border-left: 4px solid var(--brand); 
  padding: 20px; margin: 24px 0; border-radius: 8px; 
}
.hadith-quote p { 
  color: var(--text); font-style: italic; font-size: 1.2rem; 
  margin-bottom: 8px; font-weight: 500; 
}
.hadith-quote cite { 
  color: var(--muted); font-size: 0.9rem; 
}
.info-grid { 
  display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); 
  gap: 20px; margin-top: 20px; 
}
.info-card { 
  background: var(--bg); padding: 24px; border-radius: 8px; 
  border: 1px solid var(--border); text-align: center; 
}
.info-card h3 { 
  color: var(--brand); margin-bottom: 12px; font-size: 1.2rem; 
}
.info-card p { 
  color: var(--muted); line-height: 1.6; font-size: 0.95rem; 
}
.contact-actions { 
  display: flex; gap: 16px; justify-content: center; 
  flex-wrap: wrap; margin-top: 24px; 
}
.contact-btn { 
  display: inline-block; padding: 12px 24px; border-radius: 8px; 
  text-decoration: none; font-weight: 600; transition: all 0.2s ease; 
}
.contact-btn.primary { 
  background: var(--brand); color: white; 
}
.contact-btn.primary:hover { 
  background: var(--brand-2); transform: translateY(-2px); 
}
.contact-btn.secondary { 
  background: var(--panel); color: var(--text); 
  border: 2px solid var(--border); 
}
.contact-btn.secondary:hover { 
  background: var(--brand); color: white; border-color: var(--brand); 
  transform: translateY(-2px); 
}

/* Privacy page */
.privacy-content { max-width: 900px; margin: 0 auto; }
.privacy-intro { 
  background: var(--panel); padding: 30px; border-radius: 12px; 
  border: 1px solid var(--border); margin-bottom: 30px; 
}
.privacy-intro p { 
  color: var(--muted); line-height: 1.7; font-size: 1.1rem; 
  margin: 0; 
}
.privacy-section { 
  margin-bottom: 40px; padding: 30px; background: var(--panel); 
  border-radius: 12px; border: 1px solid var(--border); 
}
.privacy-section h2 { 
  color: var(--text); margin-bottom: 20px; font-size: 1.6rem; 
  border-bottom: 2px solid var(--brand); padding-bottom: 10px; 
}
.privacy-text p { 
  color: var(--muted); line-height: 1.7; margin-bottom: 16px; 
  font-size: 1rem; 
}
.privacy-text p:last-child { margin-bottom: 0; }
.privacy-footer { 
  background: var(--bg); padding: 30px; border-radius: 12px; 
  border: 1px solid var(--border); text-align: center; 
  margin-top: 40px; 
}
.privacy-footer p { 
  color: var(--muted); margin: 8px 0; font-size: 0.95rem; 
}
.privacy-footer strong { color: var(--text); }

/* Attention page */
.attention-content { max-width: 900px; margin: 0 auto; }
.attention-text { 
  background: var(--panel); padding: 40px; border-radius: 12px; 
  border: 1px solid var(--border); margin-bottom: 30px; 
}
.attention-text p { 
  color: var(--text); line-height: 1.8; font-size: 1.1rem; 
  margin: 0; text-align: justify; 
}

/* License page */
.license-content { max-width: 900px; margin: 0 auto; }
.license-text { 
  background: var(--panel); padding: 40px; border-radius: 12px; 
  border: 1px solid var(--border); margin-bottom: 30px; 
}
.license-text p { 
  color: var(--text); line-height: 1.8; font-size: 1.1rem; 
  margin: 0; text-align: justify; 
}

/* PDF pages */
.pdf-content { max-width: 1000px; margin: 0 auto; }
.pdf-container { 
  background: var(--panel); border-radius: 12px; 
  border: 1px solid var(--border); overflow: hidden; 
  box-shadow: var(--shadow); 
}

/* Hide PDF.js toolbar and controls */
.pdf-container ::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

.pdf-container ::-webkit-scrollbar-track {
  background: var(--panel);
}

.pdf-container ::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 4px;
}

.pdf-container ::-webkit-scrollbar-thumb:hover {
  background: var(--muted);
}

/* Hide any PDF.js UI elements */
.pdf-container #toolbar,
.pdf-container .toolbar,
.pdf-container #toolbarContainer,
.pdf-container .toolbarContainer,
.pdf-container #secondaryToolbar,
.pdf-container .secondaryToolbar,
.pdf-container #sidebarContainer,
.pdf-container .sidebarContainer,
.pdf-container #viewerContainer .toolbar,
.pdf-container #viewerContainer .toolbarContainer {
  display: none !important;
}
.pdf-container iframe { 
  display: block; width: 100%; height: 800px; 
  border: none; background: white; 
}
.pdf-container p { 
  padding: 40px; text-align: center; color: var(--muted); 
}
.pdf-container a { 
  color: var(--brand); text-decoration: none; 
}
.pdf-container a:hover { 
  text-decoration: underline; 
}

/* iOS Fullscreen Support */
.ios-fullscreen {
  position: fixed !important;
  top: 0 !important;
  left: 0 !important;
  width: 100vw !important;
  height: 100vh !important;
  z-index: 9999 !important;
  background: var(--bg) !important;
  padding: 0 !important;
  border-radius: 0 !important;
  max-height: none !important;
}

.ios-fullscreen-active {
  overflow: hidden !important;
}

.ios-fullscreen-close-btn {
  position: fixed;
  top: 20px;
  right: 20px;
  width: 44px;
  height: 44px;
  background: rgba(0, 0, 0, 0.7);
  color: white;
  border: none;
  border-radius: 50%;
  font-size: 20px;
  font-weight: bold;
  cursor: pointer;
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(10px);
  transition: all 0.2s ease;
}

.ios-fullscreen-close-btn:hover {
  background: rgba(0, 0, 0, 0.9);
  transform: scale(1.1);
}

.ios-fullscreen-close-btn:active {
  transform: scale(0.95);
}

/* PDF Loading Indicator */
.pdf-loading-indicator {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 200px;
  padding: 40px 20px;
  text-align: center;
}

.pdf-loading-spinner {
  font-size: 48px;
  margin-bottom: 16px;
  animation: float 2s ease-in-out infinite;
}

.pdf-loading-text {
  color: var(--text);
  font-size: 16px;
  margin-bottom: 20px;
  font-weight: 500;
}

.pdf-progress-bar {
  width: 200px;
  height: 4px;
  background: var(--border);
  border-radius: 2px;
  overflow: hidden;
}

.pdf-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--brand), var(--brand-2));
  border-radius: 2px;
  width: 0%;
  transition: width 0.3s ease;
}

/* Info menu */
.info-menu { position: relative; }
.info-toggle { 
  display: flex; align-items: center; gap: 8px; padding: 8px 16px; 
  background: var(--panel); border: 1px solid var(--border); 
  border-radius: 8px; color: var(--text); cursor: pointer; 
  transition: all 0.2s ease; font-size: 14px; font-weight: 500; 
}
.info-toggle:hover { background: var(--brand); color: white; }
.info-text { display: block; }
.info-icon { display: none; font-size: 18px; }
.info-dropdown { 
  position: absolute; top: 100%; right: 0; margin-top: 8px; 
  background: var(--panel); border: 1px solid var(--border); 
  border-radius: 8px; box-shadow: var(--shadow); z-index: 1000; 
  min-width: 200px; opacity: 0; visibility: hidden; 
  transform: translateY(-10px); transition: all 0.2s ease; 
}
.info-dropdown.show { 
  opacity: 1; visibility: visible; transform: translateY(0); 
}
.info-dropdown a { 
  display: block; padding: 12px 16px; color: var(--text); 
  text-decoration: none; border-bottom: 1px solid var(--border); 
  transition: background 0.2s ease; font-size: 14px; 
}
.info-dropdown a:last-child { border-bottom: none; }
.info-dropdown a:hover { background: var(--brand); color: white; }

/* Mobile Responsive */
@media (max-width: 900px) { 
  .grid { grid-template-columns: repeat(2, 1fr); } 
  .search input { width: 180px; }
  .info-text { display: none; }
  .info-icon { display: block; }
  .info-toggle { padding: 8px; }
  .info-icon { font-size: 18px; }
  .info-icon::before { content: "☰"; }
  .info-icon { font-size: 0; }
  .info-icon::before { font-size: 18px; }
  .brand-mark { font-size: 16px; }
  .surah-title { font-size: 18px; }
  .home-btn { width: 36px; height: 36px; }
  .home-icon { font-size: 16px; }
  .header-actions { gap: 8px; }
  .desktop-audio-controls { display: none !important; }
  .mobile-audio-controls { 
    display: flex !important; 
    flex-direction: column; 
    align-items: stretch; 
    gap: 8px; 
  }
  .reciter-selector { min-width: 120px; }
  .compact-audio-player { min-width: 160px; }
  .hero .ayah { 
    padding: 16px 20px; 
    font-size: 16px; 
    margin: 0 auto 16px; 
  }
  .lang-select { 
    appearance: none; 
    background-image: none;
    padding-right: 12px;
    min-width: 60px;
    text-indent: 0;
    font-size: 12px;
  }
}
@media (max-width: 600px) { 
  .grid { grid-template-columns: 1fr; } 
  .header-inner { gap: 8px; } 
  .search input { display:none; } 
  .search .kbd { display:none; }
  .footer-content { grid-template-columns: 1fr; gap: 20px; }
  .footer-bottom { flex-direction: column; gap: 12px; text-align: center; }
  .footer-links { 
    flex-direction: column; 
    align-items: flex-start; 
    gap: 8px; 
  }
  .app-links {
    gap: 6px;
  }
  .app-link {
    padding: 6px 10px;
    font-size: 13px;
  }
  .app-icon {
    width: 16px;
    height: 16px;
  }
  .coming-soon {
    font-size: 11px;
  }
  
  /* Mobile App Section - Mobile */
  .mobile-app-section {
    padding: 40px 0;
    margin: 20px 0;
    border-radius: 16px;
    /* Safari mobile fixes */
    -webkit-backface-visibility: hidden;
    backface-visibility: hidden;
    -webkit-transform: translateZ(0);
    transform: translateZ(0);
  }
  
  .app-promo {
    grid-template-columns: 1fr;
    gap: 40px;
    text-align: center;
  }
  
.app-content {
  order: 1;
  transition: all 0.3s ease;
}

.app-preview {
  order: 2;
  transition: all 0.3s ease;
}
  
  .app-content h2 {
    font-size: 2rem;
  }
  
  .app-description {
    font-size: 1.1rem;
    margin-bottom: 30px;
  }
  
  .app-features {
    gap: 16px;
    margin-bottom: 30px;
  }
  
  .feature {
    padding: 16px;
    text-align: left;
  }
  
  .feature-icon {
    font-size: 1.5rem;
  }
  
  .download-btn {
    padding: 16px 20px;
    justify-content: center;
  }
  
  .coming-soon-apps {
    flex-direction: column;
    gap: 12px;
  }
  
  .phone-mockup {
    width: 240px;
    height: 480px;
    margin: 0 auto;
  }
  
  .app-screenshot-img {
    border-radius: 25px;
  }
}

/* Стили для планшетов */
@media (max-width: 1024px) and (min-width: 769px) {
  .app-promo {
    gap: 50px;
  }
  
  .phone-mockup {
    width: 260px;
    height: 520px;
  }
  
  .app-content h2 {
    font-size: 2.2rem;
  }
}

/* Дополнительные стили для очень маленьких экранов */
@media (max-width: 480px) {
  .mobile-app-section {
    padding: 30px 0;
    margin: 15px 0;
    /* Safari mobile fixes for small screens */
    -webkit-backface-visibility: hidden;
    backface-visibility: hidden;
    -webkit-transform: translateZ(0);
    transform: translateZ(0);
  }
  
  .app-promo {
    gap: 30px;
  }
  
  .app-content h2 {
    font-size: 1.8rem;
  }
  
  .app-description {
    font-size: 1rem;
    margin-bottom: 25px;
  }
  
  .app-features {
    gap: 12px;
    margin-bottom: 25px;
  }
  
  .feature {
    padding: 14px;
  }
  
  .feature-icon {
    font-size: 1.3rem;
  }
  
  .feature-text h3 {
    font-size: 1.1rem;
  }
  
  .feature-text p {
    font-size: 0.9rem;
  }
  
  .download-btn {
    padding: 14px 18px;
  }
  
  .download-title {
    font-size: 1rem;
  }
  
  .download-subtitle {
    font-size: 0.8rem;
  }
  
  .phone-mockup {
    width: 200px;
    height: 400px;
  }
  
  .app-screenshot-img {
    border-radius: 20px;
  }
  
  .modal-content { width: 95%; margin: 10px; }
  .modal-header, .modal-body { padding: 16px; }
  .info-icon::before { content: "☰"; }
  .info-icon { font-size: 0; }
  .info-icon::before { font-size: 18px; }
  .brand-mark { font-size: 14px; }
  .surah-title { font-size: 16px; }
  .home-btn { width: 32px; height: 32px; }
  .home-icon { font-size: 14px; }
  .header-actions { gap: 6px; }
  .desktop-audio-controls { display: none !important; }
  .mobile-audio-controls { 
    display: flex !important; 
    flex-direction: column; 
    align-items: stretch; 
    gap: 6px; 
    padding: 10px 12px;
  }
  .reciter-selector { min-width: 100px; }
  .compact-audio-player { min-width: 140px; }
  .hero .ayah { 
    padding: 14px 18px; 
    font-size: 15px; 
    margin: 0 auto 14px; 
  }
  
  /* Mobile PDF quality improvements */
  .pdf-container {
    padding: 8px;
    max-height: 70vh;
  }
  .pdf-page {
    margin: 0 auto 12px;
    box-shadow: 0 1px 8px rgba(0,0,0,.15);
  }
  .lang-select { 
    appearance: none; 
    background-image: none;
    padding-right: 12px;
    min-width: 60px;
    text-indent: 0;
    font-size: 12px;
  }
}

.card { display: flex; align-items: center; gap: 12px; padding: 12px; border-radius: 14px; border: 1px solid var(--border); background: linear-gradient(180deg, var(--panel), transparent 160%); text-decoration: none; color: var(--text); transition: border-color .15s ease, transform .08s ease; }
.card:hover { border-color: var(--brand); }
.card:active { transform: translateY(1px); }
.badge { width: 36px; height: 36px; display: grid; place-items: center; border-radius: 10px; background: radial-gradient(circle at 30% 20%, var(--brand), var(--brand-2)); color: #fff; font-weight: 700; box-shadow: var(--shadow); }
.meta { color: var(--muted); font-size: 14px; }

/* Surah page */
.crumbs { color: var(--muted); margin: 18px 0; display: flex; gap: 8px; align-items: center; }
.viewer { padding-bottom: 60px; }
.viewer-header { display: flex; align-items: end; justify-content: space-between; gap: 16px; margin-bottom: 12px; }
.viewer-actions { display: flex; align-items: center; gap: 12px; }

/* Desktop Audio Controls */
.desktop-audio-controls {
  display: flex;
  align-items: center;
  gap: 12px;
}

/* Mobile Audio Controls */
.mobile-audio-controls {
  display: none;
  flex-direction: column;
  align-items: stretch;
  gap: 12px;
  margin-bottom: 16px;
  padding: 12px 16px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: var(--shadow);
}

/* Ensure desktop controls are visible on large screens */
@media (min-width: 901px) {
  .desktop-audio-controls {
    display: flex !important;
  }
  .mobile-audio-controls {
    display: none !important;
  }
}
.btn { display: inline-block; padding: 10px 12px; border-radius: 10px; background: var(--panel); border: 1px solid var(--border); color: var(--text); text-decoration: none; cursor: pointer; }
.btn.icon-btn { 
  padding: 8px; 
  width: 40px; 
  height: 40px; 
  display: flex; 
  align-items: center; 
  justify-content: center; 
  font-size: 18px; 
  transition: all 0.2s ease;
}
.btn.icon-btn:hover {
  background: var(--brand);
  color: white;
  transform: scale(1.05);
}
.btn.icon-btn:active {
  transform: scale(0.95);
}
.pager { display: inline-flex; align-items: center; gap: 6px; margin-right: 8px; }
.pdf-frame { width: 100%; height: min(80vh, 900px); border: 1px solid var(--border); border-radius: 12px; background: var(--panel); box-shadow: var(--shadow); }
.pdf-container { width: 100%; height: min(80vh, 900px); overflow: auto; border: 1px solid var(--border); border-radius: 12px; background: var(--panel); box-shadow: var(--shadow); padding: 16px; }
.pdf-page { 
  display: block; 
  margin: 0 auto 16px; 
  background: #fff; 
  box-shadow: 0 2px 12px rgba(0,0,0,.25); 
  border-radius: 6px; 
  position: relative;
  /* Improve quality on high DPI displays */
  image-rendering: -webkit-optimize-contrast;
  image-rendering: crisp-edges;
  image-rendering: pixelated;
  /* Ensure smooth scaling */
  image-rendering: auto;
  /* Better text rendering */
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Hide page numbers and any PDF.js page indicators */
.pdf-page::before,
.pdf-page::after,
.pdf-page .pageNumber,
.pdf-page .page-number,
.pdf-page .textLayer,
.pdf-page .annotationLayer {
  display: none !important;
}

/* Audio Player Styles */
.reciter-selector {
  min-width: 200px;
  margin-right: 12px;
}

.reciter-select {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  cursor: pointer;
}

.reciter-select:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 2px rgba(34, 193, 195, 0.2);
}

.compact-audio-player {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 8px 12px;
  margin-right: 12px;
  min-width: 200px;
  height: 40px;
}

.audio-btn {
  background: transparent;
  color: var(--text);
  border: none;
  border-radius: 50%;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
  font-size: 14px;
}

.audio-btn:hover {
  background: var(--border);
  transform: scale(1.1);
}

.audio-btn:active {
  transform: scale(0.95);
}

.compact-play-btn {
  background: var(--brand);
  color: white;
}

.compact-play-btn:hover {
  background: var(--brand-hover);
}

.audio-time {
  font-size: 12px;
  color: var(--muted);
  white-space: nowrap;
  min-width: 35px;
  text-align: center;
}

.audio-progress-bar {
  flex: 1;
  height: 4px;
  background: var(--border);
  border-radius: 2px;
  overflow: hidden;
  cursor: pointer;
  position: relative;
}

.progress-fill {
  height: 100%;
  background: var(--brand);
  border-radius: 2px;
  width: 0%;
  transition: width 0.1s ease;
}


/* Mobile responsiveness for audio player */
@media (max-width: 768px) {
  .reciter-selector {
    min-width: 150px;
    margin-right: 8px;
  }
  
  .compact-audio-player {
    min-width: 180px;
    margin-right: 8px;
  }
  
  .audio-time {
    font-size: 11px;
    min-width: 30px;
  }
  
  .footer-links { 
    flex-direction: column; 
    align-items: flex-start; 
    gap: 8px; 
  }
}

@media (max-width: 768px) {
  .viewer-actions {
    flex-wrap: wrap;
    gap: 8px;
  }
  
  .reciter-selector {
    min-width: 150px;
    margin-right: 8px;
  }
  
  .compact-audio-player {
    min-width: 180px;
    margin-right: 8px;
  }
}

@media (max-width: 480px) {
  .viewer-actions {
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
  }
  
  .reciter-selector {
    order: 1;
    width: 100%;
    min-width: auto;
    margin-right: 0;
    margin-bottom: 0;
  }
  
  .compact-audio-player {
    order: 2;
    width: 100%;
    min-width: auto;
    margin-right: 0;
    margin-bottom: 0;
  }
}

/* Footer */
.site-footer { border-top: 1px solid var(--border); padding: 20px 0 30px; color: var(--muted); }
.footer-grid { display: flex; align-items: center; justify-content: space-between; }
.muted { color: var(--muted); text-decoration: none; }

/* Safari-specific fixes */
@supports (-webkit-appearance: none) {
  .mobile-app-section {
    background: #1a1f2e !important;
    background-image: linear-gradient(135deg, #1a1f2e 0%, #121722 100%) !important;
  }
  
  .feature {
    background: #1a1f2e !important;
    background-color: #1a1f2e !important;
  }
  
  .app-link {
    background: #1a1f2e !important;
    background-color: #1a1f2e !important;
  }
  
  .app-content h2 {
    color: #22c1c3 !important;
    background: linear-gradient(135deg, #22c1c3, #6366f1) !important;
    -webkit-background-clip: text !important;
    background-clip: text !important;
    color: transparent !important;
  }
  
  .app-description {
    color: #9fb0c3 !important;
  }
  
  .feature-text h3 {
    color: #e7edf3 !important;
  }
  
  .feature-text p {
    color: #9fb0c3 !important;
  }
  
  /* Light theme overrides for Safari */
  [data-theme="light"] .mobile-app-section {
    background: #ffffff !important;
    background-image: linear-gradient(135deg, #ffffff 0%, #f5f7fb 100%) !important;
  }
  
  [data-theme="light"] .feature {
    background: #ffffff !important;
    background-color: #ffffff !important;
  }
  
  [data-theme="light"] .app-link {
    background: #ffffff !important;
    background-color: #ffffff !important;
  }
  
  [data-theme="light"] .app-content h2 {
    color: #1e88e5 !important;
    background: linear-gradient(135deg, #1e88e5, #6366f1) !important;
    -webkit-background-clip: text !important;
    background-clip: text !important;
    color: transparent !important;
  }
  
  [data-theme="light"] .app-description {
    color: #5b6b7a !important;
  }
  
  [data-theme="light"] .feature-text h3 {
    color: #0b1320 !important;
  }
  
  [data-theme="light"] .feature-text p {
    color: #5b6b7a !important;
  }
  
  .app-link:hover {
    background: var(--hover-bg) !important;
    background-color: var(--hover-bg) !important;
  }
}

