/* 
 * UmmahWatch Design System - Recitation Mode Component
 * Premium Immersive Overlay with Glassmorphism and Transitions
 */

/* Global body state for better background syncing */
body.recitation-mode-active {
    overflow: hidden !important;
}

/* Ensure only one panel exists by forcing global player hide */
body.recitation-mode-active #global-quran-player {
    display: none !important;
}

.immersive-overlay {
    position: fixed;
    inset: 0;
    z-index: 99999;
    display: flex;
    flex-direction: column;
    background: var(--ui-bg-light);
    color: var(--ui-text-dark);
    transition: all 0.5s ease;
    overflow: hidden;
    width: 100vw;
    height: 100vh;
    max-width: 100vw;
}

.immersive-overlay.dark-mode {
    background: var(--ui-bg-dark);
    /* Pure Obsidian Base */
    color: var(--ui-text-light);
    position: fixed;
    overflow: hidden;
}

/* Captivating Galaxy Atmosphere: Layered Nebulae & Deep Space Dust */
/* Captivating Galaxy Atmosphere: Refined & Cleaner */
.immersive-overlay.dark-mode::before {
    content: '';
    position: absolute;
    inset: -50%;
    background:
        radial-gradient(circle at 50% 50%, rgba(2, 6, 23, 0.95) 0%, #000000 100%),
        radial-gradient(circle at 20% 30%, rgba(6, 78, 59, 0.15) 0%, transparent 50%),
        radial-gradient(circle at 80% 70%, rgba(217, 119, 6, 0.08) 0%, transparent 50%);
    animation: immNebulaRotate 120s infinite linear;
    z-index: 1;
    pointer-events: none;
    filter: blur(80px);
    /* Softer blur */
}

.immersive-overlay.dark-mode::after {
    content: '';
    position: absolute;
    inset: 0;
    background-image:
        radial-gradient(1.5px 1.5px at 10% 10%, rgba(255, 255, 255, 0.3), transparent),
        radial-gradient(1px 1px at 50% 50%, rgba(255, 255, 255, 0.2), transparent),
        radial-gradient(2px 2px at 80% 20%, rgba(255, 255, 255, 0.2), transparent);
    background-size: 600px 600px;
    opacity: 0.6;
    z-index: 2;
    animation: immStarsTwinkle 10s infinite alternate ease-in-out;
    pointer-events: none;
}

@keyframes immStarsTwinkle {

    0%,
    100% {
        opacity: 0.4;
    }

    50% {
        opacity: 0.7;
    }
}

@keyframes immCosmicPulse {

    0%,
    100% {
        opacity: 0.8;
    }

    50% {
        opacity: 1;
    }
}

.immersive-overlay.dark-mode .imm-text-card-v3 {
    background: rgba(15, 23, 42, 0.6);
    /* Slate-900 with opacity */
    border: 1px solid rgba(255, 255, 255, 0.08);
    box-shadow:
        0 20px 50px rgba(0, 0, 0, 0.5),
        inset 0 0 0 1px rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-radius: 32px;
    position: relative;
    z-index: 10;
    transition: all 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}

.immersive-overlay.dark-mode .imm-text-card-v3.intro-anim {
    transform: translateY(0);
    opacity: 1;
}

/* Subtler Glow Blobs */
.immersive-overlay.dark-mode .imm-scroll-area::after {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(circle at 50% 50%, rgba(16, 185, 129, 0.03), transparent 60%);
    pointer-events: none;
    z-index: 1;
}

@keyframes immGlowDrift {
    0% {
        transform: translate(0, 0) scale(1);
    }

    100% {
        transform: translate(5%, 5%) scale(1.1);
    }
}


.immersive-overlay.dark-mode .imm-arabic-v3 {
    color: var(--ui-text-light) !important;
    text-shadow:
        0 0 15px rgba(255, 255, 255, 0.4),
        0 0 40px rgba(255, 255, 255, 0.1) !important;
    font-weight: 700 !important;
    animation: immHolyGlow 8s infinite alternate ease-in-out;
}

@keyframes immHolyGlow {
    0% {
        text-shadow: 0 0 15px rgba(255, 255, 255, 0.3), 0 0 30px rgba(255, 255, 255, 0.1);
    }

    100% {
        text-shadow: 0 0 25px rgba(255, 255, 255, 0.5), 0 0 50px rgba(255, 255, 255, 0.2);
    }
}


.immersive-overlay.dark-mode .imm-en-v3 {
    color: #cbd5e1 !important;
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.5) !important;
}

