/* user-style.css - Vanilla CSS only (NO Tailwind) */

/* --- EMBEDDED MODE: Assessment in a limited container (e.g., demo on marketing page) === */
body.mas-embedded-mode,
body.mas-embedded-mode.mas-fullscreen-body {
    position: relative !important;
    height: auto !important;
    width: 100% !important;
    overflow-y: auto !important;
    min-height: 0;
}

body.mas-embedded-mode .mas-user-wrap {
    height: 80vh !important;
    max-height: 800px !important;
    overflow: hidden !important;
    border-radius: 1rem;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1);
}

/* --- CORE FIXES FOR LAYOUT AND HEIGHT --- */
html.mas-fullscreen-body, body.mas-fullscreen-body {
    height: 100%;
    margin: 0;
    padding: 0;
    overflow: hidden;  /* Prevent any scrolling */
    width: 100vw;
    position: fixed; /* Lock body in place */
}

@media (max-width: 768px) {
    /* Mobile: Use relative positioning to allow keyboard without pushing content */
    html.mas-fullscreen-body, body.mas-fullscreen-body {
        position: relative;
        height: auto;
        min-height: 100vh;
        overflow-y: auto;
    }
}

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

/* --- SCREEN VISIBILITY CONTROLS --- */
.mas-screen-visible { 
    display: flex !important; 
}

/* --- TOAST NOTIFICATIONS --- */
.mas-toast {
    position: fixed;
    bottom: 20px;
    right: 20px;
    max-width: 400px;
    padding: 16px 20px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    z-index: 9999;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    animation: slideInUp 0.3s ease-out;
}

@media (max-width: 480px) {
    .mas-toast {
        max-width: 85vw;
        bottom: 10px;
        right: 10px;
        left: 10px;
        padding: 12px 16px;
        font-size: 12px;
    }
}

.mas-toast-success {
    background: #10b981;
    color: white;
    border-left: 4px solid #059669;
}

.mas-toast-error {
    background: #ef4444;
    color: white;
    border-left: 4px solid #dc2626;
}

.mas-toast-warning {
    background: #f59e0b;
    color: white;
    border-left: 4px solid #d97706;
}

.mas-toast-info {
    background: #3b82f6;
    color: white;
    border-left: 4px solid #2563eb;
}

.mas-toast-close {
    background: none;
    border: none;
    color: inherit;
    cursor: pointer;
    font-size: 20px;
    line-height: 1;
    padding: 0;
    opacity: 0.7;
    transition: opacity 0.2s;
}

.mas-toast-close:hover {
    opacity: 1;
}

@keyframes slideInUp {
    from {
        transform: translateY(100px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

@keyframes slideOutDown {
    from {
        transform: translateY(0);
        opacity: 1;
    }
    to {
        transform: translateY(100px);
        opacity: 0;
    }
}

.mas-toast.removing {
    animation: slideOutDown 0.3s ease-out forwards;
}

/* Loading spinner */
.mas-spinner {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin-right: 8px;
    vertical-align: middle;
}

@keyframes spin {
    from {
        transform: rotate(0deg);
    }
    to {
        transform: rotate(360deg);
    }
}

#mas-user-info-screen {
    display: none;
    position: absolute; 
    top: 0; 
    left: 0; 
    width: 100%; 
    height: 100%;
    z-index: 100;
    overflow-y: auto;
    align-items: center;
    justify-content: center;
    background: linear-gradient(180deg, #f1f5f9 0%, #ffffff 100%);
    padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
}

/* --- USER INFO & DASHBOARD STYLES --- */
.mas-user-wrap {
    width: 100%;
    height: 100%;
    overflow: hidden;
    position: fixed; /* Force full screen overlay */
    top: 0;
    left: 0;
    z-index: 99999;
    background: #fff;
}

.mas-user-info-container {
    background: white;
    border-radius: 12px;
    padding: 2rem;
    max-width: 500px;
    width: 95%;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.1);
}

.mas-user-info-container h2 {
    font-size: 1.875rem;
    font-weight: 700;
    color: #1f2937;
    margin-bottom: 1.5rem;
}

.mas-user-info-container form {
    width: 100%;
}

.mas-user-info-container > div {
    margin-bottom: 1rem;
}

.mas-user-info-container label {
    display: block;
    font-size: 0.875rem;
    font-weight: 500;
    color: #374151;
    margin-bottom: 0.25rem;
}

.mas-user-info-container input {
    width: 100%;
    padding: 0.5rem 1rem;
    border: 1px solid #d1d5db;
    border-radius: 0.375rem;
    font-size: 1rem;
}

.mas-user-info-container input:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

#mas-user-info-error {
    color: #dc2626;
    margin-bottom: 1rem;
    font-size: 0.875rem;
}

/* --- MODERN DASHBOARD LAYOUT --- */
#mas-assessment-dashboard {
    display: none;
    flex-direction: column; /* Fixes "size not right" issue */
    width: 100%;
    height: 100%;
    background: #f8fafc;
    overflow-y: auto; /* Allows scrolling */
    overflow-x: hidden;
}

