/* ---------- Theme tokens ---------- */
:root, [data-theme="dark"] {
  --base-font-size: 16px;
  --font-arabic: 'Amiri Quran', serif;
  --font-sans: 'Inter', -apple-system, sans-serif;
  --bg: #0B1110;          /* Deep dark emerald/slate base */
  --surface: #111A18;     /* Slightly lighter for cards */
  --surface-2: #192623;   /* Interactive elements */
  --surface-glass: rgba(17, 26, 24, 0.7);
  --hairline: #243632;
  --hairline-soft: rgba(36, 54, 50, 0.6);
  --ivory: #F2EFE9;       /* Text primary */
  --body: #A1AFA9;        /* Text secondary */
  --muted: #64746E;       /* Text tertiary */
  --gold: #D4AF37;        /* Premium gold */
  --gold-dim: #997A1F;
  --gold-glass: rgba(212, 175, 55, 0.1);
  --chrome: rgba(11, 17, 16, 0.85);
  --sheet-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
  --radius: 12px;
  --accent-red: #E74C3C;
  --accent-green: #2ECC71;
}

[data-theme="light"] {
  --bg: #F9F7F1;
  --surface: #FFFFFF;
  --surface-2: #F0EDE1;
  --surface-glass: rgba(255, 255, 255, 0.8);
  --hairline: #E5DFC8;
  --hairline-soft: rgba(229, 223, 200, 0.7);
  --ivory: #1A1C1A;       /* Text primary */
  --body: #4A524E;        /* Text secondary */
  --muted: #848F89;       /* Text tertiary */
  --gold: #5E4014;        /* Very dark premium gold for maximum contrast on light bg */
  --gold-dim: #7A5C1E;
  --gold-glass: rgba(94, 64, 20, 0.1);
  --chrome: rgba(249, 247, 241, 0.85);
  --sheet-shadow: 0 8px 24px rgba(166, 124, 0, 0.08);
  --radius: 12px;
  --accent-red: #C0392B;
  --accent-green: #27AE60;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  background: var(--bg);
  color: var(--body);
  font-family: var(--font-sans);
  font-weight: 300;
  line-height: 1.6;
  min-height: 100vh;
  transition: background 0.3s ease, color 0.3s ease;
  overflow-x: hidden;
}

/* ---------- Typography ---------- */
.font-arabic { font-family: 'Amiri Quran', serif; }
.font-mono { font-family: var(--font-sans); }

/* ---------- Glass Header ---------- */
header {
  position: sticky; top: 0; z-index: 100;
  background: var(--chrome);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--hairline);
  transition: all 0.3s ease;
}
.bar {
  max-width: 1100px; margin: 0 auto;
  padding: 16px 24px;
  display: flex; align-items: center; justify-content: space-between; gap: 14px; flex-wrap: wrap;
}
.brand { display: flex; align-items: baseline; gap: 10px; cursor: pointer; }
.brand h1 {
  font-size: 18px; font-weight: 600; color: var(--ivory); letter-spacing: 0.1em; text-transform: uppercase;
}
.brand .dot { width: 6px; height: 6px; border-radius: 50%; background: var(--gold); align-self: center; box-shadow: 0 0 8px var(--gold); }
.controls { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; flex: 1 1 auto; justify-content: flex-end; }