.immersive-overlay.dark-mode .imm-ur-v3 {
    color: #cbd5e1 !important;
    /* Clean Slate/Grey for Urdu Reflection in Dark Mode */
    text-shadow: 0 0 15px rgba(255, 255, 255, 0.1) !important;
    font-size: var(--font-size-imm-urdu, 1.8rem) !important;
    line-height: 1.8 !important;
}


.immersive-overlay.dark-mode .imm-footer-glass {
    background: linear-gradient(to top, rgba(0, 0, 0, 0.9) 30%, rgba(0, 0, 0, 0.5) 80%, transparent) !important;
    backdrop-filter: blur(30px) !important;
    -webkit-backdrop-filter: blur(30px) !important;
    border-top: 1px solid rgba(255, 255, 255, 0.08) !important;
    box-shadow: 0 -20px 50px rgba(0, 0, 0, 0.5);
}

.immersive-overlay.dark-mode .imm-header-glass {
    background: linear-gradient(to bottom, rgba(0, 0, 0, 0.6) 0%, transparent 100%) !important;
    backdrop-filter: blur(10px) !important;
    -webkit-backdrop-filter: blur(10px) !important;
}

@keyframes immNebulaRotate {
    from {
        transform: rotate(0deg) scale(1.2);
    }

    to {
        transform: rotate(360deg) scale(1.2);
    }
}

@keyframes immGlowPulse {
    0% {
        opacity: 0.4;
        transform: scale(1);
    }

    100% {
        opacity: 0.8;
        transform: scale(1.05);
    }
}


@keyframes card-float {

    0%,
    100% {
        transform: translateY(0);
    }

    50% {
        transform: translateY(-10px);
    }
}

@keyframes neon-pulse {

    0%,
    100% {
        opacity: 0.8;
        text-shadow: 0 0 20px rgba(16, 185, 129, 0.3);
    }

    50% {
        opacity: 1;
        text-shadow: 0 0 35px rgba(16, 185, 129, 0.6);
    }
}

#fractal-canvas {
    position: absolute;
    inset: 0;
    z-index: 0;
    pointer-events: none;
}

.imm-header-glass {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    z-index: 100;
    display: flex;
    justify-content: flex-end;
    /* Align actions to the right */
    align-items: center;
    padding: 1.5rem 5%;
    background: linear-gradient(to bottom, rgba(0, 0, 0, 0.4), transparent) !important;
}

.imm-static-info {
    position: absolute;
    top: 1.5rem;
    left: 5%;
    z-index: 110;
    /* Above header glass to stay visible */
    pointer-events: none;
}

.imm-meta-row {
    margin-top: 4px;
}

#imm-chapter-timer {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    background: rgba(16, 185, 129, 0.15);
    border-radius: 20px;
    border: 1px solid rgba(16, 185, 129, 0.3);
    transition: all 0.3s ease;
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.05em;
}

/* --- Sleek Top Bar & Stats --- */
.imm-top-bar {
    position: absolute;
    top: 3.5rem;
    /* Pushed down slightly to accommodate top progress bar */
    left: 50%;
    transform: translateX(-50%);
    z-index: 1000;
    display: flex;
    align-items: center;
    gap: 1.5rem;
    padding: 0.6rem 1.4rem;
    background: rgba(15, 23, 42, 0.4);
    backdrop-filter: blur(25px);
    -webkit-backdrop-filter: blur(25px);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 99px;
    box-shadow:
        0 4px 6px -1px rgba(0, 0, 0, 0.1),
        0 10px 30px rgba(0, 0, 0, 0.3);
    transition: all 0.5s cubic-bezier(0.16, 1, 0.3, 1);
    max-width: calc(100% - 40px);
}

/* New Top Progress Bar */
.imm-top-progress {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 8px;
    /* Slightly thicker for better visibility */
    background: rgba(255, 255, 255, 0.05);
    z-index: 2000;
    cursor: pointer;
    overflow: hidden;
}

.immersive-overlay.light-mode .imm-top-progress {
    background: rgba(0, 0, 0, 0.03);
}

.imm-top-progress .buffer-fill {
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    background: rgba(255, 255, 255, 0.1);
    width: 0;
    transition: width 0.3s ease;
}

.immersive-overlay.light-mode .imm-top-progress .buffer-fill {
    background: rgba(0, 0, 0, 0.05);
}

