/* frontend/static/app/styles.css - стили приложения */
body {
    font-family: Arial, sans-serif;
    margin: 0;
    padding: 20px;
    background-color: white;
}

@font-face {
    font-family: "BotHelpPrimary";
    src: url("/static/exapp/fonts/v_CCMeanwhileUncial-Doubled_v1.25.ttf") format("truetype");
    font-weight: normal;
    font-style: normal;
    font-display: swap;
}

body.bot-help-spotlight-active::before {
    content: '';
    position: fixed;
    inset: 0;
    background: rgba(10, 16, 28, 0.22);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    z-index: 980;
    pointer-events: none;
}

.history-transition-overlay {
    position: fixed;
    inset: 0;
    z-index: 1006;
    display: none;
    align-items: center;
    justify-content: center;
    background: rgba(7, 11, 18, 0.42);
    backdrop-filter: blur(2px);
    -webkit-backdrop-filter: blur(2px);
    pointer-events: auto;
}

.history-transition-busy .bot-help-dormant,
.history-transition-busy .bot-help-panel {
    pointer-events: none !important;
}

.history-transition-overlay.is-visible {
    display: flex;
}

.history-transition-overlay__content {
    min-width: 160px;
    text-align: center;
    color: #f8fafc;
    font-size: 20px;
    font-weight: 700;
    letter-spacing: 0.01em;
    padding: 12px 18px;
    border-radius: 12px;
    background: rgba(15, 23, 42, 0.78);
    border: 1px solid rgba(148, 163, 184, 0.42);
    box-shadow: 0 16px 34px rgba(2, 6, 23, 0.4);
}

.bot-help-spotlight-target {
    position: relative;
    z-index: 1000 !important;
    filter: none !important;
    outline: 2px solid rgba(59, 130, 246, 0.95);
    outline-offset: 2px;
    border-radius: 8px;
}

.bot-help-spotlight-elevated {
    z-index: 1000 !important;
}

#player-panels-container.bot-help-spotlight-has-target .player-panel {
    filter: blur(2px) brightness(0.64);
    opacity: 0.74;
    transition: filter 0.2s ease, opacity 0.2s ease;
}

#player-panels-container.bot-help-spotlight-has-target .player-panel.bot-help-spotlight-panel-target {
    filter: none;
    opacity: 1;
}

#player-panels-container .player-panel.bot-help-spotlight-panel-target .bot-help-spotlight-muted {
    filter: blur(2px) brightness(0.66);
    opacity: 0.7;
    transition: filter 0.2s ease, opacity 0.2s ease;
}

.bot-help-dormant {
    position: fixed;
    right: 18px;
    bottom: 18px;
    z-index: 1010;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    pointer-events: auto;
    cursor: pointer;
}

.bot-help-dormant__avatar {
    width: 52px;
    height: 52px;
    border-radius: 50%;
    clip-path: circle(50% at 50% 50%);
    object-fit: cover;
    object-position: center;
    border: 3px solid #3b82f6;
    box-shadow: 0 0 0 2px rgba(191, 219, 254, 0.95), 0 10px 22px rgba(30, 64, 175, 0.35);
    filter: brightness(0.52) saturate(0.85);
    transform: translateZ(0) scale(0.96);
    transition: transform 180ms ease, box-shadow 180ms ease, filter 180ms ease;
    image-rendering: auto;
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
    -webkit-mask-image: -webkit-radial-gradient(white, black);
    will-change: transform, filter;
}

.bot-help-dormant:hover .bot-help-dormant__avatar {
    transform: scale(1.12);
    filter: brightness(1) saturate(1.05);
    box-shadow: 0 0 0 2px rgba(147, 197, 253, 0.98), 0 14px 30px rgba(30, 64, 175, 0.5);
}

.bot-help-dormant:focus-visible .bot-help-dormant__avatar {
    transform: scale(1.12);
    filter: brightness(1) saturate(1.05);
    box-shadow: 0 0 0 2px rgba(147, 197, 253, 0.95), 0 12px 24px rgba(30, 64, 175, 0.42);
}

.bot-help-dormant.is-awake .bot-help-dormant__avatar {
    transform: scale(1.12);
    filter: brightness(1) saturate(1.05);
    box-shadow: 0 0 0 2px rgba(147, 197, 253, 0.98), 0 14px 30px rgba(30, 64, 175, 0.5);
}

.bot-help-dormant.bot-help-dormant--just-closed .bot-help-dormant__avatar,
.bot-help-dormant.bot-help-dormant--just-closed:hover .bot-help-dormant__avatar,
.bot-help-dormant.bot-help-dormant--just-closed:focus-visible .bot-help-dormant__avatar {
    transform: translateZ(0) scale(0.96);
    filter: brightness(0.52) saturate(0.85);
    box-shadow: 0 0 0 2px rgba(191, 219, 254, 0.95), 0 10px 22px rgba(30, 64, 175, 0.35);
}