/* ---------- UI Elements ---------- */
select.ui, input.ui, button.ui {
  background: var(--surface-2); color: var(--ivory);
  border: 1px solid var(--hairline); border-radius: 8px;
  padding: 8px 12px; font-family: var(--font-sans); font-size: 12px;
  letter-spacing: 0.04em; outline: none; transition: all 0.2s ease;
}
select.ui { cursor: pointer; max-width: 190px; }
select.ui:focus, input.ui:focus, button.ui:hover { border-color: var(--gold); }
input.ui { width: 70px; text-align: center; }
button.ui {
  width: 38px; height: 38px; cursor: pointer; font-size: 16px; line-height: 1;
  display: inline-flex; align-items: center; justify-content: center; padding: 0;
}
button.ui.text-btn { width: auto; padding: 0 16px; font-family: var(--font-sans); font-weight: 500; letter-spacing: 0.05em; }
button.ui.primary { background: var(--gold); color: #fff; border-color: var(--gold); }
button.ui.primary:hover { filter: brightness(1.1); box-shadow: 0 0 12px var(--gold-glass); }

/* ---------- Verified Badge ---------- */
.badge-verified {
  display: inline-flex; align-items: center; gap: 4px;
  background: rgba(46, 204, 113, 0.15); color: var(--accent-green);
  padding: 2px 6px; border-radius: 4px; font-size: 9px; font-weight: 600; text-transform: uppercase;
  letter-spacing: 0.1em; margin-left: 8px; border: 1px solid rgba(46, 204, 113, 0.3);
}

/* ---------- Views (Home vs Reader) ---------- */
#homeView, #readerView { display: none; opacity: 0; transition: opacity 0.4s ease; }
#homeView.active, #readerView.active { display: block; opacity: 1; }

/* ---------- Home View (Islamic Premium) ---------- */
.hero {
  text-align: center; padding: 100px 20px;
  background: radial-gradient(circle at center, var(--surface-2) 0%, var(--bg) 100%);
  position: relative; overflow: hidden;
}
.hero::before {
  content: ""; position: absolute; top: 0; left: 0; right: 0; bottom: 0;
  background-image: url('data:image/svg+xml;utf8,<svg width="60" height="60" viewBox="0 0 60 60" xmlns="http://www.w3.org/2000/svg"><path d="M30 0L60 30L30 60L0 30Z" fill="%23D4AF37" fill-opacity="0.03"/></svg>');
  pointer-events: none;
}
.hero h2 { font-size: 48px; color: var(--gold); font-family: 'Amiri Quran', serif; margin-bottom: 16px; text-shadow: 0 4px 12px rgba(0,0,0,0.3); }
.hero p { font-size: 18px; color: var(--ivory); max-width: 600px; margin: 0 auto 32px; font-weight: 400; }
.surah-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 20px; max-width: 1100px; margin: 0 auto; padding: 0 24px 80px;
}
.surah-card {
  background: var(--surface); border: 1px solid var(--hairline);
  border-radius: var(--radius); padding: 24px; cursor: pointer;
  transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
  display: flex; justify-content: space-between; align-items: center;
  position: relative; overflow: hidden;
}
.surah-card:hover {
  transform: translateY(-4px); border-color: var(--gold);
  box-shadow: 0 12px 24px rgba(0,0,0,0.2);
}
.surah-card::after {
  content: ""; position: absolute; top: 0; right: 0; width: 100px; height: 100%;
  background: linear-gradient(90deg, transparent, var(--gold-glass));
  opacity: 0; transition: opacity 0.3s;
}
.surah-card:hover::after { opacity: 1; }
.surah-number { font-family: var(--font-sans); font-size: 14px; color: var(--gold); font-weight: 500; background: var(--surface-2); width: 36px; height: 36px; display: flex; align-items: center; justify-content: center; border-radius: 50%; }
.surah-info { flex: 1; margin: 0 16px; }
.surah-info .en { font-size: 16px; color: var(--ivory); font-weight: 500; margin-bottom: 4px; }
.surah-info .meaning { font-size: 12px; color: var(--muted); }
.surah-ar { font-family: 'Amiri Quran', serif; font-size: 24px; color: var(--gold); }

/* ---------- Reader View ---------- */
main.reader { max-width: 980px; margin: 0 auto; padding: 36px 20px 120px; }
.sheet {
  background: var(--surface); border: 1px solid var(--hairline);
  border-radius: var(--radius); box-shadow: var(--sheet-shadow);
  padding: clamp(24px, 5vw, 56px); position: relative;
}
.page-meta {
  display: flex; justify-content: space-between; align-items: center;
  font-family: var(--font-sans); font-size: 11px;
  letter-spacing: 0.14em; color: var(--muted); text-transform: uppercase; margin-bottom: 40px;
  padding-bottom: 16px; border-bottom: 1px dashed var(--hairline-soft);
}
.page-meta b { color: var(--gold); font-weight: 500; }