.mas-dashboard-header-modern {
    padding: 3rem 2rem;
    text-align: center;
    background: linear-gradient(135deg, #1e40af 0%, #3b82f6 100%);
    color: white;
    flex-shrink: 0;
    box-shadow: 0 4px 20px rgba(0,0,0,0.1);
    position: relative;
    overflow: hidden;
}

/* Decorative circle in header */
.mas-dashboard-header-modern::after {
    content: '';
    position: absolute;
    top: -50%;
    right: -10%;
    width: 400px;
    height: 400px;
    background: rgba(255,255,255,0.1);
    border-radius: 50%;
    pointer-events: none;
}

.mas-dashboard-header-modern h2 {
    font-size: 2.5rem;
    font-weight: 800;
    margin: 0 0 0.5rem 0;
    letter-spacing: -0.5px;
    position: relative;
    z-index: 1;
}

.mas-dashboard-header-modern p {
    font-size: 1.2rem;
    margin: 0;
    opacity: 0.9;
    font-weight: 500;
    position: relative;
    z-index: 1;
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
}

.mas-dashboard-content-wrapper {
    flex: 1;
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem;
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

.mas-dashboard-cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1.5rem;
    width: 100%;
}

.mas-dashboard-card-modern {
    background: white;
    padding: 2rem;
    border-radius: 16px;
    border: 1px solid #f1f5f9;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -1px rgba(0, 0, 0, 0.03);
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
}

.mas-dashboard-card-modern:hover {
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    transform: translateY(-4px);
    border-color: #e2e8f0;
}

.mas-dashboard-card-icon {
    font-size: 3rem;
    margin-bottom: 1.25rem;
    background: #eff6ff;
    width: 80px;
    height: 80px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    color: #2563eb;
}

.mas-dashboard-card-label {
    font-weight: 600;
    color: #6b7280;
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 0.5rem;
}

.mas-dashboard-card-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: #1f2937;
    margin-bottom: 0.5rem;
}

.mas-dashboard-card-subvalue {
    font-size: 1rem;
    color: #64748b;
}

.mas-dashboard-actions-modern {
    display: flex;
    gap: 1.5rem;
    justify-content: center;
    margin-top: 1rem;
    padding-bottom: 3rem;
    flex-wrap: wrap;
}

/* NoScript Error Message */
.mas-noscript-error {
    background: #fee2e2;
    color: #b91c1c;
    padding: 1.8em;
    text-align: center;
    font-weight: bold;
    border-radius: 12px;
    margin: 2rem;
}

/* --- ASSESSMENT MAP & VIEWPORT --- */

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}
.mas-access-modal-card h2 {
    color: #2563eb; /* standard blue accent */
    font-size: 2rem;
    margin-bottom: 0.5rem;
    font-weight: 700;
    letter-spacing: -0.5px;
}
.mas-access-modal-card p {
    color: #475569;
    margin-bottom: 1.5rem;
    font-size: 1rem;
    line-height: 1.6;
}
.mas-access-modal-card label {
    display: block;
    margin-bottom: 0.6rem;
    color: #1e293b;
    font-weight: 600;
    font-size: 0.95rem;
    text-align: left;
}
.mas-access-modal-card input {
    width: 100%;
    padding: 0.95rem 1.1rem;
    border: 2px solid #e2e8f0;
    border-radius: 10px;
    font-size: 1rem;
    margin-bottom: 1.2rem;
    background: #f8fafc;
    transition: all 0.3s ease;
    font-family: inherit;
}

/* === Form Group Styling === */
.mas-form-group {
    margin-bottom: 1.5rem;
}

.mas-form-label {
    display: block;
    margin-bottom: 0.6rem;
    color: #1e293b;
    font-weight: 600;
    font-size: 0.95rem;
    text-align: left;
}

.mas-form-input {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 2px solid #e2e8f0;
    border-radius: 10px;
    font-size: 1rem;
    background: #f8fafc;
    transition: all 0.3s ease;
    font-family: inherit;
}

.mas-form-input:focus {
    border-color: #2563eb;
    box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.1);
    outline: none;
}

.mas-form-mono {
    font-family: 'Courier New', monospace;
    letter-spacing: 0.05em;
}

.mas-form-helper {
    font-size: 0.85rem;
    color: #64748b;
    margin-top: 0.5rem;
    text-align: center;
}

.mas-form-error {
    color: #dc2626;
    text-align: center;
    font-weight: 500;
    min-height: 1.5rem;
    margin-bottom: 1rem;
}

.mas-button-group {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    justify-content: center;
    margin-top: 1.5rem;
}

@media (min-width: 640px) {
    .mas-button-group {
        flex-direction: row;
        gap: 1.25rem;
    }
}

.mas-access-header {
    text-align: center;
    margin-bottom: 2rem;
}

.mas-access-title {
    font-size: 2rem;
    font-weight: 700;
    color: #2563eb;
    margin-bottom: 0.5rem;
}

.mas-access-subtitle {
    font-size: 1rem;
    color: #64748b;
}

.mas-access-modal-card input {
    width: 100%;
    padding: 0.95rem 1.1rem;
    border: 2px solid #e2e8f0;
    border-radius: 10px;
    font-size: 1rem;
    margin-bottom: 1.2rem;
    background: #f8fafc;
    transition: all 0.3s ease;
    font-family: inherit;
}

.mas-access-modal-card input::placeholder {
    color: #cbd5e1;
}
.mas-access-modal-card input:focus {
    border-color: #2563eb;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
    outline: none;
    background: #ffffff;
}
.mas-help-text {
    font-size: 0.85rem;
    color: #94a3b8;
    margin-top: -0.8rem;
    margin-bottom: 0.5rem;
}
.mas-access-modal-actions {
    display: flex;
    gap: 1rem;
    justify-content: center;
    margin-top: 2rem;
}
.mas-btn-large {
    padding: 1rem 2rem !important;
    font-size: 1.1rem !important;
    border-radius: 10px !important;
    font-weight: 600 !important;
    transition: all 0.3s ease !important;
}

.mas-access-modal-card .mas-btn-large {
    min-width: 140px;
}

.mas-access-modal-card .mas-btn-blue {
    background: #2563eb !important;
    color: #fff !important;
    box-shadow: 0 6px 18px rgba(37, 99, 235, 0.12);
}

.mas-access-modal-card .mas-btn-blue:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 30px rgba(37, 99, 235, 0.16);
}

.mas-access-modal-card .mas-btn-gray {
    background: #e2e8f0 !important;
    color: #1e293b !important;
    border: 1px solid #cbd5e1 !important;
}

.mas-access-modal-card .mas-btn-gray:hover {
    background: #cbd5e1 !important;
    transform: translateY(-2px);
}

/* --- NOTIFICATION MODAL STYLES (modern, clean design) --- */
#mas-modal-notification {
    display: none !important;
    position: fixed !important;
    z-index: 100001 !important;
    top: 0 !important;
    left: 0 !important;
    width: 100vw !important;
    height: 100vh !important;
    background: rgba(0, 0, 0, 0.5) !important;
    align-items: center !important;
    justify-content: center !important;
}

