:root {
    --primary-color: #FF6B6B;
    --secondary-color: #4ECDC4;
    --tertiary-color: #FFD93D;
    --background-color: #F7FFF7;
    --text-main: #2C3E50;
    --white: #FFFFFF;
    --shadow: 0 8px 15px rgba(0,0,0,0.1);
    --correct-color: #8CE071;
    --wrong-color: #FF5E5E;
    --locked-color: #D3D3D3;
}

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

body {
    font-family: 'Fredoka', sans-serif;
    background-color: var(--background-color);
    color: var(--text-main);
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    overflow: hidden;
    background-image: radial-gradient(#4ECDC4 1px, transparent 1px);
    background-size: 20px 20px;
}

#app {
    width: 100%;
    max-width: 600px;
    height: 90vh;
    background: var(--white);
    border-radius: 30px;
    box-shadow: 0 20px 40px rgba(0,0,0,0.1);
    position: relative;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

/* Screens */
.screen {
    display: none;
    flex-direction: column;
    align-items: center;
    padding: 30px;
    height: 100%;
    animation: fadeIn 0.5s ease;
}

.screen.active {
    display: flex;
}

.scrollable {
    overflow-y: auto;
    justify-content: flex-start;
    padding-bottom: 50px;
}
.scrollable::-webkit-scrollbar {
    width: 8px;
}
.scrollable::-webkit-scrollbar-thumb {
    background-color: var(--secondary-color);
    border-radius: 4px;
}

.sticky-header {
    position: sticky;
    top: 0;
    background: var(--white);
    z-index: 10;
    width: 100%;
    padding-bottom: 10px;
    border-bottom: 2px dashed #eee;
    margin-bottom: 20px;
}

/* Animations */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes bounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-10px); }
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-10px); }
    50% { transform: translateX(10px); }
    75% { transform: translateX(-10px); }
}

@keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.05); }
    100% { transform: scale(1); }
}

.bounce { animation: bounce 2s infinite ease-in-out; }
.shake { animation: shake 0.5s; }

/* Typography */
h1.title {
    font-size: 2.5rem;
    color: var(--primary-color);
    text-align: center;
    margin-bottom: 10px;
    margin-top: 15px;
}

.subtitle {
    font-size: 1.2rem;
    color: var(--text-main);
    opacity: 0.8;
    margin-bottom: 20px;
}

.header {
    width: 100%;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.header h2 {
    font-size: 1.8rem;
    color: var(--secondary-color);
}

.special-badge {
    background: linear-gradient(135deg, var(--tertiary-color), var(--primary-color));
    color: white;
    padding: 10px 25px;
    border-radius: 20px;
    font-size: 1.2rem;
    font-weight: 600;
    margin-top: 20px;
    text-align: center;
    box-shadow: var(--shadow);
    animation: pulse 2s infinite;
}
.special-badge b {
    font-size: 1.3rem;
}

.score-display {
    font-size: 1.5rem;
    font-weight: bold;
    color: var(--tertiary-color);
    background: #FFF9E6;
    padding: 5px 15px;
    border-radius: 20px;
    box-shadow: var(--shadow);
}

/* Buttons */
.btn {
    font-family: 'Fredoka', sans-serif;
    font-size: 1.2rem;
    font-weight: 600;
    padding: 15px 30px;
    border: none;
    border-radius: 25px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: var(--shadow);
    margin: 10px 0;
    width: 80%;
    max-width: 300px;
    text-align: center;
}

.btn:hover {
    transform: translateY(-3px) scale(1.02);
    box-shadow: 0 10px 20px rgba(0,0,0,0.15);
}

.btn:active { transform: translateY(1px); }
.btn-primary { background-color: var(--primary-color); color: white; }
.btn-secondary { background-color: var(--secondary-color); color: white; }
.btn-tertiary { background-color: var(--tertiary-color); color: var(--text-main); }

.menu-buttons {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
    z-index: 2;
}

.btn-back {
    align-self: flex-start;
    background: none;
    border: none;
    font-size: 1.1rem;
    font-family: 'Fredoka', sans-serif;
    font-weight: 600;
    color: var(--text-main);
    cursor: pointer;
    margin-bottom: 10px;
    transition: transform 0.2s;
}

.btn-back:hover { transform: translateX(-5px); }

.btn-audio, .btn-audio-small {
    background-color: var(--tertiary-color);
    color: var(--text-main);
    border: none;
    border-radius: 20px;
    font-family: 'Fredoka', sans-serif;
    font-weight: bold;
    cursor: pointer;
    box-shadow: var(--shadow);
    transition: transform 0.2s;
}

.btn-audio { padding: 10px 20px; font-size: 1.1rem; margin-top: 15px; }
.btn-audio-small { padding: 8px 15px; font-size: 1rem; margin-bottom: 20px; }
.btn-audio:hover, .btn-audio-small:hover { transform: scale(1.05); }

/* Level Map */
.instruction {
    font-size: 1.1rem;
    color: #7f8c8d;
    margin-bottom: 20px;
    text-align: center;
}

.level-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 15px;
    width: 100%;
    padding: 10px;
}

