* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    /* Palestine Flag Colors 🇵🇸 */
    --navy: #0a0a0a;
    --dark-purple: #111111;
    --teal: #009736;
    /* Palestine Green */
    --purple: #ce1126;
    /* Palestine Red */
    --green: #009736;
    --red: #ce1126;
    --glass-bg: rgba(255, 255, 255, 0.05);
    --glass-border: rgba(255, 255, 255, 0.15);
    --text-primary: #ffffff;
    --text-secondary: #e0e0e0;
}

body {
    font-family: 'Inter', sans-serif;
    background: linear-gradient(135deg, var(--navy) 0%, var(--dark-purple) 100%);
    color: var(--text-primary);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
    position: relative;
}

body::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image:
        radial-gradient(circle at 20% 50%, rgba(168, 85, 247, 0.15) 0%, transparent 50%),
        radial-gradient(circle at 80% 80%, rgba(20, 184, 166, 0.15) 0%, transparent 50%);
    opacity: 0.6;
    z-index: 0;
}

body::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 800px;
    height: 800px;
    background-image: url("data:image/svg+xml,%3Csvg width='200' height='200' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M100 10 L105 40 L135 35 L115 60 L135 85 L105 80 L100 110 L95 80 L65 85 L85 60 L65 35 L95 40 Z' fill='none' stroke='rgba(255,255,255,0.02)' stroke-width='1'/%3E%3C/svg%3E");
    opacity: 0.3;
    z-index: 0;
}

.container {
    max-width: 600px;
    width: 100%;
    position: relative;
    z-index: 1;
}

.icon-container {
    text-align: center;
    margin-bottom: 40px;
    animation: fadeInDown 0.8s ease-out;
}

