* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.container {
    width: 100%;
    max-width: 600px;
}

header {
    text-align: center;
    color: white;
    margin-bottom: 40px;
}

header h1 {
    font-size: 48px;
    margin-bottom: 10px;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
}

header p {
    font-size: 16px;
    opacity: 0.9;
}

main {
    position: relative;
}

.screen {
    display: none;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.screen.active {
    display: block;
    opacity: 1;
}

/* Game Selection */
#gameSelection h2 {
    color: white;
    text-align: center;
    margin-bottom: 30px;
    font-size: 28px;
}

.games-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.game-card {
    background: white;
    border-radius: 15px;
    padding: 25px;
    text-align: center;
    cursor: pointer;
    transition: transform 0.3s, box-shadow 0.3s;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.game-card:hover:not(.disabled) {
    transform: translateY(-10px);
    box-shadow: 0 8px 15px rgba(0, 0, 0, 0.2);
}

.game-card.disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.game-card h3 {
    font-size: 40px;
    margin-bottom: 10px;
}

.game-card p {
    font-size: 16px;
    font-weight: bold;
    color: #333;
    margin-bottom: 5px;
}

.game-card small {
    color: #999;
    font-size: 12px;
}

/* Cards */
.card {
    background: white;
    border-radius: 15px;
    padding: 30px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.card h2 {
    color: #333;
    margin-bottom: 20px;
    text-align: center;
}

.card input {
    width: 100%;
    padding: 12px;
    margin-bottom: 15px;
    border: 2px solid #ddd;
    border-radius: 8px;
    font-size: 16px;
    transition: border-color 0.3s;
}

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

.card button {
    width: 100%;
    padding: 12px;
    margin-bottom: 10px;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;
    transition: background 0.3s;
}

button {
    background: #667eea;
    color: white;
}

button:hover {
    background: #5568d3;
}

.btn-secondary {
    background: #ddd;
    color: #333;
}

.btn-secondary:hover {
    background: #ccc;
}

#shareCode {
    display: block;
    padding: 10px;
    margin: 10px 0;
    background: #f0f0f0;
    border-radius: 8px;
    text-align: center;
}

/* Game Container */
.game-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
}

.game-info {
    background: white;
    border-radius: 15px;
    padding: 20px;
    width: 100%;
    text-align: center;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.game-info h2 {
    color: #333;
    margin-bottom: 15px;
}

#playersList {
    font-size: 14px;
    color: #666;
    margin-bottom: 15px;
}

.player-item {
    padding: 8px;
    background: #f0f0f0;
    border-radius: 5px;
    margin: 5px 0;
}

.player-item.active {
    background: #667eea;
    color: white;
    font-weight: bold;
}

#gameStatus {
    font-size: 18px;
    font-weight: bold;
    color: #667eea;
    margin: 10px 0;
}

/* Tic Tac Toe Board */
.board {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    width: 300px;
    padding: 20px;
    background: white;
    border-radius: 15px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.cell {
    width: 80px;
    height: 80px;
    background: #f0f0f0;
    border: 2px solid #ddd;
    border-radius: 8px;
    font-size: 40px;
    font-weight: bold;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s;
    color: #333;
}

.cell:hover {
    background: #e8e8e8;
    transform: scale(1.05);
}

.cell.x {
    color: #667eea;
}

.cell.o {
    color: #764ba2;
}

/* Game Buttons */
.game-buttons {
    display: flex;
    gap: 10px;
    width: 100%;
}

.game-buttons button {
    flex: 1;
    padding: 12px;
}

/* Checkers Board */
.checkers-board {
    width: 100%;
    max-width: 400px;
    padding: 20px;
    background: white;
    border-radius: 15px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

#checkersBoardContainer {
    display: grid;
    grid-template-columns: repeat(8, 1fr);
    gap: 0;
    background: #8B4513;
    padding: 5px;
    border-radius: 8px;
}

.checkers-cell {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    position: relative;
    font-size: 24px;
    font-weight: bold;
}

.checkers-cell.black {
    background: #333;
}

.checkers-cell.white {
    background: #ddd;
}

.checkers-cell.valid-move {
    background: #90EE90;
    box-shadow: inset 0 0 10px rgba(0, 255, 0, 0.5);
}

.checkers-piece {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    cursor: pointer;
    border: 2px solid #000;
    transition: transform 0.2s;
}

.checkers-piece.red {
    background: #FF4444;
    color: #fff;
}

.checkers-piece.white-piece {
    background: #FFFF99;
    color: #333;
}

.checkers-piece.selected {
    transform: scale(1.1);
    box-shadow: 0 0 10px rgba(255, 255, 0, 0.8);
}

#checkersPlayersList {
    font-size: 14px;
    color: #666;
    margin-bottom: 15px;
}

