/* style.css */
body {
    margin: 0;
    padding: 0;
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100vh;
    background-color: #2c3e50;
    /* 어두운 청회색 */
    font-family: 'Malgun Gothic', sans-serif;
    user-select: none;
}

#game-container {
    position: relative;
    width: 1000px;
    height: 600px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
    border-radius: 10px;
    overflow: hidden;
    background-color: #87ceeb;
    /* 하늘 배경 (낮) */
}

#game-canvas {
    display: block;
    cursor: crosshair;
    /* 짓거나 부술 때 타겟용 마우스 커서 */
}

/* UI Layer */
#ui-layer {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    /* 클릭 통과 */
    z-index: 10;
}

#hud {
    position: absolute;
    top: 10px;
    left: 10px;
    right: 10px;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
}

.team-status {
    background: rgba(0, 0, 0, 0.7);
    padding: 10px 15px;
    border-radius: 8px;
    color: white;
    font-size: 16px;
    display: flex;
    flex-direction: column;
    gap: 5px;
    min-width: 150px;
}

.blue-team {
    border-left: 5px solid #1976d2;
}

.red-team {
    border-right: 5px solid #d32f2f;
    text-align: right;
}

.team-name {
    font-weight: bold;
    font-size: 18px;
}

.resources-hud {
    background: rgba(0, 0, 0, 0.7);
    padding: 10px 20px;
    border-radius: 8px;
    display: flex;
    gap: 20px;
    color: white;
    font-weight: bold;
    font-size: 18px;
}

.r-iron {
    color: #cfd8dc;
}

.r-gold {
    color: #fbc02d;
}

.r-emerald {
    color: #4caf50;
}

/* Shop Modal */
.modal {
    display: none;
    /* JS로 제어 (.show 추가) */
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(33, 33, 33, 0.95);
    padding: 30px;
    border-radius: 15px;
    border: 3px solid #ffb300;
    color: white;
    z-index: 30;
    pointer-events: auto;
    /* 상점은 클릭 가능해야 함 */
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.8);
    width: 400px;
}

.modal.show {
    display: block;
}

.modal-content h2 {
    margin-top: 0;
    color: #ffb300;
    text-align: center;
}

.shop-items {
    display: flex;
    flex-direction: column;
    gap: 15px;
    margin-bottom: 20px;
}

.shop-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(255, 255, 255, 0.1);
    padding: 10px 15px;
    border-radius: 8px;
}

.buy-btn {
    padding: 8px 12px;
    background: #4caf50;
    border: none;
    border-radius: 5px;
    color: white;
    font-weight: bold;
    cursor: pointer;
}

.buy-btn:hover {
    background: #388e3c;
}

.buy-btn:disabled {
    background: #555;
    cursor: not-allowed;
}

#close-shop-btn {
    width: 100%;
    padding: 10px;
    background: #d32f2f;
    border: none;
    border-radius: 5px;
    color: white;
    font-weight: bold;
    cursor: pointer;
}

#close-shop-btn:hover {
    background: #b71c1c;
}

/* Announcement */
#announcement {
    position: absolute;
    top: 30%;
    width: 100%;
    text-align: center;
    font-size: 36px;
    font-weight: bold;
    color: yellow;
    text-shadow: 2px 2px 5px black;
    opacity: 0;
    transition: opacity 0.5s;
}

/* Screens */
.screen {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.8);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    color: white;
    z-index: 40;
    opacity: 0;
    visibility: hidden;
    pointer-events: auto;
    transition: opacity 0.3s;
}

.screen.active {
    opacity: 1;
    visibility: visible;
}

.screen h1 {
    font-size: 48px;
    margin-bottom: 20px;
    text-shadow: 2px 2px 5px black;
}

.screen p {
    font-size: 20px;
    text-align: center;
    margin-bottom: 30px;
    line-height: 1.5;
}

.action-btn {
    padding: 15px 30px;
    font-size: 20px;
    font-weight: bold;
    background: #ff4081;
    border: none;
    border-radius: 8px;
    color: white;
    cursor: pointer;
    margin: 10px;
    transition: 0.2s;
}

.action-btn:hover {
    background: #f50057;
    transform: scale(1.05);
}