/**
 * Weekly Challenge Styles
 * Additional styles for weekly challenge page
 */

/* Weekly Challenge Layout - Override main-content for weekly challenge page */
.weekly-challenge-page .main-content,
.weekly-challenge-main {
    padding: 24px;
    height: 100vh;
    max-height: 100vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-sizing: border-box;
    position: relative;
}

/* Texture background for entire main area (excluding sidebar) */
.weekly-challenge-main::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-image: url('https://anesthesiaboard.se/wp-content/uploads/2026/01/weeklytemplatetexture-scaled.png');
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    opacity: 0.35;
    z-index: 0;
    pointer-events: none;
    transform: translateZ(0);
    will-change: transform;
    backface-visibility: hidden;
}

/* Ensure layout and content are above the texture */
.weekly-challenge-layout {
    position: relative;
    z-index: 1;
}

/* Sidebar should be transparent to show texture, but menu items have solid background */
.weekly-challenge-sidebar {
    background: transparent;
    position: relative;
    z-index: 1;
}

/* Past Challenges section - transparent background to show texture */
.past-challenges-header,
.past-challenges-list,
.past-challenge-item {
    background: transparent;
}

/* Only the menu items themselves have solid backgrounds */
.past-challenge-item {
    background: var(--bg-primary) !important;
}

/* Desktop theme toggle header - transparent to show texture */
.weekly-challenge-desktop-header {
    background: transparent;
}

.weekly-challenge-layout {
    display: flex;
    gap: 24px;
    align-items: flex-start;
    flex: 1;
    min-height: 0;
    overflow: hidden;
    height: 100%;
    max-height: 100%;
    box-sizing: border-box;
}

.weekly-challenge-content {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    height: 100%;
    max-height: 100%;
    box-sizing: border-box;
}

.weekly-challenge-sidebar {
    width: 280px;
    flex-shrink: 0;
    background: transparent;
    position: relative;
    z-index: 1;
}

/* Desktop Theme Toggle Header */
.weekly-challenge-desktop-header {
    position: absolute;
    top: 24px;
    right: 24px;
    z-index: 100;
    display: flex;
    justify-content: flex-end;
    align-items: center;
}

.weekly-challenge-main {
    position: relative;
}

/* Ensure Past Challenges sidebar starts below the theme toggle */
.weekly-challenge-sidebar {
    position: relative;
}

@media (min-width: 901px) {
    .weekly-challenge-sidebar {
        padding-top: 70px; /* Space for theme toggle button */
    }
}

@media (max-width: 900px) {
    .weekly-challenge-desktop-header {
        display: none;
    }
    
    .weekly-challenge-sidebar {
        padding-top: 0; /* Reset padding on mobile */
    }
}

/* Mobile Header for Weekly Challenge Page */
.weekly-challenge-mobile-header {
    display: none;
}

@media (max-width: 900px) {
    .weekly-challenge-mobile-header {
        display: block;
        padding: 10px 16px;
        border-bottom: 1px solid var(--border-color);
        flex-shrink: 0;
        min-height: 50px;
    }
    
    .mobile-header-actions {
        display: flex;
        align-items: center;
        justify-content: space-between;
        width: 100%;
        position: relative;
        height: 100%;
    }
    
    .mobile-header-logo {
        position: absolute;
        left: 50%;
        top: 50%;
        transform: translate(-50%, -50%);
        display: flex;
        align-items: center;
        justify-content: center;
        flex-shrink: 0;
        z-index: 1;
    }
    
    .mobile-logo-image {
        max-width: 40px;
        max-height: 40px;
        width: auto;
        height: auto;
        object-fit: contain;
    }
    
    .weekly-challenge-main {
        padding-top: 0;
    }
}

@media (max-width: 600px) {
    .weekly-challenge-mobile-header {
        padding: 8px 12px;
        min-height: 44px;
    }
    
    .mobile-logo-image {
        max-width: 36px;
        max-height: 36px;
    }
}

@media (max-width: 400px) {
    .mobile-logo-image {
        max-width: 32px;
        max-height: 32px;
    }
}

/* Challenge Flow Container */
.challenge-flow-container {
    position: relative;
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    overflow-x: hidden;
    will-change: scroll-position;
    -webkit-overflow-scrolling: touch;
}

