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

        body {
            background: #fef7e8;
            font-family: 'Amiri', 'Tajawal', 'Segoe UI', 'Roboto', system-ui, sans-serif;
            color: #2d3e2b;
            padding: 1.5rem;
            line-height: 1.5;
        }

        /* calm, spacious container */
        .app-container {
            max-width: 1300px;
            margin: 0 auto;
            background: #fffef7;
            border-radius: 48px;
            box-shadow: 0 12px 28px rgba(0, 0, 0, 0.05);
            overflow: hidden;
            padding: 1.5rem 2rem 2.5rem;
            transition: all 0.2s ease;
        }

        /* header controls area */
        .controls-bar {
            display: flex;
            flex-wrap: wrap;
            justify-content: space-between;
            align-items: center;
            gap: 0.8rem;
            background: #f3efe3;
            padding: 1rem 1.2rem;
            border-radius: 60px;
            margin-bottom: 2rem;
        }

        .speed-group, .auto-group {
            display: flex;
            align-items: center;
            gap: 0.75rem;
            background: white;
            padding: 0.4rem 1rem;
            border-radius: 40px;
            box-shadow: 0 1px 4px rgba(0,0,0,0.05);
        }

        .speed-group span, .auto-group span {
            font-size: 1rem;
            font-weight: 500;
            color: #4a6741;
        }

        .speed-btn {
            background: #e9e3d3;
            border: none;
            font-size: 1.1rem;
            font-weight: bold;
            padding: 0.3rem 1rem;
            border-radius: 40px;
            cursor: pointer;
            font-family: inherit;
            transition: 0.1s linear;
            color: #2c5a2a;
        }

        .speed-btn.active {
            background: #b5d3a7;
            color: #1e3a1c;
            box-shadow: inset 0 1px 2px rgba(0,0,0,0.1);
        }

        .toggle-switch {
            background: #d9d0bc;
            width: 52px;
            height: 28px;
            border-radius: 30px;
            display: inline-block;
            position: relative;
            cursor: pointer;
            transition: 0.2s;
        }

        .toggle-switch::after {
            content: "";
            width: 24px;
            height: 24px;
            background: white;
            border-radius: 50%;
            position: absolute;
            top: 2px;
            right: 3px;
            transition: transform 0.2s;
        }

        .toggle-switch.active {
            background: #7aa86a;
        }

        .toggle-switch.active::after {
            transform: translateX(-22px);
        }

        /* main content */
        .main-view {
            min-height: 65vh;
        }

        /* headings */
        h1, h2 {
            font-weight: 600;
            letter-spacing: -0.3px;
            color: #3c5e34;
        }

        h1 {
            font-size: 2.2rem;
            margin-bottom: 1rem;
            text-align: center;
        }

        /* buttons primary */
        .btn-primary {
            background-color: #9bbc7b;
            border: none;
            padding: 0.9rem 2rem;
            font-size: 1.3rem;
            border-radius: 60px;
            color: white;
            font-weight: bold;
            cursor: pointer;
            transition: 0.1s linear;
            font-family: inherit;
            box-shadow: 0 2px 5px rgba(0,0,0,0.1);
        }

        .btn-primary:active {
            transform: scale(0.97);
            background-color: #7eaa5e;
        }

        /* alphabet grid */
        .letters-grid {
            display: grid;
            grid-template-columns: repeat(4, 1fr);
            gap: 1.5rem;
            margin: 2rem 0;
        }

        .letter-card {
            background: #fef7e0;
            border-radius: 32px;
            text-align: center;
            padding: 1.2rem 0.5rem;
            cursor: pointer;
            transition: all 0.15s ease;
            box-shadow: 0 6px 12px rgba(0,0,0,0.05);
            border: 2px solid #e6dbbc;
            display: flex;
            flex-direction: column;
            align-items: center;
            justify-content: center;
            gap: 0.8rem;
        }

        .letter-card span {
            font-size: 3rem;
            font-weight: 500;
            display: block;
        }

        .letter-card small {
            font-size: 0.9rem;
            color: #6e5e3e;
            margin: 0;
        }

        .letter-card.completed {
            border-color: #7aa86a;
            background: #eff7e8;
            box-shadow: 0 0 0 3px #cbe5bc;
        }

        .letter-card:hover {
            transform: translateY(-3px) scale(1.02);
            border-color: #92b979;
            box-shadow: 0 10px 16px rgba(0,0,0,0.12);
        }

        .audio-btn {
            background: #9bbc7b;
            border: none;
            border-radius: 40px;
            padding: 0.8rem 1.4rem;
            color: white;
            font-weight: 700;
            cursor: pointer;
            transition: transform 0.15s ease, background 0.15s ease;
            font-family: inherit;
            display: inline-flex;
            align-items: center;
            gap: 0.6rem;
            font-size: 1.1rem;
        }

        .audio-btn svg {
            width: 20px;
            height: 20px;
            stroke: white;
        }

        .audio-btn:hover,
        .audio-btn:focus {
            transform: translateY(-2px);
            background: #7aa86a;
            outline: none;
            box-shadow: 0 6px 12px rgba(122, 168, 106, 0.25);
        }

        .section-card {
            background: #f9f5e8;
            border: 2px solid #e7dfca;
            border-radius: 28px;
            padding: 1rem 1.2rem;
            text-align: center;
            cursor: pointer;
            transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
            box-shadow: 0 4px 8px rgba(0,0,0,0.06);
        }

        .section-card:hover,
        .section-card.active {
            transform: translateY(-3px);
            border-color: #9bbc7b;
            box-shadow: 0 8px 14px rgba(0,0,0,0.12);
            background: #f2f7eb;
        }

        .section-card h3 {
            margin: 0.2rem 0;
            font-size: 1.1rem;
            color: #3b5e36;
        }

        .section-card p {
            color: #6f6c4f;
            font-size: 0.95rem;
        }

        /* letter detail page */
        .letter-detail {
            text-align: center;
            max-width: 500px;
            margin: 0 auto;
        }

        .big-letter {
            font-size: 8rem;
            background: #f9f0df;
            border-radius: 70px;
            padding: 1rem;
            margin: 1rem 0;
            font-weight: 600;
        }

        .letter-name {
            font-size: 2rem;
            color: #5d7a4b;
            margin-bottom: 1.5rem;
        }

        .nav-buttons {
            display: flex;
            gap: 1rem;
            justify-content: center;
            margin: 1.5rem 0;
            flex-wrap: wrap;
        }

        .nav-btn {
            background: #e1d5bd;
            padding: 0.6rem 1.4rem;
            border-radius: 40px;
            font-size: 1.1rem;
            border: none;
            font-weight: bold;
            cursor: pointer;
            transition: all 0.15s ease;
            display: inline-flex;
            align-items: center;
            gap: 0.5rem;
        }

        .nav-btn:hover {
            background: #c9bfa6;
            transform: translateY(-2px);
        }

        /* syllable grid */
        .syllables-grid {
            display: grid;
            grid-template-columns: repeat(4, 1fr);
            gap: 1.8rem;
            margin-top: 2rem;
        }

        .syllables-grid.harakat {
            grid-template-columns: repeat(3, 1fr);
        }

        .syllable-card {
            background: #ffffff;
            border-radius: 32px;
            padding: 1.2rem 0.8rem;
            text-align: center;
            cursor: pointer;
            transition: all 0.15s ease;
            border: 2px solid #efe2ca;
            box-shadow: 0 5px 8px rgba(0,0,0,0.03);
            position: relative;
            display: flex;
            flex-direction: column;
            align-items: center;
            justify-content: center;
        }

        .syllable-card:hover {
            transform: translateY(-4px) scale(1.02);
            box-shadow: 0 10px 18px rgba(0,0,0,0.1);
            border-color: #9bbc7b;
        }

        .syllable-card.highlight {
            background: #f9efcf;
            border-color: #b5d3a7;
        }

        .syllable-text {
            font-size: 2.7rem;
            font-weight: 600;
            margin-bottom: 0.6rem;
            order: 1;
        }

        .breakdown {
            font-size: 1.1rem;
            font-weight: 700;
            color: #2c5a2a;
            background: #f0f7e8;
            display: block;
            padding: 0.5rem 1rem;
            border-radius: 40px;
            margin-bottom: 0.8rem;
            order: 2;
        }

        .syllable-card .audio-btn {
            order: 3;
        }

        .micro-btn {
            background: #e8e0cf;
            border: none;
            font-size: 1.2rem;
            padding: 0.3rem 0.8rem;
            border-radius: 40px;
            margin-top: 0.5rem;
            display: inline-flex;
            align-items: center;
            gap: 0.4rem;
            cursor: pointer;
            color: #4f6e3c;
        }

        .feedback-msg {
            font-size: 0.8rem;
            color: #9b9b6f;
            margin-top: 0.5rem;
            transition: 0.1s;
        }

        /* general spacing */
        .spacer {
            margin: 1rem 0;
        }

        button, .letter-card, .syllable-card, .toggle-switch {
            cursor: pointer;
        }

        button:focus-visible, .letter-card:focus-visible, .syllable-card:focus-visible {
            outline: 3px solid #6b8c4a;
            outline-offset: 3px;
        }

        @media (max-width: 1024px) {
            .syllables-grid {
                grid-template-columns: repeat(2, 1fr);
            }

            .syllables-grid.harakat {
                grid-template-columns: repeat(2, 1fr);
            }

            .letters-grid {
                grid-template-columns: repeat(2, 1fr);
            }
        }

        @media (max-width: 650px) {
            .app-container {
                padding: 1rem;
            }
            .syllables-grid,
            .syllables-grid.harakat,
            .letters-grid {
                grid-template-columns: 1fr;
            }
            .big-letter {
                font-size: 5rem;
            }
        }

        /* Responsive controls bar */
        @media (max-width: 768px) {
            .controls-bar {
                flex-direction: column;
                gap: 0.5rem;
                padding: 0.6rem 1rem;
            }
            .speed-group, .auto-group {
                width: 100%;
                justify-content: center;
                padding: 0.5rem 1rem;
            }
            .speed-group span, .auto-group span {
                font-size: 0.9rem;
            }
            .speed-btn {
                font-size: 1rem;
                padding: 0.3rem 0.8rem;
            }
        }

        @media (max-width: 480px) {
            .controls-bar {
                padding: 0.8rem 1rem;
                gap: 0.8rem;
                border-radius: 40px;
            }
            .speed-group, .auto-group {
                gap: 0.5rem;
                padding: 0.4rem 0.8rem;
                flex-wrap: wrap;
                justify-content: center;
                overflow-x: auto;
                -webkit-overflow-scrolling: touch;
                width: 100%;
            }
            .speed-group span, .auto-group span {
                font-size: 0.8rem;
            }
            .speed-btn {
                font-size: 0.9rem;
                padding: 0.25rem 0.45rem;
                min-width: 52px;
                flex: 1 1 auto;
                white-space: nowrap;
            }
            .speed-group::-webkit-scrollbar,
            .auto-group::-webkit-scrollbar {
                height: 6px;
            }
            .speed-group::-webkit-scrollbar-thumb,
            .auto-group::-webkit-scrollbar-thumb {
                background: rgba(0,0,0,0.2);
                border-radius: 10px;
            }
            .toggle-switch {
                width: 44px;
                height: 24px;
            }
            .toggle-switch::after {
                width: 20px;
                height: 20px;
                top: 2px;
                right: 2px;
            }
            .toggle-switch.active::after {
                transform: translateX(-20px);
            }
        }

        @media (max-width: 360px) {
            .controls-bar {
                padding: 0.4rem 0.6rem;
            }
            .speed-group, .auto-group {
                padding: 0.3rem 0.6rem;
                gap: 0.1rem;
            }
            .speed-group span, .auto-group span {
                font-size: 0.7rem;
                padding-right: 0.3rem;
            }
            .speed-btn {
                font-size: 0.8rem;
                padding: 0.2rem 0.5rem;
            }
            .toggle-switch {
                width: 40px;
                height: 22px;
            }
            .toggle-switch::after {
                width: 18px;
                height: 18px;
                top: 2px;
                right: 2px;
            }
            .toggle-switch.active::after {
                transform: translateX(-18px);
            }
        }

        .back-link {
            display: inline-block;
            background: #ebe1ce;
            padding: 0.4rem 1rem;
            border-radius: 30px;
            margin-bottom: 1rem;
            text-decoration: none;
            color: #4a5c38;
            font-weight: bold;
        }