.bot-help-panel {
    position: fixed;
    right: 74px;
    bottom: 18px;
    z-index: 1011;
    width: min(440px, calc(100vw - 110px));
    min-height: 0;
    background: linear-gradient(135deg, #fbfdff 0%, #f4f9ff 48%, #f7f2ff 100%);
    border: 1px solid rgba(148, 163, 184, 0.36);
    border-radius: 14px;
    box-shadow: 0 16px 36px rgba(15, 23, 42, 0.22);
    padding: 8px 30px 5px 12px;
    opacity: 0;
    transform: scale(0.82);
    transform-origin: right bottom;
    transition: transform 220ms ease, opacity 220ms ease;
    pointer-events: none;
}

.bot-help-panel.visible {
    opacity: 1;
    transform: scale(1);
    pointer-events: auto;
}

.bot-help-panel__title {
    color: #334155;
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 0.2px;
}

.bot-help-panel__photo {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    clip-path: circle(50% at 50% 50%);
    object-fit: cover;
    object-position: center;
    border: 1px solid rgba(148, 163, 184, 0.45);
    box-shadow: 0 8px 18px rgba(15, 23, 42, 0.18);
    flex-shrink: 0;
    image-rendering: auto;
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
    -webkit-mask-image: -webkit-radial-gradient(white, black);
}

.bot-help-panel__close {
    position: absolute;
    top: 6px;
    right: 6px;
    border: none;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    cursor: pointer;
    background: rgba(148, 163, 184, 0.2);
    color: #334155;
    font-size: 11px;
    line-height: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
}

.bot-help-panel__quote {
    color: #1e293b;
    font-size: 7px;
    line-height: 1.35;
    font-family: "BotHelpPrimary", "Comic Sans MS", cursive;
    min-height: 1.4em;
}

.bot-help-panel__quote::after {
    content: '';
    display: block;
    clear: both;
}

.bot-help-panel__quote-text {
    display: block;
    padding-top: 23px;
    white-space: pre-wrap;
}

.bot-help-panel__photo--inline {
    float: left;
    width: 46px;
    height: 46px;
    margin: 0 8px 4px 0;
}

.bot-help-panel__nav {
    margin-top: 4px;
    display: flex;
    justify-content: space-between;
    gap: 8px;
}

.bot-help-panel__nav-btn {
    flex: 1;
    border: 1px solid rgba(148, 163, 184, 0.4);
    background: rgba(255, 255, 255, 0.9);
    color: #334155;
    border-radius: 8px;
    padding: 3px 8px;
    font-size: 11px;
    cursor: pointer;
    transition: background-color 120ms ease, opacity 120ms ease;
}

.bot-help-panel__nav-btn:hover:not(:disabled) {
    background: rgba(240, 245, 255, 0.98);
}

.bot-help-panel__nav-btn:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

.bot-help-choice-modal {
    position: fixed;
    inset: 0;
    z-index: 1200;
    display: none;
}

.bot-help-choice-modal.visible {
    display: block;
}

.bot-help-choice-modal__backdrop {
    position: absolute;
    inset: 0;
    background: rgba(12, 18, 30, 0.62);
    backdrop-filter: blur(2px);
}

.bot-help-choice-modal__dialog {
    position: relative;
    width: min(560px, calc(100vw - 28px));
    margin: 8vh auto 0;
    padding: 20px 18px;
    border-radius: 16px;
    border: 1px solid rgba(145, 168, 255, 0.35);
    background: linear-gradient(150deg, #f8fbff 0%, #f2f6ff 48%, #f8f2ff 100%);
    box-shadow: 0 22px 46px rgba(15, 23, 42, 0.3);
}

.bot-help-choice-modal__title {
    margin: 0 0 12px;
    color: #2f3a63;
    font-size: 20px;
}

.bot-help-choice-modal__list {
    display: grid;
    gap: 10px;
    margin-bottom: 12px;
}

.bot-help-choice-modal__item {
    border: 1px solid rgba(148, 163, 184, 0.35);
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.94);
    width: 100%;
    text-align: left;
    padding: 9px 10px;
    display: flex;
    gap: 10px;
    align-items: center;
    cursor: pointer;
}

.bot-help-choice-modal__item.selected {
    border-color: rgba(59, 130, 246, 0.7);
    box-shadow: 0 0 0 2px rgba(147, 197, 253, 0.55);
}

.bot-help-choice-modal__avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    object-fit: cover;
    border: 1px solid rgba(148, 163, 184, 0.45);
}

.bot-help-choice-modal__meta {
    display: grid;
    gap: 2px;
}

.bot-help-choice-modal__name {
    font-size: 16px;
    font-weight: 700;
    color: #27324f;
}

.bot-help-choice-modal__role {
    font-size: 13px;
    color: #5a688d;
}

.bot-help-choice-modal__confirm {
    width: 100%;
    border: none;
    border-radius: 10px;
    height: 40px;
    font-size: 15px;
    font-weight: 700;
    color: #fff;
    cursor: pointer;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

body.spotlight-3d-active::before {
    content: '';
    position: fixed;
    inset: 0;
    background: rgba(8, 14, 28, 0.25);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    z-index: 900;
    pointer-events: none;
}

.pdfs-list h1 {
    color: #333;
    margin-bottom: 20px;
    font-size: 1rem;
    line-height: 1.2;
}

.upload-section {
    margin-bottom: 30px;
}

#single-upload-confirm-slot {
    margin-top: 12px;
}

.single-upload-confirm {
    border: 1px solid rgba(190, 99, 12, 0.3);
    background: linear-gradient(180deg, rgba(255, 248, 227, 0.95) 0%, rgba(255, 241, 208, 0.95) 100%);
    border-radius: 10px;
    padding: 12px 14px;
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.08);
    max-width: 560px;
}

