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

body {
    font-family: 'Courier New', monospace;
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 50%, #0f3460 100%);
    color: #ffffff;
    min-height: 100vh;
    overflow-x: hidden;
}

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

.game-header {
    text-align: center;
    margin-bottom: 20px;
    background: rgba(0, 0, 0, 0.8);
    padding: 20px;
    border-radius: 15px;
    border: 2px solid #ff4444;
    box-shadow: 0 0 20px rgba(255, 68, 68, 0.3);
}

.game-header h1 {
    font-size: 2.5em;
    margin-bottom: 15px;
    text-shadow: 0 0 20px #ff4444, 0 0 40px #ff0000;
    animation: flicker 2s infinite alternate;
}

@keyframes flicker {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.8; }
}

.stats {
    display: flex;
    justify-content: space-around;
    flex-wrap: wrap;
    gap: 20px;
}

.stat {
    background: rgba(255, 255, 255, 0.1);
    padding: 10px 20px;
    border-radius: 10px;
    border: 1px solid #666;
    min-width: 120px;
}

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

.game-main {
    display: flex;
    gap: 20px;
    align-items: flex-start;
}

.game-board {
    position: relative;
    flex: 1;
    background: rgba(0, 0, 0, 0.9);
    border-radius: 15px;
    border: 3px solid #444;
    overflow: hidden;
    box-shadow: 0 0 30px rgba(0, 0, 0, 0.8);
}

