@font-face {
    font-family: 'HafsSmart';
    src: url('/HafsSmart_08.ttf') format('truetype');
    font-display: swap;
}
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}
body {
    font-family: 'HafsSmart', 'Amiri', 'Traditional Arabic', serif;
    background:
        radial-gradient(circle at top left, rgba(80, 194, 220, 0.16), transparent 34%),
        radial-gradient(circle at top right, rgba(220, 92, 110, 0.12), transparent 30%),
        linear-gradient(135deg, #10151f 0%, #151a24 52%, #0b0f16 100%);
    min-height: 100vh;
    direction: rtl;
    color: #e8edf4;
}
.container {
    max-width: 1220px;
    margin: 0 auto;
    padding: 18px 24px 32px;
}
.header {
    text-align: center;
    background: linear-gradient(135deg, rgba(28, 37, 52, 0.92) 0%, rgba(13, 18, 28, 0.94) 100%);
    color: #edf4fb;
    padding: 22px 28px;
    border-radius: 20px;
    margin-bottom: 24px;
    box-shadow: 0 18px 44px rgba(0,0,0,0.35);
    border: 1px solid rgba(82, 206, 229, 0.35);
    backdrop-filter: blur(10px);
}
.header h1 {
    font-size: 2.2rem;
    margin-bottom: 8px;
    color: #52cee5;
    text-shadow: 0 0 24px rgba(82, 206, 229, 0.18);
}
.header p {
    font-size: 1.1rem;
    color: #b7c5d6;
}
.controls {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 15px;
    margin-bottom: 25px;
    flex-wrap: wrap;
    direction: ltr;
}
.controls .control-group {
    justify-content: center;
}
.controls .control-group:first-child {
    margin-inline-start: auto;
}
.controls .control-group:last-child {
    margin-inline-end: auto;
}
.control-group {
    display: flex;
    align-items: center;
    gap: 8px;
    background: rgba(20, 27, 39, 0.9);
    padding: 10px 16px;
    border-radius: 20px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.24);
    border: 1px solid rgba(82, 206, 229, 0.26);
    backdrop-filter: blur(10px);
}
.control-group label {
    font-weight: bold;
    color: #6ed5ea;
    font-size: 0.9rem;
}

.audio-debug {
    background: rgba(20, 27, 39, 0.88);
    border: 1px solid rgba(82, 206, 229, 0.26);
    border-radius: 16px;
    padding: 12px 16px;
    margin-bottom: 20px;
    box-shadow: 0 10px 26px rgba(0,0,0,0.22);
    direction: ltr;
    backdrop-filter: blur(10px);
}

.audio-debug-title {
    font-size: 0.9rem;
    font-weight: bold;
    color: #52cee5;
    margin-bottom: 6px;
}

.audio-debug-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 6px 12px;
    font-size: 0.82rem;
    color: #b7c5d6;
}
select, input {
    padding: 6px 10px;
    border: 1px solid rgba(82, 206, 229, 0.28);
    border-radius: 6px;
    font-size: 14px;
    background: rgba(12, 17, 26, 0.92);
    color: #eef4fb;
}
select:focus, input:focus {
    outline: none;
    border-color: #52cee5;
    box-shadow: 0 0 0 3px rgba(82, 206, 229, 0.18);
}
.navigation {
    display: flex;
    justify-content: center;
    gap: 12px;
    margin-bottom: 25px;
    direction: ltr;
}
.nav-btn {
    background: linear-gradient(135deg, #56bed8 0%, #4d7ba5 100%);
    color: #08111b;
    border: 1px solid rgba(82, 206, 229, 0.2);
    padding: 10px 20px;
    border-radius: 20px;
    cursor: pointer;
    font-size: 14px;
    font-weight: bold;
    transition: all 0.3s ease;
    box-shadow: 0 10px 20px rgba(0,0,0,0.28);
}
.nav-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 14px 24px rgba(0,0,0,0.32);
}
.nav-btn:disabled {
    background: #58606d;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
    border-color: #58606d;
}
.page-info {
    text-align: center;
    margin-bottom: 15px;
    font-size: 16px;
    color: #dceaf6;
    background: rgba(20, 27, 39, 0.88);
    padding: 12px;
    border-radius: 12px;
    box-shadow: 0 10px 22px rgba(0,0,0,0.22);
    border: 1px solid rgba(82, 206, 229, 0.2);
}
.mushaf-page {
    background:
        radial-gradient(circle at 15% 10%, rgba(82, 206, 229, 0.06), transparent 28%),
        radial-gradient(circle at 90% 20%, rgba(217, 93, 114, 0.06), transparent 24%),
        linear-gradient(145deg, #151b26 0%, #0f141d 100%);
    border-radius: 18px;
    box-shadow: 0 20px 44px rgba(0,0,0,0.35);
    padding: 40px 50px;
    margin-bottom: 25px;
    border: 1px solid rgba(82, 206, 229, 0.22);
    min-height: 650px;
    position: relative;
}
.mushaf-page::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-image:
        radial-gradient(circle at 25% 25%, rgba(82, 206, 229, 0.05) 0%, transparent 50%),
        radial-gradient(circle at 75% 75%, rgba(217, 93, 114, 0.05) 0%, transparent 50%);
    border-radius: 18px;
    pointer-events: none;
}
.sura-header {
    text-align: center;
    margin: 30px 0 25px 0;
    padding: 20px;
    background: linear-gradient(135deg, rgba(35, 44, 60, 0.96) 0%, rgba(16, 22, 32, 0.96) 100%);
    border-radius: 14px;
    box-shadow: 0 8px 20px rgba(0,0,0,0.18);
    border: 1px solid rgba(82, 206, 229, 0.22);
    position: relative;
    z-index: 1;
}
.sura-name {
    font-size: 1.8rem;
    color: #eef4fb;
    margin-bottom: 8px;
    font-weight: bold;
    text-shadow: 0 0 16px rgba(82, 206, 229, 0.12);
}
.sura-info {
    color: #6ed5ea;
    font-size: 1rem;
    font-weight: bold;
}
.bismillah {
    text-align: center;
    font-size: 1.6rem;
    color: #d95d72;
    margin: 20px 0 30px 0;
    font-weight: bold;
    text-shadow: 0 0 12px rgba(217, 93, 114, 0.15);
    position: relative;
    z-index: 1;
}
.bismillah::before,
.bismillah::after {
    content: '✦';
    font-size: 1rem;
    color: #6ed5ea;
    margin: 0 15px;
}
.quran-text {
    font-size: 1.9rem;
    line-height: 2.8;
    color: #e8edf4;
    text-align: justify;
    text-justify: inter-word;
    margin-bottom: 20px;
    position: relative;
    z-index: 1;
    text-shadow: 0 0 12px rgba(0,0,0,0.18);
}
.quran-text span {
    transition: all 0.3s ease;
}

