/* ============================================
   High Noon - 서부 결투 게임 스타일
   테마: 레트로 서부 + 석양 오렌지
   ============================================ */

:root {
    /* 메인 컬러 */
    --desert-night: #1a0f0a;
    --desert-dark: #2a1810;
    --sunset-orange: #ff6b35;
    --gold-rush: #ffb627;
    --dusty-red: #d64545;
    --ui-accent: #ff6a3d;
    --ui-accent-dim: #c9412b;
    --ui-accent-glow: rgba(255, 106, 61, 0.46);
    --ui-accent-soft: rgba(255, 126, 92, 0.46);
    --ui-start-btn: #ffb37d;
    --ui-start-btn-dim: #f08b58;
    --ui-start-btn-glow: rgba(255, 179, 125, 0.38);
    --countdown-neutral: #fff8ef;
    --countdown-neutral-glow: rgba(255, 248, 239, 0.58);

    /* 서브 컬러 */
    --cactus-green: #5a7a4a;
    --sky-purple: #4a3060;
    --leather-brown: #8b6f47;
    --sand-light: #e8d5b7;

    /* UI 컬러 */
    --hp-full: #ffb627;
    --hp-low: #ff4444;
    --stun-color: #ff6b35;
    --clean-shot: #ffd700;
    --dirty-shot: #ff6b35;
    --app-height: 100dvh;
    --app-safe-bottom: calc(env(safe-area-inset-bottom, 0px) + var(--browser-safe-bottom-offset, 0px));
    --game-font-family: 'Lilita One', 'Jua', sans-serif;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
    user-select: none;
    -webkit-user-select: none;
}

html {
    height: 100%;
    height: 100dvh;
    height: var(--app-height, 100dvh);
    overflow: hidden;
    touch-action: none;
    -webkit-touch-callout: none;
    overscroll-behavior: none;
    background-color: #4a2815;
    background-image: linear-gradient(180deg,
            var(--desert-night) 0%,
            var(--desert-dark) 25%,
            #4a2815 50%,
            var(--desert-dark) 75%,
            var(--desert-night) 100%);
}

body {
    height: 100%;
    height: 100dvh;
    height: var(--app-height, 100dvh);
    margin: 0;
    overflow: hidden;
    touch-action: none;
    overscroll-behavior: none;
    font-family: var(--game-font-family);
    background-color: #4a2815;
    background-image: linear-gradient(180deg,
            var(--desert-night) 0%,
            var(--desert-dark) 25%,
            #4a2815 50%,
            var(--desert-dark) 75%,
            var(--desert-night) 100%);
    color: var(--sand-light);
}

/* ============================================
   배경 먼지 효과
   ============================================ */
.dust-particles {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1;
    overflow: hidden;
}

.dust {
    position: absolute;
    width: 4px;
    height: 4px;
    background: rgba(232, 213, 183, 0.3);
    border-radius: 50%;
    animation: dustFloat 15s infinite linear;
}

.dust:nth-child(1) {
    left: 10%;
    animation-delay: 0s;
    animation-duration: 18s;
}

.dust:nth-child(2) {
    left: 30%;
    animation-delay: -3s;
    animation-duration: 20s;
    width: 3px;
    height: 3px;
}

.dust:nth-child(3) {
    left: 50%;
    animation-delay: -6s;
    animation-duration: 16s;
}

.dust:nth-child(4) {
    left: 70%;
    animation-delay: -9s;
    animation-duration: 22s;
    width: 5px;
    height: 5px;
    opacity: 0.2;
}

.dust:nth-child(5) {
    left: 85%;
    animation-delay: -12s;
    animation-duration: 17s;
    width: 3px;
    height: 3px;
}

.dust:nth-child(6) {
    left: 25%;
    animation-delay: -7s;
    animation-duration: 19s;
    width: 2px;
    height: 2px;
}

@keyframes dustFloat {
    0% {
        transform: translateY(100vh) translateX(0);
        opacity: 0;
    }

    10% {
        opacity: 0.4;
    }

    90% {
        opacity: 0.4;
    }

    100% {
        transform: translateY(-20vh) translateX(30px);
        opacity: 0;
    }
}

.game-container {
    width: 100%;
    height: 100%;
    height: 100dvh;
    height: var(--app-height, 100dvh);
    display: flex;
    flex-direction: column;
    position: relative;
    padding: env(safe-area-inset-top) env(safe-area-inset-right) var(--app-safe-bottom) env(safe-area-inset-left);
    touch-action: none;
}

.game-container.entry-layout-pending> :not(.entry-start-overlay) {
    visibility: hidden;
    pointer-events: none;
}

.entry-start-overlay {
    position: absolute;
    inset: 0;
    z-index: 260;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.22s ease;
    background: radial-gradient(circle at 50% 50%, rgba(255, 255, 255, 0.03) 0%, rgba(0, 0, 0, 0.9) 72%);
}

.entry-start-overlay[hidden] {
    display: none !important;
}

.entry-start-overlay.show {
    opacity: 1;
    pointer-events: auto;
}

.ai-entry-name-overlay,
.ai-entry-emoji-overlay {
    position: fixed;
    pointer-events: none;
    z-index: 273;
    display: none;
    margin: 0;
    padding: 0;
}

.ai-entry-name-overlay.show,
.ai-entry-emoji-overlay.show {
    display: block;
}

.ai-entry-name-overlay>.player-label,
.ai-entry-emoji-overlay>.cowboy {
    margin: 0;
}

.ai-entry-name-overlay>.player-label {
    display: block;
}

.entry-start-btn {
    position: absolute;
    left: 50%;
    top: calc(50% + ((env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px)) * 0.5) - (var(--global-ad-banner-reserved, 0px) * 0.5));
    transform: translate(-50%, -50%);
    overflow: hidden;
    min-width: clamp(180px, 46vw, 300px);
    min-height: clamp(66px, 11dvh, 88px);
    padding: 0 24px;
    border-radius: 18px;
    border: none;
    background: linear-gradient(180deg, var(--ui-start-btn) 0%, var(--ui-start-btn-dim) 100%);
    color: #111315;
    font-family: var(--game-font-family);
    font-size: clamp(1.34rem, 5.3vw, 1.92rem);
    letter-spacing: 0.5px;
    box-shadow: 0 0 16px var(--ui-start-btn-glow), 0 8px 18px rgba(0, 0, 0, 0.34);
    cursor: pointer;
    animation: entry-start-pulse 1.5s ease-in-out infinite;
}