#checkersStatus {
    font-size: 18px;
    font-weight: bold;
    color: #667eea;
    margin: 10px 0;
}

/* УНО Стили */
.uno-container {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.uno-players-list {
    background: rgba(255, 255, 255, 0.1);
    padding: 12px;
    border-radius: 8px;
    color: white;
    font-size: 14px;
}

.uno-game-area {
    display: flex;
    flex-direction: column;
    gap: 20px;
    background: rgba(0, 0, 0, 0.1);
    padding: 20px;
    border-radius: 12px;
}

.uno-deck-area {
    display: flex;
    justify-content: center;
    gap: 60px;
    margin-bottom: 20px;
    align-items: flex-start;
}

.uno-stack {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}

.uno-stack label {
    color: white;
    font-weight: bold;
    font-size: 14px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.uno-pile {
    display: flex;
    justify-content: center;
    align-items: center;
}

.uno-pile-item {
    position: relative;
    cursor: pointer;
}

.draw-pile {
    width: 80px;
    height: 110px;
    background: linear-gradient(135deg, #667eea, #764ba2);
    border: 3px solid white;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: bold;
    font-size: 18px;
}

.draw-pile:hover {
    transform: scale(1.05);
}

.uno-card {
    width: 80px;
    height: 110px;
    background: white;
    border: 3px solid #333;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 24px;
    cursor: pointer;
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.4);
    transition: all 0.2s ease;
}

.uno-card:hover {
    transform: scale(1.08);
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.5);
}

.card-content {
    text-align: center;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

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

.player-hand {
    display: flex;
    justify-content: center;
    gap: 8px;
    flex-wrap: wrap;
    min-height: 130px;
    padding: 10px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 8px;
}

.hand-card {
    width: 70px;
    height: 100px;
    border: 2px solid white;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 20px;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.2);
}

.hand-card:hover {
    transform: scale(1.1) translateY(-10px);
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.3);
}

.hand-card.playable {
    border-color: #f1c40f;
}

.uno-controls {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 15px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 8px;
}

.uno-controls button {
    padding: 12px 20px;
    font-size: 16px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-weight: bold;
    color: white;
    transition: all 0.3s ease;
}

.uno-controls button:hover {
    transform: scale(1.02);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

.uno-controls button:active {
    transform: scale(0.98);
}

#wildcardSelector {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
}

#wildcardSelector button {
    padding: 10px !important;
    font-size: 14px !important;
}

/* Цвета для карт УНО */
.card-red {
    background: linear-gradient(135deg, #e74c3c, #c0392b);
    color: white;
}

.card-blue {
    background: linear-gradient(135deg, #3498db, #2980b9);
    color: white;
}

.card-green {
    background: linear-gradient(135deg, #2ecc71, #27ae60);
    color: white;
}

.card-yellow {
    background: linear-gradient(135deg, #f39c12, #d68910);
    color: white;
}

.card-wild {
    background: linear-gradient(135deg, #9b59b6, #8e44ad);
    color: white;
}

/* Responsive UNO */
@media (max-width: 480px) {
    header h1 {
        font-size: 36px;
    }

    .games-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }

    .board {
        width: 100%;
        max-width: 300px;
    }

    .cell {
        width: 60px;
        height: 60px;
        font-size: 30px;
    }

    .uno-deck-area {
        gap: 20px;
    }

    .player-hand {
        min-height: 110px;
    }

    .hand-card {
        width: 60px;
        height: 90px;
        font-size: 18px;
    }
}
