:root {
    --primary: #6366f1;
    --primary-dark: #4f46e5;
    --secondary: #8b5cf6;
    --accent: #ec4899;
    --success: #10b981;
    --error: #ef4444;
    --warning: #f59e0b;
    --bg-main: #0f172a;
    --bg-card: #1e293b;
    --bg-input: #334155;
    --text-primary: #f1f5f9;
    --text-secondary: #cbd5e1;
    --text-muted: #94a3b8;
    --border: #475569;
    --shadow: rgba(99, 102, 241, 0.1);
}

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

body {
    font-family: 'Poppins', sans-serif;
    background: linear-gradient(135deg, #0f172a 0%, #1e293b 100%);
    color: var(--text-primary);
    min-height: 100vh;
    padding: 20px;
    position: relative;
    overflow-x: hidden;
}

body::before {
    content: '';
    position: fixed;
    top: -50%;
    right: -50%;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle, rgba(99, 102, 241, 0.1) 0%, transparent 70%);
    animation: float 20s infinite ease-in-out;
    pointer-events: none;
}

@keyframes float {
    0%, 100% { transform: translate(0, 0); }
    50% { transform: translate(-30px, 30px); }
}

.container {
    max-width: 900px;
    margin: 0 auto;
    position: relative;
    z-index: 1;
}

.header {
    text-align: center;
    margin-bottom: 40px;
    animation: slideDown 0.6s ease-out;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.header h1 {
    font-size: 2.5rem;
    font-weight: 700;
    background: linear-gradient(135deg, var(--primary), var(--secondary), var(--accent));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 10px;
    letter-spacing: -1px;
}

.header p {
    color: var(--text-secondary);
    font-size: 1.1rem;
}

.card {
    background: var(--bg-card);
    border-radius: 20px;
    padding: 30px;
    margin-bottom: 20px;
    box-shadow: 0 10px 40px var(--shadow);
    border: 1px solid var(--border);
    backdrop-filter: blur(10px);
    animation: fadeInUp 0.6s ease-out;
}

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

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

.input-group label {
    display: block;
    margin-bottom: 8px;
    color: var(--text-secondary);
    font-weight: 600;
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.input-group input, .input-group select {
    width: 100%;
    padding: 14px 18px;
    border: 2px solid var(--border);
    border-radius: 12px;
    background: var(--bg-input);
    color: var(--text-primary);
    font-size: 1rem;
    font-family: 'Poppins', sans-serif;
    transition: all 0.3s ease;
}

.input-group input:focus, .input-group select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

.btn {
    padding: 14px 32px;
    border: none;
    border-radius: 12px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    font-family: 'Poppins', sans-serif;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    position: relative;
    overflow: hidden;
}

.btn::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.1);
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}

.btn:hover::before {
    width: 300px;
    height: 300px;
}

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

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 25px rgba(99, 102, 241, 0.3);
}

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

.btn-secondary:hover {
    background: var(--border);
    transform: translateY(-2px);
}

.btn-success {
    background: linear-gradient(135deg, var(--success), #059669);
    color: white;
}

.btn-success:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 25px rgba(16, 185, 129, 0.3);
}

.btn-small {
    padding: 8px 16px;
    font-size: 0.85rem;
}

.timer-bar {
    background: var(--bg-card);
    border-radius: 15px;
    padding: 20px;
    margin-bottom: 20px;
    border: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 15px;
}

.timer {
    display: flex;
    align-items: center;
    gap: 10px;
}

.timer-icon {
    font-size: 1.5rem;
}

.timer-text {
    font-family: 'JetBrains Mono', monospace;
    font-size: 1.8rem;
    font-weight: 600;
    color: var(--primary);
}

.progress-info {
    display: flex;
    gap: 20px;
    align-items: center;
    flex-wrap: wrap;
}