.bismillah-text {
    font-family: 'Amiri', serif;
    font-size: 32px;
    font-weight: 700;
    line-height: 2.2;
    background: linear-gradient(135deg, #00c853, #ffffff, #ff1744);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    filter: drop-shadow(0 0 20px rgba(0, 200, 83, 0.6));
    animation: float 3s ease-in-out infinite;
    text-shadow: 0 0 30px rgba(0, 151, 54, 0.5);
}

@keyframes float {

    0%,
    100% {
        transform: translateY(0);
    }

    50% {
        transform: translateY(-10px);
    }
}

@keyframes fadeInDown {
    from {
        opacity: 0;
        transform: translateY(-30px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.stats-container {
    display: flex;
    gap: 16px;
    margin-top: 30px;
    animation: fadeInUp 0.8s ease-out 0.1s both;
}

.stat-item {
    flex: 1;
    background: var(--glass-bg);
    backdrop-filter: blur(20px);
    border: 1px solid var(--glass-border);
    border-radius: 16px;
    padding: 20px;
    text-align: center;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
}

.stat-label {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 8px;
}

.stat-value {
    font-size: 32px;
    font-weight: 700;
    background: linear-gradient(135deg, #00c853, #4caf50);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    text-shadow: 0 0 20px rgba(0, 200, 83, 0.5);
    transition: transform 0.2s ease;
}


.audio-section {
    background: var(--glass-bg);
    backdrop-filter: blur(20px);
    border: 1px solid var(--glass-border);
    border-radius: 24px;
    padding: 40px;
    margin-bottom: 30px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    animation: fadeInUp 0.8s ease-out 0.2s both;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.audio-player {
    display: flex;
    align-items: center;
    gap: 20px;
    margin-bottom: 20px;
}

.play-btn {
    width: 70px;
    height: 70px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--teal), var(--purple));
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    box-shadow: 0 4px 20px rgba(20, 184, 166, 0.4);
    flex-shrink: 0;
}

.play-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 6px 30px rgba(20, 184, 166, 0.6);
}

.play-btn:active {
    transform: scale(0.95);
}

.play-btn svg {
    width: 28px;
    height: 28px;
    color: white;
}

.hidden {
    display: none !important;
}

.waveform {
    display: flex;
    align-items: center;
    gap: 4px;
    flex: 1;
    height: 60px;
}

.wave-bar {
    flex: 1;
    background: linear-gradient(135deg, var(--teal), var(--purple));
    border-radius: 4px;
    height: 20px;
    opacity: 0.3;
    transition: all 0.3s ease;
}

.waveform.playing .wave-bar {
    animation: wave 1s ease-in-out infinite;
}

.waveform.playing .wave-bar:nth-child(1) {
    animation-delay: 0s;
}

.waveform.playing .wave-bar:nth-child(2) {
    animation-delay: 0.1s;
}

.waveform.playing .wave-bar:nth-child(3) {
    animation-delay: 0.2s;
}

.waveform.playing .wave-bar:nth-child(4) {
    animation-delay: 0.3s;
}

.waveform.playing .wave-bar:nth-child(5) {
    animation-delay: 0.4s;
}

.waveform.playing .wave-bar:nth-child(6) {
    animation-delay: 0.3s;
}

.waveform.playing .wave-bar:nth-child(7) {
    animation-delay: 0.2s;
}

.waveform.playing .wave-bar:nth-child(8) {
    animation-delay: 0.1s;
}

.waveform.playing .wave-bar:nth-child(9) {
    animation-delay: 0.2s;
}

.waveform.playing .wave-bar:nth-child(10) {
    animation-delay: 0.3s;
}

@keyframes wave {

    0%,
    100% {
        height: 20px;
        opacity: 0.3;
    }

    50% {
        height: 60px;
        opacity: 1;
    }
}

.progress-container {
    width: 100%;
    height: 4px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 2px;
    overflow: hidden;
    margin-bottom: 20px;
}

.progress-bar {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, var(--teal), var(--purple));
    transition: width 0.1s linear;
}

.audio-label {
    text-align: center;
    font-family: 'Amiri', serif;
    font-size: 24px;
    font-weight: 700;
    line-height: 2.2;
    color: var(--text-primary);
    word-spacing: 4px;
    letter-spacing: 0.5px;
}

.quiz-section {
    animation: fadeInUp 0.8s ease-out;
}

.surah-reference {
    text-align: center;
    font-family: 'Inter', sans-serif;
    font-size: 14px;
    font-weight: 600;
    line-height: 2.0;
    color: var(--teal);
    background: var(--glass-bg);
    backdrop-filter: blur(20px);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    padding: 12px 20px;
    margin-bottom: 16px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
    letter-spacing: 0.5px;
    word-spacing: 2px;
}

.ayah-text {
    font-family: 'Amiri', serif;
    font-size: 28px;
    line-height: 2.4;
    text-align: center;
    direction: rtl;
    background: var(--glass-bg);
    backdrop-filter: blur(20px);
    border: 1px solid var(--glass-border);
    border-radius: 24px;
    padding: 30px;
    margin-bottom: 20px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    word-spacing: 6px;
    letter-spacing: 1px;
}

.word-blank {
    display: inline-block;
    min-width: 80px;
    height: 2px;
    background: linear-gradient(90deg, var(--teal), var(--purple));
    margin: 0 8px;
    position: relative;
    animation: glow 2s ease-in-out infinite;
    vertical-align: middle;
}

@keyframes glow {

    0%,
    100% {
        box-shadow: 0 0 5px var(--teal), 0 0 10px var(--teal);
    }

    50% {
        box-shadow: 0 0 10px var(--purple), 0 0 20px var(--purple);
    }
}

.word-blank.filled {
    background: none;
    height: auto;
    color: var(--green);
    animation: none;
    font-weight: 700;
    text-shadow: 0 0 10px rgba(16, 185, 129, 0.5);
}

.translation {
    background: linear-gradient(135deg, rgba(0, 151, 54, 0.1), rgba(0, 0, 0, 0.3));
    backdrop-filter: blur(20px);
    border: 1px solid rgba(0, 151, 54, 0.3);
    border-radius: 20px;
    padding: 24px;
    margin-bottom: 15px;
    color: #90ee90;
    line-height: 1.6;
    text-align: center;
    box-shadow: 0 8px 32px rgba(0, 151, 54, 0.2);
    font-size: 15px;
}

.translation::first-letter {
    color: #00ff88;
    font-weight: 700;
}

.malay-translation {
    background: linear-gradient(135deg, rgba(206, 17, 38, 0.1), rgba(0, 0, 0, 0.3));
    border: 1px solid rgba(206, 17, 38, 0.3);
    color: #ffb3b3;
    box-shadow: 0 8px 32px rgba(206, 17, 38, 0.2);
}

.malay-translation::first-letter {
    color: #ff6b6b;
    font-weight: 700;
}

.translation-label {
    display: inline-block;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    padding: 4px 12px;
    border-radius: 20px;
    margin-right: 12px;
    background: rgba(255, 255, 255, 0.15);
    color: #ffffff;
    vertical-align: middle;
}

.translation .translation-label {
    background: linear-gradient(135deg, #009736, #00c853);
    box-shadow: 0 2px 8px rgba(0, 151, 54, 0.4);
}

.malay-translation .translation-label {
    background: linear-gradient(135deg, #ce1126, #ff4444);
    box-shadow: 0 2px 8px rgba(206, 17, 38, 0.4);
}

.translation-text {
    display: inline;
}

.tts-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border: none;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.15);
    color: #ffffff;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-left: 12px;
    vertical-align: middle;
}

.tts-btn:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: scale(1.1);
}

.tts-btn:active {
    transform: scale(0.95);
}

.tts-btn svg {
    width: 20px;
    height: 20px;
}

.translation .tts-btn:hover {
    background: linear-gradient(135deg, #009736, #00c853);
    box-shadow: 0 0 15px rgba(0, 151, 54, 0.5);
}

.malay-translation .tts-btn:hover {
    background: linear-gradient(135deg, #ce1126, #ff4444);
    box-shadow: 0 0 15px rgba(206, 17, 38, 0.5);
}

.options-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
    margin-bottom: 20px;
}

.option-btn {
    font-family: 'Amiri', serif;
    font-size: 20px;
    line-height: 2.2;
    padding: 20px;
    background: var(--glass-bg);
    backdrop-filter: blur(20px);
    border: 2px solid var(--glass-border);
    border-radius: 16px;
    color: var(--text-primary);
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
    direction: rtl;
    word-spacing: 4px;
    letter-spacing: 0.5px;
}

.option-btn:hover:not(.correct):not(.wrong) {
    background: rgba(255, 255, 255, 0.1);
    border-color: var(--teal);
    transform: translateY(-2px);
    box-shadow: 0 6px 24px rgba(20, 184, 166, 0.3);
}

.option-btn.correct {
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.2), rgba(16, 185, 129, 0.1));
    border-color: var(--green);
    box-shadow: 0 0 20px rgba(16, 185, 129, 0.4);
    animation: celebrate 0.6s ease-out;
}