.level-item {
    background: white;
    border: 3px solid var(--secondary-color);
    border-radius: 15px;
    aspect-ratio: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    box-shadow: var(--shadow);
    transition: transform 0.2s, box-shadow 0.2s;
}

.level-item:hover {
    transform: scale(1.05) translateY(-3px);
    box-shadow: 0 10px 20px rgba(0,0,0,0.1);
}

.level-item .ar {
    font-family: 'Amiri', serif;
    font-size: 2.5rem;
    color: var(--primary-color);
    line-height: 1;
}

.level-item .la {
    font-size: 1rem;
    font-weight: bold;
}

.level-item.locked {
    background: #f5f5f5;
    border-color: var(--locked-color);
    cursor: not-allowed;
    box-shadow: none;
}

.level-item.locked:hover {
    transform: none;
}

.level-item.locked .ar {
    color: #999;
    font-size: 1.5rem; /* Lock emoji */
    font-family: 'Fredoka', sans-serif;
}

/* Lesson Screen */
.lesson-header {
    display: flex;
    flex-direction: column;
    align-items: center;
    background: linear-gradient(135deg, #f0fdfc, #fff);
    width: 100%;
    border-radius: 20px;
    padding: 20px;
    box-shadow: var(--shadow);
    border: 2px solid var(--secondary-color);
    margin-bottom: 20px;
}

.arabic-letter.huge {
    font-family: 'Amiri', serif;
    font-size: 6rem;
    line-height: 1;
    color: var(--primary-color);
    margin-bottom: 5px;
}

.lesson-section {
    width: 100%;
    background: #fff;
    border-radius: 20px;
    padding: 20px;
    box-shadow: var(--shadow);
    margin-bottom: 20px;
}

.lesson-section h3 {
    color: var(--secondary-color);
    margin-bottom: 10px;
    font-size: 1.3rem;
}

.lesson-desc {
    font-size: 1rem;
    color: #7f8c8d;
    margin-bottom: 15px;
}

.shapes-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
}

.shape-card, .vowel-card {
    background: #f8f9fa;
    border: 2px solid #e9ecef;
    border-radius: 15px;
    padding: 15px 10px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s;
}

.vowel-card {
    cursor: pointer;
    border-color: var(--tertiary-color);
}
.vowel-card:hover {
    transform: scale(1.05);
    background: #FFF9E6;
}

.shape-char {
    font-family: 'Amiri', serif;
    font-size: 2.5rem;
    color: var(--primary-color);
    margin-bottom: 5px;
}

.shape-label, .vowel-name {
    font-size: 0.9rem;
    font-weight: bold;
    color: var(--text-main);
}

