:root {
    --light: #f0d9b5;
    --dark: #b58863;
    --background: #161617;
    --selected: #63b588;
    --selected: #646f40;
    --message-ai: #2c2c2e;
    --message-user: #007acc;
    --message-good: #1a3827;
    --message-bad: #441111;
    --square: min(64px, calc(100vw / 8));
    --selected-text: black;
    --previous: rgba(255, 215, 0, 0.5);
    --corner-radius: 10px;
    --bg1: #f0d9b51a;
    --light1: #f0d9b5;
    --light2: #f0d9b533;
    --light3: #f0d9b580;
    --light4: #aaa;
}
body {
  overscroll-behavior-y: none;
}
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    font-family: Arial, sans-serif;
    background-color: var(--background);
    color: var(--light);
    height: 100%;
    font-size: 16px;
}

/* === ОСНОВНОЙ МАКЕТ: мобильный по умолчанию === */
body {
    display: flex;
    flex-direction: column;
    height: 100%;
    overflow: hidden;
}

/* === ЧАТ-ИНТЕРФЕЙС === */
#chat-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    height: 100%;
    max-height: 100vh;
    overflow: hidden;
}

#messages {
    flex: 1;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    padding: 10px;
    gap: 8px;
    scroll-padding-bottom: 10px;
}

.chat-message {
    max-width: 89%;
    padding: 10px 14px;
    border-radius: 18px;
    line-height: 1.4;
    word-wrap: break-word;
    position: relative;
}

.chat-message.ai {
    align-self: flex-start;
    background-color: var(--message-ai);
    color: var(--light);
    border: 1px solid rgba(255, 215, 0, 0.2);
}

.chat-message.user {
    align-self: flex-end;
    background-color: var(--message-user);
    color: white;
    border: 1px solid #00f0ff80;
}

.chat-message.good {
    background-color: var(--message-good);
    color: #63b588;
    border: 1px solid #63b5884d;
}

.chat-message.bad {
    background-color: #f0d9b533;
    color: #f8d85a;
    border: 1px solid #f8d85a4d;
}

.chat-message.puzzle {
    background-color: #444;
    /* font-size: 0.9em; */
}

.chat-message.thinking,
.chat-message.thinking .message-content {
    color: #aaa;
    color: #cebeb0;
    font-style: italic;
}

#play-button {
    padding: 12px 14px;
    background-color: var(--message-user);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 1.1em;
    font-weight: bold;
    cursor: pointer;
}

#play-button:hover {
    background-color: #4caf50;
}

.quick-btn,
.color-btn {
    padding: 8px 12px;
    background: #444;
    border: 1px solid #f0d9b580;
    color: var(--light);
    border-radius: 8px;
    font-size: 0.9em;
    cursor: pointer;
    margin: 0 5px;
}

.quick-btn:hover,
.color-btn:hover {
    background: #555;
}

.color-btn {
    flex: 1;
}

/* === ДОСКА === */
#board-wrapper {
    display: none;
    justify-content: center;
}

#board {
    display: grid;
    grid-template-columns: repeat(8, var(--square));
    grid-template-rows: repeat(8, var(--square));
    width: calc(var(--square) * 8);
    height: calc(var(--square) * 8);
    background-color: var(--light);
    border-radius: 12px;
    box-shadow: 0 0 10px rgba(255, 215, 0, 0.5);
    position: relative;
}

#board.flip {
    transform: rotate(180deg);
}

#board.flip div {
    transform: rotate(180deg);
}

#board div {
    width: var(--square);
    height: var(--square);
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

/* Цвета полей */
#a1, #c1, #e1, #g1, #b2, #d2, #f2, #h2,
#a3, #c3, #e3, #g3, #b4, #d4, #f4, #h4,
#a5, #c5, #e5, #g5, #b6, #d6, #f6, #h6,
#a7, #c7, #e7, #g7, #b8, #d8, #f8, #h8 {
    background-color: #444;
    background-color: var(--dark);
}

#board div span {
    width: 90%;
    height: 90%;
    background-size: contain;
    background-position: center;
    background-repeat: no-repeat;
    filter: drop-shadow(0 0 2px var(--light4));
}

