@import url('https://fonts.googleapis.com/css2?family=Orbitron:wght@400;700;900&family=Rajdhani:wght@400;600;700&family=Noto+Sans+KR:wght@400;500;700&display=swap');

:root {
    --primary-blue: #3b82f6;
    --primary-dark: #1e3a8a;
    --accent-gold: #fbbf24;
    --danger-red: #ef4444;
    --glass-bg: rgba(15, 23, 42, 0.7);
    --glass-border: rgba(59, 130, 246, 0.3);
    --neon-glow: 0 0 10px rgba(59, 130, 246, 0.5);
}

body {
    width: 100vw;
    height: 100vh;
    margin: 0;
    padding: 0;
    font-family: 'Rajdhani', 'Noto Sans KR', sans-serif;
    overflow: hidden;
    /* 스크롤바 생성 방지 */
    background-color: #000;
    user-select: none;
    touch-action: none;
    color: #e2e8f0;

    /* Center Content */
    display: flex;
    justify-content: center;
    align-items: center;
}

#game-wrapper {
    position: relative;
    /* Default full screen, mode switching will override */
    width: 100%;
    height: 100%;
    overflow: hidden;
    box-shadow: 0 0 50px rgba(0, 0, 0, 0.5);
    background-color: #020617;
    /* Game BG */

    transform-origin: center center;
}

h1,
h2,
h3,
.font-tech {
    font-family: 'Orbitron', sans-serif;
}

/* 애니메이션 */
@keyframes hologram-flicker {
    0% {
        opacity: 0.95;
    }

    5% {
        opacity: 0.8;
    }

    10% {
        opacity: 0.9;
    }

    100% {
        opacity: 0.95;
    }
}

@keyframes scanline {
    0% {
        transform: translateY(-100%);
    }

    100% {
        transform: translateY(100%);
    }
}

@keyframes pulse-border {
    0% {
        border-color: rgba(59, 130, 246, 0.3);
    }

    50% {
        border-color: rgba(59, 130, 246, 0.8);
    }

    100% {
        border-color: rgba(59, 130, 246, 0.3);
    }
}

.title-shadow {
    text-shadow: 0 0 20px rgba(59, 130, 246, 0.8);
}

.glass-panel {
    background: var(--glass-bg);
    backdrop-filter: blur(12px);
    border: 1px solid var(--glass-border);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
}

.map-card {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    border: 1px solid #334155;
    overflow: hidden;
    position: relative;
    border-radius: 0.75rem;
    background: #0f172a;
}

.map-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 0 20px rgba(59, 130, 246, 0.4);
    border-color: var(--primary-blue);
}

.warning-active {
    animation: pulse-red 1.5s infinite;
}

.emp-effect {
    position: absolute;
    inset: 0;
    pointer-events: none;
    z-index: 99;
    background: white;
    opacity: 0;
    transition: opacity 0.5s;
}

.emp-effect.active {
    opacity: 0.8;
}

/* UI Buttons */
.btn-category {
    background: rgba(30, 41, 59, 0.5);
    color: #64748b;
    border-bottom: 2px solid transparent;
    transition: all 0.2s;
    font-family: 'Orbitron', sans-serif;
    letter-spacing: 1px;
}

.btn-category.active {
    background: rgba(59, 130, 246, 0.1);
    color: var(--accent-gold);
    border-bottom-color: var(--accent-gold);
    text-shadow: 0 0 8px rgba(251, 191, 36, 0.5);
}

.btn-unit {
    background: rgba(15, 23, 42, 0.8);
    border: 1px solid #334155;
    transition: all 0.15s;
    position: relative;
    overflow: hidden;
}

.btn-unit:active {
    transform: scale(0.96);
    background: #1e293b;
}

.btn-unit:hover {
    border-color: var(--primary-blue);
    box-shadow: 0 0 10px rgba(59, 130, 246, 0.2);
}

.btn-disabled {
    opacity: 0.3;
    filter: grayscale(100%);
    pointer-events: none;
}

.cooldown-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    background: rgba(0, 0, 0, 0.7);
    z-index: 20;
    transition: height 0.1s linear;
}

.count-text {
    font-family: 'Orbitron';
    font-weight: 700;
    color: #e2e8f0;
    z-index: 30;
    text-shadow: 2px 2px 0 #000;
    font-size: 0.8rem;
}

.queue-badge {
    font-family: 'Rajdhani';
    font-weight: bold;
    background: var(--danger-red);
}

/* HUD Minimap */
#hud-minimap-container {
    position: absolute;
    top: 1rem;
    right: 1rem;
    width: 240px;
    height: 140px;
    background: rgba(0, 0, 0, 0.8);
    border: 1px solid var(--primary-blue);
    border-radius: 0.5rem;
    overflow: hidden;
    z-index: 40;
    box-shadow: 0 0 15px rgba(59, 130, 246, 0.2);
    cursor: crosshair;
}

