@import url('https://fonts.googleapis.com/css2?family=Tajawal:wght@400;500;700;800&display=swap');

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: 'Tajawal', sans-serif;
    background: #f4f7ff;
    color: #1f2937;
    transition: 0.3s;
}

.container {
    width: 92%;
    max-width: 1150px;
    margin: auto;
}

.main-header {
    background: linear-gradient(135deg, #6c63ff, #00c2ff);
    color: white;
    padding: 22px 0;
    border-bottom-left-radius: 35px;
    border-bottom-right-radius: 35px;
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.main-header h1 {
    margin: 0;
    font-size: 32px;
}

.main-header p {
    margin: 5px 0 0;
}

.dark-btn {
    background: white;
    border: none;
    border-radius: 50%;
    width: 48px;
    height: 48px;
    font-size: 22px;
    cursor: pointer;
}

.hero {
    text-align: center;
    padding: 45px 0 25px;
}

.hero h2 {
    font-size: 34px;
    margin-bottom: 10px;
}

.hero p {
    font-size: 20px;
    color: #555;
}

.categories {
    margin-bottom: 30px;
}

.cat-list {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    justify-content: center;
}

.cat-list a {
    text-decoration: none;
    background: white;
    color: #6c63ff;
    padding: 11px 20px;
    border-radius: 50px;
    font-weight: 700;
    box-shadow: 0 6px 16px rgba(0,0,0,0.08);
}

.grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 25px;
    padding-bottom: 40px;
}

.card {
    background: white;
    border-radius: 24px;
    overflow: hidden;
    box-shadow: 0 10px 30px rgba(0,0,0,0.08);
    transition: 0.3s;
}

.card:hover {
    transform: translateY(-6px);
}

.card img {
    width: 100%;
    height: 190px;
    object-fit: cover;
}

.placeholder {
    height: 190px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 70px;
    background: #eef2ff;
}

.card-body {
    padding: 20px;
}

.badge {
    background: #fff3cd;
    color: #946200;
    padding: 6px 12px;
    border-radius: 30px;
    font-size: 14px;
    font-weight: 700;
}

.level {
    background: #d1fae5;
    color: #047857;
    padding: 6px 12px;
    border-radius: 30px;
    font-size: 14px;
    font-weight: 700;
    margin-right: 5px;
}

.card h3 {
    font-size: 23px;
    margin: 17px 0 8px;
}

.card p {
    color: #666;
    line-height: 1.8;
}

.read-btn {
    display: inline-block;
    text-decoration: none;
    background: linear-gradient(135deg, #6c63ff, #00c2ff);
    color: white;
    padding: 12px 22px;
    border-radius: 50px;
    font-weight: 700;
    margin-top: 10px;
}

.empty {
    grid-column: 1 / -1;
    background: white;
    padding: 40px;
    text-align: center;
    border-radius: 25px;
    font-size: 22px;
}

.story-page {
    padding: 35px 0;
}

.back-btn {
    display: inline-block;
    margin-bottom: 20px;
    text-decoration: none;
    color: #6c63ff;
    font-weight: 700;
}

.story-box {
    background: white;
    border-radius: 28px;
    padding: 30px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.08);
}

.story-img {
    width: 100%;
    max-height: 360px;
    object-fit: cover;
    border-radius: 24px;
    margin-bottom: 20px;
}

.story-box h2 {
    font-size: 34px;
    margin-bottom: 20px;
}

.audio-box {
    background: #eef2ff;
    padding: 18px;
    border-radius: 20px;
    margin: 20px 0;
}

.audio-box audio {
    width: 100%;
}

.no-audio {
    color: #b91c1c;
}

.font-controls {
    margin: 20px 0;
}

.font-controls button {
    border: none;
    background: #6c63ff;
    color: white;
    padding: 10px 18px;
    border-radius: 12px;
    font-size: 18px;
    cursor: pointer;
}

.story-text {
    font-size: 22px;
    line-height: 2.2;
    background: #fafafa;
    padding: 25px;
    border-radius: 20px;
}

footer {
    text-align: center;
    padding: 25px;
    color: #777;
}

body.dark {
    background: #0f172a;
    color: #f8fafc;
}

body.dark .card,
body.dark .story-box,
body.dark .cat-list a,
body.dark .empty {
    background: #1e293b;
    color: #f8fafc;
}

body.dark .hero p,
body.dark .card p {
    color: #cbd5e1;
}

body.dark .story-text {
    background: #111827;
    color: #f8fafc;
}

body.dark .audio-box {
    background: #111827;
}

body.dark footer {
    color: #cbd5e1;
}

@media (max-width: 900px) {
    .grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .hero h2 {
        font-size: 28px;
    }
}

@media (max-width: 600px) {
    .grid {
        grid-template-columns: 1fr;
    }

    .header-content {
        align-items: flex-start;
    }

    .main-header h1 {
        font-size: 26px;
    }

    .hero h2 {
        font-size: 24px;
    }

    .story-box {
        padding: 20px;
    }

    .story-box h2 {
        font-size: 27px;
    }

    .story-text {
        font-size: 20px;
    }
}
.story-slider {
    position: relative;
    width: 100%;
    height: 380px;
    border-radius: 24px;
    overflow: hidden;
    margin-bottom: 20px;
    background: #eef2ff;
}

.slide-img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    opacity: 0;
    transition: opacity 0.8s ease-in-out;
}

.slide-img.active {
    opacity: 1;
}

.slider-btn {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(0,0,0,0.45);
    color: white;
    border: none;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    font-size: 32px;
    cursor: pointer;
    z-index: 5;
}

.slider-btn.prev {
    right: 15px;
}

.slider-btn.next {
    left: 15px;
}

@media (max-width: 600px) {
    .story-slider {
        height: 250px;
    }
}