.challenge-step {
    display: none;
    animation: fadeIn 0.3s ease-in-out;
}

.challenge-step.active {
    display: flex;
    flex-direction: column;
    height: 100%;
    max-height: 100%;
    overflow: hidden;
}

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

/* Start Screen */
.challenge-start-screen {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100%;
    padding: 40px 24px;
}

.challenge-start-content {
    max-width: 520px;
    width: 100%;
    text-align: center;
}

.challenge-badge {
    display: inline-flex;
    align-items: center;
    padding: 6px 14px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    margin-bottom: 24px;
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.challenge-start-title {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0 0 16px 0;
    line-height: 1.2;
}

.challenge-start-description {
    font-size: 1rem;
    line-height: 1.6;
    color: var(--text-secondary);
    margin: 0 0 32px 0;
    max-width: 460px;
    margin-left: auto;
    margin-right: auto;
}

.challenge-start-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 14px 28px;
    font-size: 1rem;
    font-weight: 600;
    min-width: 180px;
    transition: all 0.2s ease;
}

.challenge-start-btn svg {
    transition: transform 0.2s ease;
}

.challenge-start-btn:hover svg {
    transform: translateX(4px);
}

/* Challenge Section Header */
.challenge-section-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
    flex-shrink: 0;
}

.challenge-step-number {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--accent-blue);
    color: white;
    font-weight: 600;
    font-size: 0.9375rem;
    flex-shrink: 0;
}

.challenge-section-header h3 {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
}

/* Case Text Section */
.challenge-case-section,
.challenge-question-section,
.challenge-soe-section,
.challenge-results-section {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 16px;
    display: flex;
    flex-direction: column;
    min-height: 0;
    flex: 1;
    overflow: hidden;
    height: 100%;
    max-height: 100%;
    transform: translateZ(0);
    -webkit-backface-visibility: hidden;
    backface-visibility: hidden;
}

.challenge-results-header {
    flex-shrink: 0;
    margin-bottom: 16px;
}

.challenge-results-header h2 {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0;
}

.challenge-results-content {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    overflow-x: hidden;
    display: flex;
    flex-direction: column;
}

.challenge-case-text {
    font-size: 1.0625rem;
    line-height: 1.6;
    color: var(--text-primary);
    margin: 0 0 12px 0;
    padding: 0;
    white-space: pre-wrap;
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    overflow-x: hidden;
    word-wrap: break-word;
    overflow-wrap: break-word;
    text-indent: 0;
    -webkit-overflow-scrolling: touch;
}

.challenge-case-text::before {
    content: '';
    display: none;
}

.challenge-case-text > *:first-child,
.challenge-case-text:first-line {
    margin-top: 0 !important;
    padding-top: 0 !important;
}

/* Multiple True/False Questions */
.challenge-question-text {
    font-size: 1rem;
    font-weight: 500;
    color: var(--text-primary);
    margin: 0 0 12px 0;
    padding: 0;
    line-height: 1.5;
    white-space: pre-wrap;
    flex-shrink: 0;
    word-wrap: break-word;
    overflow-wrap: break-word;
    text-indent: 0;
}

.challenge-question-text::before {
    content: '';
    display: none;
}

.challenge-question-text > *:first-child,
.challenge-question-text:first-line {
    margin-top: 0 !important;
    padding-top: 0 !important;
}

.challenge-section-header {
    flex-shrink: 0;
}

.challenge-options {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 12px;
    flex: 1;
    min-height: 0;
    max-height: 100%;
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
}

