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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    font-style: normal;
    background: #E3E3E3;
    min-height: 100vh;
    padding: 20px 20px 140px 20px;
}

em,
i {
    font-style: normal;
}

.container {
    max-width: 800px;
    margin: 0 auto;
    background: white;
    border-radius: 12px;
    padding: 40px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    border: 2px solid #E3E3E3;
}

body.locked .container {
    max-width: 100%;
    height: calc(100vh - 120px);
    border-radius: 0;
    overflow-y: auto;
    padding: 80px 40px 40px;
    margin: 0;
}

h1 {
    color: #000;
    margin-bottom: 10px;
    text-align: center;
    font-size: 2.2em;
    font-weight: 700;
}

.subtitle {
    text-align: center;
    color: #666;
    margin-bottom: 30px;
    font-size: 1.1em;
}

.form-group {
    margin-bottom: 20px;
}

label {
    display: block;
    margin-bottom: 8px;
    color: #000;
    font-weight: 600;
}

input,
textarea,
select {
    width: 100%;
    padding: 12px;
    border: 2px solid #E3E3E3;
    border-radius: 6px;
    font-size: 16px;
    transition: border-color 0.3s;
    background: #fff;
    color: #000;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
}

textarea {
    font-family: 'Courier New', monospace;
}

input:focus,
textarea:focus,
select:focus {
    outline: none;
    border-color: #EA5A2F;
    box-shadow: 0 0 0 3px rgba(234, 90, 47, 0.1);
}

.btn {
    background: #EA5A2F;
    color: white;
    padding: 15px 30px;
    border: none;
    border-radius: 6px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    width: 100%;
    transition: all 0.3s ease;
}

.btn:hover {
    transform: translateY(-2px);
    background: #d84a1f;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
    background: #E3E3E3;
    color: #666;
}

.btn-secondary {
    background: #6c757d;
    color: white;
    padding: 10px 20px;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

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

.status {
    padding: 15px;
    border-radius: 6px;
    margin-top: 20px;
    display: none;
}

.status.success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
    display: block;
}

.status.error {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
    display: block;
}

.tabs {
    display: flex;
    gap: 10px;
    margin-bottom: 30px;
    border-bottom: 2px solid #E3E3E3;
}

.tab {
    padding: 12px 24px;
    background: none;
    border: none;
    border-bottom: 3px solid transparent;
    cursor: pointer;
    font-size: 16px;
    font-weight: 600;
    color: #666;
    transition: all 0.3s;
}

.tab.active {
    color: #EA5A2F;
    border-bottom-color: #EA5A2F;
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

.score-card {
    background: #f8f9fa;
    padding: 20px;
    border-radius: 8px;
    margin-bottom: 15px;
    border-left: 4px solid #EA5A2F;
}

.score-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.score-details {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 10px;
    margin-top: 10px;
}

.score-item {
    padding: 8px;
    background: white;
    border-radius: 4px;
}

.correct {
    color: #28a745;
    font-weight: bold;
}

.incorrect {
    color: #dc3545;
    font-weight: bold;
}

.feedback-box {
    background: #fff;
    border: 2px solid #EA5A2F;
    border-radius: 6px;
    padding: 20px;
    margin-top: 15px;
}

.feedback-box h4 {
    color: #EA5A2F;
    margin-bottom: 15px;
}

.profile-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    background: #EA5A2F;
    color: white;
    border-radius: 8px 8px 0 0;
    margin: -40px -40px 20px -40px;
}

.profile-meta {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.profile-name-row {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.profile-name {
    font-size: 18px;
    font-weight: 600;
}

.profile-rank {
    display: flex;
    align-items: center;
    gap: 8px;
    background: rgba(255, 255, 255, 0.15);
    padding: 6px 10px;
    border-radius: 12px;
    font-weight: 600;
    font-size: 13px;
    font-style: normal;
}

.profile-rank.hidden {
    display: none;
}

.profile-rank .rank-badge-large {
    background: white;
    color: #EA5A2F;
    padding: 6px 10px;
    border-radius: 14px;
    font-size: 13px;
    font-weight: 700;
}

.profile-rank .rank-text {
    opacity: 0.9;
}

.logout-btn {
    background: rgba(255, 255, 255, 0.2);
    color: white;
    padding: 8px 16px;
    border: 1px solid white;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
}

.logout-btn:hover {
    background: rgba(255, 255, 255, 0.3);
}

.hidden {
    display: none !important;
}

.question-section {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: #f8f9fa;
    padding: 80px 40px 100px;
    overflow-y: scroll;
    overflow-x: hidden;
    z-index: 100;
    -webkit-overflow-scrolling: touch;
}

.question-box {
    background: #f8f9fa;
    padding: 30px;
    border-radius: 8px;
    margin-bottom: 20px;
    border-left: 4px solid #EA5A2F;
    min-height: 200px;
    font-style: normal;
}

.question-box h2 {
    color: #000;
    margin-bottom: 20px;
    font-size: 1.8em;
}

.question-box p {
    color: #333;
    font-size: 1.1em;
    line-height: 1.6;
    margin-bottom: 25px;
}

.question-image {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
    margin: 20px 0;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    display: block;
}

.latex-editor-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-top: 20px;
}

.latex-input-section,
.latex-preview-section {
    background: #fff;
    border: 2px solid #E3E3E3;
    border-radius: 8px;
    padding: 15px;
    height: 500px;
    overflow-y: auto;
}

.latex-input-section h3,
.latex-preview-section h3 {
    color: #EA5A2F;
    margin-bottom: 10px;
    font-size: 16px;
}

#latexInput {
    width: 100%;
    height: calc(100% - 40px);
    border: 1px solid #ddd;
    border-radius: 4px;
    padding: 10px;
    font-family: 'Courier New', monospace;
    font-size: 14px;
    resize: none;
}

