* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Courier New', monospace;
    background: #000;
    color: #0ff;
    overflow: hidden;
}

#game-container {
    position: relative;
    width: 100vw;
    height: 100vh;
}

#game-canvas {
    display: block;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #0a0a1a 0%, #1a0a2e 100%);
}

#ui-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

#ui-overlay > * {
    pointer-events: auto;
}

#top-bar {
    position: absolute;
    top: 20px;
    left: 20px;
    display: flex;
    gap: 30px;
    background: rgba(0, 0, 0, 0.7);
    padding: 15px 25px;
    border: 2px solid #0ff;
    box-shadow: 0 0 20px rgba(0, 255, 255, 0.5);
    align-items: center;
    flex-wrap: wrap;
}

.ui-compact-btn {
    padding: 8px 14px;
    font-size: 13px;
    border-width: 2px;
    min-height: 34px;
}

.stat-group {
    display: flex;
    gap: 10px;
}

.label {
    color: #0ff;
    font-weight: bold;
    text-shadow: 0 0 10px rgba(0, 255, 255, 0.8);
}

.value {
    color: #fff;
    font-weight: bold;
    min-width: 36px;
    display: inline-block;
}

#player-health {
    color: #0f0;
    text-shadow: 0 0 10px rgba(0, 255, 0, 0.9);
}

#player-armor {
    color: #ff0;
    text-shadow: 0 0 10px rgba(255, 255, 0, 0.9);
}

#player-shield {
    color: #0ff;
    text-shadow: 0 0 10px rgba(0, 255, 255, 0.9);
}

#controls-help {
    position: absolute;
    bottom: 20px;
    left: 20px;
    background: rgba(0, 0, 0, 0.7);
    padding: 15px 25px;
    border: 2px solid #0ff;
    box-shadow: 0 0 20px rgba(0, 255, 255, 0.5);
}

#controls-help h3 {
    color: #0ff;
    margin-bottom: 10px;
    text-shadow: 0 0 10px rgba(0, 255, 255, 0.8);
}

#controls-help p {
    color: #fff;
    font-size: 14px;
    margin: 5px 0;
}

#shop-panel {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(0, 0, 0, 0.9);
    padding: 30px;
    border: 3px solid #0ff;
    box-shadow: 0 0 30px rgba(0, 255, 255, 0.8);
    width: min(1100px, 92vw);
    max-height: 80vh;
    overflow-y: auto;
}

#shop-panel h2 {
    color: #0ff;
    text-align: center;
    margin-bottom: 20px;
    font-size: 28px;
    text-shadow: 0 0 15px rgba(0, 255, 255, 1);
}

#shop-items {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

#shop-left-column,
#shop-right-column {
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.shop-category h3 {
    color: #f0f;
    margin-bottom: 10px;
    text-shadow: 0 0 10px rgba(255, 0, 255, 0.8);
}

.shop-defense-heading {
    margin-top: 10px;
    font-size: 16px;
    letter-spacing: 1px;
}

.attacking-heading {
    color: #ff6699;
    text-shadow: 0 0 10px rgba(255, 102, 153, 0.7);
}

.structure-heading {
    color: #66e0ff;
    text-shadow: 0 0 10px rgba(102, 224, 255, 0.7);
}

.shop-item {
    display: grid;
    grid-template-columns: 84px minmax(0, 1fr) auto;
    column-gap: 12px;
    align-items: stretch;
    padding: 15px;
    background: rgba(0, 255, 255, 0.1);
    border: 1px solid #0ff;
    cursor: pointer;
    transition: all 0.3s;
}

.shop-item > div {
    display: flex;
    flex-direction: column;
    gap: 5px;
    justify-content: center;
}

.item-preview {
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 34px;
    border: 1px solid rgba(0, 255, 255, 0.8);
    background: rgba(0, 255, 255, 0.08);
    box-shadow: inset 0 0 16px rgba(0, 255, 255, 0.18);
    min-height: 72px;
}

.item-attack-defense .item-preview {
    border-color: rgba(255, 102, 153, 0.8);
    background: rgba(255, 102, 153, 0.1);
    box-shadow: inset 0 0 16px rgba(255, 102, 153, 0.2);
}

.item-structure-defense .item-preview {
    border-color: rgba(102, 224, 255, 0.8);
    background: rgba(102, 224, 255, 0.1);
    box-shadow: inset 0 0 16px rgba(102, 224, 255, 0.2);
}

.shop-item:hover {
    background: rgba(0, 255, 255, 0.3);
    box-shadow: 0 0 15px rgba(0, 255, 255, 0.5);
}

.item-name {
    color: #fff;
}

.item-stats {
    color: #8fd7d7;
    font-size: 12px;
}

.item-cost::before {
    content: '💳 ';
}

.item-cost {
    color: #ff0;
    text-shadow: 0 0 10px rgba(255, 255, 0, 0.8);
}

.shop-item.affordable {
    border-color: #0f0;
}

.shop-item.unaffordable {
    border-color: #f00;
    background: rgba(255, 0, 0, 0.12);
}

.shop-item.unaffordable .item-cost {
    color: #f66;
    text-shadow: 0 0 8px rgba(255, 0, 0, 0.8);
}

.shop-item.locked {
    opacity: 0.45;
    border-style: dashed;
}

.shop-item.sold-out {
    border-color: #f0f;
    background: rgba(255, 0, 255, 0.1);
}

.shop-item.purchased {
    border-color: #0ff;
    background: rgba(0, 255, 255, 0.08);
    opacity: 0.6;
}

.shop-branch {
    position: relative;
    margin-bottom: 8px;
}

.branch-parent {
    position: relative;
}

