* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
    color: #fff;
    overflow: hidden;
    height: 100vh;
}

#game-container {
    position: relative;
    width: 100vw;
    height: 100vh;
}

/* Exit Button (Top Right Corner) */
.exit-btn {
    position: absolute;
    top: 20px;
    right: 20px;
    z-index: 100;
    width: 50px;
    height: 50px;
    background: rgba(0, 0, 0, 0.7);
    border: 2px solid #ef4444;
    border-radius: 50%;
    color: #ef4444;
    font-size: 28px;
    font-weight: 300;
    cursor: pointer;
    transition: all 0.3s;
    pointer-events: auto;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

.exit-btn:hover {
    background: #ef4444;
    color: white;
    transform: rotate(90deg) scale(1.1);
    box-shadow: 0 0 20px rgba(239, 68, 68, 0.5);
}

/* Exit Modal */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    backdrop-filter: blur(5px);
}

.modal.hidden {
    display: none;
}

.modal-content {
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
    border: 2px solid #3b82f6;
    border-radius: 20px;
    padding: 40px;
    max-width: 500px;
    text-align: center;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

.modal-content h2 {
    font-size: 28px;
    margin-bottom: 20px;
    color: #ef4444;
}

.modal-content p {
    font-size: 16px;
    color: #9ca3af;
    margin-bottom: 30px;
    line-height: 1.6;
}

.modal-buttons {
    display: flex;
    gap: 15px;
    justify-content: center;
}

.btn {
    padding: 12px 24px;
    border-radius: 10px;
    font-weight: 600;
    font-size: 16px;
    cursor: pointer;
    transition: all 0.3s;
    border: 2px solid transparent;
}

.btn-danger {
    background: linear-gradient(135deg, #ef4444, #dc2626);
    color: white;
    border: none;
}

.btn-danger:hover {
    transform: translateY(-3px);
    box-shadow: 0 10px 30px rgba(239, 68, 68, 0.4);
}

.btn-secondary {
    background: transparent;
    border-color: #3b82f6;
    color: #3b82f6;
}

.btn-secondary:hover {
    background: #3b82f6;
    color: white;
}

#game-canvas {
    display: block;
    width: 100%;
    height: 100%;
    cursor: crosshair;
}

/* HUD Styles */
#hud {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    pointer-events: none;
    z-index: 10;
}

#turn-display {
    position: absolute;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.7);
    padding: 10px 30px;
    border-radius: 5px;
    font-size: 18px;
    font-weight: bold;
    text-align: center;
    min-width: 250px;
}

#turn-display.your-turn {
    color: #4ade80;
    border: 2px solid #4ade80;
}

#turn-display.waiting {
    color: #ffffff;
    border: 2px solid #888;
}

#identity-display {
    position: absolute;
    top: 70px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.7);
    padding: 8px 20px;
    border-radius: 5px;
    font-size: 14px;
    text-align: center;
}

#stats-display {
    position: absolute;
    top: 20px;
    left: 20px;
    background: rgba(0, 0, 0, 0.7);
    padding: 10px 20px;
    border-radius: 5px;
    font-size: 16px;
    border: 2px solid #3b82f6;
}

#error-display {
    position: absolute;
    bottom: 100px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(255, 193, 7, 0.9);
    color: #000;
    padding: 10px 20px;
    border-radius: 5px;
    font-size: 14px;
    font-weight: bold;
    display: none;
    max-width: 80%;
    text-align: center;
}

#error-display.show {
    display: block;
}

/* Purchase Menu */
#purchase-menu {
    position: absolute;
    top: 50%;
    right: 50px;
    transform: translateY(-50%);
    background: rgba(0, 0, 0, 0.9);
    border: 2px solid #3b82f6;
    border-radius: 10px;
    padding: 20px;
    min-width: 200px;
    z-index: 20;
    pointer-events: auto;
}

#purchase-menu.hidden {
    display: none;
}

#purchase-menu h3 {
    margin-bottom: 15px;
    text-align: center;
    color: #3b82f6;
}

.purchase-btn {
    width: 100%;
    background: rgba(59, 130, 246, 0.2);
    border: 2px solid #3b82f6;
    color: #fff;
    padding: 12px;
    margin-bottom: 10px;
    border-radius: 5px;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: all 0.2s;
    font-size: 14px;
}

.purchase-btn:hover {
    background: rgba(59, 130, 246, 0.4);
    transform: scale(1.05);
}

.purchase-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

.piece-name {
    font-weight: bold;
}

.piece-cost {
    color: #ffd700;
}

.cancel-btn {
    width: 100%;
    background: rgba(239, 68, 68, 0.3);
    border: 2px solid #ef4444;
    color: #fff;
    padding: 10px;
    border-radius: 5px;
    cursor: pointer;
    transition: all 0.2s;
}

.cancel-btn:hover {
    background: rgba(239, 68, 68, 0.5);
}

/* Instructions */
#instructions {
    position: absolute;
    bottom: 20px;
    left: 20px;
    background: rgba(0, 0, 0, 0.7);
    padding: 15px 20px;
    border-radius: 5px;
    font-size: 12px;
    max-width: 300px;
    pointer-events: none;
}

#instructions h4 {
    margin-bottom: 10px;
    color: #3b82f6;
}

#instructions ul {
    list-style: none;
    padding-left: 0;
}

#instructions li {
    margin-bottom: 5px;
    line-height: 1.4;
}

#instructions strong {
    color: #4ade80;
}

/* Responsive */
@media (max-width: 768px) {
    #purchase-menu {
        right: 10px;
        left: 10px;
        top: auto;
        bottom: 20px;
        transform: none;
    }

    #instructions {
        display: none;
    }

    #stats-display {
        font-size: 12px;
        padding: 8px 12px;
    }
}
