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

:root {
    --bg-color: #0a192f;
    --bg-color-top: #0a192f;
    --bg-color-bottom: #112240;
    --primary: #0f172a;
    --primary-color: #0f172a;
    --primary-dark: #020617;
    --secondary: #1e293b;
    --secondary-dark: #0f172a;
    --accent: #38bdf8;
    --accent-dark: #0284c7;
    --success: #10b981;
    --rose: #ef4444;
    --text: #f8fafc;
    --text-color: #f8fafc;
    --text-light: #e2e8f0;
    --white: #ffffff;
    --shadow: 0 8px 30px rgba(0, 0, 0, 0.5);
    --shadow-soft: 0 10px 30px -10px rgba(0, 0, 0, 0.7);
    --border-dark: 2px solid rgba(255, 255, 255, 0.2);
    --car-red: #ef4444;
    --car-blue: #38bdf8;
    --car-green: #10b981;
    --car-purple: #8b5cf6;
    --card-bg: rgba(30, 41, 59, 0.85);
}

body {
    font-family: 'Baloo Bhaijaan 2', 'Tajawal', sans-serif;
    background: linear-gradient(135deg, #0b0f19, #001a33, #0f172a);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    color: var(--text);
    overflow-x: hidden;
    overflow-y: auto;
    position: relative;
    padding: 2rem 1rem;
    font-size: 20px;
    line-height: 1.6;
}

/* Racing Lights Overlay Effect */
.racing-lights-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    pointer-events: none;
    z-index: -1;
    background: radial-gradient(circle at 50% 10%, rgba(56, 189, 248, 0.15), transparent 70%);
}

/* خلفية التطبيق - عالم البطل المتسابق */
.enchanted-bg {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    z-index: -2;
    background: linear-gradient(135deg, #0b0f19, #001a33, #1e293b);
    transition: background 1s ease;
    overflow: hidden;
}

.magic-sparkle {
    position: absolute;
    color: #FFCA28;
    opacity: 0.6;
    font-size: 2.2rem;
    z-index: -1;
    animation: floatUp 8s infinite ease-in-out;
}

.bg-shell {
    position: absolute;
    font-size: 3rem;
    color: rgba(56, 189, 248, 0.4);
    z-index: -1;
    opacity: 0.4;
    animation: floatUp 12s infinite linear;
}

@keyframes floatUp {
    0% { transform: translateY(100vh) scale(0.6) rotate(0deg); opacity: 0; }
    20% { opacity: 0.7; }
    80% { opacity: 0.7; }
    100% { transform: translateY(-200px) scale(1.3) rotate(360deg); opacity: 0; }
}

.login-wrapper {
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%;
    min-height: 80vh;
}

.container {
    background: rgba(15, 23, 42, 0.85);
    border: 3px solid var(--accent);
    backdrop-filter: blur(12px);
    border-radius: 35px;
    padding: 3rem 2rem;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5), 0 0 20px rgba(56, 189, 248, 0.4);
    width: 95%;
    max-width: 920px;
    text-align: center;
    transition: all 0.4s ease;
    z-index: 10;
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
}

.login-section {
    width: 100%;
    max-width: 480px;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.subjects-section {
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.profile-avatar-container {
    margin-top: -85px;
    margin-bottom: 15px;
    width: 130px;
    height: 130px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--bg-color-top), var(--accent));
    border: 3px solid var(--accent);
    box-shadow: 0 5px 20px rgba(56, 189, 248, 0.6);
    overflow: hidden;
    display: flex;
    justify-content: center;
    align-items: center;
    animation: racerGlow 2.5s infinite alternate ease-in-out;
}

.captain-avatar {
    width: 100%;
    height: 100%;
}

.captain-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

@keyframes racerGlow {
    from { box-shadow: 0 5px 15px rgba(56, 189, 248, 0.4); transform: scale(1); }
    to { box-shadow: 0 10px 30px rgba(56, 189, 248, 0.9), 0 0 15px rgba(255, 235, 59, 0.5); transform: scale(1.05); }
}

/* Audio & Text wrappers */
.text-with-audio {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 15px;
    margin-bottom: 0.5rem;
}
.subtitle-audio {
    margin-bottom: 2rem;
}

.title {
    font-size: 2.6rem;
    color: #FFFFFF;
    font-weight: 900;
    text-shadow: 0 0 10px var(--accent), 0 0 20px var(--car-blue);
    letter-spacing: 1px;
    margin: 0;
}

.subtitle {
    font-size: 1.3rem;
    color: var(--accent);
    line-height: 1.6;
    font-weight: 700;
    margin: 0;
    text-shadow: 0 0 8px rgba(56, 189, 248, 0.4);
}

/* أزرار السماعة - نمط المتسابق المحترف */
.speak-btn {
    background: rgba(56, 189, 248, 0.2);
    color: var(--accent);
    border: 2px solid var(--accent);
    border-radius: 50%;
    width: 45px;
    height: 45px;
    font-size: 1.3rem;
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: all 0.3s;
    box-shadow: 0 0 10px rgba(56, 189, 248, 0.3);
    padding: 0;
}
.speak-btn:hover {
    transform: scale(1.1) rotate(5deg);
    background: var(--accent);
    color: #0f172a;
    box-shadow: 0 0 15px rgba(56, 189, 248, 0.8);
}

.input-group {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
    margin-bottom: 1.5rem;
    width: 100%;
}

.input-audio-wrapper {
    position: relative;
    width: 100%;
    max-width: 380px;
}