/* Фигуры */
main div.P span { background-image: url(./media/chess_pawn_light.svg); }
main div.p span { background-image: url(./media/chess_pawn_dark.svg); }
main div.R span { background-image: url(./media/chess_rook_light.svg); }
main div.r span { background-image: url(./media/chess_rook_dark.svg); }
main div.N span { background-image: url(./media/chess_knight_light.svg); }
main div.n span { background-image: url(./media/chess_knight_dark.svg); }
main div.B span { background-image: url(./media/chess_bishop_light.svg); }
main div.b span { background-image: url(./media/chess_bishop_dark.svg); }
main div.Q span { background-image: url(./media/chess_queen_light.svg); }
main div.q span { background-image: url(./media/chess_queen_dark.svg); }
main div.K span { background-image: url(./media/chess_king_light.svg); }
main div.k span { background-image: url(./media/chess_king_dark.svg); }

#board div.selected span {
    background-color: var(--selected) !important;
    border-radius: 50%;
}

#board div.circle span {
    width: 30%;
    height: 30%;
    border-radius: 50%;
    background-color: var(--selected);
}

/* === МОДАЛЬНЫЕ ОКНА === */
#rating-modal {
    display: none;
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background: rgba(0,0,0,0.9);
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

#rating-modal > div {
    background: #1a1a1a;
    padding: 20px;
    border-radius: 12px;
    width: 90%;
    max-width: 500px;
}

#full-rating-chart {
    width: 100%;
    height: 200px;
    margin-top: 10px;
    background: #000;
    border-radius: 8px;
}

#loading-gif {
    display: flex;
    align-items: center;
    justify-content: center;
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background: #161617;
    z-index: 99999;
}

#loading-gif img {
    /* width: 80%; */
    max-width: 170px;
    /* height: 80px; */
}

/* === AI АВАТАР (опционально) === */
#ai-message-container {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    max-width: 97%;
    margin-bottom: 7px;
}

#ai-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    flex-shrink: 0;
    margin-top: 4px;
}

#ai-avatar-bg, #ai-avatar-img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

#ai-avatar-img {
    position: absolute;
    width: 70%;
    height: 70%;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    opacity: 0.9;
    filter: drop-shadow(0 0 3px #fff);
}

/* === ДЕСКТОП: чат слева, доска справа === */
@media (min-width: 768px) {
    body {
        flex-direction: row;
        height: 100vh;
    }

    #messages {
        padding: 15px;
    }

    #board-wrapper {
        display: flex;
        flex: 1;
        justify-content: center;
        align-items: center;
        padding: 20px;
        overflow: hidden;
    }

    #board {
        width: calc(var(--square) * 8);
        height: calc(var(--square) * 8);
        box-shadow: 0 0 15px rgba(255, 215, 0, 0.6);
    }

    /* Скрыть кнопки быстрого ответа на десктопе (или оставить — по желанию) */
    #quick-replies {
        display: none;
    }
}

/* === ДЕСКТОП: чат слева, доска справа === */
@media (min-width: 768px) {
    body {
        flex-direction: row;
        height: 100vh;
    }

    #chat-container {
        width: 44%;
        flex: none;
        display: flex;
        flex-direction: column;
        max-height: 100vh;
    }

    #messages {
        flex: 1;
        overflow-y: auto;
        display: flex;
        flex-direction: column;
        padding: 15px;
        gap: 8px;
        scroll-padding-bottom: 10px;
    }

    #board-wrapper {
        display: flex;
        flex: 1;
        justify-content: center;
        align-items: center;
        padding: 20px;
    }

    #board {
        --square: min(64px, calc((100vh - 40px) / 8), calc((100vw - 380px - 40px) / 8));
        width: calc(var(--square) * 8);
        height: calc(var(--square) * 8);
        grid-template-columns: repeat(8, var(--square));
        grid-template-rows: repeat(8, var(--square));
        box-shadow: 0 0 15px rgb(255 215 0 / 0%);
        background-color: var(--light);
        border-radius: 12px;
    }
}/* === КАСТОМНЫЙ СКРОЛЛБАР ДЛЯ ЧАТА === */
#messages::-webkit-scrollbar {
    width: 3px;
}

#messages::-webkit-scrollbar-track {
    border-radius: 4px;
}

#messages::-webkit-scrollbar-thumb {
    background-color: var(--light2);
    border-radius: 4px;
    border: 1px solid #1e1e1f;
}

