/* ======== СТИЛИ ДЛЯ ОНЛАЙН ДОСКИ ======== */

/* Верхняя панель с выбором комнаты */
.room-panel {
    display: flex;
    flex-direction: column;
    padding: 12px 20px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 15px;
    margin: 0 auto 15px;
    max-width: 800px;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
}

.room-panel-row {
    display: flex;
    align-items: center;
    width: 100%;
}

.room-code-row {
    text-align: center;
    margin-top: 5px;
}

.room-select-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    padding: 0;
    background: rgba(255, 255, 255, 0.2);
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 10px;
    color: white;
    cursor: pointer;
    transition: all 0.3s ease;
    flex-shrink: 0;
}

.room-select-btn:hover {
    background: rgba(255, 255, 255, 0.3);
    border-color: rgba(255, 255, 255, 0.5);
    transform: translateY(-2px);
}

.room-select-btn svg {
    width: 22px;
    height: 22px;
}

.room-info {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    flex: 1;
    margin-right: 44px; /* Компенсация ширины кнопки для центрирования */
}

.room-label {
    font-size: 14px;
    color: rgba(255, 255, 255, 0.8);
    white-space: nowrap;
}

.room-name {
    font-size: 18px;
    font-weight: 700;
    color: white;
}

.room-code {
    font-size: 14px;
    color: rgba(255, 255, 255, 0.9);
    font-family: 'Courier New', monospace;
    letter-spacing: 2px;
}

.room-user-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 6px;
}

.room-username,
.room-topic {
    font-size: 14px !important;
    font-weight: 700 !important;
    color: #fff !important;
    font-style: normal !important;
}

@media (max-width: 768px) {
    .room-username,
    .room-topic {
        font-size: 15px;
    }
}


/* Панель темы и задачи */
.theme-panel {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 30px;
    padding: 10px 20px;
    background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
    border-radius: 10px;
    margin: 0 auto 15px;
    max-width: 600px;
    box-shadow: 0 2px 10px rgba(79, 172, 254, 0.3);
}

.theme-info,
.puzzle-info {
    display: flex;
    align-items: center;
    gap: 8px;
}

.theme-label,
.puzzle-label {
    font-size: 13px;
    color: rgba(255, 255, 255, 0.8);
    font-weight: 500;
}

.theme-name {
    font-size: 16px;
    font-weight: 700;
    color: white;
}

.puzzle-number {
    font-size: 16px;
    font-weight: 700;
    color: white;
    background: rgba(255, 255, 255, 0.2);
    padding: 2px 10px;
    border-radius: 12px;
}

@media (max-width: 768px) {
    .theme-panel {
        flex-direction: column;
        gap: 8px;
        padding: 10px 15px;
    }

    .theme-name {
        font-size: 14px;
    }

    .puzzle-number {
        font-size: 14px;
    }
}

/* Индикатор подключения */
.connection-indicator {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    margin-left: 10px;
    transition: background-color 0.3s;
}

.connection-indicator.status-online {
    background-color: #4CAF50;
    box-shadow: 0 0 8px #4CAF50;
}

.connection-indicator.status-offline {
    background-color: #f44336;
    box-shadow: 0 0 8px #f44336;
}

/* Индикаторы режимов */
.status-indicators {
    display: flex;
    justify-content: center;
    gap: 15px;
    margin-top: 8px;
    flex-wrap: wrap;
}

.status-indicator {
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 4px 12px;
    border-radius: 15px;
    font-size: 12px;
    font-weight: 600;
    animation: pulse 2s infinite;
}