.challenge-option-item {
    background: var(--bg-primary);
    border: 1.5px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 10px 14px;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.challenge-option-item:hover {
    border-color: var(--accent-blue);
}

.challenge-option-item.correct {
    border-color: #10b981;
    background: rgba(16, 185, 129, 0.1);
}

.challenge-option-item.incorrect {
    border-color: #ef4444;
    background: rgba(239, 68, 68, 0.1);
}

.challenge-option-item.missed {
    border-color: #f59e0b;
    background: rgba(245, 158, 11, 0.1);
}

.challenge-option-label {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    cursor: pointer;
    margin: 0;
}

.challenge-option-checkbox {
    width: 20px;
    height: 20px;
    margin-top: 2px;
    flex-shrink: 0;
    cursor: pointer;
}

.challenge-option-checkbox:disabled {
    cursor: not-allowed;
}

.challenge-option-text {
    flex: 1;
    font-size: 0.9375rem;
    line-height: 1.5;
    color: var(--text-primary);
}

.challenge-option-explanation {
    margin-top: 4px;
    padding-top: 6px;
    border-top: 1px solid var(--border-color);
    flex-shrink: 0;
}

.explanation-content {
    font-size: 0.875rem;
    line-height: 1.5;
    color: var(--text-secondary);
    margin: 0;
    padding: 0;
    white-space: pre-wrap;
    word-wrap: break-word;
    overflow-wrap: break-word;
    text-indent: 0;
}

.explanation-content::before {
    content: '';
    display: none;
}

.explanation-content > *:first-child,
.explanation-content:first-line {
    margin-top: 0 !important;
    padding-top: 0 !important;
}

/* SOE Questions */
.challenge-soe-content {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    overflow-x: hidden;
    display: flex;
    flex-direction: column;
    -webkit-overflow-scrolling: touch;
}

.challenge-soe-question {
    font-size: 1.0625rem;
    line-height: 1.6;
    color: var(--text-primary);
    margin: 0 0 10px 0;
    padding: 0;
    white-space: pre-wrap;
    flex-shrink: 0;
    word-wrap: break-word;
    overflow-wrap: break-word;
    text-indent: 0;
}

.challenge-soe-question::before {
    content: '';
    display: none;
}

.challenge-soe-question > *:first-child,
.challenge-soe-question:first-line {
    margin-top: 0 !important;
    padding-top: 0 !important;
}

.challenge-soe-answer {
    margin-top: 8px;
    padding: 12px;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    border-left: 4px solid var(--accent-blue);
    flex-shrink: 0;
}

.soe-answer-header {
    font-size: 0.9375rem;
    font-weight: 600;
    color: var(--accent-blue);
    margin-bottom: 8px;
}

.soe-answer-content {
    font-size: 1rem;
    line-height: 1.7;
    color: var(--text-primary);
    margin: 0;
    padding: 0;
    white-space: pre-wrap;
    word-wrap: break-word;
    overflow-wrap: break-word;
    text-indent: 0;
}

.soe-answer-content::before {
    content: '';
    display: none;
}

.soe-answer-content > *:first-child,
.soe-answer-content:first-line {
    margin-top: 0 !important;
    padding-top: 0 !important;
}

/* Navigation Buttons */
.challenge-nav-buttons {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    margin-top: auto;
    padding-top: 12px;
    border-top: 1px solid var(--border-color);
    flex-shrink: 0;
}

/* Button Styles */
.btn-primary,
.btn-secondary {
    padding: 12px 24px;
    border-radius: var(--radius-md);
    font-size: 0.9375rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    border: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
}

.btn-primary {
    background: linear-gradient(135deg, var(--accent-blue), var(--accent-purple));
    color: white;
}

.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.4);
}

.btn-secondary {
    background: var(--bg-secondary);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}

.btn-secondary:hover {
    background: var(--bg-hover);
    border-color: var(--text-secondary);
}

.challenge-nav-buttons .btn-primary,
.challenge-nav-buttons .btn-secondary {
    min-width: 120px;
}

.continue-after-solve-btn {
    margin-left: auto;
}

/* Results Section - Modern Compact Design */
.results-header-compact {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    margin-bottom: 12px;
    flex-shrink: 0;
}

.results-trophy {
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-md);
    flex-shrink: 0;
    animation: trophyPulse 2s ease-in-out infinite;
}

.results-trophy svg {
    width: 36px;
    height: 36px;
}

