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

body {
    font-family: Arial, sans-serif;
    background: #f7f9f7;
    color: #20352b;
}

.navbar {
    height: 75px;
    padding: 0 8%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: white;
    border-bottom: 1px solid #e9eee9;
}

.logo {
    color: #176b43;
    font-size: 20px;
    font-weight: bold;
    text-decoration: none;
}

.nav-label, .subtitle {
    color: #829087;
}

.container {
    max-width: 1100px;
    margin: auto;
    padding: 35px 25px;
}

.hero {
    background: linear-gradient(120deg, #124d36, #218451);
    color: white;
    border-radius: 22px;
    padding: 65px;
    min-height: 300px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    overflow: hidden;
}

.tag {
    font-size: 12px;
    font-weight: bold;
    color: #a6e7bf;
    letter-spacing: 1px;
}

.hero h1 {
    font-size: 48px;
    line-height: 1.2;
    margin: 18px 0;
}

.hero p {
    color: #e0f0e6;
    line-height: 1.7;
    max-width: 420px;
}

.primary-btn {
    margin-top: 25px;
    padding: 14px 24px;
    border: none;
    border-radius: 9px;
    background: #fff;
    color: #176b43;
    font-size: 15px;
    font-weight: bold;
    cursor: pointer;
}

.hero-symbol {
    font-size: 190px;
    font-weight: bold;
    color: rgba(255,255,255,.12);
}

.section {
    margin-top: 55px;
}

.section h2, .chat-preview h2 {
    font-size: 25px;
    margin-bottom: 10px;
}

.subtitle {
    font-size: 14px;
    margin-bottom: 22px;
}

.level-grid, .topic-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 18px;
}

.level-card, .topic-card {
    background: white;
    border: 1px solid #e5ebe5;
    border-radius: 14px;
    padding: 25px;
    cursor: pointer;
    text-align: left;
    transition: .2s;
    color: #20352b;
}

.level-card:hover, .topic-card:hover {
    border-color: #218451;
    transform: translateY(-3px);
}

.level-card span {
    font-size: 30px;
}

.level-card h3 {
    margin: 15px 0 8px;
}

.level-card p {
    color: #829087;
    font-size: 13px;
}

.topic-card {
    font-size: 24px;
    display: flex;
    align-items: center;
    gap: 12px;
}

.topic-card span {
    font-size: 15px;
    font-weight: bold;
}

.chat-preview {
    margin-top: 55px;
    background: #e8f4ec;
    border-radius: 18px;
    padding: 35px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.chat-preview p {
    color: #607569;
    line-height: 1.6;
    margin-top: 10px;
}

.chat-icon {
    font-size: 55px;
}

footer {
    margin-top: 50px;
    padding: 25px;
    text-align: center;
    color: #829087;
    font-size: 13px;
}

footer p {
    margin-top: 8px;
}

@media (max-width: 650px) {
    .navbar {
        padding: 0 18px;
    }

    .nav-label {
        display: none;
    }

    .container {
        padding: 20px 15px;
    }

    .hero {
        padding: 35px 25px;
    }

    .hero h1 {
        font-size: 36px;
    }

    .hero-symbol {
        display: none;
    }

    .level-grid, .topic-grid {
        grid-template-columns: 1fr;
    }
}

.level-card.selected,
.topic-card.selected {
    border: 2px solid #218451;
    background: #e8f4ec;
}

.selection-info {
    margin-top: 15px;
    color: #218451;
    font-size: 14px;
    font-weight: bold;
}

.chat-section {
    margin-top: 45px;
    background: white;
    border: 1px solid #e5ebe5;
    border-radius: 18px;
    padding: 25px;
}

.chat-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-bottom: 20px;
    border-bottom: 1px solid #eee;
}

.chat-header h2 {
    margin: 10px 0;
}

.chat-header p {
    color: #829087;
    font-size: 13px;
}

.chat-avatar {
    font-size: 45px;
}