.demo-indicator {
    background: linear-gradient(135deg, #ff6b6b 0%, #ff8e8e 100%);
    color: white;
}

.lock-indicator {
    background: linear-gradient(135deg, #ffa726 0%, #ffcc80 100%);
    color: white;
}

.game-indicator {
    background: linear-gradient(135deg, #66bb6a 0%, #a5d6a7 100%);
    color: white;
}

.indicator-icon {
    font-size: 14px;
}

.indicator-text {
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}

/* Модальное окно выбора комнаты */
.room-modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    z-index: 1000;
    justify-content: center;
    align-items: center;
    backdrop-filter: blur(5px);
}

.room-modal-overlay.active {
    display: flex;
}

.room-modal {
    background: white;
    border-radius: 20px;
    width: 90%;
    max-width: 500px;
    max-height: 80vh;
    overflow: hidden;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    animation: modalSlideIn 0.3s ease;
}

@keyframes modalSlideIn {
    from {
        transform: translateY(-50px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.room-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 25px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.room-modal-header h3 {
    margin: 0;
    font-size: 20px;
    font-weight: 600;
}

.room-modal-close {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.3s;
}

.room-modal-close:hover {
    background: rgba(255, 255, 255, 0.3);
}

.room-modal-body {
    padding: 20px 25px;
    overflow-y: auto;
    max-height: calc(80vh - 160px);
}

/* Ввод кода комнаты */
.room-code-input-section {
    margin-bottom: 25px;
}

.room-code-input-section label {
    display: block;
    font-size: 14px;
    font-weight: 600;
    color: #333;
    margin-bottom: 10px;
}

.room-code-input-wrapper {
    display: flex;
    gap: 10px;
}

.room-code-input {
    flex: 1;
    padding: 12px 15px;
    border: 2px solid #e0e0e0;
    border-radius: 10px;
    font-size: 18px;
    font-family: 'Courier New', monospace;
    letter-spacing: 2px;
    text-align: center;
    transition: border-color 0.3s;
}

.room-code-input:focus {
    outline: none;
    border-color: #667eea;
}

.room-code-input::placeholder {
    letter-spacing: 1px;
    color: #aaa;
}

.room-join-btn {
    padding: 12px 20px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border: none;
    border-radius: 10px;
    color: white;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.3s, box-shadow 0.3s;
}

.room-join-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

/* Секции списков комнат */
.room-section {
    margin-bottom: 20px;
}

.room-section-title {
    font-size: 14px;
    font-weight: 600;
    color: #666;
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 2px solid #f0f0f0;
    display: flex;
    align-items: center;
    gap: 8px;
}

.room-section-title svg {
    width: 18px;
    height: 18px;
    color: #667eea;
}

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

.room-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 15px;
    background: #f8f9fa;
    border: 2px solid transparent;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.room-item:hover {
    background: #e9ecef;
    border-color: #667eea;
    transform: translateX(5px);
}

.room-item-info {
    display: flex;
    flex-direction: column;
}

.room-item-name {
    font-weight: 600;
    color: #333;
    font-size: 15px;
}

.room-item-code {
    font-size: 13px;
    color: #666;
    font-family: 'Courier New', monospace;
}

.room-item-type {
    font-size: 12px;
    padding: 4px 10px;
    border-radius: 20px;
    background: #667eea;
    color: white;
}

.room-item-type.club {
    background: #28a745;
}

.room-item-type.group {
    background: #fd7e14;
}

.room-empty-message {
    text-align: center;
    color: #999;
    padding: 20px;
    font-style: italic;
}

/* Кнопка "Заново" над доской */
.board-controls {
    display: flex;
    justify-content: center;
    gap: 15px;
    margin-bottom: 15px;
    max-width: 800px;
    margin-left: auto;
    margin-right: auto;
}

.board-control-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border: 2px solid #dee2e6;
    border-radius: 10px;
    color: #495057;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.board-control-btn:hover {
    background: linear-gradient(135deg, #e9ecef 0%, #dee2e6 100%);
    border-color: #adb5bd;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.board-control-btn img {
    width: 20px;
    height: 20px;
}

/* Секция шахматной доски */
#sec-chess-board {
    padding: 10px 0;
}

#sec-chess-board .u-sheet {
    width: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
}

/* Доска */
#board {
    width: min(60vh, 90vw, 800px);
    height: min(60vh, 90vw, 800px);
    margin: 0 auto;
    position: relative;
}

/* Блок шахматной доски */
.chess-board-header {
    background: linear-gradient(135deg, #f1f3f4 0%, #e8eaed 100%);
    border: 2px solid #dadce0;
    border-radius: 20px;
    padding: clamp(15px, 3vw, 20px) clamp(20px, 4vw, 30px);
    margin: 0 auto;
    max-width: 850px;
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.08);
    position: relative;
    overflow: visible;
}

.chess-board-header::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, #5f6368 0%, #9aa0a6 50%, #5f6368 100%);
}

/* Общий контейнер для элементов доски */
.chess-layout {
    display: grid;
    grid-template-columns: 1fr 1fr;
    grid-template-rows: 35px 1fr 35px;
    gap: 8px;
    position: relative;
    z-index: 1;
    padding: 15px 0;
}

/* Верхняя и нижняя панели */
.top-panel, .bottom-panel {
    display: flex;
    align-items: center;
}

.turn-indicator-cell {
    justify-content: flex-start;
}

.extra-pieces-top-cell,
.extra-pieces-bottom-cell {
    justify-content: flex-end;
}

.moves-counter-cell {
    justify-content: flex-start;
}

/* Контейнер доски */
.board-container {
    grid-column: 1 / -1;
    display: flex;
    justify-content: center;
    align-items: center;
}

/* Индикатор хода */
.turn-indicator {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 5px 10px;
    background-color: transparent;
    border-radius: 8px;
}

.turn-indicator img {
    width: 24px;
    height: 24px;
    margin-right: 10px;
}

.turn-indicator span {
    font-weight: bold;
    font-size: 16px;
}

/* Счетчик ходов */
.moves-counter {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 5px 10px;
    font-weight: bold;
    background-color: transparent;
    border-radius: 8px;
}

/* Лишние фигуры */
.extra-pieces {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 3px;
    padding: 3px 8px;
    background-color: transparent;
    border-radius: 8px;
}

.extra-piece-span {
    display: block;
    cursor: help;
    transition: transform 0.2s ease;
}

.extra-piece-span:hover {
    transform: scale(1.2);
}

.extra-pieces img.extra-piece-svg,
.extra-pieces svg {
    width: 20px;
    height: 20px;
    margin: 0 2px;
    cursor: help;
    transition: transform 0.2s ease;
    vertical-align: middle;
}

/* Кнопка поворота доски */
.buttons-container {
    display: flex;
    justify-content: center;
    gap: 15px;
    max-width: 800px;
    margin: 15px auto;
}

.rotate-button .u-btn {
    padding: 8px 18px;
    font-size: 14px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.rotate-button .u-btn img {
    width: 18px;
    height: 18px;
}

/* История ходов */
#sec-MovesPuzzle {
    padding: 10px 0;
}

.moves-history {
    background: #f8f9fa;
    border: 2px solid #e9ecef;
    border-radius: 10px;
    padding: 15px 20px;
    max-width: 800px;
    margin: 0 auto;
    font-family: 'Courier New', monospace;
    min-height: 40px;
    line-height: 1.8;
}

/* Индикатор загрузки */
.loading-indicator {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px;
    font-size: 16px;
    color: #666;
}

.loading-spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #3498db;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 20px;
}

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

