:root {
    --primary: #4F46E5;
    --primary-light: #818CF8;
    --bg: #F3F4F6;
    --card-bg: #FFFFFF;
    --text: #1F2937;
    --text-light: #6B7280;
    --border: #E5E7EB;
    --hover-bg: #F9FAFB;
    --success: #10B981;
    --warning: #F59E0B;
    --danger: #EF4444;
}

*, *::before, *::after {
    box-sizing: border-box;
}

body.dark-mode {
    --primary: #6366f1;
    --primary-light: #818CF8;
    --bg: #111827;
    --card-bg: #1F2937;
    --text: #F3F4F6;
    --text-light: #9CA3AF;
    --border: #374151;
    --hover-bg: #374151;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background-color: var(--bg);
    color: var(--text);
    margin: 0;
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    transition: background-color 0.3s, color 0.3s;
}

.container {
    max-width: 800px;
    margin: 0 auto;
    padding: 20px;
    width: 100%;
    box-sizing: border-box;
}

header {
    background: var(--card-bg);
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    padding: 20px 0;
    text-align: center;
    position: relative;
}

header h1 {
    margin: 0;
    color: var(--primary);
    font-size: 1.5rem;
}

.theme-toggle {
    position: absolute;
    right: 20px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    cursor: pointer;
    font-size: 1.5rem;
    color: var(--text);
}

.card {
    background: var(--card-bg);
    border-radius: 16px;
    padding: 30px;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    margin-bottom: 20px;
    transition: background 0.3s;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background-color: var(--primary);
    color: white;
    padding: 12px 24px;
    border-radius: 8px;
    text-decoration: none;
    font-weight: 600;
    border: 2px solid transparent;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 1rem;
    line-height: 1.2;
    min-height: 48px;
}
.btn:hover { 
    opacity: 0.9;
    transform: translateY(-1px);
}

.btn-secondary {
    background-color: transparent;
    border: 2px solid var(--text-light);
    color: var(--text-light);
}

.btn-secondary:hover {
    background-color: var(--hover-bg);
    color: var(--text);
    border-color: var(--text);
}

.nav-buttons {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 15px;
    margin-top: 30px;
    flex-wrap: wrap;
}

.nav-buttons.center {
    justify-content: center;
}

.back-link {
    display: inline-flex;
    align-items: center;
    margin-bottom: 20px;
    color: var(--text-light);
    text-decoration: none;
    font-weight: 500;
    transition: color 0.2s;
}

.back-link:hover {
    color: var(--primary);
}

.text-sample-box {
    background: var(--hover-bg);
    padding: 20px;
    border-radius: 12px;
    border: 1px solid var(--border);
    margin-bottom: 25px;
    color: var(--text);
}

.select-custom {
    width: 100%;
    max-width: 400px;
    padding: 12px 16px;
    border-radius: 10px;
    border: 2px solid var(--tg-primary);
    background-color: var(--tg-card);
    color: var(--tg-text);
    font-size: 1rem;
    cursor: pointer;
    outline: none;
    transition: all 0.2s;
}

.select-custom:focus {
    box-shadow: 0 0 0 3px rgba(134, 194, 50, 0.3);
}

.text-list {
    list-style: none;
    padding: 0;
    margin: 0;
    width: 100%;
}

.text-list li {
    margin-bottom: 12px;
    width: 100%;
}

.text-list .btn-secondary {
    display: flex;
    align-items: center;
    width: 100%;
    text-align: left;
    padding: 12px 20px;
    border: 2px solid rgba(134, 194, 50, 0.3);
    border-radius: 12px;
    color: var(--tg-text);
    background: var(--tg-card);
    transition: all 0.2s;
    text-decoration: none;
    min-height: 60px;
}

.text-list .btn-secondary:hover {
    border-color: var(--tg-primary);
    background: var(--tg-task-bg);
    transform: translateX(5px);
}

.text-list .btn-secondary strong {
    color: var(--tg-primary);
    margin-right: 8px;
    text-transform: uppercase;
}

.text-list .btn-secondary span {
    font-size: 0.9rem;
    color: var(--tg-text-light);
}

