/* ==========================================================================
   STARTER GUN: REACTION SURVIVAL - STYLING SHEET
   ========================================================================== */

/* 1. 디자인 시스템 토큰 정의 */
:root {
    --bg-dark: #0a0e17;
    --bg-card: rgba(20, 26, 42, 0.6);
    --border-neon: rgba(0, 243, 255, 0.3);
    
    /* 네온 컬러 */
    --neon-blue: #00f3ff;
    --neon-pink: #ff007f;
    --neon-green: #39ff14;
    --neon-purple: #9d00ff;
    --neon-red: #ff3333;
    
    /* 텍스트 컬러 */
    --text-primary: #f1f5f9;
    --text-muted: #94a3b8;
    
    /* 트랜지션 및 섀도우 */
    --glow-blue: 0 0 15px rgba(0, 243, 255, 0.6);
    --glow-pink: 0 0 15px rgba(ff, 00, 7f, 0.6);
    --glow-green: 0 0 15px rgba(57, 255, 20, 0.6);
    --glow-red: 0 0 20px rgba(255, 51, 51, 0.8);
    
    --transition-smooth: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* 2. 전역 스타일 초기화 */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    user-select: none;
    -webkit-user-select: none;
    -webkit-tap-highlight-color: transparent;
}

body {
    background-color: var(--bg-dark);
    color: var(--text-primary);
    font-family: 'Outfit', 'Noto Sans KR', sans-serif;
    overflow: hidden;
    width: 100vw;
    height: calc(100vh - var(--ad-h, 0px)); /* 하단 배너 자리 비움 */
    display: flex;
    justify-content: center;
    align-items: center;
}

/* 3. 앱 컨테이너 */
#app-container {
    width: 100%;
    max-width: 480px;
    height: 100%;
    background: radial-gradient(circle at 50% 30%, #1e1b4b 0%, #0a0e17 80%);
    border: 1px solid rgba(255, 255, 255, 0.05);
    position: relative;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
}

/* 4. 스크린 전환 구조 */
.screen {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    pointer-events: none;
    transform: scale(0.96);
    transition: opacity 0.4s ease, transform 0.4s ease;
    display: flex;
    flex-direction: column;
    padding: 24px;
    justify-content: space-between;
    z-index: 1;
}

.screen.active {
    opacity: 1;
    pointer-events: auto;
    transform: scale(1);
    z-index: 2;
}

/* 5. 글래스모피즘 공통 카드 */
.glassmorphism {
    background: var(--bg-card);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--border-neon);
    border-radius: 20px;
    padding: 24px;
}

/* 6. 메인 스크린 컴포넌트 */
.logo-area {
    text-align: center;
    margin-top: 60px;
}

.glitch-text {
    font-size: 3.2rem;
    font-weight: 900;
    letter-spacing: 2px;
    color: var(--neon-blue);
    text-shadow: var(--glow-blue);
    position: relative;
}

.subtitle {
    font-size: 1.1rem;
    color: var(--neon-pink);
    letter-spacing: 6px;
    margin-top: 8px;
    text-shadow: 0 0 8px rgba(255, 0, 127, 0.4);
    font-weight: 700;
    text-transform: uppercase;
}

.stats-preview {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

.stats-preview:last-child {
    margin-bottom: 0;
}

.stats-preview span:first-child {
    color: var(--text-muted);
    font-size: 0.95rem;
}

.stats-preview span:last-child {
    color: var(--neon-blue);
    font-weight: 700;
    font-size: 1.2rem;
    text-shadow: 0 0 5px rgba(0, 243, 255, 0.3);
}

/* 7. 버튼 디자인 */
.btn {
    width: 100%;
    padding: 18px;
    border: none;
    border-radius: 14px;
    font-size: 1.1rem;
    font-weight: 700;
    cursor: pointer;
    transition: var(--transition-smooth);
    display: flex;
    justify-content: center;
    align-items: center;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.btn-primary {
    background: linear-gradient(135deg, var(--neon-blue) 0%, #0088ff 100%);
    color: #000;
    box-shadow: var(--glow-blue);
}

.btn-primary:active {
    transform: scale(0.97);
    filter: brightness(0.9);
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: var(--text-primary);
    margin-top: 12px;
}

.btn-secondary:active {
    background: rgba(255, 255, 255, 0.1);
}

.btn-glow {
    animation: btnPulse 2s infinite alternate;
}

@keyframes btnPulse {
    0% {
        box-shadow: 0 0 10px rgba(0, 243, 255, 0.4);
    }
    100% {
        box-shadow: 0 0 25px rgba(0, 243, 255, 0.8);
    }
}

/* 8. 게임 플레이 스크린 */
.game-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    z-index: 10;
}

.stage-badge {
    background: rgba(0, 243, 255, 0.1);
    border: 1px solid var(--neon-blue);
    padding: 8px 16px;
    border-radius: 30px;
    font-weight: 900;
    color: var(--neon-blue);
    text-shadow: 0 0 5px rgba(0, 243, 255, 0.5);
    letter-spacing: 1px;
}

.lives-container {
    display: flex;
    gap: 8px;
}

.life-heart {
    font-size: 1.4rem;
    filter: drop-shadow(0 0 4px var(--neon-red));
    transition: var(--transition-smooth);
}

.life-lost {
    opacity: 0.2;
    transform: scale(0.8);
    filter: grayscale(1);
}

/* 9. 슈팅 레인지 및 연출 */
#shooting-range {
    flex-grow: 1;
    position: relative;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    margin: 20px 0;
}

/* 권총 리볼버 SVG 래퍼 */
#gun-model {
    transition: transform 0.1s ease;
    z-index: 5;
}