/* Адаптивность для мобильных */
@media (max-width: 768px) {
    .room-panel {
        padding: 12px 15px;
        margin-left: -10px;
        margin-right: -10px;
        border-radius: 0;
    }

    .room-panel-row {
        gap: 12px;
    }

    .room-select-btn {
        width: 40px;
        height: 40px;
    }

    .room-select-btn svg {
        width: 20px;
        height: 20px;
    }

    .room-info {
        flex-direction: row;
        flex-wrap: wrap;
        gap: 5px;
    }

    .room-label {
        font-size: 13px;
    }

    .room-name {
        font-size: 16px;
    }

    .room-code {
        font-size: 13px;
    }

    .room-modal {
        width: 95%;
        max-height: 90vh;
    }

    .room-code-input-wrapper {
        flex-direction: column;
    }

    .board-controls {
        flex-wrap: wrap;
        padding: 0 10px;
    }

    .chess-board-header {
        margin-left: -10px;
        margin-right: -10px;
        border-radius: 0;
        padding: 10px 15px 15px;
    }

    .chess-layout {
        padding: 10px 0;
        grid-template-rows: 30px 1fr 30px;
        gap: 5px;
    }

    .buttons-container {
        flex-wrap: wrap;
        padding: 0 10px;
    }

    .rotate-button .u-btn .u-btn-text {
        display: none;
    }

    .rotate-button .u-btn {
        padding: 10px 14px;
    }
}

@media (max-width: 480px) {
    .room-modal-header {
        padding: 15px 20px;
    }

    .room-modal-body {
        padding: 15px 20px;
    }

    .room-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }

    .room-item-type {
        align-self: flex-start;
    }
}

/* Индикатор режима ходов */
#movesModeIndicator {
    position: fixed;
    top: 120px;
    right: 20px;
    background: rgba(74, 144, 217, 0.95);
    color: white;
    padding: 8px 15px;
    border-radius: 20px;
    font-size: 14px;
    font-weight: 500;
    z-index: 1000;
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
    display: flex;
    align-items: center;
    gap: 8px;
}

#movesModeIndicator .mode-icon {
    font-size: 16px;
}

#movesModeIndicator .mode-text {
    white-space: nowrap;
}

/* Прогресс-бар для кнопки "Заново" */
.reset-progress {
    position: absolute;
    bottom: 0;
    left: 0;
    height: 3px;
    background: linear-gradient(90deg, #4caf50 0%, #66bb6a 100%);
    border-radius: 0 0 8px 8px;
    animation: fillProgress 1s linear forwards;
    z-index: 1;
}

@keyframes fillProgress {
    from { width: 0%; }
    to { width: 100%; }
}

/* В WBChess/css/board.css */

.move-processing-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    backdrop-filter: blur(2px);
}

.move-processing-overlay .spinner {
    width: 50px;
    height: 50px;
    border: 4px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

.move-processing-overlay .text {
    color: white;
    margin-top: 20px;
    font-size: 16px;
    font-weight: 500;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}


.move-processing-bar {
    width: 100%;
    margin-top: 10px;
    padding: 20px;
    background: rgba(115, 163, 222, 0.1);
    border-radius: 8px;
    text-align: center;
    transition: opacity 0.2s;
}

.thinking-piece {
    position: relative;
    display: inline-block;
    margin-bottom: 10px;
}

.piece-icon {
    width: 48px;
    height: 48px;
    filter: drop-shadow(0 2px 4px rgba(0,0,0,0.2));
    animation: pieceThink 2s ease-in-out infinite;
}

@keyframes pieceThink {
    0%, 100% {
        transform: rotate(-5deg);
    }
    50% {
        transform: rotate(5deg);
    }
}

.thought-bubble {
    position: absolute;
    top: -15px;
    right: -30px;
    background: white;
    border: 2px solid #73a3de;
    border-radius: 20px;
    padding: 8px 12px;
    display: flex;
    gap: 4px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    animation: bubbleFloat 2s ease-in-out infinite;
}

@keyframes bubbleFloat {
    0%, 100% {
        transform: translateY(0px);
    }
    50% {
        transform: translateY(-3px);
    }
}

.thought-bubble::before {
    content: '';
    position: absolute;
    bottom: -8px;
    left: 20px;
    width: 12px;
    height: 12px;
    background: white;
    border-right: 2px solid #73a3de;
    border-bottom: 2px solid #73a3de;
    transform: rotate(45deg);
}

.thought-bubble .dot {
    width: 6px;
    height: 6px;
    background: #73a3de;
    border-radius: 50%;
    animation: dotPulse 1.4s infinite;
}

.thought-bubble .dot:nth-child(1) { animation-delay: 0s; }
.thought-bubble .dot:nth-child(2) { animation-delay: 0.2s; }
.thought-bubble .dot:nth-child(3) { animation-delay: 0.4s; }

@keyframes dotPulse {
    0%, 80%, 100% {
        transform: scale(0.8);
        opacity: 0.5;
    }
    40% {
        transform: scale(1.3);
        opacity: 1;
    }
}

.progress-text {
    font-size: 14px;
    color: #73a3de;
    font-weight: 500;
    margin-top: 5px;
}

/* ======== ПАНЕЛЬ ЗАВЕРШЕНИЯ ЗАДАЧИ ======== */
.completion-panel {
    position: fixed;
    bottom: -200px;
    left: 50%;
    transform: translateX(-50%);
    background-color: rgba(255, 255, 255, 0.95);
    border-radius: 15px 15px 0 0;
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.25);
    padding: 20px 30px;
    text-align: center;
    z-index: 1001;
    transition: bottom 0.5s ease-in-out;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    max-width: 500px;
    width: 90%;
}

.completion-panel.visible {
    bottom: 0;
}

.completion-panel img {
    width: 48px;
    height: 48px;
    margin-bottom: 10px;
}

.completion-panel .close-button {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 24px;
    height: 24px;
    background: none;
    border: none;
    cursor: pointer;
    font-size: 20px;
    color: #555;
}

/* Overlay фон */
.message-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.3);
    z-index: 1000;
    opacity: 0;
    transition: opacity 0.3s ease-in-out;
    pointer-events: none;
}

.message-overlay.visible {
    opacity: 1;
    pointer-events: auto;
}