.single-upload-confirm__title {
    font-size: 15px;
    font-weight: 700;
    color: #7a3f00;
    margin-bottom: 6px;
}

.single-upload-confirm__text {
    color: #5e4a2d;
    margin-bottom: 10px;
    font-size: 14px;
}

.single-upload-confirm__actions {
    display: flex;
    gap: 8px;
}

.single-upload-confirm__btn {
    border: none;
    border-radius: 8px;
    padding: 7px 14px;
    cursor: pointer;
    font-weight: 600;
}

.single-upload-confirm__btn.yes {
    background: #d35400;
    color: #fff;
}

.single-upload-confirm__btn.no {
    background: rgba(255, 255, 255, 0.9);
    color: #5e4a2d;
    border: 1px solid rgba(94, 74, 45, 0.25);
}

.upload-btn {
    background-color: #4CAF50;
    color: white;
    padding: 10px 20px;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 16px;
}

.upload-btn:hover {
    background-color: #45a049;
}

.pdfs-container {
    display: grid;
    gap: 15px;
}

.uploading-section {
    margin-top: 20px;
}

.uploading-section h2 {
    display: flex;
    align-items: center;
    gap: 10px;
}

.cards-loading-overlay {
    min-height: 68vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #000;
    border-radius: 12px;
}

.cards-loading-overlay__content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 14px;
    color: #f8fafc;
}

.cards-loading-overlay__photo {
    width: min(220px, 58vw);
    aspect-ratio: 1 / 1;
    border-radius: 50%;
    object-fit: cover;
    object-position: center;
    border: 2px solid rgba(255, 255, 255, 0.45);
    box-shadow: 0 0 26px rgba(255, 255, 255, 0.25);
}

.cards-loading-overlay__percent {
    font-size: clamp(24px, 5vw, 40px);
    font-weight: 700;
    letter-spacing: 1.4px;
}

.pdf-header {
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    align-items: flex-start;
    margin-bottom: 10px;
}

.pdf-header h3 {
    margin: 0 0 10px 0;
    flex: 1;
    vertical-align: middle;
}

.pdf-actions {
    display: flex;
    gap: 5px;
    margin-left: 0;
    align-items: center;
}

.pdf-more-menu-wrap {
    position: relative;
}

.pdf-more-btn {
    font-weight: 700;
    line-height: 1;
    min-width: 34px;
}

.pdf-more-menu {
    position: absolute;
    top: calc(100% + 6px);
    right: 0;
    min-width: 220px;
    background: #fff;
    border: 1px solid #d9e2f1;
    border-radius: 10px;
    box-shadow: 0 12px 24px rgba(21, 35, 64, 0.16);
    padding: 6px;
    display: none;
    flex-direction: column;
    gap: 2px;
    z-index: 60;
}

.pdf-more-menu-wrap.is-open .pdf-more-menu {
    display: flex;
}

.pdf-more-menu__item {
    border: none;
    background: transparent;
    color: #243049;
    text-align: left;
    font-size: 14px;
    line-height: 1.3;
    padding: 8px 10px;
    border-radius: 8px;
    cursor: pointer;
    width: 100%;
    transition: background-color 0.15s ease, color 0.15s ease;
}

.pdf-more-menu__item:hover {
    background: rgba(99, 102, 241, 0.1);
}

.action-btn {
    background: none;
    border: none;
    font-size: 24px; /* Уменьшено с 64px */
    cursor: pointer;
    padding: 5px;
    border-radius: 4px;
    transition: background-color 0.3s ease;
}

.game-btn {
    text-decoration: none;
    color: inherit;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
    box-shadow: 0 0 0 1px rgba(214, 170, 66, 0.38);
    animation: gameBtnPulse 10s ease-in-out infinite;
}

.game-btn.spotlight-3d-target {
    position: relative;
    z-index: 950;
    filter: none !important;
    transform: translateZ(0) scale(1.08);
    box-shadow: 0 0 0 2px rgba(255, 230, 148, 0.95), 0 0 18px rgba(255, 209, 102, 0.65);
}

.game-btn::before {
    content: '';
    position: absolute;
    top: -30%;
    left: -55%;
    width: 42%;
    height: 170%;
    transform: rotate(20deg);
    background: linear-gradient(
        90deg,
        rgba(255, 255, 255, 0) 0%,
        rgba(232, 199, 115, 0.2) 40%,
        rgba(255, 229, 138, 0.72) 50%,
        rgba(232, 199, 115, 0.2) 60%,
        rgba(255, 255, 255, 0) 100%
    );
    pointer-events: none;
    z-index: 1;
    animation: gameBtnShine 10s ease-in-out infinite;
}

.game-btn::after {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: 4px;
    border: 1px solid rgba(235, 196, 96, 0.55);
    box-shadow: inset 0 0 10px rgba(255, 225, 140, 0.22), 0 0 12px rgba(232, 186, 75, 0.35);
    pointer-events: none;
    z-index: 1;
}

.chatbot-btn:hover {
    background-color: rgba(111, 66, 193, 0.12);
    box-shadow: 0 0 0 1px rgba(111, 66, 193, 0.35) inset;
}

