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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: #000000;
    min-height: 100vh;
    color: #333;
    margin: 0;
    padding: 0;
}

.container {
    width: 100%;
    min-height: 100vh;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
}

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

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

.subtitle {
    font-size: 1.2em;
    opacity: 0.9;
}

main {
    background: white;
    border-radius: 20px;
    padding: 80px 40px 40px;
    box-shadow: 0 10px 50px rgba(0, 0, 0, 0.2);
    margin: 20px;
    position: relative;
}

/* Главное меню */
.main-menu {
    background: transparent;
    border-radius: 0;
    padding: 0;
    margin: 0;
    box-shadow: none;
    text-align: center;
    display: flex;
    align-items: center;
    justify-content: center;
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: 1000;
}

.menu-buttons {
    display: flex;
    flex-direction: column;
    gap: 30px;
    justify-content: center;
    align-items: center;
    max-width: 400px;
    width: 400px;
    margin: 0 auto;
}

.menu-btn {
    width: 400px;
    height: 160px;
    padding: 40px 30px;
    background: transparent;
    color: #00d4ff;
    border: 3px solid #00d4ff;
    border-radius: 15px;
    cursor: pointer;
    transition: all 0.3s;
    box-shadow: 0 0 20px rgba(0, 212, 255, 0.5);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.menu-btn:hover {
    background: rgba(0, 212, 255, 0.1);
    transform: translateY(-5px);
    box-shadow: 0 0 40px rgba(0, 212, 255, 0.8), 0 10px 30px rgba(0, 212, 255, 0.6);
}

.btn-icon {
    display: block;
    font-size: 4em;
    margin-bottom: 15px;
    color: #00d4ff;
    filter: drop-shadow(0 0 10px rgba(0, 212, 255, 0.8));
}

.btn-icon svg {
    width: 80px;
    height: 80px;
    filter: drop-shadow(0 0 10px rgba(0, 212, 255, 0.8));
}

.btn-text {
    display: block;
    font-size: 1.5em;
    font-weight: bold;
    color: #00d4ff;
    text-shadow: 0 0 10px rgba(0, 212, 255, 0.6);
}

.back-button-container {
    margin-bottom: 20px;
}

.close-btn {
    position: absolute;
    top: 20px;
    left: 20px;
    width: 50px;
    height: 50px;
    background: transparent;
    border: 3px solid #00d4ff;
    border-radius: 8px;
    color: #00d4ff;
    font-size: 28px;
    cursor: pointer;
    transition: all 0.3s;
    box-shadow: 0 0 15px rgba(0, 212, 255, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    line-height: 1;
}

.close-btn:hover {
    background: rgba(0, 212, 255, 0.2);
    box-shadow: 0 0 25px rgba(0, 212, 255, 0.8);
    transform: rotate(90deg);
}

.btn-back {
    background: #6c757d;
    color: white;
    padding: 12px 24px;
    font-size: 1em;
}

.btn-back:hover {
    background: #5a6268;
}

.game-section {
    display: grid;
    grid-template-columns: 1fr 400px;
    gap: 40px;
    margin-bottom: 50px;
}

.board-container {
    display: flex;
    justify-content: center;
    align-items: center;
}

#chessboard {
    display: grid;
    grid-template-columns: repeat(8, 70px);
    grid-template-rows: repeat(8, 70px);
    border: 4px solid #333;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.3);
}

#editor-board {
    display: grid;
    grid-template-columns: repeat(8, 70px);
    grid-template-rows: repeat(8, 70px);
    border: 4px solid #333;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.3);
}

.square {
    width: 70px;
    height: 70px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 50px;
    cursor: pointer;
    transition: all 0.2s;
    user-select: none;
}

.square.light {
    background-color: #f0d9b5;
}

.square.dark {
    background-color: #b58863;
}

.square:hover {
    filter: brightness(0.9);
}

.square.selected {
    background-color: #baca44 !important;
    box-shadow: inset 0 0 10px rgba(0, 0, 0, 0.3);
}

.square.valid-move {
    background-color: #9acd32 !important;
}

.controls {
    background: #f8f9fa;
    padding: 30px;
    border-radius: 15px;
}

.game-info {
    margin-bottom: 30px;
}

.game-info h2 {
    font-size: 1.5em;
    margin-bottom: 15px;
    color: #667eea;
}

.game-info p {
    margin: 10px 0;
    font-size: 1.1em;
}

#current-player, #game-status {
    color: #764ba2;
    font-weight: bold;
}

.buttons {
    display: flex;
    gap: 10px;
    margin-bottom: 30px;
}

.btn {
    flex: 1;
    padding: 15px 25px;
    font-size: 1em;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s;
    font-weight: bold;
}

.btn-primary {
    background: transparent;
    color: #00d4ff;
    border-color: #00d4ff;
}

.btn-primary:hover {
    background: rgba(0, 212, 255, 0.1);
    box-shadow: 0 0 40px rgba(0, 212, 255, 0.8);
}