.surah-head { text-align: center; margin: 48px 0 32px; scroll-margin-top: 100px; }
.surah-head:first-child { margin-top: 0; }
.surah-head .frame {
  display: inline-block; border: 1px solid var(--gold-dim);
  border-radius: 8px; padding: 12px 40px; background: var(--gold-glass);
}
.surah-head .ar { font-size: 36px; color: var(--gold); line-height: 1.4; }
.surah-head .en { font-family: var(--font-sans); font-size: 11px; letter-spacing: 0.2em; text-transform: uppercase; color: var(--ivory); margin-top: 8px; }
.bismillah { font-size: 32px; color: var(--ivory); text-align: center; margin: 16px 0 32px; opacity: 0.9; }

.arabic {
  direction: rtl; text-align: justify; text-align-last: center;
  font-size: calc(var(--base-font-size) * 1.8); line-height: 2.4; color: var(--ivory);
  margin-bottom: 40px;
}
.arabic .marker { 
  color: var(--gold); font-size: 0.7em; margin: 0 8px; opacity: 0.8; 
  cursor: pointer; transition: all 0.2s; display: inline-block;
}
.arabic .marker:hover { transform: scale(1.1); opacity: 1; text-shadow: 0 0 12px var(--gold-glass); }
.arabic .marker.active { opacity: 1; font-weight: bold; text-shadow: 0 0 16px var(--gold-dim); }

.divider { display: flex; align-items: center; gap: 16px; margin: 48px 0 32px; }
.divider::before, .divider::after { content: ""; flex: 1; height: 1px; background: linear-gradient(90deg, transparent, var(--hairline), transparent); }
.divider span { font-family: var(--font-sans); font-size: 11px; letter-spacing: 0.2em; color: var(--gold); text-transform: uppercase; }

.tr {
  display: grid; grid-template-columns: 60px 1fr 40px; gap: 8px 16px;
  padding: 16px 0; border-bottom: 1px solid var(--hairline-soft);
  font-size: var(--base-font-size); font-weight: 300; color: var(--body); align-items: start;
  transition: background 0.2s; border-radius: 8px;
}
.tr:hover { background: var(--surface-2); padding-left: 12px; padding-right: 12px; margin-left: -12px; margin-right: -12px; }
.tr:last-child { border-bottom: none; }
.tr .ref { font-family: var(--font-sans); font-size: 12px; color: var(--gold-dim); padding-top: 4px; }
.tr .txt[dir="rtl"] { text-align: right; font-size: 18px; }
.tr .actions { display: flex; justify-content: flex-end; }
.btn-bookmark {
  background: none; border: none; color: var(--muted); font-size: 18px; cursor: pointer;
  transition: color 0.2s, transform 0.2s; padding: 4px;
}
.btn-bookmark:hover { color: var(--gold); transform: scale(1.1); }
.btn-bookmark.active { color: var(--gold); }

/* ---------- Pager ---------- */
.pager {
  position: fixed; bottom: 0; left: 0; right: 0;
  background: var(--chrome); backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px);
  border-top: 1px solid var(--hairline); z-index: 100;
  display: flex; justify-content: center;
}
.pager .nav {
  background: none; border: none; font-family: var(--font-sans);
  font-size: 12px; font-weight: 500; color: var(--muted); text-transform: uppercase;
  letter-spacing: 0.1em; cursor: pointer; padding: 16px 24px; transition: color 0.2s;
}
.pager .nav:hover { color: var(--gold); }
.pager .nav:disabled { opacity: 0.2; cursor: default; }

/* ---------- Verified Badge ---------- */
.badge-verified {
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 10px; font-weight: 600; padding: 2px 6px; border-radius: 4px;
  background: rgba(46, 204, 113, 0.1); color: var(--accent-green);
  border: 1px solid rgba(46, 204, 113, 0.2); margin-left: 8px;
  vertical-align: middle;
}
.svg-icon {
  display: inline-block; vertical-align: middle; width: 14px; height: 14px; margin-right: 6px;
}
.badge-verified svg {
  margin-right: 4px; margin-left: -2px;
}