.exam-btn:hover {
    background-color: rgba(40, 167, 69, 0.12);
    box-shadow: 0 0 0 1px rgba(40, 167, 69, 0.35) inset;
}

    .cards-btn:hover {
        background-color: rgba(255, 193, 7, 0.1);
    }

    .learn-btn:hover {
        background-color: rgba(40, 167, 69, 0.1);
    }

    .game-btn:hover {
        background-color: rgba(224, 173, 56, 0.18);
        box-shadow: 0 0 0 1px rgba(233, 193, 94, 0.62), 0 0 14px rgba(224, 173, 56, 0.25);
    }

@keyframes gameBtnShine {
    0%, 88%, 100% {
        left: -55%;
        opacity: 0;
    }
    89% {
        opacity: 0.2;
    }
    92% {
        left: 130%;
        opacity: 1;
    }
    96% {
        left: 130%;
        opacity: 0;
    }
}

@keyframes gameBtnPulse {
    0%, 86%, 100% {
        filter: brightness(1);
        transform: scale(1);
    }
    90% {
        filter: brightness(1.16);
        transform: scale(1.05);
    }
    94% {
        filter: brightness(1.04);
        transform: scale(1.02);
    }
}

.view-btn:hover {
    background-color: rgba(0, 123, 255, 0.1);
}

.stats-btn:hover {
    background-color: rgba(23, 162, 184, 0.12);
    box-shadow: 0 0 0 1px rgba(23, 162, 184, 0.35) inset;
}

.delete-btn:hover {
    background-color: rgba(220, 53, 69, 0.1);
}

.share-btn:hover {
    background-color: rgba(16, 185, 129, 0.12);
    box-shadow: 0 0 0 1px rgba(16, 185, 129, 0.35) inset;
}

.share-btn--active:hover {
    background-color: rgba(16, 185, 129, 0.18) !important;
    box-shadow: 0 0 0 1px rgba(16, 185, 129, 0.45) inset;
}

.pdf-item {
    background-color: #f5f5f5;
    padding: 20px;
    border-radius: 8px;
    transition: background-color 0.3s;
    position: relative;
}

.pdf-item-layout {
    display: grid;
    grid-template-columns: minmax(96px, 20%) minmax(0, 1fr);
    column-gap: 14px;
    align-items: start;
}

.pdf-background-rect {
    width: 100%;
    height: 30px;
    border-radius: 4px;
    border: 1px solid #ddd;
    margin-top: 10px;
}

.pdf-item:hover {
    background-color: #e8e8e8;
}

.pdf-main-content {
    min-width: 0;
}

.pdf-item.pdf-uploading {
    cursor: default;
    opacity: 0.8;
    border: 2px solid #007bff;
}

.pdf-item.pdf-uploading:hover {
    background-color: #f5f5f5; /* Не меняем цвет при наведении для загружающихся PDF */
}

/* Стили для статуса загрузки */
.upload-status-container {
    margin-top: 15px;
}

.upload-status-text {
    font-size: 14px;
    color: #6c757d;
    margin-bottom: 10px;
    font-style: italic;
}

.upload-progress-bar {
    width: 100%;
    height: 20px;
    background-color: #e9ecef;
    border-radius: 10px;
    overflow: hidden;
    margin-bottom: 5px;
    position: relative;
}

.upload-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #007bff, #0056b3);
    border-radius: 10px;
    transition: width 0.3s ease;
    position: relative;
}

.upload-progress-fill::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.3), transparent);
    animation: shimmer 2s infinite;
}

@keyframes shimmer {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(100%); }
}

.upload-progress-text {
    text-align: center;
    font-size: 12px;
    color: #495057;
    font-weight: bold;
}

.pdf-stats {
    position: absolute;
    top: 50%;
    right: 20px;
    transform: translateY(-50%);
    font-weight: bold;
    font-size: 20pt;
    text-align: right;
}

.pdf-item h3 {
    margin: 0 0 10px 0;
    color: #333;
}

.pdf-preview {
    color: #666;
    font-size: 14px;
    line-height: 1.4;
}

/* PDF Viewer стили */
.pdf-viewer {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

.pdf-viewer-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 1px solid #e9ecef;
}

.pdf-viewer-title {
    color: #333;
    margin: 0;
    font-size: 24px;
    font-weight: bold;
    flex: 1;
}

.pdf-back-link {
    color: #007bff;
    cursor: pointer;
    text-decoration: none;
    font-size: 16px;
    padding: 8px 16px;
    border: 1px solid #007bff;
    border-radius: 4px;
    transition: all 0.3s ease;
    background: white;
}

.pdf-back-link:hover {
    background-color: #007bff;
    color: white;
    text-decoration: none;
}

.pdf-controls {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 15px;
    margin-bottom: 20px;
    padding: 15px;
    background-color: #f8f9fa;
    border-radius: 8px;
}

.pdf-controls button {
    background-color: #007bff;
    color: white;
    padding: 8px 16px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    transition: background-color 0.3s ease;
}

.pdf-controls button:hover:not(:disabled) {
    background-color: #0056b3;
}

.pdf-controls button:disabled {
    background-color: #6c757d;
    cursor: not-allowed;
    opacity: 0.6;
}

.page-info {
    font-weight: bold;
    color: #495057;
    font-size: 16px;
    margin: 0 10px;
}

.pdf-document-container {
    text-align: center;
    margin: 20px 0;
}