.entry-start-btn>span {
    position: relative;
    z-index: 2;
}

.entry-start-btn::after {
    content: '';
    position: absolute;
    top: -45%;
    left: -68%;
    width: 46%;
    height: 190%;
    transform: skewX(-18deg);
    background: linear-gradient(90deg,
            rgba(255, 255, 255, 0) 0%,
            rgba(255, 255, 255, 0.52) 50%,
            rgba(255, 255, 255, 0) 100%);
    pointer-events: none;
    animation: entry-start-sweep 2.4s linear infinite;
}

.entry-start-btn:active {
    transform: translate(-50%, -50%) scale(0.98);
    box-shadow: 0 0 10px rgba(255, 179, 125, 0.28), 0 6px 12px rgba(0, 0, 0, 0.3);
    filter: brightness(0.98);
}

.entry-start-btn:disabled {
    background: linear-gradient(180deg, #444 0%, #333 100%);
    color: #555;
    box-shadow: 0 2px 0 #222;
    border-color: transparent;
    cursor: not-allowed;
    animation: none;
}

.entry-start-btn:disabled::after {
    display: none;
}

/* ============================================
   플레이어 영역 (상단/하단)
   ============================================ */
.player-section {
    flex: 0.8;
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    padding: 8px 10px;
    position: relative;
    min-height: 0;
    gap: 10px;
}

.opponent-section {
    background: linear-gradient(180deg, rgba(255, 106, 61, 0.15) 0%, transparent 100%);
    transform: rotate(180deg);
}

.game-container.p2-ai-opponent .opponent-section .player-info {
    transform: rotate(180deg);
}

.my-section {
    background: linear-gradient(0deg, rgba(255, 106, 61, 0.15) 0%, transparent 100%);
}

/* ============================================
   우측 액션 버튼
   ============================================ */
.side-action-stack {
    position: absolute;
    right: 0;
    top: 50%;
    transform: translateY(-50%);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    z-index: 30;
}

.rules-btn-container {
    position: relative;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    border: 2px solid var(--ui-accent-soft);
    background: rgba(24, 11, 5, 0.9);
    color: var(--ui-accent);
    font-size: 1.1rem;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: inset 0 0 8px rgba(255, 106, 61, 0.18), 0 0 10px rgba(0, 0, 0, 0.45);
    transition: transform 0.15s ease, background 0.15s ease, opacity 0.15s ease;
    touch-action: manipulation;
}

.rules-btn-container:active {
    transform: scale(0.95);
    background: rgba(255, 106, 61, 0.22);
}

.rules-btn-container.hidden {
    display: none;
}

/* 룰 오버레이 */
.rules-overlay {
    position: fixed;
    inset: 0;
    z-index: 290;
    background: rgba(0, 0, 0, 0.88);
    display: none;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
    padding: 16px;
}

.rules-overlay.show {
    display: flex;
    opacity: 1;
    pointer-events: auto;
}

.rules-book-split {
    width: min(94vw, 440px);
    max-height: min(92dvh, 760px);
    display: grid;
    grid-template-rows: repeat(2, minmax(0, 1fr));
    gap: 12px;
}

.rules-overlay:not(.dual-layout) .rules-book-split {
    grid-template-rows: minmax(0, 1fr);
}

.rules-overlay:not(.dual-layout) .rules-content-p2 {
    display: none;
}

.rules-content {
    width: 100%;
    max-height: none;
    padding: 16px 16px 14px;
    border-radius: 16px;
    border: 1px solid rgba(255, 106, 61, 0.32);
    background: linear-gradient(180deg, rgba(40, 17, 5, 0.95) 0%, rgba(20, 8, 2, 0.96) 100%);
    box-shadow: 0 16px 36px rgba(0, 0, 0, 0.48);
    display: flex;
    flex-direction: column;
}

.rules-overlay.dual-layout .rules-content-p2 {
    transform: rotate(180deg);
}

.rules-content h2 {
    font-family: var(--game-font-family);
    font-size: clamp(1.04rem, 4vw, 1.18rem);
    color: var(--ui-accent);
    text-align: center;
    margin-bottom: 10px;
    text-shadow: 1px 1px 0 rgba(0, 0, 0, 0.5);
}

.rules-content ul {
    list-style: none;
    text-align: left;
    font-family: var(--game-font-family);
    display: grid;
    gap: 8px;
    margin: 0;
    font-size: clamp(0.85rem, 3vw, 0.92rem);
    line-height: 1.45;
    overflow: auto;
    padding-right: 4px;
    flex: 1;
}

.rules-content li {
    margin: 0;
    padding-left: 9px;
    border-left: 2px solid var(--ui-accent);
}

.rules-content li b {
    color: var(--ui-accent);
}

.close-rules-btn {
    width: 100%;
    margin-top: 12px;
    padding: 10px 12px;
    font-size: 0.98rem;
    font-family: var(--game-font-family);
    background: linear-gradient(180deg, var(--ui-accent) 0%, var(--ui-accent-dim) 100%);
    color: var(--desert-night);
    border: none;
    border-radius: 10px;
    cursor: pointer;
    box-shadow: 0 3px 0 #8b4513;
}

.close-rules-btn:active {
    transform: scale(0.98);
}

/* ============================================
   플레이어 정보
   ============================================ */
.player-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    position: relative;
    min-width: 0;
}

.name-row {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    max-width: 140px;
}

.player-label {
    font-family: var(--game-font-family);
    font-size: clamp(0.85rem, 4vw, 1.1rem);
    color: var(--gold-rush);
    text-shadow: 1px 1px 0 rgba(0, 0, 0, 0.8),
        0 0 10px rgba(255, 182, 39, 0.5);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
    text-align: center;
}

.cowboy {
    font-size: clamp(2.5rem, 12vw, 3.5rem);
    filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.6));
    transition: transform 0.1s, filter 0.1s;
    line-height: 1;
}

.cowboy.shooting {
    animation: shootEffect 0.3s ease-out;
}

@keyframes shootEffect {
    0% {
        transform: scale(1);
    }

    30% {
        transform: scale(1.3) translateX(10px);
        filter: brightness(1.5) drop-shadow(0 0 20px var(--sunset-orange));
    }

    100% {
        transform: scale(1);
    }
}

.cowboy.hit {
    animation: hitEffect 0.5s ease-out;
}