#gameCanvas {
    display: block;
    background: linear-gradient(45deg, #2c2c54 25%, transparent 25%), 
                linear-gradient(-45deg, #2c2c54 25%, transparent 25%), 
                linear-gradient(45deg, transparent 75%, #2c2c54 75%), 
                linear-gradient(-45deg, transparent 75%, #2c2c54 75%);
    background-size: 20px 20px;
    background-position: 0 0, 0 10px, 10px -10px, -10px 0px;
    cursor: crosshair;
}

.dorm-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

.dorm-room {
    position: absolute;
    width: 120px;
    height: 100px;
    background: rgba(139, 69, 19, 0.8);
    border: 2px solid #8B4513;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: bold;
    color: #fff;
    text-shadow: 1px 1px 2px #000;
    box-shadow: inset 0 0 10px rgba(0, 0, 0, 0.5);
}

.corridor {
    position: absolute;
    background: rgba(105, 105, 105, 0.6);
    border: 1px solid #696969;
}

.corridor.horizontal {
    width: 100%;
    height: 60px;
}

.corridor.vertical {
    width: 60px;
    height: 100%;
}

.control-panel {
    width: 300px;
    background: rgba(0, 0, 0, 0.9);
    border-radius: 15px;
    border: 2px solid #666;
    padding: 20px;
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.8);
}

.control-panel h3 {
    color: #ff4444;
    margin-bottom: 15px;
    text-align: center;
    text-shadow: 0 0 10px #ff4444;
}

.tower-buttons {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-bottom: 20px;
}

.tower-btn {
    background: linear-gradient(135deg, #4a4a4a, #2a2a2a);
    color: white;
    border: 2px solid #666;
    border-radius: 10px;
    padding: 15px;
    cursor: pointer;
    font-size: 12px;
    text-align: center;
    transition: all 0.3s ease;
    font-family: inherit;
}

.tower-btn:hover {
    background: linear-gradient(135deg, #666, #444);
    border-color: #888;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.5);
}

.tower-btn.selected {
    background: linear-gradient(135deg, #ff4444, #cc2222);
    border-color: #ff6666;
    box-shadow: 0 0 15px rgba(255, 68, 68, 0.5);
}

.tower-btn:disabled {
    background: #333;
    color: #666;
    cursor: not-allowed;
    border-color: #444;
}

.action-buttons {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 20px;
}

.action-buttons button {
    background: linear-gradient(135deg, #ff4444, #cc2222);
    color: white;
    border: none;
    border-radius: 8px;
    padding: 12px;
    cursor: pointer;
    font-size: 14px;
    font-weight: bold;
    transition: all 0.3s ease;
    font-family: inherit;
}

.action-buttons button:hover {
    background: linear-gradient(135deg, #ff6666, #ee4444);
    transform: translateY(-1px);
    box-shadow: 0 3px 10px rgba(255, 68, 68, 0.3);
}

.action-buttons button:disabled {
    background: #666;
    cursor: not-allowed;
    transform: none;
}

.game-info, .ghost-info {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 8px;
    padding: 15px;
    margin-bottom: 15px;
    border: 1px solid #444;
}

.game-info h4, .ghost-info h4 {
    color: #ffaa44;
    margin-bottom: 10px;
    text-shadow: 0 0 5px #ffaa44;
}

.game-info p, .ghost-info p {
    font-size: 12px;
    margin-bottom: 5px;
    color: #ccc;
}

.game-messages {
    position: fixed;
    top: 20px;
    right: 20px;
    width: 300px;
    z-index: 1000;
}

#messageBox {
    background: rgba(0, 0, 0, 0.9);
    color: #fff;
    padding: 15px;
    border-radius: 10px;
    border: 2px solid #ff4444;
    box-shadow: 0 0 20px rgba(255, 68, 68, 0.5);
    display: none;
    animation: fadeInOut 3s ease-in-out;
}

@keyframes fadeInOut {
    0% { opacity: 0; transform: translateX(100%); }
    20%, 80% { opacity: 1; transform: translateX(0); }
    100% { opacity: 0; transform: translateX(100%); }
}

.modal {
    display: none;
    position: fixed;
    z-index: 2000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.8);
    animation: fadeIn 0.5s ease-in-out;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.modal-content {
    background: linear-gradient(135deg, #1a1a2e, #16213e);
    margin: 15% auto;
    padding: 40px;
    border: 3px solid #ff4444;
    border-radius: 15px;
    width: 400px;
    text-align: center;
    box-shadow: 0 0 50px rgba(255, 68, 68, 0.5);
    animation: slideIn 0.5s ease-in-out;
}

@keyframes slideIn {
    from { transform: translateY(-50px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

.modal-content h2 {
    color: #ff4444;
    margin-bottom: 20px;
    font-size: 2em;
    text-shadow: 0 0 20px #ff4444;
}

.modal-content p {
    margin-bottom: 30px;
    font-size: 1.2em;
    color: #ccc;
}

.modal-content button {
    background: linear-gradient(135deg, #ff4444, #cc2222);
    color: white;
    border: none;
    border-radius: 10px;
    padding: 15px 30px;
    cursor: pointer;
    font-size: 16px;
    font-weight: bold;
    transition: all 0.3s ease;
    font-family: inherit;
}

.modal-content button:hover {
    background: linear-gradient(135deg, #ff6666, #ee4444);
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(255, 68, 68, 0.5);
}

/* 响应式设计 */
@media (max-width: 768px) {
    .game-main {
        flex-direction: column;
    }
    
    .control-panel {
        width: 100%;
    }
    
    #gameCanvas {
        width: 100%;
        height: 400px;
    }
    
    .stats {
        flex-direction: column;
        align-items: center;
    }
    
    .tower-buttons {
        grid-template-columns: 1fr;
    }
}

/* 添加一些恐怖效果 */
.dorm-room::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: radial-gradient(circle at center, transparent 30%, rgba(0, 0, 0, 0.3) 70%);
    pointer-events: none;
}

/* 鬼魂效果动画 */
@keyframes ghostFloat {
    0%, 100% { transform: translateY(0px) translateX(0px); }
    25% { transform: translateY(-5px) translateX(2px); }
    50% { transform: translateY(0px) translateX(-2px); }
    75% { transform: translateY(5px) translateX(1px); }
}

.ghost {
    animation: ghostFloat 3s ease-in-out infinite;
}

/* 添加血迹效果 */
.blood-effect {
    position: absolute;
    width: 10px;
    height: 10px;
    background: radial-gradient(circle, #ff0000, #880000);
    border-radius: 50%;
    animation: bloodDrop 0.5s ease-out;
}

@keyframes bloodDrop {
    0% { opacity: 1; transform: scale(0); }
    100% { opacity: 0; transform: scale(1); }
} 