#mas-modal-notification.active {
    display: flex !important;
}

/* Base modal content - used by multiple modal types */
.mas-modal-content {
    background: #ffffff !important;
    border-radius: 14px !important;
    position: relative !important;
    border: none !important;
    animation: slideUp 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* Standard notification modal (425px max-width) */
#mas-modal-notification .mas-modal-content {
    max-width: 420px !important;
    width: 90vw !important;
    padding: 2rem !important;
    box-shadow: 0 20px 60px rgba(15, 23, 42, 0.2) !important;
    margin: auto !important;
}

/* Answers review modal (900px max-width, custom header) */
#mas-answers-modal .mas-modal-content {
    max-width: 900px !important;
    width: 95vw !important;
    padding: 0 !important;
    max-height: 90vh !important;
    overflow: hidden !important;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3) !important;
}

#mas-modal-message {
    font-size: 1.05rem;
    margin-bottom: 1.5rem;
    color: #1f2937;
    line-height: 1.6;
    font-weight: 500;
}

#mas-modal-actions {
    display: flex !important;
    gap: 0.75rem !important;
    justify-content: flex-end !important;
    flex-wrap: wrap;
}

.mas-modal-close {
    position: absolute !important;
    top: 1rem !important;
    right: 1rem !important;
    font-size: 1.5rem !important;
    background: none !important;
    border: none !important;
    cursor: pointer !important;
    color: #94a3b8;
    transition: color 0.2s ease;
    padding: 0 !important;
    width: auto !important;
    height: auto !important;
    line-height: 1 !important;
}

.mas-modal-close:hover {
    color: #2563eb;
}

/* Answers modal header (teal gradient) */
#mas-answers-modal .mas-modal-header {
    background: linear-gradient(135deg, #14b8a6 0%, #0d9488 100%);
    padding: 1.5rem 2rem;
    color: white;
    position: sticky;
    top: 0;
    z-index: 10;
    border-bottom: 3px solid rgba(255, 255, 255, 0.2);
}

#mas-answers-modal .mas-modal-header h3 {
    margin: 0;
    font-size: 1.75rem;
    font-weight: 800;
}

#mas-answers-modal .mas-answers-modal-close {
    position: absolute !important;
    top: 20px !important;
    right: 20px !important;
    font-size: 1.8rem !important;
    background: rgba(255, 255, 255, 0.2) !important;
    border: none !important;
    cursor: pointer !important;
    color: white !important;
    width: 40px !important;
    height: 40px !important;
    border-radius: 50% !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    font-weight: bold !important;
    transition: all 0.2s !important;
}

#mas-answers-modal .mas-answers-modal-close:hover {
    background: rgba(255, 255, 255, 0.3) !important;
    transform: scale(1.1) !important;
}

/* Answers summary container */
#mas-answers-summary {
    overflow-y: auto;
    max-height: calc(90vh - 120px);
    padding: 2rem;
}

/* --- MAIN ASSESSMENT VIEW LAYOUT (FULLSCREEN, NO SCROLL) --- */
#mas-main-assessment-view {
    display: none;
    flex-direction: column;
    height: 100vh;
    width: 100%;
    overflow: hidden; /* Prevent any overflow */
    position: relative;
    background: #fff;
}

@media (max-width: 768px) {
    #mas-main-assessment-view {
        height: 100%;
        min-height: 100vh;
    }
}
.mas-header {
    width: 100%;
    flex-shrink: 0; /* Don't shrink */
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 1.5rem;
    background: #1f2937;
    color: #fff;
    z-index: 50;
    padding-top: max(0.75rem, env(safe-area-inset-top));
}

@media (max-width: 768px) {
    .mas-header {
        padding: 0.6rem 1rem;
        padding-top: max(0.6rem, env(safe-area-inset-top));
    }
}

@media (max-width: 480px) {
    .mas-header {
        padding: 0.5rem 0.75rem;
        padding-top: max(0.5rem, env(safe-area-inset-top));
    }
}

/* Header Controls - Responsive Layout */
.mas-header-controls {
    display: flex;
    gap: 0.75rem;
    align-items: center;
    flex-wrap: wrap;
}

/* Desktop: Normal button styling */
.mas-header-controls .mas-btn {
    padding: 0.6rem 1rem;
    font-size: 0.95rem;
    white-space: nowrap;
}

/* Mobile: Compact button styling */
@media (max-width: 768px) {
    .mas-header-controls {
        gap: 0.5rem;
    }
    
    .mas-header-controls .mas-btn {
        padding: 0.5rem 0.75rem;
        font-size: 0.85rem;
        flex: 0 1 auto;
    }
}

@media (max-width: 480px) {
    .mas-header-controls {
        gap: 0.4rem;
    }
    
    .mas-header-controls .mas-btn {
        padding: 0.4rem 0.6rem;
        font-size: 0.75rem;
        min-width: 50px;
        min-height: 36px;
        flex: 0 1 auto;
    }
}

#mas-timer-container {
    display: flex;
    align-items: center;
    gap: 10px;
}
#mas-assessment-title {
    /* Title was removed, restoring basic styling */
    font-size: 1.25rem;
    font-weight: 600;
    margin: 1rem 1.5rem;
    color: #1f2937;
}

/* Progress Bar (Fixed Height) */
.mas-progress-bar {
    background-color: #e5e7eb;
    height: 4px;
    width: 100%;
    flex-shrink: 0;
}
.mas-progress-bar-inner {
    background-color: #10b981;
    height: 100%;
    width: 0%;
    transition: width 0.3s ease-in-out;
}

/* Main Layout (Fullscreen, no scroll) */
.mas-body-full {
    flex: 1;
    display: flex;
    flex-direction: row;
    width: 100%;
    overflow: hidden;
}