/* حالة الكلمة: مخفية أثناء التسميع */
.quran-word.hidden-word {
    opacity: 0;
    transform: scale(0.8);
    visibility: hidden;
}

/* حالة الكلمة: صحيحة */
.quran-word.revealed {
    visibility: visible;
    background-color: rgba(82, 206, 229, 0.24) !important;
    color: #f8fbff;
    font-weight: bold;
    padding: 2px 4px;
    border-radius: 3px;
    animation: revealWord 0.6s ease-out forwards;
}

/* Animation for revealing words */
@keyframes revealWord {
    0% {
        opacity: 0;
        transform: scale(0.8) translateY(-5px);
    }
    50% {
        transform: scale(1.05) translateY(0);
    }
    100% {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

/* حالة الكلمة: خاطئة (أصفر) */
.quran-word.wrong {
    visibility: visible;
    background-color: rgba(217, 93, 114, 0.24) !important;
    color: #ffd7de;
    font-weight: bold;
    padding: 2px 4px;
    border-radius: 3px;
}

/* For backward compatibility - old correct class (will be replaced by revealed) */
.correct {
    background-color: rgba(82, 206, 229, 0.24) !important;
}
.aya-number {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    background: linear-gradient(135deg, #56bed8 0%, #d95d72 100%);
    color: #08111b;
    border-radius: 50%;
    font-size: 0.85rem;
    font-weight: bold;
    margin: 0 8px;
    box-shadow: 0 6px 18px rgba(0,0,0,0.28);
    border: 1px solid rgba(255,255,255,0.12);
    vertical-align: baseline;
    position: relative;
    top: -2px;
}
.page-footer {
    text-align: center;
    margin-top: 30px;
    padding: 15px;
    color: #dceaf6;
    font-size: 0.9rem;
    background: rgba(20, 27, 39, 0.88);
    border-radius: 12px;
    border: 1px solid rgba(82, 206, 229, 0.2);
    position: relative;
    z-index: 1;
}
.loading {
    text-align: center;
    padding: 50px;
    font-size: 1.4rem;
    color: #6ed5ea;
    position: relative;
    z-index: 1;
}
/* Sequence Error Styling (Skip Detection) - Visual Highlighting Only */
/* Highlight skipped ayas in yellow */
.quran-word.sequence-warning {
    background: linear-gradient(135deg, rgba(255, 206, 86, 0.28) 0%, rgba(255, 163, 38, 0.28) 100%);
    border-bottom: 2px solid #f1b84b;
    padding: 2px 4px;
    border-radius: 4px;
    animation: pulseWarning 2s ease-in-out infinite;
}

@keyframes pulseWarning {
    0%, 100% {
        background: linear-gradient(135deg, rgba(255, 206, 86, 0.28) 0%, rgba(255, 163, 38, 0.28) 100%);
    }
    50% {
        background: linear-gradient(135deg, rgba(255, 206, 86, 0.42) 0%, rgba(255, 163, 38, 0.42) 100%);
    }
}

@media (max-width: 768px) {
    .container {
        padding: 10px;
    }
    .controls {
        flex-direction: column;
        gap: 10px;
    }
    .control-group {
        width: 100%;
        justify-content: center;
    }
    .quran-text {
        font-size: 1.6rem;
        line-height: 2.5;
    }
    .mushaf-page {
        padding: 25px 30px;
    }
    .aya-number {
        width: 24px;
        height: 24px;
        font-size: 0.75rem;
    }
}
@media (max-width: 480px) {
    .quran-text {
        font-size: 1.4rem;
        line-height: 2.3;
    }
    .mushaf-page {
        padding: 20px 25px;
    }
}
