:root {
    /* Light mode - shades of blue */
    --bg-gradient-start: #e3f2fd;
    --bg-gradient-end: #bbdefb;
    --container-bg: #ffffff;
    --text-primary: #0d47a1;
    --text-secondary: #1565c0;
    --text-tertiary: #1976d2;
    --stats-bg: #e3f2fd;
    --card-gradient-start: #1976d2;
    --card-gradient-end: #1565c0;
    --input-border: #90caf9;
    --input-focus: #1976d2;
    --btn-primary: #1976d2;
    --btn-primary-hover: #1565c0;
    --btn-secondary: #42a5f5;
    --btn-secondary-hover: #2196f3;
    --correct-bg: #c8e6c9;
    --correct-text: #1b5e20;
    --correct-border: #a5d6a7;
    --wrong-bg: #ffcdd2;
    --wrong-text: #b71c1c;
    --wrong-border: #ef9a9a;
    --shadow-color: rgba(25, 118, 210, 0.3);
    --badge-bg: rgba(255, 255, 255, 0.25);
}

body.dark-mode {
    /* Dark mode - shades of blue (no black fonts) */
    --bg-gradient-start: #0d47a1;
    --bg-gradient-end: #01579b;
    --container-bg: #1a237e;
    --text-primary: #bbdefb;
    --text-secondary: #90caf9;
    --text-tertiary: #64b5f6;
    --stats-bg: #283593;
    --card-gradient-start: #1976d2;
    --card-gradient-end: #0d47a1;
    --input-border: #1976d2;
    --input-focus: #42a5f5;
    --input-bg: #283593;
    --input-text: #e3f2fd;
    --btn-primary: #2196f3;
    --btn-primary-hover: #1976d2;
    --btn-secondary: #1565c0;
    --btn-secondary-hover: #0d47a1;
    --correct-bg: #1b5e20;
    --correct-text: #c8e6c9;
    --correct-border: #2e7d32;
    --wrong-bg: #b71c1c;
    --wrong-text: #ffcdd2;
    --wrong-border: #c62828;
    --shadow-color: rgba(13, 71, 161, 0.5);
    --badge-bg: rgba(255, 255, 255, 0.15);
}

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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, var(--bg-gradient-start) 0%, var(--bg-gradient-end) 100%);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
    transition: background 0.3s ease;
}

.container {
    background: var(--container-bg);
    border-radius: 20px;
    padding: 40px;
    max-width: 700px;
    width: 100%;
    box-shadow: 0 20px 60px var(--shadow-color);
    transition: background 0.3s ease, box-shadow 0.3s ease;
    position: relative;
}

.theme-toggle {
    position: absolute;
    top: 20px;
    right: 20px;
    background: var(--btn-primary);
    border: none;
    border-radius: 50%;
    width: 50px;
    height: 50px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5em;
    transition: all 0.3s ease;
    box-shadow: 0 4px 10px var(--shadow-color);
}

.theme-toggle:hover {
    transform: scale(1.1) rotate(15deg);
    background: var(--btn-primary-hover);
}

header {
    text-align: center;
    margin-bottom: 30px;
    padding-top: 20px;
}

h1 {
    color: var(--text-primary);
    font-size: 2.5em;
    margin-bottom: 10px;
    transition: color 0.3s ease;
}

.subtitle {
    color: var(--text-secondary);
    font-size: 1.1em;
    transition: color 0.3s ease;
}

.stats {
    display: flex;
    justify-content: space-around;
    margin-bottom: 30px;
    padding: 20px;
    background: var(--stats-bg);
    border-radius: 10px;
    transition: background 0.3s ease;
}

.stat-item {
    text-align: center;
}

.stat-label {
    display: block;
    color: var(--text-secondary);
    font-size: 0.9em;
    margin-bottom: 5px;
    transition: color 0.3s ease;
}

.stat-value {
    display: block;
    font-size: 1.8em;
    font-weight: bold;
    color: var(--text-primary);
    transition: color 0.3s ease;
}

.category-selector {
    margin-bottom: 30px;
    text-align: center;
}

.category-selector label {
    font-weight: bold;
    color: var(--text-primary);
    margin-right: 10px;
    transition: color 0.3s ease;
}

.category-selector select {
    padding: 10px 20px;
    border: 2px solid var(--input-border);
    border-radius: 8px;
    font-size: 1em;
    background: var(--container-bg);
    color: var(--text-primary);
    cursor: pointer;
    outline: none;
    transition: all 0.3s ease;
}

.category-selector select:focus {
    border-color: var(--input-focus);
}

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

.card {
    background: linear-gradient(135deg, var(--card-gradient-start) 0%, var(--card-gradient-end) 100%);
    border-radius: 15px;
    padding: 40px;
    color: white;
    min-height: 200px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    position: relative;
    box-shadow: 0 10px 30px var(--shadow-color);
    transition: all 0.3s ease;
}

.category-badge {
    position: absolute;
    top: 15px;
    right: 15px;
    background: var(--badge-bg);
    padding: 5px 15px;
    border-radius: 20px;
    font-size: 0.85em;
    font-weight: bold;
    text-transform: uppercase;
    transition: background 0.3s ease;
}

.question-text {
    font-size: 1.8em;
    text-align: center;
    line-height: 1.4;
    font-weight: 500;
}

.hint {
    margin-top: 20px;
    text-align: center;
    font-size: 0.95em;
    opacity: 0.9;
    font-style: italic;
}

.answer-section {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
}

#answer-input {
    flex: 1;
    padding: 15px 20px;
    border: 2px solid var(--input-border);
    border-radius: 10px;
    font-size: 1.1em;
    outline: none;
    transition: all 0.3s ease;
    background: var(--input-bg, var(--container-bg));
    color: var(--input-text, var(--text-primary));
}

#answer-input:focus {
    border-color: var(--input-focus);
}

.btn-primary, .btn-secondary {
    padding: 15px 30px;
    border: none;
    border-radius: 10px;
    font-size: 1em;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s;
    outline: none;
}

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

.btn-primary:hover {
    background: var(--btn-primary-hover);
    transform: translateY(-2px);
    box-shadow: 0 5px 15px var(--shadow-color);
}

.btn-primary:disabled {
    background: #90a4ae;
    cursor: not-allowed;
    transform: none;
}

.btn-secondary {
    background: var(--btn-secondary);
    color: white;
}

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

.feedback {
    padding: 20px;
    border-radius: 10px;
    margin-bottom: 20px;
    text-align: center;
    font-size: 1.1em;
    font-weight: 500;
    display: none;
    transition: all 0.3s ease;
}

.feedback.correct {
    background: var(--correct-bg);
    color: var(--correct-text);
    border: 2px solid var(--correct-border);
    display: block;
}

.feedback.wrong {
    background: var(--wrong-bg);
    color: var(--wrong-text);
    border: 2px solid var(--wrong-border);
    display: block;
}

.controls {
    text-align: center;
}

#next-btn {
    width: 100%;
}

.explanation {
    margin-top: 10px;
    font-size: 0.95em;
    opacity: 0.9;
}

@media (max-width: 600px) {
    .container {
        padding: 20px;
    }

    h1 {
        font-size: 2em;
    }

    .question-text {
        font-size: 1.4em;
    }

    .answer-section {
        flex-direction: column;
    }

    .stats {
        flex-direction: column;
        gap: 15px;
    }
}