/* --- MAP AND SIDEBAR VISIBILITY FIX (FULLSCREEN) --- */
.mas-map-sidebar {
    flex: 0 0 300px;
    background: #ffffff;
    border-right: 1px solid #d1d5db;
    padding: 1.5rem;
    overflow-y: auto;
    overflow-x: hidden;
    display: none; /* Hidden by default */
    flex-direction: column;
    gap: 1rem;
    z-index: 10;
}

@media (max-width: 768px) {
    .mas-map-sidebar {
        flex: 0 0 100%;
        position: absolute;
        left: 0;
        top: 0;
        height: 100%;
        border-right: none;
        border-bottom: 1px solid #d1d5db;
    }
}

.mas-map-sidebar.active {
    display: flex; /* Show when active */
}

#mas-map-question-text {
    padding: 1rem;
    font-size: 1.1rem;
    font-weight: 500;
    color: #1f2937;
    background: #fff;
    border-radius: 4px;
    line-height: 1.5;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.mas-body {
    flex: 1;
    display: flex;
    flex-direction: column;
    position: relative;
    overflow: hidden; /* No scroll */
    background: #fff;
}

#mas-question-viewport {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    overflow-y: hidden; /* No scroll - map fills entire space */
    overflow-x: hidden;
    padding: 0; /* No padding */
    z-index: 1;
    position: relative;
}

/* PDF-Only Question Container - Full Height, No Padding/Scrolling */
#mas-question-viewport .mas-question-content.pdf-only-container {
    width: 100%;
    height: 100%;
    max-width: 100%;
    margin: 0;
    padding: 0 !important;
    background: #fff;
    border-radius: 0;
    box-shadow: none;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    justify-content: flex-start;
    text-align: left;
    position: relative;
    overflow: hidden !important;
    min-height: 0;
}

/* Ensure instruction PDF container fills the pdf-only-container */
#mas-question-viewport .mas-question-content.pdf-only-container .instruction-pdf-container {
    width: 100%;
    height: 100%;
    margin: 0;
    padding: 0;
    flex: 1;
    border-radius: 0;
}

/* Map Container - takes full space of viewport (NO BORDERS) */
#user-map-container {
    width: 100%;
    height: 100%;
    min-height: 0;
    display: block;
    overflow: hidden;
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    margin: 0;
    padding: 0;
    border: none;
    background: #ffffff;
    cursor: default;
}

/* Map Overlay - positioned inside viewport */
#mas-map-overlay {
    position: absolute;
    top: 0; 
    left: 0; 
    right: 0; 
    bottom: 0;
    z-index: 10;
    background: rgba(0, 0, 0, 0.3);
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
}
#mas-map-overlay.active {
    opacity: 1;
    pointer-events: auto;
}


/* --- H5P Specific Styles (Restored/Refined) --- */
.mas-question-content {
    width: 100%;
    height: 100%;
    max-width: none;
    margin: 0;
    padding: 2rem;
    background: #fff;
    border-radius: 0;
    box-shadow: none;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    position: relative;
    overflow-x: hidden;
    min-height: 0;
}

/* MCQ & Fill-blank Question Heading */
.mas-question-content h4 {
    font-size: 1.5rem;
    font-weight: 600;
    color: #1f2937;
    margin: 0 0 1.5rem 0;
    padding: 0 3rem;
    line-height: 1.6;
    max-width: 900px;
    letter-spacing: -0.3px;
}

/* MCQ & Fill-blank Paragraph */
.mas-question-content p {
    font-size: 1.25rem;
    font-weight: 500;
    color: #374151;
    margin: 0 0 2.5rem 0;
    padding: 0 3rem;
    line-height: 1.6;
    max-width: 900px;
}

/* MCQ Form Wrapper */
.mas-question-content form {
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0;
}
.mas-question-content.h5p-instruction-content {
    max-width: none;
    width: 100%;
    height: 100%;
    margin: 0;
    padding: 2rem;
    background: white;
    box-shadow: none;
    border-radius: 0;
    z-index: 12;
    align-items: center;
    justify-content: center;
    /* Removed rigid min-height - use viewport height instead */
}
.mas-question-content.h5p-instruction-content h4 {
    /* Ensure the question heading is visible within instruction pages */
    /* hidden: instruction pages don't show question number/title */
    display: none;
}
.mas-question-content.h5p-instruction-content > div:not(h4) {
    width: 100%;
    max-width: 100%;
    margin: 0;
    padding: 0;
}
.h5p-container-identified, .h5p-content-wrapper, .h5p-frame {
    width: 100% !important;
    max-width: 100% !important;
    overflow: hidden !important;
    box-sizing: border-box !important;
}
.h5p-container-identified iframe {
    width: 100% !important;
    height: auto !important;
    min-height: 300px;
    max-height: 600px;
    display: block !important;
}

/* Responsive rules for H5P and instruction embedded media */
.mas-question-content.h5p-instruction-content,
.mas-question-content.h5p-instruction-content .h5p-content-wrapper,
.mas-question-content.h5p-instruction-content .h5p-container-identified {
    width: 100% !important;
    max-width: 100% !important;
    margin: 0 auto !important;
}
.mas-question-content.h5p-instruction-content iframe,
.mas-question-content.h5p-instruction-content video {
    width: 100%;
    height: auto;
    max-height: 70vh;
    aspect-ratio: 16/9;
}

/* --- INSTRUCTION MEDIA CONTAINERS (UPLOADED FILES) --- */
/* Professional Video & PDF Layout */
/* NOTE: .instruction-pdf-container styles moved to PDF VIEWER section below for modern viewer support */

/* --- IMPROVED VIDEO VISIBILITY & LAYOUT --- */
/* Fix for video viewability - prevents "Next" button from being pushed off-screen */
.mas-question-content video {
    display: block;
    margin: 15px auto;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    max-width: 100%;
    height: auto;
}

@media (max-width: 768px) {
    .mas-question-content video {
        max-height: 40vh; /* Shorter on mobile to keep "Next" button visible */
    }
}

.instruction-image-container {
    width: 100%;
    margin-top: 1rem;
    margin-bottom: 1rem;
}

