/* ── High-End Buttons ── */
button {
    padding: 12px 28px;
    font-size: 15px;
    font-weight: 600;
    letter-spacing: 0.5px;
    cursor: pointer;
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    background: var(--glass-bg);
    color: #ffffff;
    backdrop-filter: var(--blur-intensity);
    -webkit-backdrop-filter: var(--blur-intensity);
    box-shadow: var(--glass-shine), 0 4px 15px rgba(0, 0, 0, 0.4);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    outline: none;
}

button:hover:not(:disabled) {
    background: rgba(255, 255, 255, 0.1);
    border-color: var(--accent-teal);
    box-shadow: 0 0 20px rgba(45, 226, 230, 0.3), var(--glass-shine);
    transform: translateY(-2px);
}

button:active:not(:disabled) {
    transform: translateY(0);
}

button:disabled {
    background: rgba(40, 40, 50, 0.5);
    color: #666;
    cursor: not-allowed;
    border-color: transparent;
    box-shadow: none;
}

/* 액션 버튼 특수 스타일 */
#btn-action {
    min-width: 180px;
    background: linear-gradient(135deg, rgba(45, 226, 230, 0.2), rgba(20, 20, 28, 0.6));
    border-color: rgba(45, 226, 230, 0.3);
}

.btn-end-turn-style {
    background: linear-gradient(135deg, rgba(224, 62, 82, 0.2), rgba(20, 20, 28, 0.6)) !important;
    border-color: rgba(224, 62, 82, 0.3) !important;
}
.btn-end-turn-style:hover:not(:disabled) {
    border-color: var(--accent-ember) !important;
    box-shadow: 0 0 20px rgba(224, 62, 82, 0.3) !important;
}

/* ── HP & Gauge Bars ── */
#hp-bar-bg {
    width: 300px;
    height: 18px;
    background: var(--glass-deep);
    border-radius: 100px;
    border: 1px solid var(--glass-border);
    position: relative;
    overflow: hidden;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.5);
    margin-top: 10px;
}

#hp-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--accent-ember), #ff7e5f);
    width: 100%;
    transition: width 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 0 15px rgba(224, 62, 82, 0.6);
}

#hp-text, #player-hp-text {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    font-weight: 700;
    font-size: 11px;
    font-family: 'Outfit', sans-serif;
    text-shadow: 0 1px 2px rgba(0,0,0,0.8);
    pointer-events: none;
    z-index: 5;
}

#player-hp-bar-bg {
    width: 220px;
    height: 14px;
    background: var(--glass-deep);
    border-radius: 100px;
    border: 1px solid var(--glass-border);
    overflow: hidden;
    position: relative;
}

#player-hp-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, #4caf50, var(--accent-teal));
    width: 100%;
    transition: width 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 0 10px rgba(76, 175, 80, 0.4);
}

/* ── Relic Cards (Draft UI) ── */
#reward-ui {
    position: absolute; top: 0; left: 0; width: 100%; height: 100%;
    background: radial-gradient(circle at center, rgba(13, 13, 20, 0.98) 0%, var(--bg-void) 100%);
    z-index: 150;
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    backdrop-filter: blur(10px);
}

.artifact-cards-container {
    flex: 1;
    display: flex;
    flex-direction: row;
    overflow-x: auto;
    overflow-y: hidden;
    gap: 24px;
    padding: 20px 40px;
    width: 100%;
    align-items: center;
    justify-content: flex-start; /* 가로 스크롤을 위해 왼쪽 정렬 */
    scroll-snap-type: x mandatory;
    scrollbar-width: none;
    -ms-overflow-style: none;
}

.artifact-cards-container::-webkit-scrollbar {
    display: none;
}

.artifact-card {
    flex: 0 0 260px; /* 캐러셀 형태를 위한 고정 너비 */
    scroll-snap-align: center;
    background: var(--glass-deep);
    border: 1px solid var(--glass-border);
    border-radius: 20px;
    padding: 24px;
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    filter: brightness(0.6) grayscale(0.4);
    animation: cardEntrance 0.6s ease-out backwards;
}

.artifact-card.active {
    filter: none;
    border-color: rgba(255, 255, 255, 0.15);
    cursor: pointer;
}

.artifact-card.active:hover {
    transform: translateY(-10px) scale(1.02);
    border-color: var(--accent-teal);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.6), 0 0 20px rgba(45, 226, 230, 0.2);
}

.artifact-card.selected {
    filter: none;
    border-color: var(--accent-gold);
    box-shadow: 0 0 30px rgba(212, 175, 55, 0.4);
    transform: translateY(-15px) scale(1.05);
}

/* ── Tooltips & Help ── */
#btn-help {
    background: var(--glass-bg);
    border: 1px solid rgba(212, 175, 55, 0.2);
    color: var(--accent-gold);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
}

#btn-help:hover {
    border-color: var(--accent-gold);
    box-shadow: 0 0 20px rgba(212, 175, 55, 0.3);
}

/* ── Recipe Board (도움말 패널) ── */
#recipe-board {
    display: none;
    opacity: 0;
    background: var(--glass-deep);
    backdrop-filter: var(--blur-heavy);
    -webkit-backdrop-filter: var(--blur-heavy);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    padding: 16px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.7);
    transition: opacity 0.3s ease;
    z-index: 100;
    max-height: 80vh; /* 모바일 이탈 방지 */
    overflow-y: auto; /* 내부 스크롤 활성 */
}

#recipe-board.visible {
    display: block;
    opacity: 1;
}

#recipe-board h3 {
    margin-top: 0;
    font-size: 15px;
    color: var(--accent-gold);
    border-bottom: 1px solid var(--glass-border);
    padding-bottom: 8px;
    margin-bottom: 12px;
}