#latexPreview {
    min-height: calc(100% - 40px);
    padding: 10px;
    background: #fafafa;
    border: 1px solid #ddd;
    border-radius: 4px;
    overflow-y: auto;
}

/* Active Navigation Button Style */
.question-nav-btn.active {
    background-color: #EA5A2F !important;
    color: white !important;
    border-color: #EA5A2F !important;
}

.timer {
    position: fixed;
    top: 20px;
    left: 20px;
    background: white;
    padding: 15px 25px;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    font-size: 18px;
    font-weight: 600;
    color: #000;
    z-index: 10000;
    border: 2px solid #E3E3E3;
    display: none;
}

.progress-indicator {
    position: fixed;
    top: 80px;
    left: 20px;
    background: white;
    padding: 15px 25px;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    font-size: 16px;
    font-weight: 600;
    color: #EA5A2F;
    z-index: 10000;
    border: 2px solid #E3E3E3;
    display: none;
}

.ai-helper {
    position: fixed;
    top: 20px;
    right: 20px;
    width: 350px;
    background: white;
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    border: 2px solid #E3E3E3;
    z-index: 10001;
    display: none;
}

.ai-helper.show {
    display: block;
}

.ai-header {
    background: #EA5A2F;
    color: white;
    padding: 15px;
    border-radius: 10px 10px 0 0;
    font-weight: 600;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.ai-close {
    background: none;
    border: none;
    color: white;
    font-size: 20px;
    cursor: pointer;
    padding: 0;
    width: 25px;
    height: 25px;
}

.ai-chat-container {
    height: 400px;
    overflow-y: auto;
    padding: 15px;
    background: #f8f9fa;
}

.ai-message {
    margin-bottom: 15px;
    padding: 10px;
    border-radius: 8px;
    max-width: 90%;
}

.ai-message.user {
    background: #EA5A2F;
    color: white;
    margin-left: auto;
}

.ai-message.assistant {
    background: white;
    border: 1px solid #E3E3E3;
}

.ai-input-container {
    padding: 15px;
    border-top: 2px solid #E3E3E3;
    display: flex;
    gap: 10px;
    align-items: center;
}

.ai-input-container input {
    flex: 1;
    padding: 10px;
    border: 2px solid #E3E3E3;
    border-radius: 6px;
    font-size: 14px;
}

.ai-input-container button {
    background: #EA5A2F;
    color: white;
    border: none;
    border-radius: 6px;
    padding: 10px 16px;
    font-weight: 600;
    cursor: pointer;
}

.ai-toggle-btn {
    position: fixed;
    top: 20px;
    right: 20px;
    background: #EA5A2F;
    color: white;
    padding: 12px 20px;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    z-index: 10000;
    display: none;
}

.latex-help-btn {
    position: fixed;
    top: 20px;
    right: 180px;
    background: #4A90E2;
    color: white;
    width: 32px;
    height: 32px;
    border: none;
    border-radius: 50%;
    font-weight: bold;
    font-size: 18px;
    line-height: 1;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    z-index: 10000;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 0;
}

.latex-help-btn:hover {
    background: #3A7BC8;
}

.latex-help-dropdown {
    position: fixed;
    top: 65px;
    right: 180px;
    width: 400px;
    max-height: 500px;
    overflow-y: auto;
    background: white;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
    z-index: 10001;
    display: none;
    padding: 20px;
    border: 2px solid #4A90E2;
}

.latex-help-dropdown.show {
    display: block;
}

.latex-help-dropdown h3 {
    color: #4A90E2;
    margin-bottom: 15px;
    font-size: 18px;
    border-bottom: 2px solid #E3E3E3;
    padding-bottom: 10px;
}

.latex-help-section {
    margin-bottom: 20px;
}

.latex-help-section h4 {
    color: #000;
    font-size: 14px;
    margin-bottom: 8px;
}

.latex-help-section code {
    background: #f4f4f4;
    padding: 2px 6px;
    border-radius: 3px;
    font-family: 'Courier New', monospace;
    font-size: 13px;
    color: #e83e8c;
}

.latex-help-section p {
    font-size: 13px;
    color: #666;
    margin: 5px 0;
    line-height: 1.6;
}

.warning-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(234, 90, 47, 0.95);
    z-index: 99999;
    color: white;
    justify-content: center;
    align-items: center;
    flex-direction: column;
    font-size: 24px;
    font-weight: 600;
    text-align: center;
    padding: 20px;
    font-style: normal;
}