.instruction-image-container img {
    width: 100%;
    max-height: 70vh;
    object-fit: contain;
    display: block;
    border-radius: 4px;
}

/* --- FOOTER / CONTROLS (FIXED) --- */
.mas-footer {
    background-color: #1f2937;
    color: #fff;
    padding: 0.75rem 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-top: 1px solid #d1d5db;
    flex-shrink: 0; /* Don't shrink */
    gap: 1rem;
    width: 100%;
    min-height: 70px;
    padding-bottom: max(0.75rem, env(safe-area-inset-bottom));
}

@media (max-width: 768px) {
    .mas-footer {
        min-height: 60px;
        padding: 0.6rem 1rem;
        padding-bottom: max(0.6rem, env(safe-area-inset-bottom));
    }
}

@media (max-width: 480px) {
    .mas-footer {
        min-height: 50px;
        padding: 0.5rem 0.75rem;
        padding-bottom: max(0.5rem, env(safe-area-inset-bottom));
    }
}
.left-controls { order: 1; display: flex; gap: 0.75rem; }
.center-controls { order: 2; display: flex; gap: 0.75rem; }
#submit-assessment-btn { order: 3; }
#mas-map-controls { display: none; order: 4; }
#mas-map-controls.active { display: flex; }

/* Buttons & Elements */
.mas-btn {
    padding: 0.75rem 1.25rem;
    border: 1px solid transparent;
    border-radius: 6px;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    white-space: nowrap;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
}

.mas-btn:hover:not(:disabled) {
    opacity: 0.9;
    transform: translateY(-1px);
}

.mas-btn:active:not(:disabled) {
    transform: translateY(0);
    opacity: 0.95;
}