.imm-top-progress .progress-fill {
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    background: linear-gradient(to right, #10b981, #34d399);
    width: 0;
    transition: width 0.1s linear;
    box-shadow: 0 0 15px rgba(16, 185, 129, 0.5);
}

.immersive-overlay.light-mode .imm-top-bar {
    background: rgba(255, 255, 255, 0.7);
    border-color: rgba(0, 0, 0, 0.05);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.05);
}

.imm-chapter-info {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.surah-title {
    font-family: var(--ui-font-title);
    font-weight: 800;
    font-size: 0.9rem;
    letter-spacing: -0.01em;
    color: white;
    /* Forced white for visibility on dark */
}

.immersive-overlay.light-mode .surah-title {
    color: var(--ui-text-dark);
}

.info-divider {
    width: 4px;
    height: 4px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 50%;
}

.ayah-badge {
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: rgba(255, 255, 255, 0.7) !important;
    /* Lighter color for dark mode */
}

.immersive-overlay.light-mode .ayah-badge {
    color: var(--ui-text-muted) !important;
}

.imm-stats-pills {
    display: flex;
    gap: 0.5rem;
}

.stat-pill {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.4rem 0.8rem;
    border-radius: 99px;
    font-size: 0.65rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    background: rgba(255, 255, 255, 0.05);
}

.stat-pill.ruku {
    color: #87cca6;
    background: rgba(251, 191, 36, 0.1);
}

.stat-pill.verse {
    color: #34d399;
    background: rgba(52, 211, 153, 0.1);
}

.stat-pill.timer {
    color: #818cf8;
    background: rgba(129, 140, 248, 0.1);
}

.stat-pill .dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: currentColor;
    box-shadow: 0 0 8px currentColor;
}

/* Exit Button Styling */
.imm-header-left {
    position: absolute;
    top: 2rem;
    left: 2rem;
    z-index: 1001;
}

.imm-exit-btn {
    width: 48px;
    height: 48px;
    border-radius: 16px;
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.2);
    color: #615f5f;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.imm-exit-btn:hover {
    background: #ef4444;
    color: white;
    transform: rotate(90deg) scale(1.1);
}

/* Side Notification / Toast */
.recitation-toast {
    position: fixed;
    top: 2rem;
    left: 2rem;
    z-index: 100000;
    padding: 0.6rem 1.2rem;
    background: rgba(15, 23, 42, 0.95);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 12px;
    color: white;
    font-weight: 700;
    font-size: 0.85rem;
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.4);
    transform: translateX(-120%);
    transition: transform 0.6s cubic-bezier(0.16, 1, 0.3, 1);
    display: flex;
    align-items: center;
    gap: 0.6rem;
}

.recitation-toast.show {
    transform: translateX(0);
}

.recitation-toast::before {
    content: '✦';
    color: var(--ui-primary);
}

.immersive-overlay.dark-mode #imm-chapter-timer {
    background: rgba(16, 185, 129, 0.12);
    border-color: rgba(16, 185, 129, 0.25);
    color: #34d399;
    box-shadow: 0 0 15px rgba(16, 185, 129, 0.1);
}

.immersive-overlay.light-mode #imm-chapter-timer {
    background: rgba(5, 150, 105, 0.1);
    border-color: rgba(5, 150, 105, 0.2);
    color: #059669;
    box-shadow: 0 2px 8px rgba(5, 150, 105, 0.1);
}

.imm-meta-dot {
    width: 4px;
    height: 4px;
    background: currentColor;
    border-radius: 50%;
    opacity: 0.3;
}

.immersive-overlay.controls-hidden .imm-static-info {
    transform: none !important;
    opacity: 1 !important;
}

.immersive-overlay.light-mode .imm-header-glass {
    background: linear-gradient(to bottom, rgba(255, 255, 255, 0.6), transparent) !important;
}

.imm-scroll-area {
    flex: 1;
    z-index: 50;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    padding: 100px 20px 140px;
    overflow-y: auto;
    overflow-x: hidden;
    width: 100%;
}

.imm-text-card-v3 {
    text-align: center;
    max-width: 900px;
    width: 92%;
    min-width: 320px;
    /* User Request: prevent tiny cards for short verses */
    padding: 40px;
    margin: auto;
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 30px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
    transition: all 0.3s ease;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

.immersive-overlay.light-mode .imm-text-card-v3 {
    background: rgba(255, 255, 255, 0.6);
    border-color: rgba(255, 255, 255, 0.8);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.05);
}

