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

body {
    font-family: 'Inter', sans-serif;
    background-color: #f1f5f9;
    color: #1f2937;
    line-height: 1.6;
    height: 100vh;
    overflow: hidden;
    overflow-x: hidden;
}

.app-container {
    display: flex;
    flex-direction: column;
    height: 100vh;
    max-height: -webkit-fill-available; /* Fix for iOS */
    position: relative;
    overflow: hidden; /* Prevent content overflow */
    overflow-x: hidden;
}

/* Header - more compact */
.app-header {
    display: flex;
    flex-direction: column;
    padding: 0;
    background-color: white;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
    z-index: 10;
    position: relative;
}

.header-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.5rem 1rem; /* Reduced from 1rem to 0.5rem */
}

.back-button {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px; /* Reduced from 40px */
    height: 32px; /* Reduced from 40px */
    border-radius: 50%;
    color: #6b7280;
    transition: all 0.2s ease;
}

.back-button:hover {
    background-color: #f3f4f6;
    color: #1f2937;
}

/* Adjusted Progress Text Position */
.progress-text {
    position: fixed;
    top: 0.75rem;    /* Reduced from 1.25rem to match sidebar toggle */
    left: 50%;
    transform: translateX(-50%);
    z-index: 999;
    font-size: 0.875rem;
    font-weight: 400;
    color: #9ca3af;
    padding: 0.25rem;
}

/* Progress bar - smaller */
.progress-container {
    width: 100%;
}

.progress-bar {
    width: 100%;
    height: 3px; /* Further reduced from 4px to 3px */
    background-color: #e5e7eb;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background-color: var(--color-primary);
    transition: width 0.3s ease;
}

/* Main Content - keep original background */
.app-content {
    flex: 1;
    overflow-y: auto;
    padding: 1rem;
    margin-bottom: 70px; /* Space for fixed footer */
    -webkit-overflow-scrolling: touch; /* Smooth scrolling on iOS */
    display: flex;
    align-items: center;
    justify-content: center;
    margin-top: 10px;
    background-color: #f1f5f9; /* Reset to original light background */
}

.content-container {
    width: 100%;
    max-width: 600px;
    margin: 0 auto;
    border-radius: 12px;
    border: 1px solid rgba(0, 0, 0, 0.05);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
    background-color: white;
    overflow: hidden;
}

/* Flashcard styles */
.flashcard {
    perspective: 1000px;
    height: 400px;
    width: 100%;
    max-width: 600px;
    margin: 0 auto;
}

.flashcard-inner {
    position: relative;
    width: 100%;
    height: 100%;
    text-align: center;
    transition: transform 0.6s;
    transform-style: preserve-3d;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.08);
    border-radius: 12px;
    border: 1px solid rgba(0, 0, 0, 0.05);
}

.flashcard.flipped .flashcard-inner {
    transform: rotateY(180deg);
}

.flashcard-front, .flashcard-back {
    position: absolute;
    width: 100%;
    height: 100%;
    -webkit-backface-visibility: hidden;
    backface-visibility: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    border-radius: 16px;
    background-color: white;
    border: 1px solid #f3f4f6;
}

.flashcard-front {
    background-color: white;
}

.flashcard-back {
    background-color: var(--color-primary);
    color: white;
    transform: rotateY(180deg);
}

.flashcard-content {
    max-width: 100%;
}

.flashcard-front h3 {
    font-size: 1.5rem;
    font-weight: 600;
    color: #1f2937;
}

.flashcard-back p {
    font-size: 1.25rem;
    font-weight: 500;
}

/* Quiz styles - make options and text smaller */
.quiz-content {
    width: 100%;
    max-width: 600px;
    margin: 0 auto;
    padding: 2rem; /* Increased from 1.5rem to 2rem */
}

.quiz-question {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 1.5rem; /* Increased from 1.25rem to 1.5rem */
    line-height: 1.4;
    color: #1f2937;
}

.quiz-options {
    display: flex;
    flex-direction: column;
    gap: 1rem; /* Increased from 0.75rem to 1rem */
    margin-bottom: 1rem; /* Add bottom margin */
}

.quiz-option {
    display: flex;
    align-items: center;
    padding: 0.875rem 1.25rem; /* Increased from 0.75rem 1rem to 0.875rem 1.25rem */
    border: 1px solid #e5e7eb;
    border-radius: 0.5rem;
    background-color: white;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 0.95rem;
    line-height: 1.4;
}

.quiz-option:hover {
    background-color: #f9fafb;
    border-color: #d1d5db;
}

