/* Prevent overscroll bounce effects on mobile */
html, body {
    margin: 0;
    padding: 0;
    overscroll-behavior: none;
    -webkit-overflow-scrolling: touch;
    overflow: hidden;
}

/* Global rule to prevent any border radius */
* {
}

#content_container {
    width: 100%;
    overflow-y: hidden; /* Disable default scrolling */
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start; /* Changed from center to flex-start */
    position: relative;
    height: 100%; /* Use 100% height to work properly inside iframe */
    min-height: 100%; /* Ensure minimum height */
    scroll-snap-type: y mandatory; /* Enable snap scrolling */
    -webkit-overflow-scrolling: touch; /* Smooth scrolling on iOS */
    scroll-behavior: smooth;
    border-radius: 0 !important; /* Ensure no border radius on any device */
    overscroll-behavior: none; /* Prevent bounce */
    overflow: hidden; /* Prevent any overflow */
    background-color: #1a2332; /* Dark blue background */
}


#content_outer {
    padding: 0px;
    display: flex;
    justify-content: flex-start;
    align-items: center;

      
}

.content-item {
    margin-bottom: 0px;
    padding: 0px;
    background-color: #1a2332; /* Dark blue background */
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    scroll-snap-align: start;
    width: 100%;
    height: 100%; /* Keep 100% height for iframe compatibility */
    min-height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: flex-start; /* Changed back to flex-start since metadata is now absolute */
    align-items: center;
    box-sizing: border-box;
    position: relative;
    overflow: visible; /* Allow metadata to expand beyond container if needed */
}

.overlay-section {
    position: absolute;
    width: 50px;    
    bottom: 5px; /* Lower the section to be 15px from the bottom */
    display: flex;
    flex-direction: column;
    justify-content: flex-start; /* This is fine since we position the whole container */
    align-items: center;
    height: auto;
    right: 0;
    margin-right: 0; /* Remove any margin from right border */
    background-color: transparent; /* Semi-transparent dark blue */
    z-index: 3; /* Ensure it's above the metadata section */
}

.like-button {
    padding: 2px 0;
    margin: 2px 0;
    background-color: transparent;
    border: none;
    cursor: pointer;
    font-size: 2em;  /* Match the inline style */
    color: #ffffff;
    transition: color 0.3s ease;
    -webkit-text-stroke: none;
    text-stroke: none;
}

.like-button.liked {
    color: #ff4444 !important; /* Brighter red color when liked - force override */
    -webkit-text-stroke: none; /* Remove any text stroke on mobile */
    text-stroke: none; /* Remove any text stroke on mobile */
}

.like-button:hover {
    color: #a9a9a9; /* Slightly darker grey on hover */
}

.save-button {
    padding: 2px 0;
    margin: 2px 0;
    background-color: transparent;
    border: none;
    cursor: pointer;
    font-size: 2em;  /* Match the inline style */
    color: #007bff;
    transform: rotate(0deg);
    transition: transform 0.3s ease, color 0.3s ease;
}

.save-button:hover {
    color: #0056b3; /* Darker blue for bookmark icon on hover */
    transform: rotate(0deg); /* Reset rotation on hover */
}

/* Hide save button for non-flashcard content types */
.save-button[data-content-type]:not([data-content-type="flashcard statement"]) {
    visibility: hidden !important;
    pointer-events: none !important;
}

.share-button {
    padding: 2px 0;
    margin: 2px 0;
    background-color: transparent; /* Transparent background */
    border: none; /* Remove border */
    cursor: pointer;
    font-size: 1.5em; /* Adjust icon size */
    color: #007bff; /* Default color */
    transition: color 0.3s ease; /* Smooth color transition */
}

.scroll-buttons {
    padding: 2px 0;
    margin: 2px 0;
    background-color: transparent;
    border: none;
    cursor: pointer;
    font-size: 2em;
    color: #20c997;
    transition: color 0.3s ease;
    font-weight: bold;
}


.share-button:hover {
    color: #0056b3; /* Darker blue for share icon on hover */
}

.creator-button {
    padding: 2px 0;
    margin: 2px 0;
    background-color: transparent; /* Transparent background */
    border: none; /* Remove border */
    cursor: pointer;
    font-size: 1.5em; /* Adjust icon size */
    color: #007bff; /* Default color */
    transition: color 0.3s ease; /* Smooth color transition */
}

.creator-button:hover {
    color: #0056b3; /* Darker blue for creator icon on hover */
}