.trophy-gold {
    background: linear-gradient(135deg, #fbbf24, #f59e0b);
    color: #ffffff;
}

.trophy-silver {
    background: linear-gradient(135deg, #94a3b8, #64748b);
    color: #ffffff;
}

.trophy-bronze {
    background: linear-gradient(135deg, #d97706, #b45309);
    color: #ffffff;
}

.trophy-improve {
    background: linear-gradient(135deg, var(--accent-blue), var(--accent-purple));
    color: #ffffff;
}

@keyframes trophyPulse {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.05);
    }
}

.results-score-compact {
    flex: 0 0 auto;
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 100px;
}

.results-score-value-compact {
    font-size: 2rem;
    font-weight: 700;
    line-height: 1;
    color: var(--text-primary);
    display: flex;
    align-items: baseline;
    gap: 3px;
}

.score-percent {
    font-size: 1.25rem;
    font-weight: 600;
    opacity: 0.8;
}

.results-score-stats {
    font-size: 0.875rem;
    color: var(--text-secondary);
    font-weight: 500;
}

.results-message-inline {
    flex: 1;
    padding-left: 12px;
    border-left: 1px solid var(--border-color);
}

.results-message-inline p {
    margin: 0;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-primary);
    line-height: 1.4;
}

/* Results Breakdown */
.results-breakdown {
    margin-top: 0;
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
    max-height: 100%;
}

.results-breakdown h3 {
    font-size: 1.0625rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0 0 10px 0;
    flex-shrink: 0;
    padding-bottom: 6px;
    border-bottom: 2px solid var(--border-color);
}

.results-breakdown-item {
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 20px;
    margin-bottom: 16px;
    flex-shrink: 0;
}

.results-breakdown-item.correct {
    border-left: 4px solid #10b981;
}

.results-breakdown-item.incorrect {
    border-left: 4px solid #ef4444;
}

.breakdown-item-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.breakdown-item-status {
    font-size: 0.9375rem;
    font-weight: 600;
    padding: 4px 12px;
    border-radius: var(--radius-sm);
}

.results-breakdown-item.correct .breakdown-item-status {
    color: #10b981;
    background: rgba(16, 185, 129, 0.1);
}

.results-breakdown-item.incorrect .breakdown-item-status {
    color: #ef4444;
    background: rgba(239, 68, 68, 0.1);
}

.breakdown-item-question {
    font-size: 0.9375rem;
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: 8px;
    line-height: 1.5;
}

.breakdown-item-answer {
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin-bottom: 8px;
    line-height: 1.5;
}

.breakdown-item-explanation {
    font-size: 0.875rem;
    line-height: 1.5;
    color: var(--text-primary);
    padding-top: 8px;
    border-top: 1px solid var(--border-color);
    white-space: pre-line;
}

.breakdown-item-explanation strong {
    color: var(--text-primary);
    font-weight: 600;
}

/* Results Actions */
.results-actions {
    display: flex;
    justify-content: center;
    align-items: center;
    margin-top: 24px;
    padding-top: 24px;
    border-top: 1px solid var(--border-color);
}

.restart-challenge-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 10px 20px;
    font-size: 0.9375rem;
    font-weight: 600;
    gap: 6px;
    background: var(--bg-secondary);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all 0.2s ease;
}

.restart-challenge-btn:hover {
    background: var(--bg-hover);
    border-color: var(--accent-blue);
    color: var(--accent-blue);
    transform: translateY(-1px);
}

.restart-challenge-btn:active {
    transform: translateY(0);
}

.restart-challenge-btn svg {
    flex-shrink: 0;
    width: 16px;
    height: 16px;
}

/* Past Challenges Sidebar */
.past-challenges-header {
    margin-bottom: 12px;
    padding-bottom: 12px;
    border-bottom: 2px solid var(--border-color);
}

.past-challenges-header h3 {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
    letter-spacing: -0.2px;
}

.past-challenges-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
    max-height: calc(100vh - 300px);
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
    padding-right: 4px;
}

.past-challenges-list::-webkit-scrollbar {
    width: 4px;
}

.past-challenges-list::-webkit-scrollbar-track {
    background: transparent;
}

.past-challenges-list::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 2px;
}

.past-challenges-list::-webkit-scrollbar-thumb:hover {
    background: var(--text-secondary);
}

.past-challenge-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    background: var(--bg-primary);
    border: 1.5px solid var(--border-color);
    border-radius: var(--radius-md);
    text-decoration: none !important;
    color: var(--text-primary);
    transition: all 0.2s ease;
    width: 100%;
    cursor: pointer;
    font-family: inherit;
    font-size: inherit;
    position: relative;
    /* Prevent any link behavior */
    pointer-events: auto;
}

.past-challenge-item[href] {
    pointer-events: none;
}