.gun-idle {
    transform: rotate(0deg);
}

.gun-ready {
    transform: rotate(-10deg) translateY(-5px);
}

/* 권총 반동 애니메이션 */
.gun-recoil {
    animation: recoil 0.15s ease-out;
}

@keyframes recoil {
    0% { transform: rotate(-25deg) translate(-10px, -15px) scale(1.1); }
    100% { transform: rotate(0deg) translate(0, 0) scale(1); }
}

/* 섬광 연출 (진짜 신호) */
#flash-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 4;
    opacity: 0;
    transition: opacity 0.05s ease;
}

.flash-active-real {
    background: radial-gradient(circle, rgba(255, 51, 51, 0.9) 0%, rgba(0, 0, 0, 0) 70%);
    opacity: 1 !important;
}

/* 가짜 신호 섬광 (속임수) */
.flash-active-fake-blue {
    background: radial-gradient(circle, rgba(0, 243, 255, 0.9) 0%, rgba(0, 0, 0, 0) 70%);
    opacity: 1 !important;
}

.flash-active-fake-green {
    background: radial-gradient(circle, rgba(57, 255, 20, 0.9) 0%, rgba(0, 0, 0, 0) 70%);
    opacity: 1 !important;
}

/* 메세지 보드 */
#status-board {
    text-align: center;
    margin-top: 24px;
    z-index: 5;
}

#signal-message {
    font-size: 1.8rem;
    font-weight: 900;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 8px;
    transition: color 0.2s ease;
}

.text-blue { color: var(--neon-blue); text-shadow: var(--glow-blue); }
.text-pink { color: var(--neon-pink); text-shadow: var(--glow-pink); }
.text-green { color: var(--neon-green); text-shadow: var(--glow-green); }
.text-red { color: var(--neon-red); text-shadow: var(--glow-red); }

#sub-message {
    color: var(--text-muted);
    font-size: 0.9rem;
    letter-spacing: 0.5px;
}

/* 10. 터치 패드 컨트롤러 */
#touch-pad-container {
    width: 100%;
    display: flex;
    justify-content: center;
    padding-bottom: 20px;
    z-index: 10;
}

#touch-pad {
    width: 100%;
    height: 120px;
    background: linear-gradient(180deg, rgba(0, 243, 255, 0.05) 0%, rgba(0, 243, 255, 0.15) 100%);
    border: 2px solid var(--neon-blue);
    border-radius: 24px;
    position: relative;
    overflow: hidden;
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    box-shadow: 0 0 10px rgba(0, 243, 255, 0.1);
    transition: var(--transition-smooth);
}

#touch-pad span {
    font-size: 1.3rem;
    font-weight: 900;
    color: var(--neon-blue);
    letter-spacing: 2px;
    text-shadow: var(--glow-blue);
    pointer-events: none;
    z-index: 2;
}

/* 터치 중인 상태 */
#touch-pad.touch-pad-active {
    background: linear-gradient(180deg, rgba(255, 0, 127, 0.1) 0%, rgba(255, 0, 127, 0.3) 100%);
    border-color: var(--neon-pink);
    box-shadow: 0 0 25px rgba(255, 0, 127, 0.4);
    transform: scale(0.98);
}

#touch-pad.touch-pad-active span {
    color: var(--neon-pink);
    text-shadow: var(--glow-pink);
    animation: textPulse 1s infinite alternate;
}