/* ---------- Custom Dropdown ---------- */
.custom-select { position: relative; display: inline-block; }
.select-btn { min-width: 200px; max-width: 200px; text-align: left; display: flex; justify-content: space-between; align-items: center; }
.select-btn::after { content: "▼"; font-size: 10px; margin-left: 8px; }
.select-dropdown {
  position: absolute; top: calc(100% + 4px); left: 0; width: 350px; max-height: 400px; overflow-y: auto;
  background: var(--surface); border: 1px solid var(--hairline); border-radius: var(--radius);
  box-shadow: var(--shadow); z-index: 200; display: none; padding: 8px 0;
}
.custom-select.active .select-dropdown { display: block; }
.optgroup-label { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.1em; padding: 8px 16px; margin-top: 8px; font-family: var(--font-sans); }
.optgroup-label:first-child { margin-top: 0; }
.custom-option {
  padding: 10px 16px; cursor: pointer; display: flex; align-items: center; font-size: 14px;
}
.custom-option:hover, .custom-option.selected { background: var(--surface-2); }
.custom-option.hidden { display: none !important; }

/* ---------- Ayah Context Menu & Audio ---------- */
.context-menu {
  position: absolute; z-index: 500; background: var(--surface); border: 1px solid var(--hairline);
  border-radius: var(--radius); box-shadow: var(--shadow); padding: 8px 0; min-width: 150px;
}
.context-item {
  padding: 10px 16px; cursor: pointer; display: flex; align-items: center; font-size: 13px; color: var(--body);
}
.context-item:hover { background: var(--surface-2); color: var(--gold); }
.context-item .icon { color: var(--gold); margin-right: 8px; font-size: 14px; width: 16px; text-align: center; }

.icon-btn { padding: 4px 10px; font-size: 14px; background: transparent; border: 1px solid var(--hairline); border-radius: var(--radius); color: var(--gold); cursor: pointer; transition: all 0.2s; }
.icon-btn:hover { background: var(--surface-2); transform: scale(1.05); }

.arabic .marker.playing { opacity: 1; color: var(--accent-green) !important; animation: pulse 1.5s infinite; text-shadow: 0 0 10px rgba(46, 204, 113, 0.5); }
.ayah-text { transition: color 0.3s ease, text-shadow 0.3s ease; }
.ayah-text.playing { color: var(--accent-green); text-shadow: 0 0 10px rgba(46, 204, 113, 0.3); }
.ayah-text.active { color: var(--gold); text-shadow: 0 0 10px rgba(220, 165, 80, 0.3); }

.tr { transition: background 0.3s ease, outline 0.3s ease; }
.tr.playing { background: rgba(46, 204, 113, 0.05); outline: 1px solid rgba(46, 204, 113, 0.2); border-radius: 8px; margin: 4px -12px; padding: 12px; border-bottom: none; }
.tr.playing:hover { background: rgba(46, 204, 113, 0.1); }
.tr.active { background: rgba(220, 165, 80, 0.05); outline: 1px solid rgba(220, 165, 80, 0.2); border-radius: 8px; margin: 4px -12px; padding: 12px; border-bottom: none; }
.tr.active:hover { background: rgba(220, 165, 80, 0.1); }

.ayah-playing { background: rgba(20, 20, 22, 0.6); outline: 1px solid var(--hairline-soft); border-radius: 8px; }

@keyframes pulse {
  0% { transform: scale(1); }
  50% { transform: scale(1.2); }
  100% { transform: scale(1); }
}
.custom-option.selected { background: var(--gold-glass); color: var(--gold); }

