﻿:root {
  --cover-bg: #1a120b;
  --cover-surface: #2c1e10;
  --cover-border: #6b4c2a;
  --cover-gold: #c9a84c;
  --cover-gold-light: #e8d48b;
  --cover-gold-dark: #8a6d2f;
  --cover-text: #f5e6c8;
  --cover-text-soft: #c4a67a;
  --paper: #fdf8ef;
  --paper-warm: #f9f0e0;
  --paper-border: #d4c4a0;
  --paper-line: #e8dcc4;
  --ink: #2a1f14;
  --ink-soft: #6b5a42;
  --ink-muted: #8a7a62;
  --gold: #9d7530;
  --gold-soft: #c9a84c;
  --shadow-cover: 0 20px 60px rgba(0, 0, 0, 0.5), 0 8px 20px rgba(0, 0, 0, 0.3);
  --shadow-book: 0 12px 40px rgba(80, 60, 30, 0.25), 0 4px 12px rgba(80, 60, 30, 0.15);
  --shadow-btn: 0 4px 14px rgba(80, 60, 30, 0.2);
  --radius-xl: 20px;
  --radius-lg: 16px;
  --radius-md: 12px;
  --radius-sm: 8px;
  --reader-frame-max-width: 980px;
  --reader-frame-max-height: 1020px;
  --reader-frame-vh-ratio: 0.84;
  --reader-frame-min-height: 360px;
  --font-body: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Noto Sans", "Helvetica Neue", Arial, sans-serif;
  --font-heading: "Palatino Linotype", "Book Antiqua", "Georgia", serif;
  --user-title-font: "Palatino Linotype", "Book Antiqua", "Georgia", serif;
  --user-title-size: 1.05rem;
  --user-verse-font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Noto Sans", "Helvetica Neue", Arial, sans-serif;
  --user-verse-size: 1.05rem;
}
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}
html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  -webkit-text-size-adjust: 100%;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
body {
  font-family: var(--font-heading);
  color: var(--ink);
  background: var(--cover-bg);
  background-image:
    radial-gradient(ellipse at 20% 0%, rgba(100, 70, 30, 0.15) 0%, transparent 50%),
    radial-gradient(ellipse at 80% 100%, rgba(100, 70, 30, 0.1) 0%, transparent 50%);
}
.app {
  position: relative;
  width: 100%;
  height: 100vh;
  height: 100dvh;
  padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
  display: grid;
  place-items: center;
  overflow: hidden;
}
.view {
  width: 100%;
  max-width: 1180px;
  height: 100%;
}
.hidden {
  display: none !important;
}
.cover-view {
  display: grid;
  place-items: center;
  height: 100%;
  padding: 12px;
}
.ambient {
  position: fixed;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(circle at 50% 30%, rgba(201, 168, 76, 0.06) 0%, transparent 60%),
    radial-gradient(circle at 50% 70%, rgba(201, 168, 76, 0.04) 0%, transparent 50%);
}
.cover-card {
  position: relative;
  width: min(92vw, 420px);
  min-height: min(86dvh, 720px);
  max-height: calc(100dvh - 24px - env(safe-area-inset-top) - env(safe-area-inset-bottom));
  border-radius: var(--radius-xl);
  padding: 20px 18px;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  gap: 16px;
  cursor: pointer;
  user-select: none;
  outline: none;
  background: linear-gradient(165deg, #3a2a18 0%, #2c1e10 40%, #1e140c 100%);
  border: 2px solid var(--cover-border);
  box-shadow: var(--shadow-cover);
  overflow: hidden;
  animation: coverFadeIn 0.8s ease-out;
  transition: transform 0.45s ease, box-shadow 0.45s ease, filter 0.45s ease;
}
@keyframes coverFadeIn {
  from { opacity: 0; transform: scale(0.96) translateY(12px); }
  to   { opacity: 1; transform: scale(1) translateY(0); }
}
.cover-card::before {
  content: "";
  position: absolute;
  inset: 8px;
  border-radius: calc(var(--radius-xl) - 4px);
  border: 1px solid rgba(201, 168, 76, 0.3);
  pointer-events: none;
  z-index: 1;
}
.cover-card::after {
  content: "";
  position: absolute;
  inset: 14px;
  border-radius: calc(var(--radius-xl) - 8px);
  border: 1px solid rgba(201, 168, 76, 0.12);
  pointer-events: none;
  z-index: 1;
}
.cover-card:focus-visible {
  box-shadow: 0 0 0 3px rgba(201, 168, 76, 0.4), var(--shadow-cover);
}
.cover-header {
  position: relative;
  text-align: center;
  padding: 8px 12px 12px;
  z-index: 2;
}
.cover-kicker {
  color: var(--cover-gold);
  font-size: clamp(0.72rem, 2vw, 0.85rem);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-weight: 600;
  margin-bottom: 8px;
}
.cover-header h1 {
  font-size: clamp(2rem, 7vw, 2.8rem);
  line-height: 1.15;
  letter-spacing: 0.04em;
  color: var(--cover-gold-light);
  text-shadow: 0 2px 8px rgba(201, 168, 76, 0.3);
  margin-bottom: 6px;
}
.cover-sub {
  color: var(--cover-text-soft);
  font-size: clamp(0.92rem, 3vw, 1.1rem);
  letter-spacing: 0.05em;
  font-weight: 400;
}
.cover-canvas-wrap {
  position: relative;
  border-radius: var(--radius-lg);
  overflow: hidden;
  min-height: 0;
  border: 1px solid rgba(201, 168, 76, 0.25);
  background:
    radial-gradient(circle at 50% 50%, rgba(201, 168, 76, 0.08) 0%, transparent 70%),
    linear-gradient(160deg, #2c1e10, #221810);
  z-index: 2;
}
.cover-fallback {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 18px;
  background: radial-gradient(circle at 50% 50%, rgba(201, 168, 76, 0.1) 0%, transparent 60%);
}
.cover-panel {
  position: relative;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: 0;
  box-shadow: none;
  overflow: hidden;
}
.cover-panel::before {
  content: none;
}
.cover-panel::after {
  content: "";
  position: absolute;
  inset: 8%;
  background:
    radial-gradient(circle,
      rgba(255, 255, 255, 0.58) 0%,
      rgba(255, 255, 255, 0.34) 18%,
      rgba(255, 250, 235, 0.2) 38%,
      rgba(255, 245, 220, 0.08) 60%,
      transparent 76%);
  filter: blur(12px);
  opacity: 1;
  pointer-events: none;
  z-index: 0;
  animation: coverElifGlow 4.2s ease-in-out infinite;
}
.cover-elif {
  position: relative;
  z-index: 1;
  display: block;
  width: auto;
  max-width: 86%;
  height: auto;
  max-height: 86%;
  object-fit: contain;
  opacity: 1;
  animation: coverElifPulse 4.2s ease-in-out infinite;
}
@keyframes coverElifGlow {
  0%, 100% {
    transform: scale(0.96) translateY(0);
    opacity: 0.84;
  }
  50% {
    transform: scale(1.11) translateY(-4px);
    opacity: 1;
  }
}
@keyframes coverElifPulse {
  0%, 100% {
    transform: scale(1) translateY(0) rotate(0deg);
    filter: drop-shadow(0 0 10px rgba(255, 255, 255, 0.34));
  }
  50% {
    transform: scale(1.07) translateY(-3px) rotate(-0.8deg);
    filter: drop-shadow(0 0 21px rgba(255, 255, 255, 0.56));
  }
}
.cover-meta {
  position: relative;
  text-align: center;
  padding: 8px 12px 4px;
  z-index: 2;
}
.cover-meta p {
  margin: 0;
}
#readyText {
  color: var(--cover-gold-light);
  font-weight: 700;
  font-size: 0.95rem;
}
.cover-hint {
  margin-top: 8px !important;
  color: var(--cover-text-soft);
  font-size: 0.85rem;
  opacity: 0.8;
}
.install-pwa-hint {
  min-height: 1.1rem;
  margin-top: 8px !important;
  color: var(--cover-text-soft);
  font-size: 0.78rem;
  opacity: 0.7;
}
.install-pwa-fab {
  position: fixed;
  --pwa-fab-right: 14px;
  right: 14px;
  bottom: calc(24px + env(safe-area-inset-bottom));
  z-index: 9999;
  border: 1px solid var(--cover-gold-dark);
  background: linear-gradient(180deg, #3a2a18, #2c1e10);
  color: var(--cover-gold-light);
  border-radius: 999px;
  font-size: 0.85rem;
  font-weight: 700;
  padding: 10px 20px;
  cursor: pointer;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.4);
  font-family: var(--font-body);
  white-space: nowrap;
  transition: transform 0.45s cubic-bezier(0.4, 0, 0.2, 1),
              opacity 0.45s ease,
              box-shadow 0.2s ease;
}
.install-pwa-fab:hover {
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
}
.install-pwa-fab:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}
.install-pwa-fab.pwa-slide-out {
  transform: translateX(calc(35% + var(--pwa-fab-right)));
  opacity: 0.45;
}
.install-pwa-fab.pwa-slide-out:hover,
.install-pwa-fab.pwa-slide-out:focus {
  transform: translateX(0);
  opacity: 1;
}
.settings-fab {
  position: fixed;
  --settings-fab-right: 14px;
  right: 14px;
  bottom: calc(76px + env(safe-area-inset-bottom));
  z-index: 9998;
  width: 44px;
  height: 44px;
  border: 1px solid var(--cover-gold-dark);
  background: linear-gradient(180deg, #3a2a18, #2c1e10);
  color: var(--cover-gold-light);
  border-radius: 50%;
  font-size: 1.15rem;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.35);
  transition: transform 0.45s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.45s ease;
}
.surah-jump-fab {
  position: fixed;
  --surah-jump-fab-right: 14px;
  right: 14px;
  bottom: calc(128px + env(safe-area-inset-bottom));
  z-index: 9997;
  width: 44px;
  height: 44px;
  border: 1px solid var(--cover-gold-dark);
  background: linear-gradient(180deg, #3a2a18, #2c1e10);
  color: var(--cover-gold-light);
  border-radius: 50%;
  font-size: 1.1rem;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.35);
  transition: transform 0.45s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.45s ease;
}
.surah-jump-fab.surah-jump-slide-out {
  transform: translateX(calc(42% + var(--surah-jump-fab-right)));
  opacity: 0.45;
}
.surah-jump-fab.surah-jump-slide-out:hover,
.surah-jump-fab.surah-jump-slide-out:focus {
  transform: translateX(0);
  opacity: 1;
}
.settings-fab.settings-slide-out {
  transform: translateX(calc(42% + var(--settings-fab-right)));
  opacity: 0.45;
}
.settings-fab.settings-slide-out:hover,
.settings-fab.settings-slide-out:focus {
  transform: translateX(0);
  opacity: 1;
}
.settings-modal {
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: grid;
  place-items: center;
  padding:
    max(10px, env(safe-area-inset-top))
    max(10px, env(safe-area-inset-right))
    max(10px, env(safe-area-inset-bottom))
    max(10px, env(safe-area-inset-left));
  box-sizing: border-box;
}
.settings-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.48);
}
.settings-panel {
  position: relative;
  width: min(92vw, 460px);
  background: var(--paper);
  border: 1px solid var(--paper-border);
  border-radius: var(--radius-md);
  box-shadow: 0 18px 36px rgba(0, 0, 0, 0.35);
  padding: 14px;
  max-height: calc(100dvh - 24px - env(safe-area-inset-top) - env(safe-area-inset-bottom));
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.settings-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}
.settings-header h2 {
  font-family: var(--font-heading);
  color: var(--gold);
  font-size: 1.05rem;
}
.settings-close {
  border: 1px solid var(--paper-border);
  background: var(--paper-warm);
  border-radius: var(--radius-sm);
  width: 32px;
  height: 32px;
  font-size: 1.2rem;
  cursor: pointer;
  color: var(--ink-soft);
}
.settings-body {
  display: grid;
  gap: 10px;
  overflow-y: auto;
  min-height: 0;
  padding-right: 2px;
}
.settings-field {
  display: grid;
  gap: 6px;
  font-family: var(--font-body);
  font-size: 0.88rem;
  color: var(--ink-soft);
}
.settings-field select,
.settings-field input[type="range"] {
  width: 100%;
}
#surahJumpSelect {
  height: min(50dvh, 320px);
  max-height: calc(100dvh - 220px - env(safe-area-inset-top) - env(safe-area-inset-bottom));
  overflow-y: auto;
}
.settings-field select {
  border: 1px solid var(--paper-border);
  border-radius: var(--radius-sm);
  padding: 8px;
  background: #fff;
  color: var(--ink);
}
.settings-footer {
  margin-top: 12px;
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  flex-shrink: 0;
}
.reader-view {
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto auto;
  gap: 10px;
  height: 100%;
  min-height: 0;
  padding: 8px;
  overflow: hidden;
}
.book-shell {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 14px;
  height: 100%;
  min-height: 0;
}
.reader-status-row {
  display: flex;
  justify-content: center;
  padding-top: 2px;
}
.book-frame {
  position: relative;
  width: 100%;
  max-width: var(--reader-frame-max-width);
  height: min(var(--reader-frame-max-height), calc(var(--reader-frame-vh-ratio) * 100vh), 100%);
  height: min(var(--reader-frame-max-height), calc(var(--reader-frame-vh-ratio) * 100dvh), 100%);
  min-height: min(var(--reader-frame-min-height), 100%);
  max-height: 100%;
  margin: 0 auto;
  aspect-ratio: 3 / 4.2;
  border-radius: var(--radius-lg);
  overflow: hidden;
  background: var(--paper);
  border: 1px solid var(--paper-border);
  box-shadow: var(--shadow-book);
  perspective: 1700px;
  touch-action: pan-y;
}
.book-frame::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 3;
  pointer-events: none;
  background:
    linear-gradient(90deg,
      rgba(100, 75, 40, 0.1) 0%,
      transparent 3%,
      transparent 97%,
      rgba(100, 75, 40, 0.1) 100%
    );
}
.page,
.flip-sheet,
.face {
  position: absolute;
  inset: 0;
}
.current {
  z-index: 1;
}
.page-paper {
  position: absolute;
  inset: 0;
  z-index: 2;
  padding: 14px 16px 16px;
  background: var(--paper);
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  gap: 10px;
}
.paper-header {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 10px;
  min-height: 34px;
  border-bottom: 1px solid var(--paper-line);
}
.paper-header::after {
  content: "";
  position: absolute;
  bottom: -1px;
  left: 10%;
  right: 10%;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(157, 117, 48, 0.2), transparent);
  pointer-events: none;
}
.paper-page {
  position: static;
  transform: none;
  color: var(--ink-muted);
  font-family: var(--font-body);
  font-size: 0.82rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  white-space: nowrap;
  line-height: 1.3;
}
.paper-title {
  color: var(--gold);
  font-family: var(--user-title-font);
  font-size: var(--user-title-size);
  font-weight: 700;
  text-align: right;
  letter-spacing: 0.01em;
  margin: 0;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.paper-content {
  overflow: hidden;
  line-height: 1.6;
  font-size: var(--user-verse-size);
  font-family: var(--user-verse-font);
  color: var(--ink);
  padding: 2px 2px 16px 0;
}
.page-paper.dense .paper-content {
  font-size: calc(var(--user-verse-size) * 0.97);
  line-height: 1.5;
}
.page-paper.ultra-dense .paper-content {
  font-size: calc(var(--user-verse-size) * 0.92);
  line-height: 1.42;
}
.page-paper.overflow-fit-1 .paper-content {
  font-size: calc(var(--user-verse-size) * 0.88);
  line-height: 1.35;
}
.page-paper.overflow-fit-2 .paper-content {
  font-size: calc(var(--user-verse-size) * 0.84);
  line-height: 1.28;
}
.page-paper.overflow-fit-1 .verse-line,
.page-paper.overflow-fit-2 .verse-line {
  margin-bottom: 4px;
}
.page-line {
  margin: 0 0 6px;
  white-space: pre-wrap;
  word-break: break-word;
}
.page-line:last-child {
  margin-bottom: 0;
}
.verse-line {
  display: flex;
  gap: 8px;
  align-items: baseline;
  margin: 0 0 6px;
  padding: 2px 0;
}
.verse-line:last-child {
  margin-bottom: 0;
}
.verse-no-inline {
  flex-shrink: 0;
  min-width: 28px;
  color: var(--gold);
  font-family: var(--font-body);
  font-size: 0.86rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  line-height: inherit;
}
.verse-text {
  flex: 1;
  min-width: 0;
}
.basmala-line {
  margin: 0 0 10px;
  padding: 4px 10px;
  border-top: 1px solid var(--paper-line);
  border-bottom: 1px solid var(--paper-line);
  color: var(--gold);
  font-family: var(--font-heading);
  font-size: 0.96rem;
  font-weight: 700;
  line-height: 1.5;
  text-align: center;
  letter-spacing: 0.01em;
}
.basmala-line:last-child {
  margin-bottom: 0;
}
.page-paper.intro-page .paper-content {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 8px 4px 18px;
}
.intro-block {
  width: min(96%, 640px);
  margin: 0 auto;
  padding: 12px 14px;
  border-top: 1px solid var(--paper-line);
  border-bottom: 1px solid var(--paper-line);
  text-align: center;
}
.intro-line {
  margin: 0;
  color: var(--gold);
  font-family: var(--font-heading);
  font-size: 1.2rem;
  font-weight: 700;
  line-height: 1.7;
  letter-spacing: 0.01em;
}
.intro-line + .intro-line {
  margin-top: 12px;
}
.measure-wrap {
  position: fixed;
  left: -10000px;
  top: 0;
  visibility: hidden;
  pointer-events: none;
  z-index: -1;
}
.measure-paper {
  position: relative;
  inset: auto;
  transform: none;
  box-shadow: none;
}
.flip-sheet {
  z-index: 5;
  transform-style: preserve-3d;
  backface-visibility: hidden;
  pointer-events: none;
  opacity: 0;
  will-change: transform, filter;
  filter: drop-shadow(-8px 5px 12px rgba(80, 60, 30, 0.18));
}
.flip-sheet::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: 0;
  z-index: 6;
  background:
    linear-gradient(90deg,
      rgba(74, 52, 22, 0.18) 0%,
      rgba(74, 52, 22, 0.08) 12%,
      transparent 44%,
      rgba(255, 248, 232, 0.2) 58%,
      rgba(255, 248, 232, 0.34) 66%,
      transparent 100%
    );
  mix-blend-mode: multiply;
}
.flip-sheet.active {
  opacity: 1;
}
.flip-sheet.forward {
  transform-origin: right center;
  transform: rotateY(0deg) translateZ(0);
}
.flip-sheet.backward {
  transform-origin: left center;
  transform: rotateY(180deg) translateZ(0);
  filter: drop-shadow(8px 5px 12px rgba(80, 60, 30, 0.18));
}
.face {
  background: var(--paper);
  backface-visibility: hidden;
}
.face::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(90deg,
      rgba(0, 0, 0, 0.08) 0%,
      transparent 26%,
      transparent 74%,
      rgba(0, 0, 0, 0.05) 100%
    );
}
.face.back {
  transform: rotateY(180deg);
}
.flip-sheet.anim-forward {
  animation: turnForward 620ms cubic-bezier(0.16, 0.74, 0.2, 1) forwards;
}
.flip-sheet.anim-forward::before {
  animation: foldShadowForward 620ms ease-out forwards;
}
.flip-sheet.anim-backward {
  animation: turnBackward 620ms cubic-bezier(0.16, 0.74, 0.2, 1) forwards;
}
.flip-sheet.anim-backward::before {
  animation: foldShadowBackward 620ms ease-out forwards;
}
@keyframes turnForward {
  0% {
    transform: rotateY(0deg) translateX(0) translateZ(0) scaleX(1);
  }
  52% {
    transform: rotateY(-94deg) translateX(1.4%) translateZ(8px) scaleX(0.992);
  }
  100% {
    transform: rotateY(-180deg) translateX(0) translateZ(0) scaleX(1);
  }
}
@keyframes turnBackward {
  0% {
    transform: rotateY(180deg) translateX(0) translateZ(0) scaleX(1);
  }
  52% {
    transform: rotateY(86deg) translateX(-1.4%) translateZ(8px) scaleX(0.992);
  }
  100% {
    transform: rotateY(0deg) translateX(0) translateZ(0) scaleX(1);
  }
}
@keyframes foldShadowForward {
  0% {
    opacity: 0;
    transform: translateX(0);
  }
  35% {
    opacity: 0.95;
    transform: translateX(-1.8%);
  }
  70% {
    opacity: 0.45;
  }
  100% {
    opacity: 0;
    transform: translateX(0);
  }
}
@keyframes foldShadowBackward {
  0% {
    opacity: 0;
    transform: translateX(0) scaleX(-1);
  }
  35% {
    opacity: 0.95;
    transform: translateX(1.8%) scaleX(-1);
  }
  70% {
    opacity: 0.45;
  }
  100% {
    opacity: 0;
    transform: translateX(0) scaleX(-1);
  }
}
.nav-btn {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  border: 1px solid var(--paper-border);
  color: var(--gold);
  background: linear-gradient(165deg, #fffaf0, #f0e4cc);
  box-shadow: var(--shadow-btn);
  font-size: 1.8rem;
  line-height: 1;
  cursor: pointer;
  transition: transform 0.12s ease, box-shadow 0.12s ease, opacity 0.12s ease;
  display: grid;
  place-items: center;
  font-family: inherit;
  flex-shrink: 0;
}
.nav-btn:hover {
  transform: scale(1.06);
  box-shadow: 0 6px 18px rgba(80, 60, 30, 0.25);
}
.nav-btn:active {
  transform: scale(0.94);
}
.nav-btn:disabled {
  opacity: 0.3;
  cursor: default;
  transform: none;
  box-shadow: none;
}
.reader-footer {
  text-align: center;
  padding: 2px 8px max(2px, env(safe-area-inset-bottom));
  color: var(--cover-text-soft);
  overflow: hidden;
}
.status-text {
  margin: 0;
  font-size: 0.92rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--cover-gold-light);
  font-family: var(--font-body);
}
.presence-text {
  margin: 0;
  font-size: 0.84rem;
  line-height: 1.38;
  letter-spacing: 0.01em;
  color: rgba(245, 230, 200, 0.9);
  font-family: var(--font-body);
  min-height: 2.3em;
  white-space: pre-line;
  word-break: break-word;
}
.footer-actions {
  margin-top: 8px;
  display: flex;
  justify-content: center;
  gap: 8px;
  flex-wrap: wrap;
}
.ghost-btn {
  border: 1px solid rgba(201, 168, 76, 0.35);
  border-radius: var(--radius-sm);
  background: rgba(201, 168, 76, 0.08);
  color: var(--cover-gold-light);
  padding: 7px 16px;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease;
  font-family: var(--font-body);
}
.ghost-btn:hover {
  background: rgba(201, 168, 76, 0.15);
  border-color: rgba(201, 168, 76, 0.5);
}
.ghost-btn:active {
  background: rgba(201, 168, 76, 0.2);
}
.page-paper.bookmarked-page::after {
  content: "";
  position: absolute;
  top: 0;
  right: 16px;
  width: 24px;
  height: 42px;
  background: linear-gradient(180deg, var(--gold), var(--cover-gold-dark));
  clip-path: polygon(0 0, 100% 0, 100% 100%, 50% 80%, 0 100%);
  z-index: 10;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.2));
}
.page-paper.bookmarked-page::before {
  content: "";
  position: absolute;
  top: 0;
  right: 17px;
  width: 22px;
  height: 6px;
  background: rgba(0, 0, 0, 0.08);
  z-index: 11;
  border-radius: 0 0 2px 2px;
}
@media (max-width: 860px) {
  :root {
    --reader-frame-max-width: 760px;
    --reader-frame-max-height: 900px;
    --reader-frame-vh-ratio: 0.78;
    --reader-frame-min-height: 340px;
  }
  .book-shell {
    gap: 10px;
  }
  .nav-btn {
    width: 42px;
    height: 42px;
    font-size: 1.6rem;
  }
  .page-paper {
    padding: 12px 14px 14px;
  }
  .paper-content {
    font-size: calc(var(--user-verse-size) * 0.97);
    line-height: 1.52;
  }
  .page-paper.dense .paper-content {
    font-size: calc(var(--user-verse-size) * 0.93);
    line-height: 1.46;
  }
  .page-paper.ultra-dense .paper-content {
    font-size: calc(var(--user-verse-size) * 0.89);
    line-height: 1.38;
  }
  .verse-no-inline {
    min-width: 25px;
    font-size: 0.84rem;
  }
}
@media (max-width: 620px) {
  :root {
    --reader-frame-max-width: 100%;
    --reader-frame-max-height: 860px;
    --reader-frame-vh-ratio: 0.72;
    --reader-frame-min-height: 320px;
  }
  .cover-view {
    padding: 8px;
  }
  .cover-card {
    width: 100%;
    max-width: 100%;
    padding: 16px 14px;
    border-radius: var(--radius-lg);
    min-height: min(84dvh, 650px);
    max-height: calc(100dvh - 16px - env(safe-area-inset-top) - env(safe-area-inset-bottom));
    gap: 12px;
  }
  .cover-card::before {
    inset: 6px;
  }
  .cover-card::after {
    inset: 10px;
  }
  .cover-header {
    padding: 4px 8px 8px;
  }
  .cover-canvas-wrap {
    border-radius: var(--radius-md);
  }
  .reader-view {
    padding: 4px 4px max(4px, env(safe-area-inset-bottom));
    gap: 4px;
  }
  .book-shell {
    grid-template-columns: 1fr;
    gap: 0;
  }
  .nav-btn {
    display: none;
  }
  .book-frame {
    height: min(var(--reader-frame-max-height), calc(var(--reader-frame-vh-ratio) * 100vh), 100%);
    height: min(var(--reader-frame-max-height), calc(var(--reader-frame-vh-ratio) * 100dvh), 100%);
    border-radius: var(--radius-md);
    aspect-ratio: auto;
  }
  .page-paper {
    padding: 10px 12px 12px;
  }
  .paper-header {
    justify-content: center;
    text-align: center;
    min-height: 28px;
    padding-bottom: 8px;
    flex-wrap: wrap;
  }
  .paper-page {
    font-size: 0.78rem;
    text-align: center;
    white-space: normal;
    line-height: 1.25;
  }
  .paper-title {
    display: none;
  }
  .paper-content {
    font-size: calc(var(--user-verse-size) * 0.91);
    line-height: 1.44;
    padding-bottom: 14px;
  }
  .page-paper.dense .paper-content {
    font-size: calc(var(--user-verse-size) * 0.89);
    line-height: 1.38;
  }
  .page-paper.ultra-dense .paper-content {
    font-size: calc(var(--user-verse-size) * 0.84);
    line-height: 1.32;
  }
  .page-paper.overflow-fit-1 .paper-content {
    font-size: calc(var(--user-verse-size) * 0.82);
    line-height: 1.28;
  }
  .page-paper.overflow-fit-2 .paper-content {
    font-size: calc(var(--user-verse-size) * 0.78);
    line-height: 1.22;
  }
  .intro-block {
    width: 100%;
    padding: 10px 10px;
  }
  .intro-line {
    font-size: 0.88rem;
    line-height: 1.58;
  }
  .verse-no-inline {
    min-width: 23px;
    font-size: 0.82rem;
  }
  .verse-line {
    gap: 6px;
    margin-bottom: 5px;
  }
  .status-text {
    font-size: 0.78rem;
  }
  .presence-text {
    font-size: 0.72rem;
    line-height: 1.28;
    min-height: 2em;
  }
  .footer-actions {
    gap: 5px;
    flex-wrap: nowrap;
    overflow-x: auto;
    padding-bottom: 2px;
  }
  .ghost-btn {
    padding: 5px 10px;
    font-size: 0.76rem;
    white-space: nowrap;
  }
  .page-paper.bookmarked-page::after {
    right: 12px;
    width: 20px;
    height: 36px;
  }
  .install-pwa-fab {
    --pwa-fab-right: 10px;
    right: 10px;
    bottom: calc(20px + env(safe-area-inset-bottom));
    font-size: 0.8rem;
    padding: 8px 16px;
  }
  .settings-fab {
    --settings-fab-right: 10px;
    right: 10px;
    bottom: calc(66px + env(safe-area-inset-bottom));
    width: 40px;
    height: 40px;
    font-size: 1.05rem;
  }
  .surah-jump-fab {
    --surah-jump-fab-right: 10px;
    right: 10px;
    bottom: calc(112px + env(safe-area-inset-bottom));
    width: 40px;
    height: 40px;
    font-size: 1rem;
  }
  #surahJumpSelect {
    height: min(44dvh, 260px);
  }
  .flip-sheet.anim-forward,
  .flip-sheet.anim-backward,
  .flip-sheet.anim-forward::before,
  .flip-sheet.anim-backward::before {
    animation-duration: 520ms;
  }
}
@media (min-width: 621px) and (max-width: 1200px) {
  :root {
    --reader-frame-max-width: 860px;
    --reader-frame-max-height: 960px;
    --reader-frame-vh-ratio: 0.8;
    --reader-frame-min-height: 340px;
  }
}
@media (min-width: 1200px) {
  :root {
    --reader-frame-max-width: 980px;
    --reader-frame-max-height: 1020px;
    --reader-frame-vh-ratio: 0.84;
    --reader-frame-min-height: 360px;
  }
  .cover-card {
    width: min(92vw, 460px);
    min-height: min(88dvh, 780px);
  }
  .nav-btn {
    width: 52px;
    height: 52px;
    font-size: 2rem;
  }
  .paper-content {
    font-size: calc(var(--user-verse-size) * 1.03);
    line-height: 1.62;
  }
}
@media (max-height: 700px) {
  :root {
    --reader-frame-vh-ratio: 0.68;
    --reader-frame-max-height: 700px;
    --reader-frame-min-height: 300px;
  }
  .cover-card {
    min-height: min(82dvh, 560px);
    max-height: calc(100dvh - 12px - env(safe-area-inset-top) - env(safe-area-inset-bottom));
    padding: 12px 12px;
    gap: 10px;
  }
  .cover-header h1 {
    font-size: clamp(1.5rem, 5vw, 2rem);
  }
  .cover-kicker {
    font-size: 0.7rem;
  }
  .cover-sub {
    font-size: 0.88rem;
  }
  .reader-view {
    gap: 3px;
  }
  .reader-footer {
    padding-bottom: max(1px, env(safe-area-inset-bottom));
  }
  .presence-text {
    font-size: 0.72rem;
    line-height: 1.25;
    min-height: 2.05em;
  }
  .ghost-btn {
    padding: 4px 9px;
    font-size: 0.74rem;
  }
}
@media (prefers-reduced-motion: reduce) {
  .flip-sheet.anim-forward,
  .flip-sheet.anim-backward,
  .flip-sheet.anim-forward::before,
  .flip-sheet.anim-backward::before {
    animation-duration: 260ms;
  }
  .nav-btn,
  .cover-card,
  .ghost-btn,
  .install-pwa-fab {
    transition: none;
  }
  .cover-card {
    animation: none;
  }
}