.mas-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.mas-btn-green { background-color: #10b981; color: #fff; }
.mas-btn-green:hover:not(:disabled) { background-color: #059669; }

.mas-btn-red { background-color: #ef4444; color: #fff; }
.mas-btn-red:hover:not(:disabled) { background-color: #dc2626; }

.mas-btn-blue { background-color: #3b82f6; color: #fff; }
.mas-btn-blue:hover:not(:disabled) { background-color: #2563eb; }

.mas-btn-gray { background-color: #6b7280; color: #fff; }
.mas-btn-gray:hover:not(:disabled) { background-color: #4b5563; }

.mas-btn-white { background-color: #fff; color: #1f2937; border-color: #d1d5db; }
.mas-btn-white:hover:not(:disabled) { background-color: #f3f4f6; border-color: #9ca3af; }

.mas-btn-dark-yellow { background-color: #f59e0b; color: #fff; }
.mas-btn-dark-yellow:hover:not(:disabled) { background-color: #d97706; }

#flag-question-btn.flagged { background-color: #f59e0b; color: #fff; }
.mas-mcq-option {
    margin-bottom: 1rem;
    width: 100%;
    max-width: 750px;
    display: flex;
    justify-content: center;
}

.mas-mcq-option label {
    display: flex;
    align-items: flex-start;
    gap: 16px;
    font-size: 1.15rem;
    font-weight: 500;
    color: #1e293b;
    padding: 1.25rem 1.5rem;
    background: #f9fafb;
    border: 2px solid #e5e7eb;
    border-radius: 12px;
    word-wrap: break-word;
    word-break: break-word;
    cursor: pointer;
    transition: all 0.3s ease;
    -webkit-user-select: none;
    -moz-user-select: none;
    user-select: none;
    width: 100%;
    text-align: left;
}

.mas-mcq-option label:hover {
    background: #dbeafe;
    border-color: #3b82f6;
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.15);
    transform: translateY(-2px);
}

.mas-mcq-option input[type="radio"],
.mas-mcq-option input[type="checkbox"] {
    cursor: pointer;
    flex-shrink: 0;
    width: 20px;
    height: 20px;
    margin-top: 2px;
}
.mas-fill-blank-dropdown {
    font-size: 1.12rem;
    padding: 0.85rem 1.1rem;
    border: 1.5px solid #dbeafe;
    border-radius: 8px;
    background: #f9fafb;
    min-width: 220px;
    margin: 0.5rem 8px;
    cursor: pointer;
    transition: all 0.2s ease;
}
.mas-fill-blank-dropdown:hover {
    border-color: #0ea5e9;
    background: #f0f9ff;
    box-shadow: 0 2px 6px rgba(6, 182, 212, 0.1);
}
.mas-fill-blank-dropdown:focus {
    outline: none;
    border-color: #0ea5e9;
    box-shadow: 0 0 0 3px rgba(6, 182, 212, 0.1);
}

/* === MAP CURSOR CONTROLS === */
/* Default map cursor - normal pointer (set above in #user-map-container) */

/* Leaflet interactive elements - pointer by default */
#user-map-container .leaflet-interactive,
#user-map-container .leaflet-marker-icon {
    cursor: pointer;
}

/* Map when drawing - blue SVG crosshair (set via JS) */
#user-map-container.drawing-mode {
    cursor: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='32' height='32'><line x1='16' y1='0' x2='16' y2='32' stroke='%232563eb' stroke-width='3'/><line x1='0' y1='16' x2='32' y2='16' stroke='%232563eb' stroke-width='3'/></svg>") 16 16, crosshair;
}

#user-map-container.drawing-mode .leaflet-interactive,
#user-map-container.drawing-mode .leaflet-marker-icon {
    cursor: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='32' height='32'><line x1='16' y1='0' x2='16' y2='32' stroke='%232563eb' stroke-width='3'/><line x1='0' y1='16' x2='32' y2='16' stroke='%232563eb' stroke-width='3'/></svg>") 16 16, crosshair;
}

/* === BRIGHTNESS CONTROLS FOR MAP === */
#mas-question-viewport.brightness-low #user-map-container {
    filter: brightness(0.6) contrast(1.2);
}

#mas-question-viewport.brightness-high #user-map-container {
    filter: brightness(1.3) contrast(0.9);
}

/* Review Modal */
#mas-review-modal {
    width: 280px !important;
    position: absolute;
    bottom: 86px; /* sits above footer */
    right: 16px;
    z-index: 1000;
    background: #ffffff;
    border: 2px solid #2563eb;
    border-radius: 14px;
    box-shadow: 0 12px 32px rgba(37, 99, 235, 0.2);
    color: #1f2937;
    display: none;
    padding: 0;
    max-height: 300px;
    overflow-y: auto;
}

#mas-review-modal.mas-screen-visible {
    display: block;
}

.review-modal-header {
    padding: 0.8rem;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    border-bottom: 2px solid #e5e7eb;
    background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
}

.mas-review-modal-close {
    background: rgba(255, 255, 255, 0.25) !important;
    border: 2px solid rgba(255, 255, 255, 0.4) !important;
    cursor: pointer !important;
    color: white !important;
    width: 36px !important;
    height: 36px !important;
    border-radius: 50% !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    font-weight: bold !important;
    font-size: 1.6rem !important;
    transition: all 0.3s ease !important;
    padding: 0 !important;
    margin: 0 !important;
    line-height: 1 !important;
}

.mas-review-modal-close:hover {
    background: rgba(255, 255, 255, 0.35) !important;
    border-color: rgba(255, 255, 255, 0.6) !important;
    transform: scale(1.12) rotate(90deg) !important;
}

#review-questions-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 10px;
    padding: 1rem;
    width: 100%;
    max-height: 300px;
    overflow-y: auto;
    background: transparent;
    border-radius: 0;
    grid-auto-rows: max-content;
}

.review-grid-item {
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 0;
}

.review-grid-item a {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    aspect-ratio: 1 / 1;
    background: #f3f4f6;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    font-weight: 600;
    font-size: 0.95rem;
    color: #1f2937;
    text-decoration: none;
    transition: all 0.2s ease;
    cursor: pointer;
    position: relative;
    min-height: 50px;
}

.review-grid-item a:hover {
    background: #dbeafe;
    border-color: #2563eb;
    color: #2563eb;
}

.review-grid-item a::before {
    content: attr(data-status);
    position: absolute;
    font-size: 0.6rem;
    top: 2px;
    right: 2px;
}

/* State colors controlled by JS classes on .review-grid-item */
.review-grid-item.flagged a {
    background: #fff5f5; /* light red */
    border-color: #ef4444;
    color: #b91c1c;
}
.review-grid-item.flagged a:hover {
    background: #fee2e2;
    border-color: #ef4444;
    color: #ef4444;
}
.review-grid-item.completed a {
    background: #ecfdf5; /* light green */
    border-color: #10b981;
    color: #065f46;
}
.review-grid-item.completed a:hover {
    background: #bbf7d0;
    border-color: #10b981;
    color: #065f46;
}
.review-grid-item.unstarted a {
    background: #ffffff; /* keep white */
    border-color: #e5e7eb;
    color: #1f2937;
}

/* --- MOBILE & TABLET STYLES --- */
@media (max-width: 1023px) {
    /* If the sidebar is not supposed to be used, hide the toggle */
    #mas-sidebar-toggle { display: none !important; }
}

@media (max-width: 767px) {
    /* Header/Footer Layout Adjustments - Horizontal on tablets */
    .mas-header {
        flex-direction: row;
        gap: 0.5rem;
        padding: 0.6rem;
        flex-wrap: wrap;
    }
    .mas-header-controls {
        width: auto;
        gap: 0.4rem;
        flex-wrap: wrap;
    }
    .mas-btn {
        height: 36px;
        font-size: 0.9rem;
        padding: 0.5rem 0.8rem;
    }
    .mas-footer {
        flex-direction: row;
        gap: 0.5rem;
        padding: 0.6rem;
        flex-wrap: wrap;
        justify-content: flex-start;
    }
    .left-controls, .center-controls {
        flex: 0 1 auto;
        justify-content: flex-start;
        flex-wrap: wrap;
        gap: 0.4rem;
    }
    #submit-assessment-btn { flex: 0 1 auto; }
    .mas-btn-large {
        padding: 0.6rem 1rem !important;
        font-size: 0.95rem !important;
    }
    .mas-question-content {
        padding: 1.5rem;
        margin: 1rem auto;
    }
    .mas-mcq-option label {
        font-size: 1.05rem;
        padding: 0.8rem 1rem;
        gap: 12px;
    }
    #mas-review-modal {
        width: 90vw;
        position: absolute;
        right: 1rem;
        bottom: 3.5rem;
        max-height: 260px;
    }
}

@media (max-width: 575px) {
    /* Smallest Mobile Sizes */
    .mas-header { 
        padding: 0.5rem 0.4rem; 
        flex-direction: row;
        gap: 0.3rem;
    }
    .mas-footer { 
        padding: 0.5rem 0.4rem; 
        flex-direction: row;
        gap: 0.3rem;
    }
    .mas-btn { 
        padding: 0.5rem 0.6rem; 
        font-size: 0.85rem; 
        height: 34px;
        flex: 1 1 auto; 
        min-width: 70px;
        white-space: nowrap;
    }
    .left-controls, .center-controls {
        flex-direction: row;
        gap: 0.3rem;
        flex-wrap: wrap;
    }
    #mas-review-modal {
        width: 95vw;
        position: absolute;
        right: 0.5rem;
        bottom: 2.5rem;
        border-radius: 8px;
        max-height: 45vh;
    }
    #user-map-container {
        /* Ensure map is not too tall on tiny screens */
        min-height: 350px !important; 
        height: auto !important;
    }
    .mas-access-modal-card {
        padding: 1.25rem;
        width: 95%;
    }
    .mas-access-modal-card h2 {
        font-size: 1.5rem;
    }
    .mas-access-modal-card p {
        font-size: 0.95rem;
    }
    .mas-access-modal-actions {
        flex-direction: row;
        gap: 0.5rem;
    }
    .mas-btn-large {
        padding: 0.6rem 0.8rem !important;
        font-size: 0.9rem !important;
        flex: 1 1 auto;
    }
    .mas-question-content {
        padding: 1.2rem;
        margin: 0.8rem auto;
    }
    .mas-mcq-option label {
        font-size: 1rem;
        padding: 0.8rem 0.9rem;
        gap: 10px;
    }
    .mas-fill-blank-dropdown {
        font-size: 1rem;
        padding: 0.7rem 0.9rem;
        min-width: 180px;
    }
    .review-grid-item a {
        font-size: 0.85rem;
    }
}

