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

:root {
    --bg-blue: #1565C0;
    --asphalt-dark: #222222;
    --asphalt-light: #333333;
    --accent-gold: #FFCA28;
    --accent-gold-dark: #FFB300;
    --glass-blue: #81D4FA;
    --text-white: #ffffff;
    --text-dark: #222222;
}

body {
    font-family: 'Baloo Bhaijaan 2', cursive;
    background: var(--bg-blue);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    color: var(--text-white);
    overflow-x: hidden;
    padding: 2rem 1rem;
    position: relative;
}

/* مضمار السباق الخلفي */
.racing-bg {
    position: fixed;
    bottom: 0; left: 0; width: 100%; height: 25%;
    z-index: -2;
    background: var(--asphalt-light);
    border-top: 15px solid var(--accent-gold);
    display: flex;
    align-items: center;
    justify-content: space-around;
    box-shadow: inset 0 20px 20px rgba(0,0,0,0.5);
}

.track-line {
    width: 150px;
    height: 15px;
    background: var(--text-white);
    border-radius: 10px;
    opacity: 0.9;
}

.pointing-hand-container {
    display: flex;
    justify-content: center;
    margin-bottom: 5px;
}
.pointing-hand {
    font-size: 3.5rem;
    animation: pointDown 0.8s infinite alternate;
}
@keyframes pointDown {
    from { transform: translateY(-10px); }
    to { transform: translateY(10px); }
}

.racer-avatar {
    display: flex;
    justify-content: center;
    margin-bottom: 20px;
    cursor: pointer;
    z-index: 10;
    transition: transform 0.3s;
}
.racer-avatar:hover {
    transform: scale(1.1);
}

.avatar-ring {
    width: 150px;
    height: 150px;
    background: var(--text-white);
    border: 8px solid var(--accent-gold);
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    box-shadow: 0 10px 20px rgba(0,0,0,0.5);
    animation: goldGlow 2s infinite alternate;
    overflow: hidden;
}

@keyframes goldGlow {
    from { box-shadow: 0 0 10px var(--accent-gold); }
    to { box-shadow: 0 0 30px var(--accent-gold-dark); }
}

.container {
    width: 100%;
    max-width: 900px;
    text-align: center;
    transition: all 0.4s ease;
    z-index: 10;
    position: relative;
    margin: auto;
}

.text-with-audio {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 15px;
    margin-bottom: 1rem;
}

.subtitle-audio {
    margin-bottom: 2.5rem;
}

.title {
    font-size: 3.5rem;
    color: var(--accent-gold);
    font-weight: 800;
    text-shadow: 3px 3px 6px rgba(0,0,0,0.6);
    margin: 0;
}

.subtitle {
    font-size: 2.8rem;
    color: var(--text-white);
    font-weight: 700;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.5);
    margin: 0;
}

/* أزرار السماعة */
.speak-btn {
    background: rgba(0,0,0,0.3);
    color: var(--glass-blue);
    border: none;
    border-radius: 50%;
    width: 50px;
    height: 50px;
    font-size: 1.5rem;
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    padding: 0;
}

.speak-btn:hover {
    transform: scale(1.15);
    background: var(--accent-gold);
    color: var(--text-dark);
}

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

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

.input-audio-wrapper {
    position: relative;
    width: 80%;
    max-width: 500px;
}

input {
    width: 100%;
    padding: 20px 60px 20px 25px;
    font-size: 1.8rem;
    border: 6px solid var(--asphalt-light);
    border-radius: 50px;
    outline: none;
    background: var(--text-white);
    color: var(--text-dark);
    transition: all 0.3s;
    font-family: 'Baloo Bhaijaan 2', cursive;
    text-align: center;
    font-weight: 800;
    box-shadow: 0 10px 20px rgba(0,0,0,0.3);
}

input:focus {
    border-color: var(--accent-gold);
    box-shadow: 0 0 20px var(--accent-gold);
    transform: scale(1.05);
}