#messages::-webkit-scrollbar-thumb:hover {
    background-color: var(--light3);
}

/* Для Firefox (ограниченно) */
@supports (-moz-appearance: none) {
    #messages {
        scrollbar-width: thin;
        scrollbar-color: rgba(255, 215, 0, 0.6) #1e1e1f;
    }
}/* === РЕЖИМ СТАРТА: всё по центру, даже на десктопе === */
#chat-container.start-mode {
    /* Переопределяем поведение десктопа */
    width: 100% !important;
    max-width: none !important;
    border-right: none !important;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

#chat-container.start-mode #messages {
    justify-content: center;
    width: 100%;
    width: auto;
    flex: none;
}

#chat-container.start-mode #input-area {
    margin-top: 20px;
    width: 100%;
    max-width: 340px;
    align-self: center;
}

#chat-container.start-mode .chat-message {
    max-width: 100%;
}

/* На десктопе: только в режиме старта — центрируем */
@media (min-width: 768px) {
    #chat-container.start-mode {
        width: 100% !important;
        border-right: none !important;
        height: 100vh;
        max-height: 100vh;
    }

    #chat-container.start-mode #messages,
    #chat-container.start-mode #input-area {
        width: auto;
        /* max-width: 380px; */
    }
}#chat-container {
    transition: 
        width 0.3s ease,
        border-right 0.3s ease,
        align-items 0.3s ease,
        justify-content 0.3s ease;
}#input-area {
    padding: 0px;
    /* background-color: #111; */
    display: flex
;
    flex-direction: row-reverse;
    /* flex-direction: column; */
    gap: 8px;
    justify-content: center;
}

/* Подсветка последнего хода */
#board div.previous span {
    /* box-shadow: 0 0 8px 2px #f8d85a; */
    border-radius: 50%;
    transition: box-shadow 0.3s ease;
    border: 3px solid #646f40;
    width: 90%;
    height: 90%;
}

/* Опционально: мигающий эффект один раз */
#board div.previous:first-of-type::after {
    content: '';
    position: absolute;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle, rgba(255,215,0,0.4) 0%, transparent 70%);
    opacity: 0;
    animation: pulse-glow 1s ease-out;
}

@keyframes pulse-glow {
    0% { opacity: 0; }
    50% { opacity: 1; }
    100% { opacity: 0; }
}#board-wrapper {
    opacity: 0;
    transform: scale(0.95);
    transition: all 0.3s ease;
}
#board-wrapper.show {
    opacity: 1;
    transform: scale(1);
}/* === ФИГУРЫ В ЧАТЕ === */
.chat-message .piece-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    margin-bottom: 8px;
    vertical-align: middle;
}

.chat-message .piece-icon span {
    display: block;
    width: 100%;
    height: 100%;
    background-size: contain;
    background-position: center;
    background-repeat: no-repeat;
    filter: drop-shadow(0 0 2px #aaa);
}

.chat-piece-img {
    background-size: contain;
    background-position: center;
    background-repeat: no-repeat;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    margin-bottom: 5px;
    vertical-align: middle;
    filter: drop-shadow(0 0 2px #aaa);
}/* === ПОДСВЕТКА ХОДОВ — МИШЕНЬ С ОБВОДКОЙ (ПРИЦЕЛ) === */
/* === ПОДСВЕТКА ХОДОВ — ТОЧКИ СОХРАНЯЮТ ЦВЕТ ПОЛЯ И ВЫДЕЛЯЮТ ФИГУРУ === */

#board div.circle {
    position: relative;
}

#board div.circle span {
    width: 90% !important;
    height: 90% !important;
    background-color: transparent !important;
    z-index: 2;
    transition: transform 0.1s ease, filter 0.1s ease;
}

#board div.circle::before {
    content: '';
    position: absolute;
    width: 30%;
    height: 30%;
    background-color: var(--selected);
    border-radius: 50%;
    z-index: 1;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    pointer-events: none;
    opacity: 0.8;
}

#board div.circle:hover {
    background-color: rgba(99, 181, 136, 0.4) !important;
}