@keyframes textPulse {
    0% { transform: scale(1); }
    100% { transform: scale(1.05); }
}

/* 11. 결과 화면 */
#screen-result {
    justify-content: center;
    align-items: center;
}

.result-card {
    width: 100%;
    text-align: center;
}

#result-title {
    font-size: 2.6rem;
    font-weight: 900;
    margin-bottom: 24px;
    letter-spacing: 2px;
}

.text-glow-red {
    color: var(--neon-red);
    text-shadow: var(--glow-red);
}

.text-glow-green {
    color: var(--neon-green);
    text-shadow: var(--glow-green);
}

.result-stats {
    margin-bottom: 30px;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    padding: 16px 0;
}

.stat-row {
    display: flex;
    justify-content: space-between;
    margin-bottom: 12px;
    font-size: 1.05rem;
}

.stat-row:last-child {
    margin-bottom: 0;
}

.stat-row span:first-child {
    color: var(--text-muted);
}

.stat-row .value {
    font-weight: 700;
    color: var(--text-primary);
}

.btn-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

/* 12. 모달 팝업 */
.modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(5, 7, 12, 0.8);
    z-index: 100;
    display: flex;
    justify-content: center;
    align-items: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
    padding: 24px;
}

.modal-overlay.active {
    opacity: 1;
    pointer-events: auto;
}

.modal-content {
    width: 100%;
    max-width: 380px;
    text-align: left;
}

.modal-content h2 {
    font-size: 1.4rem;
    color: var(--neon-blue);
    text-shadow: var(--glow-blue);
    margin-bottom: 16px;
    font-weight: 900;
}

.modal-body {
    font-size: 0.95rem;
    line-height: 1.6;
    color: var(--text-primary);
    margin-bottom: 24px;
}

.modal-body p {
    margin-bottom: 12px;
}

.modal-body p:last-child {
    margin-bottom: 0;
}


/* ===== 3차 개편 (2026-10-08): 스플래시 과녁 아트를 메인·플레이 무대로 재사용 ===== */
:root { --brand-red: #ff3b30; --brand-amber: #ff7a2f; }
#app-container { background: radial-gradient(circle at 50% 30%, #1d1420 0%, #0a0b10 78%); }

/* 메인: 히어로 아트 + 위계 */
#screen-menu { justify-content: flex-end; gap: 18px; padding-top: 0; }
#screen-menu .hero-art {
    position: absolute; left: 0; right: 0; top: 0; height: 500px; z-index: -1;
    background: url(hero_target.jpg) center top / 100% auto no-repeat;
    -webkit-mask-image: linear-gradient(to bottom, #000 0%, #000 62%, transparent 100%);
            mask-image: linear-gradient(to bottom, #000 0%, #000 62%, transparent 100%);
}
#screen-menu .logo-area { margin-top: 0; }
#screen-menu .glitch-text {
    font-size: clamp(2.2rem, 10.6vw, 2.85rem); line-height: 1; color: #fff; letter-spacing: 1px; white-space: nowrap;
    text-shadow: 0 2px 0 #000, 0 0 18px rgba(255, 59, 48, .75), 0 0 42px rgba(255, 59, 48, .45);
}
#screen-menu .subtitle { color: var(--brand-amber); text-shadow: 0 0 10px rgba(255, 122, 47, .55); margin-top: 10px; }
#screen-menu .menu-card { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; padding: 0; }
#screen-menu .stats-preview {
    flex-direction: column; align-items: flex-start; gap: 6px; margin: 0;
    padding: 14px 16px; border-radius: 16px;
    background: linear-gradient(180deg, rgba(255, 255, 255, .07), rgba(255, 255, 255, .02));
    border: 1px solid rgba(255, 255, 255, .09); border-left: 3px solid var(--brand-red);
}
#screen-menu .stats-preview span:first-child { font-size: .82rem; color: #a7a3b3; }
#screen-menu .stats-preview span:last-child { font-size: 1.55rem; font-weight: 800; color: #fff; text-shadow: none; }
#screen-menu .menu-actions { display: flex; flex-direction: column; gap: 6px; }
#screen-menu .btn-primary {
    padding: 20px; font-size: 1.2rem; font-weight: 800; color: #fff; letter-spacing: 2px;
    background: linear-gradient(180deg, #ff5a3c 0%, #e8261c 100%);
    box-shadow: 0 6px 0 #8f130d, 0 0 26px rgba(255, 59, 48, .45);
    animation: none; text-shadow: 0 1px 0 rgba(0, 0, 0, .35);
}
#screen-menu .btn-secondary { background: transparent; border: none; color: #c9c5d3; margin-top: 4px; padding: 14px; font-weight: 700; }