.question-section {
    flex: 0.7 0.7 auto; /* 30% smaller flex ratio */
    display: flex;
    justify-content: flex-start; /* Changed from center to flex-start for left alignment */
    align-items: center;
    font-size: clamp(1em, 4vw, 1.5em); /* Responsive font size */
    text-align: left; /* Changed from center to left */
    padding: clamp(8px, 2vw, 15px);
    background-color: #1a2332; /* Darker blue for question section */
    width: 100%;
    box-sizing: border-box;
    line-height: 1.5;
    min-height: 80px; /* Minimum height for touch targets */
    max-height: 50vh; /* Prevent overflow on small screens */
    color: #ffffff; /* White text for dark background */
}

/* Special styling for flashcard question sections to take up all available space */
.question-section:has(.view-container) {
    flex: 1; /* Take up all available space */
    min-height: 60vh; /* Ensure it takes up most of the viewport */
    max-height: none; /* Remove max-height constraint */
}

/* Ensure flashcard answer elements have proper dark theme styling */
.question-section .answer {
    background-color: transparent !important; /* Transparent background */
    color: #ffffff !important; /* White text */
    border: 1px solid #4a5568 !important; /* Dark border */
}

.MathJax, .MathJax_Display {
    /* Keep this simple, alignment is handled by the container now */
    vertical-align: middle;
}

/* Specific alignment for multiple choice questions */
.question-section.align-left {
    text-align: left !important;
}

/* Short answer specific styling */
.content-item:has(.shortanswer-section) .question-section {
    min-height: 35px !important; /* Reduced height for short answer questions */
    max-height: 30vh !important; /* Reduced max height */
}

.content-item:has(.shortanswer-section) .shortanswer-section textarea {
    min-height: 195px !important; /* Increased height for short answer textarea */
    resize: vertical;
    background-color: #2a3441 !important; /* Dark background to match theme */
    color: #ffffff !important; /* White text for contrast */
    border: 1px solid #4a5568 !important; /* Darker border to match theme */
    border-radius: 4px !important;
    padding: 10px !important;
    font-size: 1.2em !important;
    font-family: inherit !important;
    box-sizing: border-box !important;
    outline: none !important;
    transition: border-color 0.3s ease, box-shadow 0.3s ease !important;
}

.content-item:has(.shortanswer-section) .shortanswer-section textarea:disabled {
    color: #ffffff !important;
    -webkit-text-fill-color: #ffffff !important; /* For Safari/iOS */
    opacity: 1 !important; /* Ensure full opacity */
    background-color: #2a3441 !important; /* Keep background color consistent */
}

.content-item:has(.shortanswer-section) .shortanswer-section textarea:focus {
    border-color: #667eea !important; /* Highlight border on focus */
    box-shadow: 0 0 0 2px rgba(102, 126, 234, 0.2) !important; /* Subtle glow effect */
}

.content-item:has(.shortanswer-section) .shortanswer-section textarea::placeholder {
    color: #a0a0a0 !important; /* Light gray placeholder text */
}

.content-item:has(.shortanswer-section) .shortanswer-section .word-counter {
    color: #a0a0a0 !important; /* Light gray for better visibility on dark background */
}

/* Style for disabled submit button in short answer */
.content-item:has(.shortanswer-section) .shortanswer-section .submit-button:disabled {
    background: #6c757d !important; /* Grey background for disabled state */
    color: #ffffff !important; /* White text */
    cursor: not-allowed !important;
    opacity: 0.7 !important; /* Slightly transparent */
    transform: none !important; /* Remove any hover effects */
    box-shadow: none !important; /* Remove shadow effects */
}

.content-item:has(.shortanswer-section) .shortanswer-section .submit-button:disabled:hover {
    transform: none !important; /* Prevent hover effects on disabled button */
    box-shadow: none !important;
    background: #6c757d !important; /* Keep same background on hover */
}

.content-item:has(.shortanswer-section) .shortanswer-section .submit-button {
    font-weight: bold !important; /* Make text bold */
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%) !important; /* Modern gradient */
    border: none !important;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4) !important; /* Subtle shadow */
    transition: all 0.3s ease !important; /* Smooth transitions */
    margin: 0 auto !important; /* Center the button */
    display: block !important; /* Make it a block element for margin auto to work */
}

.content-item:has(.shortanswer-section) .shortanswer-section .submit-button:hover {
    transform: translateY(-2px) !important; /* Slight lift on hover */
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.6) !important; /* Enhanced shadow on hover */
    background: linear-gradient(135deg, #5a6fd8 0%, #6a4190 100%) !important; /* Darker gradient on hover */
}

.content-item:has(.shortanswer-section) .shortanswer-section .submit-button:active {
    transform: translateY(0) !important; /* Return to original position when clicked */
    box-shadow: 0 2px 10px rgba(102, 126, 234, 0.4) !important; /* Reduced shadow when active */
}