@keyframes hitEffect {
    0% {
        transform: scale(1);
    }

    20% {
        transform: scale(0.8) rotate(-10deg);
        filter: brightness(2) hue-rotate(180deg);
    }

    40% {
        transform: scale(1.1) rotate(10deg);
        filter: brightness(0.5);
    }

    60% {
        transform: scale(0.9) rotate(-5deg);
    }

    100% {
        transform: scale(1) rotate(0);
    }
}

/* ============================================
   HP 바
   ============================================ */
.hp-bar {
    width: 100%;
    max-width: 140px;
    height: 24px;
    background: rgba(0, 0, 0, 0.7);
    border: 2px solid var(--leather-brown);
    border-radius: 12px;
    overflow: hidden;
    position: relative;
}

.hp-bar-large {
    height: 36px;
    max-width: 160px;
    border: 3px solid var(--gold-rush);
    border-radius: 18px;
    box-shadow: 0 0 15px rgba(255, 182, 39, 0.4),
        inset 0 2px 4px rgba(0, 0, 0, 0.5);
}

.hp-fill {
    height: 100%;
    width: 100%;
    background: linear-gradient(90deg,
            var(--sunset-orange) 0%,
            var(--gold-rush) 60%,
            #ffe066 100%);
    transition: width 0.3s ease;
    border-radius: 10px;
    position: relative;
}

/* HP 바 광택 효과 */
.hp-fill::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 50%;
    background: linear-gradient(180deg,
            rgba(255, 255, 255, 0.4) 0%,
            transparent 100%);
    border-radius: 10px 10px 0 0;
}

.hp-fill.low {
    background: linear-gradient(90deg, #ff0000 0%, var(--dusty-red) 50%, #ff6666 100%);
    animation: hpPulse 0.4s ease-in-out infinite;
}

@keyframes hpPulse {

    0%,
    100% {
        opacity: 1;
        filter: brightness(1);
    }

    50% {
        opacity: 0.7;
        filter: brightness(1.3);
    }
}

.hp-text {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-family: var(--game-font-family);
    font-weight: 700;
    font-size: clamp(0.8rem, 3.5vw, 1rem);
    color: white;
    text-shadow: 1px 1px 2px black,
        0 0 8px rgba(0, 0, 0, 0.8);
}

.hp-bar-large .hp-text {
    font-size: clamp(1rem, 4.5vw, 1.3rem);
}

/* ============================================
   스턴 효과
   ============================================ */
.stun-container {
    display: none;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    position: absolute;
    bottom: 8px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 30;
}

.stun-container.show {
    display: flex;
    animation: stunContainerAppear 0.2s ease-out;
}

@keyframes stunContainerAppear {
    0% {
        opacity: 0;
        transform: translateX(-50%) scale(0.5);
    }

    100% {
        opacity: 1;
        transform: translateX(-50%) scale(1);
    }
}

.stun-indicator {
    font-family: var(--game-font-family);
    font-size: clamp(0.58rem, 2.2vmin, 0.9rem);
    color: white;
    background: linear-gradient(90deg, var(--dusty-red), var(--stun-color));
    padding: clamp(2px, 0.5vmin, 4px) clamp(8px, 1.6vmin, 12px);
    border-radius: 10px;
    white-space: nowrap;
    line-height: 1;
    text-shadow: 1px 1px 0 rgba(0, 0, 0, 0.5);
    box-shadow: 0 0 15px var(--stun-color);
    animation: stunPulse 0.25s ease-in-out infinite;
}

@keyframes stunPulse {

    0%,
    100% {
        transform: scale(1);
        box-shadow: 0 0 15px var(--stun-color);
    }

    50% {
        transform: scale(1.05);
        box-shadow: 0 0 25px var(--stun-color);
    }
}

.stun-gauge {
    width: 90px;
    height: 6px;
    background: rgba(0, 0, 0, 0.7);
    border-radius: 3px;
    overflow: hidden;
    border: 1px solid rgba(255, 107, 53, 0.5);
}

.stun-bar {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, var(--stun-color), var(--dusty-red), #ff8888);
    transition: width 0.05s linear;
    box-shadow: 0 0 10px var(--stun-color);
}

/* ============================================
   발사/데미지 이펙트
   ============================================ */
.shot-indicator {
    position: absolute;
    font-size: 2.5rem;
    opacity: 0;
    pointer-events: none;
    z-index: 50;
}

.shot-indicator.clean {
    animation: shotClean 0.6s ease-out forwards;
}

.shot-indicator.dirty {
    animation: shotDirty 0.5s ease-out forwards;
}

@keyframes shotClean {
    0% {
        opacity: 1;
        transform: scale(1) translateY(0);
        filter: brightness(1);
    }

    30% {
        opacity: 1;
        filter: brightness(2);
    }

    100% {
        opacity: 0;
        transform: scale(3) translateY(-80px);
        filter: brightness(0.5);
    }
}

@keyframes shotDirty {
    0% {
        opacity: 1;
        transform: scale(1) rotate(0deg) translateY(0);
    }

    50% {
        opacity: 0.8;
    }

    100% {
        opacity: 0;
        transform: scale(2) rotate(20deg) translateY(-60px);
    }
}

.damage-popup {
    position: absolute;
    font-family: var(--game-font-family);
    font-size: clamp(1.8rem, 10vw, 2.5rem);
    font-weight: 700;
    opacity: 0;
    pointer-events: none;
    z-index: 60;
}

.damage-popup.clean {
    color: var(--clean-shot);
    text-shadow: 4px 4px 0 rgba(0, 0, 0, 0.9),
        0 0 40px var(--clean-shot),
        0 0 80px rgba(255, 215, 0, 0.5);
}

.damage-popup.dirty {
    color: var(--dirty-shot);
    text-shadow: 3px 3px 0 rgba(0, 0, 0, 0.9),
        0 0 30px var(--dirty-shot);
}

.damage-popup.show {
    animation: damageFloat 1.5s ease-out forwards;
}

.damage-popup.show.clean {
    animation: damageFloatClean 1.5s ease-out forwards;
}

@keyframes damageFloat {
    0% {
        opacity: 1;
        transform: translateY(0) scale(0.5);
    }

    20% {
        transform: translateY(-10px) scale(1.3);
    }

    40% {
        transform: translateY(-20px) scale(1);
    }

    100% {
        opacity: 0;
        transform: translateY(-40px) scale(0.8);
    }
}

@keyframes damageFloatClean {
    0% {
        opacity: 1;
        transform: translateY(0) scale(0.5) rotate(-5deg);
    }

    15% {
        transform: translateY(-15px) scale(1.6) rotate(3deg);
        text-shadow: 4px 4px 0 rgba(0, 0, 0, 0.9),
            0 0 60px var(--clean-shot),
            0 0 100px rgba(255, 215, 0, 0.8);
    }

    40% {
        transform: translateY(-25px) scale(1.1) rotate(-2deg);
    }

    100% {
        opacity: 0;
        transform: translateY(-50px) scale(0.9) rotate(0deg);
    }
}

/* ============================================
   발사 버튼
   ============================================ */
.fire-button {
    flex: 1;
    max-width: 45%;
    height: 100%;
    position: relative;
    overflow: visible;
    isolation: isolate;
    font-family: var(--game-font-family);
    font-size: clamp(1.3rem, 5.5vw, 2rem);
    border: none;
    border-radius: 15px;
    cursor: pointer;
    transition: all 0.15s;
    line-height: 1.2;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.5);

    /* 기본: 비활성 */
    background: linear-gradient(180deg, #3a3a3a 0%, #2a2a2a 100%);
    color: #666;
    box-shadow: 0 5px 0 #1a1a1a;
}

.fire-button.active {
    background: linear-gradient(180deg, #ff5555 0%, var(--dusty-red) 100%);
    color: white;
    box-shadow: 0 0 30px rgba(255, 85, 85, 0.7),
        0 0 60px rgba(214, 69, 69, 0.4),
        0 5px 0 #6b2020,
        inset 0 -5px 20px rgba(0, 0, 0, 0.3);
    animation: fireReady 0.5s ease-in-out infinite;
    border: 2px solid rgba(255, 255, 255, 0.3);
}

@keyframes fireReady {

    0%,
    100% {
        transform: scale(1);
        box-shadow: 0 0 30px rgba(255, 85, 85, 0.7),
            0 0 60px rgba(214, 69, 69, 0.4),
            0 5px 0 #6b2020;
    }

    50% {
        transform: scale(1.03);
        box-shadow: 0 0 40px rgba(255, 85, 85, 0.9),
            0 0 80px rgba(214, 69, 69, 0.6),
            0 5px 0 #6b2020;
    }
}

.fire-button.active:active {
    transform: scale(0.95) translateY(3px);
    box-shadow: 0 2px 0 #6b2020;
    animation: none;
}

.game-container.p2-ai-opponent .opponent-section .fire-button {
    transform: rotate(180deg);
    transition: none;
}

.game-container.p2-ai-opponent .opponent-section #fire-btn2 .colt-svg {
    --colt-base-rotation: -90deg;
    --colt-scale-x: calc(var(--colt-scale-mag) * -1);
    --colt-scale-y: var(--colt-scale-mag);
    --colt-offset-x: 0px;
    --colt-offset-y: 0px;
    transform: translate(var(--colt-offset-x), var(--colt-offset-y)) rotate(var(--colt-base-rotation)) scale(var(--colt-scale-x), var(--colt-scale-y));
    transform-origin: var(--colt-origin, 50% 50%);
}

.game-container.p2-ai-opponent .opponent-section #fire-btn2 .fire-text {
    display: none;
}

