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

body {
    font-family: 'Arial', sans-serif;
    overflow: hidden;
    background: #000;
}

canvas {
    display: block;
    width: 100%;
    height: 100%;
}

#loading-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    color: white;
    z-index: 1000;
    cursor: pointer;
}

#loading-screen h1 {
    font-size: 48px;
    margin-bottom: 20px;
}

#loading-screen p {
    font-size: 24px;
    animation: blink 1.5s infinite;
}

@keyframes blink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.3; }
}

#loading-screen.hidden {
    display: none;
}

#game-ui {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

/* 크로스헤어 */
#crosshair {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 40px;
    height: 40px;
}

#crosshair.aiming {
    width: 20px;
    height: 20px;
}

.crosshair-line {
    position: absolute;
    background: rgba(255, 255, 255, 0.8);
}

.crosshair-line.horizontal {
    width: 100%;
    height: 2px;
    top: 50%;
    transform: translateY(-50%);
}

.crosshair-line.vertical {
    width: 2px;
    height: 100%;
    left: 50%;
    transform: translateX(-50%);
}

/* HUD */
#hud {
    position: absolute;
    top: 20px;
    right: 20px;
    color: white;
    font-size: 18px;
    text-align: right;
}

#health-bar {
    position: absolute;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%);
    text-align: center;
}

.hud-label {
    font-size: 14px;
    margin-bottom: 5px;
    color: #aaa;
}

.bar-container {
    width: 300px;
    height: 30px;
    background: rgba(0, 0, 0, 0.7);
    border: 2px solid #fff;
    border-radius: 5px;
    overflow: hidden;
    margin-bottom: 5px;
}

.bar-fill {
    height: 100%;
    background: linear-gradient(90deg, #ff0000, #ff6b6b);
    transition: width 0.3s ease;
    width: 100%;
}

#health-text {
    font-size: 16px;
}

#ammo-display {
    display: flex;
    align-items: baseline;
    justify-content: flex-end;
    font-size: 36px;
    font-weight: bold;
    margin-bottom: 10px;
}

#current-ammo {
    color: #fff;
}

#ammo-separator {
    margin: 0 10px;
    color: #888;
}

#reserve-ammo {
    color: #888;
    font-size: 24px;
}

#weapon-info {
    margin-top: 10px;
}

#weapon-name {
    font-size: 20px;
    color: #4CAF50;
    font-weight: bold;
}

#money-display {
    color: gold;
    font-size: 24px;
    font-weight: bold;
    pointer-events: none;
    margin-bottom: 15px;
}

/* 무기 상점 */
#weapon-shop {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(0, 0, 0, 0.95);
    padding: 40px;
    border-radius: 10px;
    border: 3px solid #4CAF50;
    color: white;
    pointer-events: auto;
    min-width: 600px;
}

#weapon-shop.hidden {
    display: none;
}

#weapon-shop h2 {
    text-align: center;
    margin-bottom: 30px;
    font-size: 32px;
    color: #4CAF50;
}

.shop-items {
    display: flex;
    gap: 20px;
    justify-content: center;
    margin-bottom: 30px;
}

.shop-item {
    background: rgba(255, 255, 255, 0.1);
    padding: 20px;
    border-radius: 8px;
    border: 2px solid #555;
    text-align: center;
    flex: 1;
    max-width: 200px;
}

.shop-item h3 {
    margin-bottom: 15px;
    color: #4CAF50;
}

.shop-item p {
    margin: 5px 0;
    font-size: 14px;
}

.shop-item.owned {
    border-color: #4CAF50;
    background: rgba(76, 175, 80, 0.2);
}

.buy-button {
    margin-top: 15px;
    padding: 10px 20px;
    background: #4CAF50;
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 16px;
    font-weight: bold;
    pointer-events: auto;
}

.buy-button:hover {
    background: #45a049;
}

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

#close-shop {
    display: block;
    margin: 0 auto;
    padding: 12px 30px;
    background: #f44336;
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 18px;
    font-weight: bold;
    pointer-events: auto;
}

#close-shop:hover {
    background: #da190b;
}

/* 게임 메시지 */
#game-messages {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
    pointer-events: none;
}

.game-message {
    background: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 20px 40px;
    border-radius: 10px;
    font-size: 24px;
    font-weight: bold;
    margin: 10px 0;
    animation: fadeInOut 2s ease;
}

@keyframes fadeInOut {
    0% { opacity: 0; transform: translateY(-20px); }
    20% { opacity: 1; transform: translateY(0); }
    80% { opacity: 1; transform: translateY(0); }
    100% { opacity: 0; transform: translateY(20px); }
}

.damage-number {
    position: absolute;
    color: #ff0000;
    font-size: 32px;
    font-weight: bold;
    pointer-events: none;
    animation: damageFloat 1s ease-out;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.8);
}

.damage-number.headshot {
    color: #ffff00;
    font-size: 48px;
}

@keyframes damageFloat {
    0% { opacity: 1; transform: translateY(0); }
    100% { opacity: 0; transform: translateY(-50px); }
}

/* 게임 오버 화면 */
#game-over-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.95);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    color: white;
    z-index: 2000;
    pointer-events: auto;
}

#game-over-screen.hidden {
    display: none;
}