#board div.circle:hover span {
    filter: drop-shadow(0 0 3px rgba(0,0,0,0.8));
    transform: scale(1.08);
}/* === ОБЫЧНЫЙ ХОД — МАЛЕНЬКАЯ ТОЧКА === */
#board div.circle::before {
    content: '';
    position: absolute;
    width: 30%;
    height: 30%;
    background-color: var(--selected);
    border-radius: 50%;
    z-index: 1;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    pointer-events: none;
    opacity: 0.7;
}

/* === МИШЕНЬ НА ФИГУРУ ПОД УДАРОМ — ЧЕРЕЗ CSS АНИМАЦИЮ === */
#board div.capture::after {
    content: '';
    position: absolute;
    width: 90%;
    height: 90%;
    z-index: 3;
    /* Статичная SVG-мишень БЕЗ анимации */
    background-image: url("1.svg");
    background-size: contain;
    background-position: center;
    background-repeat: no-repeat;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0);
    pointer-events: none;
    opacity: 1;
    /* Запуск CSS-анимации */
    animation: targetPulse 0.6s ease-out forwards;
}

/* При наведении — можно усилить */
#board div.capture:hover::after {
    filter: drop-shadow(0 0 2px rgba(255, 215, 0, 0.8));
}

/* Анимация появления мишени */
@keyframes targetPulse {
    0% {
        transform: translate(-50%, -50%) scale(0);
        opacity: 0;
    }
    70% {
        transform: translate(-50%, -50%) scale(1.1);
        opacity: 1;
    }
    100% {
        transform: translate(-50%, -50%) scale(1);
        opacity: 1;
    }
}

#board div.capture::after {
    opacity: 0;
    transition: opacity 0.1s ease;
}

#board div.capture::after {
    opacity: 1;
}

#board div.capture:hover::after {
    opacity: 1;
    filter: drop-shadow(0 0 2px rgba(255, 215, 0, 0.8));
}

#board div.capture span,
#board div.circle span {
    width: 90%;
    height: 90%;
    background-color: transparent !important;
    z-index: 2;
    transition: transform 0.1s ease, filter 0.1s ease;
}

#board div.capture:hover span {
    transform: scale(1.08);
    filter: drop-shadow(0 0 3px rgba(0,0,0,0.8));
}
/* === ИНДИКАТОР НА ТАЙМЕРЕ (АВАТАРКЕ) === */
#move-timer {
    position: relative;
}

#move-timer::after {
    content: '';
    position: absolute;
    top: -2px;
    right: -2px;
    width: 12px;
    height: 12px;
    background-color: #00ff88;
    border-radius: 50%;
    border: 2px solid #161617;
    box-shadow: 0 0 5px rgba(0,0,0,0.5);
    opacity: 0;
    transition: opacity 0.3s ease;
}

#move-timer.indicator-active::after {
    opacity: 1;
}
/* === УПРАВЛЕНИЕ ГРАФИКОМ === */
#chart-controls {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}

.view-btn {
    background: #444;
    border: 1px solid #f0d9b540;
    color: #aaa;
    padding: 4px 8px;
    border-radius: 6px;
    font-size: 0.85em;
    cursor: pointer;
}

.view-btn.active {
    background: #63b588;
    color: white;
    border-color: #63b588;
}

.view-btn:hover {
    background: #555;
}@keyframes sparkle-glow {
    0% { opacity: 0; transform: scale(0.8); }
    50% { opacity: 1; transform: scale(1.2); }
    100% { opacity: 1; transform: scale(1); }
}
.message-content span.sparkle {
    display: inline-block;
    animation: sparkle-glow 2s ease-out forwards;
    margin-left: 4px;
}
/* Плавное появление эмодзи */
@keyframes emojiFadeIn {
    from {
        opacity: 0;
        transform: scale(0.8);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.semantic-emoji,
.free-emoji {
    display: inline-block;
    animation: emojiFadeIn 2s ease-out forwards;
    /* без animation-delay */
}
.text-emoji {
    display: inline-block;
    animation: emojiFadeIn 0.4s ease-out forwards;
    animation-delay: 0s !important;
}

@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.03); }
}
#play-button {
    animation: pulse 2s infinite;
}


