* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    padding: 20px;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    background: white;
    border-radius: 20px;
    padding: 40px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

h1 {
    text-align: center;
    color: #667eea;
    margin-bottom: 30px;
    font-size: 2.5em;
}

h2 {
    color: #764ba2;
    margin-bottom: 20px;
}

.language-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-top: 30px;
}

.language-card {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 40px;
    border-radius: 15px;
    cursor: pointer;
    transition: transform 0.3s, box-shadow 0.3s;
    text-align: center;
}

.language-card:hover {
    transform: translateY(-10px);
    box-shadow: 0 15px 30px rgba(0, 0, 0, 0.3);
}

.language-card h3 {
    font-size: 1.8em;
    margin-bottom: 10px;
}

.test-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
    margin-top: 20px;
}

.test-card {
    background: #f8f9fa;
    padding: 25px;
    border-radius: 10px;
    cursor: pointer;
    border: 2px solid #e0e0e0;
    transition: all 0.3s;
}

.test-card:hover {
    border-color: #667eea;
    background: #f0f4ff;
}

.test-card h4 {
    color: #667eea;
    margin-bottom: 10px;
}

.form-container {
    max-width: 500px;
    margin: 0 auto;
}

.form-group {
    margin-bottom: 20px;
}

label {
    display: block;
    margin-bottom: 8px;
    color: #333;
    font-weight: 500;
}

input {
    width: 100%;
    padding: 12px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 16px;
    transition: border 0.3s;
}

input:focus {
    outline: none;
    border-color: #667eea;
}

button {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 12px 30px;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    cursor: pointer;
    transition: transform 0.2s;
}

button:hover {
    transform: scale(1.05);
}

button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.back-btn {
    background: #6c757d;
    margin-bottom: 20px;
}

/* QUIZ PAGE LAYOUT */
.quiz-layout {
    display: grid;
    grid-template-columns: 1fr 280px;
    gap: 20px;
    margin-top: 20px;
}

.quiz-main {
    min-width: 0;
}

.quiz-sidebar {
    position: sticky;
    top: 20px;
    height: fit-content;
}

/* QUIZ HEADER - REDUCED SIZE */
.quiz-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding: 15px 18px;
    background: #f8f9fa;
    border-radius: 10px;
}

.quiz-info {
    display: flex;
    gap: 25px;
    align-items: center;
}

.info-item {
    display: flex;
    flex-direction: column;
}

.info-label {
    font-size: 0.85em;
    color: #666;
    margin-bottom: 4px;
}

.info-value {
    font-size: 1.1em;
    font-weight: bold;
    color: #333;
}

.timer {
    background: #ff6b6b;
    color: white;
    padding: 12px 20px;
    border-radius: 8px;
    font-size: 1.2em;
    font-weight: bold;
}

/* QUESTION SECTION - REDUCED SIZE */
.question-section {
    background: white;
    border: 2px solid #e0e0e0;
    border-radius: 12px;
    padding: 25px 28px;
    margin-bottom: 20px;
    min-height: 420px;
}

.question-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 2px solid #f0f0f0;
}

.question-number {
    font-size: 1.05em;
    font-weight: bold;
    color: #667eea;
}

.question-marks {
    background: #667eea;
    color: white;
    padding: 5px 15px;
    border-radius: 18px;
    font-size: 0.9em;
}

.question-text {
    font-size: 1.15em;
    margin-bottom: 25px;
    color: #222;
    line-height: 1.6;
    font-weight: 500;
}

.options-container {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

/* OPTIONS - REDUCED SIZE */
.option {
    background: #f8f9fa;
    padding: 15px 18px;
    border-radius: 10px;
    cursor: pointer;
    border: 2px solid #e0e0e0;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    gap: 15px;
}

.option-label {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: white;
    border: 2px solid #667eea;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    color: #667eea;
    flex-shrink: 0;
    font-size: 1em;
}

.option-text {
    flex: 1;
    font-size: 1em;
    line-height: 1.4;
}

.option:hover {
    border-color: #667eea;
    background: #f0f4ff;
    transform: translateX(5px);
}

.option.selected {
    border-color: #667eea;
    background: #667eea;
    color: white;
}

.option.selected .option-label {
    background: white;
    color: #667eea;
    border-color: white;
}

/* NAVIGATION */
.navigation {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 20px;
}

.nav-buttons {
    display: flex;
    gap: 12px;
}

/* SIDEBAR - QUESTION PALETTE - COMPACT DESIGN */
.question-palette {
    background: #f8f9fa;
    padding: 18px 14px;
    border-radius: 12px;
    border: 2px solid #e0e0e0;
    max-height: calc(100vh - 180px);
    overflow-y: auto;
}

.palette-header {
    font-weight: bold;
    color: #333;
    margin-bottom: 14px;
    font-size: 1em;
    text-align: center;
    position: sticky;
    top: 0;
    background: #f8f9fa;
    padding-bottom: 8px;
    z-index: 10;
}

.palette-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 7px;
    margin-bottom: 14px;
}

.question-btn {
    width: 100%;
    height: 36px;
    min-height: 36px;
    max-height: 36px;
    border-radius: 6px;
    background: white;
    border: 2px solid #e0e0e0;
    cursor: pointer;
    transition: all 0.2s;
    font-weight: 600;
    font-size: 0.88em;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
}

.question-btn.answered {
    background: #28a745;
    color: white;
    border-color: #28a745;
}

.question-btn.active {
    border-color: #667eea;
    border-width: 2.5px;
    background: #667eea;
    color: white;
    box-shadow: 0 0 8px rgba(102, 126, 234, 0.4);
}

.question-btn:hover {
    transform: scale(1.08);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
}