#game-over-screen h1 {
    font-size: 72px;
    margin-bottom: 40px;
    color: #ff0000;
    text-shadow: 0 0 20px rgba(255, 0, 0, 0.5);
}

#game-over-screen p {
    font-size: 28px;
    margin: 10px 0;
}

#restart-button {
    margin-top: 40px;
    padding: 20px 60px;
    background: #4CAF50;
    color: white;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    font-size: 24px;
    font-weight: bold;
    pointer-events: auto;
    transition: background 0.3s;
}

#restart-button:hover {
    background: #45a049;
    transform: scale(1.05);
}

.shop-items {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
    margin-bottom: 30px;
}

.shop-item {
    max-width: 250px;
}

/* 다음 웨이브 화면 */
#next-wave-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    color: white;
    z-index: 2000;
    pointer-events: auto;
}

#next-wave-screen.hidden {
    display: none;
}

#next-wave-screen h2 {
    font-size: 64px;
    margin-bottom: 20px;
    color: #4CAF50;
    text-shadow: 0 0 20px rgba(76, 175, 80, 0.5);
}

#next-wave-screen p {
    font-size: 32px;
    margin: 10px 0 30px 0;
    color: gold;
}

#start-next-wave-button {
    padding: 20px 60px;
    background: #4CAF50;
    color: white;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    font-size: 28px;
    font-weight: bold;
    pointer-events: auto;
    transition: all 0.3s;
    animation: pulse 1.5s infinite;
}

#start-next-wave-button:hover {
    background: #45a049;
    transform: scale(1.1);
}

@keyframes pulse {
    0%, 100% { box-shadow: 0 0 20px rgba(76, 175, 80, 0.5); }
    50% { box-shadow: 0 0 40px rgba(76, 175, 80, 0.8); }
}

/* 설정 버튼 */
#settings-button {
    position: absolute;
    top: 20px;
    left: 20px;
    padding: 12px 24px;
    background: rgba(0, 0, 0, 0.7);
    color: white;
    border: 2px solid #4CAF50;
    border-radius: 8px;
    cursor: pointer;
    font-size: 18px;
    font-weight: bold;
    pointer-events: auto;
    transition: all 0.3s;
    z-index: 100;
}

#settings-button:hover {
    background: rgba(76, 175, 80, 0.3);
    transform: scale(1.05);
}

/* 설정 메뉴 */
#settings-menu {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(0, 0, 0, 0.95);
    padding: 40px;
    border-radius: 15px;
    border: 3px solid #4CAF50;
    color: white;
    pointer-events: auto;
    min-width: 700px;
    max-width: 90%;
    max-height: 80vh;
    overflow-y: auto;
    z-index: 3000;
}

#settings-menu.hidden {
    display: none;
}

#settings-menu h2 {
    text-align: center;
    margin-bottom: 25px;
    font-size: 36px;
    color: #4CAF50;
}

#settings-menu h3 {
    margin-top: 20px;
    margin-bottom: 10px;
    font-size: 24px;
    color: #4CAF50;
    border-bottom: 2px solid #4CAF50;
    padding-bottom: 5px;
}

/* 탭 메뉴 */
.settings-tabs {
    display: flex;
    gap: 10px;
    margin-bottom: 30px;
    border-bottom: 2px solid #333;
}

.settings-tab {
    flex: 1;
    padding: 15px 20px;
    background: rgba(255, 255, 255, 0.1);
    color: white;
    border: none;
    border-bottom: 3px solid transparent;
    cursor: pointer;
    font-size: 18px;
    font-weight: bold;
    pointer-events: auto;
    transition: all 0.3s;
}

.settings-tab:hover {
    background: rgba(255, 255, 255, 0.2);
}

.settings-tab.active {
    background: rgba(76, 175, 80, 0.3);
    border-bottom-color: #4CAF50;
}

/* 설정 컨텐츠 */
.settings-content {
    animation: fadeIn 0.3s ease;
}

.settings-content.hidden {
    display: none;
}

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

/* 도움말 섹션 */
.help-section {
    background: rgba(255, 255, 255, 0.05);
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 20px;
}

.help-section p {
    margin: 8px 0;
    font-size: 16px;
    line-height: 1.6;
}

.help-section strong {
    color: #4CAF50;
}

/* 네비게이션 힌트 */
.navigation-hint {
    text-align: center;
    font-size: 16px;
    color: #4CAF50;
    margin-bottom: 15px;
    padding: 10px;
    background: rgba(76, 175, 80, 0.1);
    border-radius: 5px;
    border: 1px solid #4CAF50;
}

/* 상점 카테고리 */
.shop-category {
    margin-top: 20px;
    margin-bottom: 10px;
    font-size: 20px;
    color: #4CAF50;
    border-bottom: 2px solid #4CAF50;
    padding-bottom: 5px;
}

.shop-category:first-of-type {
    margin-top: 0;
}

/* 닫기 버튼 */
#close-settings {
    display: block;
    margin: 30px auto 0;
    padding: 12px 40px;
    background: #f44336;
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 18px;
    font-weight: bold;
    pointer-events: auto;
    transition: all 0.3s;
}

#close-settings:hover {
    background: #da190b;
    transform: scale(1.05);
}