/* === СТИЛЬ: НАТУРА (по умолчанию) === */
/* === КИБЕРПАНК СТИЛЬ === */
body.cyberpunk {
    --background: #0a0a0a;
    --message-ai: #1a1a2e;
    --message-user: #007acc;
    --message-good: #25392e7d;
    --message-bad: #3a1a1a;
    --light: #00f0ff;
    --dark: #007acc;
    --selected: #00ff88;
    --previous: rgba(0, 240, 255, 0.5);
    --bg1: #00f0ff1a;
    --light1: #f0d9b5;
    --light2: #00f0ff4d;
    --light3: #00f0ff;
    --light4: #00f0ff;
    background: #0a0a0a00;
}

/* Стили для доски в киберпанк
    
    border: 2px solid #00f0ff;
    background: linear-gradient(45deg, #0a0a0a, #1a1a2e);*/
body.cyberpunk #board {
    box-shadow: 
        0 0 20px rgba(0, 240, 255, 0.3),
        inset 0 0 20px rgba(0, 240, 255, 0.1);
}

/* Светлые поля */
body.cyberpunk #a1, body.cyberpunk #c1, body.cyberpunk #e1, body.cyberpunk #g1,
body.cyberpunk #b2, body.cyberpunk #d2, body.cyberpunk #f2, body.cyberpunk #h2,
body.cyberpunk #a3, body.cyberpunk #c3, body.cyberpunk #e3, body.cyberpunk #g3,
body.cyberpunk #b4, body.cyberpunk #d4, body.cyberpunk #f4, body.cyberpunk #h4,
body.cyberpunk #a5, body.cyberpunk #c5, body.cyberpunk #e5, body.cyberpunk #g5,
body.cyberpunk #b6, body.cyberpunk #d6, body.cyberpunk #f6, body.cyberpunk #h6,
body.cyberpunk #a7, body.cyberpunk #c7, body.cyberpunk #e7, body.cyberpunk #g7,
body.cyberpunk #b8, body.cyberpunk #d8, body.cyberpunk #f8, body.cyberpunk #h8 {
    background-color: #007acc;
    background-color: #003366d7;
    background-color: #061829d7;
}

/* Тёмные поля */
body.cyberpunk #b1, body.cyberpunk #d1, body.cyberpunk #f1, body.cyberpunk #h1,
body.cyberpunk #a2, body.cyberpunk #c2, body.cyberpunk #e2, body.cyberpunk #g2,
body.cyberpunk #b3, body.cyberpunk #d3, body.cyberpunk #f3, body.cyberpunk #h3,
body.cyberpunk #a4, body.cyberpunk #c4, body.cyberpunk #e4, body.cyberpunk #g4,
body.cyberpunk #b5, body.cyberpunk #d5, body.cyberpunk #f5, body.cyberpunk #h5,
body.cyberpunk #a6, body.cyberpunk #c6, body.cyberpunk #e6, body.cyberpunk #g6,
body.cyberpunk #b7, body.cyberpunk #d7, body.cyberpunk #f7, body.cyberpunk #h7,
body.cyberpunk #a8, body.cyberpunk #c8, body.cyberpunk #e8, body.cyberpunk #g8 {
    background-color: #003366;
    background-color: #00ff8880;
    background-color: #00336680;
    background-color: #3f6681;
}

/* Подсветка ходов в киберпанк */
body.cyberpunk #board div.circle::before {
    background-color: #00ff88;
    box-shadow: 0 0 10px #007acc;
    /* background-color: #003366; */
    /* box-shadow: 0 0 10px rgba(0, 240, 255, 0.3); */
}

body.cyberpunk #board div.capture::after {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100'%3E%3Ccircle cx='50' cy='50' r='45' fill='none' stroke='%2300ff88' stroke-width='3' stroke-dasharray='5,5'/%3E%3Ccircle cx='50' cy='50' r='35' fill='none' stroke='%2300f0ff' stroke-width='2'/%3E%3C/svg%3E");
}

body.matrix #messages {
    background: #0a0a1a url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="100" height="100" viewBox="0 0 100 100"><text x="50" y="50" font-family="Courier" font-size="12" fill="rgba(0,255,136,0.05)" text-anchor="middle">101010</text></svg>') repeat;
    background-size: 60px;
}

/* Сообщения в киберпанк */
body.cyberpunk .chat-message.ai {
    background: #141e21;
    border: 1px solid #00f0ff33;
    color: #f0d9b5;
}