/* === EXTRACTED INLINE STYLES FROM JAVASCRIPT === */
/* These classes replace inline style="" attributes in user-script.js */

/* --- Error Message --- */
.mas-error-message,
.mas-error {
    max-width: 600px;
    margin: 40px auto;
    padding: 20px;
    background: #fee2e2;
    border: 2px solid #ef4444;
    border-radius: 8px;
    color: #991b1b;
    font-weight: 600;
    text-align: center;
}

/* --- Map Container (when dynamically created) --- */
.mas-map-container,
.mas-dynamic-map-container {
    width: 100%;
    height: 70vh;
    min-height: 500px;
    border-radius: 12px;
}

/* --- Instant Correction Span (Fill Blank) --- */
.mas-instant-correction {
    color: #10b981;
    margin-left: 5px;
    display: none;
    font-weight: 500;
}

.mas-instant-correction span {
    font-weight: bold;
    color: #065f46;
}

/* --- View Answers Button --- */
#mas-view-answers-btn {
    margin-top: 1.5em;
}

/* --- Answers Modal (backdrop + container) --- */
#mas-answers-modal {
    display: none !important;
    position: fixed !important;
    z-index: 100000 !important;
    top: 0 !important;
    left: 0 !important;
    width: 100vw !important;
    height: 100vh !important;
    background: rgba(0, 0, 0, 0.6) !important;
    align-items: center !important;
    justify-content: center !important;
    -webkit-backdrop-filter: blur(4px) !important;
    backdrop-filter: blur(4px) !important;
}

#mas-answers-modal[style*="display: flex"] {
    display: flex !important;
}
#mas-answers-modal.active {
    display: flex !important;
}

/* --- Review Summary Cards --- */
.mas-review-card {
    margin-bottom: 2rem;
    border: 2px solid #e5e7eb;
    border-radius: 12px;
    overflow: hidden;
    background: #fafafa;
}

.mas-review-card-header {
    background: #f3f4f6;
    padding: 1rem 1.5rem;
    border-bottom: 2px solid #7c7c7cff;
    display: flex;
    align-items: center;
    gap: 1rem;
}

.mas-review-card-header-badge {
    background: #14b8a6;
    color: white;
    font-weight: 800;
    font-size: 0.9rem;
    padding: 0.4rem 0.8rem;
    border-radius: 6px;
    min-width: 45px;
    text-align: center;
}

.mas-review-card-header-type {
    background: white;
    color: #64748b;
    font-weight: 700;
    font-size: 0.75rem;
    text-transform: uppercase;
    padding: 0.4rem 0.8rem;
    border-radius: 6px;
    letter-spacing: 0.5px;
}

.mas-review-card-header h4 {
    margin: 0;
    font-size: 1.1rem;
    font-weight: 600;
    color: #1f2937;
    flex: 1;
}

.mas-review-card-content {
    padding: 1.5rem;
}

.mas-review-question-text {
    padding: 1.5rem 1.5rem 0.5rem 1.5rem;
    background: white;
    border-bottom: 1px solid #e5e7eb;
    font-weight: 600;
    color: #374151;
    font-size: 1rem;
    line-height: 1.6;
}

.mas-review-grid-answers {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
}

.mas-review-answer-section-label {
    font-weight: 700;
    color: #64748b;
    font-size: 0.85rem;
    text-transform: uppercase;
    margin-bottom: 0.8rem;
    letter-spacing: 0.5px;
}

.mas-review-correct-section-label {
    font-weight: 700;
    color: #10b981;
    font-size: 0.85rem;
    text-transform: uppercase;
    margin-bottom: 0.8rem;
    letter-spacing: 0.5px;
}

/* --- Answer Option Boxes --- */
.mas-answer-box {
    padding: 0.8rem 1rem;
    border-radius: 8px;
    margin-bottom: 0.5rem;
    color: #374151;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.mas-answer-box-icon {
    font-size: 1.2rem;
    flex-shrink: 0;
}

.mas-answer-box-text {
    flex: 1;
}

/* Correct Answer Box */
.mas-answer-correct {
    background: #d1fae5;
    border: 2px solid #10b981;
    color: #065f46;
}

/* User Answer - Correct */
.mas-answer-user-correct {
    background: #d1fae5;
    border: 2px solid #10b981;
    color: #065f46;
}

/* User Answer - Incorrect */
.mas-answer-user-incorrect {
    background: #fee2e2;
    border: 2px solid #ef4444;
    color: #991b1b;
}

.mas-answer-user-incorrect .mas-answer-box-text {
    text-decoration: line-through;
}

/* User Answer - Not Answered */
.mas-answer-not-answered {
    background: #fef3c7;
    border: 2px solid #f59e0b;
    color: #92400e;
    font-style: italic;
}

/* Fill Blank Answer Boxes */
.mas-blank-label {
    font-weight: 900;
    font-size: 0.8rem;
    background: rgba(0, 0, 0, 0.1);
    padding: 0.2rem 0.6rem;
    border-radius: 4px;
}

.mas-blank-label-correct {
    background: rgba(16, 185, 129, 0.2);
}

/* Map Question Info Box */
.mas-map-question-info {
    background: #f0fdfa;
    border: 2px solid #14b8a6;
    padding: 1.2rem;
    border-radius: 8px;
    text-align: center;
}

.mas-map-question-info-icon {
    font-size: 3rem;
    margin-bottom: 0.5rem;
}

.mas-map-question-info-title {
    font-weight: 700;
    color: #0d9488;
    font-size: 1.1rem;
}