.input-speak {
    position: absolute;
    left: 15px; 
    top: 50%;
    transform: translateY(-50%);
    width: 45px;
    height: 45px;
    background: var(--asphalt-light);
}

.input-speak:hover {
    transform: translateY(-50%) scale(1.15);
}

.racing-btn {
    background: var(--asphalt-light);
    color: var(--text-white);
    border: none;
    padding: 15px 40px;
    border-radius: 50px;
    font-size: 2rem;
    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;
    border: 6px solid var(--accent-gold);
    box-shadow: 0 10px 25px rgba(0,0,0,0.5);
    display: inline-flex;
    justify-content: center;
    align-items: center;
}

.magic-btn-content {
    display: flex;
    align-items: center;
    gap: 15px;
}

.btn-speak {
    width: 40px;
    height: 40px;
    font-size: 1.2rem;
    background: rgba(255,255,255,0.2);
    border: none;
    color: var(--text-white);
}

.racing-btn:hover {
    transform: scale(1.15) translateY(-5px);
    box-shadow: 0 15px 35px rgba(0,0,0,0.6), 0 0 20px var(--accent-gold);
    background: var(--asphalt-dark);
}

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

.error-message {
    color: #FF3D00;
    font-weight: 800;
    font-size: 1.5rem;
    min-height: 40px;
    opacity: 0;
    transition: opacity 0.3s;
    background: rgba(255,255,255,0.9);
    padding: 10px 20px;
    border-radius: 15px;
    margin-top: 15px;
    display: inline-flex;
    align-items: center;
    gap: 10px;
    border: 2px dashed #FF3D00;
}

.error-message.show {
    opacity: 1;
}

.hidden {
    display: none !important;
}

.cards-container {
    display: flex;
    justify-content: center;
    gap: 30px;
    margin-top: 2rem;
    flex-wrap: wrap;
}

/* بطاقات المواد - على شكل أزرار سباق */
.racing-card {
    text-decoration: none;
    background: var(--asphalt-light);
    border-radius: 50px;
    width: 380px;
    padding: 15px 25px;
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: center;
    box-shadow: 0 10px 20px rgba(0,0,0,0.5);
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    border: 6px solid var(--accent-gold);
    position: relative;
}

.racing-card .glass {
    width: 100%;
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    gap: 15px;
    color: var(--text-white);
}

.racing-card:hover {
    transform: scale(1.15);
    box-shadow: 0 15px 30px rgba(0,0,0,0.6), 0 0 25px var(--accent-gold);
    background: var(--asphalt-dark);
}

.card-icons-left {
    display: flex;
    gap: 10px;
}

.icon {
    font-size: 2.5rem;
    text-shadow: 0 5px 10px rgba(0,0,0,0.4);
    transition: transform 0.3s;
}

.racing-card:hover .icon {
    transform: scale(1.2) rotate(10deg);
}

.racing-card h3 {
    font-size: 2.2rem;
    font-weight: 800;
    margin: 0;
    color: var(--text-white);
}

.card-speak {
    width: 50px;
    height: 50px;
    font-size: 1.5rem;
    background: rgba(255,255,255,0.2);
    color: var(--text-white);
    border: none;
}

.card-speak:hover {
    background: var(--accent-gold);
    color: var(--text-dark);
}

/* التجاوب مع الشاشات */
@media screen and (max-width: 768px) {
    .racer-avatar {
        margin-bottom: 15px;
    }
    .avatar-ring {
        width: 100px;
        height: 100px;
        border-width: 5px;
    }
    .title { font-size: 2.5rem; }
    .subtitle { font-size: 1.8rem; }
    input {
        font-size: 1.4rem;
        padding: 15px 50px 15px 15px;
    }
    .racing-btn {
        padding: 10px 30px;
        font-size: 1.5rem;
    }
    .cards-container {
        gap: 15px;
        flex-direction: column;
        align-items: center;
    }
    .racing-card {
        width: 100%;
        max-width: 350px;
    }
}