/* Элементы формы Теста 1 */
.section-step { display: none; }
.section-step.active { display: block; animation: fadeIn 0.4s; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }

.checkbox-group { display: flex; flex-direction: column; gap: 12px; }
.checkbox-item {
    display: flex; align-items: center; padding: 12px;
    border: 1px solid var(--border); border-radius: 8px; cursor: pointer;
}
.checkbox-item:hover { background-color: var(--hover-bg); }
.checkbox-item input { margin-right: 15px; width: 20px; height: 20px; accent-color: var(--primary); }

.result-circle {
    width: 150px; height: 150px; border-radius: 50%;
    background: var(--card-bg); display: flex; flex-direction: column;
    align-items: center; justify-content: center;
    margin: 0 auto 30px; border: 8px solid var(--primary);
}
.result-number { font-size: 2.5rem; font-weight: bold; }
.level-badge { padding: 8px 16px; border-radius: 20px; color: white; display: inline-block; margin-bottom: 20px; }
.low { background-color: var(--success); }
.medium { background-color: var(--warning); }
.high { background-color: var(--danger); }

.progress-track { background-color: var(--border); height: 8px; border-radius: 4px; overflow: hidden; margin-top: 5px; }
.progress-fill { height: 100%; background-color: var(--primary); transition: width 0.3s; }

/* === СТИЛИ ДЛЯ ТЕСТА 2 (WRAPPER) === */
.theme-green-wrapper {
    /* Светлый режим */
    --tg-primary: #86C232;
    --tg-bg: #F0F5F0;
    --tg-card: #FFFFFF;
    --tg-text: #222629;
    --tg-text-light: #616161;
    --tg-task-bg: #E8F5E9;
    --tg-panel-bg: #FFF8E1;
    --tg-accent: #F5E050;
}

body.dark-mode .theme-green-wrapper {
    /* Темный режим */
    --tg-primary: #86C232;
    --tg-bg: #1A261A;
    --tg-card: #2C332C;
    --tg-text: #E8F5E9;
    --tg-text-light: #A5D6A7;
    --tg-task-bg: #253825;
    --tg-panel-bg: #3E3B30;
    --tg-accent: #D4AC0D;
}

.theme-green-wrapper {
    background-color: var(--tg-bg);
    min-height: 100vh;
    width: 100%;
    display: flex;
    flex-direction: column;
}

.theme-green-wrapper main {
    flex: 1;
    padding-top: 20px;
    padding-bottom: 40px;
}

.theme-green-wrapper .card,
.theme-green-wrapper .task-card,
.theme-green-wrapper .score-panel {
    background-color: var(--tg-card);
    color: var(--tg-text);
    box-shadow: 0 4px 10px rgba(0,0,0,0.1);
    border: 1px solid rgba(134, 194, 50, 0.2);
    border-radius: 20px;
    margin-bottom: 20px;
}

.theme-green-wrapper h1, .theme-green-wrapper h2, .theme-green-wrapper h3 { color: var(--tg-text); }
.theme-green-wrapper p, .theme-green-wrapper li { color: var(--tg-text-light); }

.theme-green-wrapper .task-card {
    background-color: var(--tg-task-bg);
    padding: 30px; text-align: center; border: none;
}
.theme-green-wrapper .task-content {
    font-family: 'Courier New', Courier, monospace;
    font-size: 1.5rem; letter-spacing: 3px;
    margin: 30px 0; font-weight: bold;
    color: var(--tg-text); line-height: 2;
}

.theme-green-wrapper .score-panel {
    background-color: var(--tg-panel-bg);
    padding: 20px; border-bottom: 4px solid var(--tg-accent);
}

.score-selector { display: flex; justify-content: center; gap: 30px; }
.score-option { display: flex; flex-direction: column; align-items: center; cursor: pointer; }
.score-option input {
    appearance: none; width: 24px; height: 24px;
    border: 2px solid var(--tg-primary); border-radius: 50%;
    margin-bottom: 5px; background: var(--tg-card); cursor: pointer;
}
.score-option input:checked {
    background: var(--tg-primary);
    box-shadow: inset 0 0 0 4px var(--tg-card);
}
.score-option span { font-weight: bold; font-size: 1.1rem; color: var(--tg-text); }