.fire-button.disabled {
    background: linear-gradient(180deg, #2e2e2e 0%, #1c1c1c 100%);
    color: #8d8d8d;
    border: 2px solid #4a4a4a;
    box-shadow: 0 3px 0 #111, inset 0 -4px 10px rgba(0, 0, 0, 0.32);
}

.fire-button.shot-clean-glow {
    animation: none;
    background: linear-gradient(180deg, #74ff99 0%, #2f9f5b 100%);
    box-shadow: 0 0 26px rgba(84, 255, 136, 0.92),
        0 0 54px rgba(84, 255, 136, 0.58),
        0 5px 0 #1f5a35,
        inset 0 -5px 20px rgba(0, 0, 0, 0.25);
    color: #fff;
    border: 2px solid rgba(255, 255, 255, 0.3);
    filter: brightness(1.16);
}

.fire-button.shot-dirty-glow {
    animation: none;
    background: linear-gradient(180deg, #c28a5a 0%, #7a4d2f 100%);
    box-shadow: 0 0 24px rgba(145, 95, 48, 0.88),
        0 0 48px rgba(120, 73, 34, 0.56),
        0 5px 0 #4b2e19,
        inset 0 -5px 20px rgba(0, 0, 0, 0.25);
    color: #fff;
    border: 2px solid rgba(255, 255, 255, 0.3);
    filter: brightness(1.08);
}

/* ============================================
   새로운 Colt SAA 로드/무기 애니메이션
   ============================================ */
.colt-wrapper {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0;
    container-type: size;
    overflow: visible;
    padding: 0;
    pointer-events: none;
    z-index: 1;
}

.colt-svg {
    /* Fit by both width and height of the button area (after 90deg rotation). */
    width: 100%;
    height: 100%;
    --colt-scale-mag: 1.16;
    --colt-fit-height: min(calc(100cqw / var(--colt-scale-mag)), calc((100cqh / 1.5) / var(--colt-scale-mag)));
    height: var(--colt-fit-height);
    width: calc(var(--colt-fit-height) * 1.5);
    max-width: 100%;
    max-height: 100%;
    overflow: visible;
    --colt-base-rotation: -90deg;
    --colt-scale-x: var(--colt-scale-mag);
    --colt-scale-y: calc(var(--colt-scale-mag) * -1);
    --colt-origin: 50% 50%;
    --colt-offset-x: 0px;
    --colt-offset-y: 0px;
    transform: translate(var(--colt-offset-x), var(--colt-offset-y)) rotate(var(--colt-base-rotation)) scale(var(--colt-scale-x), var(--colt-scale-y));
    transform-origin: var(--colt-origin, 50% 50%);
}

#fire-btn2 .colt-svg {
    --colt-base-rotation: -90deg;
    --colt-offset-x: 0px;
    --colt-offset-y: 0px;
    transform: translate(var(--colt-offset-x), var(--colt-offset-y)) rotate(var(--colt-base-rotation)) scale(var(--colt-scale-x), var(--colt-scale-y));
    transform-origin: var(--colt-origin, 50% 50%);
}

#fire-btn1 .colt-svg {
    --colt-base-rotation: -90deg;
    --colt-offset-x: 0px;
    --colt-offset-y: 0px;
    transform: translate(var(--colt-offset-x), var(--colt-offset-y)) rotate(var(--colt-base-rotation)) scale(var(--colt-scale-x), var(--colt-scale-y));
    transform-origin: var(--colt-origin, 50% 50%);
}

.fire-text {
    position: absolute;
    left: 50%;
    bottom: 6px;
    transform: translateX(-50%);
    z-index: 3;
    pointer-events: none;
    padding: 0;
    font-size: clamp(0.9rem, 3.6vw, 1.15rem);
    line-height: 1.1;
    letter-spacing: 0.2px;
    white-space: nowrap;
}

.cylinder-group {
    /* Origin calculation: original center was 55 28. With scale 0.88 it shifted slightly. */
    transform-origin: 55px 28px;
    transition: transform 0.35s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.muzzle-flash {
    opacity: 0;
    transform-origin: 102px 21px;
    filter: drop-shadow(0 0 12px rgba(255, 196, 70, 0.95)) drop-shadow(0 0 22px rgba(255, 130, 40, 0.75));
    pointer-events: none;
}

.muzzle-core {
    fill: #fffde3;
}

.muzzle-rays {
    fill: #ffc845;
}

.muzzle-trail {
    fill: none;
    stroke: #ffe2a2;
    stroke-width: 3.2;
    stroke-linecap: round;
    opacity: 0;
    transform-origin: 103px 21px;
    filter: drop-shadow(0 0 8px rgba(255, 224, 163, 0.9));
}

.muzzle-bullet {
    fill: #fffef6;
    opacity: 0;
    transform-origin: 104px 21px;
    filter: drop-shadow(0 0 4px rgba(255, 255, 255, 0.9));
}

.muzzle-smoke {
    fill: rgba(226, 226, 226, 0.92);
    opacity: 0;
    filter: drop-shadow(0 0 5px rgba(255, 255, 255, 0.35));
}

.fire-button.fired .muzzle-flash {
    animation: muzzleFlashBurst 0.24s ease-out 1;
}

.fire-button.fired .muzzle-trail {
    animation: muzzleTrailShot 0.22s ease-out 1;
}

.fire-button.fired .muzzle-bullet {
    animation: muzzleBulletShot 0.24s linear 1;
}

.fire-button.fired .muzzle-smoke.smoke-1 {
    animation: muzzleSmoke1 0.62s ease-out 1;
}

.fire-button.fired .muzzle-smoke.smoke-2 {
    animation: muzzleSmoke2 0.68s ease-out 1;
}

.fire-button.fired .muzzle-smoke.smoke-3 {
    animation: muzzleSmoke3 0.56s ease-out 1;
}

.fire-button.fired .muzzle-smoke.smoke-4 {
    animation: muzzleSmoke4 0.72s ease-out 1;
}

.fire-button.fired .muzzle-smoke.smoke-5 {
    animation: muzzleSmoke5 0.64s ease-out 1;
}

@keyframes muzzleFlashBurst {
    0% {
        opacity: 0;
        transform: scale(0.2);
    }

    20% {
        opacity: 1;
        transform: scale(1.08);
    }

    55% {
        opacity: 1;
        transform: scale(1.85);
    }

    100% {
        opacity: 0;
        transform: scale(0.65);
    }
}

@keyframes muzzleTrailShot {
    0% {
        opacity: 0;
        transform: scaleX(0.2);
    }

    16% {
        opacity: 1;
        transform: scaleX(1);
    }

    100% {
        opacity: 0;
        transform: scaleX(2.1);
    }
}

@keyframes muzzleBulletShot {
    0% {
        opacity: 0;
        transform: translateX(0) scale(0.62);
    }

    10% {
        opacity: 1;
        transform: translateX(0) scale(1);
    }

    100% {
        opacity: 0;
        transform: translateX(44px) scale(0.88);
    }
}

@keyframes muzzleSmoke1 {
    0% {
        opacity: 0;
        transform: translate(0, 0) scale(0.45);
    }

    24% {
        opacity: 0.9;
    }

    100% {
        opacity: 0;
        transform: translate(18px, -6px) scale(2);
    }
}

@keyframes muzzleSmoke2 {
    0% {
        opacity: 0;
        transform: translate(0, 0) scale(0.45);
    }

    22% {
        opacity: 0.84;
    }

    100% {
        opacity: 0;
        transform: translate(22px, 8px) scale(2.1);
    }
}

@keyframes muzzleSmoke3 {
    0% {
        opacity: 0;
        transform: translate(0, 0) scale(0.45);
    }

    20% {
        opacity: 0.72;
    }

    100% {
        opacity: 0;
        transform: translate(15px, -10px) scale(1.65);
    }
}

@keyframes muzzleSmoke4 {
    0% {
        opacity: 0;
        transform: translate(0, 0) scale(0.4);
    }

    24% {
        opacity: 0.7;
    }

    100% {
        opacity: 0;
        transform: translate(24px, 2px) scale(2.3);
    }
}

@keyframes muzzleSmoke5 {
    0% {
        opacity: 0;
        transform: translate(0, 0) scale(0.4);
    }

    22% {
        opacity: 0.66;
    }

    100% {
        opacity: 0;
        transform: translate(20px, -12px) scale(2.05);
    }
}

.fire-button.fired .cylinder-group {
    transform: translateY(-20px) rotate(-15deg);
}

.fire-button.fired .colt-svg {
    animation: gunMuzzleRise 0.6s cubic-bezier(0.22, 0.78, 0.2, 1);
}

@keyframes gunMuzzleRise {
    0% {
        transform: translate(var(--colt-offset-x), var(--colt-offset-y)) rotate(var(--colt-base-rotation)) scale(var(--colt-scale-x), var(--colt-scale-y));
    }

    42% {
        transform: translate(var(--colt-offset-x), var(--colt-offset-y)) rotate(calc(var(--colt-base-rotation) + 24deg)) scale(var(--colt-scale-x), var(--colt-scale-y));
    }

    68% {
        transform: translate(var(--colt-offset-x), var(--colt-offset-y)) rotate(calc(var(--colt-base-rotation) + 12deg)) scale(var(--colt-scale-x), var(--colt-scale-y));
    }

    82% {
        transform: translate(var(--colt-offset-x), var(--colt-offset-y)) rotate(calc(var(--colt-base-rotation) + 4deg)) scale(var(--colt-scale-x), var(--colt-scale-y));
    }

    92% {
        transform: translate(var(--colt-offset-x), var(--colt-offset-y)) rotate(calc(var(--colt-base-rotation) - 1deg)) scale(var(--colt-scale-x), var(--colt-scale-y));
    }

    100% {
        transform: translate(var(--colt-offset-x), var(--colt-offset-y)) rotate(var(--colt-base-rotation)) scale(var(--colt-scale-x), var(--colt-scale-y));
    }
}

.empty-shell {
    opacity: 0;
    transition: all 0.2s;
}

.fire-button.fired .empty-shell {
    opacity: 1;
    transform: translateY(-12px) translateX(-5px) rotate(-45deg);
    transition: all 0.35s 0.15s ease-out;
}

.colt-hammer,
.colt-trigger {
    transition: transform 0.05s ease-out;
}

.fire-button.active:active .colt-hammer {
    transform-origin: 35px 23px;
    transform: rotate(-25deg);
}

.fire-button.active:active .colt-trigger {
    transform-origin: 46px 42px;
    transform: rotate(15deg);
}

/* ============================================
   중앙 게임 정보 영역
   ============================================ */
.center-section {
    background: linear-gradient(90deg,
            transparent 0%,
            rgba(0, 0, 0, 0.9) 20%,
            rgba(0, 0, 0, 0.95) 50%,
            rgba(0, 0, 0, 0.9) 80%,
            transparent 100%);
    padding: 10px 5px;
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    z-index: 10;
    flex-shrink: 0;
    min-height: 130px;
    position: relative;
}

.game-container.entry-ready .center-section {
    z-index: auto;
}

.entry-start-overlay.show~.center-section .side-action-stack {
    z-index: 272;
}

.entry-start-overlay.show~.center-section {
    z-index: auto;
}

.entry-start-overlay.show~.center-section .start-button-wrapper {
    visibility: hidden;
    pointer-events: none;
}

.entry-start-overlay.show~.opponent-section {
    position: relative;
    z-index: 271;
}

.entry-start-overlay.show~.opponent-section::after {
    content: '';
    position: absolute;
    inset: 0;
    pointer-events: none;
    z-index: 271;
    background: radial-gradient(circle at 50% -8%, rgba(255, 255, 255, 0.08) 0%, rgba(0, 0, 0, 0.9) 72%);
}

.entry-start-overlay.show~.opponent-section .player-info .name-row,
.entry-start-overlay.show~.opponent-section .player-info .cowboy {
    position: relative;
    z-index: 272;
}

.entry-start-overlay.show~.my-section .player-info .name-row,
.entry-start-overlay.show~.my-section .player-info .cowboy {
    position: relative;
    z-index: 272;
}

.countdown-side {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    min-width: 0;
    overflow: visible;
}

.opponent-countdown {
    transform: rotate(180deg);
}

.game-container.p2-ai-opponent .opponent-countdown {
    transform: none;
}

.countdown {
    font-family: 'Rye', serif;
    font-size: min(2.5rem, 8vw);
    color: var(--countdown-neutral);
    text-shadow: 0 0 20px var(--countdown-neutral-glow),
        3px 3px 0 rgba(0, 0, 0, 0.8);
    line-height: 1;
    white-space: nowrap;
}

/* 카운트다운 숫자 팝 애니메이션 */
.countdown.countdown-pop {
    animation: countdownPop 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes countdownPop {
    0% {
        transform: scale(2);
        opacity: 0;
        text-shadow: 0 0 60px rgba(255, 248, 239, 0.95),
            0 0 100px rgba(255, 248, 239, 0.95);
    }

    50% {
        opacity: 1;
        text-shadow: 0 0 40px rgba(255, 248, 239, 0.92),
            0 0 80px rgba(255, 248, 239, 0.92);
    }

    100% {
        transform: scale(1);
        text-shadow: 0 0 20px var(--countdown-neutral-glow),
            3px 3px 0 rgba(0, 0, 0, 0.8);
    }
}

.countdown.go {
    color: var(--ui-accent);
    text-shadow: 0 0 30px var(--ui-accent),
        0 0 60px var(--ui-accent-dim),
        3px 3px 0 rgba(0, 0, 0, 0.8);
    animation: goPulse 0.12s ease-in-out infinite, goAppear 0.3s ease-out;
}

@keyframes goPulse {

    0%,
    100% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.2);
    }
}

@keyframes goAppear {
    0% {
        transform: scale(3);
        opacity: 0;
    }

    100% {
        transform: scale(1);
        opacity: 1;
    }
}

.round-info {
    display: none;
    font-family: var(--game-font-family);
    font-size: clamp(0.55rem, 2.5vw, 0.7rem);
    color: var(--ui-accent);
    letter-spacing: 1px;
    text-shadow: 1px 1px 0 rgba(0, 0, 0, 0.8);
}

/* 중앙 컨트롤 */
.center-controls {
    --center-controls-width: calc(clamp(84px, 25vw, 136px) + 16px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 8px;
    width: var(--center-controls-width);
    min-width: var(--center-controls-width);
    flex-shrink: 0;
    position: relative;
}

.game-container.entry-ready .center-controls {
    position: static;
    width: var(--center-controls-width);
    min-width: var(--center-controls-width);
    padding: 0 8px;
}

.game-message {
    position: absolute;
    top: -34px;
    left: 50%;
    transform: translateX(-50%);
    font-family: var(--game-font-family);
    font-size: clamp(0.8rem, 3.5vw, 1rem);
    color: var(--sand-light);
    text-align: center;
    text-shadow: 1px 1px 0 rgba(0, 0, 0, 0.8);
    white-space: nowrap;
    pointer-events: none;
    min-height: 1.1em;
    z-index: 12;
}

.game-message-opponent {
    top: -34px;
}

.game-message-me {
    top: -34px;
}

.game-message:empty {
    display: none;
}

.game-message.damage {
    color: var(--ui-accent);
    font-weight: 700;
}

/* 시작 버튼 래퍼 */
.start-button-wrapper {
    position: relative;
    --start-btn-width: clamp(84px, 25vw, 136px);
    --start-btn-height: calc(var(--start-btn-width) * 0.66);
    --start-btn-font-size: clamp(0.9rem, calc(var(--start-btn-height) * 0.24), 1.24rem);
    width: var(--start-btn-width);
    height: var(--start-btn-height);
    display: flex;
    align-items: center;
    justify-content: center;
}

.game-container.entry-ready .start-button-wrapper {
    visibility: hidden;
    pointer-events: none;
}

/* 시작 버튼 */
.start-button {
    position: relative;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    width: var(--start-btn-width);
    height: var(--start-btn-height);
    padding: 0 clamp(10px, 2.2vw, 16px);
    font-family: var(--game-font-family);
    font-size: var(--start-btn-font-size);
    background: linear-gradient(180deg, var(--ui-start-btn) 0%, var(--ui-start-btn-dim) 100%);
    border: 2px solid rgba(255, 188, 137, 0.92);
    border-radius: 12px;
    color: #291506;
    cursor: pointer;
    box-shadow: 0 0 16px var(--ui-start-btn-glow), 0 8px 18px rgba(0, 0, 0, 0.34);
    transition: box-shadow 0.15s ease, transform 0.15s ease, filter 0.15s ease;
    line-height: 1.2;
    text-align: center;
    text-shadow: none;
    z-index: 2;
    white-space: nowrap;
    word-break: keep-all;
}


.start-button:active {
    transform: scale(0.98);
    box-shadow: 0 0 10px rgba(255, 179, 125, 0.28), 0 6px 12px rgba(0, 0, 0, 0.3);
    filter: brightness(0.98);
    animation: none;
}

.start-button:disabled {
    background: linear-gradient(180deg, #444 0%, #333 100%);
    color: #555;
    box-shadow: 0 2px 0 #222;
    border-color: transparent;
    cursor: not-allowed;
    animation: none;
}

/* GO 타이머 (버튼 감싸기) */
.go-timer-svg {
    position: absolute;
    top: -8px;
    left: -8px;
    width: calc(100% + 16px);
    height: calc(100% + 16px);
    z-index: 3;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s;
}

.go-timer-svg.active {
    opacity: 1;
}

.go-timer-bg {
    fill: none;
    stroke: rgba(255, 255, 255, 0.1);
    stroke-width: 3;
}

.go-timer-progress {
    fill: none;
    stroke: var(--ui-accent);
    stroke-width: 4;
    stroke-linecap: round;
    stroke-dasharray: 324;
    stroke-dashoffset: 0;
    transition: stroke-dashoffset 0.05s linear;
    filter: drop-shadow(0 0 10px var(--ui-accent));
}

/* ============================================
   홈 버튼 (2초 꾹 누르기)
   ============================================ */
.home-btn-container {
    position: relative;
    width: 44px;
    height: 44px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.home-btn-progress {
    position: absolute;
    width: 100%;
    height: 100%;
    transform: rotate(-90deg);
}

.home-btn-bg {
    fill: rgba(0, 0, 0, 0.6);
    stroke: rgba(255, 106, 61, 0.4);
    stroke-width: 2;
}

.home-btn-fill {
    fill: none;
    stroke: var(--ui-accent);
    stroke-width: 3;
    stroke-linecap: round;
    stroke-dasharray: 126;
    stroke-dashoffset: 126;
    transition: stroke-dashoffset 0.05s linear;
}

.home-btn-icon {
    font-size: 1.2rem;
    z-index: 1;
    filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.5));
}

.home-btn-container:active .home-btn-icon {
    transform: scale(0.9);
}

.home-btn-container.hidden {
    display: none;
}

/* ============================================
   게임 오버 오버레이
   ============================================ */
.game-over-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(ellipse at center,
            rgba(26, 15, 10, 0.95) 0%,
            rgba(0, 0, 0, 0.98) 100%);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.game-over-overlay.show {
    display: flex;
    animation: overlayFadeIn 0.3s ease-out;
}

@keyframes overlayFadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

.game-over-content {
    text-align: center;
    animation: gameOverAppear 0.6s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    padding: 30px 20px;
}

@keyframes gameOverAppear {
    0% {
        transform: scale(0.3) rotate(-10deg);
        opacity: 0;
    }

    50% {
        transform: scale(1.1) rotate(2deg);
    }

    100% {
        transform: scale(1) rotate(0deg);
        opacity: 1;
    }
}

.winner-emoji {
    font-size: clamp(4rem, 20vw, 6rem);
    margin-bottom: 10px;
    animation: emojiPop 0.8s cubic-bezier(0.175, 0.885, 0.32, 1.275) 0.2s both;
    filter: drop-shadow(0 0 30px rgba(255, 106, 61, 0.8));
}

@keyframes emojiPop {
    0% {
        transform: scale(0) rotate(-30deg);
        opacity: 0;
    }

    60% {
        transform: scale(1.2) rotate(10deg);
    }

    100% {
        transform: scale(1) rotate(0deg);
        opacity: 1;
    }
}

.game-over-content h1 {
    font-family: var(--game-font-family);
    font-size: clamp(2.2rem, 14vw, 3.5rem);
    color: var(--ui-accent);
    text-shadow: 0 0 40px rgba(255, 106, 61, 1),
        0 0 80px rgba(255, 106, 61, 0.5),
        5px 5px 0 rgba(0, 0, 0, 0.9);
    margin-bottom: 20px;
    animation: victoryGlow 1.5s ease-in-out infinite;
}

@keyframes victoryGlow {

    0%,
    100% {
        text-shadow: 0 0 40px rgba(255, 106, 61, 1),
            0 0 80px rgba(255, 106, 61, 0.5),
            5px 5px 0 rgba(0, 0, 0, 0.9);
    }

    50% {
        text-shadow: 0 0 60px rgba(255, 106, 61, 1),
            0 0 120px rgba(255, 106, 61, 0.7),
            5px 5px 0 rgba(0, 0, 0, 0.9);
    }
}

#winner-score {
    display: none;
    font-family: var(--game-font-family);
    font-size: clamp(1.2rem, 5.5vw, 1.6rem);
    color: var(--sand-light);
    margin-bottom: 0;
    text-shadow: 2px 2px 0 rgba(0, 0, 0, 0.8);
    animation: winnerSlide 0.5s ease-out 0.3s both;
}

.final-scores {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    padding: 15px;
    margin-bottom: 25px;
}

.final-score-row {
    display: flex;
    justify-content: space-between;
    padding: 8px 0;
    font-family: var(--game-font-family);
    font-size: clamp(1rem, 4.3vw, 1.2rem);
    color: var(--sand-light);
    text-shadow: 1px 1px 0 rgba(0, 0, 0, 0.55);
}

.final-score-row:first-child {
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

@keyframes winnerSlide {
    from {
        transform: translateY(20px);
        opacity: 0;
    }

    to {
        transform: translateY(0);
        opacity: 1;
    }
}

#restart-btn {
    display: block;
    width: 100%;
    max-width: 260px;
    margin: 0 auto 12px;
    padding: 16px 30px;
    font-family: var(--game-font-family);
    font-size: clamp(1.1rem, 4.5vw, 1.3rem);
    background: linear-gradient(180deg, var(--ui-accent) 0%, var(--ui-accent-dim) 100%);
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 12px;
    color: var(--desert-night);
    cursor: pointer;
    box-shadow: 0 5px 0 #7a2a1d,
        0 0 25px rgba(255, 106, 61, 0.5);
    animation: buttonSlide 0.5s ease-out 0.5s both;
}

@keyframes buttonSlide {
    from {
        transform: translateY(30px);
        opacity: 0;
    }

    to {
        transform: translateY(0);
        opacity: 1;
    }
}

#restart-btn:active {
    transform: translateY(3px);
    box-shadow: 0 2px 0 #7a2a1d;
}

