/* Original Construction Safety lesson design restored for external loading. */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;600;800&display=swap');

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;600;800&display=swap');
        
        #safety-app, #safety-app * {
            box-sizing: border-box;
        }

        #safety-app {
            all: initial;
            font-family: 'Inter', sans-serif;
            display: flex;
            justify-content: center;
            align-items: center;
            width: 100%;
            height: 100%;
            min-height: 600px;
            padding: 10px;
            background: transparent;
        }

        /* Required rule for Key Words */
        #safety-app strong { 
            color: #4f46e5 !important; /* Tailwind indigo-600 */
            font-weight: 700 !important;
            background-color: rgba(79, 70, 229, 0.1) !important;
            padding: 0.1rem 0.3rem !important;
            border-radius: 0.25rem !important;
        }

        #safety-game-container {
            width: 100%;
            max-width: 950px;
            height: 100%;
            min-height: 600px;
            max-height: 90vh;
            background: #f8fafc;
            border-radius: 12px;
            box-shadow: 0 15px 35px rgba(0,0,0,0.15);
            overflow: hidden;
            position: relative;
            display: flex;
            flex-direction: column;
            border: 1px solid #cbd5e1;
            transition: all 0.3s ease;
        }
        
        /* Fullscreen overrides */
        #safety-game-container:fullscreen {
            max-width: 100%;
            max-height: 100%;
            height: 100vh;
            border-radius: 0;
            border: none;
        }
        #safety-game-container:-webkit-full-screen {
            max-width: 100%;
            max-height: 100%;
            height: 100vh;
            border-radius: 0;
            border: none;
        }

        .module-screen {
            display: none;
            flex-direction: column;
            width: 100%;
            flex: 1;
            padding: 24px;
            box-sizing: border-box;
            overflow-y: auto;
            background: #ffffff;
        }

        .module-screen.active {
            display: flex;
            animation: fadeIn 0.4s ease-in-out;
        }

        .topbar {
            width: 100%;
            height: 54px;
            padding: 0 20px;
            display: flex;
            justify-content: space-between;
            align-items: center;
            background: #1e293b;
            color: #f8fafc;
            font-weight: 600;
            z-index: 10;
        }

        .caution-stripes {
            height: 8px;
            width: 100%;
            background: repeating-linear-gradient(
                45deg,
                #fbbf24,
                #fbbf24 15px,
                #1e293b 15px,
                #1e293b 30px
            );
        }

        /* High-Contrast Interactive Buttons */
        .btn-primary {
            background: #2563eb;
            color: white;
            padding: 12px 28px;
            border-radius: 8px;
            font-weight: 700;
            transition: all 0.2s;
            border: none;
            cursor: pointer;
            box-shadow: 0 4px 6px -1px rgba(37, 99, 235, 0.2);
            display: inline-flex;
            align-items: center;
            justify-content: center;
        }
        .btn-primary:hover:not(:disabled) { background: #1d4ed8; transform: translateY(-1px); box-shadow: 0 6px 8px -1px rgba(37, 99, 235, 0.3); }
        .btn-primary:disabled { background: #94a3b8; cursor: not-allowed; box-shadow: none; transform: none; }

        .btn-secondary {
            background: #64748b;
            color: white;
            padding: 12px 28px;
            border-radius: 8px;
            font-weight: 700;
            transition: all 0.2s;
            border: none;
            cursor: pointer;
            box-shadow: 0 4px 6px -1px rgba(100, 116, 139, 0.2);
        }
        .btn-secondary:hover:not(:disabled) { background: #475569; transform: translateY(-1px); box-shadow: 0 6px 8px -1px rgba(100, 116, 139, 0.3); }

        .btn-success {
            background: #16a34a;
            color: white;
            padding: 12px 28px;
            border-radius: 8px;
            font-weight: 700;
            transition: all 0.2s;
            border: none;
            cursor: pointer;
            box-shadow: 0 4px 6px -1px rgba(22, 163, 74, 0.2);
        }
        .btn-success:hover:not(:disabled) { background: #15803d; transform: translateY(-1px); box-shadow: 0 6px 8px -1px rgba(22, 163, 74, 0.3); }

        .selectable-card {
            border: 2px solid #e2e8f0;
            border-radius: 10px;
            padding: 16px;
            cursor: pointer;
            transition: all 0.2s;
            display: flex;
            flex-direction: column;
            align-items: center;
            text-align: center;
            background: #fff;
            box-shadow: 0 2px 4px rgba(0,0,0,0.05);
            user-select: none;
            -webkit-tap-highlight-color: transparent;
        }
        .selectable-card:hover { border-color: #94a3b8; background: #f8fafc; transform: translateY(-2px); }
        .selectable-card.selected { border-color: #2563eb; background: #eff6ff; box-shadow: 0 0 0 3px rgba(37,99,235,0.2); transform: scale(1.02); }
        .selectable-card.correct { border-color: #16a34a; background: #f0fdf4; color: #14532d; }
        .selectable-card.wrong { border-color: #dc2626; background: #fef2f2; color: #7f1d1d; }

        .hotspot {
            position: absolute;
            width: 48px;
            height: 48px;
            background: transparent;
            border: 3px dashed rgba(255, 255, 255, 0.7);
            border-radius: 50%;
            cursor: pointer;
            display: flex;
            justify-content: center;
            align-items: center;
            color: transparent;
            font-weight: bold;
            transition: transform 0.2s, background 0.2s, border-color 0.2s;
            animation: pulseTransparent 2s infinite;
            -webkit-tap-highlight-color: transparent;
        }
        .hotspot:hover { 
            transform: scale(1.15); 
            background: rgba(255, 255, 255, 0.25);
            border-color: rgba(255, 255, 255, 1);
        }
        .hotspot.found { 
            background: rgba(22, 163, 74, 0.8); 
            border: 2px solid #16a34a;
            color: white; 
            animation: none; 
            cursor: default; 
            transform: scale(1);
        }

        .flip-card {
            background-color: transparent;
            width: 100%;
            height: 220px;
            perspective: 1000px;
            cursor: pointer;
            -webkit-tap-highlight-color: transparent;
        }
        .flip-card-inner {
            position: relative;
            width: 100%;
            height: 100%;
            text-align: center;
            transition: transform 0.6s cubic-bezier(0.4, 0.2, 0.2, 1);
            transform-style: preserve-3d;
            box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
            border-radius: 12px;
        }
        .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;
            border-radius: 12px;
            display: flex;
            flex-direction: column;
            justify-content: center;
            align-items: center;
            padding: 24px;
            box-sizing: border-box;
        }
        .flip-card-front {
            background-color: #f8fafc;
            border: 2px solid #e2e8f0;
            color: #1e293b;
        }
        .flip-card-front:hover {
            border-color: #94a3b8;
            background-color: #f1f5f9;
        }
        .flip-card-back {
            background-color: #2563eb;
            color: white;
            transform: rotateY(180deg);
            border: 2px solid #1d4ed8;
        }

        @keyframes fadeIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }
        @keyframes pulseTransparent { 0% { box-shadow: 0 0 0 0 rgba(255, 255, 255, 0.6); } 70% { box-shadow: 0 0 0 15px rgba(255, 255, 255, 0); } 100% { box-shadow: 0 0 0 0 rgba(255, 255, 255, 0); } }
        @keyframes firework-burst { 0% { transform: scale(0); opacity: 1; } 50% { opacity: 1; } 100% { transform: scale(2); opacity: 0; } }
        
        .toc-item {
            opacity: 0;
            transform: translateX(30px);
            transition: opacity 0.6s ease-out, transform 0.6s ease-out;
        }
        .toc-item.visible {
            opacity: 1;
            transform: translateX(0);
        }

        .fw-particle { position: absolute; width: 8px; height: 8px; border-radius: 50%; animation: firework-burst 2s infinite ease-out; }
        .fw-1 { top: 25%; left: 20%; animation-delay: 0s; box-shadow: -30px -30px 0 #fbbf24, 30px -30px 0 #34d399, -30px 30px 0 #f87171, 30px 30px 0 #60a5fa, 0 -45px 0 #a78bfa, 0 45px 0 #f472b6, -45px 0 0 #34d399, 45px 0 0 #fbbf24; }
        .fw-2 { top: 35%; left: 80%; animation-delay: 0.6s; box-shadow: -40px -40px 0 #60a5fa, 40px -40px 0 #fbbf24, -40px 40px 0 #34d399, 40px 40px 0 #f87171, 0 -55px 0 #f472b6, 0 55px 0 #a78bfa, -55px 0 0 #fbbf24, 55px 0 0 #34d399; }
        .fw-3 { top: 15%; left: 50%; animation-delay: 1.2s; box-shadow: -20px -20px 0 #f87171, 20px -20px 0 #a78bfa, -20px 20px 0 #60a5fa, 20px 20px 0 #fbbf24, 0 -35px 0 #34d399, 0 35px 0 #f472b6, -35px 0 0 #a78bfa, 35px 0 0 #60a5fa; }
        
        .feedback-toast {
            position: absolute;
            bottom: 24px;
            left: 50%;
            transform: translateX(-50%);
            padding: 14px 28px;
            border-radius: 8px;
            color: white;
            font-weight: bold;
            display: none;
            z-index: 50;
            box-shadow: 0 10px 15px -3px rgba(0,0,0,0.2);
            text-align: center;
        }
        
        /* Standardized Component Layout Classes */
        .stage-header { flex-shrink: 0; margin-bottom: 16px; }
        .stage-body { flex: 1 1 auto; width: 100%; display: flex; flex-direction: column; position: relative; overflow-y: auto; overflow-x: hidden; min-height: 0; margin-bottom: 16px; }
        .feedback-row { flex-shrink: 0; min-height: 52px; display: flex; align-items: center; justify-content: center; background: #f8fafc; border: 1px solid #cbd5e1; border-radius: 8px; padding: 8px 16px; margin-bottom: 16px; font-size: 0.9rem; color: #334155; font-weight: 700; text-align: center; box-shadow: inset 0 2px 4px rgba(0,0,0,0.02); }
        .button-row { flex-shrink: 0; display: flex; justify-content: space-between; align-items: center; width: 100%; border-top: 1px solid #e2e8f0; padding-top: 16px; margin-top: auto; }
#lpsi-bridge-loaded{display:none!important;}