.theme-green-wrapper .btn {
    background-color: var(--tg-primary);
    color: #fff; border-radius: 30px; border: none;
    font-weight: bold; text-transform: uppercase;
}
.theme-green-wrapper .btn-secondary {
    background-color: transparent;
    border: 2px solid var(--tg-text-light);
    color: var(--tg-text-light);
}

.program-grid {
    display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 15px; margin: 30px 0;
}
.program-block {
    background-color: var(--tg-panel-bg);
    color: var(--tg-text);
    padding: 20px; border-radius: 15px;
    text-align: center; text-decoration: none;
    border-bottom: 4px solid var(--tg-accent);
    font-weight: bold; transition: transform 0.2s;
    display: flex; flex-direction: column;
    align-items: center; justify-content: center; min-height: 100px;
}
.program-block:hover { transform: translateY(-5px); background-color: var(--tg-task-bg); }
.program-block span { font-size: 2rem; margin-bottom: 10px; }

.wizard-step { display: none; }
.wizard-step.active { display: block; animation: fadeIn 0.4s; }

/* --- Стили для Картинно-Графического Плана (Цепная связь) --- */
.chain-container {
    display: flex;
    flex-direction: column;
    gap: 20px;
    margin-top: 30px;
}

.chain-row {
    display: flex;
    align-items: center;
    background: var(--tg-card);
    padding: 15px;
    border-radius: 12px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    border-left: 5px solid var(--tg-primary);
    color: var(--tg-text);
}

.chain-text {
    flex: 1;
    font-size: 1.1rem;
    color: var(--tg-text);
}

.chain-link-word {
    color: var(--tg-primary);
    font-weight: bold;
    border-bottom: 2px solid var(--tg-accent);
    padding-bottom: 2px;
}

.chain-arrow {
    font-size: 2rem;
    color: var(--tg-text-light);
    margin: 0 15px;
}

.chain-visual {
    width: 60px;
    height: 60px;
    background: var(--tg-task-bg);
    border: 2px dashed var(--tg-primary);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    color: var(--tg-text);
}

/* --- Стили для Макетов (Смысловой блок) --- */
.maket-options {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-top: 20px;
}

.maket-card {
    background: var(--tg-bg);
    border: 2px solid var(--border);
    border-radius: 10px;
    padding: 15px;
    cursor: pointer;
    text-align: center;
    transition: all 0.3s;
}

.maket-card:hover, .maket-card.selected {
    border-color: var(--tg-primary);
    background: var(--tg-panel-bg);
}

.maket-icon {
    font-size: 2.5rem;
    margin-bottom: 10px;
    display: block;
}

/* === MEDIA QUERIES === */
@media (max-width: 600px) {
    .container {
        padding: 15px;
    }
    .card {
        padding: 20px;
        border-radius: 12px;
    }
    .nav-buttons {
        flex-direction: column;
        width: 100%;
        gap: 10px;
    }
    .nav-buttons .btn {
        width: 100%;
        text-align: center;
    }
    header h1 {
        font-size: 1.2rem;
        padding-right: 40px;
    }
    .result-circle {
        width: 120px;
        height: 120px;
    }
    .result-number {
        font-size: 2rem;
    }
}

.feedback-msg {
    margin-top: 20px;
    padding: 15px;
    border-radius: 10px;
    font-weight: 600;
    display: none;
}

.feedback-msg.success {
    background-color: rgba(16, 185, 129, 0.1);
    color: #10B981;
    border: 1px solid rgba(16, 185, 129, 0.3);
}

.feedback-msg.error {
    background-color: rgba(239, 68, 68, 0.1);
    color: #EF4444;
    border: 1px solid rgba(239, 68, 68, 0.3);
}

.dark-mode .feedback-msg.success {
    background-color: rgba(16, 185, 129, 0.2);
}

.dark-mode .feedback-msg.error {
    background-color: rgba(239, 68, 68, 0.2);
}