:root {
    --light-square: #eeeed2;
    --dark-square: #769656;
    --square-size: 64px;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

body {
    background-color: #121212;
    color: #f0f0f0;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
}

.game-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    background: #1e1e1e;
    padding: 24px;
    border-radius: 12px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.7);
    max-width: 980px;
    width: 100%;
    border: 1px solid #333;
}

.game-header {
    width: 100%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
    border-bottom: 1px solid #333;
    padding-bottom: 12px;
}

.game-header h1 {
    font-size: 1.4rem;
    color: #fff;
}

.settings-bar {
    display: flex;
    gap: 16px;
    align-items: center;
    font-size: 0.9rem;
}

.setting-group {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.settings-bar select {
    background: #2a2a2a;
    color: #fff;
    border: 1px solid #555;
    padding: 6px 10px;
    border-radius: 6px;
    outline: none;
    cursor: pointer;
}

.economy-panel {
    margin-bottom: 12px;
    width: 100%;
    max-width: 520px;
    padding: 10px 15px;
    background: #252525;
    border-radius: 8px;
    display: flex;
    justify-content: space-around;
    border: 1px solid #444;
    font-size: 13px;
}

.material-badge {
    color: #f1c40f;
    font-weight: bold;
}

#multiplayer-controls {
    margin-bottom: 15px;
    width: 100%;
    background: #252525;
    padding: 12px;
    border-radius: 8px;
    text-align: center;
    border: 1px solid #383838;
}

.main-content {
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
    justify-content: center;
    align-items: flex-start;
}

.board-wrapper {
    position: relative;
    background: #2a2a2a;
    padding: 6px;
    border-radius: 8px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.4);
}

.chess-board {
    display: grid;
    grid-template-columns: repeat(8, var(--square-size));
    grid-template-rows: repeat(8, var(--square-size));
    width: calc(var(--square-size) * 8);
    height: calc(var(--square-size) * 8);
    border: 3px solid #333;
    border-radius: 4px;
    image-rendering: pixelated;
}

.square {
    width: var(--square-size);
    height: var(--square-size);
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
    user-select: none;
    cursor: pointer;
}

.square.light { background-color: var(--light-square); }
.square.dark { background-color: var(--dark-square); }

.square.selected {
    background-color: rgba(255, 235, 59, 0.75) !important;
}

.square.last-move {
    background-color: rgba(129, 212, 250, 0.5) !important;
}

.square.highlight::after {
    content: '';
    width: 18px;
    height: 18px;
    background-color: #ff5722;
    border: 2px solid #fff;
    border-radius: 50%;
    box-shadow: 0 0 5px rgba(0,0,0,0.8);
}

.square.highlight.capture::after {
    width: 100%;
    height: 100%;
    border: 4px solid #ff1744;
    background-color: rgba(255, 23, 68, 0.3);
    border-radius: 0;
    box-sizing: border-box;
}

.piece {
    width: 90%;
    height: 90%;
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
    z-index: 2;
    pointer-events: none;
    image-rendering: pixelated;
}

.sidebar {
    width: 280px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.status-box, .timers-box, .uno-panel, .spawn-panel, .history-container {
    background: #252525;
    padding: 10px;
    border-radius: 8px;
    border: 1px solid #383838;
}

.turn-indicator {
    font-weight: bold;
    text-align: center;
    font-size: 13px;
    color: #4caf50;
    margin-bottom: 2px;
}

.game-status {
    font-size: 0.82rem;
    color: #b0b0b0;
    text-align: center;
}

.timers-box {
    display: flex;
    justify-content: space-between;
    gap: 8px;
}

.timer-card {
    flex: 1;
    background: #2a2a2a;
    padding: 8px;
    border-radius: 6px;
    text-align: center;
    border-left: 4px solid transparent;
}
.timer-card.active {
    border-left-color: #4caf50;
    background: #333;
}
.timer-label {
    font-size: 0.75rem;
    color: #aaa;
}
.timer-value {
    font-size: 1.1rem;
    font-weight: bold;
    font-family: monospace;
}

.uno-panel {
    display: flex;
    justify-content: space-around;
    align-items: center;
}

.uno-deck-container, .uno-card-display {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}

/* Стили и плавная анимация переворота карт Таро */
.uno-deck-img {
    width: 65px;
    height: 95px;
    cursor: pointer;
    border-radius: 6px;
    object-fit: cover;
    transition: transform 0.4s ease;
    transform-style: preserve-3d;
}
.uno-deck-img:hover {
    transform: scale(1.05);
}

.uno-label {
    font-size: 0.7rem;
    color: #bbb;
    text-align: center;
}

#animation-container {
    width: 100%;
    height: 70px;
    background: #111;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px dashed #555;
    font-size: 12px;
    color: #aaa;
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
}

.spawn-panel {
    display: none;
    border: 1px dashed #ff9800;
    text-align: center;
}

.spawn-panel h4 {
    font-size: 0.8rem;
    color: #ffb74d;
    margin-bottom: 6px;
}

.spawn-buttons {
    display: flex;
    gap: 4px;
    flex-wrap: wrap;
    justify-content: center;
}

.btn-spawn {
    font-size: 0.75rem;
    padding: 4px 6px;
    background: #444;
    color: #fff;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    flex: 1;
}
.btn-spawn.active {
    background: #ff9800;
    font-weight: bold;
}

.history-container {
    display: flex;
    flex-direction: column;
    height: 120px;
}

.history-container h3 {
    font-size: 0.82rem;
    margin-bottom: 4px;
    border-bottom: 1px solid #333;
    padding-bottom: 3px;
    color: #ccc;
}

.move-history {
    overflow-y: auto;
    font-size: 0.78rem;
    display: flex;
    flex-direction: column;
    gap: 3px;
    flex-grow: 1;
    font-family: monospace;
}

.move-row {
    display: flex;
    justify-content: space-between;
    padding: 2px 4px;
    background: rgba(255,255,255,0.02);
    border-radius: 3px;
}

.controls {
    display: flex;
    gap: 8px;
}

.btn {
    flex: 1;
    background: #444;
    color: #fff;
    border: none;
    padding: 8px;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 600;
    font-size: 0.8rem;
    transition: background 0.2s;
}
.btn:hover { background: #555; }
.btn-primary { background: #2e7d32; }
.btn-primary:hover { background: #388e3c; }
.btn-danger { background: #c62828; }
.btn-danger:hover { background: #d32f2f; }
.btn-blue { background: #0288d1; }
.btn-blue:hover { background: #039be5; }