:root {
    --bg-color: #f8fafc;
    --card-bg: #ffffff;
    --text-main: #334155;
    --text-secondary: #94a3b8;
    
    /* Мягкие цвета */
    --primary: #6366f1; /* Indigo */
    --primary-light: #e0e7ff;
    
    --success-bg: #dcfce7; /* Soft Green */
    --success-border: #86efac;
    --success-text: #166534;
    
    --error-bg: #fee2e2; /* Soft Red */
    --error-border: #fca5a5;
    --error-text: #991b1b;
    
    --border-radius: 16px;
}

* { box-sizing: border-box; margin: 0; padding: 0; font-family: 'Inter', sans-serif; }

body {
    background-color: var(--bg-color);
    color: var(--text-main);
    display: flex;
    justify-content: center;
    min-height: 100vh;
    padding: 20px;
}

.app-container {
    width: 100%;
    max-width: 600px;
}

.screen { display: none; opacity: 0; transition: opacity 0.3s ease; }
.screen.active { display: block; opacity: 1; }

h1 { font-size: 2rem; font-weight: 700; text-align: center; margin-bottom: 8px; color: #1e293b; }
.subtitle { text-align: center; color: var(--text-secondary); margin-bottom: 32px; }

/* Buttons & Inputs */
.mode-selector {
    display: flex;
    gap: 8px;
    background: #e2e8f0;
    padding: 4px;
    border-radius: 12px;
    margin-bottom: 24px;
}

.mode-btn {
    flex: 1;
    border: none;
    background: transparent;
    padding: 10px;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    color: var(--text-secondary);
    transition: all 0.2s;
}

.mode-btn.active { background: var(--card-bg); color: var(--text-main); box-shadow: 0 1px 3px rgba(0,0,0,0.1); }

.settings-panel { display: none; margin-bottom: 24px; background: var(--card-bg); padding: 20px; border-radius: var(--border-radius); }
.settings-panel.active { display: block; }
.settings-panel label { display: block; margin-bottom: 8px; font-weight: 600; }
.settings-panel input, .settings-panel select { width: 100%; padding: 12px; border: 1px solid #cbd5e1; border-radius: 8px; font-size: 16px; outline: none; }

.primary-btn {
    width: 100%;
    padding: 16px;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: var(--border-radius);
    font-size: 18px;
    font-weight: 700;
    cursor: pointer;
    transition: background 0.2s;
}
.primary-btn:hover { background: #4f46e5; }

/* Quiz Area */
.quiz-header { margin-bottom: 20px; }
.progress-info { display: flex; justify-content: space-between; font-size: 14px; font-weight: 600; margin-bottom: 8px; color: var(--text-secondary); }
.progress-bar-bg { width: 100%; height: 8px; background: #e2e8f0; border-radius: 4px; overflow: hidden; }
.progress-bar-fill { height: 100%; background: var(--primary); width: 0%; transition: width 0.3s; }

.question-card {
    background: var(--card-bg);
    padding: 24px;
    border-radius: var(--border-radius);
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
    margin-bottom: 20px;
}

.question-card h3 { font-size: 18px; margin-bottom: 20px; line-height: 1.5; color: #1e293b; }

/* Options Styling */
.option-item {
    padding: 16px;
    border: 2px solid #e2e8f0;
    border-radius: 12px;
    margin-bottom: 12px;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 16px;
    display: flex;
    align-items: center; /* Center vertically */
    gap: 16px;
    background: #fff;
}

.option-item:hover { border-color: #cbd5e1; background: #f8fafc; }

/* Custom Checkbox Square */
.custom-checkbox {
    width: 24px;
    height: 24px;
    min-width: 24px;
    border: 2px solid #cbd5e1;
    border-radius: 6px;
    background: transparent;
    transition: all 0.2s;
}

.opt-text {
    flex: 1;
}

/* User Selected State (Before submit) */
.option-item.selected { 
    border-color: var(--primary); 
    background: var(--primary-light);
}
.option-item.selected .custom-checkbox {
    border-color: var(--primary);
    background-color: var(--primary); /* Optional: fill it if selected */
}

/* --- RESULT STATES (After submit) --- */

/* 1. Correct Option (Base) - Зеленый фон карточки, но пустой квадрат (если не выбрали) */
.option-item.correct {
    border-color: var(--success-border);
    background: var(--success-bg);
    color: var(--success-text);
}
.option-item.correct .custom-checkbox {
    border-color: var(--success-text);
    background-color: transparent; /* Пустой квадрат по умолчанию */
}

/* 2. Correct Option + Selected (User picked it) - ЗАКРАШЕННЫЙ квадрат */
.option-item.selected.correct .custom-checkbox {
    background-color: var(--success-text);
}

/* 3. Wrong Option (Always selected) - ЗАКРАШЕННЫЙ красный квадрат */
.option-item.wrong {
    border-color: var(--error-border);
    background: var(--error-bg);
    color: var(--error-text);
}
.option-item.wrong .custom-checkbox {
    border-color: var(--error-text);
    background-color: var(--error-text);
}

/* Result Message Styling */
.result-message {
    margin-top: 20px;
    font-size: 18px;
    font-weight: 700;
    text-align: center;
    padding: 16px;
    border-radius: 12px;
    border: 2px solid transparent;
    width: 100%;
}

.result-message.hidden { display: none; }

.msg-success {
    background: var(--success-bg);
    border-color: var(--success-border);
    color: var(--success-text);
}

.msg-error {
    background: var(--error-bg);
    border-color: var(--error-border);
    color: var(--error-text);
}


/* Controls */
.controls { display: flex; flex-direction: column; gap: 12px; }
.nav-buttons { display: flex; gap: 12px; }
.nav-btn { flex: 1; padding: 14px; border: none; background: #f1f5f9; border-radius: 12px; font-weight: 600; cursor: pointer; color: var(--text-main); transition: background 0.2s;}
.nav-btn:hover { background: #e2e8f0; }

.action-btn { width: 100%; padding: 14px; background: var(--text-main); color: white; border: none; border-radius: 12px; font-weight: 600; cursor: pointer; transition: opacity 0.2s; }
.action-btn:hover { opacity: 0.9; }

.text-btn { background: none; border: none; color: var(--text-secondary); padding: 8px; cursor: pointer; font-size: 14px; }
.text-btn:hover { color: var(--text-main); }