#hub-btn {
    display: block;
    width: 100%;
    max-width: 260px;
    margin: 0 auto;
    padding: 14px 25px;
    font-family: var(--game-font-family);
    font-size: clamp(0.95rem, 4vw, 1.1rem);
    background: linear-gradient(180deg, #555 0%, #333 100%);
    border: 2px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    color: var(--sand-light);
    cursor: pointer;
    box-shadow: 0 4px 0 #1a1a1a;
    animation: buttonSlide 0.5s ease-out 0.65s both;
}

#hub-btn:active {
    transform: translateY(2px);
    box-shadow: 0 2px 0 #1a1a1a;
}

/* ============================================
   화면 효과
   ============================================ */
.flash-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 500;
}

.flash-overlay.flash-clean {
    animation: flashClean 0.15s ease-out;
}

.flash-overlay.flash-dirty {
    animation: flashDirty 0.12s ease-out;
}

@keyframes flashClean {
    0% {
        background: radial-gradient(circle at center, rgba(255, 255, 255, 0.9) 0%, rgba(255, 215, 0, 0.7) 50%, transparent 100%);
    }

    50% {
        background: radial-gradient(circle at center, rgba(255, 215, 0, 0.5) 0%, rgba(255, 182, 39, 0.3) 50%, transparent 100%);
    }

    100% {
        background: transparent;
    }
}