.btn-secondary {
    background: transparent;
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.1);
    transform: translateY(-2px);
}

.moves-history {
    background: white;
    padding: 20px;
    border-radius: 10px;
    max-height: 300px;
    overflow-y: auto;
}

.moves-history h3 {
    margin-bottom: 15px;
    color: #667eea;
}

#moves-list {
    font-family: monospace;
    font-size: 0.95em;
    line-height: 1.8;
}

.move-item {
    padding: 5px;
    border-bottom: 1px solid #eee;
}

.about {
    margin-top: 50px;
}

.about h2 {
    font-size: 2em;
    margin-bottom: 20px;
    color: #667eea;
    text-align: center;
}

.about > p {
    text-align: center;
    font-size: 1.1em;
    margin-bottom: 40px;
    line-height: 1.6;
}

.features {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 30px;
    margin-top: 30px;
}

.feature {
    background: #f8f9fa;
    padding: 30px;
    border-radius: 15px;
    text-align: center;
    transition: transform 0.3s;
}

.feature:hover {
    transform: translateY(-5px);
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.1);
}

.feature h3 {
    font-size: 1.5em;
    margin-bottom: 15px;
    color: #764ba2;
}

.feature p {
    color: #666;
    line-height: 1.6;
}

footer {
    text-align: center;
    color: white;
    padding: 30px;
    margin-top: 40px;
}

/* Редактор карт */
#editor-container {
    background: white;
    border-radius: 20px;
    padding: 80px 40px 40px;
    box-shadow: 0 10px 50px rgba(0, 0, 0, 0.2);
    margin: 20px;
    position: relative;
}

/* Страница выбора игры */
#game-select-container {
    background: transparent;
    border-radius: 0;
    padding: 80px 40px 40px;
    box-shadow: none;
    margin: 20px;
    max-width: 800px;
    margin-left: auto;
    margin-right: auto;
    position: relative;
}

.game-select-section h2 {
    font-size: 2em;
    margin-bottom: 30px;
    color: #00d4ff;
    text-align: center;
    text-shadow: 0 0 10px rgba(0, 212, 255, 0.6);
}

.create-game-section {
    margin-bottom: 40px;
    text-align: center;
}

