@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;500;700&display=swap');

:root {
    --bg-black: #000000;
    --bg-panel: #0a0a0a;
    --border: #333;
    --text-main: #ffffff;
    --danger: #cf6679;
}

body {
    background-color: var(--bg-black);
    color: var(--text-main);
    font-family: 'Inter', sans-serif;
    margin: 0;
    overflow: hidden;
}

.hidden { display: none !important; }

#lang-btn {
    position: fixed; top: 15px; right: 15px; z-index: 99999; 
    width: 30px; height: 30px; border-radius: 50%; background: #222; 
    color: #888; border: 1px solid #444; cursor: pointer; font-size: 10px; 
    display: flex; align-items: center; justify-content: center; padding: 0; margin: 0; opacity: 0.5; transition: 0.2s;
}
#lang-btn:hover { opacity: 1; color: #fff; border-color: #fff; }

.screen {
    width: 100vw; height: 100vh; position: fixed; top: 0; left: 0;
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    background: var(--bg-black); z-index: 10;
}

.panel {
    background: var(--bg-panel); border: 1px solid var(--border); padding: 30px;
    width: 380px; max-width: 90%; box-shadow: 0 0 40px rgba(0,0,0,1);
    display: flex; flex-direction: column; border-radius: 8px;
    transition: box-shadow 0.3s, border-color 0.3s;
}

/* Красная тема для Анархо-Анархии */
.theme-aa.panel {
    box-shadow: 0 0 60px rgba(255, 0, 0, 0.4);
    border-color: #500;
}
.theme-aa .chat-container {
    border-color: #500;
}
.theme-aa .chat-header {
    background: rgba(255, 0, 0, 0.2);
    border-bottom-color: #500;
}

h2, h3, h4 { margin: 0 0 15px 0; font-weight: 700; color: var(--text-main); text-align: center; }