.palette-legend {
    display: flex;
    flex-direction: column;
    gap: 9px;
    margin-top: 14px;
    padding-top: 14px;
    border-top: 2px solid #e0e0e0;
    position: sticky;
    bottom: 0;
    background: #f8f9fa;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.85em;
}

.legend-box {
    width: 22px;
    height: 22px;
    min-width: 22px;
    min-height: 22px;
    border-radius: 5px;
    border: 2px solid #e0e0e0;
    flex-shrink: 0;
}

.legend-box.answered {
    background: #28a745;
    border-color: #28a745;
}

.legend-box.current {
    background: #667eea;
    border-color: #667eea;
}

/* Scrollbar styling for palette */
.question-palette::-webkit-scrollbar {
    width: 5px;
}

.question-palette::-webkit-scrollbar-track {
    background: #e0e0e0;
    border-radius: 10px;
}

.question-palette::-webkit-scrollbar-thumb {
    background: #667eea;
    border-radius: 10px;
}

.question-palette::-webkit-scrollbar-thumb:hover {
    background: #764ba2;
}

/* RESULT PAGE */
.result-container {
    text-align: center;
    padding: 40px;
}

.result-header {
    margin-bottom: 40px;
}

.result-icon {
    font-size: 5em;
    margin-bottom: 20px;
}

.score-card {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 40px;
    border-radius: 20px;
    margin: 30px auto;
    max-width: 450px;
}

.score-display {
    font-size: 4em;
    font-weight: bold;
    margin: 20px 0;
}

.score-label {
    font-size: 1.3em;
    opacity: 0.9;
}

.result-details {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 20px;
    margin: 30px 0;
}

.detail-card {
    background: #f8f9fa;
    padding: 30px;
    border-radius: 15px;
    border: 2px solid #e0e0e0;
}

.detail-value {
    font-size: 2.5em;
    font-weight: bold;
    color: #667eea;
    margin-bottom: 10px;
}

.detail-label {
    color: #666;
    font-size: 1.15em;
}

.weak-topics {
    text-align: left;
    margin-top: 30px;
    padding: 30px;
    background: #fff3cd;
    border-radius: 15px;
    border-left: 5px solid #ffc107;
}

.weak-topics h3 {
    color: #856404;
    margin-bottom: 20px;
    font-size: 1.3em;
}

.weak-topics ul {
    margin-left: 25px;
    margin-top: 15px;
}

.weak-topics li {
    margin-bottom: 12px;
    color: #856404;
    font-size: 1.1em;
    line-height: 1.6;
}

.hidden {
    display: none;
}



/* Code block styling for questions */
.question-text {
    font-size: 1.15em;
    margin-bottom: 25px;
    color: #222;
    line-height: 1.6;
    font-weight: 500;
    white-space: pre-wrap;
}

.code-block {
    display: block;
    background: #f4f4f4;
    border: 1px solid #ddd;
    border-left: 4px solid #667eea;
    color: #333;
    font-family: 'Courier New', Courier, monospace;
    font-size: 0.9em;
    line-height: 1.5;
    margin: 15px 0;
    padding: 15px 20px;
    white-space: pre;
    overflow-x: auto;
    border-radius: 5px;
}






/* RESPONSIVE */
@media (max-width: 1200px) {
    .quiz-layout {
        grid-template-columns: 1fr 260px;
    }

    .quiz-sidebar {
        max-width: 260px;
    }

    .palette-grid {
        grid-template-columns: repeat(4, 1fr);
        gap: 6px;
    }

    .question-btn {
        height: 34px;
        min-height: 34px;
        max-height: 34px;
        font-size: 0.85em;
    }
}

@media (max-width: 1024px) {
    .quiz-layout {
        grid-template-columns: 1fr;
    }

    .quiz-sidebar {
        position: static;
        max-width: 100%;
    }

    .question-palette {
        max-height: 320px;
    }

    .palette-grid {
        grid-template-columns: repeat(10, 1fr);
        gap: 7px;
    }

    .question-btn {
        height: 36px;
        min-height: 36px;
        max-height: 36px;
        font-size: 0.88em;
    }
}

@media (max-width: 768px) {
    .container {
        padding: 20px;
    }

    h1 {
        font-size: 1.8em;
    }

    .quiz-header {
        flex-direction: column;
        gap: 15px;
        padding: 15px;
    }

    .quiz-info {
        flex-direction: column;
        gap: 12px;
        width: 100%;
    }

    .question-section {
        padding: 20px;
        min-height: 380px;
    }

    .question-text {
        font-size: 1.05em;
    }

    .option {
        padding: 12px 15px;
    }

    .option-label {
        width: 32px;
        height: 32px;
        font-size: 0.95em;
    }

    .option-text {
        font-size: 0.95em;
    }

    .navigation {
        flex-direction: column;
    }

    .nav-buttons {
        width: 100%;
        justify-content: space-between;
    }

    .palette-grid {
        grid-template-columns: repeat(8, 1fr);
        gap: 6px;
    }

    .question-btn {
        height: 34px;
        min-height: 34px;
        max-height: 34px;
        font-size: 0.82em;
    }

    .question-palette {
        max-height: 280px;
        padding: 14px 12px;
    }

    .legend-item {
        font-size: 0.8em;
    }

    .legend-box {
        width: 20px;
        height: 20px;
        min-width: 20px;
        min-height: 20px;
    }
}

@media (max-width: 480px) {
    .palette-grid {
        grid-template-columns: repeat(6, 1fr);
        gap: 5px;
    }

    .question-btn {
        height: 32px;
        min-height: 32px;
        max-height: 32px;
        font-size: 0.78em;
    }

    .question-palette {
        padding: 12px 10px;
    }

    .question-section {
        padding: 18px;
        min-height: 350px;
    }
}