#loading-message {
    font-size: 18px;
    color: #6c757d;
    padding: 40px;
    background-color: #f8f9fa;
    border-radius: 8px;
    margin: 20px 0;
}

#pdf-canvas {
    border: 2px solid #dee2e6;
    border-radius: 8px;
    display: block;
    margin: 0 auto;
    max-width: 100%;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    background: white;
}

.questions-view {
    max-width: 800px;
}

.back-link {
    color: #007bff;
    cursor: pointer;
    margin-bottom: 20px;
    text-decoration: underline;
}

.back-link:hover {
    color: #0056b3;
}

.pdfs-footer {
    margin-top: 24px;
    padding-top: 10px;
    border-top: 1px solid #e5e7eb;
    display: flex;
    justify-content: center;
    gap: 8px;
    flex-wrap: wrap;
}

.contacts-link-btn {
    background: transparent;
    border: none;
    color: #0d5bd7;
    text-decoration: underline;
    cursor: pointer;
    font-size: 14px;
    padding: 6px 10px;
}

.contacts-link-btn:hover {
    color: #0846a6;
}

.materials-tabs {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin-top: 12px;
    margin-bottom: 8px;
    flex-wrap: wrap;
}

.materials-tab-btn {
    border: 1px solid #c7d2fe;
    background: #f8faff;
    color: #1e3a8a;
    border-radius: 999px;
    padding: 6px 12px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s ease;
}

.materials-tab-btn:hover {
    border-color: #93c5fd;
    background: #eff6ff;
}

.materials-tab-btn.is-active {
    background: linear-gradient(135deg, #2563eb 0%, #4f46e5 100%);
    color: #ffffff;
    border-color: transparent;
    box-shadow: 0 6px 14px rgba(37, 99, 235, 0.25);
}

.community-load-more-wrap {
    margin-top: 14px;
    display: flex;
    justify-content: center;
}

.community-load-more-btn {
    min-width: 220px;
}

.community-copy-btn {
    width: 40px !important;
    height: 40px !important;
    font-size: 20px !important;
    margin-right: 8px;
}

.share-btn--active {
    background: #e9fbe7 !important;
    border-color: #7cc47a !important;
}

.community-owner-label {
    margin: 4px 0 8px;
    color: #64748b;
    font-size: 13px;
}

.community-no-access-view {
    max-width: 760px;
}

.community-no-access-banner {
    margin-top: 8px;
    padding: 12px 18px;
    border-radius: 14px;
    border: 2px dashed #ef4444;
    color: #991b1b;
    background: #fff1f2;
    font-size: 24px;
    font-weight: 800;
    text-align: center;
    display: inline-block;
    max-width: 100%;
}

.community-no-access-text {
    margin-top: 12px;
    color: #334155;
    font-size: 16px;
    white-space: nowrap;
}

.contacts-view {
    max-width: 760px;
}

.profile-view {
    max-width: 860px;
}

.profile-view h2 {
    margin: 0 0 14px;
    color: #1f2937;
}

.profile-card {
    display: grid;
    gap: 16px;
    background: linear-gradient(145deg, #ffffff 0%, #f8fbff 100%);
    border: 1px solid #dbe5f3;
    border-radius: 14px;
    padding: 18px;
    box-shadow: 0 12px 30px rgba(15, 23, 42, 0.09);
}

.profile-card__header {
    display: grid;
    grid-template-columns: auto 1fr auto;
    gap: 14px;
    align-items: center;
}

.profile-card__avatar-wrap {
    width: 74px;
    height: 74px;
}

.profile-card__avatar {
    width: 74px;
    height: 74px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid #c7d7ef;
}

.profile-card__avatar--placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    background: #e4ecf9;
    color: #1e3a8a;
    font-weight: 700;
    font-size: 24px;
}

.profile-card__meta {
    min-width: 0;
}

.profile-card__name {
    font-size: 20px;
    font-weight: 700;
    color: #111827;
}

.profile-card__username {
    color: #6b7280;
    margin-top: 4px;
}

.profile-photo-upload-btn {
    display: inline-block;
    margin-top: 10px;
    padding: 6px 10px;
    background: #eff6ff;
    color: #1d4ed8;
    border: 1px solid #bfdbfe;
    border-radius: 8px;
    font-size: 13px;
    cursor: pointer;
}

.profile-star-block {
    display: grid;
    justify-items: center;
    gap: 6px;
}

.profile-star {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #7c5700;
    background: radial-gradient(circle at 30% 30%, #fff6c9 0%, #ffd85f 50%, #f5b400 100%);
    box-shadow: 0 0 20px rgba(245, 180, 0, 0.35);
    transition: width 200ms ease, height 200ms ease, font-size 200ms ease;
    animation: profile-star-pulse 2.8s ease-in-out infinite;
}

.profile-star-count {
    font-weight: 700;
    color: #1f2937;
}

.profile-history h3 {
    margin: 0 0 8px;
    color: #1f2937;
}

.profile-history__list {
    display: grid;
    gap: 8px;
}

.profile-history__row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 10px 12px;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    background: #ffffff;
}

.profile-history__reason {
    color: #334155;
}

.profile-history__stars {
    font-weight: 700;
    color: #92400e;
    white-space: nowrap;
}

.profile-history__empty {
    color: #6b7280;
}

.profile-history__sentinel {
    height: 2px;
}

.profile-access-levels h3 {
    margin: 4px 0 8px;
}

.profile-access-levels__list {
    display: grid;
    gap: 10px;
}

.profile-access-level {
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 10px 12px;
    background: #ffffff;
}

.profile-access-level--open {
    border-color: #86efac;
    background: #f0fdf4;
}

.profile-access-level__top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
    margin-bottom: 4px;
}

