/* =========================
    Root Variables
========================== */
        :root {
            --primary: #3b82f6;
            --info: #60a5fa;
            --success: #22c55e;
            --warning: #f59e0b;
            --danger: #f43f5e;
            --purple: #a855f7;
            --pink: #ec4899;
            --dark: #1e293b;
            --light: #f8fafc;
            --gray1: #f1f5f9;
            --gray2: #e2e8f0;
            --gray3: #cbd5e1;
            --gray4: #94a3b8;
            --gray5: #64748b;
            --gray6: #475569;
            --gray7: #334155;
            --gray8: #1e293b;
            --gray9: #0f172a;
            --border-radius: 16px;
            --shadow: 0 4px 12px rgba(0,0,0,0.08);
            --transition: all 0.3s ease;
        }

        * {
            margin: 0;
            padding: 0;
            box-sizing: border-box;
            font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
        }

        body {
            background: linear-gradient(135deg, #f0f9ff 0%, #e0f2fe 100%);
            color: var(--gray8);
            line-height: 1.6;
            min-height: 100vh;
            display: flex;
            flex-direction: column;
            justify-content: center;
            align-items: center;
            direction: rtl;
            padding: 10px;
        }
        
        .book-container {
            position: relative;
            width: 95vw;
            max-width: 1200px;
            height: 85vh; /* Increased from 75vh */
            perspective: 2000px;
            display: flex;
            justify-content: center;
            align-items: center;
            margin: 0 auto;
        }
        
        .book {
            position: relative;
            width: 100%;
            height: 100%;
            transform-style: preserve-3d;
            transform: translateZ(0);
        }
        
        .page {
            position: absolute;
            width: 100%;
            height: 100%;
            top: 0;
            left: 0;
            background: white;
            border-radius: var(--border-radius);
            box-shadow: var(--shadow);
            padding: 20px; /* Reduced from 30px */
            overflow: hidden;
            transform-origin: right center;
            transform-style: preserve-3d;
            transition: transform 1s cubic-bezier(0.645, 0.045, 0.355, 1);
            z-index: 1;
            display: flex;
            flex-direction: column;
        }
        
        .page-content {
            backface-visibility: hidden;
            height: 100%;
            transform: rotateY(0deg);
            padding: 15px; /* Reduced from 25px */
            direction: rtl;
            text-align: justify;
            overflow-y: auto;
            display: flex;
            flex-direction: column;
        }
        
        .page h2 {
            text-align: center;
            margin-bottom: 15px; /* Reduced from 25px */
            color: var(--primary);
            border-bottom: 1px solid var(--gray2);
            padding-bottom: 8px; /* Reduced from 12px */
            font-size: 1.6em; /* Reduced from 1.8em */
        }
        
        .page p {
            line-height: 1.6; /* Reduced from 1.8 */
            margin-bottom: 12px; /* Reduced from 20px */
            font-size: 1.1em; /* Reduced from 1.2em */
            color: var(--gray7);
        }
        
        .page-front {
            background: linear-gradient(to right, var(--primary), var(--info));
            color: var(--light);
            display: flex;
            flex-direction: column;
            justify-content: center;
            align-items: center;
            text-align: center;
            border-radius: var(--border-radius);
            box-shadow: 0 0 15px rgba(0, 0, 0, 0.1);
            padding: 30px; /* Added padding */
        }
        
        .page-front h1 {
            font-size: 2.5em; /* Reduced from 3em */
            margin-bottom: 20px; /* Reduced from 30px */
            text-shadow: 3px 3px 6px rgba(0,0,0,0.2);
            color: white;
            font-weight: bold;
        }
        
        .page-front p {
            font-size: 1.3em; /* Reduced from 1.5em */
            margin-bottom: 20px; /* Reduced from 30px */
            text-shadow: 2px 2px 4px rgba(0,0,0,0.2);
            color: white;
        }
        
        .page-front .author {
            margin-top: 25px; /* Reduced from 40px */
            font-style: italic;
            font-size: 1.1em; /* Reduced from 1.3em */
            color: white;
        }
        
        .controls {
            position: absolute;
            bottom: -70px; /* Adjusted from -80px */
            width: 100%;
            display: flex;
            justify-content: center;
            gap: 15px; /* Reduced from 20px */
            z-index: 100;
        }
        
        button {
            padding: 10px 20px; /* Reduced from 12px 25px */
            background: var(--primary);
            color: white;
            border: none;
            border-radius: 50px;
            cursor: pointer;
            font-size: 16px; /* Reduced from 18px */
            box-shadow: var(--shadow);
            transition: var(--transition);
            font-weight: 600;
        }
        
        button:hover {
            background: var(--info);
            transform: translateY(-3px);
            box-shadow: 0 6px 15px rgba(59, 130, 246, 0.3);
        }
        
        button:active {
            transform: translateY(0);
            box-shadow: var(--shadow);
        }
        
        button:disabled {
            background: var(--gray3);
            cursor: not-allowed;
            transform: none;
            box-shadow: none;
        }
        
        /* Page turning effect - REVERSED */
        .page.flipped {
            transform: rotateY(180deg);
        }
        
        .page::before {
            content: '';
            position: absolute;
            top: 0;
            bottom: 0;
            right: 0;
            width: 30px;
            background: linear-gradient(to left, rgba(0,0,0,0.1) 0%, rgba(0,0,0,0) 100%);
            transform: rotateY(90deg);
            transform-origin: right center;
            z-index: 2;
            border-radius: 0 var(--border-radius) var(--border-radius) 0;
        }
        
        /* Page number styling */
        .page-number {
            font-weight: bold;
            border: red solid 1px;
            color: var(--primary);
        }
        
        /* ===== Workbook specific styles ===== */
        .question {
            background-color: var(--gray1);
            padding: 15px; /* Reduced from 20px */
            border-radius: var(--border-radius);
            margin: 15px 0; /* Reduced from 20px */
            border-right: 4px solid var(--primary);
        }
        
        .question h3 {
            color: var(--primary);
            margin-bottom: 12px; /* Reduced from 15px */
            font-size: 1.2em; /* Reduced from 1.3em */
        }
        
        .options {
            display: flex;
            flex-direction: column;
            gap: 8px; /* Reduced from 10px */
            margin: 12px 0; /* Reduced from 15px */
        }
        
        .option {
            background: white;
            padding: 10px 12px; /* Reduced from 12px 15px */
            border-radius: 8px;
            cursor: pointer;
            transition: var(--transition);
            border: 1px solid var(--gray3);
        }
        
        .option:hover {
            background: var(--gray2);
            transform: translateX(-5px);
        }
        
        .option.selected {
            background: var(--info);
            color: white;
            border-color: var(--primary);
        }
        
        .option.correct {
            background: var(--success);
            color: white;
        }
        
        .option.incorrect {
            background: var(--danger);
            color: white;
        }
        
        .submit-btn {
            background: var(--success);
            margin-top: 8px; /* Reduced from 10px */
        }
        
        .submit-btn:hover {
            background: #16a34a;
        }

        .try-again-btn {
            background: var(--warning);
            margin-top: 8px; /* Reduced from 10px */
        }
        
        .try-again-btn:hover {
            background: #eab308;
        }
        
        .feedback {
            margin-top: 12px; /* Reduced from 15px */
            padding: 8px; /* Reduced from 10px */
            border-radius: 8px;
            display: none;
        }
        
        .feedback.correct {
            background: rgba(34, 197, 94, 0.1);
            color: var(--success);
            border: 1px solid var(--success);
            display: block;
        }
        
        .feedback.incorrect {
            background: rgba(244, 63, 94, 0.1);
            color: var(--danger);
            border: 1px solid var(--danger);
            display: block;
        }
        
        .fill-blank {
            display: flex;
            align-items: center;
            gap: 8px; /* Reduced from 10px */
            margin: 8px 0; /* Reduced from 10px */
        }
        
        .fill-blank input {
            padding: 6px 10px; /* Reduced from 8px 12px */
            border: 1px solid var(--gray3);
            border-radius: 8px;
            width: 130px; /* Reduced from 150px */
            direction: rtl;
        }
        
        .fill-blank input.correct {
            border-color: var(--success);
            background: rgba(34, 197, 94, 0.1);
        }
        
        .fill-blank input.incorrect {
            border-color: var(--danger);
            background: rgba(244, 63, 94, 0.1);
        }
        
        .matching-game {
            display: flex;
            flex-direction: column;
            gap: 8px; /* Reduced from 10px */
            margin: 12px 0; /* Reduced from 15px */
        }
        
        .matching-pair {
            display: flex;
            justify-content: space-between;
            align-items: center;
            background: white;
            padding: 8px 12px; /* Reduced from 10px 15px */
            border-radius: 8px;
            border: 1px solid var(--gray3);
        }
        
        .matching-pair select {
            padding: 4px 8px; /* Reduced from 5px 10px */
            border: 1px solid var(--gray3);
            border-radius: 5px;
            direction: rtl;
        }
        
        .audio-player {
            display: flex;
            align-items: center;
            gap: 8px; /* Reduced from 10px */
            margin: 12px 0; /* Reduced from 15px */
            background: var(--gray1);
            padding: 8px 12px; /* Reduced from 10px 15px */
            border-radius: 8px;
        }
        
        .audio-player button {
            padding: 6px 12px; /* Reduced from 8px 15px */
            font-size: 13px; /* Reduced from 14px */
        }
        
        .progress-bar {
            flex-grow: 1;
            height: 6px; /* Reduced from 8px */
            background: var(--gray3);
            border-radius: 4px;
            overflow: hidden;
        }
        
        .progress {
            height: 100%;
            background: var(--primary);
            width: 0%;
            transition: width 0.1s;
        }
        
        .score-display {
            text-align: center;
            font-size: 1.1em; /* Reduced from 1.2em */
            margin: 15px 0; /* Reduced from 20px */
            padding: 12px; /* Reduced from 15px */
            background: var(--gray1);
            border-radius: var(--border-radius);
        }

        .attempts-display {
            text-align: left;
            font-size: 0.85em; /* Reduced from 0.9em */
            color: var(--gray5);
            margin-top: 4px; /* Reduced from 5px */
        }
        
        /* Student info form */
        .student-info-form {
            display: flex;
            flex-direction: column;
            gap: 15px; /* Reduced from 20px */
            margin: 20px 0; /* Reduced from 30px */
        }
        
        .form-group {
            display: flex;
            flex-direction: column;
            gap: 6px; /* Reduced from 8px */
        }
        
        .form-group label {
            font-weight: 600;
            color: var(--gray7);
        }
        
        .form-group input, .form-group select {
            padding: 8px 12px; /* Reduced from 10px 15px */
            border: 1px solid var(--gray3);
            border-radius: 8px;
            font-size: 0.95em; /* Reduced from 1em */
            direction: rtl;
        }
        
        /* Certificate styles */
        .certificate {
            text-align: center;
            padding: 30px; /* Reduced from 40px */
            border: 8px solid var(--primary); /* Reduced from 10px */
            border-radius: var(--border-radius);
            background: white;
            position: relative;
        }
        
        .certificate h2 {
            color: var(--primary);
            font-size: 2.2em; /* Reduced from 2.5em */
            margin-bottom: 15px; /* Reduced from 20px */
        }
        
        .certificate h3 {
            color: var(--gray7);
            font-size: 1.6em; /* Reduced from 1.8em */
            margin: 15px 0; /* Reduced from 20px */
        }
        
        .certificate p {
            font-size: 1.2em; /* Reduced from 1.3em */
            margin: 12px 0; /* Reduced from 15px */
        }
        
        .certificate-logo {
            max-width: 100px; /* Reduced from 120px */
            margin: 0 auto 15px; /* Reduced from 20px */
        }
        
        .signature-area {
            margin-top: 30px; /* Reduced from 40px */
            display: flex;
            justify-content: space-between;
            border-top: 2px solid var(--gray3);
            padding-top: 15px; /* Reduced from 20px */
        }
        
        .signature {
            text-align: center;
            width: 45%;
        }
        
        .signature-line {
            width: 80%;
            height: 1px;
            background: var(--gray5);
            margin: 30px auto 8px; /* Reduced from 40px auto 10px */
        }
        
        .print-btn {
            background: var(--purple);
            margin-top: 15px; /* Reduced from 20px */
        }
        
        .print-btn:hover {
            background: var(--pink);
        }
        
        .reset-btn {
            background: var(--danger);
        }
        
        .reset-btn:hover {
            background: #e11d48;
        }
        
        /* Reset page styles */
        .reset-page-container {
            text-align: center;
            padding: 20px;
        }

        .warning-text {
            color: #e74c3c;
            font-weight: bold;
            margin: 15px 0;
        }

        .reset-actions {
            margin: 30px 0;
        }

        .reset-btn {
            background-color: #e74c3c;
            color: white;
            border: none;
            padding: 12px 24px;
            border-radius: 6px;
            font-size: 16px;
            cursor: pointer;
            transition: background-color 0.3s;
        }

        .reset-btn:hover {
            background-color: #c0392b;
        }

        .current-student-info {
            margin-top: 30px;
            padding: 15px;
            background-color: #f8f9fa;
            border-radius: 6px;
            border: 1px solid #dee2e6;
        }

        .current-student-info h3 {
            margin-bottom: 10px;
            color: #495057;
        }

        /* ===== NEW STYLES FOR STAGES ===== */
        .stage-indicator {
            position: absolute;
            top: 8px; /* Reduced from 10px */
            left: 8px; /* Reduced from 10px */
            background: var(--primary);
            color: white;
            padding: 4px 12px; /* Reduced from 5px 15px */
            border-radius: 20px;
            font-size: 0.85em; /* Reduced from 0.9em */
            font-weight: bold;
        }
        
        .stage-locked {
            position: absolute;
            top: 50%;
            left: 50%;
            transform: translate(-50%, -50%);
            background: rgba(0, 0, 0, 0.7);
            color: white;
            padding: 15px; /* Reduced from 20px */
            border-radius: var(--border-radius);
            text-align: center;
            z-index: 10;
        }
        
        .stage-locked h3 {
            margin-bottom: 12px; /* Reduced from 15px */
            color: white;
        }
        
        .stage-locked p {
            color: white;
            margin-bottom: 12px; /* Reduced from 15px */
        }
        
        .stage-progress-bar {
            height: 8px; /* Reduced from 10px */
            background: var(--gray3);
            border-radius: 5px;
            margin: 12px 0; /* Reduced from 15px */
            overflow: hidden;
        }
        
        .stage-progress-fill {
            height: 100%;
            background: var(--primary);
            width: 0%;
            transition: width 0.5s ease;
        }
        
        .vocabulary-list {
            display: grid;
            grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); /* Reduced from 200px */
            gap: 12px; /* Reduced from 15px */
            margin: 15px 0; /* Reduced from 20px */
        }
        
        .vocabulary-card {
            background: white;
            padding: 12px; /* Reduced from 15px */
            border-radius: 8px;
            border: 1px solid var(--gray3);
            box-shadow: var(--shadow);
            text-align: center;
        }
        
        .vocabulary-card.hebrew {
            background: var(--gray1);
            font-weight: bold;
            font-size: 1.1em; /* Reduced from 1.2em */
        }
        
        .vocabulary-card.english {
            background: var(--info);
            color: white;
        }
        
        .vocabulary-card .translation {
            font-size: 0.85em; /* Reduced from 0.9em */
            color: var(--gray6);
            margin-top: 4px; /* Reduced from 5px */
        }
        
        .vocabulary-card.english .translation {
            color: rgba(255, 255, 255, 0.8);
        }
        
        .stage-summary {
            background: var(--gray1);
            padding: 15px; /* Reduced from 20px */
            border-radius: var(--border-radius);
            margin: 15px 0; /* Reduced from 20px */
        }
        
        .stage-summary h3 {
            color: var(--primary);
            margin-bottom: 12px; /* Reduced from 15px */
            text-align: center;
        }
        
        .stage-summary-item {
            display: flex;
            justify-content: space-between;
            padding: 8px 0; /* Reduced from 10px 0 */
            border-bottom: 1px solid var(--gray3);
        }
        
        .stage-summary-item:last-child {
            border-bottom: none;
        }
        
        .stage-summary-item .label {
            font-weight: 600;
        }
        
        .stage-summary-item .value {
            color: var(--primary);
            font-weight: bold;
        }
        
        /* ===== ANIMATIONS ===== */
        @keyframes float {
            0%, 100% { transform: translateY(0); }
            50% { transform: translateY(-15px); }
        }
        
        @keyframes pulse {
            0% { transform: scale(1); }
            50% { transform: scale(1.05); }
            100% { transform: scale(1); }
        }
        
        @keyframes confetti {
            0% { transform: translateY(0) rotate(0); opacity: 1; }
            100% { transform: translateY(100vh) rotate(360deg); opacity: 0; }
        }
        
        .confetti {
            position: fixed;
            width: 10px;
            height: 10px;
            background: var(--primary);
            top: -10px;
            animation: confetti 5s linear forwards;
            z-index: 1000;
        }

        /* ===== NEW STYLES FOR PICTURE-WORD MATCHING ===== */
        .picture-word-matching {
            display: flex;
            flex-direction: column;
            gap: 15px; /* Reduced from 20px */
            margin: 15px 0; /* Reduced from 20px */
        }
        
        .pictures-container {
            display: grid;
            grid-template-columns: repeat(2, 1fr);
            gap: 12px; /* Reduced from 15px */
            margin-bottom: 15px; /* Reduced from 20px */
        }
        
        .picture-item {
            display: flex;
            flex-direction: column;
            align-items: center;
            gap: 8px; /* Reduced from 10px */
            padding: 12px; /* Reduced from 15px */
            background: var(--gray1);
            border-radius: var(--border-radius);
            border: 2px solid transparent;
            cursor: pointer;
            transition: var(--transition);
        }
        
        .picture-item:hover {
            transform: translateY(-5px);
            box-shadow: var(--shadow);
        }
        
        .picture-item.selected {
            border-color: var(--primary);
            background: rgba(59, 130, 246, 0.1);
        }
        
        .picture-item img {
            max-width: 100%;
            max-height: 130px; /* Reduced from 150px */
            border-radius: 8px;
            object-fit: contain;
        }
        
        .picture-item .picture-label {
            font-weight: bold;
            color: var(--primary);
        }
        
        .words-container {
            display: flex;
            flex-wrap: wrap;
            gap: 8px; /* Reduced from 10px */
            justify-content: center;
        }
        
        .word-option {
            padding: 8px 12px; /* Reduced from 10px 15px */
            background: var(--info);
            color: white;
            border-radius: 8px;
            cursor: pointer;
            transition: var(--transition);
        }
        
        .word-option:hover {
            background: var(--primary);
            transform: scale(1.05);
        }
        
        .word-option.selected {
            background: var(--success);
        }
        
        .word-option.used {
            background: var(--gray4);
            cursor: not-allowed;
        }
        
        /* ===== STYLES FOR TEXT WITH PICTURE PAGE ===== */
        .text-with-picture {
            display: flex;
            flex-direction: column;
            gap: 15px; /* Reduced from 20px */
            margin: 15px 0; /* Reduced from 20px */
        }
        
        .text-image-container {
            display: flex;
            flex-direction: column;
            gap: 15px; /* Reduced from 20px */
            align-items: center;
        }
        
        @media (min-width: 768px) {
            .text-image-container {
                flex-direction: row;
                align-items: flex-start;
            }
        }
        
        .text-content {
            flex: 1;
        }
        
        .image-content {
            flex: 1;
            display: flex;
            justify-content: center;
        }
        
        .image-content img {
            max-width: 100%;
            max-height: 250px; /* Reduced from 300px */
            border-radius: var(--border-radius);
            box-shadow: var(--shadow);
            object-fit: contain;
        }
        
        /* ===== RESPONSIVE DESIGN ===== */
        @media (max-width: 1024px) {
            .book-container {
                width: 90vw;
                height: 90vh; /* Increased from 85vh */
            }
        }
        
        @media (max-width: 768px) {
            .book-container {
                width: 95vw;
                height: 85vh; /* Increased from 80vh */
            }
            
            .page-content {
                padding: 12px; /* Reduced from 15px */
            }
            
            .page h2 {
                font-size: 1.4em; /* Reduced from 1.5em */
            }
            
            .page p {
                font-size: 1em;
            }
            
            .page-front h1 {
                font-size: 2em; /* Reduced from 2.2em */
            }
            
            .page-front p {
                font-size: 1.1em; /* Reduced from 1.2em */
            }
            
            .matching-pair {
                flex-direction: column;
                align-items: flex-start;
                gap: 8px; /* Reduced from 10px */
            }
            
            .signature-area {
                flex-direction: column;
                gap: 15px; /* Reduced from 20px */
            }
            
            .signature {
                width: 100%;
            }
            
            .controls {
                flex-wrap: wrap;
                bottom: -90px; /* Adjusted from -100px */
            }
            
            .vocabulary-list {
                grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); /* Reduced from 150px */
            }
            
            .pictures-container {
                grid-template-columns: 1fr;
            }
        }

        @media (max-width: 480px) {
            button {
                padding: 8px 16px; /* Reduced from 10px 20px */
                font-size: 14px; /* Reduced from 16px */
            }
            
            .controls {
                gap: 8px; /* Reduced from 10px */
            }
            
            .page-number-container {
                bottom: -35px; /* Adjusted from -40px */
            }
            
            .vocabulary-list {
                grid-template-columns: 1fr;
            }
        }
        
        @media print {
            body * {
                visibility: hidden;
            }
            
            .certificate, .certificate * {
                visibility: visible;
            }
            
            .certificate {
                position: absolute;
                left: 0;
                top: 0;
                width: 100%;
                border: none;
                box-shadow: none;
            }
            
            .print-btn, .reset-btn {
                display: none;
            }
        }
        
        /* ===== MODAL STYLES ===== */
        .modal-overlay {
            position: fixed;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            background: rgba(0, 0, 0, 0.5);
            display: flex;
            justify-content: center;
            align-items: center;
            z-index: 10000;
            opacity: 0;
            visibility: hidden;
            transition: var(--transition);
        }
        
        .modal-overlay.active {
            opacity: 1;
            visibility: visible;
        }
        
        .modal {
            background: white;
            border-radius: var(--border-radius);
            padding: 25px; /* Reduced from 30px */
            width: 90%;
            max-width: 500px;
            box-shadow: var(--shadow);
            transform: scale(0.9);
            transition: var(--transition);
            text-align: center;
        }
        
        .modal-overlay.active .modal {
            transform: scale(1);
        }
        
        .modal h3 {
            margin-bottom: 15px; /* Reduced from 20px */
            color: var(--dark);
            font-size: 1.4em; /* Reduced from 1.5em */
        }
        
        .modal p {
            margin-bottom: 20px; /* Reduced from 25px */
            font-size: 1em; /* Reduced from 1.1em */
            line-height: 1.6;
        }
        
        .modal-buttons {
            display: flex;
            justify-content: center;
            gap: 12px; /* Reduced from 15px */
        }
        
        .modal-btn {
            padding: 8px 20px; /* Reduced from 10px 25px */
            border: none;
            border-radius: 8px;
            cursor: pointer;
            font-weight: 600;
            transition: var(--transition);
        }
        
        .modal-btn.confirm {
            background: var(--danger);
            color: white;
        }
        
        .modal-btn.confirm:hover {
            background: #e11d48;
        }
        
        .modal-btn.cancel {
            background: var(--gray3);
            color: var(--gray7);
        }
        
        .modal-btn.cancel:hover {
            background: var(--gray4);
        }
        
        /* Points indicator */
        .points-indicator {
            display: inline-block;
            margin-right: 8px; /* Reduced from 10px */
            padding: 3px 6px; /* Reduced from 4px 8px */
            background: var(--warning);
            color: white;
            border-radius: 12px;
            font-size: 0.75em; /* Reduced from 0.8em */
            font-weight: bold;
        }
        
        .points-info {
            font-size: 0.85em; /* Reduced from 0.9em */
            color: var(--gray6);
            margin-top: 4px; /* Reduced from 5px */
        }
        
        /* Error message for student info */
        .error-message {
            color: var(--danger);
            font-size: 0.85em; /* Reduced from 0.9em */
            margin-top: 4px; /* Reduced from 5px */
            display: none;
        }
        
        .error-message.show {
            display: block;
        }
        
        /* Read-only form styles */
        .read-only-form {
            pointer-events: none;
            opacity: 0.7;
        }
        
        .read-only-message {
            background-color: var(--warning);
            color: white;
            padding: 8px; /* Reduced from 10px */
            border-radius: 8px;
            text-align: center;
            margin-bottom: 12px; /* Reduced from 15px */
        }
        
        /* Student info display on cover */
        .student-info-display {
            margin-top: 15px; /* Reduced from 20px */
            font-size: 1.1em; /* Reduced from 1.2em */
            font-weight: bold;
            color: white;
        }
        
        /* Drag and drop styles */
        .drag-drop-container {
            display: flex;
            flex-direction: column;
            gap: 15px; /* Reduced from 20px */
        }
        
        .drag-items {
            display: flex;
            flex-wrap: wrap;
            gap: 8px; /* Reduced from 10px */
            justify-content: center;
        }
        
        .drag-item {
            padding: 8px 12px; /* Reduced from 10px 15px */
            background: var(--info);
            color: white;
            border-radius: 8px;
            cursor: move;
            user-select: none;
        }
        
        .drag-item.matched {
            background: var(--success);
        }
        
        .drop-zone {
            min-height: 90px; /* Reduced from 100px */
            border: 2px dashed var(--gray4);
            border-radius: 8px;
            padding: 12px; /* Reduced from 15px */
            display: flex;
            flex-wrap: wrap;
            gap: 8px; /* Reduced from 10px */
        }
        
        .english-words {
            display: flex;
            flex-wrap: wrap;
            gap: 8px; /* Reduced from 10px */
            justify-content: center;
        }
        
        .english-word {
            padding: 8px 12px; /* Reduced from 10px 15px */
            background: var(--warning);
            color: white;
            border-radius: 8px;
        }
        
        .drop-target.highlight {
            background: var(--success);
        }
        
        /* Sentence arrangement styles */
        .sentence-arrangement {
            display: flex;
            flex-wrap: wrap;
            gap: 8px; /* Reduced from 10px */
            margin: 15px 0; /* Reduced from 20px */
            padding: 12px; /* Reduced from 15px */
            background: white;
            border-radius: 8px;
            border: 1px solid var(--gray3);
            min-height: 50px; /* Reduced from 60px */
        }
        
        .word-chip {
            padding: 6px 10px; /* Reduced from 8px 12px */
            background: var(--info);
            color: white;
            border-radius: 20px;
            cursor: move;
            user-select: none;
        }
        
        .word-chip.used {
            background: var(--gray4);
            cursor: default;
        }
        
        .word-bank {
            display: flex;
            flex-wrap: wrap;
            gap: 8px; /* Reduced from 10px */
            margin: 12px 0; /* Reduced from 15px */
            padding: 12px; /* Reduced from 15px */
            background: var(--gray1);
            border-radius: 8px;
        }

        /* ===== NEW STYLES FOR FLIP CARDS ===== */
        .flip-cards-container {
            display: grid;
            grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); /* Reduced from 200px */
            gap: 15px; /* Reduced from 20px */
            margin: 20px 0; /* Reduced from 30px */
        }
        
        .flip-card {
            background-color: transparent;
            width: 100%;
            height: 130px; /* Reduced from 150px */
            perspective: 1000px;
            cursor: pointer;
        }
        
        .flip-card-inner {
            position: relative;
            width: 100%;
            height: 100%;
            text-align: center;
            transition: transform 0.6s;
            transform-style: preserve-3d;
            box-shadow: 0 4px 8px rgba(0,0,0,0.1);
            border-radius: var(--border-radius);
        }
        
        .flip-card.flipped .flip-card-inner {
            transform: rotateY(180deg);
        }
        
        .flip-card-front, .flip-card-back {
            position: absolute;
            width: 100%;
            height: 100%;
            -webkit-backface-visibility: hidden;
            backface-visibility: hidden;
            display: flex;
            flex-direction: column;
            justify-content: center;
            align-items: center;
            padding: 15px; /* Reduced from 20px */
            border-radius: var(--border-radius);
        }
        
        .flip-card-front {
            background-color: var(--primary);
            color: white;
        }
        
        .flip-card-back {
            background-color: var(--info);
            color: white;
            transform: rotateY(180deg);
        }
        
        .flip-card-word {
            font-size: 1.3em; /* Reduced from 1.5em */
            font-weight: bold;
            margin-bottom: 8px; /* Reduced from 10px */
        }
        
        .flip-card-translation {
            font-size: 0.95em; /* Reduced from 1em */
            opacity: 0.9;
        }
        
        .play-button {
            background: rgba(255, 255, 255, 0.2);
            border: none;
            border-radius: 50%;
            width: 35px; /* Reduced from 40px */
            height: 35px; /* Reduced from 40px */
            display: flex;
            justify-content: center;
            align-items: center;
            cursor: pointer;
            margin-top: 8px; /* Reduced from 10px */
            transition: var(--transition);
        }
        
        .play-button:hover {
            background: rgba(255, 255, 255, 0.3);
            transform: scale(1.1);
        }
        
        .play-button svg {
            width: 18px; /* Reduced from 20px */
            height: 18px; /* Reduced from 20px */
            fill: white;
        }
        
        /* ===== NEW STYLES FOR STORY AUDIO PLAYER ===== */
        .story-audio-player {
            background: var(--gray1);
            padding: 12px; /* Reduced from 15px */
            border-radius: var(--border-radius);
            margin: 15px 0; /* Reduced from 20px */
        }
        
        .story-audio-controls {
            display: flex;
            align-items: center;
            gap: 8px; /* Reduced from 10px */
            margin-top: 8px; /* Reduced from 10px */
        }
        
        .story-audio-controls button {
            padding: 6px 12px; /* Reduced from 8px 15px */
            font-size: 13px; /* Reduced from 14px */
        }
        
        .story-audio-progress {
            flex-grow: 1;
            height: 6px; /* Reduced from 8px */
            background: var(--gray3);
            border-radius: 4px;
            overflow: hidden;
        }
        
        .story-audio-progress-bar {
            height: 100%;
            background: var(--primary);
            width: 0%;
            transition: width 0.1s;
        }
        
        .volume-control {
            display: flex;
            align-items: center;
            gap: 4px; /* Reduced from 5px */
        }
        
        .volume-control input {
            width: 70px; /* Reduced from 80px */
        }
        
        /* ===== NEW STYLES FOR WORD PLAY BUTTONS ===== */
        .word-with-audio {
            display: flex;
            align-items: center;
            gap: 8px; /* Reduced from 10px */
            margin: 4px 0; /* Reduced from 5px */
        }
        
        .word-audio-button {
            background: var(--primary);
            border: none;
            border-radius: 50%;
            width: 28px; /* Reduced from 30px */
            height: 28px; /* Reduced from 30px */
            display: flex;
            justify-content: center;
            align-items: center;
            cursor: pointer;
            transition: var(--transition);
            padding: 0;
        }
        
        .word-audio-button:hover {
            background: var(--info);
            transform: scale(1.1);
        }
        
        .word-audio-button svg {
            width: 14px; /* Reduced from 15px */
            height: 14px; /* Reduced from 15px */
            fill: white;
        }
        
        /* ===== ENHANCED STYLES FOR VOICE BUTTONS ===== */
        .voice-button {
            display: inline-flex;
            align-items: center;
            justify-content: center;
            background: var(--primary);
            border: none;
            border-radius: 50%;
            width: 32px; /* Reduced from 36px */
            height: 32px; /* Reduced from 36px */
            cursor: pointer;
            transition: var(--transition);
            padding: 0;
            margin-left: 6px; /* Reduced from 8px */
        }
        
        .voice-button:hover {
            background: var(--info);
            transform: scale(1.1);
        }
        
        .voice-button svg {
            width: 16px; /* Reduced from 18px */
            height: 16px; /* Reduced from 18px */
            fill: white;
        }
        
        .audio-controls {
            display: flex;
            align-items: center;
            gap: 8px; /* Reduced from 10px */
        }
        
        /* Align elements properly */
        .matching-pair {
            align-items: center;
            justify-content: space-between;
        }
        
        .fill-blank {
            align-items: center;
        }
        
        .question {
            text-align: right;
        }
        
        .options {
            text-align: right;
        }
        
        /* NEW STYLES FOR LOGO */
        .page-logo {
            position: absolute;
            top: 15px; /* Reduced from 20px */
            right: 15px; /* Reduced from 20px */
            width: 50px; /* Reduced from 60px */
            height: 50px; /* Reduced from 60px */
            z-index: 5;
        }
        
        .page-logo img {
            width: 100%;
            height: 100%;
            object-fit: contain;
        }
        
        .cover-logo {
            width: 120px; /* Reduced from 150px */
            height: 120px; /* Reduced from 150px */
            margin-bottom: 20px; /* Reduced from 30px */
        }
        
        .cover-logo img {
            width: 100%;
            height: 100%;
            object-fit: contain;
        }

        /* ===== NEW STYLES FOR LETTER PAGE ===== */
        .letter-page-container {
            display: flex;
            flex-direction: column;
            height: 100%;
            gap: 15px; /* Reduced from 20px */
        }

        .letter-description {
            flex: 1;
            display: flex;
            flex-direction: column;
            align-items: flex-start;
            justify-content: flex-start;
            padding: 15px; /* Reduced from 20px */
            background: var(--gray1);
            border-radius: var(--border-radius);
        }

        .letter-desc-text {
            font-size: 1.2em; /* Reduced from 1.3em */
            font-weight: bold;
            margin-bottom: 15px; /* Reduced from 20px */
            color: var(--primary);
            text-align: right;
        }

        .letter-audio-control {
            display: flex;
            align-items: center;
            gap: 8px; /* Reduced from 10px */
        }

        .letter-audio-control span {
            font-size: 1em; /* Reduced from 1.1em */
            color: var(--gray7);
        }

        .letter-display {
            flex: 2;
            display: flex;
            justify-content: center;
            align-items: center;
            background: linear-gradient(135deg, var(--primary), var(--info));
            border-radius: var(--border-radius);
            padding: 30px; /* Reduced from 40px */
        }

        .big-letter {
            font-size: 18vw; /* Reduced from 20vw */
            color: white;
            text-shadow: 5px 5px 15px rgba(0, 0, 0, 0.3);
            margin: 0;
            line-height: 1;
        }

        /* For larger screens, limit the maximum font size */
        @media (min-width: 1200px) {
            .big-letter {
                font-size: 200px; /* Reduced from 240px */
            }
        }

        /* For mobile devices */
        @media (max-width: 768px) {
            .letter-page-container {
                flex-direction: column;
            }
            
            .letter-description {
                padding: 12px; /* Reduced from 15px */
            }
            
            .letter-desc-text {
                font-size: 1.1em;
            }
            
            .letter-display {
                padding: 15px; /* Reduced from 20px */
            }
            
            .big-letter {
                font-size: 25vw; /* Reduced from 30vw */
            }
        }

        /* ===== NEW STYLES FOR CURSIVE WORD PAGE ===== */
        .word-cursive-page-container {
            display: flex;
            flex-direction: column;
            height: 100%;
            gap: 8px; /* Reduced from 10px */
        }

        .cursive-display {
            flex: 1;
            display: flex;
            justify-content: center;
            align-items: center;
            background: linear-gradient(135deg, var(--primary), var(--info));
            border-radius: var(--border-radius);
            padding: 15px; /* Reduced from 20px */
            margin: 4px 0; /* Reduced from 5px */
        }

        .cursive-image-container {
            display: flex;
            justify-content: center;
            align-items: center;
            background: rgba(255, 255, 255, 0.9);
            border-radius: var(--border-radius);
            padding: 25px; /* Reduced from 30px */
            max-width: 90%;
            box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
        }

        .cursive-image {
            max-width: 100%;
            max-height: 220px; /* Reduced from 250px */
            object-fit: contain;
            filter: drop-shadow(2px 2px 4px rgba(0, 0, 0, 0.3));
        }

        /* For mobile devices */
        @media (max-width: 768px) {
            .cursive-display {
                padding: 12px; /* Reduced from 15px */
            }
            
            .cursive-image-container {
                padding: 15px; /* Reduced from 20px */
                max-width: 95%;
            }
            
            .cursive-image {
                max-height: 180px; /* Reduced from 200px */
            }
        }

        /* ===== NEW STYLES FOR WORD PAGE ===== */
        .word-page-container {
            display: flex;
            flex-direction: column;
            height: 100%;
            gap: 8px; 
        }

        .word-description {
            direction: ltr;
            flex: 0 0 auto;
            display: flex;
            flex-direction: row;
            align-items: center;
            justify-content: space-between;
            padding: 12px; /* Reduced from 15px */
            background: var(--gray1);
            border-radius: var(--border-radius);
            text-align: center;
            min-height: auto;
        }

        .word-desc-text {
            font-size: 1.2em; /* Reduced from 1.3em */
            font-weight: bold;
            margin-bottom: 0;
            color: var(--primary);
            flex: 1;
            margin-right: 12px; /* Reduced from 15px */
        }

        .word-audio-control {
            display: flex;
            align-items: center;
            gap: 8px; /* Reduced from 10px */
            margin-top: 0;
            flex-shrink: 0;
        }

        .word-audio-control span {
            font-size: 1em; /* Reduced from 1.1em */
            color: var(--gray7);
        }

        .word-display {
            flex: 1;
            display: flex;
            flex-direction: column;
            justify-content: center;
            align-items: center;
            background: linear-gradient(135deg, var(--primary), var(--info));
            border-radius: var(--border-radius);
            padding: 4px 30px; /* Reduced from 5px 40px */
            text-align: center;
            position: relative;
            min-height: auto;
            margin: 4px 0; /* Reduced from 5px */
        }

        .word-display-title {
            position: absolute;
            top: 6px; /* Reduced from 8px */
            right: 15px; /* Reduced from 20px */
            color: rgba(255, 255, 255, 0.8);
            font-size: 1em; /* Reduced from 1.1em */
            font-weight: bold;
            margin: 0;
        }

        .big-word {
            color: white;
            text-shadow: 5px 5px 15px rgba(0, 0, 0, 0.3);
            margin: 4px 0; /* Reduced from 5px */
            line-height: 1;
            word-wrap: break-word;
            max-width: 100%;
            padding: 0;
        }

        /* Dynamic font sizing based on word length */
        .big-word.short { font-size: 18vw; } /* Reduced from 20vw */
        .big-word.medium { font-size: 14vw; } /* Reduced from 15vw */
        .big-word.long { font-size: 9vw; } /* Reduced from 10vw */

        /* For larger screens, limit the maximum font size */
        @media (min-width: 1200px) {
            .big-word.short { font-size: 200px; } /* Reduced from 240px */
            .big-word.medium { font-size: 160px; } /* Reduced from 180px */
            .big-word.long { font-size: 110px; } /* Reduced from 120px */
        }

        /* For mobile devices */
        @media (max-width: 768px) {
            .word-page-container {
                flex-direction: column;
            }
            
            .word-description {
                padding: 10px;
            }
            
            .word-desc-text {
                font-size: 1.1em;
            }
            
            .word-display {
                padding: 4px 15px; /* Reduced from 5px 20px */
            }
            
            .word-display-title {
                position: relative;
                top: auto;
                right: auto;
                margin-bottom: 12px; /* Reduced from 15px */
                font-size: 1em; /* Reduced from 1.1em */
            }

            .word-description {
               padding: 8px; /* Reduced from 10px */
            }
            
            .big-word.short { font-size: 25vw; } /* Reduced from 30vw */
            .big-word.medium { font-size: 20vw; } /* Reduced from 22vw */
            .big-word.long { font-size: 14vw; } /* Reduced from 15vw */
        }

        /* ===== NEW STYLES FOR PAGE NUMBER IN BOOK ===== */
        .page-number-in-book {
            position: absolute;
            bottom: 12px; /* Reduced from 15px */
            left: 15px; /* Reduced from 20px */
            font-size: 0.95em; /* Reduced from 1em */
            color: var(--gray5);
            font-weight: bold;
            z-index: 5;
        }

        /* ===== NEW COMPACT LAYOUT STYLES ===== */
        .compact-layout {
            display: flex;
            flex-direction: column;
            height: 100%;
            gap: 10px;
        }

        .compact-section {
            flex: 1;
            overflow-y: auto;
            padding: 10px;
            border-radius: var(--border-radius);
            background: var(--gray1);
        }

        .compact-section.full-height {
            flex: 2;
        }

        .two-column-layout {
            display: flex;
            gap: 15px;
            height: 100%;
        }

        .two-column-layout > div {
            flex: 1;
            overflow-y: auto;
            padding: 15px;
            border-radius: var(--border-radius);
            background: var(--gray1);
        }

        /* Ensure content fits without scrolling */
        .fit-content {
            max-height: 100%;
            overflow-y: auto;
        }

        /* Adjust spacing for better fit */
        .tight-spacing {
            margin: 8px 0;
            padding: 10px;
        }

        .tight-spacing h3 {
            margin-bottom: 8px;
        }

        /* Reduce line height for better fit */
        .compact-text {
            line-height: 1.4;
        }

        /* Smaller font sizes for compact layout */
        .compact-font {
            font-size: 0.95em;
        }





        /* ===== INTERACTIVE PICTURE STYLES ===== */
