* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    font-family: 'Segoe UI', Tahoma, sans-serif;
    background: #f4f7fb;
    color: #222;
    line-height: 1.6;
}

/* ---------- NAV ---------- */
.navbar {
    background: linear-gradient(135deg, #1e3a8a, #3b82f6);
    color: #fff;
    padding: .9rem 0;
    box-shadow: 0 2px 8px rgba(0,0,0,.15);
    position: sticky;
    top: 0;
    z-index: 100;
}
.nav-container {
    max-width: 1150px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 1rem;
    flex-wrap: wrap;
}
.logo { color: #fff; font-size: 1.4rem; font-weight: bold; text-decoration: none; }
.nav-links {
    display: flex;
    list-style: none;
    gap: 1.4rem;
    align-items: center;
}
.nav-links a, .nav-links button {
    color: #fff;
    text-decoration: none;
    font-weight: 500;
    font-size: .95rem;
    background: none;
    border: none;
    cursor: pointer;
    font-family: inherit;
}
.nav-links a:hover, .nav-links button:hover { opacity: .75; }
.btn-small {
    background: rgba(255,255,255,.15);
    padding: .4rem .9rem;
    border-radius: 6px;
}
.nav-toggle {
    display: none;
    background: none;
    border: none;
    color: #fff;
    font-size: 1.5rem;
    cursor: pointer;
}

/* ---------- LAYOUT ---------- */
.container {
    max-width: 950px;
    margin: 2rem auto;
    padding: 0 1rem;
    min-height: 60vh;
}

/* ---------- HERO ---------- */
.hero {
    text-align: center;
    padding: 3rem 1.5rem;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0,0,0,.08);
    margin-bottom: 2rem;
}
.hero h1 { font-size: 2.6rem; color: #1e3a8a; margin-bottom: 1rem; }
.hero p { font-size: 1.1rem; color: #555; margin-bottom: 2rem; }

/* ---------- LEVEL CARDS ---------- */
.level-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1.5rem;
    margin-top: 2rem;
}
.level-card {
    background: #fff;
    padding: 2rem 1.5rem;
    border-radius: 12px;
    text-align: center;
    text-decoration: none;
    color: #222;
    box-shadow: 0 4px 12px rgba(0,0,0,.08);
    transition: transform .2s, box-shadow .2s;
    border-top: 5px solid #3b82f6;
    display: block;
}
.level-card:hover { transform: translateY(-5px); box-shadow: 0 8px 24px rgba(0,0,0,.15); }
.level-card h2 { color: #1e3a8a; margin-bottom: .5rem; }
.level-card p { color: #666; font-size: .95rem; }

/* ---------- FORMS ---------- */
.form-card {
    background: #fff;
    padding: 2rem;
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0,0,0,.08);
    max-width: 440px;
    margin: 2rem auto;
}
.form-card h1 { color: #1e3a8a; margin-bottom: 1.5rem; text-align: center; }
.form-group { margin-bottom: 1.1rem; }
.form-group label { display: block; font-weight: 600; margin-bottom: .4rem; color: #374151; }
.form-group input, .form-group select {
    width: 100%;
    padding: .75rem 1rem;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    font-size: 1rem;
    font-family: inherit;
    background: #fff;
}
.form-group input:focus, .form-group select:focus { outline: none; border-color: #3b82f6; }

/* ---------- BUTTONS ---------- */
.btn {
    display: inline-block;
    padding: .85rem 2rem;
    background: #1e3a8a;
    color: #fff;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    transition: background .2s;
    text-align: center;
}
.btn:hover { background: #3b82f6; }
.btn-block { width: 100%; }
.btn-secondary { background: #6b7280; }
.btn-secondary:hover { background: #9ca3af; }

/* ---------- ALERTS ---------- */
.alert {
    padding: 1rem 1.25rem;
    border-radius: 8px;
    margin-bottom: 1rem;
    font-weight: 500;
}
.alert-error { background: #fef2f2; color: #991b1b; border-left: 4px solid #dc2626; }
.alert-info { background: #eff6ff; color: #1e40af; border-left: 4px solid #3b82f6; }
.alert-success { background: #ecfdf5; color: #065f46; border-left: 4px solid #10b981; }

/* ---------- QUESTIONS ---------- */
.question-card {
    background: #fff;
    padding: 2rem;
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0,0,0,.08);
    margin-bottom: 1.5rem;
}
.question-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 1rem;
    font-size: .85rem;
    color: #666;
    flex-wrap: wrap;
    gap: .5rem;
}
.badge {
    background: #dbeafe;
    color: #1e3a8a;
    padding: .25rem .75rem;
    border-radius: 12px;
    font-weight: 600;
    font-size: .8rem;
    display: inline-block;
    margin-right: .4rem;
}
.badge-hard   { background: #fee2e2; color: #991b1b; }
.badge-medium { background: #fef3c7; color: #92400e; }
.badge-easy   { background: #d1fae5; color: #065f46; }

.question-text {
    font-size: 1.15rem;
    margin-bottom: 1.5rem;
    color: #111;
    white-space: pre-line;
}
.options { display: flex; flex-direction: column; gap: .75rem; }
.option {
    display: flex;
    align-items: center;
    padding: .9rem 1rem;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    cursor: pointer;
    transition: all .2s;
    background: #fff;
}
.option:hover { border-color: #3b82f6; background: #eff6ff; }
.option input { margin-right: 1rem; }
.option.correct   { border-color: #10b981; background: #ecfdf5; }
.option.incorrect { border-color: #ef4444; background: #fef2f2; }

.solution-box {
    background: #f0f9ff;
    border-left: 4px solid #3b82f6;
    padding: 1.5rem;
    border-radius: 8px;
    margin-top: 1.5rem;
    white-space: pre-line;
    font-family: 'Courier New', monospace;
    font-size: .95rem;
    line-height: 1.7;
}

/* ---------- STATS ---------- */
.stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 1rem;
    margin-bottom: 2rem;
}
.stat {
    background: #fff;
    padding: 1.5rem;
    border-radius: 12px;
    text-align: center;
    box-shadow: 0 4px 12px rgba(0,0,0,.08);
}
.stat-value { font-size: 2rem; font-weight: bold; color: #1e3a8a; }
.stat-label { color: #666; font-size: .9rem; }

/* ---------- TIMER ---------- */
.timer-bar {
    position: sticky;
    top: 60px;
    background: #1e3a8a;
    color: #fff;
    padding: .75rem 1.5rem;
    border-radius: 8px;
    margin-bottom: 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-weight: 600;
    z-index: 90;
    box-shadow: 0 4px 12px rgba(30,58,138,.3);
}
.timer-bar.warning { background: #dc2626; animation: pulse 1s infinite; }
@keyframes pulse { 50% { opacity: .85; } }
.timer-display { font-family: 'Courier New', monospace; font-size: 1.3rem; }

/* ---------- TABLES ---------- */
table {
    width: 100%;
    background: #fff;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 12px rgba(0,0,0,.08);
    border-collapse: collapse;
}
th, td { padding: .9rem 1rem; text-align: left; }
th { background: #1e3a8a; color: #fff; font-weight: 600; }
tr:nth-child(even) td { background: #f9fafb; }

/* ---------- FILTER ROW ---------- */
.filter-row {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
    margin-bottom: 1.5rem;
    background: #fff;
    padding: 1.25rem;
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0,0,0,.08);
}
.filter-row .form-group { flex: 1; min-width: 140px; margin: 0; }
.filter-row .form-group label { font-size: .85rem; }

/* ---------- FOOTER ---------- */
footer {
    text-align: center;
    padding: 2rem;
    color: #666;
    font-size: .9rem;
}

/* ---------- RESPONSIVE ---------- */
@media (max-width: 700px) {
    .nav-toggle { display: block; }
    .nav-links {
        display: none;
        width: 100%;
        flex-direction: column;
        gap: .5rem;
        margin-top: 1rem;
        align-items: flex-start;
    }
    .nav-links.open { display: flex; }
    .hero h1 { font-size: 2rem; }
    .timer-bar { top: 0; }
}