.branch-parent::after {
    content: '↴';
    position: absolute;
    right: 10px;
    color: #f0f;
    opacity: 0.8;
    font-size: 14px;
}

.branch-children {
    margin-left: 20px;
    padding-left: 16px;
    border-left: 1px solid rgba(255, 0, 255, 0.5);
    display: flex;
    gap: 8px;
    flex-direction: column;
}

.branch-child {
    background: rgba(255, 0, 255, 0.08);
}

#turret-panel {
    position: absolute;
    left: 20px;
    top: 100px;
    width: 320px;
    background: rgba(0, 0, 0, 0.88);
    border: 2px solid #ff0;
    box-shadow: 0 0 22px rgba(255, 255, 0, 0.6);
    padding: 16px;
}

#turret-panel h3 {
    margin-bottom: 10px;
    color: #ff0;
}

#turret-panel-stats {
    color: #fff;
    font-size: 14px;
    margin-bottom: 12px;
    line-height: 1.5;
    white-space: pre-line;
}

.turret-panel-actions {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.turret-panel-actions button {
    font-size: 14px;
    padding: 10px;
}

#close-shop {
    margin-top: 20px;
    width: 100%;
    padding: 15px;
    background: rgba(255, 0, 255, 0.3);
    border: 2px solid #f0f;
    color: #fff;
    cursor: pointer;
    font-family: 'Courier New', monospace;
    font-size: 16px;
    font-weight: bold;
    transition: all 0.3s;
}

#close-shop:hover {
    background: rgba(255, 0, 255, 0.5);
    box-shadow: 0 0 20px rgba(255, 0, 255, 0.8);
}

#wave-notification {
    position: absolute;
    bottom: 14%;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(255, 0, 0, 0.9);
    padding: 22px 34px;
    border: 4px solid #f00;
    box-shadow: 0 0 40px rgba(255, 0, 0, 0.9);
    text-align: center;
    animation: pulse 1s infinite;
}

#wave-notification h2 {
    font-size: 34px;
    color: #fff;
    text-shadow: 0 0 20px rgba(255, 0, 0, 1);
    margin-bottom: 10px;
}

#wave-notification p {
    font-size: 18px;
    color: #fff;
}

@keyframes pulse {
    0%, 100% {
        transform: translateX(-50%) scale(1);
    }
    50% {
        transform: translateX(-50%) scale(1.05);
    }
}

.floating-notification {
    position: absolute;
    bottom: 14%;
    left: 50%;
    transform: translateX(-50%);
    padding: 12px 24px;
    border: 2px solid #0f0;
    color: #fff;
    font-size: 19px;
    font-family: 'Courier New', monospace;
    font-weight: bold;
    z-index: 9999;
    pointer-events: none;
}

.floating-notification.success {
    background: rgba(0, 255, 0, 0.18);
    border-color: #0f0;
    box-shadow: 0 0 24px rgba(0, 255, 0, 0.65);
}

.floating-notification.error {
    background: rgba(255, 0, 0, 0.2);
    border-color: #f00;
    box-shadow: 0 0 24px rgba(255, 0, 0, 0.7);
}

.hidden {
    display: none !important;
}

#main-menu {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #000 0%, #1a0a2e 50%, #0a0a1a 100%);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

#main-menu h1 {
    font-size: 64px;
    color: #0ff;
    text-shadow: 0 0 30px rgba(0, 255, 255, 1);
    margin-bottom: 50px;
    animation: glow 2s infinite;
}

@keyframes glow {
    0%, 100% {
        text-shadow: 0 0 30px rgba(0, 255, 255, 1);
    }
    50% {
        text-shadow: 0 0 50px rgba(0, 255, 255, 1), 0 0 70px rgba(0, 255, 255, 0.8);
    }
}

#menu-buttons, #multiplayer-setup, #instructions {
    display: flex;
    flex-direction: column;
    gap: 20px;
    min-width: 400px;
}

button {
    padding: 20px 40px;
    background: rgba(0, 255, 255, 0.2);
    border: 3px solid #0ff;
    color: #0ff;
    font-family: 'Courier New', monospace;
    font-size: 20px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s;
    text-shadow: 0 0 10px rgba(0, 255, 255, 0.8);
}

button:hover {
    background: rgba(0, 255, 255, 0.4);
    box-shadow: 0 0 30px rgba(0, 255, 255, 0.8);
    transform: scale(1.05);
}

input {
    padding: 15px;
    background: rgba(0, 0, 0, 0.7);
    border: 2px solid #0ff;
    color: #0ff;
    font-family: 'Courier New', monospace;
    font-size: 16px;
}

input::placeholder {
    color: rgba(0, 255, 255, 0.5);
}

input:focus {
    outline: none;
    box-shadow: 0 0 20px rgba(0, 255, 255, 0.5);
}

#multiplayer-setup h2, #instructions h2 {
    color: #f0f;
    text-align: center;
    margin-bottom: 20px;
    text-shadow: 0 0 20px rgba(255, 0, 255, 0.8);
}

#multiplayer-setup p {
    color: #9fd;
    text-align: center;
    line-height: 1.4;
}

#multiplayer-actions {
    display: flex;
    gap: 12px;
}

#multiplayer-actions button {
    flex: 1;
}

#multiplayer-default-endpoint {
    color: #0ff;
    font-size: 13px;
}

#multiplayer-advanced {
    border: 1px solid rgba(0, 255, 255, 0.5);
    padding: 10px;
    background: rgba(0, 0, 0, 0.35);
}

#multiplayer-advanced summary {
    color: #9fd;
    cursor: pointer;
    margin-bottom: 10px;
}

#instructions p {
    color: #fff;
    line-height: 1.6;
    margin-bottom: 10px;
    text-align: center;
}