/* Modern design for fill-in-blank input fields */
.blank-input {
    padding: 4px 10px !important;
    border: 2px solid #ccc !important;
    border-radius: 20px !important;
    width: 150px !important;
    display: inline-block !important;
    vertical-align: baseline !important;
    line-height: 1.2 !important;
    font-size: 14px !important;
    box-sizing: border-box !important;
    margin: 0 !important;
    outline: none !important;
    background-color: #ffffff !important;
    color: #333333 !important;
}

.blank-input:focus {
    border-color: #667eea !important;
    box-shadow: 0 0 0 2px rgba(102, 126, 234, 0.2) !important;
}

/* Modern design for fill-in-blank submit buttons */
.content-item:has(.blank-input) .choice-section .submit-button {
    font-size: 1.2em !important; /* Bigger text for submit button */
    font-weight: bold !important; /* Make text bold */
    border-radius: 25px !important; /* Rounder corners */
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%) !important; /* Modern gradient */
    border: none !important;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4) !important; /* Subtle shadow */
    transition: all 0.3s ease !important; /* Smooth transitions */
    padding: 12px 24px !important; /* Same padding as short answer submit button */
    width: 250px !important; /* Longer width for better proportions */
    min-height: 44px !important; /* Ensure minimum touch target size */
    text-align: center !important; /* Center text like short answer button */
    white-space: nowrap !important; /* Prevent text wrapping */
    margin: 0 auto !important; /* Center the button */
    display: block !important; /* Make it a block element for margin auto to work */
}

.content-item:has(.blank-input) .choice-section .submit-button:hover {
    transform: translateY(-2px) !important; /* Slight lift on hover */
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.6) !important; /* Enhanced shadow on hover */
    background: linear-gradient(135deg, #5a6fd8 0%, #6a4190 100%) !important; /* Darker gradient on hover */
}

.content-item:has(.blank-input) .choice-section .submit-button:active {
    transform: translateY(0) !important; /* Return to original position when clicked */
    box-shadow: 0 2px 10px rgba(102, 126, 234, 0.4) !important; /* Reduced shadow when active */
}

/* Modern design for flashcard toggle buttons */
.content-item:has(.view-container) .toggle-answer-button {
    font-size: 1em !important; /* Bigger text for button */
    font-weight: bold !important; /* Make text bold */
    color: #ffffff !important; /* White text color */
    border-radius: 25px !important; /* Rounder corners */
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%) !important; /* Modern gradient */
    border: none !important;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4) !important; /* Subtle shadow */
    transition: all 0.3s ease !important; /* Smooth transitions */
    padding: 8px 16px !important; /* More padding for better proportions */
    width: 250px !important; /* Maintain original width */
}

.content-item:has(.view-container) .toggle-answer-button:hover {
    transform: translateY(-2px) !important; /* Slight lift on hover */
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.6) !important; /* Enhanced shadow on hover */
    background: linear-gradient(135deg, #5a6fd8 0%, #6a4190 100%) !important; /* Darker gradient on hover */
}

.content-item:has(.view-container) .toggle-answer-button:active {
    transform: translateY(0) !important; /* Return to original position when clicked */
    box-shadow: 0 2px 10px rgba(102, 126, 234, 0.4) !important; /* Reduced shadow when active */
}

