/* ===== Глобальные переменные ===== */
:root {
    --bg: #f0f8ff;
    --text: #1a1a2e;
    --card: rgba(255,255,255,0.75);
    --border: #d0d8e0;
    --shadow: 0 20px 60px rgba(0,0,0,0.10);
    --radius: 30px;
    --primary: #4a90e2;
    --secondary: #f39c12;
    --success: #2ecc71;
    --danger: #e74c3c;
    --font: 'Segoe UI', Roboto, system-ui, sans-serif;
}
body.dark {
    --bg: #1a1a2e;
    --text: #eee;
    --card: rgba(40,40,70,0.8);
    --border: #3a3a5a;
    --shadow: 0 20px 60px rgba(0,0,0,0.4);
}
body {
    font-family: var(--font);
    background: var(--bg);
    color: var(--text);
    transition: background 0.3s, color 0.3s;
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 16px;
    margin: 0;
}
.container {
    max-width: 820px;
    width: 100%;
    background: var(--card);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-radius: var(--radius);
    padding: 24px;
    box-shadow: var(--shadow);
    transition: background 0.3s;
    position: relative;
}
.btn {
    display: inline-block;
    padding: 14px 28px;
    border: none;
    border-radius: 50px;
    background: var(--primary);
    color: #fff;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.1s, background 0.2s, box-shadow 0.2s;
    touch-action: manipulation;
    text-align: center;
    margin: 6px;
    user-select: none;
}
.btn:hover { background: #357abd; box-shadow: 0 4px 12px rgba(74,144,226,0.3); }
.btn:active { transform: scale(0.96); }
.btn-secondary { background: var(--secondary); }
.btn-secondary:hover { background: #e08e0b; }
.btn-success { background: var(--success); }
.btn-success:hover { background: #27ae60; }
.btn-danger { background: var(--danger); }
.btn-danger:hover { background: #c0392b; }
.btn-outline {
    background: transparent;
    border: 2px solid var(--primary);
    color: var(--primary);
}
.btn-outline:hover { background: var(--primary); color: #fff; }
.btn-sm { padding: 10px 18px; font-size: 0.9rem; }
.btn-block { width: 100%; display: block; }
.btn:disabled { opacity: 0.5; pointer-events: none; }
.card {
    background: rgba(255,255,255,0.5);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    border-radius: var(--radius);
    padding: 20px;
    margin: 15px 0;
    box-shadow: 0 2px 12px rgba(0,0,0,0.04);
    border: 1px solid var(--border);
    transition: 0.3s;
}
body.dark .card { background: rgba(50,50,80,0.4); border-color: #3a3a5a; }
img { max-width: 100%; border-radius: 20px; display: block; }
.flex { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.text-center { text-align: center; }
.mt-2 { margin-top: 20px; }
.mb-1 { margin-bottom: 10px; }
.hidden { display: none !important; }
.question-image {
    max-height: 220px;
    object-fit: contain;
    width: 100%;
    border-radius: 20px;
    background: #f8f9fa;
}
.options-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-top: 20px;
}
.option-btn {
    padding: 18px 12px;
    border: 3px solid var(--border);
    border-radius: 20px;
    background: var(--card);
    color: var(--text);
    font-size: 1.3rem;
    font-weight: 600;
    cursor: pointer;
    transition: 0.15s;
    touch-action: manipulation;
    box-shadow: 0 2px 6px rgba(0,0,0,0.03);
}
.option-btn:active { transform: scale(0.96); }
.option-btn.correct { border-color: var(--success); background: #d5f5e3; color: #1a6e3a; }
.option-btn.wrong { border-color: var(--danger); background: #fadbd8; color: #922b21; }
.option-btn.disabled { opacity: 0.5; pointer-events: none; }
.modal {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.45);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s;
    padding: 16px;
}
.modal.active {
    opacity: 1;
    pointer-events: auto;
}
.modal-content {
    background: var(--card);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-radius: var(--radius);
    max-width: 560px;
    width: 100%;
    padding: 28px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 30px 80px rgba(0,0,0,0.25);
    border: 1px solid var(--border);
    animation: slideUp 0.25s ease-out;
}
@keyframes slideUp {
    from { transform: translateY(30px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}
.modal-close {
    float: right;
    background: none;
    border: none;
    font-size: 2rem;
    cursor: pointer;
    color: var(--text);
    opacity: 0.6;
}
.modal-close:hover { opacity: 1; }
input, select {
    width: 100%;
    padding: 14px 18px;
    border: 2px solid var(--border);
    border-radius: 50px;
    font-size: 1rem;
    background: rgba(255,255,255,0.6);
    color: var(--text);
    transition: 0.2s;
    margin-bottom: 12px;
}
body.dark input, body.dark select {
    background: rgba(60,60,90,0.6);
    color: #eee;
    border-color: #4a4a6a;
}
input:focus, select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(74,144,226,0.2);
}
.list-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    border-bottom: 1px solid var(--border);
}
.list-item:last-child { border-bottom: none; }
.progress-bar {
    width: 100%;
    height: 10px;
    background: var(--border);
    border-radius: 20px;
    overflow: hidden;
    margin: 8px 0;
}
.progress-bar .fill {
    height: 100%;
    background: var(--success);
    border-radius: 20px;
    transition: width 0.4s;
}
@media (max-width: 600px) {
    .options-grid { grid-template-columns: 1fr; }
    .grid-2 { grid-template-columns: 1fr; }
    .btn { font-size: 1rem; padding: 12px 20px; }
    .container { padding: 16px; }
    .modal-content { padding: 20px; }
}
.theme-toggle {
    position: fixed;
    top: 16px;
    right: 16px;
    background: rgba(255,255,255,0.3);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    border: none;
    border-radius: 50%;
    width: 48px;
    height: 48px;
    font-size: 1.8rem;
    cursor: pointer;
    z-index: 3000;
    box-shadow: 0 2px 12px rgba(0,0,0,0.1);
}
body.dark .theme-toggle { background: rgba(0,0,0,0.3); }
.confetti-container {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    pointer-events: none;
    z-index: 9999;
    overflow: hidden;
}
.confetti {
    position: absolute;
    width: 10px;
    height: 10px;
    background: #f1c40f;
    top: -10px;
    animation: confettiFall linear forwards;
}
@keyframes confettiFall {
    to { transform: translateY(110vh) rotate(720deg); opacity: 0; }
}