#hud-minimap-container:hover {
    border-color: var(--accent-gold);
}

/* Modal Styles */
.modal-overlay {
    position: fixed;
    inset: 0;
    z-index: 100;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s;
}

.modal-overlay.active {
    opacity: 1;
    pointer-events: auto;
}

.option-panel {
    width: 90%;
    max-width: 500px;
    background: #0f172a;
    border: 1px solid #334155;
    border-top: 4px solid var(--primary-blue);
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.8);
    padding: 2rem;
    border-radius: 1rem;
    transform: translateY(20px);
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.modal-overlay.active .option-panel {
    transform: translateY(0);
}

/* Range Slider */
input[type=range] {
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
    background: transparent;
}

input[type=range]::-webkit-slider-thumb {
    -webkit-appearance: none;
    height: 16px;
    width: 16px;
    border-radius: 50%;
    background: var(--accent-gold);
    cursor: pointer;
    margin-top: -6px;
    box-shadow: 0 0 10px var(--accent-gold);
}

input[type=range]::-webkit-slider-runnable-track {
    width: 100%;
    height: 4px;
    cursor: pointer;
    background: #334155;
    border-radius: 2px;
}

/* Safe Zone for Toast */
#toast-msg {
    top: 15%;
    font-family: 'Rajdhani';
    letter-spacing: 1px;
    border-left: 4px solid var(--accent-gold);
    background: linear-gradient(90deg, rgba(15, 23, 42, 0.95) 0%, rgba(15, 23, 42, 0.8) 100%);
}

/* [NEW] Queue Badge */
.queue-badge {
    position: absolute;
    top: 2px;
    right: 2px;
    background-color: rgba(220, 38, 38, 0.9);
    color: white;
    font-size: 0.7rem;
    font-weight: bold;
    padding: 0 4px;
    border-radius: 4px;
    z-index: 50;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

/* Loading Bar Glow */
#loading-bar {
    box-shadow: 0 0 15px #3b82f6;
}

/* Used Skill Button */
.btn-unit.used {
    filter: grayscale(100%) brightness(0.5);
    pointer-events: none;
}

/* RECLAIM/style.css 맨 아래 추가 */

/* style.css 맨 아래 추가 */

/* 모바일 가로 모드 전용 스타일 (높이가 500px 이하일 때) */
@media screen and (max-height: 500px) and (orientation: landscape) {

    /* 1. UI 전체 컨테이너 축소 (유지) */
    .absolute.inset-0.pointer-events-none {
        width: 100% !important;
        height: 100% !important;
        transform: none !important;
        /* 복잡한 스케일링 제거하고 직접 배치 */
    }

    /* 2. 유닛 생산 패널 -> 왼쪽 상단으로 이동 */
    #unit-panel-container {
        position: fixed !important;
        top: 10px !important;
        left: 10px !important;
        width: auto !important;
        min-width: 200px !important;
        /* 최소 너비 확보 */
        max-width: 40% !important;
        height: auto !important;
        flex: none !important;
        z-index: 60 !important;
        transform-origin: top left !important;
        transform: scale(0.9) !important;
        /* 전체적으로 살짝 축소 */
    }

    /* 유닛 리스트 높이 및 간격 최적화 */
    #unit-list-container {
        height: 46px !important;
        gap: 2px !important;
        padding: 2px !important;
    }

    /* 유닛 버튼 크기 축소 (40%) */
    .btn-unit {
        width: 38px !important;
        height: 38px !important;
        min-width: 38px !important;
    }

    .btn-unit canvas {
        transform: scale(0.55) !important;
        margin-top: 5px !important;
    }

    .btn-unit span.absolute.top-0 {
        display: none !important;
    }

    /* 이름 숨김 */
    .btn-unit .count-text {
        font-size: 8px !important;
        right: 1px !important;
        bottom: 0px !important;
    }

    /* 3. 미니맵 -> 유닛 패널 바로 오른쪽으로 이동 */
    #hud-minimap-container {
        position: fixed !important;
        top: 10px !important;
        /* 유닛 패널 너비(약 220px~250px) + 여백 */
        left: 260px !important;
        right: auto !important;
        /* 우측 정렬 해제 */
        width: 120px !important;
        height: 70px !important;
        z-index: 60 !important;
        opacity: 0.9 !important;
        border: 1px solid rgba(59, 130, 246, 0.5) !important;
    }

    /* 4. x2 버튼 숨기기 (요청사항) */
    #btn-speed-2 {
        display: none !important;
    }

    /* 옵션 버튼 등 다른 UI 위치 정리 */
    #hud-option-btn {
        top: 10px !important;
        right: 10px !important;
    }

    /* 5. 하단 버튼들(정찰 등) 위치 정리 */
    .flex.justify-between.items-start {
        position: fixed !important;
        bottom: 10px !important;
        left: 10px !important;
        width: auto !important;
        margin: 0 !important;
        padding: 0 !important;
        z-index: 50 !important;
    }
}