body.cyberpunk .chat-message.user {
    background: #00f0ff29;
    color: #ffffff;
    border: 1px solid #00f0ff80;
}

body.cyberpunk .chat-message.good {
    background: var(--message-good);
    color: #63b588;
    border: 1px solid #00ff884d;
}

body.cyberpunk .chat-message.bad {
    background: #f0d9b521;
    color: #f8d85a;
    border: 1px solid rgba(255, 215, 0, 0.5);
}

/* Кнопки в киберпанк */
body.cyberpunk .quick-btn,
body.cyberpunk .color-btn {
    background: #141e21;
    border: 1px solid rgba(0, 240, 255, 0.3);
    color: #f0d9b5;
}

body.cyberpunk .quick-btn:hover,
body.cyberpunk .color-btn:hover {
    background: #00f0ff29;
    box-shadow: 0 0 10px rgba(0, 240, 255, 0.3);
}

/* Таймер в киберпанк */
body.cyberpunk #move-timer {
    background: #1a1a2e80;
    border: 1px solid #00f0ff40;
    color: #00f0ff;
}

/* === КНОПКИ ПЕРЕКЛЮЧЕНИЯ СТИЛЕЙ === */
#style-buttons {
    display: flex;
    gap: 8px;
    margin: 8px 0;
    justify-content: center;
    flex-wrap: wrap;
}

.style-btn {
    padding: 8px 26px 8px 16px;
    margin: 0 5px;
    background: #444;
    border: 1px solid #f0d9b580;
    color: var(--light);
    border-radius: 8px;
    font-size: 0.9em;
    cursor: pointer;
    transition: all 0.3s ease;
}

.style-btn:hover {
    background: #555;
    transform: translateY(-1px);
}

.style-btn.active {
    background: var(--selected);
    color: var(--selected-text);
    border-color: var(--selected);
}

/* Киберпанк стиль для кнопок стиля */
body.cyberpunk .style-btn {
    background: #141e21;
    border: 1px solid #00f0ff80;
    color: #00f0ff;
}

body.cyberpunk .style-btn:hover {
    background: #00f0ff29;
    box-shadow: 0 0 10px #00f0ff29;
}

body.cyberpunk .style-btn.active {
    color: #00ff88;
    border-color: #00ff88;
}


/* === СТИЛЬ: МАТРИЦА === */
body.matrix {
    --background: #000;
    --message-ai: #000c09;
    --message-user: #003306;
    --message-good: #00220a;
    --message-bad: #3a1a1a;
    --light: #00ff88;
    --dark: #004411;
    --selected: #00ff88;
    --previous: rgba(0, 255, 136, 0.4);
    --bg1: #001f0e;
    --light1: #00ff88;
    --light2: #00ff884d;
    --light3: #00ff88;
    --light4: #00ff88;
    color: #00ff88;
    background: #000;
    font-family: 'Courier New', monospace;
    font-style: normal;
    /* text-shadow: 0 0 5px rgba(0, 255, 136, 0.7); */
}

body.matrix #board div.capture::after {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100'%3E%3Ccircle cx='50' cy='50' r='45' fill='none' stroke='%230f0' stroke-width='2' stroke-dasharray='4,4'/%3E%3Ccircle cx='50' cy='50' r='30' fill='none' stroke='%230a0' stroke-width='1.5'/%3E%3Ctext x='50' y='57' font-family='monospace' font-size='17' fill='%230f0' text-anchor='middle'>0.1%3C/text%3E%3C/svg%3E");
}

body.matrix #messages {
    background: #000 url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="100" height="100" viewBox="0 0 100 100"><text x="50" y="50" font-family="Courier" font-size="12" fill="rgba(0,255,136,0.05)" text-anchor="middle">101010</text></svg>') repeat;
    background-size: 60px;
}

body.matrix .chat-message.ai,
body.matrix .chat-message.user,
body.matrix .chat-message.good,
body.matrix .chat-message.bad {
    border: 1px solid #00ff8833;
    background: #000a0522;
    backdrop-filter: blur(2px);
    box-shadow: 0 0 8px rgba(0, 255, 136, 0.1);
    border-left: 2px solid #00ff88;
}

body.matrix .chat-message.user {
    background: #00330633;
    color: #00ff88;
    border-left: 2px solid #00ff88;
    border-right: 2px solid #00ff88;
}

