/* ==========================================================================
   Progressor — единый CSS (перенос из static-prototype/app-dynamic.html
   + content/style.css + hall-of-fame.html). Этап 3 рефакторинга.
   ========================================================================== */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
    color: #fff;
    min-height: 100vh;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 15px;
}

/* --------------------------------------------------------------------------
   Header
   -------------------------------------------------------------------------- */

header {
    text-align: center;
    padding: 18px 0;
}

h1 {
    font-size: 2.2em;
    margin-bottom: 6px;
    background: linear-gradient(90deg, #4285f4, #34a853);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.subtitle {
    font-size: 1.05em;
    color: #aaa;
}

.breadcrumb {
    font-size: 0.9em;
    color: #888;
    margin-bottom: 15px;
}

.breadcrumb a {
    color: #4285f4;
    text-decoration: none;
}

.back-button {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: #4285f4;
    text-decoration: none;
    margin-bottom: 20px;
    font-size: 1.1em;
}

.back-button:hover {
    color: #34a853;
}

/* --------------------------------------------------------------------------
   Dashboard: 3-колоночная компоновка
   -------------------------------------------------------------------------- */

.main-content {
    margin-top: 20px;
}

.three-columns {
    display: grid;
    grid-template-columns: 280px 1fr 380px;
    gap: 20px;
    /* Колонки занимают доступную высоту экрана, без роста страницы. */
    align-items: stretch;
}

.col-directions,
.col-chat,
.col-other {
    min-height: 0;
    /* На больших экранах колонки тянутся до низу viewport, контент скроллится внутри. */
    max-height: calc(100vh - 220px);
    overflow-y: auto;
    /* Скрыть скроллбар, но оставить скролл (для чистого UI). */
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.2) transparent;
}

.col-directions::-webkit-scrollbar,
.col-chat::-webkit-scrollbar,
.col-other::-webkit-scrollbar {
    width: 6px;
}

.col-directions::-webkit-scrollbar-thumb,
.col-chat::-webkit-scrollbar-thumb,
.col-other::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.15);
    border-radius: 3px;
}

/* Адаптив: на <=1200px — 2 колонки, на <=768px — 1. */
@media (max-width: 1200px) {
    .three-columns {
        grid-template-columns: 1fr 1fr;
    }

    .col-other {
        grid-column: 1 / -1;
    }

    /* На узких — снимаем ограничение высоты (контент в столбик). */
    .col-directions,
    .col-chat,
    .col-other {
        max-height: none;
    }
}

@media (max-width: 768px) {
    .three-columns {
        grid-template-columns: 1fr;
    }
}

/* --------------------------------------------------------------------------
   Левая колонка: направления
   -------------------------------------------------------------------------- */

.directions-panel {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 15px;
    padding: 20px;
}

.directions-panel h3 {
    margin-bottom: 15px;
    color: #4285f4;
}

.direction-card {
    background: rgba(255, 255, 255, 0.08);
    padding: 12px;
    border-radius: 8px;
    margin-bottom: 10px;
    cursor: pointer;
    transition: all 0.3s ease;
    border-left: 3px solid transparent;
    text-decoration: none;
    color: inherit;
    display: block;
}

.direction-card:hover {
    background: rgba(255, 255, 255, 0.12);
    border-left-color: #4285f4;
}

.direction-card h4 {
    font-size: 0.95em;
    margin-bottom: 5px;
}

.direction-card p {
    font-size: 0.8em;
    color: #aaa;
}

/* --------------------------------------------------------------------------
   Центральная колонка: чат
   -------------------------------------------------------------------------- */

.chat-panel {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 15px;
    padding: 20px;
    /* Высота тянется по колонке (col-chat max-height), а не фикс. 500px. */
    height: 100%;
    min-height: 400px;
    display: flex;
    flex-direction: column;
}