.imm-arabic-v3 {
    font-family: var(--font-arabic) !important;
    font-size: var(--font-size-imm-arabic) !important;
    line-height: var(--line-height-arabic) !important;
    margin-bottom: 0.5rem;
    direction: rtl;
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.5);
    font-weight: var(--font-weight-arabic) !important;
}

.immersive-overlay.light-mode .imm-arabic-v3 {
    text-shadow: none;
    color: #0f172a;
}

.imm-divider {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    width: 100%;
    max-width: 200px;
    margin: 1rem auto;
    opacity: 0.3;
}

.imm-divider .line {
    flex: 1;
    height: 1px;
    background: currentColor;
}

.imm-divider .dot {
    width: 4px;
    height: 4px;
    border-radius: 50%;
    background: currentColor;
}

.imm-translation-block {
    display: block;
    width: 100%;
}

.imm-en-v3 {
    font-family: var(--font-english) !important;
    font-size: var(--font-size-imm-english, 1rem) !important;
    opacity: 0.95;
    max-width: 800px;
    margin: 0 auto;
    line-height: var(--line-height-english) !important;
    font-weight: 500;
    transition: opacity 0.3s ease, transform 0.3s ease;
}

.immersive-overlay.light-mode .imm-en-v3 {
    color: #334155;
}

.imm-ur-v3 {
    font-family: 'Fajer Noori';
    src: url('../fonts/urdu/fajer.ttf') format('truetype');
    font-size: var(--font-size-imm-urdu, 1.4rem) !important;
    color: #334155;
    /* Dark Slate Grey instead of Orange */
    direction: rtl;
    line-height: 1.3;
    margin-top: 0.5rem;
    text-shadow: none;
    transition: opacity 0.3s ease, transform 0.3s ease;
}

.immersive-overlay.light-mode .imm-ur-v3 {
    color: #1e293b;
    text-shadow: none;
    font-weight: 700;
}

/* Scale down for long verses */
.imm-text-card-v3.long-text .imm-arabic-v3 {
    font-size: calc(clamp(2rem, 5vw, 2.5rem) * 0.8) !important;
}

.imm-text-card-v3.long-text .imm-en-v3 {
    font-size: calc(clamp(1rem, 1.8vw, 1.25rem) * 0.8) !important;
}

.imm-text-card-v3.long-text .imm-ur-v3 {
    font-size: calc(clamp(1.2rem, 2.5vw, 1.8rem) * 0.8) !important;
}

/* Hide scrollbar */
.immersive-overlay,
.imm-scroll-area {
    scrollbar-width: none !important;
    -ms-overflow-style: none !important;
}

.immersive-overlay::-webkit-scrollbar,
.imm-scroll-area::-webkit-scrollbar {
    display: none !important;
}

.imm-footer-glass {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 100;
    padding: 30px 5% !important;
    background: linear-gradient(to top, rgba(15, 23, 42, 0.95), rgba(15, 23, 42, 0.6), transparent) !important;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-top: 1px solid rgba(255, 255, 255, 0.05);
}

.immersive-overlay.light-mode .imm-footer-glass {
    background: linear-gradient(to top, rgba(255, 255, 255, 0.9), rgba(255, 255, 255, 0.6), transparent) !important;
}

.imm-controls-v3 {
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: relative;
    max-width: 1200px;
    margin: 0 auto;
}

.main-buttons {
    display: flex;
    gap: 24px;
    align-items: center;
}