.chat-messages {
    height: 300px;
    overflow-y: auto;
    padding: 20px 0;
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.ai-message,
.user-message {
    padding: 14px 18px;
    border-radius: 14px;
    max-width: 80%;
    line-height: 1.6;
    font-size: 14px;
}

.ai-message {
    background: #e8f4ec;
    align-self: flex-start;
}

.user-message {
    background: #176b43;
    color: white;
    align-self: flex-end;
}

.chat-input-area {
    display: flex;
    gap: 10px;
}

.chat-input-area input {
    flex: 1;
    min-width: 0;
    padding: 14px;
    border: 1px solid #dce5dc;
    border-radius: 10px;
    outline: none;
}

.chat-input-area button {
    padding: 12px 20px;
    background: #176b43;
    color: white;
    border: none;
    border-radius: 10px;
    cursor: pointer;
}

@media(max-width: 550px) {
    .chat-input-area {
        flex-direction: column;
    }

    .chat-input-area button {
        padding: 14px;
    }
}

/* Форматирование ответов AI */

.ai-message p {
    margin: 0 0 10px;
    line-height: 1.65;
}

.ai-message p:last-child {
    margin-bottom: 0;
}

.ai-message strong {
    color: #126b43;
    font-weight: 700;
}

.ai-message em {
    font-style: italic;
}

.ai-message h4 {
    margin: 12px 0 8px;
    color: #126b43;
    font-size: 16px;
}

.ai-message ul {
    padding-left: 22px;
    margin: 8px 0;
}

.ai-message li {
    margin-bottom: 7px;
    line-height: 1.6;
}

/* Индикатор ожидания */

.typing-indicator {
    color: #55816b;
    font-style: italic;
    animation: typingPulse 1.4s infinite;
}

@keyframes typingPulse {
    0%, 100% {
        opacity: 0.5;
    }

    50% {
        opacity: 1;
    }
}

/* Кнопка во время отправки */

.chat-input-area button:disabled {
    opacity: 0.6;
    cursor: wait;
}

/* Навигация */
.main-nav {
    display: flex;
    align-items: center;
    gap: 22px;
}

.main-nav a {
    color: #315b46;
    text-decoration: none;
    font-size: 14px;
    font-weight: 600;
}

.main-nav a:hover {
    color: #16804e;
}

/* Раздел упражнений */
.exercises-section {
    padding-top: 60px;
}

.exercise-intro {
    text-align: center;
    margin: 30px auto;
    max-width: 550px;
}

.exercise-icon {
    font-size: 48px;
    margin-bottom: 12px;
}

.exercise-card {
    max-width: 650px;
    margin: 30px auto;
    padding: 30px;
    background: white;
    border: 1px solid #dce9df;
    border-radius: 18px;
    box-shadow: 0 8px 25px rgba(20, 80, 50, 0.05);
}

.exercise-top {
    display: flex;
    justify-content: space-between;
    color: #397052;
    font-weight: 600;
    margin-bottom: 15px;
}

.progress-track {
    width: 100%;
    height: 8px;
    background: #e8f1eb;
    border-radius: 20px;
    overflow: hidden;
    margin-bottom: 25px;
}

.progress-fill {
    width: 20%;
    height: 100%;
    background: #187347;
    border-radius: 20px;
    transition: width 0.3s ease;
}

.exercise-card h3 {
    font-size: 21px;
    margin-bottom: 22px;
    color: #263e30;
}

.exercise-options {
    display: grid;
    gap: 12px;
    margin-bottom: 20px;
}

.exercise-option {
    width: 100%;
    padding: 15px;
    border: 1px solid #dce9df;
    border-radius: 10px;
    background: #f8fbf8;
    text-align: left;
    font-size: 16px;
    cursor: pointer;
    color: #263e30;
}

.exercise-option:hover {
    border-color: #187347;
}

.exercise-option.selected {
    border: 2px solid #187347;
    background: #e8f4ec;
}

.exercise-option.correct {
    border: 2px solid #16834c;
    background: #e1f5e8;
}

.exercise-option.incorrect {
    border: 2px solid #d94c4c;
    background: #fff0f0;
}

.exercise-option:disabled {
    cursor: default;
}

.exercise-feedback {
    margin: 15px 0;
    line-height: 1.6;
}

.exercise-feedback.success {
    color: #16834c;
}

.exercise-feedback.error {
    color: #c43e3e;
}

.exercise-bottom {
    text-align: center;
    margin: 45px auto;
}

.exercise-bottom p {
    color: #718278;
    margin: 12px 0 20px;
}

.result-icon {
    font-size: 55px;
    text-align: center;
    margin-bottom: 15px;
}

.exercise-card:has(.result-icon) {
    text-align: center;
}

.exercise-card:has(.result-icon) h2 {
    color: #187347;
    margin: 15px 0;
}

/* Адаптация для телефона */
@media (max-width: 850px) {
    .main-nav {
        flex-wrap: wrap;
        gap: 12px;
    }

    .navbar {
        flex-wrap: wrap;
        gap: 15px;
    }
}

@media (max-width: 600px) {
    .main-nav {
        width: 100%;
        justify-content: center;
    }

    .main-nav a {
        font-size: 12px;
    }

    .exercise-card {
        padding: 20px;
    }
}

/* ===== СӨЗДҮК ===== */

.dictionary-section {
    padding-top: 60px;
}

.dictionary-search {
    max-width: 750px;
    margin: 30px auto;
    display: flex;
    gap: 12px;
}

.dictionary-search input,
.dictionary-search select {
    padding: 15px;
    border: 1px solid #dce9df;
    border-radius: 10px;
    background: white;
    font-size: 15px;
    outline: none;
}

.dictionary-search input {
    flex: 2;
    min-width: 0;
}

.dictionary-search select {
    flex: 1;
    min-width: 0;
    color: #315b46;
}

.dictionary-search input:focus,
.dictionary-search select:focus {
    border-color: #187347;
}

.dictionary-count {
    max-width: 750px;
    margin: 0 auto 18px;
    color: #718278;
    font-size: 14px;
}

.dictionary-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
    max-width: 900px;
    margin: 0 auto;
}