.option-btn.wrong {
    background: linear-gradient(135deg, rgba(239, 68, 68, 0.2), rgba(239, 68, 68, 0.1));
    border-color: var(--red);
    animation: shake 0.4s ease-out;
}

/* Translation quiz option buttons (English text) */
.option-btn.translation-option {
    font-family: 'Inter', sans-serif;
    font-size: 14px;
    direction: ltr;
    text-align: left;
    line-height: 1.5;
    padding: 16px 20px;
    grid-column: 1 / -1;
}

@keyframes celebrate {

    0%,
    100% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.05);
    }
}

@keyframes shake {

    0%,
    100% {
        transform: translateX(0);
    }

    25% {
        transform: translateX(-10px);
    }

    75% {
        transform: translateX(10px);
    }
}

.feedback {
    text-align: center;
    padding: 16px;
    border-radius: 12px;
    margin-bottom: 20px;
    font-weight: 600;
    animation: fadeInUp 0.4s ease-out;
}

.feedback.success {
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.2), rgba(16, 185, 129, 0.1));
    border: 1px solid var(--green);
    color: var(--green);
}

.feedback.error {
    background: linear-gradient(135deg, rgba(239, 68, 68, 0.2), rgba(239, 68, 68, 0.1));
    border: 1px solid var(--red);
    color: var(--red);
}

.nav-buttons {
    display: flex;
    gap: 16px;
    animation: fadeInUp 0.8s ease-out 0.4s both;
}

.btn {
    flex: 1;
    padding: 16px 24px;
    border: none;
    border-radius: 12px;
    font-family: 'Inter', sans-serif;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.btn svg {
    width: 20px;
    height: 20px;
}

.btn-secondary {
    background: var(--glass-bg);
    backdrop-filter: blur(20px);
    border: 2px solid var(--glass-border);
    color: var(--text-primary);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: var(--teal);
    transform: translateY(-2px);
    box-shadow: 0 6px 24px rgba(20, 184, 166, 0.3);
}

.btn-primary {
    background: linear-gradient(135deg, var(--teal), var(--purple));
    color: white;
    box-shadow: 0 4px 20px rgba(20, 184, 166, 0.4);
}

.btn-primary:hover:not(.disabled) {
    transform: translateY(-2px);
    box-shadow: 0 6px 30px rgba(20, 184, 166, 0.6);
}

.btn-primary.disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn:active:not(.disabled) {
    transform: translateY(0);
}

.loading {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(10, 22, 40, 0.9);
    backdrop-filter: blur(10px);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 20px;
    z-index: 1000;
    font-size: 18px;
    color: var(--text-secondary);
}

.spinner {
    width: 50px;
    height: 50px;
    border: 4px solid var(--glass-border);
    border-top-color: var(--teal);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

@media (max-width: 640px) {
    .container {
        padding: 0 10px;
    }

    .audio-section {
        padding: 24px;
    }

    .ayah-text {
        font-size: 24px;
        padding: 20px;
    }

    .options-grid {
        grid-template-columns: 1fr;
    }

    .nav-buttons {
        flex-direction: column;
    }
}

/* Confetti celebration animation */
@keyframes confettiFall {
    0% {
        transform: translateY(0) rotate(0deg);
        opacity: 1;
    }

    100% {
        transform: translateY(100vh) rotate(720deg);
        opacity: 0;
    }
}

/* Milestone celebration styling */
.feedback.milestone {
    font-size: 20px;
    padding: 30px;
    box-shadow: 0 0 40px rgba(255, 215, 0, 0.5);
    border: 2px solid #ffd700;
    animation: pulse 0.5s ease-in-out infinite alternate;
}

@keyframes pulse {
    from {
        transform: scale(1);
        box-shadow: 0 0 40px rgba(255, 215, 0, 0.5);
    }

    to {
        transform: scale(1.02);
        box-shadow: 0 0 60px rgba(255, 215, 0, 0.8);
    }
}