.content-item:has(.view-container) .toggle-answer-button.answered {
    background: linear-gradient(135deg, #48bb78 0%, #38a169 100%) !important; /* Green gradient for answered state */
    box-shadow: 0 4px 15px rgba(72, 187, 120, 0.4) !important; /* Green shadow */
}

.content-item:has(.view-container) .toggle-answer-button.answered:hover {
    background: linear-gradient(135deg, #38a169 0%, #2f855a 100%) !important; /* Darker green gradient on hover */
    box-shadow: 0 6px 20px rgba(72, 187, 120, 0.6) !important; /* Enhanced green shadow on hover */
}

.choice-section {
    flex: 1.1 1.1 auto; /* 30% larger flex ratio to compensate */
    display: flex;
    flex-direction: column;
    justify-content: flex-start; /* Align content to top */
    align-items: flex-start;
    font-size: clamp(0.9em, 3.5vw, 1.2em); /* Responsive font size */
    padding: clamp(12px, 3vw, 20px);
    background-color: #1a2332; /* Darker blue for choice section */
    width: 100%;
    box-sizing: border-box;
    min-height: 120px; /* Minimum height for choice buttons */
    max-height: 60vh; /* Increased max-height to fill space */
    color: #ffffff; /* White text for dark background */
    margin-bottom: 80px; /* Add margin to ensure space for metadata section */
}

.choice-section ul {
    list-style: none;
    padding: 0;
    width: 100%;
    margin: 0;
}

.choice-section li {
    margin: 8px 0;
    width: 100%;
}

.choice-section button {
    width: 90%;
    padding: clamp(8px, 2vw, 12px) clamp(12px, 3vw, 16px);
    text-align: left;
    border: 1px solid #4a5568;
    border-radius: 4px;
    background-color: #3a4551; /* Dark blue button background */
    cursor: pointer;
    font-size: clamp(0.8em, 3vw, 1em);
    transition: all 0.2s ease;
    color: #ffffff; /* White text for dark background */
    min-height: 44px; /* Minimum touch target size */
}

.choice-section button:disabled {
    cursor: not-allowed;
    color: #212529 !important; /* Maintain text color when disabled */
    opacity: 1; /* Ensure full opacity */
}

/* Override disabled text color for unselected options to keep them visible */
.choice-section button:disabled:not([style*="background-color: #86efac"]):not([style*="background-color: #fca5a5"]) {
    color: #ffffff !important; /* Keep white text for unselected disabled options */
}

.choice-section button:hover {
    background-color: #4a5568; /* Darker blue on hover */
    border-color: #667eea;
}

.choice-section #feedback {
    margin-top: 16px;
    text-align: center;
    font-size: 1.1em;
    min-height: 2em;
    overflow: hidden;
    white-space: pre-wrap;
    word-wrap: break-word;
}

.answer-section {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0; /* Leave space for overlay-section (50px width + 10px margin) */
    display: flex;
    justify-content: flex-start;
    align-items: flex-start;
    font-size: clamp(0.8em, 3vw, 1.2em);
    text-align: left;
    padding: 0;
    background-color: #1a2332; /* Dark blue for metadata section */
    box-sizing: border-box;
    min-height: 60px;
    max-height: 40vh; /* Increased from 25vh to 40vh for more space */
    overflow-y: auto; /* Allow scrolling if content still exceeds height */
    z-index: 2; /* Ensure it's above content but below overlay */
    pointer-events: auto; /* Ensure metadata is clickable */
}

/* Responsive design */
@media (max-width: 480px) {
    /* Hide scroll buttons on mobile */
    .scroll-buttons {
        display: none !important;
    }
    
    /* Mobile-specific like button styling */
    .like-button {
        color: #ffffff !important; /* Force solid white on mobile */
        -webkit-text-stroke: none !important; /* Remove any text stroke */
        text-stroke: none !important; /* Remove any text stroke */
    }
    
    .like-button.liked {
        color: #ff4444 !important; /* Force red color when liked on mobile */
        -webkit-text-stroke: none !important; /* Remove any text stroke */
        text-stroke: none !important; /* Remove any text stroke */
    }
    
    .content-item {
        padding: 2px; /* Minimal padding for mobile */
    }
    
    .question-section {
        min-height: 60px;
        max-height: 40vh;
        font-size: clamp(1.4em, 5.5vw, 2em) !important; /* Bigger text for mobile - larger than choice section */
        padding: 5px 3px; /* Minimal horizontal padding for mobile */
    }
    
    .choice-section {
        min-height: 100px;
        max-height: 35vh; /* Reduced for mobile */
        margin-bottom: 70px; /* Reduced margin for mobile */
        font-size: clamp(1.1em, 4.5vw, 1.6em) !important; /* Bigger text for mobile */
        padding: 0 3px; /* Minimal horizontal padding for mobile */
    }
    
    .choice-section button {
        font-size: clamp(1.1em, 4.5vw, 1.6em) !important; /* Bigger button text for mobile */
        padding: 8px 5px; /* Minimal button padding for mobile */
        margin: 2px 0; /* Minimal vertical margin between buttons */
    }
    
    .choice-section ul {
        padding-left: 5px; /* Minimal left padding for list */
        margin: 0; /* Remove default margins */
    }
    
    .answer-section {
        min-height: 50px;
        max-height: 35vh; /* Increased from 20vh to 35vh for more mobile space */
        right: 0; /* Maintain space for overlay on mobile */
        padding: 5px 3px; /* Minimal horizontal padding for mobile */
        overflow-y: auto; /* Allow scrolling if content exceeds height on mobile */
    }
    
    .question-metadata {
        padding: 1px 2px 1px 0; /* Very minimal padding for mobile */
    }
    
    .metadata-item {
        font-size: 1.3em !important; /* Much bigger text for mobile */
        margin-bottom: 1px; /* Very minimal margin for mobile */
        padding: 1px 5px 1px 0; /* Balanced padding for mobile, removed left padding */
        line-height: 1.1; /* Better line height for mobile readability */
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }
    
    .metadata-label {
        font-size: 0.9em !important; /* Smaller text for mobile labels */
        min-width: 45px; /* Much narrower for mobile */
        margin-right: 0.2em !important; /* Much smaller space for mobile */
        font-weight: bold !important; /* Make labels bold on mobile */
    }
}

/* Tablet responsive adjustments */
@media (min-width: 481px) and (max-width: 768px) {
    /* Hide scroll buttons on tablet */
    .scroll-buttons {
        display: none !important;
    }
    
    /* Tablet-specific like button styling */
    .like-button {
        color: #ffffff !important; /* Force solid white on tablet */
        -webkit-text-stroke: none !important; /* Remove any text stroke */
        text-stroke: none !important; /* Remove any text stroke */
        font-size: 2em !important; /* Larger icons for tablet */
        padding: 10px 0 !important; /* More padding for better touch targets, no left/right padding */
    }
    
    .like-button.liked {
        color: #ff4444 !important; /* Force red color when liked on tablet */
        -webkit-text-stroke: none !important; /* Remove any text stroke */
        text-stroke: none !important; /* Remove any text stroke */
    }
    
    /* Tablet-specific styling for all interaction buttons */
    .save-button,
    .share-button,
    .creator-button,
    .report_button {
        font-size: 2em !important; /* Larger icons for tablet */
        padding: 10px 0 !important; /* More padding for better touch targets, no left/right padding */
    }
    
    /* Tablet-specific scroll button styling */
    .scroll-buttons {
        font-size: 2.5em !important; /* Even bigger navigation buttons for tablet */
    }
    
    .question-section {
        min-height: 70px;
        max-height: 45vh;
        font-size: clamp(1.1em, 4.5vw, 1.7em) !important; /* Slightly bigger text for tablet */
        padding: 8px 5px; /* Minimal horizontal padding for tablet */
    }
    
    .choice-section {
        min-height: 110px;
        max-height: 30vh; /* Reduced for tablet */
        margin-bottom: 75px; /* Reduced margin for tablet */
        font-size: clamp(1em, 4vw, 1.5em) !important; /* Slightly bigger text for tablet */
        padding: 0 5px; /* Minimal horizontal padding for tablet */
    }
    
    .choice-section button {
        font-size: clamp(1em, 4vw, 1.5em) !important; /* Slightly bigger button text for tablet */
        padding: 10px 8px; /* Minimal button padding for tablet */
        margin: 3px 0; /* Minimal vertical margin between buttons */
    }
    
    .choice-section ul {
        padding-left: 8px; /* Minimal left padding for list */
        margin: 0; /* Remove default margins */
    }
    
    .answer-section {
        min-height: 55px;
        max-height: 38vh; /* Increased from 22vh to 38vh for more tablet space */
        right: 0; /* Maintain space for overlay on tablet */
        padding: 8px 5px; /* Minimal horizontal padding for tablet */
        overflow-y: auto; /* Allow scrolling if content exceeds height on tablet */
    }
    
    .question-metadata {
        padding: 5px 8px 5px 0; /* Minimal padding for tablet */
    }
    
    .metadata-item {
        font-size: 1em !important; /* Slightly bigger text for tablet */
        margin-bottom: 3px; /* Reduced margin for tablet */
        padding: 2px 8px 2px 0; /* Balanced padding for tablet, removed left padding */
        line-height: 1.2; /* Better line height for tablet readability */
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }
    
    .metadata-label {
        font-size: 0.85em !important; /* Smaller text for tablet labels */
        min-width: 55px; /* Much narrower for tablet */
        margin-right: 0.3em !important; /* Smaller space for tablet */
        font-weight: bold !important; /* Make labels bold on tablet */
    }
}


.correct {
    color: green;
    font-weight: bold;
  }
  .incorrect {
    color: red;
    font-weight:normal;
  }

.question-metadata {
    background-color: #1a2332; /* Dark blue for metadata */
    padding: clamp(4px, 1vw, 7px) clamp(8px, 2vw, 15px);
    padding-left: 0;
    border-radius: 0; /* Remove border radius to match bottom edge */
    margin: 0; /* Remove all margins */
    border-bottom: none; /* Remove bottom border since it's at the bottom */
    border-left: none; /* Remove left border since it's at the left edge */
    border-right: none; /* Remove right border since it's at the right edge */
    width: 100%;
    text-align: left;
    color: #ffffff; /* White text for dark background */
}

.metadata-item {
    margin-bottom: 8px;
    font-size: 0.9em;
    color: #e2e8f0; /* Light gray text for dark background */
    text-align: left;
    padding: 2px 10px 2px 0; /* Consistent padding, removed left padding */
    margin: 1px 0;
    line-height: 1.2; /* Better line spacing for long content */
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.metadata-label {
    font-weight: 600;
    color: #ffffff; /* White text for labels */
    margin-right: 0.5em; /* Approximately two letters wide */
    display: inline-block;
    min-width: 60px; /* Reduced from 80px to 60px */
    padding: 2px;
}

.question-type-label {
    font-size: 0.8em;
    color: #a0aec0;
    margin-bottom: 8px;
    text-align: center;
    width: 100%;
}

.correct-answer {
    background-color: #3a4551; /* Dark blue background for dark theme */
    padding: 15px;
    border-radius: 8px;
    border: 1px solid #4a5568;
    color: #ffffff; /* White text for dark background */
}

.answer-label {
    font-weight: bold;
    color: #ffffff; /* White text for dark background */
    margin-right: 8px;
}

/* LaTeX Content Styles - Ensure inline display for all $$ expressions */
.MathJax {
    display: inline-block !important;
    margin: 0 2px !important;
    letter-spacing: normal !important;
    vertical-align: middle !important;
}

/* Treat all MathJax as inline since everything uses $$ delimiters */
.MathJax_Display {
    display: inline-block !important;
    margin: 0 2px !important;
    text-align: left !important;
    letter-spacing: normal !important;
    vertical-align: middle !important;
}

/* Hide unrendered LaTeX content until MathJax processes it */
.MathJax_Processing {
    visibility: hidden !important;
}

/* Show content once MathJax is ready */
.MathJax_Display, .MathJax {
    visibility: visible !important;
}

/* Mobile-specific fixes for navigation bar visibility */
@media (max-width: 768px) {
    /* Hide scroll buttons on all mobile and tablet devices */
    .scroll-buttons {
        display: none !important;
    }
    
    html, body {
        overscroll-behavior: none !important;
        -webkit-overflow-scrolling: touch;
        overflow: hidden !important;
        position: fixed;
        width: 100%;
        height: 100%;
    }
    
    #content_outer {
        height: 100dvh !important; /* Use dynamic viewport height on mobile */
        min-height: 100dvh !important;
        overscroll-behavior: none !important;
        overflow: hidden !important;
        border-radius: 0 !important; /* Ensure no border radius */
    }
    
    #iframe_home {
        height: calc(100dvh - 60px) !important; /* Use dynamic viewport height */
        overscroll-behavior: none !important;
        overflow: hidden !important;
        border-radius: 0 !important; /* Ensure no border radius */
    }
    
    #home_navigation {
        position: fixed !important;
        bottom: 0 !important;
        left: 0 !important;
        right: 0 !important;
        z-index: 1000 !important;
        height: 60px !important;
        background-color: rgb(0, 0, 0) !important;
        border-radius: 0 !important; /* Ensure no border radius */
    }
    
    #content_container {
        height: 100dvh !important;
        min-height: 100dvh !important;
        padding-bottom: 60px !important; /* Add padding to account for fixed navigation */
        overscroll-behavior: none !important;
        overflow: hidden !important;
        border-radius: 0 !important; /* Ensure no border radius on mobile */
    }
    
    .content-item {
        height: 100dvh !important;
        min-height: 100dvh !important;
        padding-bottom: 60px !important; /* Add padding to account for fixed navigation */
        overscroll-behavior: none !important;
        overflow: hidden !important;
        border-radius: 0 !important; /* Ensure no border radius */
    }
}