/* 플레이: 과녁 무대 */
.game-header { margin-top: 22px; }
.stage-badge { background: rgba(0, 0, 0, .55); padding: 9px 18px; font-size: 1.05rem; }
#shooting-range { margin: 6px -24px 14px; }
#shooting-range .range-art {
    position: absolute; left: 50%; top: 26%; width: 640px; aspect-ratio: 1080 / 1280;
    transform: translate(-50%, -68%); z-index: 1; opacity: .62;
    background: url(hero_target.jpg) center / cover no-repeat;
    -webkit-mask-image: radial-gradient(closest-side, #000 55%, transparent 100%);
            mask-image: radial-gradient(closest-side, #000 55%, transparent 100%);
    pointer-events: none;
}
#gun-svg { width: 200px; height: 200px; filter: drop-shadow(0 8px 14px rgba(0, 0, 0, .8)) drop-shadow(0 0 2px rgba(255, 255, 255, .35)); }
#status-board {
    margin-top: 8px; padding: 14px 22px 12px; border-radius: 18px;
    background: rgba(8, 9, 14, .72); border: 1px solid rgba(255, 255, 255, .08);
    -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px);
}
#signal-message { font-weight: 800; font-size: 1.75rem; }
#sub-message { display: inline-block; margin-top: 2px; padding: 4px 12px; border-radius: 99px; background: rgba(255, 255, 255, .07); color: #c9c5d3; }

/* 터치 패드 = 화면의 단 하나의 채움 컨트롤 (규칙 문구 「파란 터치 패드」 유지) */
#touch-pad-container { padding-bottom: 6px; }
#touch-pad {
    height: 136px; border: none; border-radius: 28px;
    background: linear-gradient(180deg, #4ff6ff 0%, #00c8e0 55%, #0096c7 100%);
    box-shadow: 0 7px 0 #00607f, 0 0 34px rgba(0, 243, 255, .35), inset 0 2px 0 rgba(255, 255, 255, .55);
}
#touch-pad::before {
    content: ''; position: absolute; left: 50%; top: 50%; width: 220px; height: 220px; transform: translate(-50%, -50%);
    border-radius: 50%; border: 2px solid rgba(255, 255, 255, .28); box-shadow: 0 0 0 26px rgba(255, 255, 255, .06), 0 0 0 54px rgba(255, 255, 255, .04);
}
#touch-pad span { color: #032430; text-shadow: 0 1px 0 rgba(255, 255, 255, .45); font-size: 1.4rem; }
#touch-pad.touch-pad-active {
    background: linear-gradient(180deg, #ff4fa3 0%, #ff007f 60%, #c40062 100%);
    box-shadow: 0 3px 0 #7a003d, 0 0 40px rgba(255, 0, 127, .5), inset 0 2px 0 rgba(255, 255, 255, .4);
    transform: translateY(4px);
}
#touch-pad.touch-pad-active span { color: #fff; text-shadow: 0 1px 0 rgba(0, 0, 0, .3); }
#shooting-range #flash-overlay { mix-blend-mode: screen; }
#shooting-range .flash-active-real { background: radial-gradient(circle, rgba(255, 70, 50, 1) 0%, rgba(255, 30, 30, .55) 38%, rgba(0, 0, 0, 0) 72%); }

/* 한글 제목 굵기 상한 800 (삼성 글꼴 뭉개짐 방지) */
.modal-content h2 { font-weight: 800; }
.modal-body strong { color: #fff; }
/* 한국어 단어 중간 줄바꿈 금지(규칙 안내·신호 문구) */
body { word-break: keep-all; overflow-wrap: break-word; }
#result-title { font-size: clamp(2.1rem, 10vw, 2.6rem); }
/* 권총: 납작한 SVG 도형 → ComfyUI 스타터 권총 그림 (2026-10-08) */
#gun-model #gun-svg { display: none; }
#gun-model .gun-img {
    display: block; width: 236px; height: auto; pointer-events: none;
    filter: drop-shadow(0 10px 16px rgba(0, 0, 0, .85)) drop-shadow(0 0 1px rgba(255, 255, 255, .25));
}
/* 신호 판: 긴 영어 문구에서도 화면 가장자리에 붙지 않게 */
#status-board { max-width: calc(100% - 40px); }
