/* ========================================================================
   Mushaf Interactive – Stylesheet  (Elegant Islamic Edition)
   طابع إسلامي فاخر: زمردي – ذهبي – مخطوطات
   ======================================================================== */

/* ------------------------------------------------------------------ Fonts */
@import url('https://fonts.googleapis.com/css2?family=Amiri:ital,wght@0,400;0,700;1,400&family=Tajawal:wght@300;400;500;700;800&display=swap');

/* ---------------------------------------------------------- Custom Props */
:root {
    /* ── Core palette ── */
    --emerald:        #0e4a3a;
    --emerald-mid:    #165b48;
    --emerald-light:  #1d7a60;
    --emerald-glow:   rgba(14,74,58,.18);

    --gold:           #c9982a;
    --gold-bright:    #e8b84b;
    --gold-pale:      #f5e9c8;
    --gold-muted:     #a87d22;

    --parchment:      #faf4e4;
    --parchment-2:    #f2e8ca;
    --parchment-3:    #e8d9ab;

    --ink:            #1a1208;
    --ink-mid:        #3d3020;
    --ink-soft:       #6b5c3e;

    --cream:          #fdf9f1;
    --cream-2:        #f6f0dc;

    /* ── Surfaces (light theme) ── */
    --c-bg:           var(--parchment);
    --c-surface:      var(--cream);
    --c-surface-2:    var(--cream-2);
    --c-text:         var(--ink);
    --c-muted:        var(--ink-soft);
    --c-border:       #d4c49a;
    --c-divider:      #e0d0a4;

    --c-brand:        var(--emerald);
    --c-brand-mid:    var(--emerald-mid);
    --c-brand-light:  var(--emerald-light);
    --c-brand-glow:   var(--emerald-glow);
    --c-gold:         var(--gold);
    --c-gold-bright:  var(--gold-bright);
    --c-gold-pale:    var(--gold-pale);

    --c-hi:           rgba(14,74,58,.14);
    --c-hi-border:    var(--emerald-light);
    --c-play:         rgba(201,152,42,.30);
    --c-play-border:  var(--gold);

    /* ── Ornament SVG (Islamic star pattern tile) ── */
    --pattern: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='60' height='60'%3E%3Cg fill='none' stroke='%23c9982a' stroke-width='.4' opacity='.18'%3E%3Cpolygon points='30,4 34.7,17.6 49.2,17.6 37.7,26.4 42.4,40 30,31.2 17.6,40 22.3,26.4 10.8,17.6 25.3,17.6'/%3E%3Crect x='18' y='18' width='24' height='24' transform='rotate(45 30 30)'/%3E%3C/g%3E%3C/svg%3E");

    /* ── Layout ── */
    --topbar-h:       56px;
    --toolbar-h:      58px;
    --bottom-h:       64px;
    --radius:         14px;
    --shadow-sm:      0 2px 8px rgba(0,0,0,.10);
    --shadow-md:      0 6px 22px rgba(0,0,0,.16);
    --shadow-lg:      0 16px 48px rgba(0,0,0,.24);
    --shadow-gold:    0 4px 18px rgba(201,152,42,.35);

    --font-body:  "Tajawal", "Segoe UI", "Noto Naskh Arabic", system-ui, sans-serif;
    --font-title: "Amiri", "Tajawal", Georgia, serif;
}

/* ───────────────── SEPIA THEME ───────────────── */
[data-theme="sepia"] {
    --c-bg:        #ede3c4;
    --c-surface:   #f7f0db;
    --c-surface-2: #ede3c4;
    --c-text:      #2d2010;
    --c-muted:     #7a6540;
    --c-border:    #c8b47e;
    --c-divider:   #dac889;
    --c-brand:        #5a3010;
    --c-brand-mid:    #6e3c14;
    --c-brand-light:  #8a4e20;
    --c-brand-glow:   rgba(90,48,16,.16);
    --c-gold:         #9e7520;
    --c-gold-bright:  #c49428;
    --c-gold-pale:    #f2e4b4;
    --c-hi:         rgba(90,48,16,.12);
    --c-hi-border:  #8a4e20;
    --c-play:       rgba(158,117,32,.28);
    --c-play-border:#9e7520;
}