/* iOS Safari specific fixes */
@supports (-webkit-touch-callout: none) {
    /* Hide scroll buttons on iOS devices */
    .scroll-buttons {
        display: none !important;
    }
    
    #content_outer {
        height: 100dvh !important;
        min-height: 100dvh !important;
    }
    
    #iframe_home {
        height: calc(100dvh - 60px) !important;
    }
    
    #home_navigation {
        position: fixed !important;
        bottom: 0 !important;
        left: 0 !important;
        right: 0 !important;
        z-index: 1000 !important;
    }
}

/* Additional media query for larger tablets and touch devices */
@media (max-width: 1024px) and (hover: none) {
    /* Hide scroll buttons on touch devices up to 1024px */
    .scroll-buttons {
        display: none !important;
    }
}

/* iPad and larger tablet specific styling */
@media (min-width: 769px) and (max-width: 1024px) {
    /* Larger icons for iPad and larger tablets */
    .like-button,
    .save-button,
    .share-button,
    .creator-button,
    .report_button {
        font-size: 2.2em !important; /* Even larger icons for iPad */
        padding: 12px 0 !important; /* More padding for better touch targets, no left/right padding */
    }
    
    /* iPad-specific scroll button styling */
    .scroll-buttons {
        font-size: 2.8em !important; /* Even bigger navigation buttons for iPad */
    }
}

