@font-face { font-family: "KFGQPC Hafs"; src: url("quran/UthmanicHafs-v-3.0.ttf") format("truetype"); font-display: block; }
.reader { --rp: #ECE6D3; --rpaper: #FFFEF8; --rink: #000000; --rline: #C9BC97; --rgold: #6E4A0C; --rhead: #FBF1D6; --rmuted: #3F3D34; color-scheme: light;
  position: fixed; inset: 0; z-index: 40; background: var(--rp); color: var(--rink); display: grid; grid-template-rows: auto 1fr auto; padding-top: env(safe-area-inset-top, 0px); padding-bottom: env(safe-area-inset-bottom, 0px); }
.reader-bar { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 8px max(12px, env(safe-area-inset-right, 0px)) 8px max(12px, env(safe-area-inset-left, 0px)); background: #0E3B31; color: #FFFFFF; }
.reader-bar .ttl { font-size: 15px; text-align: center; flex: 1; min-width: 0; }
.reader-bar .ttl b { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-family: var(--font-display); font-size: 19px; color: #F3D58E; font-weight: 700; }
.reader-bar button { background: none; border: 1px solid rgba(243,213,142,.55); color: #FFFFFF; border-radius: 10px; min-width: 40px; padding: 0 6px; min-height: 44px; font-size: 16px; }
.reader-scroll { overflow-y: auto; overscroll-behavior: contain; padding: 12px max(8px, env(safe-area-inset-right, 0px)) 16px max(8px, env(safe-area-inset-left, 0px)); }
.mushaf { max-width: 560px; margin: 0 auto; border: 1.5px solid var(--rline); border-radius: 6px; padding: 10px 10px 6px; background: var(--rpaper); color: var(--rink); box-shadow: 0 1px 6px rgba(60,45,10,.12); }
.mushaf .ln { font-family: "KFGQPC Hafs", serif; direction: rtl; white-space: nowrap; text-align: justify; text-align-last: justify; line-height: var(--lh, 1.9em); height: var(--lh, auto); overflow: hidden; }
.mushaf .fl { font-family: "KFGQPC Hafs", serif; direction: rtl; text-align: justify; line-height: 2.1; margin: 0 0 .2em; }
.mushaf .sh { font-family: var(--font-display); text-align: center; border: 1.5px solid var(--rgold); border-radius: 6px; color: var(--rgold); margin: 4px 0; line-height: 1.7; font-size: 1.05em; background: var(--rhead); font-weight: 700; }
.mushaf:not(.flow) .sh { height: var(--lh, auto); margin: 0; box-sizing: border-box; display: flex; align-items: center; justify-content: center; line-height: 1.2; }
.mushaf:not(.flow) .bs { height: var(--lh, auto); line-height: var(--lh, 1.9em); overflow: hidden; }
.mushaf .bs { font-family: "KFGQPC Hafs", serif; text-align: center; line-height: 1.9; }
.mushaf .pno { text-align: center; font-size: 15px; color: var(--rmuted); padding-top: 4px; font-variant-numeric: tabular-nums; }
.reader-foot { display: grid; gap: 8px; padding: 8px max(12px, env(safe-area-inset-right, 0px)) 8px max(12px, env(safe-area-inset-left, 0px)); border-top: 1px solid var(--rline); background: var(--rp); }
.reader-foot .row { display: flex; gap: 8px; }
.reader-foot .btn { flex: 1; min-height: 48px; font-size: 16px; }
.reader-foot .tools .btn { background: #FFFFFF; color: #1A1A14; border: 1.5px solid var(--rline); font-weight: 700; }
.reader-foot .tools .btn:disabled { opacity: .45; }
.reader-foot .tools .btn { padding: 0 6px; white-space: nowrap; font-size: 15px; }
.reader .btn.primary, .rd-end .btn.primary { background: #0E5C4A; color: #FFFFFF; border: 1.5px solid #0E5C4A; }
.rd-end .btn:not(.primary):not(.link) { background: #FFFFFF; color: #1A1A14; border: 1.5px solid #C9BC97; }
.rd-end .btn.link { background: none; border: 0; color: #0E5C4A; text-decoration: underline; }
.reader-foot .nav .btn:not(.primary) { background: #FFFFFF; color: #1A1A14; border: 1.5px solid var(--rline); }
.reader-src { font-size: 12px; color: var(--rmuted); text-align: center; margin: 8px 0 0; }
.reader-mark { text-align: center; font-size: 15px; font-weight: 700; color: var(--rgold); margin: 0 0 6px; }
.reader .err { color: #8A1C1C; text-align: center; }
.reader-bar button:disabled { opacity: .4; }
.mushaf .am { position: relative; cursor: pointer; border-radius: 6px; -webkit-tap-highlight-color: transparent; }
.mushaf .am::before { content: ""; position: absolute; inset: -8px 0; }
.mushaf .am.bm { background: #F5CB5C; box-shadow: 0 0 0 3px #F5CB5C; color: #000; }
/* الوضع الليلي ناعم: رمادي دافئ مش أسود، والنص كريمي مش أبيض صافي */
.reader.night { --rp: #2E2A24; --rpaper: #3A352D; --rink: #E8DFC8; --rline: #5E5646; --rgold: #DDBE7C; --rhead: #463F33; --rmuted: #CFC4A8; color-scheme: dark; }
.reader.night .mushaf { box-shadow: none; }
.reader.night .reader-bar { background: #26332D; }
.reader.night .reader-foot .tools .btn, .reader.night .reader-foot .nav .btn:not(.primary) { background: #463F33; color: #EDE4CC; border-color: #6A614F; }
.reader.night .mushaf .am.bm { background: #9C7A2C; box-shadow: 0 0 0 3px #9C7A2C; color: #FFF6DD; }
.reader.night .err { color: #FF9C8C; }
.reader.full { grid-template-rows: auto 1fr; }
.reader.full .reader-bar, .reader.full .reader-foot, .reader.full .reader-src { display: none; }
.reader.full .reader-scroll { padding-top: 8px; }
.rd-strip { display: none; align-items: center; justify-content: space-between; gap: 8px; padding: 4px max(10px, env(safe-area-inset-right, 0px)) 4px max(10px, env(safe-area-inset-left, 0px)); color: var(--rmuted); font-size: 14px; border-bottom: 1px solid var(--rline); }
.rd-strip button { min-height: 36px; padding: 0 12px; border-radius: 999px; border: 1px solid var(--rline); background: var(--rpaper); color: var(--rink); font-family: inherit; font-size: 14px; }
.reader.full .rd-strip { display: flex; }
.rd-end { position: absolute; inset: 0; z-index: 3; background: rgba(20,20,10,.55); display: grid; place-items: center; padding: 16px; }
.rd-end .card { background: #FFFEF8; color: #111; border-radius: 16px; padding: 22px 18px; max-width: 380px; width: 100%; display: grid; gap: 10px; text-align: center; box-shadow: 0 10px 40px rgba(0,0,0,.3); }
.rd-end .big { font-family: var(--font-display); font-size: 24px; font-weight: 700; color: #0E3B31; margin: 0; }
.rd-end p { margin: 0; font-size: 17px; line-height: 1.7; }
.rd-end .btn { min-height: 50px; font-size: 17px; }
.reader-bar .rd-jump { font-size: 14px; font-weight: 700; padding: 0 10px; white-space: nowrap; }
.reader-foot .tools .rd-go { flex: 0 0 76px; min-height: 48px; text-align: center; border-radius: 10px; border: 1.5px solid var(--rline); background: #FFFFFF; color: #1A1A14; font-weight: 700; padding: 4px; }
.reader.night .reader-foot .tools .rd-go { background: #463F33; color: #EDE4CC; border-color: #6A614F; }
.rd-retry { display: grid; gap: 10px; justify-items: center; padding: 30px 0; }
.reader-bar button.ib { display: grid; place-items: center; gap: 0; min-width: 52px; min-height: 52px; padding: 2px 6px; line-height: 1.1; }
.reader-bar button.ib .i { font-size: 18px; }
.reader-bar button.ib .l { font-size: 13px; font-weight: 700; }
.rd-tip { position: absolute; inset: 0; z-index: 3; background: rgba(20,20,10,.45); display: grid; place-items: center; padding: 16px; }
.rd-tip .card { background: #FFFEF8; color: #111; border-radius: 16px; padding: 22px 18px; max-width: 360px; width: 100%; display: grid; gap: 12px; text-align: center; box-shadow: 0 10px 40px rgba(0,0,0,.3); border: 0; }
.rd-tip p { margin: 0; font-size: 18px; line-height: 1.8; }
.rd-tip .am-demo { font-family: "KFGQPC Hafs", serif; font-size: 26px; background: #F5CB5C; border-radius: 6px; padding: 0 6px; }
.rd-tip .btn { min-height: 50px; font-size: 18px; background: #0E5C4A; color: #fff; border: 0; }
