/* 기본 리셋 및 폰트 설정 */
:root {
    --bg-color: #0f172a; /* 어두운 배경 */
    --text-color: #f8fafc;
    --primary-color: #3b82f6; /* 메인 파란색 */
    --primary-hover: #60a5fa;
    --secondary-bg: #1e293b;
    --border-color: #334155;
    --accent-color: #10b981; /* 에메랄드 포인트 */
}

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

body {
    font-family: 'Inter', -apple-system, sans-serif;
    background-color: var(--bg-color);
    color: var(--text-color);
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
}

/* 게임 전체 컨테이너 (모바일 앱 느낌의 UI) */
.game-container {
    width: 100%;
    max-width: 480px;
    height: 800px;
    max-height: 95vh;
    background-color: var(--secondary-bg);
    border-radius: 16px;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.5), 0 8px 10px -6px rgba(0, 0, 0, 0.3);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    border: 1px solid var(--border-color);
}

/* 헤더 & 탭 */
.game-header {
    padding: 24px 24px 16px 24px;
    background: linear-gradient(180deg, #1e293b 0%, #0f172a 100%);
    border-bottom: 1px solid var(--border-color);
}

.game-header h1 {
    font-size: 26px;
    font-weight: 800;
    margin-bottom: 24px;
    text-align: center;
    /* 텍스트 그라데이션 효과 */
    background: linear-gradient(to right, #60a5fa, #34d399);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    letter-spacing: 1px;
}

.tabs {
    display: flex;
    gap: 8px;
    background-color: rgba(15, 23, 42, 0.5);
    padding: 4px;
    border-radius: 12px;
}

.tab-btn {
    flex: 1;
    padding: 12px 0;
    background-color: transparent;
    border: none;
    color: #94a3b8;
    font-size: 15px;
    font-weight: 600;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.tab-btn:hover {
    color: var(--text-color);
}

.tab-btn.active {
    background-color: var(--primary-color);
    color: white;
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.4);
}

/* 메인 컨텐츠 영역 */
.game-content {
    flex: 1;
    padding: 24px;
    overflow-y: auto;
    position: relative;
    /* 스크롤바 커스텀 */
    scrollbar-width: thin;
    scrollbar-color: var(--border-color) transparent;
}

.game-content::-webkit-scrollbar {
    width: 6px;
}
.game-content::-webkit-scrollbar-thumb {
    background-color: var(--border-color);
    border-radius: 10px;
}

/* SPA 뷰 전환 설정 */
.view {
    display: none;
    /* 뷰 전환 시 부드러운 애니메이션 */
    animation: fadeIn 0.4s ease-out forwards;
}

.view.active {
    display: block;
}

.view h2 {
    font-size: 22px;
    margin-bottom: 20px;
    color: var(--text-color);
    display: flex;
    align-items: center;
    gap: 12px;
}

.view h2::after {
    content: '';
    flex: 1;
    height: 1px;
    background: linear-gradient(to right, var(--primary-color), transparent);
}

.content-box {
    background-color: rgba(15, 23, 42, 0.4);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 20px;
}

.content-box p {
    color: #cbd5e1;
    line-height: 1.6;
    margin-bottom: 24px;
}

#combat-log p {
    margin-bottom: 0;
    line-height: 1.3;
}

/* 액션 버튼들 */
.action-buttons {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.action-btn {
    width: 100%;
    padding: 14px;
    background-color: var(--secondary-bg);
    border: 1px solid var(--border-color);
    color: var(--text-color);
    border-radius: 8px;
    font-weight: 600;
    font-size: 15px;
    cursor: pointer;
    transition: all 0.2s;
}

.action-btn:hover {
    background-color: var(--border-color);
    transform: translateY(-2px);
}

.action-btn.danger {
    background-color: rgba(239, 68, 68, 0.1);
    border-color: rgba(239, 68, 68, 0.3);
    color: #fca5a5;
}

.action-btn.danger:hover {
    background-color: rgba(239, 68, 68, 0.2);
    border-color: rgba(239, 68, 68, 0.5);
}

/* 스탯 그리드 디자인 */
.stats-container {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
}

.stat-box {
    background-color: rgba(15, 23, 42, 0.6);
    padding: 16px;
    border-radius: 12px;
    border: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    justify-content: center;
    transition: transform 0.2s;
}

.stat-box:hover {
    transform: scale(1.02);
    border-color: #475569;
}

.stat-label {
    font-size: 12px;
    color: #94a3b8;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 6px;
}

.stat-value {
    font-size: 18px;
    font-weight: 800;
    color: var(--text-color);
}

/* 스탯별 포인트 컬러 */
.stat-value.health { color: #ef4444; } /* 빨간색 */
.stat-value.gold { color: #f59e0b; }   /* 노란색 */
.stat-value.exp { color: #a855f7; }    /* 보라색 */
.stat-value.attack { color: #f97316; } /* 주황색 */
.stat-value.speed { color: #3b82f6; }  /* 파란색 */

/* 장비 슬롯 툴팁 디자인 */
.equip-slot {
    position: relative;
    cursor: help;
    display: flex;
    justify-content: space-between;
    padding: 6px;
    border-radius: 6px;
    transition: background-color 0.2s;
    background: rgba(15, 23, 42, 0.4);
    border: 1px solid var(--border-color);
}

.equip-slot:hover {
    background-color: rgba(59, 130, 246, 0.1);
    border-color: rgba(59, 130, 246, 0.3);
}

.equip-tooltip {
    display: none;
    position: absolute;
    bottom: 110%;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(15, 23, 42, 0.95);
    border: 1px solid var(--border-color);
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 12px;
    white-space: pre-line;
    width: max-content;
    min-width: 120px;
    z-index: 10;
    color: #f8fafc;
    box-shadow: 0 4px 6px rgba(0,0,0,0.5);
    text-align: center;
    pointer-events: none;
}

.equip-tooltip strong {
    display: block;
    color: #38bdf8;
    margin-bottom: 4px;
    border-bottom: 1px solid #334155;
    padding-bottom: 4px;
}

.equip-slot:hover .equip-tooltip {
    display: block;
}

/* 치명타 텍스트 스타일 */
.crit-text {
    color: #fef08a !important;
    font-weight: 900;
    text-shadow: 0 0 5px rgba(234, 179, 8, 0.8);
}

/* 캐릭터 슬롯 스타일 */
.char-slot {
    background: rgba(30, 41, 59, 0.8);
    border: 1px solid #475569;
    border-radius: 8px;
    padding: 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.char-slot-empty {
    background: rgba(15, 23, 42, 0.5);
    border: 1px dashed #475569;
    border-radius: 8px;
    padding: 16px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s;
}
.char-slot-empty:hover {
    background: rgba(30, 41, 59, 0.5);
    border-color: #94a3b8;
}

/* 애니메이션 키프레임 */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}