.mas-map-question-info-subtitle {
    color: #64748b;
    margin-top: 0.5rem;
    font-size: 0.9rem;
    font-style: italic;
}

/* --- Completion Message & Score Card --- */
.mas-completion-message {
    text-align: center;
    padding: 2rem;
}

@keyframes scaleUp {
    from {
        transform: scale(0) rotate(-45deg);
        opacity: 0;
    }
    to {
        transform: scale(1) rotate(0deg);
        opacity: 1;
    }
}

@keyframes slideInUp {
    from {
        transform: translateY(30px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.mas-completion-container {
    animation: slideInUp 0.6s ease-out;
}

.mas-completion-card {
    animation: slideInUp 0.8s ease-out 0.2s both;
}

.mas-completion-card h1 {
    background: linear-gradient(135deg, #0369a1, #2563eb);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.mas-completion-card > div:nth-child(4) {
    animation: slideInUp 1s ease-out 0.4s both;
}

.mas-completion-card > div:nth-child(5) {
    animation: slideInUp 1.2s ease-out 0.6s both;
}

.mas-completion-card button:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15) !important;
}

.mas-score-summary {
    margin-top: 2rem;
    padding: 1.5rem;
    background: linear-gradient(135deg, #f0fdfa 0%, #ecfdf5 100%);
    border: 2px solid #14b8a6;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 1rem;
}

.mas-score-display {
    text-align: left;
}

.mas-score-label {
    font-size: 0.9rem;
    color: #64748b;
    font-weight: 600;
    margin-bottom: 0.3rem;
}

.mas-score-number {
    font-size: 2.5rem;
    font-weight: 800;
    line-height: 1;
    margin-top: 0.2rem;
}

.mas-score-percentage {
    font-size: 1.2rem;
    font-weight: 700;
    margin-top: 0.2rem;
}

.mas-score-meta {
    text-align: right;
}

.mas-score-meta-item {
    margin-bottom: 0.5rem;
}

.mas-score-meta-label {
    font-weight: 600;
    color: #64748b;
}

.mas-score-meta-value {
    color: #1f2937;
    font-weight: 700;
}

/* ===================================== */
/* PDF VIEWER - Modern Book View Styles */
/* ===================================== */

.instruction-pdf-container {
    display: flex;
    flex-direction: column;
    width: 100%;
    max-width: 100%;
    height: 100%;
    margin: 0;
    padding: 0;
    background: #f9fafb;
    border-radius: 0;
    overflow: hidden;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08);
    flex: 1;
    align-self: stretch;
}

/* PDF Viewer Toolbar */
.pdf-viewer-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 14px;
    background: linear-gradient(135deg, #ffffff 0%, #f3f4f6 100%);
    border-bottom: 2px solid #e5e7eb;
    flex-wrap: wrap;
    gap: 10px;
    min-height: 48px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
    flex-shrink: 0;
    border-top-left-radius: 0;
    border-top-right-radius: 0;
}

.pdf-viewer-controls-left {
    display: flex;
    align-items: center;
    gap: 8px;
}

.pdf-separator {
    width: 1px;
    height: 24px;
    background: #d1d5db;
    margin: 0 4px;
}

/* PDF Viewer Buttons */
.pdf-viewer-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    padding: 0;
    border: 2px solid #d1d5db;
    background: white;
    color: #374151;
    font-size: 16px;
    font-weight: 600;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    -webkit-user-select: none;
    user-select: none;
}

.pdf-viewer-btn:hover {
    background: #f3f4f6;
    border-color: #2563eb;
    color: #2563eb;
    box-shadow: 0 2px 8px rgba(37, 99, 235, 0.15);
    transform: translateY(-2px);
}

.pdf-viewer-btn.active {
    background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
    border-color: #1d4ed8;
    color: white;
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.3);
}

.pdf-viewer-btn:active {
    transform: translateY(0);
    box-shadow: 0 1px 4px rgba(37, 99, 235, 0.2);
}

/* Zoom Level Display */
.pdf-zoom-level {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 60px;
    padding: 6px 12px;
    background: white;
    border: 2px solid #d1d5db;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 700;
    color: #374151;
    text-align: center;
}

/* Normal MCQ/Fill-Blank Questions - Keep Original Padding */
#mas-question-viewport .mas-question-content:not(.pdf-only-container) {
    padding: 2rem;
}

/* PDF Viewer Wrapper */
.pdf-viewer-wrapper {
    flex: 1;
    width: 100%;
    background: white;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    overflow: auto;
    border: 1px solid #e5e7eb;
    border-bottom-left-radius: 12px;
    border-bottom-right-radius: 12px;
    transition: all 0.3s ease;
    position: relative;
    min-height: 600px;
}

/* PDF Iframe */
.pdf-iframe {
    display: block !important;
    width: 100% !important;
    height: 100% !important;
    min-height: 600px;
    border: none !important;
}

/* PDF-Only Container Layout */
.pdf-only-container {
    padding: 0 !important;
    margin: 0 !important;
    height: 100%;
    display: flex;
    flex-direction: column;
}

.pdf-only-container .instruction-pdf-container {
    margin: 0;
    padding: 0;
    flex: 1;
    border-radius: 12px;
}

/* Responsive Design for PDF Viewer */
@media (max-width: 768px) {
    .instruction-pdf-container {
        border-radius: 8px;
        margin: 0;
    }

    .pdf-viewer-toolbar {
        padding: 8px 10px;
        min-height: 42px;
        gap: 6px;
    }

    .pdf-viewer-btn {
        width: 32px;
        height: 32px;
        font-size: 14px;
    }

    .pdf-zoom-level {
        min-width: 50px;
        padding: 4px 8px;
        font-size: 12px;
    }

    .pdf-viewer-wrapper {
        min-height: 400px;
    }

    .pdf-iframe {
        min-height: 400px !important;
    }
}

/* Book View Enhancement */
.pdf-viewer-wrapper.book-view {
    justify-content: center;
    align-items: center;
}

.pdf-viewer-wrapper.book-view .pdf-iframe {
    max-width: 95%;
}