.play-pause-btn {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background: var(--ui-primary);
    color: white;
    font-size: 1.5rem;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    box-shadow: 0 10px 20px rgba(var(--ui-primary-rgb), 0.2);
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.immersive-overlay.dark-mode .play-pause-btn {
    background: #ffffff;
    color: #020617;
    /* Dark Slate */
    box-shadow: 0 0 30px rgba(255, 255, 255, 0.15);
}

.play-pause-btn:hover {
    transform: scale(1.1);
    box-shadow: 0 0 40px rgba(255, 255, 255, 0.25);
}

.imm-nav-btn {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: white;
    font-size: 1.1rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.immersive-overlay.light-mode .imm-nav-btn {
    background: rgba(255, 255, 255, 0.9);
    border-color: rgba(0, 0, 0, 0.15);
    color: #1e293b;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.immersive-overlay.light-mode .imm-nav-btn:hover {
    background: #ffffff !important;
    border-color: var(--ui-primary);
    color: var(--ui-primary);
}

.imm-nav-btn:hover {
    background: rgba(255, 255, 255, 0.1) !important;
    transform: translateY(-2px);
    border-color: rgba(255, 255, 255, 0.3);
}

.imm-nav-btn.secondary {
    opacity: 0.5;
    transform: scale(0.8);
}

.imm-nav-btn.secondary:hover {
    opacity: 0.9;
    transform: scale(0.9) translateY(-2px);
}

.imm-chip {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    border-radius: 50px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.15);
    color: white;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    cursor: pointer;
    transition: all 0.3s;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

.immersive-overlay.light-mode .imm-chip {
    background: rgba(0, 0, 0, 0.05);
    border-color: rgba(0, 0, 0, 0.1);
    color: #475569;
}

.imm-chip:hover {
    background: var(--ui-primary);
    border-color: var(--ui-primary);
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(var(--ui-primary-rgb), 0.3);
}

.immersive-overlay.dark-mode .imm-chip {
    background: rgba(16, 185, 129, 0.1);
    border-color: rgba(16, 185, 129, 0.2);
    color: #e2e8f0;
    /* Light Slate-200 for high visibility */
}

.imm-chip.active {
    background: var(--ui-primary);
    border-color: var(--ui-primary);
    color: white;
}

.immersive-overlay.fullscreen-active {
    width: 100vw !important;
    height: 100vh !important;
    max-width: none !important;
    max-height: none !important;
}

.imm-system-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

.fade-out {
    opacity: 0;
    pointer-events: none;
}

/* Floating Toggle for Mobile */
.imm-float-toggle {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: var(--ui-primary);
    color: white;
    display: none;
    /* Desktop hidden */
    align-items: center;
    justify-content: center;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
    z-index: 100000;
    cursor: pointer;
    border: none;
    transition: all 0.3s;
}

@media (max-width: 850px) {
    .imm-controls-v3 {
        flex-direction: column;
        gap: 1.5rem;
        padding-bottom: 20px;
    }

    .imm-settings-row {
        width: 100%;
        justify-content: center !important;
    }

    .playback-system-row {
        width: 100%;
        justify-content: center !important;
    }

    .imm-controls-v3>div {
        flex: 1 1 100% !important;
        justify-content: center !important;
    }

    .imm-main-buttons {
        order: -1;
        padding: 0 !important;
    }

    .imm-text-card-v3 {
        padding: 30px 20px !important;
        width: 95% !important;
        min-width: 280px !important;
        /* Slightly smaller min-width for mobile */
    }

    .imm-header-glass {
        padding: 1rem 5% !important;
    }
}

@media (max-width: 768px) {
    .imm-top-bar {
        top: 1.5rem;
        padding: 0.4rem 1rem;
        background: transparent;
        border: none;
        box-shadow: none;
        backdrop-filter: none;
        -webkit-backdrop-filter: none;
        width: 100%;
        justify-content: center;
        flex-wrap: wrap;
        /* Prevent overflow if pills are too many */
    }

    .surah-title {
        font-size: 1.1rem;
        letter-spacing: -0.02em;
        text-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
    }

    .ayah-badge {
        font-size: 0.8rem;
        color: rgba(255, 255, 255, 0.8) !important;
        text-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
    }

    .imm-top-progress {
        height: 10px;
    }

    .imm-arabic-v3 {
        font-size: clamp(1.8rem, 8vw, 2.5rem) !important;
        line-height: 1.8;
    }

    .imm-en-v3 {
        font-size: clamp(0.9rem, 4vw, 1.1rem) !important;
        line-height: 1.6;
    }

    .imm-ur-v3 {
        font-size: clamp(1.2rem, 5vw, 1.6rem) !important;
        line-height: 1.8;
    }

    .imm-header-glass {
        padding: 1rem 1.5rem;
        flex-direction: row;
        justify-content: space-between;
        background: none !important;
        /* Cleaner header */
    }

    .imm-text-card-v3 {
        padding: 25px 20px;
        border-radius: 24px;
        margin: 1rem auto;
    }

    /* Footer Controls - Optimized Mobile Stack */
    .imm-footer-glass {
        padding: 15px 15px 40px !important;
        backdrop-filter: blur(40px);
        -webkit-backdrop-filter: blur(40px);
        border-top: 1px solid rgba(255, 255, 255, 0.1);
        background: linear-gradient(to top, rgba(15, 23, 42, 0.98), rgba(15, 23, 42, 0.8), transparent) !important;
    }

    .imm-controls-v3 {
        display: flex;
        flex-direction: column;
        gap: 20px;
        align-items: center;
    }

    /* 1. Reciter & Translation (Top Row on Mobile) */
    .imm-settings-row {
        order: 1;
        width: 100%;
        justify-content: center !important;
        gap: 8px;
    }

    /* 2. Unified Playback + System Row (Middle Row on Mobile) */
    .playback-system-row {
        order: 2;
        width: 100%;
        justify-content: center !important;
        gap: 15px !important;
        padding: 0 !important;
    }

    .playback-system-row .imm-nav-btn {
        width: 42px;
        height: 42px;
        flex: 0 0 auto;
    }

    .main-buttons {
        gap: 15px !important;
    }

    .play-pause-btn {
        width: 64px !important;
        height: 64px !important;
    }

    .imm-chip {
        flex: 0 1 auto;
        min-width: 120px;
        justify-content: center;
        font-size: 0.65rem;
        padding: 6px 12px;
    }

    .imm-scroll-area {
        padding-top: 60px;
        padding-bottom: 200px;
    }

    /* Mobile Icon Visibility Tweaks */
    .opt-fullscreen,
    .opt-theme {
        background: rgba(255, 255, 255, 0.1);
        border-color: rgba(255, 255, 255, 0.2);
        color: white;
    }

    .immersive-overlay.light-mode .opt-fullscreen,
    .immersive-overlay.light-mode .opt-theme {
        background: rgba(0, 0, 0, 0.06);
        border-color: rgba(0, 0, 0, 0.1);
        color: #475569;
    }
}

@media (max-width: 480px) {
    .imm-arabic-v3 {
        font-size: 1.6rem !important;
    }

    .imm-en-v3 {
        font-size: 0.85rem !important;
    }

    .imm-ur-v3 {
        font-size: 1.1rem !important;
    }

    .main-buttons {
        gap: 15px;
    }

    .play-pause-btn {
        width: 54px;
        height: 54px;
    }

    .imm-nav-btn {
        width: 44px;
        height: 44px;
        color: white !important;
        /* Ensure icons are visible */
    }

    .immersive-overlay.light-mode .imm-nav-btn {
        color: #475569 !important;
    }

    .imm-chip span:last-child {
        max-width: 80px;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .sm-hide {
        display: none !important;
    }
}


/* Recommendation Screen */
.imm-recommend-screen {
    position: absolute;
    inset: 0;
    z-index: 200;
    background: rgba(var(--ui-bg-dark-rgb, 2, 6, 23), 0.9);
    backdrop-filter: blur(25px);
    -webkit-backdrop-filter: blur(25px);
    display: flex;
    align-items: center;
    justify-content: center;
    animation: imm-fade-in 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}

.immersive-overlay.light-mode .imm-recommend-screen {
    background: rgba(255, 255, 255, 0.85);
}

.imm-recommend-content {
    max-width: 800px;
    width: 90%;
    text-align: center;
}

.finish-icon {
    font-size: 4rem;
    animation: imm-float 3s ease-in-out infinite;
}

.imm-recommend-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1.5rem;
    margin-top: 2rem;
}

.recommend-card {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 20px;
    padding: 1.5rem;
    text-align: center;
    transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    cursor: pointer;
    text-decoration: none;
    color: inherit;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.75rem;
}

.immersive-overlay.light-mode .recommend-card {
    background: white;
    border-color: rgba(0, 0, 0, 0.05);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.05);
}

.recommend-card:hover {
    transform: translateY(-8px);
    background: rgba(var(--ui-primary-rgb), 0.1);
    border-color: var(--ui-primary);
    box-shadow: 0 20px 40px rgba(var(--ui-primary-rgb), 0.2);
}

.rec-icon {
    width: 50px;
    height: 50px;
    background: rgba(var(--ui-primary-rgb), 0.1);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    color: var(--ui-primary);
    border: 1px solid rgba(var(--ui-primary-rgb), 0.2);
}

.rec-surah {
    font-weight: 800;
    font-size: 1.1rem;
    font-family: var(--ui-font-title, 'Outfit', sans-serif);
}

.rec-meta {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    opacity: 0.6;
    font-weight: 700;
}

@keyframes imm-fade-in {
    from {
        opacity: 0;
        transform: scale(1.05);
    }

    to {
        opacity: 1;
        transform: scale(1);
    }
}

@keyframes imm-float {

    0%,
    100% {
        transform: translateY(0);
    }

    50% {
        transform: translateY(-15px);
    }
}

/* --- Auto-Hide Controls Logic --- */

/* Default State: Controls Visible */
.imm-header-glass,
.imm-footer-glass {
    transition: transform 0.5s ease, opacity 0.5s ease;
}

/* Hidden State */
.immersive-overlay.controls-hidden .imm-header-glass {
    transform: translateY(-100%);
    opacity: 0;
    pointer-events: none;
}

.immersive-overlay.controls-hidden .imm-footer-glass {
    transform: translateY(100%);
    opacity: 0;
    pointer-events: none;
}

/* Floating Toggle (The "Icon" to show controls) */
/* Override previous display:none for mobile if needed, but managing visibility via class */
.imm-float-toggle {
    display: flex;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    z-index: 200;
}

.immersive-overlay.controls-hidden .imm-float-toggle {
    opacity: 1;
    pointer-events: auto;
    display: flex !important;
    /* Force show on mobile when controls hidden */
}

/* Font Fallback Update */
.imm-arabic-v3 {
    font-family: 'Amiri', 'Scheherazade New', 'Lateef', serif !important;
}

/* Pause Banner Styles */
.imm-pause-banner {
    position: absolute;
    top: -60px;
    left: 50%;
    transform: translateX(-50%);
    width: 90%;
    max-width: 500px;
    background: rgba(15, 23, 42, 0.85);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.15);
    padding: 20px;
    border-radius: 24px;
    z-index: 1000;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.6);
    animation: bannerSlideDown 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
}