@keyframes flashDirty {
    0% {
        background: radial-gradient(circle at center, rgba(255, 150, 100, 0.7) 0%, rgba(255, 107, 53, 0.4) 50%, transparent 100%);
    }

    100% {
        background: transparent;
    }
}

/* 화면 흔들림 */
.game-container.shake {
    animation: containerShake 0.5s ease-out;
}

@keyframes containerShake {

    0%,
    100% {
        transform: translateX(0) translateY(0);
    }

    10% {
        transform: translateX(-10px) translateY(-3px);
    }

    20% {
        transform: translateX(10px) translateY(3px);
    }

    30% {
        transform: translateX(-8px) translateY(-2px);
    }

    40% {
        transform: translateX(8px) translateY(2px);
    }

    50% {
        transform: translateX(-6px) translateY(-1px);
    }

    60% {
        transform: translateX(6px) translateY(1px);
    }

    70% {
        transform: translateX(-4px);
    }

    80% {
        transform: translateX(4px);
    }
}

@keyframes entry-start-pulse {
    0% {
        box-shadow: 0 0 12px rgba(255, 107, 53, 0.32), 0 8px 18px rgba(0, 0, 0, 0.34);
    }

    50% {
        box-shadow: 0 0 24px rgba(255, 182, 39, 0.72), 0 10px 22px rgba(0, 0, 0, 0.42);
    }

    100% {
        box-shadow: 0 0 12px rgba(255, 107, 53, 0.32), 0 8px 18px rgba(0, 0, 0, 0.34);
    }
}