/* Сообщения результата */
.win-message { color: #2ecc71; font-size: 24px; font-weight: bold; }
.draw-message { color: #3498db; font-size: 24px; font-weight: bold; }
.lose-message { color: #e74c3c; font-size: 24px; font-weight: bold; }

/* Кнопки на панели */
.panel-buttons {
    display: flex;
    gap: 10px;
    margin-top: 10px;
    justify-content: center;
}

.retry-puzzle-btn {
    display: inline-block;
    padding: 10px 20px;
    background-color: #2196F3;
    color: white;
    text-decoration: none;
    border-radius: 5px;
    font-weight: bold;
    margin-top: 15px;
    transition: all 0.3s ease;
}

.retry-puzzle-btn:hover {
    background-color: #0b7dda;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.2);
}

/* Причина результата */
.result-reason {
    font-size: 0.85em;
    opacity: 0.8;
    margin-top: 4px;
}

.name-setup-modal {
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background: rgba(0,0,0,0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
}

.name-setup-content {
    background: white;
    padding: 30px;
    border-radius: 12px;
    max-width: 450px;
    width: 90%;
    text-align: center;
    position: relative;
    box-shadow: 0 10px 40px rgba(0,0,0,0.3);
}

.name-setup-close {
    position: absolute;
    top: 10px;
    right: 10px;
    background: none;
    border: none;
    font-size: 32px;
    line-height: 1;
    color: #999;
    cursor: pointer;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    transition: all 0.2s;
}

.name-setup-close:hover {
    background: #f0f0f0;
    color: #333;
}

.name-setup-content h2 {
    margin: 0 0 20px;
    font-size: 24px;
    color: #333;
}

.current-name-display {
    font-size: 28px;
    margin: 15px 0;
    font-weight: bold;
    color: #555;
}

.name-base {
    color: #666;
}

.name-digits {
    color: #4CAF50;
    font-size: 36px;
}

.name-setup-hint {
    font-size: 14px;
    color: #777;
    margin: 10px 0 20px;
}

.name-setup-input {
    width: 100%;
    padding: 12px;
    font-size: 18px;
    margin: 20px 0;
    border: 2px solid #ddd;
    border-radius: 6px;
    box-sizing: border-box;
}

.name-setup-input:focus {
    outline: none;
    border-color: #4CAF50;
}

.name-setup-buttons {
    display: flex;
    gap: 10px;
    justify-content: center;
}

.name-setup-btn {
    padding: 12px 30px;
    font-size: 18px;
    background: #4CAF50;
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.2s;
}

.name-setup-btn:hover {
    background: #45a049;
}


/* ======== ФИКСИРОВАННЫЕ КНОПКИ ======== */
#fixedActionButtons {
    position: fixed;
    bottom: 24px;
    right: 24px;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 10px;
    z-index: 500;
}

.fab-btn {
    width: 52px;
    height: 52px;
    border-radius: 50%;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.25);
    transition: transform 0.2s, box-shadow 0.2s;
    text-decoration: none;
}

.fab-btn:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 16px rgba(0,0,0,0.35);
}

.fab-attention {
    background: #ff5722;
    color: white;
    width: 60px;
    height: 60px;
    font-size: 24px;
}

.fab-attention.active {
    animation: fabPulse 1s ease-in-out 3;
}

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

.fab-sound {
    background: #607d8b;
    color: white;
}

.fab-sound.muted {
    background: #455a64;
}

.fab-club {
    background: #4caf50;
    color: white;
}

.fab-menu {
    display: none;
    flex-direction: column;
    gap: 8px;
    align-items: flex-end;
}

.fab-menu.open {
    display: flex;
}

.fab-menu-item {
    background: white;
    border: none;
    border-radius: 24px;
    padding: 10px 18px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    box-shadow: 0 3px 10px rgba(0,0,0,0.2);
    white-space: nowrap;
    transition: background 0.2s, transform 0.2s;
}

.fab-menu-item:hover {
    background: #f5f5f5;
    transform: scale(1.03);
}

@media (max-width: 768px) {
    #fixedActionButtons {
        bottom: 16px;
        right: 16px;
    }
    .fab-btn {
        width: 46px;
        height: 46px;
        font-size: 18px;
    }
    .fab-attention {
        width: 54px;
        height: 54px;
        font-size: 22px;
    }
}

