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

body {
    font-family: "Microsoft YaHei", "PingFang SC", sans-serif;
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
    min-height: 100vh;
    color: #fff;
}

.container {
    max-width: 800px;
    margin: 0 auto;
    padding: 20px;
}

header {
    text-align: center;
    margin-bottom: 30px;
}

header h1 {
    font-size: 2.5em;
    color: #e94560;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
}

.subtitle {
    color: #aaa;
    margin-top: 5px;
}

/* Buttons */
.btn {
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-family: inherit;
}

.btn-primary {
    background: #e94560;
    color: white;
}

.btn-primary:hover {
    background: #ff6b6b;
    transform: translateY(-2px);
}

.btn-secondary {
    background: #0f3460;
    color: white;
    border: 2px solid #e94560;
}

.btn-secondary:hover {
    background: #1a4980;
}

.btn-danger {
    background: #c0392b;
    color: white;
}

.btn-danger:hover {
    background: #e74c3c;
}

/* Screens */
.screen {
    display: block;
}

.hidden {
    display: none !important;
}

/* Lobby */
.lobby-content {
    text-align: center;
    background: rgba(255, 255, 255, 0.05);
    padding: 40px;
    border-radius: 16px;
    backdrop-filter: blur(10px);
}

.lobby-content h2 {
    margin-bottom: 15px;
    color: #fff;
}

.rule-hint {
    color: #aaa;
    margin-bottom: 30px;
    font-size: 14px;
}

.lobby-buttons {
    display: flex;
    gap: 20px;
    justify-content: center;
    margin-bottom: 40px;
}

.join-room {
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    padding-top: 30px;
}

.join-room h3 {
    margin-bottom: 15px;
    color: #ccc;
}

.join-input {
    display: flex;
    gap: 10px;
    justify-content: center;
}

.join-input input {
    padding: 12px 20px;
    font-size: 18px;
    border: 2px solid #0f3460;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.1);
    color: white;
    text-transform: uppercase;
    letter-spacing: 4px;
    width: 150px;
    text-align: center;
}

.join-input input::placeholder {
    color: #666;
    letter-spacing: 0;
}

/* Waiting */
.waiting-content {
    text-align: center;
    background: rgba(255, 255, 255, 0.05);
    padding: 60px 40px;
    border-radius: 16px;
}

#waitingMessage {
    font-size: 1.5em;
    margin-bottom: 20px;
}

.room-code {
    font-size: 3em;
    letter-spacing: 10px;
    color: #e94560;
    font-weight: bold;
    margin-bottom: 30px;
}

/* Game */
.game-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 12px;
    margin-bottom: 20px;
}

.player-info {
    display: flex;
    align-items: center;
    gap: 10px;
}

.player-label {
    font-weight: bold;
}

#blackInfo .player-label {
    color: #333;
    background: #ccc;
    padding: 5px 15px;
    border-radius: 20px;
}

#redInfo .player-label {
    color: white;
    background: #e94560;
    padding: 5px 15px;
    border-radius: 20px;
}

.turn-indicator {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: #333;
}

.turn-indicator.active {
    background: #4ade80;
    animation: pulse 1s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

.game-status {
    font-size: 1.2em;
    color: #fbbf24;
}

.board-container {
    display: flex;
    justify-content: center;
    margin-bottom: 20px;
}

#boardCanvas {
    border-radius: 8px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
}

.piece-info {
    background: rgba(255, 255, 255, 0.05);
    padding: 15px 20px;
    border-radius: 12px;
    margin-bottom: 20px;
    min-height: 50px;
}

.piece-info-content {
    display: flex;
    gap: 20px;
    align-items: center;
}

#selectedPieceType {
    font-weight: bold;
    color: #e94560;
}

#selectedPieceAbilities {
    color: #4ade80;
}

.game-controls {
    display: flex;
    gap: 15px;
    justify-content: center;
}

/* Modal */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.modal-content {
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
    padding: 40px;
    border-radius: 16px;
    text-align: center;
    border: 2px solid #e94560;
}

.modal-content h2 {
    margin-bottom: 15px;
    color: #e94560;
}

.modal-content p {
    margin-bottom: 25px;
    font-size: 1.2em;
}

.modal-buttons {
    display: flex;
    gap: 15px;
    justify-content: center;
    margin-bottom: 15px;
}

.rematch-status {
    color: #4ade80;
    font-size: 0.9em;
}

/* Responsive */
@media (max-width: 600px) {
    .container {
        padding: 10px;
    }

    header h1 {
        font-size: 2em;
    }

    .lobby-buttons {
        flex-direction: column;
    }

    #boardCanvas {
        width: 100%;
        height: auto;
    }
}