.profile-access-level__title {
    font-weight: 700;
    color: #1f2937;
}

.profile-access-level__status {
    font-size: 12px;
    color: #475569;
}

.profile-access-level__desc {
    font-size: 13px;
    color: #475569;
    margin-bottom: 8px;
}

.profile-access-level__progress {
    height: 8px;
    border-radius: 999px;
    background: #e5e7eb;
    overflow: hidden;
}

.profile-access-level__progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #3b82f6 0%, #22c55e 100%);
}

.star-reward-fly {
    position: fixed;
    right: 20px;
    bottom: 18px;
    z-index: 12000;
    padding: 8px 12px;
    border-radius: 999px;
    background: #fef3c7;
    color: #92400e;
    border: 1px solid #fcd34d;
    font-weight: 700;
    opacity: 0;
    transform: translateY(24px) scale(0.92);
    transition: transform 950ms ease, opacity 950ms ease;
    pointer-events: none;
}

.star-reward-fly--visible {
    opacity: 1;
    transform: translateY(-90px) scale(1);
}

@keyframes profile-star-pulse {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.06);
    }
}

.contacts-view h2 {
    margin: 0 0 14px;
    color: #1f2937;
}

.contacts-view p {
    margin: 0 0 10px;
    color: #374151;
}

.contacts-card {
    display: grid;
    gap: 12px;
    align-items: start;
    background: linear-gradient(145deg, #ffffff 0%, #f8fbff 100%);
    border: 1px solid #dbe5f3;
    border-radius: 14px;
    padding: 18px 18px 16px;
    box-shadow: 0 12px 30px rgba(15, 23, 42, 0.09);
    position: relative;
    overflow: hidden;
}

.contacts-card::before {
    content: '';
    position: absolute;
    inset: 0 auto 0 0;
    width: 4px;
    background: linear-gradient(180deg, #2563eb 0%, #7c3aed 100%);
}

.contacts-details {
    min-width: 0;
    display: grid;
    gap: 8px;
    align-content: start;
}

.contacts-details p {
    margin: 0;
    font-size: 16px;
    line-height: 1.5;
}

.contacts-details a {
    color: #0d5bd7;
    font-weight: 600;
    text-decoration: none;
    border-bottom: 1px solid rgba(13, 91, 215, 0.35);
}

.contacts-details a:hover {
    color: #0846a6;
    border-bottom-color: rgba(8, 70, 166, 0.6);
}

@media (max-width: 640px) {
    .contacts-card {
        padding: 16px 14px 14px;
    }
    .profile-card__header {
        grid-template-columns: 1fr;
        justify-items: start;
    }
    .profile-star-block {
        justify-items: start;
    }
    .community-copy-btn {
        width: 42px !important;
        height: 42px !important;
        font-size: 20px !important;
    }
    .materials-tabs {
        margin-top: 8px;
        margin-bottom: 8px;
    }
    .materials-tab-btn {
        font-size: 13px;
        padding: 6px 10px;
    }
}

.question h2 {
    color: #333;
    margin-bottom: 20px;
}

.variants {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.variant-option {
    display: flex;
    align-items: center;
    padding: 15px;
    background-color: #f8f9fa;
    border-radius: 5px;
    cursor: pointer;
    transition: background-color 0.3s;
}

.variant-option:hover {
    background-color: #e9ecef;
}

.variant-option input[type="radio"] {
    margin-right: 10px;
}

.variant-letter {
    font-weight: bold;
    color: #007bff;
    margin-right: 8px;
    min-width: 20px;
}

.variant-text {
    flex: 1;
}

.loading {
    opacity: 0.6;
    pointer-events: none;
}

.loading::after {
    content: "Загрузка...";
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: white;
    padding: 20px;
    border-radius: 5px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

#progress-container {
    margin: 20px 0;
    text-align: center;
}

.progress-bar {
    display: flex;
    justify-content: center;
    gap: 4px;
    margin: 20px 0;
    flex-wrap: wrap;
}

.progress-segment {
    width: 30px;
    height: 8px;
    background-color: #e9ecef;
    border-radius: 4px;
    transition: background-color 0.3s ease;
}

.progress-segment.correct {
    background-color: #28a745; /* Зеленый для правильных ответов */
}

.progress-segment.incorrect {
    background-color: #dc3545; /* Красный для неправильных ответов */
}

.question-counter {
    text-align: center;
    font-size: 14px;
    color: #666;
    margin-bottom: 15px;
}

.questions-view {
    max-width: 800px;
    margin: 0 auto;
    padding: 20px;
}

/* Стили для режима изучения */
.learning-view {
    max-width: 800px;
    margin: 0 auto;
    padding: 20px;
}

#learning-progress-container {
    margin: 20px 0;
    text-align: center;
}

.fragment-view {
    background-color: #f8f9fa;
    padding: 25px;
    border-radius: 8px;
    margin-bottom: 20px;
}

.fragment-counter {
    text-align: center;
    font-size: 16px;
    color: #666;
    margin-bottom: 20px;
    font-weight: bold;
}

.fragment-text {
    line-height: 1.6;
    font-size: 16px;
    color: #333;
    margin-bottom: 25px;
}

.fragment-text p {
    margin: 0 0 15px 0;
}

.fragment-content {
    overflow: hidden;
}

.fragment-picture img {
    max-width: 300px;
    height: auto;
    float: right;
    margin-left: 20px;
    margin-bottom: 10px;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.fragment-text {
    text-align: justify;
    line-height: 1.6;
}

/* Обеспечиваем правильное обтекание текстом */
.fragment-text p {
    margin-bottom: 1em;
}

/* Стили для адаптивности на маленьких экранах */
@media (max-width: 768px) {
    .fragment-picture img {
        float: none;
        display: block;
        margin: 0 auto 20px auto;
        max-width: 100%;
    }

    .fragment-text {
        margin-right: 0 !important;
    }
}

/* Стили для загружающихся PDF */
.loading-pdf {
    background-color: #f8f9fa !important;
    border: 2px dashed #007bff;
    pointer-events: none; /* Отключаем клики по загружающимся PDF */
    opacity: 0.8;
}

.loading-pdf:hover {
    background-color: #f8f9fa !important; /* Отключаем hover для загружающихся PDF */
}

.loading-status {
    padding: 15px 0;
}

.loading-text {
    font-weight: bold;
    color: #007bff;
    margin-bottom: 10px;
    font-size: 16px;
    text-align: center;
}

.progress-percentage {
    text-align: center;
    font-weight: bold;
    color: #495057;
    font-size: 14px;
}

/* Анимация для progress bar */
.progress-bar-fill {
    transition: width 0.5s ease-in-out;
}

.fragment-controls {
    text-align: center;
}

.btn {
    padding: 10px 20px;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 16px;
    transition: background-color 0.3s ease;
}

.btn-primary {
    background-color: #007bff;
    color: white;
}

.btn-primary:hover {
    background-color: #0056b3;
}

.learning-question {
    background-color: #ffffff;
    padding: 25px;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.learning-question h2 {
    color: #333;
    margin-bottom: 20px;
}

.learning-complete {
    text-align: center;
    background-color: #d4edda;
    padding: 40px;
    border-radius: 8px;
    border: 1px solid #c3e6cb;
}

.learning-complete h2 {
    color: #155724;
    margin-bottom: 20px;
}

.learning-complete p {
    color: #155724;
    font-size: 16px;
    margin-bottom: 25px;
    }

    /* Стили для карточек */
    .cards-view {
        max-width: 1200px;
        margin: 0 auto;
        padding: 20px;
    }

    .cards-view h2 {
        text-align: center;
        margin-bottom: 30px;
        color: #333;
    }

    .cards-container {
        display: grid;
        grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
        gap: 20px;
        margin: 20px 0;
    }

    .fragment-card {
        height: 200px;
        border-radius: 8px;
        position: relative;
        overflow: hidden;
        box-shadow: 0 4px 8px rgba(0,0,0,0.1);
        transition: transform 0.3s ease, box-shadow 0.3s ease;
        cursor: pointer;
    }

    .fragment-card:hover {
        transform: translateY(-5px);
        box-shadow: 0 6px 16px rgba(0,0,0,0.15);
    }

    .card-overlay {
        position: absolute;
        bottom: 0;
        left: 0;
        right: 0;
        background: linear-gradient(transparent, rgba(0,0,0,0.7));
        color: white;
        padding: 20px;
        display: flex;
        flex-direction: column;
        justify-content: flex-end;
        height: 100%;
    }

    .card-text {
        font-size: 14px;
        font-weight: bold;
        margin-bottom: 10px;
        text-shadow: 1px 1px 2px rgba(0,0,0,0.8);
    }

    .card-progress {
        display: flex;
        gap: 2px;
        flex-wrap: wrap;
    }

    .progress-division {
        width: 12px;
        height: 6px;
        border-radius: 2px;
    }

    .progress-division.correct {
        background-color: #28a745;
    }

    .progress-division.incorrect {
        background-color: #dc3545;
    }

    /* Адаптивность для карточек */
    @media (max-width: 768px) {
        .cards-container {
            grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
            gap: 15px;
        }

        .fragment-card {
            height: 150px;
        }
    }

/* Стили для списка вопросов на карточках */
.card-questions-list {
    margin-top: 10px;
    max-height: 120px;
    overflow-y: auto;
}

.card-question-item {
    transition: background-color 0.2s;
}

.card-question-item:hover {
    background-color: rgba(0, 0, 0, 0.4) !important;
}

/* Увеличиваем минимальную высоту карточек для размещения вопросов */
.fragment-card {
    min-height: 280px !important;
    height: auto;
}

/* Стили для скроллбара в списке вопросов */
.card-questions-list::-webkit-scrollbar {
    width: 4px;
}

.card-questions-list::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 2px;
}

.card-questions-list::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.4);
    border-radius: 2px;
}

.card-questions-list::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.6);
}

