body {
    margin: 0;
    padding: 0;
    background-color: #050505; /* Deeper space black */
    color: #66fcf1;
    font-family: 'Courier New', Courier, monospace;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh; padding: 20px; box-sizing: border-box;
    background-image:
        radial-gradient(white, rgba(255,255,255,.2) 2px, transparent 40px),
        radial-gradient(white, rgba(255,255,255,.15) 1px, transparent 30px),
        radial-gradient(white, rgba(255,255,255,.1) 2px, transparent 40px);
    background-size: 550px 550px, 350px 350px, 250px 250px;
    background-position: 0 0, 40px 60px, 130px 270px;
}

#game-container {
    display: flex;
    align-items: flex-start; /* Prevent stretching of canvas height */
    gap: 20px;
    background-color: rgba(31, 40, 51, 0.9);
    padding: 20px;
    border-radius: 10px;
    box-shadow: 0 0 20px rgba(102, 252, 241, 0.3), inset 0 0 10px rgba(0,0,0,0.5);
    border: 1px solid #45a29e;
}

#ui-panel {
    width: 250px;
    display: flex;
    flex-direction: column;
    gap: 15px;
}

h1 {
    margin-top: 0;
    font-size: 24px;
    text-transform: uppercase;
    text-shadow: 0 0 8px #66fcf1;
    text-align: center;
    border-bottom: 2px solid #45a29e;
    padding-bottom: 10px;
}

.stats {
    background: #0b0c10;
    padding: 10px;
    border-radius: 5px;
    border: 1px solid #45a29e;
}

.stats p {
    margin: 8px 0;
    font-size: 16px;
    font-weight: bold;
    display: flex;
    justify-content: space-between;
}

.stats span {
    color: #fff;
    text-shadow: 0 0 5px #fff;
}

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

button {
    background-color: #0b0c10;
    color: #45a29e;
    border: 1px solid #45a29e;
    padding: 12px;
    font-size: 14px;
    font-weight: bold;
    font-family: inherit;
    cursor: pointer;
    border-radius: 5px;
    transition: all 0.2s;
    text-align: left;
    position: relative;
    overflow: hidden;
}

button:hover:not(:disabled) {
    background-color: #45a29e;
    color: #0b0c10;
    box-shadow: 0 0 10px #45a29e;
}

button:active:not(:disabled) {
    transform: scale(0.98);
}

button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    border-color: #555;
    color: #555;
}

.tower-btn::before {
    content: '';
    display: inline-block;
    width: 12px;
    height: 12px;
    margin-right: 10px;
    border-radius: 2px;
}

.tower-btn[data-type="laser"]::before { background-color: #ff00ff; box-shadow: 0 0 5px #ff00ff; }
.tower-btn[data-type="plasma"]::before { background-color: #00ffff; box-shadow: 0 0 5px #00ffff; }
.tower-btn[data-type="stasis"]::before { background-color: #ffff00; box-shadow: 0 0 5px #ffff00; }

.tower-btn.selected {
    border-color: #fff;
    color: #fff;
    box-shadow: inset 0 0 10px rgba(255,255,255,0.2), 0 0 5px #fff;
}

#enemy-info {
    font-size: 11px;
    background: #0b0c10;
    padding: 10px;
    border-radius: 5px;
    border: 1px solid #45a29e;
    margin-top: 5px;
}

#enemy-info p {
    margin: 5px 0 0 0;
}

#tower-actions {
    background: #0b0c10;
    padding: 10px;
    border-radius: 5px;
    border: 1px solid #45a29e;
    font-size: 12px;
}

#tower-actions p {
    margin: 5px 0 10px 0;
}

#tower-actions button {
    padding: 8px;
    font-size: 12px;
    width: 100%;
    margin-bottom: 5px;
}

#start-wave-btn {
    margin-top: auto;
    text-align: center;
    background-color: #45a29e;
    color: #0b0c10;
    font-size: 18px;
    text-transform: uppercase;
}

#start-wave-btn:hover:not(:disabled) {
    background-color: #66fcf1;
    box-shadow: 0 0 15px #66fcf1;
}

#game-canvas {
    background-color: #050505;
    border: 2px solid #45a29e;
    cursor: crosshair;
    box-shadow: inset 0 0 20px rgba(69, 162, 158, 0.2);
}

#game-message {
    font-weight: bold;
    color: #ff4c4c;
    text-align: center;
    min-height: 20px;
    text-shadow: 0 0 5px #ff4c4c;
}

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

.modal-content {
    background-color: rgba(31, 40, 51, 0.95);
    padding: 30px;
    border-radius: 10px;
    border: 2px solid #45a29e;
    box-shadow: 0 0 30px rgba(102, 252, 241, 0.4);
    text-align: center;
    width: 400px;
}

.modal-content h2 {
    color: #ff4c4c;
    text-shadow: 0 0 10px #ff4c4c;
    font-size: 32px;
    margin-top: 0;
}

.modal-content h3 {
    color: #66fcf1;
    margin-bottom: 10px;
    border-bottom: 1px solid #45a29e;
    padding-bottom: 5px;
}

#score-input-section {
    display: flex;
    gap: 10px;
    margin: 20px 0;
    justify-content: center;
}

#player-name {
    background: #0b0c10;
    border: 1px solid #45a29e;
    color: #66fcf1;
    padding: 10px;
    font-family: inherit;
    font-size: 16px;
    border-radius: 5px;
    width: 200px;
}

#player-name:focus {
    outline: none;
    box-shadow: 0 0 10px #66fcf1;
}

#high-score-table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 20px;
}

#high-score-table th, #high-score-table td {
    padding: 8px;
    text-align: center;
    border-bottom: 1px solid rgba(69, 162, 158, 0.3);
}

#high-score-table th {
    color: #45a29e;
}

.primary-btn {
    background-color: #45a29e;
    color: #0b0c10;
    font-size: 18px;
    text-transform: uppercase;
    width: 100%;
    padding: 15px;
}

.primary-btn:hover {
    background-color: #66fcf1;
    box-shadow: 0 0 15px #66fcf1;
}