.chat-panel h3 {
    margin-bottom: 15px;
    color: #4285f4;
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    margin-bottom: 15px;
    padding: 10px;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 10px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.message {
    margin-bottom: 15px;
    padding: 12px 18px;
    border-radius: 12px;
    max-width: 80%;
    animation: fadeIn 0.3s ease;
    line-height: 1.5;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.message.bot {
    background: rgba(66, 133, 244, 0.2);
    border-left: 3px solid #4285f4;
    align-self: flex-start;
}

.message.user {
    background: rgba(52, 168, 83, 0.2);
    border-right: 3px solid #34a853;
    margin-left: auto;
}

.chat-input-area {
    display: flex;
    gap: 10px;
}

.chat-input-area input {
    flex: 1;
    padding: 12px 20px;
    border: none;
    border-radius: 25px;
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
    font-size: 1em;
}

.chat-input-area input:focus {
    outline: 2px solid #4285f4;
}

.send-btn {
    padding: 12px 20px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border: none;
    border-radius: 8px;
    color: white;
    cursor: pointer;
    font-size: 1.2em;
}

.send-btn:hover {
    transform: scale(1.05);
}

/* --------------------------------------------------------------------------
   Welcome message + quick-actions
   -------------------------------------------------------------------------- */

.welcome-message {
    text-align: center;
    padding: 60px 20px;
}

.welcome-message h2 {
    font-size: 2em;
    margin-bottom: 15px;
}

.welcome-message p {
    color: #aaa;
    margin-bottom: 30px;
}

.quick-actions {
    display: flex;
    gap: 15px;
    justify-content: center;
    flex-wrap: wrap;
}

.quick-action {
    background: rgba(66, 133, 244, 0.2);
    border: 1px solid #4285f4;
    padding: 12px 25px;
    border-radius: 25px;
    cursor: pointer;
    transition: all 0.3s ease;
    color: #fff;
    font-size: 0.95em;
}

.quick-action:hover {
    background: rgba(66, 133, 244, 0.3);
}

/* --------------------------------------------------------------------------
   Правая колонка: прогресс + профиль + Hall of Fame + suggestions
   -------------------------------------------------------------------------- */

.progress-panel {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 15px;
    padding: 20px;
    margin-bottom: 20px;
}

.progress-panel h3 {
    margin-bottom: 15px;
    color: #4285f4;
}

.progress-stat {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.progress-stat:last-of-type {
    border-bottom: none;
}

.progress-stat-label {
    color: #aaa;
    font-size: 0.9em;
}

.progress-stat-value {
    color: #34a853;
    font-weight: 600;
}

.overall-progress {
    margin-top: 15px;
}

.overall-progress .progress-bar {
    height: 10px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 5px;
    margin: 10px 0;
    overflow: hidden;
}

.overall-progress .progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #4285f4, #34a853);
    border-radius: 5px;
    transition: width 0.5s ease;
}

.reset-progress {
    margin-top: 15px;
    padding: 8px 16px;
    background: rgba(244, 67, 54, 0.2);
    border: 1px solid rgba(244, 67, 54, 0.5);
    border-radius: 15px;
    color: #fff;
    cursor: pointer;
    font-size: 0.85em;
}

.reset-progress:hover {
    background: rgba(244, 67, 54, 0.3);
}

/* User profile */
.user-profile {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 10px;
    padding: 15px;
    margin-bottom: 20px;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 10px;
}

.user-avatar {
    font-size: 2.5em;
}

.user-details .user-name {
    font-weight: 600;
}

.user-details .user-role {
    font-size: 0.85em;
    color: #aaa;
}

.user-levels {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.level-indicator {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 0.75em;
    margin-top: 5px;
}

.level-basic {
    background: #e8f5e9;
    color: #2e7d32;
}

.level-intermediate {
    background: #fff3e0;
    color: #ef6c00;
}

.level-advanced {
    background: #fce4ec;
    color: #c2185b;
}

/* Hall of Fame button on dashboard */
.hall-of-fame-btn {
    display: block;
    text-align: center;
    padding: 15px;
    background: linear-gradient(90deg, rgba(251, 194, 59, 0.3), rgba(251, 194, 59, 0.1));
    border: 2px solid #fbc33b;
    border-radius: 15px;
    color: #fbc33b;
    text-decoration: none;
    font-weight: bold;
    font-size: 1.1em;
    margin-bottom: 20px;
    transition: all 0.3s;
}

.hall-of-fame-btn:hover {
    background: linear-gradient(90deg, rgba(251, 194, 59, 0.4), rgba(251, 194, 59, 0.2));
    transform: translateY(-2px);
}

/* Suggestion cards */
.suggestion-card {
    background: linear-gradient(135deg, rgba(66, 133, 244, 0.15), rgba(52, 168, 83, 0.15));
    border: 1px solid rgba(66, 133, 244, 0.3);
    border-radius: 10px;
    padding: 15px;
    margin-top: 15px;
}

.suggestion-card h4 {
    color: #4285f4;
    margin-bottom: 8px;
    font-size: 0.9em;
}

.suggestion-card p {
    font-size: 0.85em;
    color: #ddd;
    margin-bottom: 10px;
}

.suggestion-card button {
    background: rgba(66, 133, 244, 0.3);
    border: 1px solid #4285f4;
    color: #fff;
    padding: 8px 16px;
    border-radius: 20px;
    cursor: pointer;
    font-size: 0.85em;
}

.suggestion-card button:hover {
    background: rgba(66, 133, 244, 0.5);
}

/* --------------------------------------------------------------------------
   Direction detail: module cards
   -------------------------------------------------------------------------- */

.content-section {
    background: rgba(255, 255, 255, 0.03);
    border-radius: 15px;
    padding: 25px;
    margin-bottom: 30px;
}

.section-title {
    font-size: 1.5em;
    margin-bottom: 20px;
    color: #4285f4;
    border-bottom: 2px solid rgba(66, 133, 244, 0.3);
    padding-bottom: 10px;
}

.modules-section {
    margin-bottom: 40px;
}

.modules-section .section-title {
    margin-bottom: 20px;
    color: #4285f4;
}

.module-card {
    display: block;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 15px;
    padding: 20px;
    margin-bottom: 15px;
    text-decoration: none;
    color: white;
    transition: all 0.3s;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.module-card:hover {
    background: rgba(255, 255, 255, 0.1);
    transform: translateY(-5px);
    border-color: rgba(66, 133, 244, 0.5);
}

.module-card.locked {
    opacity: 0.5;
    cursor: not-allowed;
}

.module-card.locked:hover {
    opacity: 0.7;
    transform: none;
    border-color: rgba(251, 188, 4, 0.3);
}

.module-prereqs {
    margin-top: 10px;
    padding: 10px 12px;
    background: rgba(251, 188, 4, 0.08);
    border-left: 3px solid #fbbc04;
    border-radius: 4px;
    font-size: 0.85em;
    color: #ccc;
}

.module-prereqs small {
    color: #fbbc04;
    font-weight: 600;
    display: block;
    margin-bottom: 4px;
}

.module-prereqs ul {
    margin: 0;
    padding-left: 18px;
    color: #aaa;
}

.module-prereqs li {
    margin: 2px 0;
}

.status-depends {
    background: rgba(251, 188, 4, 0.2);
    color: #fbbc04;
}

.module-prereqs-warning {
    background: rgba(251, 188, 4, 0.08);
    border: 1px solid #fbbc04;
    border-radius: 8px;
    padding: 12px 16px;
    margin-bottom: 20px;
    color: #ccc;
}

.module-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.module-title {
    font-size: 1.2em;
    font-weight: 600;
    color: #fff;
}

.module-status {
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 0.8em;
    font-weight: 600;
}

.status-available {
    background: rgba(52, 168, 83, 0.2);
    color: #34a853;
}

.status-locked {
    background: rgba(255, 255, 255, 0.1);
    color: #888;
}

.module-description {
    color: #aaa;
    margin-bottom: 15px;
    line-height: 1.5;
}

.module-meta {
    display: flex;
    gap: 15px;
    font-size: 0.85em;
    color: #888;
}

.module-meta span {
    display: inline-flex;
    align-items: center;
    gap: 5px;
}

/* --------------------------------------------------------------------------
   Module detail: theory + cases
   -------------------------------------------------------------------------- */

.theory-section {
    background: rgba(255, 255, 255, 0.03);
    border-radius: 15px;
    padding: 25px;
    margin-top: 30px;
}

.theory-card {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 10px;
    padding: 15px;
    margin-bottom: 10px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    transition: all 0.3s ease;
}

.theory-card:hover {
    background: rgba(255, 255, 255, 0.1);
    transform: translateX(5px);
}

.theory-info h4 {
    margin-bottom: 5px;
}

.theory-info p {
    font-size: 0.85em;
    color: #aaa;
}

.theory-duration {
    padding: 5px 10px;
    background: rgba(66, 133, 244, 0.2);
    border-radius: 15px;
    font-size: 0.8em;
}

.cases-section {
    background: rgba(255, 255, 255, 0.03);
    border-radius: 15px;
    padding: 25px;
    margin-top: 30px;
}

.cases-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(400px, 1fr));
    gap: 20px;
    margin-top: 20px;
}

.case-card {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 10px;
    padding: 20px;
    transition: all 0.3s ease;
    border: 1px solid rgba(255, 255, 255, 0.1);
    cursor: pointer;
}

.case-card:hover {
    background: rgba(255, 255, 255, 0.1);
    transform: translateY(-5px);
}

.case-title {
    font-size: 1.2em;
    color: #34a853;
    margin-bottom: 10px;
}

.case-meta {
    font-size: 0.85em;
    color: #888;
    margin-bottom: 10px;
}

.case-desc {
    color: #aaa;
    line-height: 1.6;
    margin-bottom: 15px;
}

.case-badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 0.8em;
    margin-right: 10px;
}

.badge-beginner {
    background: #e8f5e9;
    color: #2e7d32;
}

.badge-intermediate {
    background: #fff3e0;
    color: #f57c00;
}

.badge-advanced {
    background: #ffebee;
    color: #c62828;
}

.case-tags {
    margin-top: 10px;
}

.case-tag {
    display: inline-block;
    padding: 2px 8px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    font-size: 0.75em;
    margin-right: 5px;
    color: #aaa;
}

.case-btn,
.case-sandbox-btn {
    padding: 8px 16px;
    border-radius: 8px;
    font-size: 0.9em;
    font-family: inherit;
    cursor: pointer;
    border: 1px solid;
    transition: background 0.2s ease;
}

.case-btn {
    background: rgba(52, 168, 83, 0.2);
    border-color: #34a853;
    color: #34a853;
}

.case-btn:hover {
    background: rgba(52, 168, 83, 0.3);
}

.case-sandbox-btn {
    background: rgba(26, 115, 232, 0.15);
    border-color: #1a73e8;
    color: #1a73e8;
}

.case-sandbox-btn:hover {
    background: rgba(26, 115, 232, 0.25);
}

.case-actions {
    display: flex;
    gap: 8px;
    align-items: center;
    margin-top: 10px;
    flex-wrap: wrap;
}

/* --------------------------------------------------------------------------
   Quiz — проверка знаний
   -------------------------------------------------------------------------- */

.check-section {
    background: linear-gradient(135deg, rgba(66, 133, 244, 0.08), rgba(52, 168, 83, 0.08));
    border: 2px solid rgba(66, 133, 244, 0.2);
    border-radius: 15px;
    padding: 20px;
    margin-top: 30px;
}

.check-blocks {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
}

.check-block {
    margin-bottom: 0;
}

.check-question {
    font-size: 1em;
    font-weight: 600;
    color: #fff;
    margin-bottom: 8px;
    line-height: 1.3;
}

.check-options {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.check-option {
    padding: 8px 14px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
    color: #ddd;
    line-height: 1.3;
    font-size: 0.92em;
}

.check-option:hover {
    background: rgba(66, 133, 244, 0.15);
    border-color: rgba(66, 133, 244, 0.5);
}

.check-option.revealed {
    cursor: default;
}

.check-option.revealed:hover {
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(255, 255, 255, 0.1);
}

.check-option.correct {
    background: rgba(52, 168, 83, 0.25);
    border-color: #34a853;
    color: #fff;
}

.check-option.correct::before {
    content: "✓ ";
    font-weight: bold;
}

.check-option.incorrect {
    background: rgba(234, 67, 53, 0.25);
    border-color: #ea4335;
    color: #fff;
}

.check-option.incorrect::before {
    content: "✗ ";
    font-weight: bold;
}

/* --------------------------------------------------------------------------
   Modals (теория / кейс)
   -------------------------------------------------------------------------- */

.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
    z-index: 1000;
    align-items: center;
    justify-content: center;
}

.modal.active {
    display: flex;
}

.modal-content {
    background: linear-gradient(135deg, #1a1a2e, #16213e);
    border-radius: 20px;
    padding: 40px 40px 20px 40px;
    max-width: 1050px;
    width: 90%;
    max-height: 80vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    border: 2px solid rgba(52, 168, 83, 0.3);
    position: relative;
}

.modal-content.theory {
    border-color: rgba(66, 133, 244, 0.3);
}

.modal-close {
    position: absolute;
    top: 15px;
    right: 15px;
    font-size: 2em;
    cursor: pointer;
    color: #888;
    background: none;
    border: none;
    line-height: 1;
}

.modal-close:hover {
    color: #fff;
}

.modal-title {
    color: #34a853;
    margin-bottom: 15px;
    font-size: 1.8em;
}

.modal-title.theory {
    color: #4285f4;
}

.modal-meta {
    display: flex;
    gap: 20px;
    margin-bottom: 20px;
    color: #888;
    font-size: 0.9em;
}

.modal-body {
    line-height: 1.8;
    color: #ddd;
    overflow-y: auto;
    flex: 1 1 auto;
    min-height: 0;
}

.modal-body a {
    color: #64b5f6;
    text-decoration: underline;
}

.modal-body a:hover {
    color: #90caf9;
}

.modal-body h4 {
    color: #4285f4;
    margin: 15px 0 10px 0;
}

.modal-body ul,
.modal-body ol {
    margin-left: 20px;
    margin-bottom: 15px;
}

.modal-body li {
    margin-bottom: 8px;
}

/* --------------------------------------------------------------------------
   Hall of Fame
   -------------------------------------------------------------------------- */

.my-stats {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 15px;
    padding: 18px;
    margin-bottom: 16px;
}

.my-stats h2 {
    color: #4285f4;
    margin-bottom: 14px;
}

/* HoF: лидерборд сверху, значки снизу на всю ширину. */
.hall-layout {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.hall-main {
    width: 100%;
}

.hall-side {
    width: 100%;
}

@media (min-width: 1100px) {
    /* Лидерборд ограничен по ширине для читаемости, значки — на всю ширину. */
    .hall-main {
        max-width: 1100px;
        margin: 0 auto;
    }
    .hall-side .badges-section {
        margin-bottom: 0;
    }
}

.my-stats-grid,
.stats-overview {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 15px;
}

.stat-card {
    background: rgba(255, 255, 255, 0.03);
    border-radius: 12px;
    padding: 20px;
    text-align: center;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.stat-value {
    font-size: 2em;
    color: #34a853;
    font-weight: bold;
    margin-bottom: 5px;
}

.stat-label {
    color: #aaa;
    font-size: 0.9em;
}

.leaderboard-section {
    background: rgba(255, 255, 255, 0.03);
    border-radius: 15px;
    padding: 18px;
    margin-bottom: 16px;
}

.filter-section {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.filter-btn {
    padding: 8px 16px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 20px;
    color: #aaa;
    cursor: pointer;
    font-size: 0.9em;
    transition: all 0.3s;
}

.filter-btn:hover,
.filter-btn.active {
    background: rgba(66, 133, 244, 0.2);
    border-color: #4285f4;
    color: #fff;
}

.leaderboard {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.leaderboard-item {
    display: grid;
    grid-template-columns: 60px 50px 1fr auto;
    gap: 15px;
    align-items: center;
    padding: 15px;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.05);
    transition: all 0.3s;
}

.leaderboard-item:hover {
    background: rgba(255, 255, 255, 0.06);
    transform: translateX(5px);
}

.leaderboard-item.top-1 {
    background: linear-gradient(90deg, rgba(251, 194, 59, 0.15), transparent);
    border-color: rgba(251, 194, 59, 0.3);
}

.leaderboard-item.top-2 {
    background: linear-gradient(90deg, rgba(192, 192, 192, 0.1), transparent);
    border-color: rgba(192, 192, 192, 0.2);
}

.leaderboard-item.top-3 {
    background: linear-gradient(90deg, rgba(205, 127, 50, 0.1), transparent);
    border-color: rgba(205, 127, 50, 0.2);
}

.leaderboard-rank {
    font-size: 1.5em;
    font-weight: bold;
    text-align: center;
}

.leaderboard-avatar {
    font-size: 2em;
    text-align: center;
}

.leaderboard-user .lb-name {
    font-weight: 600;
    margin-bottom: 3px;
}

.leaderboard-user .lb-department {
    font-size: 0.85em;
    color: #aaa;
}

.leaderboard-stats {
    display: flex;
    gap: 15px;
    font-size: 0.85em;
    color: #888;
}

.leaderboard-score {
    font-size: 1.3em;
    font-weight: bold;
    color: #fbc33b;
}

.badges-section {
    background: rgba(255, 255, 255, 0.03);
    border-radius: 15px;
    padding: 18px;
    margin-bottom: 16px;
}

.badges-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 10px;
}

.badge-card {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 12px;
    padding: 12px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.badge-card:hover {
    background: rgba(255, 255, 255, 0.1);
    transform: translateY(-3px);
}

.badge-card.earned {
    border-color: rgba(251, 194, 59, 0.5);
    background: rgba(251, 194, 59, 0.05);
}

.badge-icon {
    font-size: 3em;
    margin-bottom: 10px;
}

.badge-name {
    font-weight: 600;
    margin-bottom: 5px;
}

.badge-desc {
    font-size: 0.85em;
    color: #aaa;
    margin-bottom: 8px;
}

.badge-count {
    font-size: 0.75em;
    color: #666;
}

/* --------------------------------------------------------------------------
   Утилиты
   -------------------------------------------------------------------------- */

.text-muted {
    color: #aaa;
}

.text-center {
    text-align: center;
}

.empty-state {
    text-align: center;
    padding: 40px 20px;
    color: #888;
}

/* =========================================================================
   FAB chat widget (C3.1) — floating button + collapsible panel.
   На дашборде (body.has-inline-chat) FAB скрыт, чат inline в 3-й колонке.
   ========================================================================= */

.chat-fab {
    position: fixed;
    bottom: 24px;
    right: 24px;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    border: none;
    background: #4285f4;
    color: #fff;
    font-size: 24px;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    z-index: 1000;
    transition: transform 0.2s, box-shadow 0.2s;
}

.chat-fab:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.4);
}

/* На дашборде FAB скрыт (чат уже inline). */
body.has-inline-chat .chat-fab {
    display: none;
}

.chat-panel-floating {
    position: fixed;
    bottom: 96px;
    right: 24px;
    width: 360px;
    max-height: 500px;
    background: #1a1a2e;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
    z-index: 1001;
    display: none;
    flex-direction: column;
    overflow: hidden;
}

.chat-panel-floating--open {
    display: flex;
}

.chat-panel-floating-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.chat-panel-floating-header h3 {
    margin: 0;
    font-size: 1em;
}

.chat-panel-close {
    background: none;
    border: none;
    color: #888;
    font-size: 24px;
    cursor: pointer;
    padding: 0 4px;
    line-height: 1;
}

.chat-panel-close:hover {
    color: #fff;
}

.chat-messages--fab {
    flex: 1;
    overflow-y: auto;
    padding: 12px 16px;
    min-height: 200px;
    max-height: 350px;
}

/* Мобильная адаптация: FAB-панель на полный экран. */
@media (max-width: 768px) {
    .chat-panel-floating {
        bottom: 0;
        right: 0;
        left: 0;
        width: 100%;
        max-height: 100%;
        border-radius: 0;
    }
}

/* --------------------------------------------------------------------------
   Chat link cards — кликабельные ссылки в ответе чат-бота.
   -------------------------------------------------------------------------- */

.chat-links {
    margin-top: 10px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.chat-link-card {
    display: inline-block;
    padding: 8px 14px;
    background: rgba(66, 133, 244, 0.12);
    border: 1px solid rgba(66, 133, 244, 0.3);
    border-radius: 8px;
    color: #8ab4f8;
    text-decoration: none;
    font-size: 0.88em;
    transition: background 0.2s, border-color 0.2s;
    cursor: pointer;
}

.chat-link-card:hover {
    background: rgba(66, 133, 244, 0.25);
    border-color: #4285f4;
    color: #fff;
}

.chat-link-card::before {
    content: "→ ";
    opacity: 0.7;
}

/* UX-FB-2: abbr tooltips */
abbr.abbr-tip {
    border-bottom: 1px dotted #64b5f6;
    cursor: help;
    text-decoration: none;
    color: #64b5f6;
}

/* UX-FB-1: блок источников теории */
.theory-references {
    margin-top: 1.5em;
    padding-top: 1em;
    border-top: 1px solid rgba(255,255,255,0.1);
}
.references-title {
    font-size: 1em;
    font-weight: 600;
    color: #aaa;
    margin-bottom: 0.5em;
}
.references-list {
    list-style: none;
    padding: 0;
    margin: 0;
}
.reference-item {
    padding: 6px 0;
    font-size: 0.88em;
    color: #ccc;
    line-height: 1.4;
    display: flex;
    align-items: flex-start;
    gap: 6px;
    flex-wrap: wrap;
}
.reference-text {
    flex: 1;
    min-width: 0;
}
.reference-copy-btn {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 0.95em;
    opacity: 0.5;
    transition: opacity 0.2s;
    padding: 2px 4px;
    flex-shrink: 0;
}
.reference-copy-btn:hover {
    opacity: 1;
}
.reference-item a {
    color: #64b5f6;
    text-decoration: none;
    font-size: 0.85em;
}