.dictionary-card {
    padding: 22px;
    background: white;
    border: 1px solid #dce9df;
    border-radius: 14px;
    box-shadow: 0 5px 18px rgba(20, 80, 50, 0.04);
    transition: transform 0.2s, border-color 0.2s;
}

.dictionary-card:hover {
    transform: translateY(-3px);
    border-color: #187347;
}

.dictionary-word {
    font-size: 21px;
    font-weight: 700;
    color: #187347;
    margin-bottom: 5px;
}

.dictionary-translation {
    font-size: 16px;
    font-weight: 600;
    color: #263e30;
    margin-bottom: 12px;
}

.dictionary-example {
    font-size: 14px;
    line-height: 1.6;
    color: #718278;
    padding-top: 12px;
    border-top: 1px solid #edf2ee;
}

.dictionary-category {
    display: inline-block;
    margin-top: 12px;
    padding: 5px 10px;
    background: #e8f4ec;
    color: #187347;
    border-radius: 20px;
    font-size: 12px;
}

.dictionary-empty {
    text-align: center;
    padding: 40px 15px;
    color: #718278;
}

.dictionary-empty span {
    font-size: 40px;
}

.dictionary-empty p {
    margin-top: 10px;
}

@media (max-width: 600px) {
    .dictionary-search {
        flex-direction: column;
    }

    .dictionary-grid {
        grid-template-columns: 1fr;
    }
}

/* Компактный блок скорости речи */
.speech-settings {
    width: 280px;
    max-width: 100%;
    margin-top: 8px;
}

.speed-labels {
    display: flex;
    justify-content: space-between;
    color: #a0a7b0;
    font-size: 11px;
    margin: 4px 2px 5px;
    font-weight: 400;
}

#speaking-rate {
    width: 100%;
    margin: 0;
}

#speaking-rate-value {
    color: #8b95a1;
    font-size: 13px;
    font-weight: 400;
}

/* Управление голосовым разговором */
#voice-pause-button,
#voice-end-button {
    padding: 9px 12px;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    font-size: 13px;
    white-space: nowrap;
}

#voice-pause-button {
    background: #e8eef7;
    color: #263b59;
}

#voice-end-button {
    background: #fde8e8;
    color: #b42318;
    min-width: 38px;
}

#voice-status {
    font-size: 12px;
    color: #64748b;
    white-space: nowrap;
}

#voice-pause-button[hidden],
#voice-end-button[hidden],
#voice-status[hidden] {
    display: none;
}

