/* assets/css/style.css v9.0 */
:root { --primary: #2c3e50; --accent: #007bff; --bg-body: #f4f6f9; --text-main: #212529; --border: #dee2e6; --success: #28a745; --error: #dc3545; --header-h: 60px; --sidebar-w: 280px; --aside-w: 320px; }
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; outline: none; }
body { font-family: 'Inter', sans-serif; margin: 0; background: var(--bg-body); color: var(--text-main); height: 100vh; display: flex; flex-direction: column; overflow: hidden; }

/* HEADER & LAYOUT */
header { height: var(--header-h); background: #fff; border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; padding: 0 15px; z-index: 50; flex-shrink: 0; }
.menu-btn { font-size: 24px; border: none; background: none; color: var(--text-main); padding: 8px; cursor: pointer; display: none; }
.logo { font-weight: 800; font-size: 1.25rem; color: var(--primary); letter-spacing: -0.5px; } .logo span { color: var(--accent); }
.layout { display: flex; flex: 1; overflow: hidden; position: relative; }
.sidebar { width: var(--sidebar-w); background: #fff; border-right: 1px solid var(--border); display: flex; flex-direction: column; z-index: 40; transition: transform 0.3s ease; }
.menu-scroll { flex: 1; overflow-y: auto; padding: 10px; }
.main { flex: 1; overflow-y: auto; -webkit-overflow-scrolling: touch; padding: 30px; scroll-behavior: smooth; background: var(--bg-body); min-width: 0; }
.container { max-width: 800px; margin: 0 auto; padding-bottom: 100px; }
.aside { width: var(--aside-w); background: #fff; border-left: 1px solid var(--border); display: flex; flex-direction: column; z-index: 30; flex-shrink: 0; }
.aside-header { padding: 20px; border-bottom: 1px solid var(--border); font-weight: 700; color: var(--primary); background: #f8f9fa; }
.aside-scroll { flex: 1; overflow-y: auto; padding: 0; }

@media (max-width: 1200px) { .aside { display: none !important; } .main { padding: 15px; } }
@media (max-width: 900px) { .sidebar { position: absolute; top: 0; bottom: 0; left: 0; transform: translateX(-100%); box-shadow: 10px 0 40px rgba(0,0,0,0.2); width: 80%; max-width: 300px; } .sidebar.open { transform: translateX(0); } .menu-btn { display: block; } .overlay { display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.5); backdrop-filter: blur(2px); z-index: 35; opacity: 0; transition: opacity 0.3s; } .overlay.show { display: block; opacity: 1; } }

/* MENU */
.lvl1-btn { width: 100%; border: none; background: #fff; padding: 15px; font-size: 1rem; font-weight: 700; color: var(--primary); text-align: left; display: flex; justify-content: space-between; align-items: center; cursor: pointer; border-radius: 8px; margin-bottom: 5px; transition: 0.2s; }
.lvl1-btn:hover { background: #f1f3f5; color: var(--accent); } .lvl1-btn.active { background: #e7f1ff; color: var(--accent); }
.arrow { transition: transform 0.2s; font-size: 0.8em; opacity: 0.5; } .lvl1-btn.active .arrow { transform: rotate(180deg); opacity: 1; }
.lvl1-panel { display: none; padding-left: 10px; margin-bottom: 10px; }
.lvl2-btn { width: 100%; border: none; background: transparent; padding: 10px 15px; font-size: 0.9rem; font-weight: 600; color: #555; text-align: left; display: flex; justify-content: space-between; align-items: center; cursor: pointer; border-left: 2px solid #ddd; margin-top: 2px; }
.lvl2-btn:hover { border-left-color: var(--accent); color: var(--accent); background: #fafafa; } .lvl2-btn.active { border-left-color: var(--accent); color: var(--accent); }
.lvl2-panel { display: none; padding-left: 15px; margin-bottom: 10px; }
.menu-link { display: block; padding: 10px 14px; text-decoration: none; color: #333; background: #fff; border: 1px solid transparent; border-radius: 8px; margin-top: 6px; transition: all 0.2s ease; box-shadow: 0 1px 2px rgba(0,0,0,0.03); }
.menu-link:hover { background: #fff; border-color: #d0d7de; box-shadow: 0 4px 12px rgba(0,0,0,0.08); transform: translateY(-1px); }
.menu-link.active { background: #f0f9ff; border-color: var(--accent); box-shadow: 0 2px 5px rgba(0, 123, 255, 0.15); }
.menu-row-top { display: flex; justify-content: space-between; align-items: center; font-size: 0.95rem; font-weight: 600; color: #2c3e50; } .menu-link.active .menu-row-top { color: var(--accent); }
.menu-topic { display: block; font-size: 0.8rem; color: #999; margin-top: 3px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.badge { font-size: 0.75rem; background: #eee; padding: 2px 8px; border-radius: 12px; color: #666; font-weight: 700; } .menu-link.active .badge { background: var(--accent); color: #fff; }

/* CONTENT */
.mobile-options { background: white; border: 1px solid var(--border); border-radius: 12px; margin-bottom: 20px; overflow: hidden; display: none; } @media (max-width: 1200px) { .mobile-options { display: block; } }
.mo-header { padding: 15px; background: #f8f9fa; font-weight: 600; cursor: pointer; display: flex; justify-content: space-between; } .mo-body { display: none; border-top: 1px solid var(--border); } .mo-body.open { display: block; }
.opt-item { padding: 10px 15px; border-bottom: 1px solid #eee; font-size: 0.9rem; }
.card { background: #fff; border-radius: 12px; padding: 0; margin-bottom: 25px; box-shadow: 0 2px 8px rgba(0,0,0,0.04); border: 2px solid transparent; } .card.error { border-color: var(--error); }
.card-header { padding: 15px; background: #fdfdfd; border-bottom: 1px solid #eee; display: flex; flex-direction: column; gap: 10px; } @media (min-width: 600px) { .card-header { flex-direction: row; align-items: center; justify-content: space-between; } }
.q-label { font-weight: 800; color: var(--primary); font-size: 1rem; }
.card-select { padding: 10px; border: 1px solid #ced4da; border-radius: 8px; background: white; width: 100%; font-size: 1rem; } @media (min-width: 600px) { .card-select { width: 250px; } }
.card-body { padding: 20px; line-height: 1.7; color: #333; font-size: 1.05rem; }
.feedback { margin: 0 20px 20px; padding: 15px; border-radius: 8px; display: none; } .fb-ok { background: #d4edda; color: #155724; } .fb-err { background: #f8d7da; color: #721c24; }
.btn-main { width: 100%; padding: 16px; background: var(--success); color: white; border: none; border-radius: 50px; font-size: 1.1rem; font-weight: bold; cursor: pointer; }
.btn-reset { width: 100%; padding: 12px; background: white; border: 2px solid #eee; border-radius: 50px; margin-top: 10px; cursor: pointer; display: none; }

/* STUDY & SPEAKING MODES */
.study-content { background: #fff; border-radius: 12px; padding: 25px; box-shadow: 0 4px 15px rgba(0,0,0,0.05); margin-bottom: 30px; font-size: 1.25rem; line-height: 2.2; color: #333; }
.word { padding: 2px 4px; border-radius: 4px; cursor: pointer; transition: all 0.2s ease; border-bottom: 2px solid transparent; position: relative; } .word:hover { background: #f0f0f0; }
.study-content .w-nomen { color: #2980b9; font-weight: 600; } .study-content .w-verb { color: #c0392b; font-weight: 600; } .study-content .w-adj { color: #27ae60; }
.study-content.grayscale .w-nomen, .study-content.grayscale .w-verb, .study-content.grayscale .w-adj { color: #333 !important; font-weight: normal; }
.study-title { font-size: 1.4rem; font-weight: 800; color: #2c3e50; margin-bottom: 0px; line-height: 1.3; display: block; padding-bottom: 15px; border-bottom: 2px solid #eee; }
/* Blur Mode */
.study-content.blur-mode .w-nomen, .study-content.blur-mode .w-verb, .study-content.blur-mode .w-adj { color: transparent !important; background: #e9ecef; border-bottom: 2px solid #ced4da; user-select: none; }
.study-content.blur-mode .w-nomen:hover, .study-content.blur-mode .w-verb:hover, .study-content.blur-mode .w-adj:hover { color: #000 !important; background: #fff3cd; cursor: help; }
/* Focus Mode */
.study-content.focus-mode .word { color: transparent !important; background: #e9ecef; border-radius: 4px; user-select: none; }
.study-content.focus-mode .w-nomen, .study-content.focus-mode .w-verb, .study-content.focus-mode .w-adj { background: transparent; user-select: auto; }
.study-content.focus-mode .w-nomen { color: #2980b9 !important; } .study-content.focus-mode .w-verb { color: #c0392b !important; } .study-content.focus-mode .w-adj { color: #27ae60 !important; }
.study-content.focus-mode .word:hover { color: #000 !important; background: #fff3cd; cursor: help; }
/* Player */
.audio-header { background: #fff; padding: 20px; border-radius: 12px; margin-bottom: 20px; box-shadow: 0 2px 10px rgba(0,0,0,0.05); display: flex; flex-direction: column; gap: 15px; }
.audio-player { width: 100%; height: 40px; outline: none; }
.study-controls { display: flex; gap: 10px; flex-wrap: wrap; }
.toggle-btn { padding: 8px 16px; border-radius: 20px; border: 1px solid #ddd; background: #fff; cursor: pointer; font-size: 0.95rem; font-weight: 600; color: #555; display: flex; align-items: center; gap: 8px; transition: 0.2s; }
.toggle-btn:hover { background: #f8f9fa; } .toggle-btn.active { background: var(--primary); color: #fff; border-color: var(--primary); box-shadow: inset 0 2px 4px rgba(0,0,0,0.2); }

/* --- Стили для диалогов в Teil 3 (Planning) --- */
.dialogue-box {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 10px;
}

.d-line {
    padding: 8px 12px;
    border-radius: 8px;
    font-size: 1rem;
    line-height: 1.4;
    max-width: 95%;
}

/* Реплика А (Предложение) - Слева, синяя */
.d-a {
    background: #e7f1ff;
    color: #004085;
    align-self: flex-start;
    border-bottom-left-radius: 0;
}
.d-a::before { content: "👤 A: "; font-weight: bold; opacity: 0.7; }

/* Реплика B (Реакция) - Справа, зеленая/серая */
.d-b {
    background: #f1f3f5;
    color: #383d41;
    align-self: flex-end;
    border-bottom-right-radius: 0;
    text-align: right;
}
.d-b::after { content: " :B 👤"; font-weight: bold; opacity: 0.7; }

/* Реплика C (Итог/Компромисс) - По центру, зеленая */
.d-ok {
    background: #d4edda;
    color: #155724;
    align-self: center;
    text-align: center;
    width: 100%;
    font-weight: 500;
}
.d-ok::before { content: "🤝 "; }


/* ... старые стили ... */

/* --- Reading Multiple Choice Styles --- */
.mc-container {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.mc-option {
    display: flex;
    align-items: flex-start;
    padding: 12px;
    border: 2px solid #e9ecef;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    background: #fff;
}

.mc-option:hover {
    background: #f8f9fa;
    border-color: #dee2e6;
}

/* Скрываем стандартную радио-кнопку */
.mc-option input[type="radio"] {
    display: none;
}

/* Стили для активного состояния (выбрано пользователем) */
.mc-option input[type="radio"]:checked + .mc-letter {
    background: var(--accent);
    color: white;
    border-color: var(--accent);
}

.mc-option input[type="radio"]:checked ~ .mc-text {
    font-weight: 600;
}

.mc-option input[type="radio"]:checked ~ .mc-text .mc-ru {
    font-weight: 400;
}

/* Буква (A, B, C) */
.mc-letter {
    display: flex;
    justify-content: center;
    align-items: center;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: 2px solid #ced4da;
    color: #6c757d;
    font-weight: 700;
    margin-right: 15px;
    flex-shrink: 0;
    transition: all 0.2s;
}

.mc-text {
    flex: 1;
    font-size: 1rem;
    line-height: 1.4;
}

.mc-ru {
    font-size: 0.85rem;
    color: #888;
    margin-top: 4px;
    font-style: italic;
}

/* Результаты проверки */
.mc-correct {
    background-color: #d4edda !important;
    border-color: #28a745 !important;
}
.mc-correct .mc-letter {
    background-color: #28a745;
    color: white;
    border-color: #28a745;
}

.mc-wrong {
    background-color: #f8d7da !important;
    border-color: #dc3545 !important;
    opacity: 0.7;
}
.mc-wrong .mc-letter {
    background-color: #dc3545;
    color: white;
    border-color: #dc3545;
}

/* --- Стили для скрытых переводов (MC) --- */

/* Кнопка перевода (маленькая) */
.btn-mini-trans {
    background: none;
    border: 1px solid #dee2e6;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.8rem;
    padding: 2px 6px;
    margin-left: 10px;
    opacity: 0.6;
    transition: all 0.2s;
    flex-shrink: 0;
}
.btn-mini-trans:hover {
    opacity: 1;
    background: #f1f1f1;
    border-color: #ccc;
}

/* Блок вопроса */
.q-text-block {
    margin-bottom: 20px;
    font-weight: 700;
    font-size: 1.1rem;
}
.q-text-row {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
}
.q-ru-hidden {
    display: none;
    font-weight: 400;
    font-size: 0.95rem;
    color: #666;
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px dashed #eee;
    font-style: italic;
}

/* Опции (внутри радио-кнопок) */
.mc-text-wrap {
    flex: 1;
}
.mc-text-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
}
.mc-ru-hidden {
    display: none;
    font-size: 0.9rem;
    color: #888;
    margin-top: 6px;
    font-style: italic;
    font-weight: 400;
}

/* Правка для мобильных: чтобы кнопка не прилипала */
@media (max-width: 600px) {
    .btn-mini-trans {
        padding: 4px 8px; /* Чуть больше область клика */
    }
}

/* Login Screen */
#login-overlay {
    position: fixed;
    inset: 0;
    background: #2c3e50;
    z-index: 99999;
    display: flex;
    align-items: center;
    justify-content: center;
}


.login-box {
    background: white; padding: 30px; border-radius: 12px; text-align: center; width: 90%; max-width: 350px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.3);
}
.login-box input {
    width: 100%; padding: 12px; margin: 15px 0; border: 2px solid #eee; border-radius: 8px; font-size: 1.1rem;
}
.login-box button {
    width: 100%; padding: 12px; background: var(--accent); color: white; border: none; border-radius: 8px;
    font-size: 1.1rem; cursor: pointer;
}

/* --- ДОПОЛНЕНИЯ ДЛЯ УСТНОЙ ЧАСТИ (SPEAKING MODE) --- */

/* Контейнер для блоков выступления участников */
.speaking-box {
    background: #f8f9fa;
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 15px;
    margin-bottom: 15px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.speaking-box:hover {
    background: #fff;
    border-color: var(--accent);
    box-shadow: 0 4px 12px rgba(0,0,0,0.05);
}

.speaking-box b {
    color: var(--primary);
    display: block;
    margin-bottom: 5px;
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.speaking-box p {
    margin: 0;
    font-size: 1.05rem;
    line-height: 1.6;
}

/* Стили для иконок участников в заголовках */
.card-header .q-label i {
    margin-right: 8px;
    color: var(--accent);
}

/* Улучшение отображения скрытого перевода в Speaking Mode */
.speaking-box .mc-ru-hidden {
    display: none; /* Управляется через app.js (toggleTrans) */
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px dashed #ccc;
    color: #666;
    font-style: italic;
    font-size: 0.95rem;
}

/* Фикс для аудио-плеера на очень узких экранах */
@media (max-width: 400px) {
    .audio-header {
        padding: 10px;
    }
    .study-controls {
        justify-content: center;
    }
    .toggle-btn {
        padding: 6px 12px;
        font-size: 0.85rem;
    }
}

/* Стиль для сообщения об ошибке при логине */
#login-error {
    color: var(--error);
    margin-top: 10px;
    font-size: 0.9rem;
    font-weight: 600;
}


/* ================================
   SPEAKING – TEIL 3 – PLANUNG
================================ */

.speaking-plan .card-header {
    background: #f4f6f8;
    font-weight: 600;
}

.plan-item {
    background: #f9fafb;
    border: 1px solid #e1e4e8;
    border-radius: 12px;
    padding: 12px;
    margin-bottom: 12px;
    cursor: pointer;
    transition: background 0.2s ease;
}

.plan-item:hover {
    background: #f1f3f5;
}

.plan-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 6px;
}

.plan-topic {
    font-weight: 700;
    font-size: 0.95rem;
    color: #2c3e50;
}

.plan-hint {
    font-size: 0.8rem;
    opacity: 0.6;
}

.plan-de {
    font-size: 0.95rem;
    line-height: 1.5;
    color: #2c3e50;
}

.plan-ru {
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px dashed #cfd6df;
    font-style: italic;
    color: #555;
}


.overlay {
  pointer-events: none;
}

/* Mobile answers dropdown: show/hide only body */
.mobile-options #mo-body { display: none; }
.mobile-options.open #mo-body { display: block; }