/* ───────────────── DARK THEME ───────────────── */
[data-theme="dark"] {
    --c-bg:        #0b0f14;
    --c-surface:   #131820;
    --c-surface-2: #1b2330;
    --c-text:      #e8dfc8;
    --c-muted:     #8a7f68;
    --c-border:    #2a3444;
    --c-divider:   #242e3e;
    --c-brand:        #1a6e52;
    --c-brand-mid:    #145c44;
    --c-brand-light:  #22916c;
    --c-brand-glow:   rgba(26,110,82,.22);
    --c-gold:         #c9982a;
    --c-gold-bright:  #e8b84b;
    --c-gold-pale:    #2a2010;
    --c-hi:         rgba(34,145,108,.18);
    --c-hi-border:  #22916c;
    --c-play:       rgba(201,152,42,.25);
    --c-play-border:#c9982a;
}

/* ─────────────────────────── RESET ─────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }
html, body { height: 100%; }
body {
    font-family: var(--font-body);
    background: var(--c-bg);
    color: var(--c-text);
    direction: rtl;
    -webkit-font-smoothing: antialiased;
    overscroll-behavior: none;
    overflow: hidden;
}
button { font-family: inherit; cursor: pointer; border: none; background: none; color: inherit; }
input, select, textarea { font-family: inherit; font-size: inherit; color: inherit; }
a { color: var(--c-brand); text-decoration: none; }
svg { display: block; fill: currentColor; }

/* ═══════════════════════════════════════════════════════════
   APP SHELL
═══════════════════════════════════════════════════════════ */
.app {
    height: 100dvh;
    display: grid;
    grid-template-rows: var(--topbar-h) var(--toolbar-h) 1fr var(--bottom-h);
    background: var(--c-bg);
}

/* ───────────────── TOP BAR ───────────────── */
.topbar {
    background: linear-gradient(135deg, var(--c-brand) 0%, var(--c-brand-mid) 60%, var(--c-brand) 100%);
    color: #fff;
    display: flex; align-items: center; justify-content: space-between;
    padding: 0 10px;
    position: relative; z-index: 5;
    border-bottom: 2px solid var(--gold);
    box-shadow: 0 1px 0 var(--gold-muted), var(--shadow-sm);
}
.topbar::before {
    content: '';
    position: absolute; inset: 0;
    background: var(--pattern);
    opacity: .5;
    pointer-events: none;
}

.tb-icon {
    position: relative; z-index: 1;
    width: 42px; height: 42px; border-radius: 10px;
    color: rgba(255,255,255,.9);
    display: flex; align-items: center; justify-content: center;
    transition: background .15s;
}
.tb-icon svg { width: 22px; height: 22px; }
.tb-icon:active { background: rgba(255,255,255,.15); }

.tb-title {
    position: relative; z-index: 1;
    flex: 1; text-align: center;
    display: flex; flex-direction: column; line-height: 1.15;
    pointer-events: none;
}
.tb-title-main {
    font-family: var(--font-title);
    font-weight: 700; font-size: 17px; letter-spacing: .5px;
}
.tb-title-main::before,
.tb-title-main::after { content: ' ❖ '; color: var(--gold-bright); font-size: 12px; }
.tb-title-sub { font-size: 11px; opacity: .75; margin-top: 1px; }