.vowel-name {
    color: #7f8c8d;
    font-weight: normal;
    font-size: 0.8rem;
}

.vowels-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
}


/* Common UI Elements */
.progress-bar-container {
    width: 100%;
    height: 15px;
    background-color: #eee;
    border-radius: 10px;
    margin-top: 20px;
    overflow: hidden;
}

.progress-bar {
    height: 100%;
    background-color: var(--secondary-color);
    width: 0%;
    transition: width 0.3s ease;
}

.quiz-container {
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    flex-grow: 1;
}

.quiz-question {
    font-size: 3rem;
    font-weight: bold;
    color: var(--primary-color);
    margin-bottom: 10px;
    text-align: center;
    background: #fff0f0;
    padding: 20px 40px;
    border-radius: 20px;
    box-shadow: var(--shadow);
    font-family: 'Amiri', serif;
}

.options-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
    width: 100%;
    margin-top: auto;
    margin-bottom: auto;
}

.option-btn {
    background: white;
    border: 3px solid #e0e0e0;
    border-radius: 20px;
    padding: 20px;
    font-family: 'Amiri', serif;
    font-size: 3rem;
    cursor: pointer;
    transition: all 0.2s;
    box-shadow: var(--shadow);
    color: var(--text-main);
    display: flex;
    justify-content: center;
    align-items: center;
    text-align: center;
    min-height: 100px;
}

.option-btn:hover { transform: scale(1.05); border-color: var(--secondary-color); }
.option-btn.correct { background-color: var(--correct-color); color: white; border-color: var(--correct-color); animation: pulse 0.5s; }
.option-btn.wrong { background-color: var(--wrong-color); color: white; border-color: var(--wrong-color); }

/* Explore UI */
.explore-container {
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    flex-grow: 1;
}

.arabic-letter.large { font-size: 6rem; margin-bottom: 0; font-family: 'Amiri', serif; color: var(--primary-color); }

.explore-options {
    display: flex;
    justify-content: center;
    gap: 20px;
    width: 100%;
    flex-wrap: wrap;
}

.explore-item {
    font-size: 3rem;
    background: white;
    border: 3px solid #e0e0e0;
    border-radius: 20px;
    padding: 20px;
    cursor: pointer;
    transition: all 0.2s;
    box-shadow: var(--shadow);
}
.explore-item:hover { transform: scale(1.1); }
.explore-item.correct { background-color: var(--correct-color); border-color: var(--correct-color); animation: bounce 1s; }
.explore-item.wrong { background-color: var(--wrong-color); border-color: var(--wrong-color); opacity: 0.5; }

/* Background floating shapes */
.floating-shapes { position: absolute; width: 100%; height: 100%; top: 0; left: 0; pointer-events: none; z-index: 1; }
.shape { position: absolute; font-family: 'Amiri', serif; font-size: 4rem; color: rgba(78, 205, 196, 0.2); animation: float 10s infinite linear; }
.shape-1 { top: 10%; left: 10%; animation-delay: 0s; }
.shape-2 { top: 70%; left: 80%; animation-delay: -3s; }
.shape-3 { top: 40%; left: 85%; color: rgba(255, 107, 107, 0.2); animation-delay: -6s; }
@keyframes float { 0% { transform: translateY(0) rotate(0deg); } 50% { transform: translateY(-20px) rotate(180deg); } 100% { transform: translateY(0) rotate(360deg); } }

.final-score { font-size: 2rem; margin: 20px 0; font-weight: bold; color: var(--secondary-color); }
.mt-20 { margin-top: 20px; }

/* Footer */
.footer-credits {
    margin-top: auto;
    margin-bottom: -15px;
    text-align: center;
    font-size: 0.9rem;
    color: #95a5a6;
    z-index: 10;
    line-height: 1.5;
}
.footer-credits strong {
    color: var(--secondary-color);
    font-size: 1rem;
}