.interactive-picture-container {
    display: flex;
    flex-direction: column;
    gap: 20px;
    margin: 15px 0;
}

.hotspot-image-wrapper {
    position: relative;
    width: 100%;
    max-width: 600px;
    margin: 0 auto;
}

.hotspot-image {
    width: 100%;
    height: auto;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
}

.hotspot {
    position: absolute;
    width: 30px;
    height: 30px;
    transform: translate(-50%, -50%);
    cursor: pointer;
    z-index: 10;
}

.hotspot-marker {
    width: 20px;
    height: 20px;
    background: var(--primary);
    border: 3px solid white;
    border-radius: 50%;
    box-shadow: 0 2px 8px rgba(0,0,0,0.3);
    transition: var(--transition);
    animation: pulse 2s infinite;
}

.hotspot:hover .hotspot-marker {
    transform: scale(1.3);
    background: var(--danger);
}

.hotspot-tooltip {
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0,0,0,0.8);
    color: white;
    padding: 8px 12px;
    border-radius: 8px;
    white-space: nowrap;
    opacity: 0;
    visibility: hidden;
    transition: var(--transition);
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 10px;
}

.hotspot:hover .hotspot-tooltip {
    opacity: 1;
    visibility: visible;
}

.hotspot-tooltip::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 6px solid transparent;
    border-top-color: rgba(0,0,0,0.8);
}