/* Панель комнаты в состоянии "вне комнаты" (после кика или выхода) */
.room-panel--offline {
    background: linear-gradient(135deg, #9e9e9e 0%, #757575 100%) !important;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.15) !important;
}

.room-panel--offline .room-name {
    color: rgba(255, 255, 255, 0.6);
    font-style: italic;
}

.room-panel--offline .room-code {
    color: rgba(255, 255, 255, 0.4);
    letter-spacing: 4px;
}

.room-panel--offline .room-select-btn {
    animation: pulse-btn 2s ease-in-out infinite;
}

@keyframes pulse-btn {
    0%, 100% { background: rgba(255, 255, 255, 0.2); }
    50% { background: rgba(255, 255, 255, 0.4); }
}

/* ======== ГОЛОС И ВИДЕО ПАНЕЛЬ ======== */

/* Обёртка доска + голос */
.board-with-voice {
    display: flex;
    flex-direction: row;
    align-items: flex-start;
    gap: 16px;
    max-width: 1200px;
    margin: 0 auto;
}

.board-with-voice .chess-board-header {
    flex: 0 0 auto;
    margin: 0;
    max-width: none;
}

/* Голосовая панель — справа от доски у ученика */
.voice-panel {
    flex: 0 0 200px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    min-height: 200px;
}

/* Кнопки управления */
.voice-controls {
    display: flex;
    flex-direction: column;
    gap: 8px;
    align-items: center;
}

.voice-active-controls {
    display: flex;
    flex-direction: column;
    gap: 8px;
    align-items: center;
    width: 100%;
}

.voice-btn {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    background: #e0e0e0;
    color: #333;
    transition: all 0.2s;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}

.voice-btn:hover {
    transform: scale(1.08);
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
}

.voice-btn--active {
    background: #4caf50;
    color: white;
}

.voice-btn--muted {
    background: #f44336;
    color: white;
}

/* Сетка видео */
.voice-video-grid {
    display: flex;
    flex-direction: column;
    gap: 8px;
    flex: 1;
    overflow-y: auto;
    max-height: 600px;
}

/* Тайл участника */
.voice-tile {
    position: relative;
    background: #1a1a2e;
    border-radius: 10px;
    overflow: hidden;
    aspect-ratio: 4/3;
    border: 2px solid transparent;
    transition: border-color 0.2s;
}

.voice-tile.speaking {
    border-color: #4caf50;
    box-shadow: 0 0 8px rgba(76, 175, 80, 0.5);
}

.voice-tile video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

/* Аватар когда камера выключена */
.voice-tile__avatar {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 32px;
    color: rgba(255,255,255,0.4);
    background: #1a1a2e;
    /* Показываем когда нет видео */
}

.voice-tile video:not([srcObject]) ~ .voice-tile__avatar,
.voice-tile video[srcObject=""] ~ .voice-tile__avatar {
    display: flex;
}

/* Имя участника */
.voice-tile__name {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 4px 8px;
    font-size: 11px;
    font-weight: 600;
    color: white;
    background: linear-gradient(transparent, rgba(0,0,0,0.7));
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Иконка выключенного микрофона */
.voice-tile__mic-off {
    position: absolute;
    top: 6px;
    right: 6px;
    color: #f44336;
    font-size: 12px;
    display: none;
}

.voice-tile.mic-muted .voice-tile__mic-off {
    display: block;
}

/* ======== МОБИЛЬНЫЕ — только звук, видео скрыто ======== */
@media (max-width: 768px) {
    .board-with-voice {
        flex-direction: column;
        align-items: center;
    }

    .voice-panel {
        flex: none;
        width: 100%;
        max-width: 500px;
        min-height: auto;
    }

    /* Видео сетка скрыта на мобильных */
    .voice-video-grid {
        display: none;
    }

    /* Кнопки горизонтально */
    .voice-controls {
        flex-direction: row;
        justify-content: center;
    }

    .voice-active-controls {
        flex-direction: row;
        width: auto;
    }
}

/* ======== ТАЙЛЫ ГОЛОСА ======== */

.vt-mode-menu {
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 8px;
    box-shadow: 0 4px 16px rgba(0,0,0,0.15);
    overflow: hidden;
    min-width: 170px;
}
.vt-mode-menu__item {
    display: block;
    width: 100%;
    padding: 8px 14px;
    border: none;
    background: none;
    text-align: left;
    cursor: pointer;
    font-size: 13px;
    color: #333;
}
.vt-mode-menu__item:hover { background: #f5f5f5; }
.vt-mode-menu__item.active { background: #e8f4ff; font-weight: 600; }

.voice-tile__controls {
    position: absolute;
    bottom: 22px;
    left: 0;
    right: 0;
    display: flex;
    justify-content: center;
    gap: 4px;
    opacity: 0;
    transition: opacity 0.2s;
}
.voice-tile:hover .voice-tile__controls { opacity: 1; }

.vt-btn {
    width: 26px;
    height: 26px;
    border-radius: 50%;
    border: none;
    background: rgba(0,0,0,0.6);
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    flex-shrink: 0;
}
.vt-btn:hover { background: rgba(0,0,0,0.85); }
.vt-btn.voice-btn--muted { background: rgba(244,67,54,0.8); }

.voice-tile__indicators {
    position: absolute;
    top: 4px;
    right: 4px;
    display: flex;
    gap: 2px;
    font-size: 12px;
}

/* ======== ЧАТ ======== */

.room-chat-panel {
    background: #f8f9fa;
    border-top: 1px solid #e0e0e0;
    display: flex;
    flex-direction: column;
    max-height: 260px;
    flex-shrink: 0;
}
.room-chat-header {
    display: flex;
    align-items: center;
    padding: 8px 12px;
    cursor: pointer;
    user-select: none;
    background: #f1f3f4;
    border-bottom: 1px solid #e0e0e0;
    gap: 8px;
}
.room-chat-title { flex: 1; font-size: 13px; font-weight: 600; color: #555; }
.room-chat-badge {
    background: #e53935;
    color: white;
    border-radius: 10px;
    font-size: 11px;
    padding: 1px 6px;
}
.room-chat-collapse-btn { background: none; border: none; cursor: pointer; color: #777; padding: 0; }
.room-chat-body { display: flex; flex-direction: column; flex: 1; overflow: hidden; }
.room-chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 8px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.room-chat-msg { font-size: 12px; line-height: 1.4; }
.room-chat-msg__name { font-weight: 600; color: #1565c0; margin-right: 4px; }
.room-chat-input-row {
    display: flex;
    gap: 6px;
    padding: 6px 8px;
    border-top: 1px solid #e0e0e0;
}
.room-chat-input {
    flex: 1;
    border: 1px solid #ddd;
    border-radius: 16px;
    padding: 4px 10px;
    font-size: 12px;
    outline: none;
}
.room-chat-input:focus { border-color: #1976d2; }
.room-chat-send-btn {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    border: none;
    background: #1976d2;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    flex-shrink: 0;
}

/* Вкладки голос/чат (доска ученика) */
.voice-tabs {
    display: flex;
    border-bottom: 1px solid #e0e0e0;
    flex-shrink: 0;
}
.voice-tab {
    flex: 1;
    padding: 6px 8px;
    border: none;
    background: none;
    cursor: pointer;
    font-size: 12px;
    color: #777;
    border-bottom: 2px solid transparent;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
}
.voice-tab.active { color: #1976d2; border-bottom-color: #1976d2; }
.voice-chat-badge {
    background: #e53935;
    color: white;
    border-radius: 8px;
    font-size: 10px;
    padding: 0 4px;
    line-height: 1.4;
}
.voice-tab-content {
    flex: 1;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}
.voice-chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 6px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.chat-msg { font-size: 12px; line-height: 1.4; }
.chat-msg--own .chat-msg__name { color: #2e7d32; }
.chat-msg__name { font-weight: 600; color: #1565c0; margin-right: 4px; }
.voice-chat-input-row {
    display: flex;
    gap: 4px;
    padding: 6px;
    border-top: 1px solid #e0e0e0;
    flex-shrink: 0;
}
.voice-chat-input {
    flex: 1;
    border: 1px solid #ddd;
    border-radius: 14px;
    padding: 3px 8px;
    font-size: 12px;
    outline: none;
}
.voice-chat-input:focus { border-color: #1976d2; }
.voice-chat-send-btn {
    width: 26px;
    height: 26px;
    border-radius: 50%;
    border: none;
    background: #1976d2;
    color: white;
    cursor: pointer;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
}

/* Плашка последнего сообщения (мобильный) */
.chat-last-message-bar {
    background: #e3f2fd;
    border-top: 1px solid #bbdefb;
    padding: 6px 12px;
    font-size: 12px;
    color: #333;
    cursor: pointer;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    transition: background 0.4s;
}
.chat-last-message-bar--new { background: #fff9c4; }

/* FAB кнопка чата */
.fab-chat { position: relative; }
.fab-chat-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    background: #e53935;
    color: white;
    border-radius: 8px;
    font-size: 10px;
    padding: 0 4px;
    pointer-events: none;
    line-height: 1.5;
}

/* Оверлей чата (мобильный) */
.chat-overlay {
    position: fixed;
    inset: 0;
    z-index: 1000;
    background: white;
    display: flex;
    flex-direction: column;
}
.chat-overlay-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    background: #1976d2;
    color: white;
    font-weight: 600;
    font-size: 15px;
    flex-shrink: 0;
}
.chat-overlay-close {
    background: none;
    border: none;
    color: white;
    font-size: 20px;
    cursor: pointer;
    padding: 0;
}
.chat-overlay-messages {
    flex: 1;
    overflow-y: auto;
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.chat-overlay-input-row {
    display: flex;
    gap: 8px;
    padding: 10px 12px;
    border-top: 1px solid #e0e0e0;
    flex-shrink: 0;
}
.chat-overlay-input {
    flex: 1;
    border: 1px solid #ddd;
    border-radius: 20px;
    padding: 8px 14px;
    font-size: 14px;
    outline: none;
}
.chat-overlay-input:focus { border-color: #1976d2; }
.chat-overlay-send-btn {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    border: none;
    background: #1976d2;
    color: white;
    cursor: pointer;
    font-size: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

/* ======== МОБИЛЬНЫЙ ЭКРАН КАМЕРЫ УЧИТЕЛЯ ======== */

#mobileCameraView {
    position: fixed;
    inset: 0;
    z-index: 900;
    display: flex;
    flex-direction: column;
    background: #000;
}

#mobileCameraVideoContainer {
    flex: 0 0 60%;
    background: #1a1a2e;
    position: relative;
    overflow: hidden;
}

#mobileCameraVideoContainer video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.mobile-camera-avatar {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 64px;
    color: rgba(255,255,255,0.3);
}

#mobileCameraBackBtn {
    position: absolute;
    top: 12px;
    left: 12px;
    background: rgba(0,0,0,0.6);
    color: white;
    border: none;
    border-radius: 20px;
    padding: 6px 14px;
    font-size: 13px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    z-index: 10;
}

#mobileCameraBackBtn:hover {
    background: rgba(0,0,0,0.8);
}

#mobileCameraChat {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: white;
    min-height: 0;
}

.fab-camera {
    background: #1976d2;
    color: white;
}

.fab-camera:hover {
    background: #1565c0;
}

/* Скрываем .voice-panel на мобиле/планшете — голос через панель под доской */
@media (max-width: 1024px) {
    .voice-panel {
        display: none !important;
    }
    /* FAB скрыт на мобиле/планшете */
    #fixedActionButtons {
        display: none !important;
    }
}

/* Кнопка "Загрузить ещё" в чате */
.chat-load-more {
    display: block;
    width: 100%;
    padding: 6px;
    background: #f0f7ff;
    border: 1px solid #bbdefb;
    border-radius: 4px;
    color: #1976d2;
    font-size: 12px;
    cursor: pointer;
    text-align: center;
    transition: background 0.2s;
    margin-bottom: 4px;
}

.chat-load-more:hover {
    background: #e3f2fd;
}

/* ======== КНОПКА ЗВУКА В ЗАГОЛОВКЕ ======== */
.room-sound-btn {
    background: rgba(255,255,255,0.2);
    border: none;
    border-radius: 50%;
    width: 28px;
    height: 28px;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    transition: background 0.2s;
    flex-shrink: 0;
}
.room-sound-btn:hover { background: rgba(255,255,255,0.35); }
.room-sound-btn.muted { background: rgba(255,255,255,0.1); opacity: 0.6; }

/* ======== ПАНЕЛЬ ДЕЙСТВИЙ УЧЕНИКА ======== */
#sec-student-panel {
    padding: 8px 0;
}

.student-action-panel {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 12px;
    padding: 10px 16px;
    background: #f1f3f4;
    border: 2px solid #dadce0;
    border-radius: 40px;
    max-width: 400px;
    margin: 0 auto;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    position: relative;
}

/* Скрыта на десктопе */
@media (min-width: 1025px) {
    #sec-student-panel {
        display: none;
    }
}

.sap-btn {
    width: 52px;
    height: 52px;
    border-radius: 50%;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    transition: all 0.2s;
    box-shadow: 0 2px 6px rgba(0,0,0,0.15);
    position: relative;
    flex-shrink: 0;
}
.sap-btn:hover { transform: scale(1.08); box-shadow: 0 4px 10px rgba(0,0,0,0.2); }
.sap-btn:active { transform: scale(0.96); }

/* Звонок */
.sap-btn--call {
    background: #4caf50;
    color: white;
    width: 58px;
    height: 58px;
    font-size: 22px;
}
.sap-btn--call.connected {
    background: #f44336;
}

/* Микрофон */
.sap-btn--mic {
    background: #e0e0e0;
    color: #555;
}
.sap-btn--mic.active { background: #2196f3; color: white; }
.sap-btn--mic.muted  { background: #f44336; color: white; }

/* Камера */
.sap-btn--cam {
    background: #e0e0e0;
    color: #555;
}
.sap-btn--cam.active { background: #2196f3; color: white; }
.sap-btn--cam.muted  { background: #f44336; color: white; }

/* Внимание */
.sap-btn--attention {
    background: #ff5722;
    color: white;
}
.sap-btn--attention.open { background: #e64a19; }

/* Чат */
.sap-btn--chat {
    background: #607d8b;
    color: white;
}

/* Бейдж */
.sap-badge {
    position: absolute;
    top: -3px;
    right: -3px;
    background: #e53935;
    color: white;
    border-radius: 8px;
    font-size: 10px;
    padding: 1px 5px;
    pointer-events: none;
    line-height: 1.5;
}

/* Меню внимания под панелью */
.sap-attention-menu {
    display: none;
    flex-direction: column;
    gap: 6px;
    align-items: center;
    margin-bottom: 8px;
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    z-index: 100;
}

.sap-attention-menu.open { display: flex; }
.sap-menu-item {
    background: white;
    border: none;
    border-radius: 20px;
    padding: 8px 16px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
    white-space: nowrap;
    transition: background 0.2s;
}
.sap-menu-item:hover { background: #f5f5f5; }

/* ======== МОБИЛЬНЫЙ ВИДЕОСЛАЙДЕР ======== */

.mobile-video-slider {
    position: relative;
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 0 4px;
    max-width: 500px;
    margin: 0 auto;
}

.mvs-viewport {
    flex: 1;
    overflow: hidden;
    border-radius: 10px;
}

.mvs-track {
    display: flex;
    transition: transform 0.3s ease;
}

.mvs-tile {
    flex: 0 0 100%;
    position: relative;
    aspect-ratio: 4/3;
    background: #1a1a2e;
    border-radius: 10px;
    overflow: hidden;
    border: 2px solid transparent;
}

.mvs-tile.speaking {
    border-color: #4caf50;
}

.mvs-tile video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.mvs-tile__avatar {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 40px;
    color: rgba(255,255,255,0.35);
    background: #1a1a2e;
}

.mvs-tile__name {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 4px 8px;
    font-size: 12px;
    font-weight: 600;
    color: white;
    background: linear-gradient(transparent, rgba(0,0,0,0.75));
}

.mvs-tile__equalizer {
    position: absolute;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%);
    display: none;
    gap: 2px;
    align-items: flex-end;
    height: 14px;
}

.mvs-tile.speaking .mvs-tile__equalizer {
    display: flex;
}

.mvs-tile__equalizer .eq-bar {
    width: 3px;
    background: #4caf50;
    border-radius: 2px;
    animation: eqBarAnim 0.6s ease-in-out infinite alternate;
}
.mvs-tile__equalizer .eq-bar:nth-child(1) { height: 6px;  animation-delay: 0s; }
.mvs-tile__equalizer .eq-bar:nth-child(2) { height: 12px; animation-delay: 0.1s; }
.mvs-tile__equalizer .eq-bar:nth-child(3) { height: 8px;  animation-delay: 0.2s; }

.mvs-arrow {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: none;
    background: rgba(0,0,0,0.15);
    color: #555;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    flex-shrink: 0;
    transition: background 0.2s;
}

.mvs-arrow:hover { background: rgba(0,0,0,0.25); }
.mvs-arrow:disabled { opacity: 0.3; cursor: not-allowed; }

.mvs-dots {
    position: absolute;
    bottom: 6px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 5px;
}

.mvs-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: rgba(0,0,0,0.2);
    transition: background 0.2s, transform 0.2s;
}

.mvs-dot.active {
    background: #1976d2;
    transform: scale(1.2);
}

/* ======== ПЛАШКА ГОВОРЯЩЕГО НА ДОСКЕ ======== */

.board-speaker-badge {
    position: absolute;
    top: 8px;
    left: 8px;
    display: flex;
    align-items: center;
    gap: 6px;
    background: rgba(0,0,0,0.65);
    color: white;
    padding: 4px 10px 4px 8px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    z-index: 10;
    backdrop-filter: blur(4px);
    animation: bsbFadeIn 0.3s ease;
    max-width: 200px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

@keyframes bsbFadeIn {
    from { opacity: 0; transform: translateY(-4px); }
    to   { opacity: 1; transform: translateY(0); }
}

.bsb-name {
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ======== ЭКВАЛАЙЗЕР НА ТАЙЛАХ УЧЕНИКА ======== */

.voice-tile__equalizer {
    position: absolute;
    bottom: 22px;
    left: 50%;
    transform: translateX(-50%);
    display: none;
    gap: 2px;
    align-items: flex-end;
    height: 14px;
}

.voice-tile.speaking .voice-tile__equalizer {
    display: flex;
}

.voice-tile.speaking {
    border-color: #4caf50;
    box-shadow: 0 0 0 2px rgba(76,175,80,0.4);
}

.bsb-equalizer {
    display: flex;
    align-items: flex-end;
    gap: 2px;
    height: 14px;
    flex-shrink: 0;
}

.bsb-equalizer .bsb-bar,
.voice-tile__equalizer .eq-bar {
    width: 3px;
    border-radius: 2px;
    background: #4caf50;
    animation: eqBarAnim 0.6s ease-in-out infinite alternate;
}

.bsb-equalizer .bsb-bar:nth-child(1),
.voice-tile__equalizer .eq-bar:nth-child(1) { height: 6px;  animation-delay: 0s; }
.bsb-equalizer .bsb-bar:nth-child(2),
.voice-tile__equalizer .eq-bar:nth-child(2) { height: 12px; animation-delay: 0.1s; }
.bsb-equalizer .bsb-bar:nth-child(3),
.voice-tile__equalizer .eq-bar:nth-child(3) { height: 8px;  animation-delay: 0.2s; }

@keyframes eqBarAnim {
    from { transform: scaleY(0.4); opacity: 0.7; }
    to   { transform: scaleY(1.0); opacity: 1.0; }
}

/* ======== УНИФИЦИРОВАННАЯ ПАНЕЛЬ ДЕЙСТВИЙ — ВЕЗДЕ ПОД ДОСКОЙ ======== */

/* Показываем секцию #sec-student-panel ВСЕГДА (раньше была только мобиль) */
@media (min-width: 1025px) {
    #sec-student-panel {
        display: block;
    }
}

/* Видеосетка справа — только десктоп ≥ 1280px */
.voice-video-side {
    flex: 0 0 220px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    position: relative;
    transition: flex-basis 0.3s ease, opacity 0.3s ease;
}

.voice-video-side.collapsed {
    flex: 0 0 28px;
    opacity: 0.6;
}

.voice-video-side.collapsed .voice-video-grid {
    display: none;
}

.voice-video-side-toggle {
    position: absolute;
    top: 0;
    left: -14px;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    border: 2px solid #ddd;
    background: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 6px rgba(0,0,0,0.15);
    z-index: 5;
    transition: transform 0.3s ease;
    color: #555;
    font-size: 12px;
}

.voice-video-side.collapsed .voice-video-side-toggle {
    transform: rotate(180deg);
}

/* Скрываем видеосетку справа если ширина <1280px */
@media (max-width: 1279px) {
    .voice-video-side {
        display: none !important;
    }
}

/* Пульсация трубки когда учитель в голосе, а ученик нет (пункт 1) */
.sap-btn--call.teacher-waiting {
    animation: callPulse 1.4s ease-in-out infinite;
}

@keyframes callPulse {
    0%, 100% {
        box-shadow: 0 2px 6px rgba(0,0,0,0.15), 0 0 0 0 rgba(76, 175, 80, 0.7);
    }
    50% {
        box-shadow: 0 2px 6px rgba(0,0,0,0.15), 0 0 0 12px rgba(76, 175, 80, 0);
    }
}

.sap-call-pulse-hint {
    display: block;
    margin: 0 auto 8px;
    width: fit-content;
    max-width: 90%;
    background: #4caf50;
    color: white;
    padding: 6px 14px;
    border-radius: 14px;
    font-size: 13px;
    font-weight: 600;
    text-align: center;
    box-shadow: 0 2px 8px rgba(76, 175, 80, 0.4);
    animation: callHintPulse 1.5s ease-in-out infinite;
    position: relative;
}

.sap-call-pulse-hint::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 5px solid transparent;
    border-top-color: #4caf50;
}

@keyframes callHintPulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.85; transform: scale(1.02); }
}

/* Чат-оверлей ученика (по кнопке chat в панели) */
.student-chat-overlay {
    position: fixed;
    bottom: 90px;
    right: 20px;
    width: 320px;
    height: 400px;
    background: white;
    border: 1px solid #ddd;
    border-radius: 12px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.2);
    display: flex;
    flex-direction: column;
    z-index: 600;
    overflow: hidden;
}

@media (max-width: 768px) {
    .student-chat-overlay {
        bottom: 0;
        right: 0;
        left: 0;
        top: 0;
        width: auto;
        height: auto;
        border-radius: 0;
    }
}

.student-chat-overlay .voice-chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 8px;
}

/* Скрываем СТАРУЮ .voice-panel — больше не используется у ученика */
.voice-panel {
    display: none !important;
}

/* Плашка отказа в правах доступа (пункт 5) */
.voice-permission-denied-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10001;
    backdrop-filter: blur(4px);
}

.voice-permission-denied-modal {
    background: white;
    border-radius: 16px;
    padding: 30px 28px;
    max-width: 480px;
    width: 92%;
    text-align: center;
    box-shadow: 0 20px 60px rgba(0,0,0,0.4);
}

.voice-permission-denied-icon {
    font-size: 48px;
    margin-bottom: 16px;
}

.voice-permission-denied-title {
    font-size: 22px;
    font-weight: 700;
    color: #d32f2f;
    margin-bottom: 12px;
}

.voice-permission-denied-text {
    font-size: 15px;
    color: #444;
    line-height: 1.5;
    margin-bottom: 22px;
}

.voice-permission-denied-text strong {
    color: #1976d2;
    background: #e3f2fd;
    padding: 2px 8px;
    border-radius: 4px;
    font-family: monospace;
}

.voice-permission-denied-btn {
    padding: 12px 28px;
    background: #4caf50;
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
}

.voice-permission-denied-btn:hover {
    background: #43a047;
}

/* Уведомление о потере связи с голосом (пункт 14) */
.voice-disconnected-bar {
    position: fixed;
    top: 70px;
    left: 50%;
    transform: translateX(-50%);
    background: #ff9800;
    color: white;
    padding: 10px 18px;
    border-radius: 24px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.25);
    z-index: 9999;
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 14px;
    animation: vdb-slide-in 0.3s ease;
}

@keyframes vdb-slide-in {
    from { transform: translate(-50%, -20px); opacity: 0; }
    to   { transform: translate(-50%, 0); opacity: 1; }
}

.voice-disconnected-bar button {
    background: white;
    color: #ff9800;
    border: none;
    border-radius: 16px;
    padding: 4px 12px;
    font-weight: 700;
    cursor: pointer;
    font-size: 13px;
}