#recipe-board li {
    margin-bottom: 8px;
    background: rgba(255, 255, 255, 0.03);
    padding: 8px;
    border-radius: 6px;
    font-size: 12px;
}

/* ── Relic Tooltip (유물 설명칸) ── */
.relic-tooltip {
    visibility: hidden;
    opacity: 0;
    pointer-events: none;
    position: absolute;
    top: 120%;
    left: 50%;
    transform: translateX(-50%);
    width: max-content;
    max-width: 220px;
    white-space: normal;
    word-break: keep-all;
    line-height: 1.4;
    background: rgba(13, 13, 20, 0.95);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--glass-border);
    border-radius: 8px;
    padding: 10px 14px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.8);
    color: #e2e2e2;
    font-size: 12px;
    z-index: 110;
    transition: opacity 0.3s, visibility 0.3s, top 0.3s; /* 트랜지션 시간 보정 */
    transition-delay: 0.1s; /* 모바일 터치 유지 시간 확보 */
}

/* PC 인터랙션: 마우스 호버 */
@media (hover: hover) {
    .relic-item:hover .relic-tooltip {
        visibility: visible;
        opacity: 1;
        top: 110%;
    }
}

/* 모바일 인터랙션: 터치 액티브 */
@media (hover: none) {
    .relic-item:active .relic-tooltip {
        visibility: visible;
        opacity: 1;
        top: 110%;
        transition-delay: 0s; /* 터치 시엔 즉시 등장 */
    }
}

/* ── Mobile Responsive Overrides ── */
@media (max-width: 768px) {
    /* 1. 도움말 패널 중앙 정렬 및 너비 최적화 */
    #recipe-board {
        top: 60px;
        right: 50%;
        transform: translateX(50%);
        width: 90vw;
        max-width: 320px;
        padding: 12px;
        font-size: 11px;
    }

    #recipe-board h3 {
        font-size: 13px;
        margin-bottom: 8px;
    }

    /* 2. 유물 툴팁 좌측 잘림 방지 (중앙 정렬 해제) */
    .relic-tooltip {
        left: 0;
        transform: none;
        width: max-content;
        max-width: 70vw;
        font-size: 11px;
        padding: 8px;
        transition-delay: 0.15s; /* 모바일에서는 사라지는 시간을 더 확보 */
    }

    /* 3. 유물 아이콘 크기 축소 */
    .relic-item {
        width: 32px;
        height: 32px;
        font-size: 16px;
    }
}

/* ── Boss Effects ── */
.boss-glow {
    animation: bossGlow 3s ease-in-out infinite;
}

#monster svg {
    filter: drop-shadow(0 0 10px var(--boss-glow-color));
    transition: filter 0.3s ease;
}

/* ── Combat VFX: Floating Text ── */
.floating-text {
    position: absolute;
    z-index: 9999;
    pointer-events: none;
    font-weight: 900;
    font-size: 32px;
    font-family: 'Outfit', sans-serif;
    white-space: nowrap;
    text-transform: uppercase;
    animation: etherealFloat 1.2s cubic-bezier(0.22, 1, 0.36, 1) forwards;
    text-shadow: 0 0 10px var(--glow-color), 0 0 20px var(--glow-color), 2px 2px 4px rgba(0,0,0,0.9);
}

/* 상태별 발광 컬러 매핑 */
.floating-text.clash { --glow-color: var(--accent-gold); color: #ffffff; }
.floating-text.damage { --glow-color: var(--accent-ember); color: #ffeb3b; }
.floating-text.shield { --glow-color: var(--accent-teal); color: #e0ffff; }
.floating-text.heal { --glow-color: #00FF88; color: #ffffff; }

/* ── Floating Text 애니메이션 ── */
@keyframes etherealFloat {
    0% {
        opacity: 0;
        transform: translate(-50%, 0) scale(0.5);
    }
    20% {
        opacity: 1;
        transform: translate(-50%, -20px) scale(1.2);
    }
    50% {
        opacity: 1;
        transform: translate(-50%, -40px) scale(1);
    }
    100% {
        opacity: 0;
        transform: translate(-50%, -100px) scale(0.8);
    }
}

/* ── Player Feedback VFX ── */
.floating-player-dmg {
    position: absolute;
    z-index: 10000;
    color: #ff3333;
    font-weight: 900;
    font-size: 24px;
    text-shadow: 0 0 10px rgba(255, 0, 0, 0.8), 2px 2px 0px #000;
    animation: playerHit 0.8s cubic-bezier(0.36, 0.07, 0.19, 0.97) forwards;
}

.floating-player-blocked {
    position: absolute;
    z-index: 10000;
    color: var(--accent-teal);
    font-weight: 900;
    font-size: 20px;
    text-shadow: 0 0 8px rgba(45, 226, 230, 0.8), 1px 1px 0px #000;
    animation: etherealFloat 1s forwards;
}

@keyframes playerHit {
    0% { transform: translate(-50%, 0) scale(1.5); opacity: 1; }
    20% { transform: translate(-60%, -10px) rotate(-5deg); }
    40% { transform: translate(-40%, -20px) rotate(5deg); }
    100% { transform: translate(-50%, -60px) scale(1); opacity: 0; }
}

/* ── Screen Effects ── */
.screen-shake-heavy {
    animation: shakeHeavy 0.5s cubic-bezier(.36,.07,.19,.97) both;
}

@keyframes shakeHeavy {
    10%, 90% { transform: translate3d(-4px, 0, 0); }
    20%, 80% { transform: translate3d(8px, 0, 0); }
    30%, 50%, 70% { transform: translate3d(-12px, 0, 0); }
    40%, 60% { transform: translate3d(12px, 0, 0); }
}

