:root {
            --bg: #000000;
            --bg-card: rgba(18,18,18, 0.5);
            --text: #ffffff;
            --border: rgba(255,255,255, 0.15);
            --input-bg: rgba(10,10,10, 0.8);
            --sidebar-bg: #000000;
            --muted: #a3a3a3;
            --heading: #ffffff;
            --accent: #ffffff;
            --accent-light: #ffffff;
        }
        .light-mode {
            --bg: #ffffff;
            --bg-card: rgba(255, 255, 255, 0.9);
            --text: #000000;
            --border: rgba(0,0,0, 0.2);
            --input-bg: #ffffff;
            --sidebar-bg: #ffffff;
            --muted: #444444;
            --heading: #000000;
        }

        html, body { overflow-x: hidden; width: 100%; }
        * { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
        body {
            background: var(--bg);
            color: var(--text);
            transition: background 0.35s ease, color 0.35s ease;
            background-image:
                radial-gradient(circle at 10% 0%, rgba(255,255,255, 0.08), transparent 45%),
                radial-gradient(circle at 90% 40%, rgba(255,255,255, 0.1), transparent 50%);
            background-attachment: fixed;
        }
        .glass-effect { background: var(--bg-card); backdrop-filter: blur(16px); border: 1px solid var(--border); box-shadow: 0 25px 60px -15px rgba(0, 0, 0, 0.6); }

        .geo-pattern {
            background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='84' height='84' viewBox='0 0 84 84'%3E%3Cg fill='none' stroke='%23808080' stroke-opacity='0.16' stroke-width='1'%3E%3Cpath d='M42 0 L84 42 L42 84 L0 42 Z'/%3E%3Ccircle cx='42' cy='42' r='18'/%3E%3C/g%3E%3C/svg%3E");
            background-size: 84px 84px;
        }

        .custom-scrollbar::-webkit-scrollbar { width: 6px; }
        .custom-scrollbar::-webkit-scrollbar-track { background: rgba(0,0,0, 0.4); }
        .custom-scrollbar::-webkit-scrollbar-thumb { background: var(--accent); border-radius: 4px; }

        .light-mode { color: var(--text); }
        .light-mode [class*="text-white"],
        .light-mode h1, .light-mode h2, .light-mode h3 { color: var(--heading) !important; }
        .light-mode [class*="text-slate-100"],
        .light-mode [class*="text-slate-200"],
        .light-mode [class*="text-slate-300"] { color: #000000 !important; }
        .light-mode [class*="text-slate-400"] { color: var(--muted) !important; }
        .light-mode [class*="text-slate-500"] { color: #333333 !important; }
        .light-mode [class*="text-emerald-100"] { color: #000000 !important; }
        .light-mode [class*="text-emerald-400"]:not(.reciter-btn.active) { color: #000000 !important; }
        .light-mode [class*="bg-emerald-950"],
        .light-mode [class*="bg-emerald-900"] { background-color: rgba(0,0,0, 0.06) !important; }
        .light-mode [class*="border-emerald-500"] { border-color: rgba(0,0,0, 0.2) !important; }
        .light-mode header[class*="bg-emerald-950"] { background-color: rgba(255, 255, 255, 0.9) !important; border-color: rgba(0,0,0, 0.15) !important; }
        .light-mode #loader { background: rgba(255,255,255, 0.96) !important; }
        .light-mode .audio-spinner { border-color: rgba(0,0,0, 0.2); border-top-color: var(--accent); }
        .light-mode .nav-btn { background: rgba(0,0,0, 0.08); color: #000000; }
        .light-mode .nav-btn:hover { background: rgba(0,0,0, 0.15); border-color: var(--accent); }
        .light-mode .reciter-btn { background: rgba(0,0,0, 0.08); color: #333333; border-color: rgba(0,0,0, 0.2); }
        .light-mode .reciter-btn:hover { background: rgba(0,0,0, 0.15); color: #000000; border-color: var(--accent); }
        .light-mode .reciter-btn.active { background: var(--accent); color: #ffffff; border-color: var(--accent); }
        .light-mode .hero-btn-outline { color: #000000; border-color: #000000; }
        .light-mode .hero-btn-outline:hover { background: rgba(0,0,0, 0.1); }
        .light-mode .surah-item:hover { background: rgba(0,0,0, 0.1); }
        .light-mode .surah-item .num { background: rgba(0,0,0, 0.15); color: #000000; }
        .light-mode .surah-item .actions button { color: #555555; }
        .light-mode .surah-item .actions button:hover { color: #000000; }
        .light-mode #api-status-badge { background: rgba(0,0,0, 0.1) !important; color: #000000 !important; }
        .light-mode #error-box { background: #fef2f2 !important; color: #991b1b !important; border-color: rgba(239, 68, 68, 0.3) !important; }
        .light-mode #error-box p, .light-mode #error-box button { color: inherit !important; }
        .light-mode .sidebar-search input, .light-mode #sidebar-search-input { color: #000000; }
        .light-mode ::placeholder { color: #666666; }
        .light-mode .media-ctrl-btn { background: rgba(0,0,0, 0.08); color: #333333; border-color: rgba(0,0,0, 0.2); }
        .light-mode .media-ctrl-btn:hover { background: rgba(0,0,0, 0.15); color: #000000; }
        .light-mode .media-ctrl-btn.on { background: var(--accent); color: #fff; border-color: var(--accent); }
        .light-mode .footer-watermark { border-color: rgba(0,0,0, 0.15); color: #666666; }
        .light-mode #volume-slider, .light-mode #audio-progress-slider { accent-color: #000000; }
        .light-mode #audio-restart-btn { background: rgba(0,0,0, 0.08); color: #000000; border-color: rgba(0,0,0, 0.2); }
        .light-mode #audio-restart-btn:hover { background: rgba(0,0,0, 0.15); }

        .sidebar-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.7); z-index: 49; opacity: 0; pointer-events: none; transition: opacity 0.3s; }
        .sidebar-overlay.active { opacity: 1; pointer-events: auto; }
        .sidebar {
            position: fixed; top: 0; left: -340px; width: 320px; height: 100%; height: 100dvh;
            background: var(--sidebar-bg); border-right: 1px solid var(--border);
            z-index: 50; transition: left 0.32s cubic-bezier(.4,0,.2,1); display: flex; flex-direction: column; overflow: hidden;
            box-shadow: 25px 0 70px rgba(0,0,0,0.4);
        }
        .sidebar.open { left: 0; }
        .sidebar-header { padding: 20px 16px; border-bottom: 1px solid var(--border); display: flex; justify-content: space-between; align-items: center; flex-shrink: 0; }
        .sidebar-search { padding: 14px; border-bottom: 1px solid var(--border); flex-shrink: 0; }
        .sidebar-search input { width: 100%; padding: 12px 16px; background: var(--input-bg); border: 1px solid var(--border); border-radius: 14px; color: var(--text); font-size: 13px; outline: none; transition: border-color .2s; }
        .sidebar-search input:focus { border-color: var(--accent); }
        .sidebar-list { flex: 1; overflow-y: auto; padding: 8px 0 120px; }
        .surah-item { display: flex; align-items: center; gap: 10px; padding: 12px 16px; cursor: pointer; border-left: 3px solid transparent; transition: background 0.2s, border-color .2s; }
        .surah-item:hover { background: rgba(255,255,255,0.06); border-left-color: var(--accent); }
        .surah-item .num { min-width: 32px; height: 32px; display: flex; align-items: center; justify-content: center; background: rgba(255,255,255,0.12); border-radius: 10px; font-size: 11px; font-weight: 700; color: var(--accent-light); }
        .surah-item .info { flex:1; display: flex; flex-direction: column; }
        .surah-item .info .en { font-size:14px; font-weight:600; color:var(--text); }
        .surah-item .info .ar { font-family:'Amiri',serif; font-size:18px; color:var(--accent-light); }
        .surah-item .info .meta { font-size:11px; color: var(--muted); margin-top: 2px; }
        .surah-item .actions { display: flex; align-items:center; gap: 6px; }
        .surah-item .actions button { background: none; border: none; color: var(--muted); cursor: pointer; padding: 6px; font-size: 14px; transition: color 0.2s, transform .15s; }
        .surah-item .actions button:hover { color: var(--accent-light); transform: scale(1.15); }
        .surah-item .actions .faved { color: var(--accent); }

        .name-tile {
            background: rgba(18,18,18, 0.4); border: 1px solid var(--border); border-radius: 18px;
            padding: 16px 12px; text-align: center; cursor: pointer; transition: all .25s ease;
            animation: fadeInUp .4s ease both;
        }
        .name-tile:hover { border-color: var(--accent); background: rgba(255,255,255,0.1); transform: translateY(-4px); box-shadow: 0 10px 20px -5px rgba(255,255,255,0.15); }
        .name-tile .n-idx { font-size: 11px; color: var(--accent-light); font-weight: 700; }
        .name-tile .n-ar { font-family: 'Amiri', serif; font-size: 24px; color: var(--accent-light); margin: 6px 0; }
        .name-tile .n-en { font-size: 12px; font-weight: 600; color: var(--text); }
        .light-mode .name-tile { background: rgba(0,0,0, 0.04); }

        .name-modal-overlay {
            position: fixed; inset: 0; background: rgba(0,0,0,0.75); z-index: 70;
            display: flex; align-items: center; justify-content: center; padding: 20px;
            opacity: 0; pointer-events: none; transition: opacity .25s ease;
        }
        .name-modal-overlay.open { opacity: 1; pointer-events: auto; }
        .name-modal-card {
            background: var(--sidebar-bg); border: 1px solid var(--border); border-radius: 28px;
            padding: 36px 28px; max-width: 360px; width: 100%; text-align: center;
            transform: scale(.92) translateY(12px); transition: transform .25s ease;
            box-shadow: 0 35px 80px rgba(0,0,0,0.6);
        }
        .name-modal-overlay.open .name-modal-card { transform: scale(1) translateY(0); }

        .random-ayah-card {
            background: linear-gradient(135deg, rgba(18,18,18, 0.75), rgba(18,18,18, 0.35));
            border: 1px solid var(--border); border-radius: 28px; padding: 32px; position: relative; overflow: hidden;
            box-shadow: 0 20px 50px -10px rgba(0,0,0,0.3);
        }
        .random-ayah-card .ayah-arabic { font-family: 'Amiri', serif; font-size: 28px; line-height: 2.2; color: var(--accent-light); }
        .random-ayah-fade { animation: fadeInUp .5s ease both; }
        .refresh-spin { animation: spin .6s linear; }

        .tasbih-card { background: rgba(18,18,18, 0.45); border: 1px solid var(--border); border-radius: 28px; padding: 32px; text-align: center; box-shadow: 0 20px 50px -10px rgba(0,0,0,0.3); }
        .tasbih-count { font-size: 72px; font-weight: 800; color: var(--accent-light); font-variant-numeric: tabular-nums; transition: transform .12s ease; }
        .tasbih-count.pulse { transform: scale(1.15); }
        .tasbih-tap-btn {
            position: relative; z-index: 10;
            width: 140px; height: 140px; border-radius: 50%; border: none; cursor: pointer;
            background: radial-gradient(circle at 35% 30%, #ffffff, #bdbdbd);
            box-shadow: 0 15px 40px rgba(255,255,255,0.4), inset 0 -8px 16px rgba(0,0,0,0.25);
            color: #000000; font-size: 16px; font-weight: 800; letter-spacing: .05em;
            transition: transform .12s ease; pointer-events: auto;
        }
        .tasbih-tap-btn:active { transform: scale(0.92); }
        .tasbih-ring { display: flex; align-items: center; justify-content: center; position: relative; margin: 0 auto 22px; width: 160px; height: 160px; }
        .tasbih-ring svg { position: absolute; inset: 0; transform: rotate(-90deg); pointer-events: none; }
        .tasbih-ring circle { fill: none; stroke-width: 6; }
        .tasbih-mini-btn {
            width: 44px; height: 44px; border-radius: 50%; border: 1px solid var(--border); background: rgba(18,18,18, 0.6);
            color: var(--text); font-size: 18px; cursor: pointer; transition: all .2s;
        }
        .tasbih-mini-btn:hover { border-color: var(--accent); color: var(--accent-light); background: rgba(255,255,255,0.1); }
        @keyframes ripple { from { box-shadow: 0 0 0 0 rgba(255,255,255,0.4); } to { box-shadow: 0 0 0 22px rgba(255,255,255,0); } }
        .tasbih-tap-btn.tapped { animation: ripple .5s ease-out; }

        .reciter-btn { padding: 8px 18px; border-radius: 22px; font-size: 12px; font-weight: 600; border: 1px solid rgba(255,255,255,0.2); background: rgba(18,18,18, 0.5); color: var(--muted); transition: all 0.25s; cursor: pointer; white-space: nowrap; }
        .reciter-btn:hover { border-color: var(--accent); color: var(--accent-light); background: rgba(255,255,255,0.1); }
        .reciter-btn.active { border-color: var(--accent); color: #000000; background: var(--accent); box-shadow: 0 5px 16px rgba(255,255,255,0.35); }
        .reciter-btn.active:hover { background: #bdbdbd; border-color: #bdbdbd; }

        .nav-btn { padding: 10px 20px; border-radius: 14px; background: rgba(18,18,18, 0.6); border: 1px solid var(--border); color: var(--text); transition: 0.2s; cursor: pointer; font-size: 13px; }
        .nav-btn:hover { background: rgba(255,255,255,0.12); border-color: var(--accent); }
        .nav-btn:disabled { opacity: 0.3; pointer-events: none; }

        .hero-btn { padding: 14px 32px; border-radius: 35px; font-weight: 700; font-size: 14px; background: linear-gradient(135deg, #ffffff, #bdbdbd); color: #000000; border: none; cursor: pointer; transition: all 0.25s; box-shadow: 0 8px 28px rgba(255,255,255,0.3); }
        .hero-btn:hover { transform: translateY(-3px); box-shadow: 0 12px 38px rgba(255,255,255,0.4); }
        .hero-btn-outline { background: transparent; color: var(--accent-light); border: 2px solid var(--accent-light); }
        .hero-btn-outline:hover { background: rgba(255,255,255,0.12); transform: translateY(-3px); }

        @keyframes spin { to { transform: rotate(360deg); } }
        @keyframes fadeInUp { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: translateY(0); } }
        @keyframes popIn { from { opacity: 0; transform: scale(.95) translateY(-8px); } to { opacity: 1; transform: scale(1) translateY(0); } }
        .verse-anim { animation: fadeInUp 0.45s ease both; }
        #detail-view:not(.hidden), #main-list-view:not(.hidden) { animation: fadeInUp 0.35s ease both; }
        .audio-spinner { display:inline-block; width:18px; height:18px; border:2px solid rgba(255,255,255,0.25); border-top-color:var(--accent); border-radius:50%; animation:spin 0.7s linear infinite; }

        .media-ctrl-btn {
            display: inline-flex; align-items: center; gap: 8px; padding: 8px 14px; border-radius: 12px;
            font-size: 12px; font-weight: 600; border: 1px solid var(--border); background: rgba(18,18,18, 0.5);
            color: var(--muted); cursor: pointer; transition: all .2s;
        }
        .media-ctrl-btn:hover { border-color: var(--accent); color: var(--accent-light); }
        .media-ctrl-btn.on { background: var(--accent); color: #000000; border-color: var(--accent); }
        #volume-slider, #audio-progress-slider { accent-color: var(--accent); }
        #volume-slider { width: 90px; }
        #audio-progress-slider { width: 100%; }

        .footer-watermark {
            text-align: center; padding: 24px 16px 28px; margin-top: 32px;
            border-top: 1px solid var(--border); color: var(--muted);
            font-size: 11px; letter-spacing: 0.08em; text-transform: uppercase; font-weight: 700;
        }

/* ===== black & white theme helpers (light mode) ===== */
:root { --compass-red: #ff1a1a; }
.light-mode { --accent: #000000; --accent-light: #111111; }
#tasbih-progress-ring { stroke: var(--accent); }
.light-mode [class*="text-amber"] { color: #000000 !important; }
.light-mode [class*="text-emerald-950"] { color: #ffffff !important; }
.light-mode [class*="from-amber-300"], .light-mode [class*="from-amber-400"] { background-image: linear-gradient(135deg, #3a3a3a, #000000) !important; }
.light-mode #audio-play-btn, .light-mode #toast { background: #000000 !important; }
.light-mode .hero-btn { background: #000000; color: #ffffff; box-shadow: 0 8px 24px rgba(0,0,0,0.25); }
.light-mode .hero-btn-outline { background: transparent; color: #000000; }
.light-mode .tasbih-tap-btn { background: radial-gradient(circle at 35% 30%, #4a4a4a, #000000); color: #ffffff; }

/* ===== floating Qibla compass icon (bottom-left) ===== */
#compass-fab {
    position: fixed; left: 16px; bottom: 18px; z-index: 45;
    width: 56px; height: 56px; border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    background: #000; border: 2px solid var(--compass-red);
    box-shadow: 0 0 0 0 rgba(255,26,26,.6), 0 8px 24px rgba(0,0,0,.5);
    animation: fabPulse 2.4s infinite; transition: transform .2s;
    text-decoration: none;
}
#compass-fab:hover { transform: scale(1.1) rotate(8deg); }
#compass-fab:active { transform: scale(.92); }
@keyframes fabPulse { 70% { box-shadow: 0 0 0 16px rgba(255,26,26,0), 0 8px 24px rgba(0,0,0,.5); } 100% { box-shadow: 0 0 0 0 rgba(255,26,26,0), 0 8px 24px rgba(0,0,0,.5); } }