/* Добавить в конец файла или в секцию с карточками */

/* Эффект затемнения для карточки после возврата */
.fragment-card.card-dimmed .card-overlay {
    background-color: rgba(0, 0, 0, 0.8) !important;
    transition: background-color 0.5s ease;
}

/* Добавляем рамку для ещё большей заметности */
.fragment-card.card-dimmed {
    border: 3px solid #ffc107 !important;
    box-shadow: 0 0 20px rgba(255, 193, 7, 0.6) !important;
    transition: all 0.5s ease;
}

.fragment-card .card-overlay {
    transition: background-color 0.5s ease;
}

/* Стили для таймера */
#timer-container {
    transition: color 0.3s ease;
}

#timer-container.warning {
    animation: pulse 1s infinite;
}

@keyframes pulse {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.1);
    }
}

.chatbot-container {
    max-width: 800px;
    margin: 0 auto;
    padding: 20px;
}

.chatbot-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 2px solid #e0e0e0;
}

.chatbot-header h2 {
    margin: 0;
    color: #333;
}

.btn-back {
    padding: 8px 16px;
    background-color: #6c757d;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
}

.btn-back:hover {
    background-color: #5a6268;
}

.chatbot-progress {
    display: flex;
    justify-content: space-between;
    padding: 15px;
    background-color: #f8f9fa;
    border-radius: 8px;
    margin-bottom: 20px;
}