.past-challenge-item a {
    pointer-events: none;
    text-decoration: none;
    color: inherit;
}

.past-challenge-item:hover {
    background: var(--bg-secondary);
    border-color: var(--accent-blue);
    transform: translateX(2px);
    box-shadow: 0 2px 8px rgba(59, 130, 246, 0.15);
}

.past-challenge-item.active {
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.1), rgba(139, 92, 246, 0.1));
    border-color: var(--accent-blue);
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.2);
}

.past-challenge-icon {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-secondary);
    border-radius: var(--radius-sm);
    flex-shrink: 0;
    color: var(--accent-blue);
    transition: all 0.2s ease;
}

.past-challenge-item:hover .past-challenge-icon {
    background: rgba(59, 130, 246, 0.1);
    transform: scale(1.05);
}

.past-challenge-item.active .past-challenge-icon {
    background: rgba(59, 130, 246, 0.2);
    color: var(--accent-blue);
}

.past-challenge-icon svg {
    width: 18px;
    height: 18px;
}

.past-challenge-info {
    flex: 1;
    min-width: 0;
    text-align: left;
}

.past-challenge-title {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 2px;
    line-height: 1.3;
    text-align: left;
}

.past-challenge-item.active .past-challenge-title {
    color: var(--accent-blue);
}

.past-challenge-meta {
    font-size: 0.75rem;
    color: var(--text-secondary);
    font-weight: 500;
    text-align: left;
}

.past-challenge-action {
    flex-shrink: 0;
    color: var(--text-secondary);
    transition: all 0.2s ease;
    opacity: 0.6;
}

.past-challenge-item:hover .past-challenge-action,
.past-challenge-item.active .past-challenge-action {
    color: var(--accent-blue);
    opacity: 1;
    transform: translateX(2px);
}

.past-challenges-empty {
    padding: 24px;
    text-align: center;
    color: var(--text-secondary);
    font-size: 0.9375rem;
}

/* Empty State */
.weekly-challenge-empty {
    text-align: center;
    padding: 80px 20px;
}

.empty-state-icon {
    color: var(--text-muted);
    margin-bottom: 24px;
    display: inline-block;
}

.weekly-challenge-empty h2 {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0 0 12px 0;
}

.weekly-challenge-empty p {
    font-size: 1rem;
    color: var(--text-secondary);
    margin: 0;
}