input {
    width: 100%;
    padding: 15px 20px 15px 60px;
    font-size: 1.5rem;
    border: 2px solid var(--accent);
    border-radius: 20px;
    outline: none;
    background: rgba(15, 23, 42, 0.9);
    color: #ffffff;
    transition: all 0.3s;
    font-family: 'Baloo Bhaijaan 2', cursive;
    text-align: center;
    font-weight: 800;
    box-shadow: inset 0 2px 8px rgba(0,0,0,0.5);
}
input::placeholder {
    color: rgba(226, 232, 240, 0.6);
}
input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 20px rgba(56, 189, 248, 0.7), inset 0 2px 5px rgba(0,0,0,0.2);
    transform: scale(1.02);
}

.input-speak {
    position: absolute;
    left: 10px;
    top: 50%;
    transform: translateY(-50%);
    width: 40px;
    height: 40px;
    font-size: 1.1rem;
    background: var(--accent);
    color: #0f172a;
    border: none;
}
.input-speak:hover {
    transform: translateY(-50%) scale(1.1);
    background: #ffffff;
    color: #0f172a;
}

/* زر تسجيل الدخول المتسابق */
.magic-btn {
    background: linear-gradient(135deg, #0f172a, #1e293b);
    color: var(--white);
    border: 2px solid var(--accent);
    width: 100%;
    height: 60px;
    border-radius: 25px;
    font-size: 1.7rem;
    font-weight: 800;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    font-family: 'Baloo Bhaijaan 2', cursive;
    box-shadow: 0 6px 15px rgba(56, 189, 248, 0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    white-space: nowrap;
    gap: 10px;
}
.magic-btn:hover {
    transform: translateY(-3px) scale(1.02);
    box-shadow: 0 10px 25px rgba(56, 189, 248, 0.8);
    background: linear-gradient(135deg, var(--accent), var(--accent-dark));
    color: #0f172a;
}
.magic-btn:active {
    transform: scale(0.96);
}

.error-message {
    color: #ef4444;
    font-weight: 800;
    font-size: 1.4rem;
    min-height: 40px;
    opacity: 0;
    transition: opacity 0.3s;
    background: rgba(15, 23, 42, 0.95);
    padding: 10px 20px;
    border-radius: 15px;
    margin-top: 15px;
    display: inline-flex;
    align-items: center;
    gap: 10px;
    border: 2px dashed #ef4444;
    box-shadow: 0 0 15px rgba(239, 68, 68, 0.4);
}
.error-message.show {
    opacity: 1;
}

.hidden {
    display: none !important;
}

.cards-container {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin-top: 1.5rem;
    flex-wrap: wrap;
    width: 100%;
}

/* بطاقات المواد - مضمار السباق */
.magical-card {
    text-decoration: none;
    background: linear-gradient(135deg, #1e293b, #0f172a);
    border: 3px solid var(--accent);
    border-radius: 25px;
    width: 180px;
    height: 195px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5), 0 0 15px rgba(56, 189, 248, 0.3);
    transition: all 0.3s ease;
    padding: 15px;
    animation: gentleFloat 3s infinite alternate ease-in-out;
}

.magical-card:nth-child(2) {
    animation-delay: 0.5s;
}
.magical-card:nth-child(3) {
    animation-delay: 1s;
}
.magical-card:nth-child(4) {
    animation-delay: 1.5s;
}

@keyframes gentleFloat {
    0% { transform: translateY(0); }
    100% { transform: translateY(-8px); }
}

.magical-card .glass {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    color: var(--text);
    transition: all 0.4s ease;
}

.magical-card:hover {
    border-color: #FFFFFF;
    box-shadow: 0 0 30px rgba(56, 189, 248, 0.8), 0 10px 30px rgba(0, 0, 0, 0.7);
    transform: scale(1.08) translateY(-5px);
}

.icon {
    font-size: 3.2rem;
    text-shadow: 0 0 10px rgba(56, 189, 248, 0.5);
    transition: transform 0.3s;
}
.magical-card:hover .icon {
    transform: scale(1.2) rotate(5deg);
}

.magical-card h3 {
    font-size: 1.5rem;
    font-weight: 800;
    margin: 0;
    color: #FFFFFF;
    text-shadow: 0 2px 5px rgba(0,0,0,0.6);
}

.card-speak {
    width: 35px;
    height: 35px;
    font-size: 1rem;
    background: rgba(56, 189, 248, 0.2);
    border: 1px solid var(--accent);
}
.card-speak:hover {
    background: var(--accent);
    color: #0f172a;
}

/* التجاوب مع مختلف الشاشات */
@media screen and (max-width: 768px) {
    .container {
        padding: 2rem 1.2rem;
        width: 95%;
        border-radius: 25px;
        margin-top: 40px;
    }
    .title { font-size: 2.1rem; }
    .subtitle { font-size: 1.1rem; }
    input {
        font-size: 1.3rem;
        padding: 12px 15px 12px 50px;
    }
    .magic-btn {
        height: 55px;
        font-size: 1.5rem;
        border-radius: 18px;
    }
    .cards-container {
        gap: 15px;
    }
    .magical-card {
        width: 145px;
        height: 160px;
    }
    .icon { font-size: 2.5rem; }
    .magical-card h3 { font-size: 1.3rem; }
}

@media screen and (max-width: 480px) {
    .title { font-size: 1.8rem; }
    .subtitle { font-size: 1rem; }
    .container {
        padding: 1.5rem 1rem;
        border-radius: 20px;
    }
    input {
        font-size: 1.1rem;
    }
    .speak-btn {
        width: 36px;
        height: 36px;
        font-size: 1.1rem;
    }
    .cards-container {
        gap: 12px;
    }
    .magical-card {
        width: 130px;
        height: 145px;
    }
    .magical-card h3 { font-size: 1.1rem; }
}
