@font-face {
  font-family: "KFGQPC Uthman Taha Naskh";
  src: url("/quran/fonts/UthmanTN1-Ver10.woff2") format("woff2");
  font-display: swap;
}

:root {
  color-scheme: light;
  --arabic-scale: 1;
  --arabic-font-size-adjust: 1;
  --arabic-line-height: 2.05;
  --arabic-letter-spacing: 0em;
  --arabic-font-family: "Scheherazade New", "Amiri Quran", "LPMQ", serif;
  --q-bg-1: #f8fafc;
  --q-bg-2: #eef2ff;
  --q-ink: #0f172a;
  --q-muted: #475569;
  --q-line: #e2e8f0;
  --q-brand: #1d4ed8;
  --q-brand-2: #0284c7;
}

html,
body {
  background: radial-gradient(circle at top left, var(--q-bg-2) 0%, var(--q-bg-1) 45%, #ffffff 100%) !important;
}

body {
  font-family: "Quicksand", "Segoe UI", sans-serif !important;
  color: var(--q-ink) !important;
  font-size: 15px;
  line-height: 1.45;
}

a,
a:visited {
  color: inherit;
}

.header,
.page-wrapper,
.ayah-wrapper {
  width: min(100%, 960px);
  margin-left: auto !important;
  margin-right: auto !important;
}

.header { background: linear-gradient(135deg, rgba(30,58,138,0.2), rgba(30,58,138,0.05));
  margin-top: 0 !important;
  margin-bottom: 1rem !important;
  padding: 0.7rem 0.75rem 0.1rem !important;
}

.header h1 {
  font-size: clamp(1rem, 2vw, 1.28rem) !important;
  line-height: 1.3;
}

.header h2.surah-count,
.header h2.page-name,
.page-heading,
.ayah-tafsir-title,
.ayah-number {
  color: var(--q-ink) !important;
}

.header h2.surah-count {
  font-size: 0.92rem !important;
}

.header h2.page-name {
  font-size: 0.84rem !important;
  margin-bottom: 0.75rem !important;
  padding-top: 0.4rem !important;
}

.surah-number-name {
  background: linear-gradient(135deg, var(--q-brand), var(--q-brand-2)) !important;
  border: none !important;
  box-shadow: 0 8px 16px rgba(14, 165, 164, 0.2);
  font-size: 0.65em !important;
}

.page-wrapper {
  padding-left: 0.75rem !important;
  padding-right: 0.75rem !important;
}

.ayah-wrapper {
  background: rgba(255, 255, 255, 0.86);
  border: 1px solid var(--q-line);
  border-radius: 14px;
  box-shadow: 0 12px 30px rgba(15, 23, 42, 0.06);
  padding: 0.7rem 0.7rem 1.1rem !important;
  backdrop-filter: blur(2px);
}

.search-wrapper {
  margin-bottom: 0.7rem !important;
}

.search-keywords,
.goto-ayah {
  font-family: "Quicksand", sans-serif !important;
  border: 1px solid var(--q-line) !important;
  border-radius: 10px !important;
  background: #fff !important;
  padding: 0.32rem 0.52rem !important;
}

.search-keywords {
  font-size: 0.95rem !important;
}

.goto-ayah {
  font-size: 0.82rem !important;
}

.ayah {
  margin-bottom: 0.35rem !important;
}

.ayah-text {
  background: linear-gradient(180deg, #f8fafc 0%, #f1f5f9 100%) !important;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  overflow: hidden;
  font-size: clamp(2rem, 3.6vw, 2.9rem) !important;
}

.ayah-text p {
  line-height: 2.05 !important;
  padding: 0.5rem 0.55rem 0.5rem 0.36rem !important;
}

.ayah-translation {
  color: var(--q-muted) !important;
  font-style: normal !important;
  font-size: 0.95rem !important;
  background: #fff;
  border: 1px solid var(--q-line);
  border-top: 0;
  border-radius: 0 0 12px 12px;
  padding: 0.6rem 0.55rem 0.75rem !important;
  margin-bottom: 0.85rem !important;
}

.ayah-translation p {
  line-height: 1.55 !important;
  padding: 0.1rem 0.15rem !important;
}

.ayah-tafsir-wrapper {
  border: 1px dashed #cbd5e1;
  border-radius: 10px;
  padding: 0.55rem !important;
  background: #fff;
}

.ayah-tafsir-title {
  font-size: 1rem !important;
  padding-bottom: 0.35rem !important;
}

.ayah-tafsir,
.page-wrapper p,
.page-wrapper li {
  font-size: 0.93rem !important;
  line-height: 1.5 !important;
}

.ayah-toolbar {
  margin: 0.3rem 0 1.3rem !important;
}

.icon-ayah-toolbar {
  border-radius: 9px;
  background: #e2e8f0 !important;
  color: #0f172a !important;
  width: 1.7em !important;
  height: 1.7em !important;
}

.ayah-prev,
.ayah-next {
  background: #fff;
  border: 1px solid var(--q-line);
  border-radius: 10px;
  min-width: 38px;
  min-height: 36px;
  display: inline-flex;
  justify-content: center;
  align-items: center;
  box-shadow: 0 3px 10px rgba(15, 23, 42, 0.06);
}

.sidepage {
  background: rgba(255, 255, 255, 0.96) !important;
  border-right: 1px solid var(--q-line);
}

.sidepage-item {
  border-bottom: 1px solid #eef2ff !important;
}

.sidepage-item:hover {
  background: #f8fafc !important;
}

@media (max-width: 768px) {
  body {
    font-size: 14px;
  }

  .header,
  .page-wrapper,
  .ayah-wrapper {
    width: calc(100% - 0.65rem);
  }

  .header { background: linear-gradient(135deg, rgba(30,58,138,0.2), rgba(30,58,138,0.05));
    margin-bottom: 0.8rem !important;
    padding: 0.5rem 0.35rem 0 !important;
  }

  .page-wrapper {
    padding-left: 0.35rem !important;
    padding-right: 0.35rem !important;
  }

  .ayah-wrapper {
    border-radius: 12px;
    box-shadow: 0 8px 22px rgba(15, 23, 42, 0.06);
    padding: 0.55rem 0.5rem 0.8rem !important;
  }

  .ayah-text {
    font-size: clamp(1.55rem, 7vw, 2.35rem) !important;
  }

  .ayah-text p {
    line-height: 1.9 !important;
    padding: 0.42rem 0.45rem 0.42rem 0.26rem !important;
  }

  .ayah-translation {
    font-size: 0.9rem !important;
  }

  .label-goto-ayah {
    font-size: 0.8rem !important;
  }
}

/* Mobile comfort overrides */
@media (max-width: 768px) {
  html,
  body {
    overflow-x: hidden;
  }

  .header,
  .page-wrapper,
  .ayah-wrapper {
    width: 100% !important;
    max-width: 100% !important;
  }

  .menu {
    top: 0.25rem !important;
    left: 0.35rem !important;
  }

  .linemenu {
    width: 20px !important;
    height: 3px !important;
    margin: 3px 0 !important;
  }

  .goto-ayah-wrapper {
    position: static !important;
    top: auto !important;
    margin: 0.25rem 0 0.45rem !important;
    text-align: left !important;
  }

  .label-goto-ayah {
    display: inline-block;
    margin-right: 0.3rem;
  }

  .ayah-toolbar {
    margin: 0.2rem 0 0.7rem !important;
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 0.25rem;
    flex-wrap: wrap;
  }

  .icon-ayah-toolbar {
    float: none !important;
    margin-left: 0 !important;
    width: 1.55em !important;
    height: 1.55em !important;
    font-size: 0.95rem !important;
  }

  .ayah-prev,
  .ayah-next {
    min-width: 34px;
    min-height: 32px;
    font-size: 0.95rem;
  }

  .sidepage {
    width: min(92vw, 340px) !important;
    max-width: 92vw !important;
  }

  .sidepage-item-link {
    font-size: 0.92rem !important;
    padding-top: 0.6rem !important;
    padding-bottom: 0.6rem !important;
  }
}

@media (max-width: 480px) {
  body {
    font-size: 13px;
  }

  .header h1 {
    font-size: 0.98rem !important;
  }

  .header h2.surah-count {
    font-size: 0.84rem !important;
  }

  .header h2.page-name {
    font-size: 0.78rem !important;
  }

  .ayah-wrapper {
    border-radius: 10px;
    padding: 0.45rem 0.4rem 0.65rem !important;
  }

  .ayah-text {
    font-size: clamp(1.35rem, 7.8vw, 2rem) !important;
  }

  .ayah-text p {
    line-height: 1.75 !important;
    padding: 0.36rem 0.36rem 0.36rem 0.2rem !important;
  }

  .ayah-translation,
  .ayah-tafsir,
  .page-wrapper p,
  .page-wrapper li {
    font-size: 0.86rem !important;
  }
}

/* Surah list (home) compact */
.surah-list {
  margin-top: 0.35rem !important;
}

.surah-index {
  padding: 0.5rem 2.2rem 0.45rem 0.7rem !important;
  margin-bottom: 0.42rem !important;
  border-radius: 10px;
  border: 1px solid var(--q-line);
  background: #ffffff !important;
}

.surah-index-name {
  font-size: clamp(1rem, 1.35vw, 1.18rem) !important;
  line-height: 1.3 !important;
  font-weight: 600;
  letter-spacing: 0;
}

.surah-index-ayah {
  font-size: 0.82rem !important;
  color: var(--q-muted);
  margin-top: 0.16rem;
}

.surah-index-name__latin {
  font-family: "Quicksand", sans-serif !important;
}

.surah-index-name__arabic {
  font-family: "KFGQPC Uthman Taha Naskh", "LPMQ", serif !important;
  font-size: 1.05em;
  display: inline-block;
  margin-inline-start: 0.08em;
}

.surah-index-number {
  font-size: 0.82rem !important;
  right: 0.55rem !important;
  top: 0.48rem !important;
  opacity: 0.75;
}

@media (max-width: 768px) {
  .surah-index {
    padding: 0.42rem 2rem 0.4rem 0.58rem !important;
    margin-bottom: 0.34rem !important;
  }

  .surah-index-name {
    font-size: 0.96rem !important;
    line-height: 1.25 !important;
    font-weight: 600;
  }

  .surah-index-ayah {
    font-size: 0.76rem !important;
  }

  .surah-index-number {
    font-size: 0.74rem !important;
    right: 0.48rem !important;
    top: 0.42rem !important;
  }
}

@media (max-width: 480px) {
  .surah-index-name {
    font-size: 0.9rem !important;
  }
}

/* Viewport-based typography for surah list */
.surah-index-name {
  font-size: 1.35vw !important;
}

.surah-index-ayah {
  font-size: 0.88vw !important;
}

.surah-index-number {
  font-size: 0.9vw !important;
}

@media (max-width: 992px) {
  .surah-index-name {
    font-size: 2.2vw !important;
  }

  .surah-index-ayah {
    font-size: 1.45vw !important;
  }

  .surah-index-number {
    font-size: 1.35vw !important;
  }
}

@media (max-width: 768px) {
  .surah-index-name {
    font-size: 3.75vw !important;
  }

  .surah-index-ayah {
    font-size: 2.45vw !important;
  }

  .surah-index-number {
    font-size: 2.2vw !important;
  }
}

@media (max-width: 480px) {
  .surah-index-name {
    font-size: 4.4vw !important;
  }

  .surah-index-ayah {
    font-size: 2.9vw !important;
  }

  .surah-index-number {
    font-size: 2.7vw !important;
  }
}

/* 3D card treatment including between-surah items */
.surah-list {
  display: grid;
  gap: 0.5rem;
}

.surah-index {
  border: 1px solid #dbe4ef !important;
  border-top-color: #eef4fb !important;
  border-left-color: #eef4fb !important;
  box-shadow:
    0 10px 18px rgba(15, 23, 42, 0.08),
    0 2px 0 rgba(255, 255, 255, 0.85) inset,
    0 -1px 0 rgba(15, 23, 42, 0.05) inset !important;
  transform: translateY(0);
  transition: transform 160ms ease, box-shadow 160ms ease, border-color 160ms ease;
}

.surah-index:hover {
  transform: translateY(-2px);
  border-color: #c9d8e8 !important;
  box-shadow:
    0 14px 24px rgba(15, 23, 42, 0.12),
    0 2px 0 rgba(255, 255, 255, 0.92) inset,
    0 -1px 0 rgba(15, 23, 42, 0.06) inset !important;
}

.ayah-wrapper,
.ayah-text,
.ayah-translation,
.ayah-tafsir-wrapper {
  border-color: #d9e3ef !important;
  box-shadow:
    0 10px 20px rgba(15, 23, 42, 0.07),
    0 1px 0 rgba(255, 255, 255, 0.9) inset !important;
}

@media (max-width: 768px) {
  .surah-list {
    gap: 0.38rem;
  }

  .surah-index {
    box-shadow:
      0 7px 14px rgba(15, 23, 42, 0.08),
      0 1px 0 rgba(255, 255, 255, 0.86) inset !important;
  }

  .surah-index:hover {
    transform: translateY(-1px);
  }
}

/* Surah reading view: default clean Arabic-only */
.arabic-only .ayah-translation,
.arabic-only .ayah-tafsir-wrapper {
  display: none !important;
}

.arabic-only .ayah-text {
  font-size: clamp(1.45rem, 2.8vw, 2.2rem) !important;
}

.arabic-only .ayah-text p {
  line-height: 1.95 !important;
}

@media (max-width: 768px) {
  .arabic-only .ayah-text {
    font-size: clamp(1.15rem, 6.2vw, 1.75rem) !important;
  }

  .arabic-only .ayah-text p {
    line-height: 1.75 !important;
    padding: 0.34rem 0.34rem 0.34rem 0.2rem !important;
  }
}

/* Floating vertical nav on ayah page */
.arabic-only .ayah-prev-next-wrapper {
  position: static !important;
  height: 0 !important;
  margin: 0 !important;
}

.arabic-only .ayah-prev,
.arabic-only .ayah-next {
  position: fixed !important;
  top: 50vh !important;
  transform: translateY(-50%);
  z-index: 80;
  width: 44px;
  height: 44px;
  border-radius: 999px;
  border: 1px solid #d6e1ef !important;
  background: rgba(255, 255, 255, 0.96) !important;
  box-shadow:
    0 10px 22px rgba(15, 23, 42, 0.14),
    0 1px 0 rgba(255, 255, 255, 0.92) inset !important;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.15rem;
  line-height: 1;
}

.arabic-only .ayah-prev {
  left: max(8px, calc((100vw - min(100vw, 960px)) / 2 - 54px)) !important;
}

.arabic-only .ayah-next {
  right: max(8px, calc((100vw - min(100vw, 960px)) / 2 - 54px)) !important;
}

.arabic-only .ayah-prev:hover,
.arabic-only .ayah-next:hover {
  transform: translateY(-50%) translateY(-1px);
  box-shadow:
    0 14px 26px rgba(15, 23, 42, 0.18),
    0 1px 0 rgba(255, 255, 255, 0.96) inset !important;
}

.arabic-only .ayah-prev.bottom,
.arabic-only .ayah-next.bottom {
  display: none !important;
}

@media (max-width: 1024px) {
  .arabic-only .ayah-prev {
    left: 8px !important;
  }

  .arabic-only .ayah-next {
    right: 8px !important;
  }
}

@media (max-width: 768px) {
  .arabic-only .ayah-prev,
  .arabic-only .ayah-next {
    width: 40px;
    height: 40px;
    font-size: 1.04rem;
    top: 52vh !important;
  }

  .arabic-only .ayah-prev {
    left: 5px !important;
  }

  .arabic-only .ayah-next {
    right: 5px !important;
  }
}

/* Modern hamburger + JS toggle side menu */
.menu {
  position: fixed !important;
  top: 12px !important;
  left: 12px !important;
  z-index: 130 !important;
}

.menu a {
  width: 44px;
  height: 44px;
  border-radius: 999px;
  border: 1px solid #d8e3ef;
  background: rgba(255, 255, 255, 0.94);
  box-shadow: 0 10px 22px rgba(15, 23, 42, 0.16), 0 1px 0 rgba(255, 255, 255, 0.95) inset;
  display: inline-flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 4px;
  backdrop-filter: blur(4px);
}

.linemenu {
  width: 18px !important;
  height: 2px !important;
  border-radius: 4px;
  margin: 0 !important;
  background: #0f172a !important;
  transition: transform 170ms ease, opacity 170ms ease;
}

.sidepage-close {
  display: none !important;
}

.sidepage {
  display: none !important;
  opacity: 0;
  transform: translateX(-12px);
  pointer-events: none;
  transition: opacity 180ms ease, transform 180ms ease;
  width: min(92vw, 360px) !important;
  max-width: 92vw !important;
  min-height: 100vh !important;
  height: 100vh !important;
  position: fixed !important;
  top: 0 !important;
  left: 0 !important;
  z-index: 120 !important;
  background: rgba(255, 255, 255, 0.985) !important;
  border-right: 1px solid #d9e4f1 !important;
  box-shadow: 16px 0 36px rgba(15, 23, 42, 0.18);
  overflow-y: auto;
}

.sidepage:target {
  display: none !important;
}

body.sidepage-open .sidepage {
  display: block !important;
  opacity: 1;
  transform: translateX(0);
  pointer-events: auto;
}

body.sidepage-open::before {
  content: "";
  position: fixed;
  inset: 0;
  background: rgba(2, 6, 23, 0.24);
  z-index: 110;
}

body.sidepage-open .menu a {
  background: rgba(15, 23, 42, 0.95);
  border-color: #0f172a;
  box-shadow: 0 12px 24px rgba(2, 6, 23, 0.32);
}

body.sidepage-open .linemenu {
  background: #f8fafc !important;
}

body.sidepage-open .linemenu:nth-child(1) {
  transform: translateY(6px) rotate(45deg);
}

body.sidepage-open .linemenu:nth-child(2) {
  opacity: 0;
}

body.sidepage-open .linemenu:nth-child(3) {
  transform: translateY(-6px) rotate(-45deg);
}

@media (max-width: 768px) {
  .menu {
    top: 9px !important;
    left: 9px !important;
  }

  .menu a {
    width: 40px;
    height: 40px;
  }

  .sidepage {
    width: min(94vw, 330px) !important;
    max-width: 94vw !important;
  }
}

/* Requested: hide translation by default + remove per-ayah action buttons */
.arabic-only .ayah-translation,
.arabic-only .ayah-tafsir-wrapper {
  display: none !important;
}

.arabic-only .ayah-toolbar {
  display: none !important;
}

/* Arabic size tuning: smaller on desktop + optimized mobile */
.arabic-only .ayah-text {
  font-size: clamp(1.1rem, 2vw, 1.7rem) !important;
}

.arabic-only .ayah-text p {
  line-height: 1.65 !important;
  padding: 0.28rem 0.3rem 0.28rem 0.16rem !important;
}

@media (max-width: 768px) {
  .arabic-only .ayah-text {
    font-size: clamp(0.98rem, 4.8vw, 1.34rem) !important;
  }

  .arabic-only .ayah-text p {
    line-height: 1.52 !important;
    padding: 0.22rem 0.22rem 0.22rem 0.12rem !important;
  }
}

@media (max-width: 480px) {
  .arabic-only .ayah-text {
    font-size: clamp(0.9rem, 5.2vw, 1.12rem) !important;
  }

  .arabic-only .ayah-text p {
    line-height: 1.45 !important;
    padding: 0.18rem 0.18rem 0.18rem 0.1rem !important;
  }
}

/* Fix menu interaction + right-half popup with 3D shadow */
.menu {
  position: fixed !important;
  top: 12px !important;
  left: 12px !important;
  z-index: 150 !important;
}

.menu a {
  width: 44px;
  height: 44px;
  border-radius: 999px;
  border: 1px solid #d8e3ef;
  background: rgba(255, 255, 255, 0.95);
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.18), 0 1px 0 rgba(255, 255, 255, 0.96) inset;
  display: inline-flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 4px;
}

.linemenu {
  width: 18px !important;
  height: 2px !important;
  margin: 0 !important;
  border-radius: 4px;
  background: #0f172a !important;
  transition: transform 170ms ease, opacity 170ms ease;
}

.sidepage-close {
  display: none !important;
}

.sidepage {
  display: none !important;
  position: fixed !important;
  right: 0 !important;
  left: auto !important;
  top: 8vh !important;
  width: min(50vw, 560px) !important;
  max-width: 50vw !important;
  height: 84vh !important;
  min-height: 360px !important;
  padding: 1rem 1.1rem 1rem 1.1rem !important;
  border: 1px solid #d7e2ef !important;
  border-radius: 18px 0 0 18px;
  background: rgba(255, 255, 255, 0.985) !important;
  box-shadow: -24px 0 40px rgba(15, 23, 42, 0.28), -2px 0 0 rgba(255, 255, 255, 0.9) inset !important;
  z-index: 140 !important;
  overflow-y: auto;
  opacity: 0;
  transform: translateX(18px);
  pointer-events: none;
  transition: opacity 180ms ease, transform 180ms ease;
}

.sidepage:target {
  display: none !important;
}

body.sidepage-open .sidepage {
  display: block !important;
  opacity: 1;
  transform: translateX(0);
  pointer-events: auto;
}

body.sidepage-open .menu a {
  background: #0f172a;
  border-color: #0f172a;
}

body.sidepage-open .linemenu:nth-child(1) {
  transform: translateY(6px) rotate(45deg);
  background: #f8fafc !important;
}

body.sidepage-open .linemenu:nth-child(2) {
  opacity: 0;
}

body.sidepage-open .linemenu:nth-child(3) {
  transform: translateY(-6px) rotate(-45deg);
  background: #f8fafc !important;
}

/* Hide translation text */

@media (max-width: 1024px) {
  .sidepage {
    width: min(58vw, 500px) !important;
    max-width: 58vw !important;
    top: 7vh !important;
    height: 86vh !important;
  }
}

@media (max-width: 768px) {
  .menu {
    top: 9px !important;
    left: 9px !important;
  }

  .menu a {
    width: 40px;
    height: 40px;
  }

  .sidepage {
    width: min(88vw, 420px) !important;
    max-width: 88vw !important;
    top: 6vh !important;
    height: 88vh !important;
    border-radius: 14px 0 0 14px;
  }
}

/* Force-hide all per-ayah action buttons */
.ayah .ayah-toolbar,
.ayah-toolbar,
.icon-ayah-toolbar,
.link-mark-ayah,
.murottal-audio-player,
.icon-play-audio,
.icon-mark-ayah,
.icon-back-to-top {
  display: none !important;
  visibility: hidden !important;
  pointer-events: none !important;
}

/* Alternating ayah backgrounds */
.ayah:nth-child(odd) .ayah-text {
  background: #ffffff !important;
  border-color: #e3e8ef !important;
}

.ayah:nth-child(even) .ayah-text {
  background: #f3f5f8 !important;
  border-color: #dde3ea !important;
}

.ayah:nth-child(odd) .ayah-text p,
.ayah:nth-child(even) .ayah-text p {
  background: transparent !important;
}

/* Nav buttons pinned to left/right side of ayah content (not top) */
.ayah {
  position: relative;
}

.ayah-prev-next-wrapper {
  position: static !important;
  height: 0 !important;
  margin: 0 !important;
}

.ayah-prev,
.ayah-next,
.arabic-only .ayah-prev,
.arabic-only .ayah-next {
  position: fixed !important;
  top: 50vh !important;
  transform: translateY(-50%) !important;
  z-index: 90 !important;
  width: 44px !important;
  height: 44px !important;
  min-width: 44px !important;
  min-height: 44px !important;
  border-radius: 999px !important;
  border: 1px solid #d6e1ef !important;
  background: rgba(255, 255, 255, 0.97) !important;
  box-shadow: 0 12px 24px rgba(15, 23, 42, 0.16), 0 1px 0 rgba(255,255,255,0.92) inset !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  line-height: 1 !important;
}

.ayah-prev,
.arabic-only .ayah-prev {
  left: max(8px, calc((100vw - min(100vw, 960px)) / 2 - 56px)) !important;
  right: auto !important;
}

.ayah-next,
.arabic-only .ayah-next {
  right: max(8px, calc((100vw - min(100vw, 960px)) / 2 - 56px)) !important;
  left: auto !important;
}

.ayah-prev.bottom,
.ayah-next.bottom,
.arabic-only .ayah-prev.bottom,
.arabic-only .ayah-next.bottom {
  display: none !important;
}

/* Header cleanup and modern layout */
.header { background: linear-gradient(135deg, rgba(30,58,138,0.2), rgba(30,58,138,0.05));
  width: min(100%, 960px) !important;
  margin: 0.5rem auto 1rem !important;
  padding: 0.85rem 1rem 0.8rem !important;
  border: 1px solid #dbe5f1;
  border-radius: 16px;
  background: linear-gradient(180deg, rgba(255,255,255,0.98), rgba(247,250,255,0.95));
  box-shadow: 0 12px 26px rgba(15, 23, 42, 0.09), 0 1px 0 rgba(255,255,255,0.95) inset;
  text-align: left !important;
}

.header h2.page-name {
  display: inline-flex;
  font-size: 0.72rem !important;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #1e293b !important;
  margin: 0 0 0.5rem !important;
  padding: 0.18rem 0.5rem !important;
  border-radius: 999px;
  background: #ecfeff;
  border: 1px solid #bceff3;
}

.header h1.surah-name {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  margin: 0 !important;
  line-height: 1.25;
  font-size: clamp(1.05rem, 1.8vw, 1.35rem) !important;
  font-weight: 700;
}

.header .surah-number-name {
  position: static !important;
  top: auto !important;
  margin: 0 !important;
  flex: 0 0 auto;
  min-width: 28px;
  text-align: center;
  font-size: 0.76rem !important;
  padding: 0.2rem 0.42rem !important;
}

.header .surah-header-link {
  color: #0f172a !important;
  font-weight: 700;
}

.header h2.surah-count {
  margin: 0.45rem 0 0 !important;
  font-size: 0.84rem !important;
  font-weight: 600;
  color: #475569 !important;
}

@media (max-width: 1024px) {
  .ayah-prev { left: 8px !important; }
  .ayah-next { right: 8px !important; }
}

@media (max-width: 768px) {
  .ayah-prev,
  .ayah-next {
    width: 40px !important;
    height: 40px !important;
    min-width: 40px !important;
    min-height: 40px !important;
    top: 52vh !important;
  }

  .ayah-prev { left: 5px !important; }
  .ayah-next { right: 5px !important; }

  .header { background: linear-gradient(135deg, rgba(30,58,138,0.2), rgba(30,58,138,0.05));
    margin-top: 0.35rem !important;
    padding: 0.7rem 0.75rem 0.65rem !important;
    border-radius: 14px;
  }

  .header h1.surah-name {
    font-size: clamp(0.95rem, 4.2vw, 1.14rem) !important;
    gap: 0.42rem;
  }

  .header h2.surah-count {
    font-size: 0.78rem !important;
  }
}

/* Colored curved badge for surah name */
.header .surah-header-link {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.26rem 0.62rem;
  border-radius: 999px;
  background: linear-gradient(135deg, #ecfeff 0%, #dbeafe 100%);
  border: 1px solid #bfdbfe;
  box-shadow: 0 6px 14px rgba(59, 130, 246, 0.16), 0 1px 0 rgba(255,255,255,0.9) inset;
  color: #0f172a !important;
}

@media (max-width: 768px) {
  .header .surah-header-link {
    padding: 0.2rem 0.52rem;
  }
}

/* Center align detected Bismillah line */
.ayah-text p.bismillah-center {
  text-align: center !important;
}

/* Hide original in-box top nav and use floating nav outside ayah box */
.ayah-prev-next-wrapper,
.ayah-prev,
.ayah-next,
.ayah-prev.bottom,
.ayah-next.bottom {
  display: none !important;
}

.floating-surah-nav {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 95;
}

.floating-surah-nav__btn {
  position: fixed;
  top: 50vh;
  transform: translateY(-50%);
  width: 46px;
  height: 46px;
  border-radius: 999px;
  border: 1px solid #d6e1ef;
  background: rgba(255, 255, 255, 0.97);
  color: #0f172a;
  box-shadow: 0 12px 24px rgba(15, 23, 42, 0.18), 0 1px 0 rgba(255,255,255,0.92) inset;
  display: inline-flex;
  justify-content: center;
  align-items: center;
  font-size: 1.2rem;
  line-height: 1;
  text-decoration: none;
  pointer-events: auto;
}

.floating-surah-nav__prev {
  left: max(8px, calc((100vw - min(100vw, 960px)) / 2 - 62px));
}

.floating-surah-nav__next {
  right: max(8px, calc((100vw - min(100vw, 960px)) / 2 - 62px));
}

.floating-surah-nav__btn:hover {
  transform: translateY(-50%) translateY(-1px);
  box-shadow: 0 16px 28px rgba(15, 23, 42, 0.22), 0 1px 0 rgba(255,255,255,0.95) inset;
}

@media (max-width: 1024px) {
  .floating-surah-nav__prev { left: 8px; }
  .floating-surah-nav__next { right: 8px; }
}

@media (max-width: 768px) {
  .floating-surah-nav__btn {
    width: 40px;
    height: 40px;
    font-size: 1.04rem;
    top: 52vh;
  }

  .floating-surah-nav__prev { left: 5px; }
  .floating-surah-nav__next { right: 5px; }
}

/* Ayah number badge: Quicksand + colored circle outside card */
.ayah-text {
  overflow: visible !important;
  position: relative;
}

.ayah-number {
  font-family: "Quicksand", "Segoe UI", sans-serif !important;
  font-weight: 700 !important;
  font-size: 0.66rem !important;
  line-height: 1 !important;
  color: #ffffff !important;
  background: linear-gradient(135deg, #1d4ed8 0%, #0284c7 100%) !important;
  border: 2px solid #ffffff !important;
  box-shadow: 0 8px 16px rgba(2, 132, 199, 0.28), 0 1px 0 rgba(255,255,255,0.35) inset !important;
  border-radius: 999px !important;
  min-width: 30px !important;
  height: 30px !important;
  padding: 0 0.34rem !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  position: absolute !important;
  top: -12px !important;
  left: 10px !important;
  right: auto !important;
  z-index: 4 !important;
}

@media (max-width: 768px) {
  .ayah-number {
    min-width: 27px !important;
    height: 27px !important;
    font-size: 0.6rem !important;
    top: -10px !important;
    left: 8px !important;
  }
}

/* Colored background for floating surah navigation buttons */
.floating-surah-nav__btn {
  background: linear-gradient(135deg, #1d4ed8 0%, #0284c7 100%) !important;
  color: #ffffff !important;
  border: 1px solid #0b7ea0 !important;
  box-shadow: 0 14px 26px rgba(2, 132, 199, 0.34), 0 1px 0 rgba(255,255,255,0.24) inset !important;
}

.floating-surah-nav__btn:hover {
  background: linear-gradient(135deg, #0891b2 0%, #0369a1 100%) !important;
  color: #ffffff !important;
}

/* Move ayah number badge to top-right */
.ayah-number {
  left: auto !important;
  right: 10px !important;
}

@media (max-width: 768px) {
  .ayah-number {
    left: auto !important;
    right: 8px !important;
  }
}

/* Move hamburger floating button to top-right */
.menu {
  left: auto !important;
  right: 12px !important;
}

@media (max-width: 768px) {
  .menu {
    left: auto !important;
    right: 9px !important;
  }
}

/* Push ayah number further outside the ayah box */
.ayah-number {
  top: -16px !important;
  right: -12px !important;
}

@media (max-width: 768px) {
  .ayah-number {
    top: -13px !important;
    right: -9px !important;
  }
}

/* Docked "Ke ayat" selector inside surah header with elegant 3D style */
.header .goto-ayah-wrapper {
  position: static !important;
  top: auto !important;
  width: auto !important;
  text-align: left !important;
  margin: 0.55rem 0 0 !important;
  display: inline-flex;
  align-items: center;
  gap: 0.42rem;
  padding: 0.34rem 0.44rem;
  border-radius: 12px;
  background: linear-gradient(180deg, #ffffff, #f5f8fc);
  border: 1px solid #d8e3ef;
  box-shadow: 0 8px 16px rgba(15, 23, 42, 0.08), 0 1px 0 rgba(255, 255, 255, 0.9) inset;
}

.header .label-goto-ayah {
  font-family: "Quicksand", "Segoe UI", sans-serif !important;
  font-size: 0.72rem !important;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #1e293b !important;
  margin: 0 !important;
}

.header .goto-ayah {
  min-width: 84px;
  height: 30px;
  border-radius: 10px !important;
  border: 1px solid #bfd4e7 !important;
  background: #ffffff !important;
  box-shadow: 0 4px 10px rgba(2, 132, 199, 0.12), 0 1px 0 rgba(255,255,255,0.92) inset;
  font-family: "Quicksand", "Segoe UI", sans-serif !important;
  font-size: 0.84rem !important;
  font-weight: 700;
  color: #0f172a !important;
  padding: 0 0.5rem !important;
}

@media (max-width: 768px) {
  .header .goto-ayah-wrapper {
    margin-top: 0.45rem !important;
    padding: 0.28rem 0.35rem;
    border-radius: 10px;
    gap: 0.34rem;
  }

  .header .label-goto-ayah {
    font-size: 0.66rem !important;
  }

  .header .goto-ayah {
    min-width: 76px;
    height: 28px;
    font-size: 0.78rem !important;
  }
}

/* Push ayah number farther outside and avoid clipping */
.ayah-wrapper,
.ayah {
  overflow: visible !important;
}

.ayah-number {
  top: -20px !important;
  right: -18px !important;
}

@media (max-width: 768px) {
  .ayah-number {
    top: -15px !important;
    right: -12px !important;
  }
}

/* Move goto-ayah control to top-right inside surah header */
.header { background: linear-gradient(135deg, rgba(30,58,138,0.2), rgba(30,58,138,0.05));
  position: relative !important;
}

.header .goto-ayah-wrapper {
  position: absolute !important;
  top: 0.65rem !important;
  right: 0.75rem !important;
  left: auto !important;
  margin: 0 !important;
}

@media (max-width: 768px) {
  .header .goto-ayah-wrapper {
    top: 0.5rem !important;
    right: 0.52rem !important;
  }

  .header { background: linear-gradient(135deg, rgba(30,58,138,0.2), rgba(30,58,138,0.05));
    padding-top: 2.15rem !important;
  }
}

/* Reduce Arabic text size by ~30% */
.ayah-text,
.arabic-only .ayah-text {
  font-size: 70% !important;
}

/* Rebalance Arabic size (less aggressive than 70%) */
.ayah-text,
.arabic-only .ayah-text {
  font-size: 85% !important;
}

/* Arabic size bump +50% */
.ayah-text,
.arabic-only .ayah-text {
  font-size: 130% !important;
}

/* Arabic size bump +50% more (from 130% -> ~195%) */
.ayah-text,
.arabic-only .ayah-text {
  font-size: calc(195% * var(--arabic-scale, 1) * var(--arabic-font-size-adjust, 1)) !important;
}

.ayah-text,
.arabic-only .ayah-text,
.ayah-text p,
.arabic-only .ayah-text p {
  font-family: var(--arabic-font-family) !important;
  font-kerning: normal;
  letter-spacing: normal !important;
  word-spacing: normal !important;
}

/* End-of-ayah marker to aid waqaf */
.ayah-text p::after {
  content: ' ۝';
  font-size: 0.95em;
  color: #0f172a;
  margin-left: 0.25em;
}

/* Add more vertical gap between ayat */
.ayah {
  margin-bottom: 1rem !important;
}

/* Highlight Bismillah line with navy background */
.ayah-text p.bismillah-center {
  background: linear-gradient(135deg, #1d4ed8 0%, #1e3a8a 100%) !important;
  color: #0b1f28 !important;
  padding: 0.5rem 0.75rem !important;
  border-radius: 14px;
  box-shadow: 0 10px 18px rgba(14, 165, 164, 0.22), 0 1px 0 rgba(255,255,255,0.9) inset;
}

/* Adjust Bismillah box: clear navy background, subtle shadow */
.ayah-text p.bismillah-center {
  background: #e0f8f5 !important;
  color: #0f172a !important;
  border: 1px solid #a5e4dd !important;
  box-shadow: 0 10px 18px rgba(15, 23, 42, 0.12), 0 1px 0 rgba(255,255,255,0.95) inset !important;
}

/* Bismillah box: brighter navy, remove gray tint */
.ayah-text p.bismillah-center {
  background: #d1faf5 !important;
  border: 1px solid #6ee7d2 !important;
  color: #0f172a !important;
  box-shadow: 0 10px 18px rgba(14, 165, 164, 0.25), 0 1px 0 rgba(255,255,255,0.95) inset !important;
}

/* Footer redesign box, avoid overlap */
.footer {
  position: relative;
  margin: 1.25rem auto 1.5rem;
  width: min(100%, 960px);
  padding: 1rem 1.1rem;
  text-align: center;
  border: 1px solid #dbe5f1;
  border-radius: 14px;
  background: linear-gradient(180deg, rgba(255,255,255,0.98), rgba(247,250,255,0.95));
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.08), 0 1px 0 rgba(255,255,255,0.9) inset;
  color: #0f172a;
  box-sizing: border-box;
}

.footer p {
  font-size: 0.88em;
  line-height: 1.6em;
  margin: 0.1rem 0;
}

/* Home icon in header */
.header-home {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  margin-right: 0.5rem;
  border-radius: 999px;
  background: linear-gradient(135deg, #1d4ed8 0%, #0284c7 100%);
  color: #fff;
  text-decoration: none;
  border: 1px solid #0b7ea0;
  box-shadow: 0 8px 16px rgba(2, 132, 199, 0.28), 0 1px 0 rgba(255,255,255,0.8) inset;
  font-size: 1rem;
}

.header-home:hover {
  background: linear-gradient(135deg, #0891b2 0%, #0369a1 100%);
}

.show-translation .ayah-translation {
  display: block !important;
}

/* Reposition home icon: centered top, line style */
.header { background: linear-gradient(135deg, rgba(30,58,138,0.2), rgba(30,58,138,0.05)); position: relative !important; }
.header-home {
  position: absolute;
  top: 0.6rem;
  left: 50%;
  transform: translateX(-50%);
  width: 30px;
  height: 30px;
  margin: 0;
  border-radius: 999px;
  background: transparent;
  border: 1px solid #cbd5e1;
  color: #0f172a;
  box-shadow: none;
  font-size: 1rem;
  line-height: 1;
}
.header-home:hover {
  background: #e2e8f0;
}

/* Let goto nav sit inline (no absolute) so home is between name and nav */
.header .goto-ayah-wrapper {
  position: static !important;
  margin-left: auto !important;
}

.header h1.surah-name {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}

.header-main-row {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

@media (max-width: 768px) {
  .header-home {
    top: 0.45rem;
    width: 28px;
    height: 28px;
  }
  .header .goto-ayah-wrapper {
    margin-left: auto !important;
  }
}

/* Override home icon background to black */
.header-home {
  background: #0f172a !important;
  color: #ffffff !important;
  border-color: #0f172a !important;
}
.header-home:hover {
  background: #1f2937 !important;
}

/* Move goto-ayah back to top-right of header */
.header { background: linear-gradient(135deg, rgba(30,58,138,0.2), rgba(30,58,138,0.05));
  position: relative !important;
}
.header .goto-ayah-wrapper {
  position: absolute !important;
  top: 0.6rem !important;
  right: 0.6rem !important;
  left: auto !important;
  margin: 0 !important;
}
@media (max-width: 768px) {
  .header .goto-ayah-wrapper {
    top: 0.5rem !important;
    right: 0.5rem !important;
  }
}

/* Add inset padding for ayah text so it doesn't hug border */
.ayah-text p {
  padding: 0.6rem 0.65rem 0.6rem 0.65rem !important;
}

@media (max-width: 768px) {
  .ayah-text p {
    padding: 0.5rem 0.5rem 0.5rem 0.5rem !important;
  }
}

/* Hide hamburger menu completely */
.menu { display: none !important; }

/* Surah list styling: cards, shadow, alternating tones, navy number badge */
.surah-list {
  display: grid;
  gap: 0.65rem;
}

.surah-index {
  background: #ffffff !important;
  border: 1px solid #dbe4ef !important;
  border-radius: 12px;
  box-shadow: 0 12px 24px rgba(15, 23, 42, 0.08), 0 1px 0 rgba(255,255,255,0.9) inset;
  padding: 0.65rem 2.4rem 0.6rem 0.8rem !important;
  position: relative;
  transition: transform 140ms ease, box-shadow 140ms ease, border-color 140ms ease;
}

.surah-index:nth-child(even) {
  background: #f8fafc !important;
  border-color: #d2deec !important;
}

.surah-index:hover {
  transform: translateY(-2px);
  box-shadow: 0 16px 30px rgba(15, 23, 42, 0.12), 0 1px 0 rgba(255,255,255,0.95) inset;
}

.surah-index-link { display: block; text-decoration: none; color: inherit; }

.surah-index-name {
  font-size: clamp(1rem, 1.4vw, 1.15rem) !important;
  font-weight: 700;
  line-height: 1.25;
}

.surah-index-ayah {
  font-size: 0.86rem !important;
  color: #475569;
  margin-top: 0.16rem;
}

.surah-index-number {
  position: absolute;
  right: 0.65rem !important;
  top: 0.58rem !important;
  min-width: 30px;
  height: 30px;
  border-radius: 999px;
  background: linear-gradient(135deg, #1d4ed8 0%, #0284c7 100%);
  color: #fff !important;
  font-family: "Quicksand", "Segoe UI", sans-serif !important;
  font-weight: 700 !important;
  font-size: 0.78rem !important;
  border: 1px solid #0b7ea0;
  box-shadow: 0 10px 18px rgba(2,132,199,0.22), 0 1px 0 rgba(255,255,255,0.85) inset;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

@media (max-width: 768px) {
  .surah-index {
    padding: 0.55rem 2.1rem 0.55rem 0.7rem !important;
    border-radius: 10px;
  }
  .surah-index-number {
    top: 0.5rem !important;
    right: 0.55rem !important;
    min-width: 28px;
    height: 28px;
    font-size: 0.72rem !important;
  }
  .surah-index-name { font-size: 0.98rem !important; }
  .surah-index-ayah { font-size: 0.8rem !important; }
}

/* Stronger alternating backgrounds for surah list */
.surah-index {
  background: #ffffff !important;
}
.surah-index:nth-child(even) {
  background: #f1f5f9 !important;
  border-color: #d2deec !important;
}
.surah-index:nth-child(odd) {
  background: #ffffff !important;
  border-color: #dbe4ef !important;
}
.surah-index-link { background: transparent !important; }

/* Make header sticky/floating */
.header { background: linear-gradient(135deg, rgba(30,58,138,0.2), rgba(30,58,138,0.05));
  position: sticky !important;
  top: 10px !important;
  z-index: 60;
}

@media (max-width: 768px) {
  .header { background: linear-gradient(135deg, rgba(30,58,138,0.2), rgba(30,58,138,0.05)); top: 8px !important; }
}


.floating-reader-controls {
  position: fixed;
  left: 50%;
  bottom: 1rem;
  transform: translateX(-50%);
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.88);
  border: 1px solid rgba(148, 163, 184, 0.28);
  box-shadow: 0 16px 30px rgba(15, 23, 42, 0.22);
  backdrop-filter: blur(14px);
  z-index: 95;
}

.floating-reader-controls__btn {
  border: 0;
  border-radius: 999px;
  padding: 0.6rem 0.85rem;
  background: rgba(30, 58, 138, 0.16);
  color: #e2e8f0;
  font-family: "Quicksand", sans-serif;
  font-size: 0.82rem;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
}

.floating-reader-controls__btn.is-active {
  background: #1d4ed8;
  color: #ffffff;
}

.floating-reader-controls__select {
  border: 0;
  border-radius: 999px;
  padding: 0.58rem 0.85rem;
  background: rgba(30, 58, 138, 0.16);
  color: #e2e8f0;
  font-family: "Quicksand", sans-serif;
  font-size: 0.82rem;
  font-weight: 700;
  line-height: 1;
  outline: none;
  min-width: 10.5rem;
  appearance: none;
  text-align: center;
}

.floating-reader-controls__select option {
  color: #0f172a;
}

@media (max-width: 768px) {
  .floating-reader-controls {
    bottom: 0.7rem;
    gap: 0.35rem;
    padding: 0.4rem;
    width: calc(100% - 1rem);
    justify-content: center;
  }

  .floating-reader-controls__btn,
  .floating-reader-controls__select {
    padding: 0.58rem 0.75rem;
    font-size: 0.76rem;
  }

  .floating-reader-controls__select {
    min-width: 9rem;
  }
}