.warning-overlay.show {
    display: flex;
}

.warning-count {
    font-size: 48px;
    color: #000;
    margin: 20px 0;
}

.loading-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    z-index: 99999;
    justify-content: center;
    align-items: center;
}

.loading-modal.show {
    display: flex;
}

.loading-content {
    background: white;
    padding: 40px 60px;
    border-radius: 15px;
    text-align: center;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
}

.spinner {
    width: 60px;
    height: 60px;
    border: 5px solid #f3f3f3;
    border-top: 5px solid #EA5A2F;
    border-radius: 50%;
    margin: 0 auto 20px;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

.confirmation-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    z-index: 100000;
    justify-content: center;
    align-items: center;
}

.confirmation-modal.show {
    display: flex;
}

.confirmation-content {
    background: white;
    padding: 40px;
    border-radius: 15px;
    max-width: 600px;
    width: 90%;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
}

.confirmation-content h2 {
    color: #EA5A2F;
    margin-bottom: 20px;
}

.confirmation-content ul {
    text-align: left;
    margin: 20px 0;
    padding-left: 30px;
    line-height: 1.8;
}

.confirmation-content ul li {
    margin: 10px 0;
}

.confirmation-buttons {
    display: flex;
    gap: 15px;
    margin-top: 30px;
}

.confirm-btn {
    flex: 1;
    padding: 15px;
    border: none;
    border-radius: 6px;
    font-weight: 600;
    font-size: 16px;
    cursor: pointer;
}

.confirm-btn.start {
    background: #28a745;
    color: white;
}

.confirm-btn.cancel {
    background: #dc3545;
    color: white;
}

.resume-test-banner {
    background: #fff3cd;
    border: 2px solid #ffc107;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 20px;
    text-align: center;
}

.resume-test-banner h3 {
    color: #856404;
    margin-bottom: 15px;
}

.resume-test-banner p {
    color: #856404;
    margin-bottom: 15px;
}

.leaderboard-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 20px;
}

.leaderboard-table thead {
    background: #EA5A2F;
    color: white;
}

.leaderboard-table th {
    padding: 15px;
    text-align: left;
    font-weight: 600;
}

.leaderboard-table td {
    padding: 12px 15px;
    border-bottom: 1px solid #E3E3E3;
}

.leaderboard-table tbody tr:hover {
    background: #f8f9fa;
}

.rank-badge {
    display: inline-block;
    width: 30px;
    height: 30px;
    line-height: 30px;
    text-align: center;
    border-radius: 50%;
    font-weight: bold;
    color: white;
}

.rank-1 {
    background: #FFD700;
    color: #000;
}

.rank-2 {
    background: #C0C0C0;
    color: #000;
}

.rank-3 {
    background: #CD7F32;
    color: white;
}

.rank-other {
    background: #6c757d;
}

.forgot-password-link {
    text-align: center;
    margin-top: 15px;
}

.forgot-password-link a {
    color: #EA5A2F;
    text-decoration: none;
    font-size: 14px;
}

.forgot-password-link a:hover {
    text-decoration: underline;
}



.sponsor-footer {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: white;
    border-top: 2px solid #E3E3E3;
    padding: 15px 20px;
    z-index: 9997;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 20px;
    flex-wrap: wrap;
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.05);
}

.sponsor-label {
    font-size: 11px;
    color: #666;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-right: 10px;
}

.sponsor-logos {
    display: flex;
    align-items: center;
    gap: 30px;
    flex-wrap: wrap;
}

.sponsor-logo {
    height: 48px;
    width: auto;
    object-fit: contain;
    opacity: 0.8;
    transition: opacity 0.3s;
}

.sponsor-logo:hover {
    opacity: 1;
}

/* Rubric toggle button */
.rubric-toggle {
    display: inline-block;
    margin-left: 12px;
    padding: 6px 12px;
    background: #EA5A2F;
    color: white;
    border: 2px solid #EA5A2F;
    border-radius: 6px;
    font-weight: 600;
    cursor: pointer;
    font-size: 13px;
    transition: all 0.3s ease;
}

.rubric-toggle:hover {
    background: #d84a1f;
    transform: translateY(-1px);
}

.rubric-toggle.hidden {
    display: none;
}

@media (max-width: 1200px) {
    .latex-editor-container {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    body {
        padding-bottom: 180px;
    }

    .rank-footer {
        bottom: 60px;
        padding: 10px 15px;
    }

    .rank-content {
        flex-direction: column;
        gap: 8px;
        font-size: 14px;
    }

    .sponsor-footer {
        padding: 12px 15px;
        gap: 15px;
    }

    .sponsor-label {
        font-size: 10px;
        width: 100%;
        text-align: center;
        margin: 0 0 5px 0;
    }

    .sponsor-logos {
        gap: 20px;
        justify-content: center;
    }

    .sponsor-logo {
        height: 40px;
    }
}