/* Report Modal Styles */
.report-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.8);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 10000;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.report-modal.show {
    opacity: 1;
}

.report-modal-content {
    background-color: #2a3441;
    border: 2px solid #17a2b8;
    border-radius: 8px;
    padding: 20px;
    max-width: 90%;
    width: 500px;
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
    color: #ffffff;
}

.report-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 1px solid #4a5a6a;
}

.report-modal-header h3 {
    margin: 0;
    color: #17a2b8;
    font-size: 1.3em;
}

.close-modal {
    background: none;
    border: none;
    color: #ffffff;
    font-size: 1.5em;
    cursor: pointer;
    padding: 5px;
    border-radius: 3px;
    transition: background-color 0.3s;
}

.close-modal:hover {
    background-color: #4a5a6a;
}

.report-form {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.form-group label {
    font-weight: 600;
    color: #ffffff;
    font-size: 0.95em;
}

.form-group select,
.form-group textarea {
    padding: 10px;
    border: 1px solid #4a5a6a;
    border-radius: 4px;
    background-color: #3a4a5a;
    color: #ffffff;
    font-size: 0.9em;
    transition: border-color 0.3s;
}

.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: #17a2b8;
}

.form-group textarea {
    resize: vertical;
    min-height: 100px;
}

.form-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    margin-top: 10px;
}