@keyframes bannerSlideDown {
    from {
        transform: translate(-50%, -40px);
        opacity: 0;
    }

    to {
        transform: translate(-50%, 0);
        opacity: 1;
    }
}

.pause-banner-content {
    display: flex;
    align-items: center;
    gap: 20px;
}

.pause-icon {
    font-size: 1.5rem;
    background: rgba(255, 255, 255, 0.1);
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    color: #fbbf24;
}

.pause-text-wrap {
    flex: 1;
}

.btn-pause-action {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: white;
    padding: 10px 18px;
    border-radius: 12px;
    font-size: 0.8rem;
    font-weight: 800;
    cursor: pointer;
    transition: all 0.3s;
    white-space: nowrap;
}

.btn-pause-action.active {
    background: #fbbf24;
    color: #064E3B;
    border-color: #fbbf24;
}

.btn-pause-resume {
    background: #10b981;
    color: white;
    border: none;
    padding: 10px 18px;
    border-radius: 12px;
    font-size: 0.8rem;
    font-weight: 800;
    cursor: pointer;
    transition: all 0.3s;
}

.btn-pause-resume:hover {
    filter: brightness(1.1);
    transform: scale(1.05);
}

/* Bismillah Calligraphic Styling */
.bismillah-calligraphy {
    display: flex;
    justify-content: center;
    align-items: center;
    margin: 60px 0 !important;
    animation: bismillah-glow 3s infinite alternate ease-in-out;
}

.bismillah-svg-imm {
    width: 600px;
    max-width: 90%;
    height: auto;
    filter: drop-shadow(0 0 15px rgba(255, 255, 255, 0.4));
    transition: filter 0.3s ease;
}

.immersive-overlay.dark-mode .bismillah-svg-imm {
    filter: invert(1) drop-shadow(0 0 20px rgba(255, 255, 255, 0.6));
}

.bismillah-svg-list {
    width: 400px;
    max-width: 90%;
    height: auto;
    margin: 1.5rem auto;
    display: block;
    /* In list mode, if it's dark theme (global), we might need to invert it */
}

/* Base Light Mode List - keep as is (black) */
.ayah-card.is-read .bismillah-svg-list {
    opacity: 0.4;
}

@keyframes bismillah-glow {
    from {
        transform: scale(1);
    }

    to {
        transform: scale(1.05);
    }
}

@media (max-width: 480px) {
    .bismillah-calligraphy {
        margin: 30px 0 !important;
    }

    .bismillah-svg-imm {
        width: 300px;
    }

    .bismillah-svg-list {
        width: 200px;
    }
}