body.matrix #board {
    box-shadow: 0 0 25px rgba(0, 255, 136, 0.4), inset 0 0 15px rgba(0, 255, 136, 0.2);
    /* border: 1px solid #00ff8866; */
    background: #001108;
}

/* Поля доски в стиле Матрицы */
body.matrix #a1, body.matrix #c1, body.matrix #e1, body.matrix #g1,
body.matrix #b2, body.matrix #d2, body.matrix #f2, body.matrix #h2,
body.matrix #a3, body.matrix #c3, body.matrix #e3, body.matrix #g3,
body.matrix #b4, body.matrix #d4, body.matrix #f4, body.matrix #h4,
body.matrix #a5, body.matrix #c5, body.matrix #e5, body.matrix #g5,
body.matrix #b6, body.matrix #d6, body.matrix #f6, body.matrix #h6,
body.matrix #a7, body.matrix #c7, body.matrix #e7, body.matrix #g7,
body.matrix #b8, body.matrix #d8, body.matrix #f8, body.matrix #h8 {
    background-color: #001a0b;
}

body.matrix #b1, body.matrix #d1, body.matrix #f1, body.matrix #h1,
body.matrix #a2, body.matrix #c2, body.matrix #e2, body.matrix #g2,
body.matrix #b3, body.matrix #d3, body.matrix #f3, body.matrix #h3,
body.matrix #a4, body.matrix #c4, body.matrix #e4, body.matrix #g4,
body.matrix #b5, body.matrix #d5, body.matrix #f5, body.matrix #h5,
body.matrix #a6, body.matrix #c6, body.matrix #e6, body.matrix #g6,
body.matrix #b7, body.matrix #d7, body.matrix #f7, body.matrix #h7,
body.matrix #a8, body.matrix #c8, body.matrix #e8, body.matrix #g8 {
    background-color: #000f07;
}

/* Эффект "падающие символы" */
body.matrix::before {
    content: '';
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    pointer-events: none;
    background: 
        linear-gradient(
            transparent 0%,
            rgba(0, 255, 136, 0.03) 50%,
            transparent 100%
        ),
        repeating-linear-gradient(
            0deg,
            rgba(0, 255, 136, 0.02) 0px,
            rgba(0, 255, 136, 0.02) 1px,
            transparent 1px,
            transparent 2px
        );
    z-index: -1;
    animation: matrixScan 3s linear infinite;
    opacity: 0.3;
}

@keyframes matrixScan {
    0% { transform: translateY(-100%); }
    100% { transform: translateY(100vh); }
}

/* Кнопки в стиле Матрицы */
body.matrix .quick-btn,
body.matrix .color-btn,
body.matrix .style-btn {
    background: #001a0b;
    border: 1px solid #00ff8840;
    color: #00ff88;
    font-family: 'Courier New', monospace;
    letter-spacing: 0.5px;
}

body.matrix .quick-btn:hover,
body.matrix .color-btn:hover,
body.matrix .style-btn:hover {
    background: #003306;
    box-shadow: 0 0 10px rgba(0, 255, 136, 0.2);
    text-shadow: 0 0 5px #00ff88;
}

body.matrix .style-btn.active {
    color: #00ff88;
    border-color: #00ff88;
    box-shadow: 0 0 10px rgba(0, 255, 136, 0.5);
}

/* Таймер в Матрице */
body.matrix #move-timer {
    background: #001a0b80;
    border: 1px solid #00ff8840;
    color: #00ff88;
    font-family: 'Courier New', monospace;
    /* text-shadow: 0 0 5px #00ff88; */
}

/* Подсветка ходов в Матрице */
body.matrix #board div.circle::before {
    background-color: #00ff88;
    /* box-shadow: 0 0 8px #00ff88; */
}

body.matrix #board div.capture::after {
    filter: drop-shadow(0 0 5px #00ff88);
}

/* Эффект "зелёного свечения" для фигур */
body.matrix main div span {
    filter: 
        drop-shadow(0 0 1px #00ff88) 
        drop-shadow(0 0 7px #00aa55) !important;
}

body.matrix main div span {
    filter: drop-shadow(0 01px #00ff88) drop-shadow(0 0 7px #00aa55) !important;
}