.cancel-btn,
.submit-btn,
.close-btn {
    padding: 10px 20px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.9em;
    transition: background-color 0.3s;
}

.cancel-btn {
    background-color: #6c757d;
    color: #ffffff;
}

.cancel-btn:hover {
    background-color: #5a6268;
}

.submit-btn {
    background-color: #17a2b8;
    color: #ffffff;
}

.submit-btn:hover {
    background-color: #138496;
}

.close-btn {
    background-color: #6c757d;
    color: #ffffff;
}

.close-btn:hover {
    background-color: #5a6268;
}

.report-success {
    text-align: center;
    padding: 20px;
}

.report-success h3 {
    color: #198754;
    margin-bottom: 10px;
}

.report-success p {
    color: #ffffff;
    margin: 0;
}

/* Report Button Styles */
.report_button {
    background: none;
    border: none;
    color: #6c757d;
    cursor: pointer;
    font-size: 1.5em;
    padding: 5px;
    border-radius: 3px;
    transition: all 0.3s ease;
}

.report_button:hover {
    color: #e74c3c;
    background-color: rgba(231, 76, 60, 0.1);
}

/* Mobile Responsive for Report Modal */
@media (max-width: 768px) {
    .report-modal-content {
        width: 95%;
        padding: 15px;
        margin: 10px;
    }
    
    .report-modal-header h3 {
        font-size: 1.1em;
    }
    
    .form-actions {
        flex-direction: column;
        gap: 8px;
    }
    
    .cancel-btn,
    .submit-btn {
        width: 100%;
        padding: 12px;
        font-size: 1em;
    }
    
    .form-group select,
    .form-group textarea {
        font-size: 16px; /* Prevent zoom on iOS */
        padding: 12px;
    }
    
    .report_button {
        font-size: 2em !important;
        padding: 8px !important;
    }
}

@media (max-width: 480px) {
    .report-modal-content {
        padding: 12px;
    }
    
    .report-modal-header {
        margin-bottom: 15px;
        padding-bottom: 8px;
    }
    
    .report-modal-header h3 {
        font-size: 1em;
    }
    
    .close-modal {
        font-size: 1.3em;
        padding: 3px;
    }
    
    .form-group {
        gap: 3px;
    }
    
    .form-group label {
        font-size: 0.9em;
    }
    
    .form-group select,
    .form-group textarea {
        font-size: 16px;
        padding: 10px;
    }
    
    .cancel-btn,
    .submit-btn {
        padding: 10px 15px;
        font-size: 0.9em;
    }
}

/* Splash Animation Styles */
.splash-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: #000000;
    z-index: 9999;
    display: flex;
    justify-content: center;
    align-items: center;
    opacity: 1;
    transition: opacity 0.8s ease-out;
}

.splash-overlay.fade-out {
    opacity: 0;
    pointer-events: none;
}