/* ---------- Modal (Auth) ---------- */
.modal-overlay {
  position: fixed; top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.6); backdrop-filter: blur(8px);
  z-index: 200; display: flex; align-items: center; justify-content: center;
  opacity: 0; pointer-events: none; transition: opacity 0.3s ease;
}
.modal-overlay.active { opacity: 1; pointer-events: all; }
.modal {
  background: var(--surface); border: 1px solid var(--hairline);
  border-radius: var(--radius); width: 100%; max-width: 400px;
  padding: 32px; position: relative; transform: translateY(20px); transition: transform 0.3s ease;
  box-shadow: 0 24px 64px rgba(0,0,0,0.5);
}
.modal-overlay.active .modal { transform: translateY(0); }
.modal-close {
  position: absolute; top: 16px; right: 16px; background: none; border: none;
  color: var(--muted); font-size: 24px; cursor: pointer; transition: color 0.2s;
}
.modal-close:hover { color: var(--ivory); }
.modal h3 { font-size: 24px; color: var(--ivory); margin-bottom: 24px; font-weight: 500; text-align: center; }
.form-group { margin-bottom: 16px; }
.form-group label { display: block; font-size: 12px; color: var(--muted); margin-bottom: 6px; text-transform: uppercase; letter-spacing: 0.05em; }
.form-group input {
  width: 100%; background: var(--surface-2); border: 1px solid var(--hairline);
  color: var(--ivory); padding: 12px 16px; border-radius: 8px; font-size: 16px;
  outline: none; transition: border-color 0.2s; font-family: inherit;
}
.form-group input:focus { border-color: var(--gold); }
.modal-btn {
  width: 100%; background: var(--gold); color: #fff; border: none;
  padding: 14px; border-radius: 8px; font-size: 16px; font-weight: 500;
  cursor: pointer; transition: all 0.2s; margin-top: 8px;
}
.modal-btn:hover { filter: brightness(1.1); box-shadow: 0 4px 16px var(--gold-glass); }
.modal-switch { text-align: center; margin-top: 24px; font-size: 14px; color: var(--muted); }
.modal-switch a { color: var(--gold); text-decoration: none; cursor: pointer; font-weight: 500; }
.modal-switch a:hover { text-decoration: underline; }
.error-msg { color: var(--accent-red); font-size: 13px; text-align: center; margin-bottom: 16px; min-height: 20px; }
.qr-container { text-align: center; margin: 20px 0; background: #fff; padding: 16px; border-radius: 8px; }

/* Bookmarks Sidebar/Dropdown */
.dropdown { position: relative; }
.dropdown-menu {
  position: absolute; top: calc(100% + 8px); right: 0; width: 300px;
  background: var(--surface); border: 1px solid var(--hairline);
  border-radius: var(--radius); box-shadow: 0 12px 32px rgba(0,0,0,0.5);
  display: none; flex-direction: column; max-height: 400px; overflow-y: auto;
}
.dropdown.active .dropdown-menu { display: flex; }
.dropdown-item {
  padding: 12px 16px; border-bottom: 1px solid var(--hairline-soft);
  cursor: pointer; transition: background 0.2s; display: flex; justify-content: space-between; align-items: center;
}
.dropdown-item:hover { background: var(--surface-2); }
.dropdown-item:last-child { border-bottom: none; }
.dropdown-item .title { color: var(--ivory); font-weight: 500; font-size: 14px; }
.dropdown-item .sub { color: var(--muted); font-size: 12px; }
.dropdown-item .del { color: var(--accent-red); background: none; border: none; cursor: pointer; padding: 4px; opacity: 0.7; }
.dropdown-item .del:hover { opacity: 1; }

@media(max-width:760px){
  .surah-grid { grid-template-columns: 1fr; }
  .arabic { font-size: calc(var(--base-font-size) * 1.4); } /* Mobile scaled font-size */
  .tr { grid-template-columns: 1fr; gap: 4px; padding-bottom: 24px; }
  .tr .ref { display: inline-block; margin-bottom: 4px; }
  .tr .actions { justify-content: flex-start; margin-top: 8px; }
}

body.fullscreen-mode main.reader {
  max-width: 100% !important;
  width: 100% !important;
  padding: 20px 5vw 120px !important;
}
body.fullscreen-mode .sheet {
  border: none !important;
  background: transparent !important;
  box-shadow: none !important;
  padding: 0 !important;
  position: relative;
}

/* ---------- Layout & Sidebar ---------- */

/* Media Player UI */
.media-player-card {
  background: var(--surface-glass);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--hairline);
  border-radius: 16px;
  padding: 20px 16px;
  box-shadow: var(--sheet-shadow);
  position: relative;
  overflow: hidden;
  margin-top: 16px;
}