.progress-item {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.progress-label {
    font-size: 0.8rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.progress-value {
    font-size: 1.3rem;
    font-weight: 700;
    font-family: 'JetBrains Mono', monospace;
}

.question-card {
    margin-bottom: 30px;
}

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

.question-number {
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    color: white;
    padding: 8px 16px;
    border-radius: 20px;
    font-weight: 600;
    font-size: 0.9rem;
}

.section-tag {
    background: var(--bg-input);
    color: var(--text-secondary);
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 0.85rem;
    border: 1px solid var(--border);
}

.question-text {
    font-size: 1.2rem;
    line-height: 1.6;
    margin-bottom: 25px;
    color: var(--text-primary);
    font-weight: 500;
}

.options {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.option {
    background: var(--bg-input);
    border: 2px solid var(--border);
    border-radius: 12px;
    padding: 16px 20px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 15px;
    position: relative;
}

.option:hover {
    border-color: var(--primary);
    background: rgba(99, 102, 241, 0.1);
    transform: translateX(5px);
}

.option.selected {
    border-color: var(--primary);
    background: rgba(99, 102, 241, 0.15);
}

.option.correct {
    border-color: var(--success);
    background: rgba(16, 185, 129, 0.15);
}

.option.incorrect {
    border-color: var(--error);
    background: rgba(239, 68, 68, 0.15);
}

.option.disabled {
    cursor: not-allowed;
    opacity: 0.7;
}

.option.disabled:hover {
    transform: none;
}

.option-letter {
    width: 35px;
    height: 35px;
    border-radius: 50%;
    background: var(--bg-card);
    border: 2px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.9rem;
    flex-shrink: 0;
}

.option.selected .option-letter {
    background: var(--primary);
    border-color: var(--primary);
    color: white;
}

.option.correct .option-letter {
    background: var(--success);
    border-color: var(--success);
    color: white;
}

.option.incorrect .option-letter {
    background: var(--error);
    border-color: var(--error);
    color: white;
}

.option-text {
    flex: 1;
    font-size: 1rem;
    line-height: 1.5;
}

.navigation {
    display: flex;
    gap: 15px;
    justify-content: space-between;
    margin-top: 30px;
    flex-wrap: wrap;
}

.results-card {
    text-align: center;
    padding: 40px;
}

.results-score {
    font-size: 5rem;
    font-weight: 700;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin: 20px 0;
    font-family: 'JetBrains Mono', monospace;
}

.results-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 20px;
    margin: 30px 0;
}

.stat-item {
    background: var(--bg-input);
    border-radius: 12px;
    padding: 20px;
    border: 1px solid var(--border);
}

.stat-value {
    font-size: 2rem;
    font-weight: 700;
    font-family: 'JetBrains Mono', monospace;
    margin-bottom: 5px;
}

.stat-label {
    color: var(--text-muted);
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.history-section {
    margin-top: 40px;
}

.history-title {
    font-size: 1.5rem;
    margin-bottom: 20px;
    color: var(--text-primary);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 15px;
}

.history-item {
    background: var(--bg-input);
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 15px;
    border: 1px solid var(--border);
    transition: all 0.3s ease;
}

.history-item.last-attempt {
    border: 2px solid var(--primary);
    background: rgba(99, 102, 241, 0.05);
}

.history-item:hover {
    border-color: var(--primary);
    transform: translateX(5px);
}

.badge-new {
    background: linear-gradient(135deg, var(--success), #059669);
    color: white;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-right: 10px;
}

.history-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 15px;
}

.history-info {
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
}

.history-detail {
    display: flex;
    flex-direction: column;
}

.history-label {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.history-value {
    font-weight: 600;
    font-family: 'JetBrains Mono', monospace;
}

.hidden {
    display: none !important;
}

.fade-in {
    animation: fadeIn 0.5s ease-out;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.explanation {
    background: rgba(99, 102, 241, 0.1);
    border-left: 4px solid var(--primary);
    padding: 15px;
    margin-top: 15px;
    border-radius: 8px;
    font-size: 0.95rem;
    line-height: 1.6;
}

.explanation-label {
    font-weight: 600;
    color: var(--primary);
    margin-bottom: 5px;
}

.review-mode-indicator {
    background: linear-gradient(135deg, var(--warning), #f97316);
    color: white;
    padding: 12px 20px;
    border-radius: 12px;
    text-align: center;
    margin-bottom: 20px;
    font-weight: 600;
}

.filter-buttons {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.filter-btn {
    padding: 8px 16px;
    border: 2px solid var(--border);
    background: var(--bg-input);
    color: var(--text-primary);
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: 600;
    transition: all 0.3s ease;
    font-family: 'Poppins', sans-serif;
}

.filter-btn.active {
    background: var(--primary);
    border-color: var(--primary);
    color: white;
}

.filter-btn:hover {
    border-color: var(--primary);
}

/* Mobile Responsive */
@media (max-width: 768px) {
    body {
        padding: 15px;
    }

    .header h1 {
        font-size: 2rem;
    }

    .header p {
        font-size: 1rem;
    }

    .card {
        padding: 20px;
    }

    .timer-bar {
        flex-direction: column;
        align-items: flex-start;
    }

    .timer-text {
        font-size: 1.5rem;
    }

    .question-text {
        font-size: 1.1rem;
    }

    .results-score {
        font-size: 3.5rem;
    }

    .navigation {
        flex-direction: column;
    }

    .btn {
        width: 100%;
    }

    .history-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .history-title {
        flex-direction: column;
        align-items: flex-start;
    }
}