.progress-info, .progress-score {
    font-size: 16px;
    font-weight: 500;
    color: #495057;
}

.chatbot-messages {
    background-color: #fff;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    padding: 20px;
    min-height: 400px;
    max-height: 600px;
    overflow-y: auto;
    margin-bottom: 20px;
}

.message {
    margin-bottom: 15px;
    padding: 12px 16px;
    border-radius: 8px;
    max-width: 80%;
    animation: fadeIn 0.3s ease-in;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.bot-message {
    background-color: #e3f2fd;
    margin-right: auto;
}

.user-message {
    background-color: #f1f8e9;
    margin-left: auto;
}

.message p {
    margin: 0;
    line-height: 1.5;
}

.message button {
    margin-top: 10px;
}

.chatbot-input-area {
    display: flex;
    gap: 10px;
    align-items: stretch;
    flex-direction: column;
}

.chatbot-input-area textarea {
    width: 100%;
    padding: 12px;
    border: 1px solid #ced4da;
    border-radius: 8px;
    font-size: 14px;
    font-family: inherit;
    resize: vertical;
    min-height: 60px;
}

.chatbot-input-area textarea:focus {
    outline: none;
    border-color: #007bff;
    box-shadow: 0 0 0 0.2rem rgba(0, 123, 255, 0.25);
}

.chatbot-input-area button {
    padding: 12px 24px;
    white-space: nowrap;
}

.chatbot-input-actions {
    display: flex;
    flex-direction: row;
    gap: 8px;
    justify-content: flex-start;
    width: auto;
}

.chatbot-input-actions .btn-primary {
    width: 168px;
    min-height: 44px;
}

.btn-primary {
    background-color: #007bff;
    color: white;
    border: none;
    border-radius: 4px;
    padding: 10px 20px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: background-color 0.2s;
}

.btn-primary:hover:not(:disabled) {
    background-color: #0056b3;
}

.btn-primary:disabled {
    background-color: #6c757d;
    cursor: not-allowed;
    opacity: 0.6;
}

.icon-btn i.fa-robot {
    color: #9c27b0;
}

.icon-btn:hover i.fa-robot {
    color: #7b1fa2;
}

/* Индикатор загрузки для чат-бота */
.chatbot-loading {
    background-color: #f0f0f0 !important;
}

.chatbot-loading .loading-content {
    display: flex;
    align-items: center;
    gap: 12px;
}

.chatbot-loading .loading-spinner {
    width: 20px;
    height: 20px;
    border: 3px solid #e0e0e0;
    border-top: 3px solid #007bff;
    border-radius: 50%;
    animation: chatbot-spin 1s linear infinite;
}

.chatbot-loading .loading-text {
    color: #666;
    font-style: italic;
}

.app-topbar__stars-pill {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 8px;
    border-radius: 999px;
    border: 1px solid #f3d27b;
    background: #fff8df;
    color: #7a4e00;
    font-size: 13px;
    font-weight: 700;
    cursor: help;
    white-space: nowrap;
}

.app-topbar__stars-icon {
    font-size: 12px;
    line-height: 1;
}

.app-topbar__avatar-link {
    flex-shrink: 0;
}

@keyframes chatbot-spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

@media (max-width: 768px) {
    .app-topbar {
        padding: 8px 8px !important;
    }

    .app-topbar__inner {
        min-width: 0;
        align-items: center !important;
        gap: 4px;
    }

    .app-topbar__right {
        flex-shrink: 1;
        min-width: 0;
        gap: 6px !important;
    }

    .app-topbar__logout {
        white-space: nowrap;
    }
    .app-topbar__stars-pill {
        font-size: 12px;
        padding: 3px 7px;
    }

    .pdf-item-layout {
        grid-template-columns: minmax(0, 1fr);
        row-gap: 10px;
    }

    .pdf-background-rect {
        width: min(180px, 45%);
        margin-top: 0;
    }

    .pdf-main-content {
        min-width: 0;
    }

    .pdf-header {
        min-width: 0;
    }

    .pdf-actions {
        flex-wrap: wrap;
        min-width: 0;
    }
}