input, select {
    background: #000 !important; border: 1px solid #444 !important; color: #fff !important;
    padding: 12px; width: 100%; margin-bottom: 15px; box-sizing: border-box; font-family: inherit; font-size: 1rem; border-radius: 4px;
}
input:focus, select:focus { border-color: #fff !important; outline: none; }

button {
    background: #fff; color: #000; font-weight: 700; border: 1px solid #fff;
    padding: 12px; width: 100%; cursor: pointer; transition: 0.2s; margin-bottom: 10px; font-family: inherit; border-radius: 4px;
}
button:hover { background: #ccc; }

button.outline { background: transparent; border: 1px solid #444; color: #888; }
button.outline:hover { border-color: #fff; color: #fff; }
button.active-tab { border-color: #fff; color: #fff; background: #111; }
button.danger { background: #000; color: var(--danger); border-color: var(--danger); }
button.danger:hover { background: var(--danger); color: #fff; }

.rules-block { border-left: 3px solid #fff; padding-left: 15px; margin-bottom: 20px; }
.rules-list { padding-left: 20px; color: #ccc; font-size: 0.9rem; line-height: 1.5; margin: 0; }
.contact-card { background: #111; padding: 15px; margin-bottom: 10px; border-radius: 6px; display: flex; justify-content: space-between; align-items: center; border: 1px solid #222; }

#board-container {
    padding: 20px; background: #080808; border: 1px solid #333;
    box-shadow: 0 0 60px rgba(0,0,0,0.9); overflow: visible !important;
}

.ui-draggable-dragging { z-index: 99999 !important; overflow: visible !important; }

.white-1e1d7 { background-color: #777 !important; color: #000 !important; }
.black-3c85d { background-color: #222 !important; color: #fff !important; }

.square-55d63 { position: relative; }
.highlight-valid::after {
    content: ''; position: absolute; width: 22px; height: 22px; background: rgba(180, 255, 180, 0.7);
    border-radius: 50%; top: 50%; left: 50%; transform: translate(-50%, -50%); pointer-events: none;
    box-shadow: 0 0 8px rgba(255,255,255,0.9);
}
.highlight-capture::after {
    content: ''; position: absolute; width: 100%; height: 100%; box-shadow: inset 0 0 0 4px rgba(220, 50, 50, 0.9);
    top: 0; left: 0; pointer-events: none;
}
.highlight-last {
    background-color: rgba(217, 70, 239, 0.4) !important;
}

.avatar-lg { width: 100px; height: 100px; border-radius: 50%; object-fit: cover; border: 2px solid #333; display: block; margin: 0 auto; background: #000; }
.avatar-sm { width: 32px; height: 32px; border-radius: 50%; object-fit: cover; border: 1px solid #444; background: #000; }
.avatar-game { width: 60px; height: 60px; border-radius: 50%; object-fit: cover; border: 2px solid #444; background: #000; }

.game-layout { 
    display: flex; gap: 20px; align-items: center; justify-content: center; 
    height: 100vh; width: 100vw; box-sizing: border-box;
}
.game-main { display: flex; gap: 20px; align-items: center; }

.center-col { display: flex; flex-direction: column; align-items: center; gap: 15px; }
.player-card { display: flex; flex-direction: column; align-items: center; gap: 5px; width: 120px; text-align: center; }
.player-name { font-weight: bold; font-size: 1rem; text-overflow: ellipsis; overflow: hidden; white-space: nowrap; width: 100%; }
.timer { font-family: monospace; font-size: 1.5rem; color: #444; border: 1px solid #222; padding: 5px; width: 100%; box-sizing: border-box; }
.timer.active { color: #fff; border-color: #fff; }

.chat-container {
    width: 250px; height: 590px; background: rgba(10, 10, 10, 0.8); 
    border: 1px solid #333; display: flex; flex-direction: column;
    border-radius: 8px; backdrop-filter: blur(5px);
}
.chat-header {
    padding: 10px; background: rgba(255,255,255,0.05); font-size: 0.85rem; font-weight: bold; border-bottom: 1px solid #333; text-align: center; letter-spacing: 1px;
}
.chat-messages {
    flex: 1; overflow-y: auto; padding: 10px; display: flex; flex-direction: column; gap: 6px; font-size: 0.8rem;
}
.chat-messages::-webkit-scrollbar { width: 6px; }
.chat-messages::-webkit-scrollbar-thumb { background: #333; border-radius: 3px; }
.chat-msg { word-wrap: break-word; line-height: 1.3; }
.chat-input-area {
    display: flex; border-top: 1px solid #333; padding: 5px; gap: 5px;
}
.chat-input-area input { margin: 0; border: 1px solid #222 !important; padding: 8px; font-size: 0.85rem; background: #000 !important; border-radius: 4px; }
.chat-input-area button { width: auto; margin: 0; padding: 0 12px; border: 1px solid #333; background: #222; color: #fff; border-radius: 4px; }
.chat-input-area button:hover { background: #444; }

.lobby-list { height: 350px; overflow-y: auto; border: 1px solid #222; margin: 20px 0; background: #050505; border-radius: 4px; }
.lobby-item { display: flex; justify-content: space-between; align-items: center; padding: 15px; border-bottom: 1px solid #222; }
.tag { font-size: 0.8rem; color: #666; border: 1px solid #333; padding: 2px 5px; margin-left: 10px; }

/* LEADERBOARD & STATS */
.lb-list { display:flex; flex-direction:column; gap:5px; }
.lb-item { display:flex; justify-content:space-between; padding:10px; background:#111; border:1px solid #222; font-size:0.9rem; }
.stat-row { border-left: 3px solid #fff; padding-left: 10px; font-size: 0.8rem; }
.stat-val { color: #aaa; margin-top:2px; }
.elo-badge { font-size: 0.75rem; border: 1px solid #444; padding: 1px 6px; border-radius: 4px; color: #666; margin-top: 2px; }

#rematch-panel {
    position: absolute; top: 10px; left: 50%; transform: translateX(-50%);
    background: #111; padding: 15px; border: 1px solid #444; border-radius: 4px;
    display: flex; gap: 20px; align-items: center;
    box-shadow: 0 10px 30px rgba(0,0,0,1); z-index: 2000;
}

#toast-container { position: fixed; bottom: 30px; right: 30px; z-index: 999; display: flex; flex-direction: column; gap: 10px; }
.toast { background: #111; border-left: 4px solid #fff; padding: 15px 20px; color: #fff; min-width: 250px; box-shadow: 0 5px 20px rgba(0,0,0,1); border-radius: 4px; font-size: 0.9rem; }
.modal-backdrop { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.9); z-index: 100; display: flex; justify-content: center; align-items: center; }

#spectator-area {
    position: fixed; bottom: 20px; right: 320px;
    background: rgba(0,0,0,0.5); padding: 10px; border-radius: 4px;
    border: 1px solid #333; color: #888; font-size: 0.8rem;
    max-height: 150px; overflow-y: auto; display: flex; flex-direction: column; gap: 2px;
}
#spectator-area h5 { margin: 0 0 5px 0; color: #fff; font-size: 0.8rem; border-bottom: 1px solid #444; padding-bottom: 2px; }

.nav-row { display: flex; gap: 5px; margin-bottom: 20px; border-bottom: 1px solid #222; padding-bottom: 10px; }
.nav-btn { background: transparent; border: none; color: #666; padding: 5px 10px; margin: 0; font-size: 0.9rem; transition: 0.2s; }
.nav-btn:hover { color: #fff; }
.nav-btn.active { color: #fff; font-weight: bold; border-bottom: 2px solid #fff; }
.highlight-valid::after {
    content: ''; position: absolute; width: 22px; height: 22px; background: rgba(180, 255, 180, 0.7);
    border-radius: 50%; top: 50%; left: 50%; transform: translate(-50%, -50%); pointer-events: none;
    box-shadow: 0 0 8px rgba(255,255,255,0.9);
}
.highlight-capture::after {
    content: ''; position: absolute; width: 100%; height: 100%; box-shadow: inset 0 0 0 4px rgba(220, 50, 50, 0.9);
    top: 0; left: 0; pointer-events: none;
}
.highlight-last {
    background-color: rgba(217, 70, 239, 0.4) !important;
}

/* НОВОЕ: Красная клетка при заморозке */
.highlight-cooldown {
    background-color: rgba(255, 0, 0, 0.5) !important;
    box-shadow: inset 0 0 10px #ff0000;
}

.highlight-valid::after {
    content: ''; position: absolute; width: 22px; height: 22px; background: rgba(180, 255, 180, 0.7);
    border-radius: 50%; top: 50%; left: 50%; transform: translate(-50%, -50%); pointer-events: none;
    box-shadow: 0 0 8px rgba(255,255,255,0.9);
}
.highlight-capture::after {
    content: ''; position: absolute; width: 100%; height: 100%; box-shadow: inset 0 0 0 4px rgba(220, 50, 50, 0.9);
    top: 0; left: 0; pointer-events: none;
}
.highlight-last {
    background-color: rgba(217, 70, 239, 0.4) !important;
}
.highlight-cooldown {
    background-color: rgba(255, 0, 0, 0.5) !important;
    box-shadow: inset 0 0 10px #ff0000;
}

/* НОВОЕ: Подсветка выбранной фигуры при клике */
.highlight-selected {
    background-color: rgba(255, 255, 0, 0.5) !important; /* Желтый полупрозрачный */
    box-shadow: inset 0 0 5px #ffff00;
}

/* ... (Остальной код) ... */