.media-player-card::before {
  content: "";
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  background-image: radial-gradient(var(--gold-dim) 1px, transparent 1px);
  background-size: 16px 16px;
  opacity: 0.05;
  pointer-events: none;
}

.player-controls {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  margin-top: 24px;
  position: relative;
  z-index: 1;
}

.player-btn {
  border-radius: 50%;
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--surface-2);
  border: 1px solid var(--hairline-soft);
  color: var(--muted);
  transition: all 0.3s ease;
}

.player-btn:hover {
  background: var(--surface-2);
  border-color: var(--gold-dim);
  color: var(--ivory);
  transform: scale(1.05);
}

.player-btn.main-play {
  width: 56px;
  height: 56px;
  background: var(--gold);
  color: var(--bg);
  border: none;
  box-shadow: 0 4px 16px var(--gold-glass);
}

.player-btn.main-play:hover {
  background: var(--gold-dim);
  transform: scale(1.08);
  box-shadow: 0 6px 20px var(--gold-glass);
}

.layout-wrapper {
  display: flex;
  min-height: calc(100vh - 71px);
  position: relative;
}
.main-content {
  flex: 1;
  min-width: 0;
}

/* ---------- Premium Homepage Redesign ---------- */
.hero-section {
  position: relative;
  padding: 80px 24px;
  text-align: center;
  overflow: hidden;
  border-radius: var(--radius);
  margin-bottom: 60px;
  background: linear-gradient(135deg, var(--surface-2) 0%, var(--surface) 100%);
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.1);
  border: 1px solid var(--hairline);
}
.hero-bg-pattern {
  position: absolute;
  top: -50%; left: -50%; right: -50%; bottom: -50%;
  background-image: 
    radial-gradient(var(--gold-glass) 1px, transparent 1px),
    radial-gradient(var(--gold-glass) 1px, transparent 1px);
  background-size: 40px 40px;
  background-position: 0 0, 20px 20px;
  opacity: 0.4;
  transform: rotate(15deg);
  pointer-events: none;
  z-index: 1;
}
.hero-content {
  position: relative;
  z-index: 2;
  max-width: 800px;
  margin: 0 auto;
  animation: fadeUp 1s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}
.hero-title {
  font-size: 32px;
  color: var(--gold);
  margin-bottom: 16px;
  opacity: 0.9;
}
.hero-brand {
  font-size: 48px;
  font-weight: 700;
  color: var(--ivory);
  letter-spacing: 0.05em;
  margin-bottom: 16px;
  font-family: var(--font-sans);
}
.hero-subtitle {
  font-size: 18px;
  color: var(--body);
  margin-bottom: 32px;
  max-width: 600px;
  margin-left: auto;
  margin-right: auto;
}
.hero-actions {
  display: flex;
  gap: 16px;
  justify-content: center;
  flex-wrap: wrap;
}
.hero-btn {
  display: flex !important;
  align-items: center;
  justify-content: center;
  font-size: 16px !important;
  padding: 12px 32px !important;
  border-radius: 30px !important;
  height: auto !important;
  min-height: 48px !important;
  width: auto !important;
  line-height: normal !important;
  font-family: var(--font-sans) !important;
  font-weight: 600 !important;
  transition: transform 0.2s ease, box-shadow 0.2s ease !important;
}
.hero-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px var(--gold-glass) !important;
}
.hero-btn-outline {
  display: flex !important;
  align-items: center;
  justify-content: center;
  background: transparent !important;
  border: 1px solid var(--hairline) !important;
  color: var(--ivory) !important;
  font-size: 16px !important;
  padding: 12px 32px !important;
  border-radius: 30px !important;
  height: auto !important;
  min-height: 48px !important;
  width: auto !important;
  line-height: normal !important;
  font-family: var(--font-sans) !important;
  font-weight: 600 !important;
  transition: all 0.2s ease !important;
}
.hero-btn-outline:hover {
  border-color: var(--gold) !important;
  color: var(--gold) !important;
  transform: translateY(-2px);
}