/* Style the option markers (A, B, C, D) with theme colors */
.option-marker {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.5rem;
    height: 1.5rem;
    margin-right: 0.75rem;
    background-color: var(--color-primary-light, #e0e7ff);
    color: var(--color-primary-dark, #4338ca);
    border-radius: 50%;
    font-weight: 600;
    font-size: 0.8rem;
    transition: all 0.2s ease;
}

.quiz-option:hover .option-marker {
    background-color: var(--color-primary, #4f46e5);
    color: white;
}

/* Update quiz option styling for correct/incorrect answers */
.quiz-option.correct {
    border-color: #10b981;
    background-color: #d1fae5; /* Light green background */
}

.quiz-option.correct .option-marker {
    background-color: #10b981; /* Green marker */
    color: white;
}

.quiz-option.incorrect {
    border-color: #ef4444;
    background-color: #fee2e2; /* Light red background */
}

.quiz-option.incorrect .option-marker {
    background-color: #ef4444; /* Red marker */
    color: white;
}

/* Add a subtle highlight to the correct answer when user selects wrong */
.quiz-option.highlight-correct {
    border-color: #10b981;
    background-color: #d1fae5; /* Light green background */
}

.quiz-option.highlight-correct .option-marker {
    background-color: #10b981; /* Green marker */
    color: white;
}

.quiz-feedback {
    margin-top: 16px;
    padding: 12px 16px;
    border-radius: 8px;
    display: flex;
}

.score-display {
    display: flex;
    gap: 16px;
}

.score-display.left-aligned {
    margin-left: 8px; /* Add a small margin to align with the question options */
}

.score-item {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    border-radius: 16px;
    font-weight: 500;
    background-color: white;
}

.score-item.correct {
    color: rgb(22, 163, 74);
}

.score-item.incorrect {
    color: rgb(220, 38, 38);
}

.score-item svg {
    stroke-width: 2.5;
}

/* Footer Navigation Layout */
.app-footer {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: white;
    padding: 1rem;
    display: flex;
    justify-content: center; /* Center all items */
    align-items: center;
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.05);
    z-index: 100;
    height: 60px;
    gap: 1rem; /* Default gap */
}

/* Navigation Buttons */
.nav-button {
    padding: 0.5rem;
    border-radius: 50%;
    border: none;
    background: transparent;
    color: #666;
    cursor: pointer;
    transition: all 0.2s ease;
}

/* Action Button (Flip) */
.action-button {
    padding: 0.5rem 1.5rem;
    border-radius: 8px;
    border: none;
    background-color: var(--color-primary);
    color: white;
    font-weight: 500;
    min-width: 100px;
    transition: all 0.2s ease;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* Hover state */
.action-button:hover {
    background-color: var(--color-primary-dark);
    transform: translateY(-1px);
    box-shadow: 0 3px 6px rgba(0, 0, 0, 0.15);
}

/* Active state */
.action-button:active {
    transform: translateY(0);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* Disabled state */
.action-button:disabled {
    background-color: #e5e7eb;
    color: #9ca3af;
    cursor: not-allowed;
    box-shadow: none;
}

/* Different spacing for quiz mode */
.app-footer[data-mode="quiz"] {
    justify-content: space-around; /* More space between buttons in quiz mode */
    padding: 1rem 2rem; /* Larger horizontal padding */
    gap: 2rem; /* Larger gap for quiz mode */
}

/* Hover states */
.nav-button:hover {
    background: #f5f5f5;
    color: #333;
}

/* Mobile adjustments */
@media (max-width: 640px) {
    .app-footer {
        padding: 0.75rem;
        gap: 0.75rem; /* Slightly reduced gap on mobile */
    }
    
    .app-footer[data-mode="quiz"] {
        padding: 0.75rem 1.5rem;
        gap: 1.5rem; /* Reduced but still spaced for quiz */
    }
    
    .action-button {
        min-width: 80px;
        padding: 0.5rem 1rem;
        font-size: 0.875rem;
    }
}

/* Animation for card transitions */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.flashcard, .quiz-content {
    animation: fadeIn 0.3s ease-out;
}

/* Study cover wrapper - dark background just for the cover */
.study-cover-wrapper {
    background-color: #1a1625;
    padding: 3rem 2rem;
    border-radius: 32px;
    margin: 1rem;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15);
}

/* Cover Container - Improved Spacing and Mobile Responsiveness */
.cover-container {
    width: 1200px !important;
    height: 630px !important;
    padding: 2rem;
    text-align: left;
    margin: 2rem auto;
    background: linear-gradient(145deg, var(--color-primary-light) 0%, rgba(255, 255, 255, 0.95) 100%);
    border-radius: 16px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    display: flex;
    align-items: center;
    transform: scale(1.02);
    transition: transform 0.3s ease;
    overflow: hidden; /* Added to ensure content fits */
}

.cover-content {
    display: flex;
    flex-direction: column;
    gap: 2rem;
    width: 100%; /* Ensure full width */
}

.cover-type {
    display: inline-flex;
    padding: 0.375rem 0.75rem;
    background-color: rgba(0, 0, 0, 0.05);
    color: #1f2937;
    border-radius: 6px;
    font-size: 0.6875rem;
    font-weight: 500;
    letter-spacing: 0.02em;
    text-transform: uppercase;
    align-self: flex-start;
}

.cover-title {
    font-size: clamp(1.125rem, 3vw, 1.75rem);
    font-weight: 600;
    color: #1f2937;
    line-height: 1.3;
    max-width: 100%;
    word-wrap: break-word;
    overflow-wrap: break-word;
    hyphens: auto;
    letter-spacing: -0.01em;
    margin-bottom: 0.5rem;  /* Add some space after title */
}

.cover-description {
    display: none;
}

.cover-stats {
    display: inline-flex;
    gap: 2rem;
    margin-bottom: 1.5rem;
}

.stat-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    position: relative;
    padding-bottom: 2px;
}

.stat-item::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 1px;
    background-color: rgba(0, 0, 0, 0.1);
}

.stat-value {
    font-size: 0.875rem;
    font-weight: 600;
    color: #1f2937;
}

.stat-label {
    font-size: 0.75rem;
    color: #6b7280;
    font-weight: 500;
}

.start-button {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.625rem 1.25rem;
    background: linear-gradient(
        135deg,
        rgba(0, 0, 0, 0.4) 0%,
        rgba(0, 0, 0, 0.3) 100%
    );
    color: white;
    border: none;
    border-radius: 12px;
    font-weight: 500;
    font-size: 0.875rem;
    transition: all 0.2s ease;
    cursor: pointer;
    align-self: flex-start;
    backdrop-filter: blur(8px);
    box-shadow: 
        0 2px 4px rgba(0, 0, 0, 0.1),
        inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

.start-button:hover {
    background: linear-gradient(
        135deg,
        rgba(0, 0, 0, 0.5) 0%,
        rgba(0, 0, 0, 0.4) 100%
    );
    transform: translateY(-1px);
    box-shadow: 
        0 4px 8px rgba(0, 0, 0, 0.15),
        inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

/* Mobile Responsive Adjustments */
@media (max-width: 640px) {
    .cover-container {
        min-height: 520px; /* Even more height on mobile */
        margin: 1rem;
        width: calc(100% - 2rem);
        padding: 1.5rem;
        border-radius: 12px;
    }

    .cover-content {
        gap: 1.5rem;
    }

    .cover-title {
        font-size: 1.5rem; /* Larger font on mobile */
    }

    .start-button {
        width: 100%; /* Full width button on mobile */
        justify-content: center;
        padding: 0.75rem;
        font-size: 1rem;
    }
}

/* Small Mobile Adjustments */
@media (max-width: 380px) {
    .cover-container {
        min-height: 540px;
        margin: 0.5rem;
        width: calc(100% - 1rem);
        padding: 1.25rem;
    }
}

/* Preview card styles */
.preview-container {
    padding: 2rem;
    max-width: 800px;
    margin: 0 auto;
    background-color: #f8fafc;
    border-radius: 16px;
}

.preview-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
}

.preview-title {
    font-size: 1.5rem;
    font-weight: 600;
    color: #1f2937;
}

.preview-type {
    padding: 0.5rem 1.25rem;
    background-color: var(--color-primary);
    color: white;
    border-radius: 9999px;
    font-weight: 500;
    font-size: 0.875rem;
}

.preview-card {
    background: white;
    padding: 2rem;
    border-radius: 12px;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
}

.preview-question {
    font-size: 1.25rem;
    font-weight: 600;
    color: #1f2937;
    margin-bottom: 1.5rem;
}

.preview-options {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.preview-option {
    padding: 1rem 1.25rem;
    background-color: #f9fafb;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    font-size: 1rem;
    color: #374151;
    transition: all 0.2s ease;
}

.preview-option:hover {
    background-color: #f3f4f6;
    border-color: #d1d5db;
}

.preview-more {
    text-align: center;
    margin-top: 1rem;
    color: #6b7280;
    font-size: 0.875rem;
}

/* Dark wrapper container */
.dark-wrapper {
    background-color: #1a1625;  /* Dark purple background */
    min-height: 100vh;
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
}

/* Add this to your study.css file */
.score-container {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-left: 16px;
    font-size: 14px;
}

.score-item {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 4px 8px;
    border-radius: 12px;
    font-weight: 500;
}

.score-item.correct {
    background-color: rgba(34, 197, 94, 0.1);
    color: rgb(22, 163, 74);
}

.score-item.incorrect {
    background-color: rgba(239, 68, 68, 0.1);
    color: rgb(220, 38, 38);
}

.score-item svg {
    stroke-width: 2.5;
}

/* End Cover Styles */
.end-cover-wrapper {
    min-height: calc(100vh - 60px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem 1rem;
    width: 100%;
}

.end-cover-container {
    background: white;
    border-radius: 16px;
    padding: 2rem;
    width: 100%;
    max-width: 600px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.end-cover-content {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1rem;
    width: 100%;
    align-items: center;
}

/* Mobile Adjustments */
@media (max-width: 768px) {
    .end-cover-wrapper {
        padding: 1.5rem 1rem 0 1rem; /* Equal padding on mobile */
    }

    .end-cover-container {
        padding: 1.25rem;
    }

    .end-cover-content {
        padding: 0 1rem; /* Equal padding */
    }
}

/* Small Mobile Adjustments */
@media (max-width: 480px) {
    .end-cover-wrapper {
        padding: 1rem 0.5rem 0 0.5rem; /* Reduced side padding */
    }

    .end-cover-container {
        padding: 1rem;
    }

    .end-cover-content {
        padding: 0 0.5rem; /* Reduced side padding */
    }
}

/* Score Summary - More minimalistic */
.score-summary {
    text-align: center;
    margin-bottom: 0.5rem;
}

.score-summary h2 {
    font-size: 1.25rem;
    font-weight: 600;
    color: #1f2937;
    margin-bottom: 0.375rem;
}

.final-score {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.25rem;
}

.score-percentage {
    font-size: 2.25rem;
    font-weight: 600;
    color: var(--color-primary);
    line-height: 1;
}

.score-details {
    display: flex;
    gap: 0.75rem;
    font-size: 0.75rem;
    color: #6b7280;
}

/* Share Section - More minimalistic */
.share-section {
    text-align: center;
    margin: 0.25rem 0;
}

.share-section h3 {
    font-size: 0.875rem;
    color: #4b5563;
    margin-bottom: 0.375rem;
}

.share-buttons {
    display: flex;
    gap: 16px;
    justify-content: center;
    flex-wrap: wrap;
}

.share-button {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 4px 8px;
    border-radius: 12px;
    font-weight: 500;
    font-size: 0.75rem;
    background-color: rgba(34, 197, 94, 0.1);
    color: rgb(22, 163, 74);
    transition: all 0.2s ease;
}

.share-button.reddit {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 4px 8px;
    border-radius: 12px;
    font-weight: 500;
    font-size: 0.75rem;
    background-color: rgba(255, 69, 0, 0.1);  /* Reddit orange with opacity */
    color: rgb(255, 69, 0);  /* Reddit orange */
    transition: all 0.2s ease;
}

.share-button.reddit:hover {
    background-color: rgba(255, 69, 0, 0.15);
    transform: translateY(-1px);
}

.share-button.reddit svg {
    width: 14px;
    height: 14px;
}

.share-button.whatsapp {
    background-color: rgba(37, 211, 102, 0.1);
    color: rgb(37, 211, 102);
}

.share-button.copy-link {
    background-color: rgba(99, 102, 241, 0.1);
    color: rgb(99, 102, 241);
}

.share-button svg {
    width: 14px;
    height: 14px;
}

.share-button:hover {
    transform: translateY(-1px);
    opacity: 0.9;
}

/* Mobile Responsive Adjustments for Share Buttons */
@media (max-width: 640px) {
    .share-buttons {
        gap: 8px;
    }
    
    .share-button {
        padding: 4px 6px;
        font-size: 0.7rem;
    }
    
    .share-button svg {
        width: 12px;
        height: 12px;
    }
}

/* Enhanced responsive leaderboard styles */
.leaderboard-section {
    margin: 1rem auto;
    max-width: 100%;
    width: 100%;
}

.leaderboard-section h3 {
    font-size: 0.875rem;
    font-weight: 400;
    color: #6b7280;
    margin-bottom: 0.5rem;
    text-align: center;
}

.leaderboard {
    max-height: 120px;
    overflow-y: auto;
    padding-right: 5px;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
    scrollbar-color: rgba(209, 213, 219, 0.5) transparent;
    margin: 0 auto;
    width: 100%;
    max-width: 400px; /* Limit width on larger screens */
}

.leaderboard::-webkit-scrollbar {
    width: 4px;
}

.leaderboard::-webkit-scrollbar-track {
    background: transparent;
}

.leaderboard::-webkit-scrollbar-thumb {
    background-color: rgba(209, 213, 219, 0.5);
    border-radius: 2px;
}

.leaderboard-item {
    display: flex;
    align-items: center;
    padding: 0.375rem 0;
    min-height: 36px;
    justify-content: flex-start; /* Align items to the start (left) */
}

.leaderboard-item.you {
    background-color: transparent;
}

.rank {
    width: 24px;
    font-weight: 400;
    color: #6b7280;
    text-align: left;
    flex-shrink: 0;
}

.avatar {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    overflow: hidden;
    margin-right: 0.5rem;
    flex-shrink: 0;
}

.avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.name {
    flex: 1;
    font-weight: 400;
    color: #6b7280;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-right: 8px;
    text-align: left; /* Explicitly set left alignment */
    padding-left: 0; /* Remove any potential padding */
}

.score {
    font-weight: 400;
    color: #ef4444;
    flex-shrink: 0;
}

/* Desktop-specific adjustments */
@media (min-width: 768px) {
    .leaderboard {
        max-height: 140px; /* Slightly taller on desktop */
    }
    
    .leaderboard-item {
        padding: 0.5rem 0;
        min-height: 40px; /* Slightly taller items on desktop */
    }
    
    .avatar {
        width: 24px;
        height: 24px;
    }
    
    .name {
        font-size: 0.875rem; /* Slightly larger text on desktop */
    }
    
    .score {
        font-size: 0.875rem;
    }
}

/* Mobile-specific padding adjustments - Direct approach */
@media (max-width: 640px) {
    /* Apply padding to the section itself */
    .leaderboard-section {
        padding: 0 15px;
        box-sizing: border-box;
    }
    
    /* Reset padding on the leaderboard to avoid double padding */
    .leaderboard {
        max-width: 100%;
        padding: 0;
    }
    
    /* Add more visible spacing to items */
    .leaderboard-item {
        padding: 0.3125rem 10px; /* Add horizontal padding to items */
        min-height: 34px;
        margin: 0; /* Reset margin */
        border-bottom: 1px solid rgba(209, 213, 219, 0.3); /* Add subtle separator */
    }
    
    .leaderboard-item:last-child {
        border-bottom: none;
    }
    
    /* Other mobile styles remain the same */
    .avatar {
        width: 20px;
        height: 20px;
        margin-right: 0.375rem;
    }
    
    .rank {
        width: 20px;
        font-size: 0.8125rem;
    }
    
    .name {
        font-size: 0.8125rem;
    }
    
    .score {
        font-size: 0.8125rem;
    }
}

/* Action Buttons - More minimalistic */
.cover-actions {
    display: flex;
    gap: 0.75rem;
    justify-content: center;
    margin-top: 0.75rem;
}

.cover-actions .action-button {
    display: flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.375rem 0.75rem;
    border-radius: 4px;
    font-size: 0.75rem;
    background-color: transparent;
    border: 1px solid #e5e7eb;
    color: #6b7280;
    transition: all 0.2s ease;
}

.cover-actions .action-button:hover {
    background-color: #f3f4f6;
    color: #4b5563;
}

.cover-actions .action-button svg {
    width: 1rem;
    height: 1rem;
    stroke: currentColor;
    stroke-width: 2;
}

/* Mobile Responsive Adjustments */
@media (max-width: 640px) {
    .end-cover-container {
        margin: 0.5rem 0.25rem;
        width: calc(100% - 0.5rem);
        padding: 1.5rem;
    }

    .end-cover-content {
        gap: 1rem;
    }

    .score-summary h2 {
        font-size: 1.125rem;
    }

    .score-percentage {
        font-size: 2rem;
    }

    .share-buttons {
        flex-direction: row;
    }

    .share-button {
        flex: 1;
        justify-content: center;
    }

    .leaderboard-icon {
        width: 14px;
        height: 14px;
    }
}

@media (max-width: 480px) {
    .end-cover-container {
        min-height: 400px; /* Further reduced height for smaller screens */
    }
}

/* Extra small screens */
@media (max-width: 380px) {
    .end-cover-container {
        width: calc(100% - 0.5rem);  /* Even wider */
        margin-left: 0.25rem;        /* Smaller margin */
        margin-right: 0.25rem;       /* Smaller margin */
    }
}

/* Adjusted avatar size to match text */
.avatar {
    width: 22px;  /* Reduced from 28px */
    height: 22px; /* Reduced from 28px */
    border-radius: 50%;
    overflow: hidden;
    margin-right: 0.5rem; /* Slightly reduced margin */
    flex-shrink: 0;
}

.avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Responsive adjustments */
@media (max-width: 640px) {
    .avatar {
        width: 20px;  /* Reduced from 24px */
        height: 20px; /* Reduced from 24px */
        margin-right: 0.375rem;
    }
}

/* Option states for auto-advance */
.option {
    cursor: pointer;
    transition: all 0.2s ease;
}

.option:hover {
    background-color: #f3f4f6;
}

.option.selected {
    border-color: #6b7280;
}

.option.correct {
    background-color: rgba(34, 197, 94, 0.1);
    border-color: rgb(22, 163, 74);
}

.option.incorrect {
    background-color: rgba(239, 68, 68, 0.1);
    border-color: rgb(220, 38, 38);
}

.recent-students {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 1rem;
    margin: 0;
    margin-top: -1rem;  /* Added negative margin to pull it up */
    padding-left: 0;
}

.avatar-stack {
    display: flex;
    align-items: center;
}

.stacked-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: 2px solid white;
    overflow: hidden;
    margin-left: -8px;
    background: white;
}

.stacked-avatar:first-child {
    margin-left: 0;
}

.stacked-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.student-count {
    font-size: 0.875rem;
    color: #6b7280;
    font-weight: 500;
}

/* Fix for iOS safari viewport height issue */
@supports (-webkit-touch-callout: none) {
    .app-container {
        height: -webkit-fill-available;
    }
}

/* Force hide theme label with high specificity */
div[class*="theme-label"],
div[class*="Theme"],
.theme-label,
*[class*="theme-indicator"],
*[style*="position: fixed"][style*="bottom"][style*="right"] {
    display: none !important;
    visibility: hidden !important;
    opacity: 0 !important;
    pointer-events: none !important;
    position: absolute !important;
    z-index: -9999 !important;
}

/* Hide debug info */
.debug-info {
    display: none !important;
    visibility: hidden !important;
}

/* Summary button */
.action-button.summary {
    background-color: #4F46E5;
    color: white;
}

.action-button.summary:hover {
    color: #4338CA;
    background-color: #e2e2e7;
}

/* All buttons and links in the action section */
.flex.flex-wrap.gap-2.justify-center.mt-4 button,
.flex.flex-wrap.gap-2.justify-center.mt-4 a {
    transition: transform 0.1s ease !important;
}

.flex.flex-wrap.gap-2.justify-center.mt-4 button:active,
.flex.flex-wrap.gap-2.justify-center.mt-4 a:active {
    transform: scale(0.95) !important;
}

@keyframes loading-shine {
    0% {
        transform: translateX(0);
    }
    100% {
        transform: translateX(100%);
    }
}

.action-btn {
    position: relative;
    transition: all 0.15s cubic-bezier(0.4, 0, 0.2, 1);
    transform: translateY(0);
}

.action-btn:active {
    transform: translateY(2px);
}

/* Green button */
.green-btn:active {
    background-color: #8bc34a !important;
}

/* Gray button */
.gray-btn:active {
    background-color: #d1d5db !important;
}

/* Orange button */
.orange-btn:active {
    background-color: #f59e0b !important;
}

/* Refined Sidebar Toggle Position */
.sidebar-toggle {
    position: fixed;
    top: 0.75rem;      /* Reduced from 1rem */
    right: 0.75rem;    /* Reduced from 1rem */
    z-index: 999;
    padding: 0.4rem;   /* Slightly reduced padding */
    background: white;
    border: 1px solid rgba(229, 231, 235, 0.8);
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.04); /* Lighter shadow */
}

.sidebar-toggle:hover {
    background: #f9fafb;
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

/* Sidebar Overlay */
.sidebar-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.3);
    backdrop-filter: blur(2px);
    z-index: 998;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s;
}

.sidebar-overlay.active {
    opacity: 1;
    visibility: visible;
}

/* Sidebar */
.sidebar {
    position: fixed;
    top: 0;
    right: -320px;
    width: 320px;
    height: 100%;
    background: #ffffff;
    z-index: 1000;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: -4px 0 15px rgba(0, 0, 0, 0.08);
    border-left: 1px solid rgba(229, 231, 235, 0.5);
}

.sidebar.active {
    right: 0;
}

/* Refined Sidebar Header */
.sidebar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.5rem;
    background: linear-gradient(to right, #f8f9fa, #ffffff);
    border-bottom: 1px solid rgba(229, 231, 235, 0.5);
}

.sidebar-header h3 {
    font-size: 1.25rem;
    font-weight: 600;
    color: #1f2937;
    letter-spacing: -0.025em;
}

.close-sidebar {
    padding: 0.5rem;
    background: none;
    border: none;
    cursor: pointer;
    color: #6b7280;
    transition: all 0.2s;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.close-sidebar:hover {
    background-color: #f3f4f6;
    color: #111827;
    transform: rotate(90deg);
}

.close-sidebar svg {
    width: 20px;
    height: 20px;
    stroke-width: 2;
}

/* Sidebar Content */
.sidebar-content {
    padding: 1rem;
    overflow-y: auto;
    height: calc(100% - 76px);
}

/* Sidebar Content Styling */
.sidebar-section {
    padding: 1.5rem;
    border-bottom: 1px solid rgba(229, 231, 235, 0.5);
    background: white;
    animation: fadeIn 0.3s ease-out;
}

/* All Caps Section Title Styling */
.section-title {
    font-size: 0.7rem;
    font-weight: 600;
    color: #374151;
    padding: 0.75rem 1rem;
    margin: 0 0 1rem;
    background: #f8fafc;
    display: flex;
    align-items: center;
    letter-spacing: 0.08em;
    border-radius: 6px;
    position: relative;
    text-transform: uppercase;
}

/* Different colors for different sections */
.nav-links .section-title {
    background: linear-gradient(to right, #eef2ff, #f8fafc);
    border-left: 3px solid #818cf8;
}

.also-studied-list .section-title {
    background: linear-gradient(to right, #ecfdf5, #f8fafc);
    border-left: 3px solid #9cd95b;
}

.author-sets-list .section-title {
    background: linear-gradient(to right, #fff7ed, #f8fafc);
    border-left: 3px solid #fb923c;
}

.section-title::before {
    content: '';
    display: inline-block;
    width: 4px;
    height: 4px;
    margin-right: 8px;
    border-radius: 50%;
}

.nav-links .section-title::before {
    background: #818cf8;
}

.also-studied-list .section-title::before {
    background: #9cd95b;
}

.author-sets-list .section-title::before {
    background: #fb923c;
}

/* Minimalistic Navigation Content Styling */
.nav-links {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.5rem 0.75rem;  /* Reduced padding */
    color: #4b5563;
    font-size: 0.75rem;      /* Smaller font size */
    border-radius: 6px;
    transition: all 0.2s ease;
    text-decoration: none;
}

.nav-link svg {
    width: 14px;             /* Smaller icons */
    height: 14px;
    stroke-width: 1.5px;
    color: #9ca3af;
}

.nav-link:hover {
    background: #f3f4f6;
    color: #111827;
}

.nav-link:hover svg {
    color: #9cd95b;
}

.nav-link.active {
    background: #f9fafb;
    color: #111827;
    font-weight: 500;
}

.nav-link.active svg {
    color: #9cd95b;
}

/* Study Items */
.study-item {
    display: block;
    padding: 1rem;
    border-radius: 1rem;
    background: white;
    margin-bottom: 0.75rem;
    text-decoration: none;
    color: inherit;
    transition: all 0.2s;
    border: 1px solid #f3f4f6;
    position: relative;
    overflow: hidden;
    background: linear-gradient(to right, white, #fcfcfc);
}

.study-item:hover {
    background-color: #f9fafb;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
    border-color: rgba(156, 217, 91, 0.4);
    background: linear-gradient(to right, #f9fafb, white);
}

.study-item::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    height: 100%;
    width: 4px;
    background: #9cd95b;
    opacity: 0;
    transition: opacity 0.2s;
}

.study-item:hover::before {
    opacity: 1;
}

.study-item h5 {
    font-size: 0.75rem;      /* Smaller font size */
    color: #4b5563;
    margin-bottom: 0.25rem;
    font-weight: 500;
}

.study-item h5:hover::after {
    content: attr(title);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    padding: 0.5rem;
    background: rgba(0, 0, 0, 0.8);
    color: white;
    border-radius: 0.25rem;
    font-size: 0.75rem;
    white-space: normal;
    z-index: 1000;
    max-width: 200px;
    opacity: 0;
    animation: fadeIn 0.2s ease-out forwards;
}

.study-meta {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 0.75rem;
}

.type-badge {
    font-size: 0.625rem;     /* Smaller font size */
    color: #6b7280;
    background: #f3f4f6;
    padding: 0.15rem 0.4rem; /* Reduced padding */
    border-radius: 4px;
}

.common-count {
    font-size: 0.625rem;     /* Smaller font size */
    color: #9ca3af;
}

/* Scrollable content */
.sidebar-content {
    height: calc(100% - 76px);
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: #e5e7eb transparent;
    padding-bottom: 2rem;
}

.sidebar-content::-webkit-scrollbar {
    width: 5px;
}

.sidebar-content::-webkit-scrollbar-track {
    background: transparent;
}

.sidebar-content::-webkit-scrollbar-thumb {
    background-color: #e5e7eb;
    border-radius: 20px;
    border: 6px solid transparent;
}

.sidebar-content::-webkit-scrollbar-thumb:hover {
    background-color: #d1d5db;
}

/* Additional Refinements */

/* Add subtle animation for sidebar sections */
.sidebar-section {
    animation: fadeIn 0.3s ease-out;
}

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

/* Add loading shimmer effect for content */
.loading-shimmer {
    position: relative;
    overflow: hidden;
    background: #f3f4f6;
}

.loading-shimmer::after {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    transform: translateX(-100%);
    background: linear-gradient(
        90deg,
        rgba(255, 255, 255, 0) 0,
        rgba(255, 255, 255, 0.2) 20%,
        rgba(255, 255, 255, 0.5) 60%,
        rgba(255, 255, 255, 0)
    );
    animation: shimmer 2s infinite;
}

@keyframes shimmer {
    100% {
        transform: translateX(100%);
    }
}

/* Active state for current page link */
.nav-link.active {
    background-color: rgba(156, 217, 91, 0.12);
    color: #9cd95b;
    font-weight: 600;
}

.nav-link.active svg {
    color: #9cd95b;
}

/* Empty state styling */
.empty-state {
    padding: 2rem 1rem;
    text-align: center;
    color: #6b7280;
}

.empty-state svg {
    width: 3rem;
    height: 3rem;
    margin: 0 auto 1rem;
    color: #9ca3af;
}

/* Focus states for accessibility */
.nav-link:focus-visible,
.study-item:focus-visible,
.sidebar-toggle:focus-visible {
    outline: 2px solid #9cd95b;
    outline-offset: 2px;
}

/* Responsive adjustments */
@media (max-width: 640px) {
    .sidebar {
        width: 100%;
        right: -100%;
    }
    
    .sidebar-toggle {
        top: 0.75rem;
        right: 0.75rem;
        padding: 0.5rem;
    }
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
    .sidebar {
        background: #1f2937;
        border-left-color: rgba(255, 255, 255, 0.1);
    }
    
    .sidebar-header {
        background: linear-gradient(to right, #111827, #1f2937);
        border-bottom-color: rgba(255, 255, 255, 0.1);
    }
    
    .nav-link {
        color: #e5e7eb;
    }
    
    .study-item {
        background: #374151;
        border-color: rgba(255, 255, 255, 0.1);
    }
    
    .study-item:hover {
        background: #4b5563;
    }
    
    .type-badge {
        background-color: rgba(156, 217, 91, 0.2);
    }
}

/* Minimalistic Related Sets Styling */
.also-studied-list,
.author-sets-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.study-item {
    display: flex;
    align-items: center;
    padding: 0.75rem;
    background: transparent;
    border-radius: 6px;
    transition: all 0.2s ease;
    text-decoration: none;
}

.study-item-content {
    flex: 1;
}

.study-item h5 {
    font-size: 0.75rem;      /* Smaller font size */
    color: #4b5563;
    margin-bottom: 0.25rem;
    font-weight: 500;
}

.study-meta {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.type-badge {
    font-size: 0.625rem;     /* Smaller font size */
    color: #6b7280;
    background: #f3f4f6;
    padding: 0.15rem 0.4rem; /* Reduced padding */
    border-radius: 4px;
}

.common-count {
    font-size: 0.625rem;     /* Smaller font size */
    color: #9ca3af;
}

.study-item:hover {
    background: #f9fafb;
}

/* Separator between sections */
.sidebar-section + .sidebar-section {
    border-top: 1px solid #f3f4f6;
    margin-top: 1rem;
    padding-top: 1rem;
}

/* Mobile Sidebar Styling */
@media (max-width: 768px) {
    .sidebar {
        width: 85%;
        right: -85%;
        background: #ffffff;  /* Same as desktop */
        border-left: 1px solid rgba(229, 231, 235, 0.5);
    }

    .sidebar.active {
        right: 0;
        box-shadow: -4px 0 15px rgba(0, 0, 0, 0.05);
    }

    .sidebar-overlay {
        background: rgba(0, 0, 0, 0.2);  /* Lighter overlay */
        backdrop-filter: blur(2px);
    }

    /* Keep all other styles consistent with desktop */
    .sidebar-header {
        background: linear-gradient(to right, #f8fafc, #ffffff);
    }

    .sidebar-content {
        background: #ffffff;
    }

    .nav-link {
        color: #374151;  /* Darker text color */
        font-weight: 500; /* Slightly bolder */
    }

    .study-item h5 {
        color: #374151;  /* Darker text color */
        font-weight: 500;
    }

    .type-badge {
        color: #4b5563;  /* Darker badge text */
        background: #f3f4f6;  /* Slightly darker background */
    }

    .common-count {
        color: #4b5563;  /* Darker count text */
    }

    /* Keep brand colors for related sections */
    .also-studied-list .type-badge,
    .author-sets-list .type-badge {
        color: #6b8c3c;  /* Keep the branded dark green */
        background: rgba(156, 217, 91, 0.15);  /* Slightly more opaque */
    }
}

/* Brand-colored Related Content Sections */
.also-studied-list .section-title,
.author-sets-list .section-title {
    color: #9cd95b;
    background: rgba(156, 217, 91, 0.05);
}

.also-studied-list .section-title::before,
.author-sets-list .section-title::before {
    background: #9cd95b;
    width: 4px;
    height: 4px;
}

.also-studied-list .study-item:hover,
.author-sets-list .study-item:hover {
    background: rgba(156, 217, 91, 0.05);
}

.also-studied-list .type-badge,
.author-sets-list .type-badge {
    background: rgba(156, 217, 91, 0.1);
    color: #6b8c3c;  /* Darker shade of our brand color */
}

.also-studied-list .common-count,
.author-sets-list .common-count {
    color: #9cd95b;
}