.btn-large {
    padding: 20px 40px;
    font-size: 1.3em;
    width: 100%;
    max-width: 500px;
    background: transparent;
    color: #00d4ff;
    border: 3px solid #00d4ff;
    box-shadow: 0 0 20px rgba(0, 212, 255, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-large * {
    color: #00d4ff;
}

.btn-large:hover {
    background: rgba(0, 212, 255, 0.1);
    box-shadow: 0 0 40px rgba(0, 212, 255, 0.8);
}

.btn-icon-small {
    margin-right: 10px;
    font-size: 3em;
    color: #00d4ff !important;
    font-weight: bold;
}

.ongoing-games-section h3 {
    font-size: 1.5em;
    margin-bottom: 20px;
    color: #00d4ff;
    border-bottom: 2px solid #00d4ff;
    padding-bottom: 10px;
    text-shadow: 0 0 10px rgba(0, 212, 255, 0.6);
}

.games-list {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.game-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    background: transparent;
    border-left: 5px solid;
    border-top: 2px solid;
    border-right: 2px solid;
    border-bottom: 2px solid;
    border-radius: 10px;
    transition: all 0.3s;
}

.game-item:hover {
    background: rgba(255, 255, 255, 0.05);
    transform: translateX(5px);
}

.game-info {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.game-actions {
    display: flex;
    gap: 10px;
}

.game-name {
    font-size: 1.2em;
    font-weight: bold;
    color: #00d4ff;
}

.game-status {
    font-size: 0.9em;
    color: #66e0ff;
}

.btn-small {
    padding: 10px 20px;
    font-size: 1em;
    background: transparent;
    border: 2px solid;
}

.btn-small:hover {
    background: rgba(255, 255, 255, 0.1);
}

/* Модальное окно */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
}

.modal-content {
    background: #1a1a1a;
    border: 3px solid #00d4ff;
    border-radius: 15px;
    padding: 40px;
    max-width: 500px;
    width: 90%;
    position: relative;
    box-shadow: 0 0 40px rgba(0, 212, 255, 0.6);
}

.modal-content h2 {
    color: #00d4ff;
    margin-bottom: 30px;
    text-align: center;
    text-shadow: 0 0 10px rgba(0, 212, 255, 0.6);
}

.modal-close {
    position: absolute;
    top: 15px;
    left: 15px;
}

.form-group {
    margin-bottom: 25px;
}

.form-group label {
    display: block;
    color: #00d4ff;
    margin-bottom: 10px;
    font-size: 1.1em;
}

.form-input {
    width: 100%;
    padding: 12px;
    background: transparent;
    border: 2px solid #00d4ff;
    border-radius: 8px;
    color: #00d4ff;
    font-size: 1.1em;
    box-shadow: 0 0 10px rgba(0, 212, 255, 0.3);
}

.form-input:focus {
    outline: none;
    box-shadow: 0 0 20px rgba(0, 212, 255, 0.6);
}

.form-input::placeholder {
    color: rgba(0, 212, 255, 0.5);
}

.color-picker {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
}

.color-option {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.3s;
    border: 3px solid transparent;
}

.color-option:hover {
    transform: scale(1.2);
    box-shadow: 0 0 20px currentColor;
}

.color-option.selected {
    border: 3px solid white;
    box-shadow: 0 0 20px currentColor;
}

.modal-actions {
    margin-top: 30px;
    display: flex;
    justify-content: center;
}

.btn-danger {
    background: transparent;
    color: #ff4444;
    border: 2px solid #ff4444;
}

.btn-danger:hover {
    background: rgba(255, 68, 68, 0.2);
    box-shadow: 0 0 20px rgba(255, 68, 68, 0.5);
}

.editor-section h2 {
    font-size: 2em;
    margin-bottom: 10px;
    color: #667eea;
    text-align: center;
}

.editor-description {
    text-align: center;
    margin-bottom: 30px;
    color: #666;
    font-size: 1.1em;
}

.editor-content {
    display: grid;
    grid-template-columns: 1fr 400px;
    gap: 40px;
}

.editor-controls {
    background: #f8f9fa;
    padding: 30px;
    border-radius: 15px;
}

.editor-controls h3 {
    margin-bottom: 20px;
    color: #667eea;
}

.pieces-palette {
    margin-bottom: 30px;
}

.palette-section {
    margin-bottom: 25px;
}

.palette-section h4 {
    margin-bottom: 10px;
    color: #764ba2;
}

.pieces-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
}

.piece-btn {
    background: white;
    border: 2px solid #ddd;
    border-radius: 8px;
    font-size: 40px;
    padding: 15px;
    cursor: pointer;
    transition: all 0.2s;
}

.piece-btn:hover {
    border-color: #667eea;
    transform: scale(1.1);
}

.piece-btn.selected {
    border-color: #667eea;
    background: #f0f4ff;
    box-shadow: 0 0 10px rgba(102, 126, 234, 0.3);
}

.editor-actions {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

@media (max-width: 1024px) {
    .game-section {
        grid-template-columns: 1fr;
    }
    
    .editor-content {
        grid-template-columns: 1fr;
    }
    
    #chessboard {
        grid-template-columns: repeat(8, 60px);
        grid-template-rows: repeat(8, 60px);
    }
    
    .square {
        width: 60px;
        height: 60px;
        font-size: 45px;
    }
}

@media (max-width: 768px) {
    header h1 {
        font-size: 2em;
    }
    
    main {
        padding: 20px;
    }
    
    #chessboard {
        grid-template-columns: repeat(8, 45px);
        grid-template-rows: repeat(8, 45px);
    }
    
    .square {
        width: 45px;
        height: 45px;
        font-size: 35px;
    }
    
    .buttons {
        flex-direction: column;
    }
}

/* Выбор типа игры */
.game-type-selector {
    display: flex;
    gap: 10px;
    margin-top: 10px;
}

.game-type-btn {
    flex: 1;
    opacity: 0.7;
    transition: all 0.3s;
    background: transparent !important;
    border: 2px solid #00d4ff !important;
    color: #00d4ff !important;
}

.game-type-btn.active {
    opacity: 1;
    background: rgba(0, 212, 255, 0.3) !important;
    box-shadow: 0 0 15px rgba(0, 212, 255, 0.5);
}

/* Модальное окно ожидания */
.waiting-info {
    text-align: center;
    padding: 20px;
}

.spinner {
    width: 60px;
    height: 60px;
    border: 4px solid rgba(0, 212, 255, 0.3);
    border-top-color: #00d4ff;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 20px auto;
}

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

.room-code-display {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
    margin: 20px 0;
    padding: 15px;
    background: rgba(0, 212, 255, 0.1);
    border: 2px solid #00d4ff;
    border-radius: 10px;
}

#room-code-text {
    font-size: 2em;
    font-weight: bold;
    color: #00d4ff;
    letter-spacing: 5px;
}

.waiting-status {
    color: #00d4ff;
    font-size: 1.1em;
    margin-top: 20px;
}

/* Статус подключения */
.connection-status {
    position: absolute;
    top: 70px;
    right: 20px;
    padding: 10px 20px;
    background: rgba(0, 0, 0, 0.8);
    border: 2px solid;
    border-radius: 10px;
    font-size: 0.9em;
    z-index: 100;
}

.connection-status.connected {
    border-color: #44ff44;
    color: #44ff44;
}

.connection-status.waiting {
    border-color: #ffff44;
    color: #ffff44;
}

.connection-status.disconnected {
    border-color: #ff4444;
    color: #ff4444;
}