.features-section {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 24px;
  margin-bottom: 60px;
}
.feature-card {
  background: var(--surface);
  border: 1px solid var(--hairline);
  border-radius: var(--radius);
  padding: 32px 24px;
  text-align: center;
  transition: transform 0.3s ease, border-color 0.3s ease;
  animation: fadeUp 1s cubic-bezier(0.16, 1, 0.3, 1) forwards;
  opacity: 0;
}
.feature-card:nth-child(1) { animation-delay: 0.1s; }
.feature-card:nth-child(2) { animation-delay: 0.2s; }
.feature-card:nth-child(3) { animation-delay: 0.3s; }
.feature-card:hover {
  transform: translateY(-4px);
  border-color: var(--gold);
}
.feature-icon {
  margin-bottom: 16px;
  filter: drop-shadow(0 4px 8px var(--gold-glass));
  display: flex;
  justify-content: center;
}
.feature-icon svg {
  display: block;
}
.feature-card h3 {
  font-size: 18px;
  color: var(--ivory);
  margin-bottom: 12px;
  font-weight: 600;
}
.feature-card p {
  font-size: 14px;
  color: var(--body);
}

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

@media(max-width: 768px) {
  .hero-section { padding: 40px 16px; margin-bottom: 40px; }
  .hero-brand { font-size: 32px; margin-bottom: 12px; }
  .hero-title { font-size: 24px; margin-bottom: 12px; }
  .hero-subtitle { font-size: 15px; margin-bottom: 24px; }
  .hero-actions { display: flex; flex-direction: column; width: 100%; gap: 12px; }
  .hero-btn, .hero-btn-outline { width: 100% !important; max-width: 100% !important; flex: 1 1 auto; }
  
  .features-section { grid-template-columns: 1fr; gap: 16px; margin-bottom: 40px; }
  
  .bar { padding: 8px 12px; justify-content: space-between; flex-wrap: nowrap; }
  .brand { margin-bottom: 0; }
  .brand h1 { font-size: 16px; }
  .controls { width: auto; justify-content: flex-end; gap: 8px; flex-wrap: nowrap; }
  .controls .ui { font-size: 13px; padding: 6px 10px; }
  
  .surah-card { padding: 16px; }
  .surah-info .en { font-size: 14px; }
  .surah-info .meaning { font-size: 11px; }
  
  main.reader { padding: 20px 12px 100px; }
  .surah-head .ar { font-size: 28px; }
  .bismillah { font-size: 24px; }
  .sheet { padding: 20px 16px; }
}

@media(max-width: 480px) {
  .hero-brand { font-size: 28px; }
  .feature-card { padding: 24px 16px; }
}

.sidebar {
  position: fixed;
  top: 0;
  right: 0;
  height: 100vh;
  width: 300px;
  max-width: 85vw;
  z-index: 1000;
  background: var(--surface);
  border-left: 1px solid var(--hairline);
  padding: 24px;
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}
.sidebar.open {
  transform: translateX(0);
  box-shadow: -10px 0 30px rgba(0,0,0,0.5);
}
.sidebar-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
}
.sidebar-content {
  flex: 1;
  overflow-y: auto;
}
.sidebar-content::-webkit-scrollbar {
  width: 4px;
}
.sidebar-content::-webkit-scrollbar-thumb {
  background: var(--hairline-soft);
  border-radius: 4px;
}

.hamburger-btn {
  display: inline-flex;
}

@media(min-width:1024px) {
  .sidebar-overlay {
    display: none !important;
  }
}
.sidebar-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 999;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease;
  display: block;
}
.sidebar-overlay.open {
  opacity: 1;
  visibility: visible;
}

.pwd-toggle { position: absolute; right: 12px; bottom: 12px; cursor: pointer; color: var(--muted); font-size: 16px; user-select: none; }
.pwd-toggle:hover { color: var(--gold); }
