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

:root {
    --bg: #0f1117;
    --surface: #1a1d27;
    --surface2: #252836;
    --text: #e4e4e7;
    --text-muted: #9ca3af;
    --primary: #6366f1;
    --primary-hover: #818cf8;
    --accent: #22c55e;
    --gold: #fbbf24;
    --silver: #d1d5db;
    --bronze: #d97706;
    --radius: 12px;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100dvh;
    line-height: 1.5;
}

.container {
    max-width: 600px;
    margin: 0 auto;
    padding: 1rem;
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.center { text-align: center; }

/* Card */
.card {
    background: var(--surface);
    border-radius: var(--radius);
    padding: 1.5rem;
}

h1 {
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
}

h2 { font-size: 1.2rem; }

.subtitle {
    color: var(--text-muted);
    margin-bottom: 1.5rem;
    font-size: 0.95rem;
}

/* Form start */
.form-start {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.form-start input {
    background: var(--surface2);
    border: 1px solid #374151;
    border-radius: 8px;
    padding: 0.85rem 1rem;
    color: var(--text);
    font-size: 1rem;
    outline: none;
    transition: border-color 0.2s;
}

.form-start input:focus {
    border-color: var(--primary);
}

/* Buttons */
.btn {
    display: inline-block;
    border: none;
    border-radius: 8px;
    padding: 0.85rem 1.25rem;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s, transform 0.1s;
    text-decoration: none;
    text-align: center;
    color: var(--text);
}

.btn:active { transform: scale(0.97); }

.btn-primary {
    background: var(--primary);
    color: #fff;
}
.btn-primary:hover { background: var(--primary-hover); }

.btn-secondary {
    background: var(--surface2);
}
.btn-secondary:hover { background: #374151; }

.btn-choice {
    background: var(--surface2);
    width: 100%;
    text-align: left;
    min-height: 52px;
    padding: 0.9rem 1rem;
    line-height: 1.4;
    border: 2px solid transparent;
}

.btn-choice:hover {
    border-color: var(--primary);
    background: #2a2d3a;
}

.btn-choice.selected {
    border-color: var(--primary);
    background: var(--primary);
    color: #fff;
}

.choices {
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
    margin-top: 1.25rem;
}

/* Quiz header / timer */
.quiz-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.question-count {
    font-weight: 700;
    font-size: 0.9rem;
    white-space: nowrap;
    color: var(--text-muted);
}

.timer-wrapper {
    flex: 1;
    height: 8px;
    background: var(--surface2);
    border-radius: 4px;
    overflow: hidden;
}

.timer-bar {
    height: 100%;
    width: 100%;
    background: var(--accent);
    border-radius: 4px;
    transition: width 0.15s linear, background-color 0.3s;
}

.timer-label {
    font-weight: 700;
    font-size: 0.9rem;
    min-width: 2.5rem;
    text-align: right;
    font-variant-numeric: tabular-nums;
}

.question-text {
    margin-bottom: 0.25rem;
}

/* Result */
.score-display {
    margin: 1.5rem 0 1rem;
}

.score-big {
    font-size: 3.5rem;
    font-weight: 800;
    color: var(--primary);
    line-height: 1;
}

.score-label {
    color: var(--text-muted);
    font-size: 1.1rem;
    margin-top: 0.25rem;
}

.stats {
    display: flex;
    justify-content: center;
    gap: 2rem;
    margin-bottom: 1.5rem;
}

.stat { text-align: center; }

.stat-value {
    display: block;
    font-size: 1.4rem;
    font-weight: 700;
}

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

/* Leaderboard */
.podium {
    display: flex;
    justify-content: center;
    gap: 0.75rem;
    margin: 1.25rem 0;
    flex-wrap: wrap;
}

.podium-item {
    background: var(--surface2);
    border-radius: var(--radius);
    padding: 1rem;
    text-align: center;
    min-width: 100px;
    flex: 1;
    max-width: 160px;
}

.podium-rank {
    display: block;
    font-size: 1.5rem;
    font-weight: 800;
    margin-bottom: 0.25rem;
}

.podium-1 .podium-rank { color: var(--gold); }
.podium-2 .podium-rank { color: var(--silver); }
.podium-3 .podium-rank { color: var(--bronze); }

.podium-1 { border: 2px solid var(--gold); }
.podium-2 { border: 2px solid var(--silver); }
.podium-3 { border: 2px solid var(--bronze); }

.podium-pseudo {
    display: block;
    font-weight: 600;
    font-size: 0.95rem;
    margin-bottom: 0.15rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.podium-score {
    font-size: 0.85rem;
    color: var(--text-muted);
}

.leaderboard-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 1rem;
    font-size: 0.9rem;
}

.leaderboard-table th {
    text-align: left;
    padding: 0.6rem 0.5rem;
    border-bottom: 1px solid #374151;
    color: var(--text-muted);
    font-weight: 600;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.leaderboard-table td {
    padding: 0.6rem 0.5rem;
    border-bottom: 1px solid #1f2233;
}

.leaderboard-table tr.highlight {
    background: rgba(99, 102, 241, 0.15);
}

.leaderboard-table tr.highlight td {
    font-weight: 600;
}