/* ───────────────── TOOLBAR ───────────────── */
.toolbar {
    border-bottom: 2px solid var(--gold);
    display: flex; align-items: stretch; justify-content: space-around;
    padding: 0 4px;
    overflow-x: auto; scrollbar-width: none;
    background-image: var(--pattern), linear-gradient(180deg, #fff8ea 0%, var(--cream-2) 100%);
}
.toolbar::-webkit-scrollbar { display: none; }
[data-theme="dark"] .toolbar {
    background-image: var(--pattern), linear-gradient(180deg, #1b2330 0%, #131820 100%);
}
[data-theme="sepia"] .toolbar {
    background-image: var(--pattern), linear-gradient(180deg, #f2e8c8 0%, #ede3c4 100%);
}

.tool {
    flex: 1 0 52px; min-width: 52px;
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    color: var(--c-brand);
    padding: 6px 4px; gap: 2px;
    position: relative; transition: color .15s;
}
.tool::after {
    content: '';
    position: absolute; bottom: 0; left: 20%; right: 20%;
    height: 2px; border-radius: 2px;
    background: var(--c-gold);
    transform: scaleX(0); transition: transform .18s;
}
.tool:active { color: var(--c-gold); background: rgba(201,152,42,.08); }
.tool:active::after { transform: scaleX(1); }
.tool svg  { width: 20px; height: 20px; }
.tool span { font-size: 10px; font-weight: 700; letter-spacing: .2px; }

/* ═══════════════════════════════════════════════════════════
   VIEWER
═══════════════════════════════════════════════════════════ */
.viewer {
    overflow: auto; position: relative;
    -webkit-overflow-scrolling: touch;
    background: var(--pattern), var(--c-bg);
}


/* ─────────── PAGE FRAME ─────────── */
.reader {
    padding: 12px 8px;
    display: flex; align-items: flex-start; justify-content: center;
    min-height: 100%;
}
.page-frame {
    position: relative; width: 100%; max-width: 680px;
    background: var(--cream);
    border-radius: var(--radius);
    box-shadow:
        0 0 0 1px var(--c-border),
        0 0 0 5px var(--cream),
        0 0 0 7px var(--c-gold),
        var(--shadow-md);
    overflow: visible;
}
.page-frame::before {
    content: '';
    position: absolute; inset: -8px;
    border: 1px solid rgba(201,152,42,.40);
    border-radius: calc(var(--radius) + 8px);
    pointer-events: none; z-index: 2;
}
.page-frame::after {
    content: '◆';
    position: absolute; top: -16px; left: 50%; transform: translateX(-50%);
    color: var(--c-gold); font-size: 20px; z-index: 3;
    pointer-events: none;
    text-shadow: 0 0 10px rgba(201,152,42,.55);
}
.page-img {
    display: block; width: 100%; height: auto;
    border-radius: calc(var(--radius) - 1px);
    user-select: none; -webkit-user-drag: none;
}
.overlay {
    position: absolute; inset: 0;
    width: 100%; height: 100%;
    border-radius: calc(var(--radius) - 1px);
    overflow: hidden; pointer-events: none;
}
.overlay polygon {
    fill: transparent; stroke: transparent; stroke-width: 2;
    pointer-events: all; cursor: pointer;
    transition: fill .18s, stroke .18s;
}
.overlay polygon:hover  { fill: rgba(14,74,58,.08); stroke: var(--c-brand-light); stroke-width: 1; }
.overlay polygon.active { fill: var(--c-hi); stroke: var(--c-hi-border); stroke-width: 1.5; }
.overlay polygon.playing{ fill: var(--c-play); stroke: var(--c-play-border); stroke-width: 1.5; }
.overlay polygon.bookmark{ stroke: var(--c-gold); stroke-dasharray: 4 3; stroke-width: 1.5; }

.page-loader {
    position: absolute; inset: 0; border-radius: var(--radius);
    display: none; align-items: center; justify-content: center;
    background: rgba(250,244,228,.7); backdrop-filter: blur(4px); z-index: 5;
}
.page-loader.show { display: flex; }
.page-loader .spin {
    width: 40px; height: 40px; border-radius: 50%;
    border: 3px solid var(--c-border); border-top-color: var(--c-brand);
    animation: spin 1s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ═══════════════════════════════════════════════════════════
   BOTTOM BAR
═══════════════════════════════════════════════════════════ */
.bottom-bar {
    background: linear-gradient(180deg, var(--c-surface) 0%, var(--c-surface-2) 100%);
    border-top: 2px solid var(--c-gold);
    box-shadow: 0 -4px 18px rgba(0,0,0,.12);
    display: flex; align-items: center; justify-content: space-between;
    padding: 0 10px;
    padding-bottom: env(safe-area-inset-bottom, 0);
    z-index: 5; position: relative;
}
.bottom-bar::before {
    content: '';
    position: absolute; inset: 0;
    background: var(--pattern); opacity: .35; pointer-events: none;
}

.bb-side {
    position: relative; z-index: 1;
    width: 42px; height: 42px; border-radius: 50%;
    color: var(--c-brand);
    display: flex; align-items: center; justify-content: center;
    transition: background .15s;
}
.bb-side svg { width: 22px; height: 22px; }
.bb-side:active { background: var(--c-brand-glow); }

/* Compact page-jump in bottom bar */
.bb-page-jump {
    position: relative; z-index: 1;
    display: flex; align-items: center; gap: 4px;
}
.bb-page-jump input {
    width: 72px; padding: 5px 8px;
    border: 1px solid var(--c-border); border-radius: 8px;
    background: var(--c-surface-2); text-align: center;
    font-size: 13px; outline: none; color: var(--c-text);
    transition: border-color .18s, box-shadow .18s;
}
.bb-page-jump input:focus { border-color: var(--c-brand); box-shadow: 0 0 0 2px var(--c-brand-glow); }
.bb-page-jump button {
    width: 32px; height: 32px; border-radius: 50%;
    background: linear-gradient(135deg, var(--c-brand-light), var(--c-brand));
    color: #fff; display: flex; align-items: center; justify-content: center;
    box-shadow: var(--shadow-sm); transition: opacity .15s;
}
.bb-page-jump button svg { width: 18px; height: 18px; fill: currentColor; }
.bb-page-jump button:active { opacity: .8; }

/* Fullscreen mode */
body.fullscreen .top-bar,
body.fullscreen .bottom-bar,
body.fullscreen .toolbar { display: none !important; }
body.fullscreen .viewer { height: 100dvh; }
body.fullscreen .reader { padding: 0; height: 100%; }
body.fullscreen .page-frame {
    max-width: 100%; height: 100%;
    border-radius: 0; box-shadow: none;
    border: none;
}
body.fullscreen .page-img { height: 100dvh; object-fit: contain; }
body.fullscreen #overlay { height: 100dvh; }

.player { position: relative; z-index: 1; flex: 1; display: flex; align-items: center; justify-content: center; gap: 4px; }

.pl-btn {
    width: 38px; height: 38px; border-radius: 50%;
    background: linear-gradient(135deg, var(--c-brand-light), var(--c-brand));
    color: #fff;
    display: flex; align-items: center; justify-content: center;
    box-shadow: 0 3px 10px rgba(14,74,58,.35);
    transition: transform .12s, box-shadow .12s;
}
.pl-btn svg { width: 20px; height: 20px; }
.pl-btn:active { transform: scale(.93); box-shadow: 0 1px 4px rgba(14,74,58,.20); }
.pl-btn[disabled] { opacity: .35; pointer-events: none; }
.pl-btn.primary {
    width: 52px; height: 52px;
    background: linear-gradient(135deg, var(--gold-bright), var(--gold));
    box-shadow: 0 0 0 3px var(--c-surface), 0 0 0 5px var(--c-gold), 0 6px 20px rgba(201,152,42,.50);
}
.pl-btn.primary:active {
    transform: scale(.93);
    box-shadow: 0 0 0 3px var(--c-surface), 0 0 0 5px var(--c-gold), 0 2px 8px rgba(201,152,42,.25);
}

/* ═══════════════════════════════════════════════════════════
   SCRIM
═══════════════════════════════════════════════════════════ */
.scrim {
    position: fixed; inset: 0;
    background: rgba(5,10,8,.55); backdrop-filter: blur(2px);
    opacity: 0; pointer-events: none;
    transition: opacity .25s; z-index: 80;
}
.scrim.show { opacity: 1; pointer-events: all; }

/* ═══════════════════════════════════════════════════════════
   DRAWER
═══════════════════════════════════════════════════════════ */
.drawer {
    position: fixed; top: 0; bottom: 0; right: 0;
    width: 92%; max-width: 360px;
    background: var(--c-surface);
    transform: translateX(110%);
    transition: transform .3s cubic-bezier(.25,.8,.25,1);
    z-index: 90; display: flex; flex-direction: column;
    box-shadow: var(--shadow-lg);
    border-left: 3px solid var(--c-gold);
}
.drawer.open { transform: translateX(0); }

.drawer-head {
    background: var(--pattern), linear-gradient(135deg, var(--c-brand) 0%, var(--c-brand-mid) 100%);
    color: #fff;
    padding: 16px 14px;
    padding-top: calc(16px + env(safe-area-inset-top, 0));
    display: flex; align-items: center; justify-content: space-between;
    border-bottom: 2px solid var(--gold);
}
.dh-title { display: flex; flex-direction: column; line-height: 1.2; }
.dh-title strong { font-family: var(--font-title); font-size: 17px; letter-spacing: .4px; }
.dh-title span   { font-size: 11px; opacity: .75; margin-top: 2px; }

.x-btn {
    width: 36px; height: 36px; border-radius: 50%; color: inherit;
    display: flex; align-items: center; justify-content: center; transition: background .15s;
}
.x-btn svg { width: 20px; height: 20px; }
.x-btn:active { background: rgba(0,0,0,.10); }
.drawer-head .x-btn { color: rgba(255,255,255,.9); }
.drawer-head .x-btn:active { background: rgba(255,255,255,.15); }

.drawer-tabs {
    display: flex;
    background: var(--c-surface-2);
    border-bottom: 1px solid var(--c-divider);
}
.dt {
    flex: 1; padding: 12px 4px;
    font-size: 13px; font-weight: 700;
    color: var(--c-muted);
    border-bottom: 3px solid transparent;
    transition: color .15s, border-color .15s;
}
.dt.active { color: var(--c-brand); border-bottom-color: var(--c-gold); background: var(--c-surface); }

.drawer-body { flex: 1; overflow-y: auto; padding: 16px; }
.dpanel { display: none; }
.dpanel.active { display: block; }

.field { margin-bottom: 20px; }
.field > label {
    display: flex; align-items: center; gap: 6px;
    font-size: 11px; font-weight: 800;
    color: var(--c-muted);
    margin-bottom: 8px; letter-spacing: .8px; text-transform: uppercase;
}
.field > label::before {
    content: '';
    display: inline-block; width: 8px; height: 8px;
    background: var(--c-gold);
    clip-path: polygon(50% 0%,61% 35%,98% 35%,68% 57%,79% 91%,50% 70%,21% 91%,32% 57%,2% 35%,39% 35%);
}
.field select,
.field input[type="number"],
.field input[type="search"] {
    width: 100%; padding: 10px 13px;
    border: 1px solid var(--c-border); border-radius: 10px;
    background: var(--c-surface-2); outline: none;
    transition: border-color .18s, box-shadow .18s;
}
.field select:focus, .field input:focus {
    border-color: var(--c-brand); box-shadow: 0 0 0 3px var(--c-brand-glow);
}
.toggle-field {
    display: flex; align-items: center; justify-content: space-between;
    background: var(--c-surface-2); padding: 12px 14px; border-radius: 10px;
    border: 1px solid var(--c-border);
}
.toggle-field label { margin: 0; color: var(--c-text); font-weight: 600; font-size: 14px; }
.toggle-field label::before { display: none !important; }
.toggle-field input[type="checkbox"] { width: 20px; height: 20px; accent-color: var(--c-brand); cursor: pointer; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
    padding: 8px 14px; border-radius: 20px;
    background: var(--c-surface-2); border: 1px solid var(--c-border);
    font-size: 13px; font-weight: 600; color: var(--c-text);
    transition: background .15s, color .15s, border-color .15s, box-shadow .15s;
}
.chip.active {
    background: linear-gradient(135deg, var(--c-brand-light), var(--c-brand));
    color: #fff; border-color: transparent;
    box-shadow: 0 3px 10px var(--c-brand-glow);
}

.seg {
    display: flex; border: 1px solid var(--c-border); border-radius: 10px;
    overflow: hidden; background: var(--c-surface-2);
}
.seg button {
    flex: 1; padding: 9px 6px;
    font-size: 13px; font-weight: 700; color: var(--c-muted);
    border-right: 1px solid var(--c-border);
}
.seg button:last-child { border-right: none; }
.seg button.active { background: linear-gradient(135deg, var(--c-brand-light), var(--c-brand)); color: #fff; }

.speed-row { display: flex; gap: 6px; flex-wrap: wrap; }
.speed-row button {
    flex: 1 0 58px; padding: 8px 4px; border-radius: 9px;
    border: 1px solid var(--c-border); background: var(--c-surface-2);
    font-weight: 700; font-size: 13px; color: var(--c-muted);
    transition: background .15s, color .15s;
}
.speed-row button.active {
    background: linear-gradient(135deg, var(--c-brand-light), var(--c-brand));
    color: #fff; border-color: transparent;
}

.link-btn {
    display: flex; align-items: center; gap: 10px;
    width: 100%; padding: 13px 14px;
    background: var(--c-surface-2); border: 1px solid var(--c-border); border-radius: 10px;
    color: var(--c-brand); font-weight: 700; font-size: 14px;
    margin-bottom: 8px; transition: background .15s, box-shadow .15s;
}
.link-btn::before { content: '❯'; font-size: 11px; color: var(--c-gold); margin-left: auto; }
.link-btn:active { background: var(--c-surface); box-shadow: var(--shadow-sm); }

.hint { font-size: 12px; color: var(--c-muted); line-height: 1.7; }

/* ═══════════════════════════════════════════════════════════
   MODALS
═══════════════════════════════════════════════════════════ */
.modal {
    position: fixed; top: 50%; left: 50%;
    width: 92%; max-width: 460px; max-height: 88vh;
    background: var(--c-surface);
    border-radius: 18px;
    border: 1px solid var(--c-border);
    box-shadow: 0 0 0 1px var(--c-gold), var(--shadow-lg);
    display: none; flex-direction: column;
    z-index: 95; overflow: hidden; opacity: 0;
}
.modal.open { display: flex; animation: modalIn .26s cubic-bezier(.34,1.4,.64,1) forwards; }
@keyframes modalIn {
    from { transform: translate(-50%,-42%) scale(.92); opacity: 0; }
    to   { transform: translate(-50%,-50%) scale(1);  opacity: 1; }
}

.modal-head {
    padding: 15px 16px;
    background: var(--pattern), linear-gradient(135deg, var(--c-brand) 0%, var(--c-brand-mid) 100%);
    color: #fff; display: flex; align-items: center; justify-content: space-between;
    border-bottom: 2px solid var(--gold);
}
.modal-head strong { font-family: var(--font-title); font-size: 17px; letter-spacing: .4px; }
.modal-head .x-btn { color: rgba(255,255,255,.9); }

.modal-search {
    padding: 12px; border-bottom: 1px solid var(--c-divider);
    background: var(--c-surface-2);
}
.modal-search input {
    width: 100%; padding: 10px 13px;
    border: 1px solid var(--c-border); border-radius: 10px;
    background: var(--c-surface); outline: none;
    transition: border-color .18s, box-shadow .18s;
}
.modal-search input:focus { border-color: var(--c-brand); box-shadow: 0 0 0 3px var(--c-brand-glow); }
.modal-body { padding: 8px; overflow-y: auto; flex: 1; }

.surah-row {
    display: flex; align-items: center;
    padding: 10px 12px; border-radius: 10px; cursor: pointer; gap: 10px;
    transition: background .12s;
}
.surah-row:hover, .surah-row:active { background: var(--c-surface-2); }
.surah-row + .surah-row { border-top: 1px solid var(--c-divider); border-radius: 0; }
.surah-row:first-child { border-radius: 10px 10px 0 0; }
.surah-row:last-child  { border-radius: 0 0 10px 10px; }
.sr-no {
    width: 36px; height: 36px; flex-shrink: 0;
    background: linear-gradient(135deg, var(--gold-bright), var(--gold));
    color: #fff; border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-weight: 800; font-size: 13px;
    box-shadow: 0 2px 8px rgba(201,152,42,.35);
}
.sr-name { flex: 1; font-weight: 700; font-size: 15px; font-family: var(--font-title); }
.sr-meta { font-size: 12px; color: var(--c-muted); white-space: nowrap; }

.bm-row {
    display: flex; align-items: center; justify-content: space-between;
    padding: 12px 14px; border-bottom: 1px solid var(--c-divider); transition: background .12s;
}
.bm-row:hover { background: var(--c-surface-2); }
.bm-info { cursor: pointer; }
.bm-info strong { display: block; color: var(--c-brand); font-weight: 700; }
.bm-info span   { font-size: 12px; color: var(--c-muted); }
.bm-del {
    color: #a03030; padding: 6px 12px; border-radius: 8px;
    font-size: 13px; font-weight: 700;
    border: 1px solid rgba(160,48,48,.25); background: rgba(160,48,48,.06);
    transition: background .12s;
}
.bm-del:active { background: rgba(160,48,48,.14); }

.empty {
    text-align: center; padding: 44px 16px;
    color: var(--c-muted); font-size: 14px; line-height: 1.7;
}
.empty::before { content: '◆'; display: block; font-size: 28px; color: var(--c-gold); opacity: .4; margin-bottom: 10px; }

.memorize-body { padding: 16px; }
.memorize-actions { display: flex; gap: 10px; margin-top: 8px; }
.btn {
    flex: 1; padding: 13px; border-radius: 10px;
    background: var(--c-surface-2); border: 1px solid var(--c-border);
    font-weight: 700; font-size: 15px; color: var(--c-text); transition: background .15s;
}
.btn.primary {
    background: linear-gradient(135deg, var(--c-brand-light), var(--c-brand));
    color: #fff; border-color: transparent;
    box-shadow: 0 4px 14px var(--c-brand-glow);
}
.btn.primary:active { opacity: .88; }
.memorize-status {
    margin-top: 16px; padding: 13px 15px; border-radius: 10px;
    background: linear-gradient(135deg, var(--gold-pale), #f0e2a4);
    color: var(--c-brand); font-size: 14px; font-weight: 700; text-align: center;
    border: 1px solid var(--c-gold);
    box-shadow: inset 0 1px 0 rgba(255,255,255,.6);
}

/* ═══════════════════════════════════════════════════════════
   AYAH SHEET
═══════════════════════════════════════════════════════════ */
.sheet {
    position: fixed; left: 0; right: 0; bottom: 0;
    max-height: 78vh;
    background: var(--c-surface);
    border-radius: 22px 22px 0 0;
    border-top: 3px solid var(--c-gold);
    transform: translateY(100%);
    transition: transform .32s cubic-bezier(.25,.8,.25,1);
    z-index: 95; display: flex; flex-direction: column;
    box-shadow: 0 -8px 32px rgba(0,0,0,.20);
    padding-bottom: env(safe-area-inset-bottom, 0);
}
.sheet.open { transform: translateY(0); }
.sheet .handle {
    width: 44px; height: 4px; background: var(--c-gold); opacity: .6;
    border-radius: 2px; margin: 10px auto 0;
}
.sheet-head {
    display: flex; align-items: center; justify-content: space-between;
    padding: 10px 14px; border-bottom: 1px solid var(--c-divider);
}
.sheet-head strong { font-family: var(--font-title); color: var(--c-brand); font-size: 16px; }
.sheet-actions { display: flex; gap: 4px; }
.sheet-actions .x-btn { color: var(--c-muted); }
.sheet-actions .x-btn:active { background: var(--c-surface-2); color: var(--c-brand); }

.sheet-body { padding: 14px 16px; overflow-y: auto; }
.ayah-quick { display: flex; gap: 8px; margin-bottom: 16px; }
.aq {
    flex: 1; display: flex; flex-direction: column;
    align-items: center; justify-content: center; gap: 5px;
    padding: 12px 6px; border-radius: 12px;
    background: var(--c-surface-2); border: 1px solid var(--c-border);
    color: var(--c-brand); font-weight: 700; font-size: 12px;
    transition: background .15s, box-shadow .15s;
}
.aq svg { width: 20px; height: 20px; }
.aq:active {
    background: linear-gradient(135deg, var(--c-brand-light), var(--c-brand));
    color: #fff; box-shadow: 0 3px 10px var(--c-brand-glow);
}

.label {
    display: flex; align-items: center; gap: 8px;
    font-size: 11px; font-weight: 800;
    color: var(--c-muted); letter-spacing: .8px; margin-bottom: 8px;
}
.label::before { content: '◈'; color: var(--c-gold); font-size: 14px; }
.label::after  { content: ''; flex: 1; height: 1px; background: linear-gradient(90deg, var(--c-divider), transparent); }

.translation { font-family: var(--font-title); font-size: 17px; line-height: 2; margin-bottom: 16px; color: var(--c-text); }
.tafsir {
    font-size: 14px; line-height: 1.9; color: var(--c-text);
    background: var(--c-surface-2); padding: 13px 15px; border-radius: 10px;
    border-right: 4px solid var(--c-gold); position: relative;
}
.tafsir::before {
    content: '❝';
    position: absolute; top: 8px; left: 10px;
    font-size: 28px; color: var(--c-gold); opacity: .3; line-height: 1;
}

/* ═══════════════════════════════════════════════════════════
   TOAST
═══════════════════════════════════════════════════════════ */
.toast {
    position: fixed; left: 50%; transform: translateX(-50%);
    bottom: calc(var(--bottom-h) + 16px);
    background: linear-gradient(135deg, var(--c-brand-mid), var(--c-brand));
    color: #fff; padding: 11px 22px; border-radius: 24px;
    font-size: 13px; font-weight: 700;
    opacity: 0; pointer-events: none;
    transition: opacity .22s, transform .22s;
    z-index: 110;
    box-shadow: 0 4px 18px rgba(14,74,58,.40);
    border: 1px solid rgba(255,255,255,.15);
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(-6px); }

/* ═══════════════════════════════════════════════════════════
   RESPONSIVE
═══════════════════════════════════════════════════════════ */

/* Mobile-first: تأكد أن الصورة تملأ العرض بالكامل مع هامش صغير */
@media (max-width: 480px) {
    .reader { padding: 6px 4px; }
    .page-frame {
        border-radius: 8px;
        box-shadow:
            0 0 0 1px var(--c-border),
            0 0 0 3px var(--cream),
            0 0 0 5px var(--c-gold),
            var(--shadow-sm);
    }
    .bb-page-jump input { width: 58px; font-size: 12px; padding: 4px 6px; }
    .bb-side { width: 36px; height: 36px; }
}
@media (min-width: 600px) {
    .reader { padding: 20px; }
    .pl-btn { width: 48px; height: 48px; }
    .pl-btn.primary { width: 62px; height: 62px; }
    .tool span { font-size: 12px; }
    .toolbar { padding: 0 8px; }
}
@media (min-width: 900px) {
    :root { --topbar-h: 62px; --toolbar-h: 70px; --bottom-h: 80px; }
    .tb-title-main { font-size: 19px; }
    .reader { padding: 28px; }
}

/* ── Scrollbars ── */
::-webkit-scrollbar { width: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--c-border); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--c-gold); }