/* Responsive Design */
@media (max-width: 900px) {
    /* Sidebar Mobile Styles */
    .sidebar {
        position: fixed;
        top: 0;
        left: 0;
        height: 100vh;
        width: 260px;
        z-index: 9999;
        transform: translateX(-100%);
        transition: transform 0.3s ease;
        box-shadow: none;
    }
    
    .sidebar.active {
        transform: translateX(0);
        box-shadow: 2px 0 24px rgba(0, 0, 0, 0.3);
    }
    
    .mobile-sidebar-overlay {
        display: block;
    }
    
    .weekly-challenge-layout {
        flex-direction: column;
    }

    .weekly-challenge-sidebar {
        width: 100%;
    }

    .challenge-results-stats {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 1024px) {
    .weekly-challenge-layout {
        flex-direction: column;
    }

    .weekly-challenge-sidebar {
        width: 100%;
    }

    .challenge-results-stats {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .weekly-challenge-main {
        padding: 16px;
    }

    .weekly-challenge-layout {
        gap: 16px;
    }
    
    /* Past Challenges Horizontal Slider on Mobile */
    .past-challenges-slider-wrapper {
        position: relative;
        display: flex;
        align-items: center;
        gap: 8px;
    }
    
    .past-challenges-list {
        display: flex;
        flex-direction: row;
        gap: 12px;
        overflow-x: auto;
        overflow-y: hidden;
        -webkit-overflow-scrolling: touch;
        scroll-snap-type: x mandatory;
        scroll-behavior: smooth;
        padding: 12px 0;
        max-height: none;
        padding-right: 0;
        flex: 1;
        min-width: 0;
    }
    
    .past-challenges-list::-webkit-scrollbar {
        display: none;
    }
    
    .past-challenge-item {
        flex-shrink: 0;
        width: calc(100vw - 120px); /* Account for nav buttons (2x 40px) and gaps (2x 8px + padding) */
        max-width: 350px;
        min-width: 200px;
        scroll-snap-align: start;
    }
    
    .past-challenge-item:hover {
        transform: none;
    }
    
    /* Past Challenges Slider Navigation - Side buttons */
    .past-challenges-nav {
        display: flex;
        align-items: center;
        gap: 0;
        flex-shrink: 0;
        margin: 0;
        padding: 0;
        border: none;
    }
    
    .past-challenges-nav-btn {
        width: 40px;
        height: 40px;
        border-radius: 50%;
        border: 1.5px solid var(--border-color);
        background: var(--bg-primary);
        color: var(--text-primary);
        display: flex;
        align-items: center;
        justify-content: center;
        cursor: pointer;
        transition: all 0.2s ease;
        flex-shrink: 0;
        padding: 0;
        margin: 0;
    }
    
    .past-challenges-nav-btn:hover:not(:disabled) {
        background: var(--bg-secondary);
        border-color: var(--accent-blue);
        color: var(--accent-blue);
        transform: scale(1.05);
    }
    
    .past-challenges-nav-btn:disabled {
        opacity: 0.3;
        cursor: not-allowed;
    }
    
    .past-challenges-nav-btn svg {
        width: 20px;
        height: 20px;
    }
    
    .past-challenges-dots {
        display: none; /* Hide dots on mobile when buttons are on sides */
    }
    
    .past-challenges-dot {
        width: 6px;
        height: 6px;
        border-radius: 50%;
        background: var(--border-color);
        transition: all 0.2s ease;
        cursor: pointer;
        flex-shrink: 0;
    }
    
    .past-challenges-dot.active {
        background: var(--accent-blue);
        width: 24px;
        border-radius: 3px;
    }

    .challenge-step.active {
        height: auto;
        max-height: none;
        overflow: visible;
    }
    
    .challenge-case-section,
    .challenge-question-section,
    .challenge-soe-section,
    .challenge-results-section {
        padding: 20px;
        max-height: calc(100vh - 120px);
        height: auto;
        min-height: 0;
        display: flex;
        flex-direction: column;
        overflow-y: auto;
        overflow-x: hidden;
        -webkit-overflow-scrolling: touch;
    }
    
    .challenge-case-text {
        flex: 0 0 auto;
        overflow: visible;
        margin-bottom: 12px;
    }
    
    .challenge-options {
        flex: 0 0 auto;
        overflow: visible;
        gap: 10px;
        margin-bottom: 16px;
    }
    
    .challenge-soe-content {
        flex: 0 0 auto;
        overflow: visible;
    }
    
    .challenge-option-item {
        padding: 10px 14px;
    }
    
    .challenge-question-text {
        font-size: 0.9375rem;
        margin-bottom: 16px;
    }
    
    .challenge-section-header {
        margin-bottom: 16px;
    }

    .challenge-start-screen {
        padding: 40px 20px;
    }

    .challenge-start-screen h2 {
        font-size: 1.5rem;
    }

    .challenge-section-header h3 {
        font-size: 1.125rem;
    }

    .challenge-nav-buttons {
        flex-direction: row;
        gap: 10px;
        flex-wrap: wrap;
    }

    .challenge-nav-buttons .btn-primary,
    .challenge-nav-buttons .btn-secondary {
        flex: 1;
        min-width: calc(50% - 5px);
    }

    .continue-after-solve-btn {
        margin-left: 0;
    }
    
    /* Make restart button more compact on mobile */
    .restart-challenge-btn {
        padding: 8px 16px;
        font-size: 0.875rem;
        gap: 6px;
    }
    
    .restart-challenge-btn svg {
        width: 14px;
        height: 14px;
    }
    
    .results-actions {
        margin-top: 16px;
        padding-top: 16px;
    }

    .results-score-value {
        font-size: 2.5rem;
    }
}

@media (max-width: 600px) {
    .weekly-challenge-main {
        padding: 12px;
    }
    
    .weekly-challenge-layout {
        gap: 12px;
    }
    
    .challenge-start-title {
        font-size: 1.5rem;
    }
    
    .challenge-start-description {
        font-size: 0.875rem;
    }
    
    .challenge-start-btn {
        width: 100%;
        min-width: auto;
        padding: 12px 20px;
    }

    .challenge-case-section,
    .challenge-question-section,
    .challenge-soe-section,
    .challenge-results-section {
        padding: 16px;
        max-height: calc(100vh - 140px);
        height: auto;
        min-height: 0;
        display: flex;
        flex-direction: column;
        overflow-y: auto;
        overflow-x: hidden;
        -webkit-overflow-scrolling: touch;
    }
    
    .challenge-case-text {
        flex: 0 0 auto;
        overflow: visible;
        margin-bottom: 12px;
    }
    
    .challenge-options {
        flex: 0 0 auto;
        overflow: visible;
    }
    
    .challenge-soe-content {
        flex: 0 0 auto;
        overflow: visible;
    }
    
    .challenge-section-header {
        margin-bottom: 12px;
    }
    
    .challenge-section-header h3 {
        font-size: 1rem;
    }
    
    .challenge-step-number {
        width: 28px;
        height: 28px;
        font-size: 0.875rem;
    }

    .challenge-option-item {
        padding: 10px 12px;
    }
    
    .challenge-options {
        gap: 8px;
        margin-bottom: 16px;
    }

    .challenge-question-text,
    .challenge-soe-question {
        font-size: 0.875rem;
        margin-bottom: 12px;
        line-height: 1.5;
    }
    
    .challenge-option-text {
        font-size: 0.8125rem;
        line-height: 1.4;
    }
    
    .challenge-option-checkbox {
        width: 18px;
        height: 18px;
    }
    
    .explanation-content {
        font-size: 0.75rem;
        line-height: 1.5;
    }
    
    .challenge-nav-buttons {
        padding-top: 16px;
        gap: 10px;
        flex-direction: row;
    }
    
    .challenge-nav-buttons .btn-primary,
    .challenge-nav-buttons .btn-secondary {
        padding: 10px 16px;
        font-size: 0.875rem;
        flex: 1;
        min-width: calc(50% - 5px);
    }
    
    /* Make restart button even more compact on smaller screens */
    .restart-challenge-btn {
        padding: 8px 14px;
        font-size: 0.8125rem;
    }
    
    .restart-challenge-btn svg {
        width: 14px;
        height: 14px;
    }

    .results-header-compact {
        flex-direction: column;
        text-align: center;
        padding: 16px;
        gap: 12px;
    }

    .results-trophy {
        width: 48px;
        height: 48px;
    }

    .results-trophy svg {
        width: 36px;
        height: 36px;
    }

    .results-score-value-compact {
        font-size: 1.75rem;
    }

    .score-percent {
        font-size: 1.125rem;
    }

    .results-message-inline {
        padding-left: 0;
        padding-top: 12px;
        border-left: none;
        border-top: 1px solid var(--border-color);
    }

    .results-message-inline p {
        font-size: 0.875rem;
    }

    .results-breakdown h3 {
        font-size: 1rem;
        margin-bottom: 10px;
    }
    
    /* Past Challenges - More Compact on Small Screens */
    .past-challenges-header {
        margin-bottom: 8px;
        padding-bottom: 8px;
    }
    
    .past-challenges-header h3 {
        font-size: 0.875rem;
    }
    
    .past-challenges-slider-wrapper {
        gap: 6px;
    }
    
    .past-challenges-list {
        gap: 8px;
        padding: 8px 0;
    }
    
    .past-challenge-item {
        padding: 8px 10px;
        gap: 8px;
        width: calc(100vw - 108px); /* Account for nav buttons (2x 36px) and gaps (2x 6px + padding) */
    }
    
    .past-challenge-icon {
        width: 28px;
        height: 28px;
    }
    
    .past-challenge-icon svg {
        width: 16px;
        height: 16px;
    }
    
    .past-challenge-title {
        font-size: 0.8125rem;
        margin-bottom: 1px;
        line-height: 1.2;
    }
    
    .past-challenge-meta {
        font-size: 0.6875rem;
    }
    
    .past-challenge-action svg {
        width: 14px;
        height: 14px;
    }
    
    .past-challenges-nav-btn {
        width: 36px;
        height: 36px;
    }
    
    .past-challenges-nav-btn svg {
        width: 18px;
        height: 18px;
    }
    
    .past-challenges-empty {
        padding: 16px;
        font-size: 0.875rem;
    }
}