.hebrew-word {
    font-weight: bold;
    font-size: 1.1em;
}

.english-translation {
    font-size: 0.9em;
    opacity: 0.9;
}

.hotspot-voice {
    background: rgba(255,255,255,0.2);
    width: 24px;
    height: 24px;
}

.hotspot-voice svg {
    width: 12px;
    height: 12px;
}

.hotspot-legend {
    background: var(--gray1);
    padding: 15px;
    border-radius: var(--border-radius);
    text-align: center;
}

.hotspot-legend h3 {
    margin-bottom: 12px;
    color: var(--primary);
}

.hotspot-words-list {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 10px;
    justify-items: center;
}

.hotspot-word-item {
    display: flex;
    align-items: center;
    gap: 8px;
    background: white;
    padding: 8px 12px;
    border-radius: 8px;
    border: 1px solid var(--gray3);
}

/* Responsive design for interactive picture */
@media (max-width: 768px) {
    .interactive-picture-container {
        gap: 15px;
    }
    
    .hotspot-words-list {
        grid-template-columns: 1fr;
    }
    
    .hotspot-word-item {
        justify-content: center;
    }
    
    .hotspot-tooltip {
        white-space: normal;
        text-align: center;
        min-width: 120px;
    }
}

/* Enhanced pulse animation for hotspots */
@keyframes pulse {
    0% {
        box-shadow: 0 0 0 0 rgba(59, 130, 246, 0.7);
    }
    70% {
        box-shadow: 0 0 0 10px rgba(59, 130, 246, 0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(59, 130, 246, 0);
    }
}