.splash-container {
    position: relative;
    width: 300px;
    height: 200px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.hill-container {
    position: relative;
    width: 100%;
    height: 140px;
    overflow: visible;
}

.hill {
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 0;
    border-left: 150px solid transparent;
    border-right: 150px solid transparent;
    border-bottom: 100px solid #ff8c42;
    opacity: 0;
    animation: hillForm 0.3s ease-out forwards;
}

.hill-shadow {
    position: absolute;
    bottom: -5px;
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 0;
    border-left: 160px solid transparent;
    border-right: 160px solid transparent;
    border-bottom: 20px solid rgba(0, 0, 0, 0.3);
    opacity: 0;
    animation: hillShadowForm 0.3s ease-out forwards;
}

.climber {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    width: 20px;
    height: 30px;
    background: #ffffff;
    border-radius: 10px 10px 0 0;
    opacity: 0;
    animation: climberAppear 0.3s ease-out 0.3s forwards;
}

.climber::before {
    content: '';
    position: absolute;
    top: -10px;
    left: 50%;
    transform: translateX(-50%);
    width: 12px;
    height: 12px;
    background: #ffffff;
    border-radius: 50%;
}

.climber::after {
    content: '';
    position: absolute;
    bottom: -5px;
    left: 50%;
    transform: translateX(-50%);
    width: 6px;
    height: 8px;
    background: #ffffff;
    border-radius: 2px;
}

.app-title {
    position: absolute;
    top: -60px;
    left: 50%;
    transform: translateX(-50%);
    font-family: 'Arial', sans-serif;
    font-size: 24px;
    font-weight: bold;
    color: #ffffff;
    text-align: center;
    white-space: nowrap;
    opacity: 0;
    animation: titleAppear 1.5s ease-out 0.6s forwards;
}

.app-subtitle {
    position: absolute;
    top: -5px;
    left: 50%;
    transform: translateX(-50%);
    font-family: 'Arial', sans-serif;
    font-size: 16px;
    color: #cbd5e0;
    text-align: center;
    opacity: 0;
    animation: subtitleAppear 1.5s ease-out 2.1s forwards;
}

@keyframes hillForm {
    0% {
        width: 0;
        height: 0;
        border-left: 0px solid transparent;
        border-right: 0px solid transparent;
        border-bottom: 0px solid #ff8c42;
        opacity: 0;
    }
    50% {
        opacity: 1;
    }
    100% {
        width: 0;
        height: 0;
        border-left: 150px solid transparent;
        border-right: 150px solid transparent;
        border-bottom: 100px solid #ff8c42;
        opacity: 1;
    }
}

@keyframes hillShadowForm {
    0% {
        width: 0;
        height: 0;
        border-left: 0px solid transparent;
        border-right: 0px solid transparent;
        border-bottom: 0px solid rgba(0, 0, 0, 0.3);
        opacity: 0;
    }
    50% {
        opacity: 1;
    }
    100% {
        width: 0;
        height: 0;
        border-left: 160px solid transparent;
        border-right: 160px solid transparent;
        border-bottom: 20px solid rgba(0, 0, 0, 0.3);
        opacity: 1;
    }
}

@keyframes climberAppear {
    0% {
        opacity: 0;
        transform: translateX(-50%) scale(0.5);
    }
    100% {
        opacity: 1;
        transform: translateX(-50%) scale(1);
    }
}

@keyframes climberClimb {
    0% {
        bottom: 20px;
    }
    25% {
        bottom: 40px;
    }
    50% {
        bottom: 60px;
    }
    75% {
        bottom: 80px;
    }
    100% {
        bottom: 85px;
    }
}

@keyframes titleAppear {
    0% {
        opacity: 0;
        transform: translateX(-50%) translateY(-20px);
    }
    100% {
        opacity: 1;
        transform: translateX(-50%) translateY(0);
    }
}

@keyframes subtitleAppear {
    0% {
        opacity: 0;
        transform: translateX(-50%) translateY(-10px);
    }
    100% {
        opacity: 1;
        transform: translateX(-50%) translateY(0);
    }
}

/* Mobile responsive adjustments */
@media (max-width: 768px) {
    .splash-container {
        width: 250px;
        height: 160px;
    }
    
    .hill {
        border-left: 125px solid transparent;
        border-right: 125px solid transparent;
        border-bottom: 80px solid #ff8c42;
    }
    
    .hill-shadow {
        border-left: 135px solid transparent;
        border-right: 135px solid transparent;
        border-bottom: 15px solid rgba(0, 0, 0, 0.3);
    }
    
    .app-title {
        font-size: 18px;
        top: -70px;
    }
    
    .app-subtitle {
        font-size: 14px;
        top: -40px;
    }
}