@keyframes entry-start-sweep {
    0% {
        left: -70%;
    }

    100% {
        left: 132%;
    }
}

/* 플레이어 피격 */
.player-section.hit {
    animation: hitFlash 0.5s ease-out;
}

@keyframes hitFlash {
    0% {
        filter: brightness(1);
    }

    10% {
        filter: brightness(3) saturate(0) contrast(1.2);
    }

    25% {
        filter: brightness(0.5) saturate(1.5) hue-rotate(10deg);
    }

    40% {
        filter: brightness(2) saturate(0.5);
    }

    60% {
        filter: brightness(0.8) saturate(1.2);
    }

    100% {
        filter: brightness(1) saturate(1);
    }
}

/* 스턴 상태 */
.player-section.stunned {
    animation: stunnedFlash 0.5s ease-in-out infinite;
}

.opponent-section.stunned {
    animation: stunnedFlashOpponent 0.5s ease-in-out infinite;
}

@keyframes stunnedFlash {

    0%,
    100% {
        background: linear-gradient(0deg, rgba(255, 100, 50, 0.15) 0%, transparent 100%);
    }

    50% {
        background: linear-gradient(0deg, rgba(255, 50, 0, 0.3) 0%, transparent 100%);
    }
}

@keyframes stunnedFlashOpponent {

    0%,
    100% {
        background: linear-gradient(180deg, rgba(255, 100, 50, 0.15) 0%, transparent 100%);
    }

    50% {
        background: linear-gradient(180deg, rgba(255, 50, 0, 0.3) 0%, transparent 100%);
    }
}

.player-section.stunned .cowboy {
    animation: stunShake 0.15s infinite;
}

.player-section.stunned .fire-button .colt-wrapper {
    animation: gunStunnedShake 0.12s ease-in-out infinite;
}

@keyframes stunShake {

    0%,
    100% {
        transform: translateX(0) rotate(0deg);
    }

    25% {
        transform: translateX(-4px) rotate(-5deg);
    }

    75% {
        transform: translateX(4px) rotate(5deg);
    }
}

@keyframes gunStunnedShake {

    0%,
    100% {
        transform: translateX(0) rotate(0deg);
    }

    25% {
        transform: translateX(-5px) rotate(-2deg);
    }

    75% {
        transform: translateX(5px) rotate(2deg);
    }
}

/* ============================================
   반응형 조정
   ============================================ */
@media (max-height: 600px) {
    .player-section {
        padding: 5px 8px;
    }

    .center-section {
        min-height: 110px;
        padding: 8px 5px;
    }

    .cowboy {
        font-size: clamp(2rem, 10vw, 2.8rem);
    }

    .hp-bar-large {
        height: 30px;
    }
}

@media (max-width: 320px) {
    .fire-button {
        font-size: 1rem;
    }

    .start-button {
        padding: 8px 10px;
    }
}