/* Страница прогресса обучения */
.progress-section { padding-top: 60px; }
.progress-summary, .progress-level-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 18px;
    margin-top: 28px;
}
.progress-stat, .progress-level-card {
    background: #fff;
    border: 1px solid #dce9df;
    border-radius: 16px;
    padding: 22px;
    box-shadow: 0 8px 25px rgba(20, 80, 50, 0.04);
}
.progress-stat { display: flex; flex-direction: column; gap: 8px; text-align: center; }
.progress-stat strong { color: #26734d; font-size: 30px; }
.progress-stat span, .progress-level-details span { color: #64748b; font-size: 13px; }
.progress-level-card h3 { margin: 0 0 10px; color: #315b46; }
.progress-level-best { color: #16804e; font-weight: 700; margin-bottom: 18px; }
.progress-level-details { display: flex; flex-direction: column; gap: 5px; padding-top: 12px; margin-top: 12px; border-top: 1px solid #edf2ee; }
.progress-level-details strong { color: #263b32; overflow-wrap: anywhere; }
.progress-note { margin-top: 22px; color: #64748b; font-size: 13px; text-align: center; }
@media (max-width: 700px) {
    .progress-summary, .progress-level-grid { grid-template-columns: 1fr; }
}


/* ===== МОБИЛЬНАЯ ВЕРСИЯ ===== */
.mobile-menu-toggle {
    display: none;
    border: 1px solid #dce9df;
    background: #ffffff;
    color: #176b43;
    border-radius: 10px;
    width: 42px;
    height: 42px;
    font-size: 23px;
    line-height: 1;
    cursor: pointer;
}

@media (max-width: 700px) {
    .navbar {
        height: auto;
        min-height: 68px;
        padding: 12px 16px;
        display: flex;
        flex-wrap: wrap;
        gap: 10px;
    }

    .logo {
        font-size: 17px;
        line-height: 1.2;
        max-width: calc(100% - 56px);
    }

    .mobile-menu-toggle {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        margin-left: auto;
        flex: 0 0 42px;
    }

    .nav-label {
        display: none;
    }

    .main-nav {
        display: none;
        order: 3;
        width: 100%;
        flex-direction: column;
        align-items: stretch;
        justify-content: flex-start;
        gap: 0;
        padding: 6px 0 2px;
        border-top: 1px solid #edf2ee;
    }

    .main-nav.is-open {
        display: flex;
    }

    .main-nav a {
        display: block;
        padding: 12px 8px;
        font-size: 15px;
        border-bottom: 1px solid #f0f3f0;
    }

    .container {
        width: 100%;
        padding: 18px 14px 28px;
    }

    .hero {
        min-height: 0;
        padding: 34px 23px;
        border-radius: 18px;
    }

    .hero h1 {
        font-size: clamp(30px, 8vw, 38px);
        line-height: 1.15;
    }

    .hero p {
        font-size: 15px;
    }

    .primary-btn {
        width: 100%;
        min-height: 48px;
    }

    .section {
        margin-top: 38px;
    }

    .section h2, .chat-preview h2 {
        font-size: 22px;
        line-height: 1.3;
    }

    .level-grid, .topic-grid, .dictionary-grid,
    .progress-summary, .progress-level-grid {
        grid-template-columns: minmax(0, 1fr);
        gap: 12px;
    }

    .level-card, .topic-card {
        padding: 20px;
    }

    .chat-preview {
        margin-top: 38px;
        padding: 23px;
        gap: 15px;
        align-items: flex-start;
    }

    .chat-icon {
        font-size: 38px;
        flex: 0 0 auto;
    }

    .chat-section {
        margin-top: 30px;
        padding: 17px 14px;
        border-radius: 14px;
    }

    .chat-header {
        gap: 12px;
        align-items: flex-start;
    }

    .chat-avatar {
        font-size: 34px;
    }

    .chat-messages {
        height: min(42vh, 360px);
        min-height: 220px;
        padding: 15px 0;
    }

    .ai-message, .user-message {
        max-width: 92%;
        padding: 11px 13px;
        font-size: 14px;
        overflow-wrap: anywhere;
    }

    .chat-input-area {
        display: flex;
        flex-wrap: wrap;
        flex-direction: row;
        gap: 8px;
    }

    .chat-input-area input {
        flex: 1 0 100%;
        width: 100%;
        min-height: 46px;
    }

    .chat-input-area button {
        flex: 1 1 auto;
        min-height: 44px;
        padding: 10px 12px;
        font-size: 14px;
    }

    #voice-status {
        flex: 1 0 100%;
        white-space: normal;
        text-align: center;
        padding: 3px 0;
    }

    .exercise-card {
        width: 100%;
        margin: 20px auto;
        padding: 19px 15px;
    }

    .exercise-card h3 {
        font-size: 18px;
        line-height: 1.45;
    }

    .exercise-top {
        gap: 10px;
        flex-wrap: wrap;
        font-size: 13px;
    }

    .exercise-option {
        min-height: 48px;
        padding: 13px;
        font-size: 15px;
    }

    .dictionary-search {
        flex-direction: column;
        gap: 10px;
    }

    .dictionary-search input, .dictionary-search select {
        width: 100%;
        min-height: 46px;
        font-size: 16px;
    }

    .dictionary-card, .progress-stat, .progress-level-card {
        padding: 18px;
    }

    .progress-section, .dictionary-section, .exercises-section {
        padding-top: 35px;
    }

    footer {
        padding: 22px 12px;
    }
}

@media (max-width: 380px) {
    .container { padding-left: 11px; padding-right: 11px; }
    .hero { padding: 29px 18px; }
    .hero h1 { font-size: 30px; }
    .chat-input-area button { font-size: 13px; padding: 9px 8px; }
}
