/* =========================================
   PokeWASD 다크 모드 스타일 시트 (최적화 버전)
========================================= */

:root {
    /* 다크 테마 컬러 팔레트 */
    --bg-color: #0f172a;
    /* 딥 네이비 배경 */
    --card-bg: #1e293b;
    /* 카드/패널 배경 */
    --text-main: #f8fafc;
    /* 기본 흰색 텍스트 */
    --text-muted: #94a3b8;
    /* 서브 회색 텍스트 */
    --border-light: #334155;
    /* 경계선 색상 */
    --primary: #3b82f6;
    /* 포인트 블루 */
    --primary-hover: #60a5fa;
    /* 밝은 블루 (호버) */
    --accent: #fbbf24;
    /* 포인트 골드/옐로우 */
    --warning: #f59e0b;
    /* 주황색 */
    --success: #10b981;
    /* 초록색 */
    --danger: #ef4444;
    /* 빨간색 */

    /* 유리 질감 (Glassmorphism) - 다크버전 */
    --glass-bg: rgba(30, 41, 59, 0.75);
    --glass-border: rgba(255, 255, 255, 0.1);
    --glass-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    overflow-x: hidden;
    /* 가로 스크롤바가 생기는 현상 완벽 차단 */
    font-family: 'Pretendard Variable', Pretendard, -apple-system, BlinkMacSystemFont, system-ui, sans-serif;
    color: var(--text-main);
    line-height: 1.6;
    background-color: var(--bg-color);
    background-image:
        radial-gradient(at 0% 0%, rgba(59, 130, 246, 0.1) 0px, transparent 50%),
        radial-gradient(at 100% 0%, rgba(251, 191, 36, 0.05) 0px, transparent 50%),
        radial-gradient(at 50% 100%, rgba(16, 185, 129, 0.05) 0px, transparent 50%);
    background-attachment: fixed;
    min-height: 100vh;
}

.container {
    max-width: 600px;
    margin: 0 auto;
    text-align: center;
    padding-bottom: 40px;
}

/* =========================================
   글로벌 헤더 & 페이지 타이틀
========================================= */
.highlight-letter {
    color: var(--accent);
}

/* =========================================
   플로팅 글래스 메뉴바 (Navigation)
========================================= */
/* 3. 메뉴바 상단 여백 조정 */
.glass-nav {
    position: relative;
    top: 10px;
    /* 스크롤 시 상단에 붙는 위치를 살짝 위로 */
    z-index: 1000;
    display: flex;
    gap: 12px;
    background: var(--glass-bg);
    backdrop-filter: blur(16px);
    border: 1px solid var(--glass-border);
    padding: 10px 18px;
    /* 패딩도 살짝 다이어트 */
    border-radius: 50px;
    box-shadow: var(--glass-shadow);
    width: max-content;
    max-width: calc(100% - 30px);
    margin: 0 auto 20px auto;
    /* 메뉴바 아래 여백도 25px -> 20px로 조정 */
}

.glass-nav::-webkit-scrollbar {
    display: none;
}

/* 메뉴 버튼 기본 스타일 (세로 배열로 변경) */
.glass-nav a {
    text-decoration: none;
    padding: 10px 16px;
    /* 위아래 여백을 살짝 늘림 */
    border-radius: 20px;
    flex-shrink: 0;
    transition: all 0.2s ease;
    display: flex;
    flex-direction: column;
    /* 🌟 핵심: 영어와 한글을 위아래로 배치 */
    align-items: center;
    /* 🌟 핵심: 가운데 정렬 */
    justify-content: center;
}

/* 상단 영어 영역 */
.nav-top {
    display: flex;
    align-items: baseline;
}

.nav-key {
    font-size: 18px;
    font-weight: 900;
    color: var(--text-main);
    transition: color 0.2s;
}

.nav-text {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-muted);
    margin-left: 1px;
}

/* 하단 한글 영역 (새로 추가됨) */
.nav-sub {
    font-size: 11.5px;
    color: var(--text-muted);
    margin-top: 4px;
    font-weight: 600;
    letter-spacing: -0.5px;
    transition: color 0.2s;
}

/* 활성화 및 호버 효과 */
.glass-nav a:hover,
.glass-nav a.active {
    background: rgba(59, 130, 246, 0.15);
}

.glass-nav a:hover .nav-key,
.glass-nav a.active .nav-key {
    color: var(--accent);
}

.glass-nav a:hover .nav-text,
.glass-nav a.active .nav-text {
    color: var(--text-main);
}

.glass-nav a:hover .nav-sub,
.glass-nav a.active .nav-sub {
    color: var(--text-main);
}

/* 한글도 선택 시 밝게 변경 */

@media (max-width: 600px) {
    .glass-nav {
        width: calc(100% - 30px);
        flex-wrap: wrap;
        justify-content: center;
        border-radius: 20px;
        padding: 15px 12px;
        gap: 8px;
        white-space: normal;
        overflow-x: visible;
    }

    .glass-nav a {
        padding: 8px 12px;
        background: rgba(255, 255, 255, 0.05);
        border: 1px solid var(--border-light);
        flex: 1 1 auto;
    }
}

/* =========================================
   6칸 슬롯 (상단 고정)
========================================= */
.slots-container {
    display: flex;
    justify-content: space-around;
    margin-bottom: 20px;
    padding: 18px 10px;
    max-width: 550px;
    margin-left: auto;
    margin-right: auto;
}

.slot {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background-color: var(--card-bg);
    color: var(--text-muted);
    font-weight: bold;
    font-size: 15px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: inset 0 2px 5px rgba(0, 0, 0, 0.2);
    transition: all 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
    border: 2px solid var(--border-light);
    cursor: pointer;
    overflow: hidden;
    position: relative;
}

.slot.active {
    background-color: var(--primary);
    color: white;
    border: 2px solid var(--accent);
    transform: scale(1.15);
    box-shadow: 0 8px 20px rgba(251, 191, 36, 0.3);
}

.slot.filled {
    background-color: var(--bg-color);
    border-color: var(--accent);
}

.slot img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

/* =========================================
   아코디언 패널 공통
========================================= */
.glass-panel {
    background: var(--glass-bg);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--glass-border);
    box-shadow: var(--glass-shadow);
    border-radius: 24px;
}

.info-panel {
    max-height: 0;
    overflow: hidden;
    opacity: 0;
    margin-top: 0;
    padding: 0 20px;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    transform: translateY(-10px);
}

.info-panel.open {
    max-height: 1500px;
    opacity: 1;
    margin-top: 15px;
    padding: 25px 20px;
    transform: translateY(0);
}

.panel-header {
    display: flex;
    align-items: center;
    margin-bottom: 15px;
    border-bottom: 1px solid var(--border-light);
    padding-bottom: 10px;
}

.back-btn {
    background: none;
    border: none;
    font-size: 14px;
    font-weight: bold;
    color: var(--accent);
    cursor: pointer;
    padding: 5px 10px;
    border-radius: 8px;
    margin-right: 10px;
    transition: background 0.2s;
}

.back-btn:hover {
    background: rgba(251, 191, 36, 0.1);
}

.panel-title {
    font-size: 18px;
    font-weight: 800;
    color: var(--text-main);
    margin: 0;
}

/* =========================================
   1단계: 타입 선택 그리드 & 완료 버튼
========================================= */
.type-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    margin-bottom: 15px;
}

.type-select-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
    background: var(--card-bg);
    border: 2px solid var(--border-light);
    padding: 12px 5px;
    border-radius: 16px;
    font-size: 13.5px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.2s;
    color: var(--text-main);
}

.type-select-btn img {
    width: 30px;
    height: 30px;
    object-fit: contain;
}

.type-select-btn:hover {
    transform: translateY(-2px);
    border-color: var(--primary);
}

.type-select-btn.selected {
    border-color: var(--accent);
    background: rgba(251, 191, 36, 0.1);
    color: var(--accent);
}

.confirm-btn {
    width: 100%;
    padding: 15px;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: 12px;
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.2s;
}

.confirm-btn:hover:not(:disabled) {
    background: var(--primary-hover);
    transform: translateY(-2px);
}

.confirm-btn:disabled {
    background: var(--border-light);
    color: var(--text-muted);
    cursor: not-allowed;
}

/* =========================================
   2단계: 포켓몬 리스트
========================================= */
.poke-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
}

.poke-card {
    background: var(--card-bg);
    border: 1px solid var(--border-light);
    border-radius: 16px;
    padding: 12px;
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    transition: all 0.2s;
}

.poke-card:hover {
    border-color: var(--accent);
    transform: scale(1.02);
    background-color: rgba(251, 191, 36, 0.05);
}

.poke-img {
    width: 50px;
    height: 50px;
    object-fit: contain;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 50%;
}

.poke-info {
    display: flex;
    flex-direction: column;
    text-align: left;
}

.poke-name {
    font-size: 15px;
    font-weight: 800;
    color: var(--text-main);
}

.poke-rank {
    font-size: 12px;
    color: var(--accent);
    font-weight: bold;
}

/* =========================================
   3단계: 상세 족보 및 툴팁
========================================= */
.strategy-tags {
    display: flex;
    gap: 10px;
    margin: 15px 0;
    justify-content: flex-start;
}

.tag {
    background: var(--bg-color);
    padding: 6px 12px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: bold;
    border: 1px solid var(--border-light);
}

.tag.atk {
    border-left: 4px solid var(--danger);
}

.tag.def {
    border-left: 4px solid var(--primary);
}

.meta-section {
    margin-top: 20px;
    text-align: left;
}

.meta-section h4 {
    font-size: 15px;
    color: var(--accent);
    margin-bottom: 10px;
    padding-bottom: 5px;
    border-bottom: 1px dashed var(--border-light);
}

.meta-list {
    list-style: none;
    padding: 0;
}

.tooltip-item {
    background: var(--card-bg);
    margin-bottom: 8px;
    padding: 12px 14px;
    border-radius: 10px;
    font-size: 14.5px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: relative;
    cursor: help;
    border: 1px solid var(--border-light);
    transition: border-color 0.2s;
}

.tooltip-item:hover {
    border-color: var(--primary);
}

.item-name {
    font-weight: bold;
    color: var(--text-main);
}

.meta-rate {
    font-weight: 800;
    color: var(--accent);
    font-size: 14px;
}

/* 툴팁 팝업 */
.tooltip-box {
    visibility: hidden;
    opacity: 0;
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%) translateY(10px);
    background: rgba(15, 23, 42, 0.95);
    backdrop-filter: blur(8px);
    color: #fff;
    padding: 12px 16px;
    border-radius: 12px;
    width: max-content;
    max-width: 250px;
    font-size: 13px;
    line-height: 1.5;
    font-weight: normal;
    z-index: 100;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5);
    transition: all 0.3s;
    pointer-events: none;
    margin-bottom: 8px;
    text-align: left;
    border: 1px solid var(--border-light);
}

.tooltip-item:hover .tooltip-box {
    visibility: visible;
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

/* =========================================
   상세 정보: 종족값 & 상성 & 아이콘
========================================= */
.inline-type-icon {
    width: 18px;
    height: 18px;
    vertical-align: text-bottom;
    margin: 0 2px;
    object-fit: contain;
}

.title-type-icons {
    display: inline-flex;
    gap: 4px;
    margin-left: 6px;
}

.title-type-icons img {
    width: 24px;
    height: 24px;
    border-radius: 50%;
}

/* 종족값 6칸 그리드 */
.stats-container {
    /* 해당 요소들을 감싸는 div의 클래스명 */
    display: flex;
    flex-wrap: wrap;
    /* 공간이 모자라면 자동으로 아랫줄로 넘김! */
    gap: 6px;
    /* 줄바꿈 되었을 때 위아래/양옆 간격 */
    align-items: center;
    /* 요소들 높이 중앙 정렬 */
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 6px;
    margin: 15px 0;
}

.stat-item {
    background: var(--card-bg);
    border: 1px solid var(--border-light);
    border-radius: 12px;
    padding: 8px 4px;
    text-align: center;
    transition: all 0.2s;
}

.stat-label {
    display: block;
    font-size: 11.5px;
    color: var(--text-muted);
    font-weight: bold;
    margin-bottom: 2px;
    letter-spacing: -0.5px;
}

.stat-val {
    display: block;
    font-size: 15px;
    color: var(--text-main);
    font-weight: 600;
}

.stat-highest .stat-val {
    color: var(--accent);
    font-weight: 900;
    font-size: 17px;
    text-decoration: underline;
    text-underline-offset: 4px;
}

.stat-atk-high {
    border-color: rgba(239, 68, 68, 0.5);
    background: rgba(239, 68, 68, 0.1);
}

.stat-def-high {
    border-color: rgba(59, 130, 246, 0.5);
    background: rgba(59, 130, 246, 0.1);
}

/* 상성 박스 */
.matchup-box {
    background: var(--card-bg);
    border-radius: 16px;
    padding: 16px;
    margin: 15px 0;
    border: 1px solid var(--border-light);
    font-size: 14.5px;
    line-height: 1.7;
    text-align: left;
}

.matchup-weak {
    color: #fca5a5;
    margin-bottom: 8px;
}

/* 다크모드용 밝은 빨강 */
.matchup-resist {
    color: #86efac;
    margin-bottom: 8px;
}

/* 다크모드용 밝은 초록 */
.matchup-immune {
    color: #93c5fd;
}

/* 다크모드용 밝은 파랑 */
.matchup-box strong {
    font-weight: 800;
    color: var(--text-main);
}

/* =========================================
   [A]ssemble Party (가챠 페이지)
========================================= */
.party-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
    margin-bottom: 20px;
}

.party-member {
    background: var(--card-bg);
    border: 1px solid var(--border-light);
    border-radius: 12px;
    padding: 12px 5px;
    text-align: center;
    position: relative;
    cursor: pointer;
    transition: all 0.2s;
}

.party-member:hover {
    border-color: var(--primary);
}

.party-member.mega-core {
    border: 2px solid #a855f7;
    background: rgba(168, 85, 247, 0.1);
}

.member-img {
    width: 60px;
    height: 60px;
    object-fit: contain;
}

.member-name {
    display: block;
    font-weight: 700;
    font-size: 14px;
    margin-top: 5px;
    color: var(--text-main);
}

.member-rank {
    display: block;
    font-size: 11px;
    color: var(--accent);
    font-weight: bold;
    margin-top: 2px;
    margin-bottom: 6px;
}

.member-types {
    display: flex;
    justify-content: center;
    gap: 4px;
    margin-top: 6px;
}

.member-types img {
    width: 16px;
    height: 16px;
    border-radius: 50%;
}

/* 자물쇠 토글 아이콘 */
.lock-icon {
    position: absolute;
    top: 6px;
    right: 6px;
    font-size: 14px;
    z-index: 5;
    background: rgba(15, 23, 42, 0.8);
    border-radius: 50%;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--border-light);
}

.party-member.locked {
    border: 2px solid var(--accent) !important;
    background-color: rgba(251, 191, 36, 0.08);
}

.party-member.locked .lock-icon {
    background: var(--accent);
    border-color: var(--accent);
}

/* 버튼 호버 액션 공통 */
button {
    transition: transform 0.1s, filter 0.2s;
}

button:active {
    transform: scale(0.96);
}

button:hover {
    filter: brightness(1.1);
}

/* =========================================
   [S]trategy Tip (스피드표 & 퀴즈)
========================================= */

/* 퀴즈 버튼 스타일 */
.quiz-btn {
    padding: 10px 24px;
    border-radius: 12px;
    font-size: 15px;
    font-weight: 800;
    border: none;
    cursor: pointer;
    color: white;
    transition: transform 0.1s, box-shadow 0.2s;
}

.quiz-btn.btn-o {
    background-color: var(--primary);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}

.quiz-btn.btn-x {
    background-color: var(--danger);
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.3);
}

.quiz-btn:active {
    transform: scale(0.95);
}

/* 스피드 탭 버튼 */
.speed-tab {
    background: var(--card-bg);
    border: 1px solid var(--border-light);
    color: var(--text-muted);
    padding: 10px 16px;
    border-radius: 20px;
    font-size: 13.5px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.2s;
}

.speed-tab.active {
    background: rgba(251, 191, 36, 0.1);
    border-color: var(--accent);
    color: var(--accent);
}

/* 다크모드용 스피드 테이블 */
.speed-table {
    width: 100%;
    border-collapse: collapse;
    background: var(--card-bg);
    border-radius: 12px;
    overflow: hidden;
    border: 1px solid var(--border-light);
    text-align: left;
}

.speed-table th {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-muted);
    padding: 12px 15px;
    font-size: 13px;
    border-bottom: 2px solid var(--border-light);
}

.speed-table td {
    padding: 14px 15px;
    border-bottom: 1px solid var(--border-light);
    color: var(--text-main);
    font-size: 14px;
}

.speed-table tbody tr:last-child td {
    border-bottom: none;
}

.speed-table tbody tr:hover {
    background: rgba(255, 255, 255, 0.02);
}

/* 실능 숫자 및 배지 스타일 */
.stat-num {
    font-weight: 900;
    color: var(--accent);
    font-size: 16px;
    width: 60px;
}

.poke-name {
    font-weight: 700;
    margin-right: 8px;
}

.badge {
    display: inline-block;
    padding: 3px 6px;
    border-radius: 6px;
    font-size: 11px;
    font-weight: bold;
    vertical-align: middle;
    margin-right: 4px;
}

.badge.pos {
    background: rgba(239, 68, 68, 0.15);
    color: #fca5a5;
    border: 1px solid rgba(239, 68, 68, 0.3);
}

/* 빨강 (최속) */
.badge.neu {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-muted);
    border: 1px solid var(--border-light);
}

/* 회색 (준속) */
.badge.neg {
    background: rgba(59, 130, 246, 0.15);
    color: #93c5fd;
    border: 1px solid rgba(59, 130, 246, 0.3);
}

/* 파랑 (최저속) */
.badge.scarf {
    background: var(--accent);
    color: #1e293b;
}

/* 스카프 강조 */
.badge.up {
    background: var(--success);
    color: white;
}

/* 랭크업 강조 */

/* =========================================
   메가진화 / 폼 체인지 토글 버튼 (다크모드 최적화)
========================================= */
.mega-btn-container {
    display: flex;
    gap: 4px;
    margin: 15px auto 20px auto;
    justify-content: center;
    background: rgba(15, 23, 42, 0.6);
    /* 주변보다 더 깊고 어두운 베이스 컨테이너 */
    padding: 6px;
    border-radius: 14px;
    /* 알약 느낌의 둥근 모서리 */
    border: 1px solid var(--border-light);
    max-width: 320px;
}

.mega-toggle-btn {
    flex: 1;
    background: transparent;
    border: 1px solid transparent;
    padding: 10px;
    border-radius: 10px;
    font-size: 13.5px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    color: var(--text-muted);
    /* 비활성 시 은은한 회색 */
}

/* 🔵 추천 3: 이모지 대신 CSS 발광 구슬 (가장 고급스러움) */
.mega-toggle-btn::before {
    content: '';
    /* 이모지 삭제 */
    display: inline-block;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    border: 2px solid #475569;
    /* 꺼져있을 땐 탁한 회색 테두리 */
    background: transparent;
    transition: all 0.3s ease;
    margin-right: 2px;
}

.mega-toggle-btn.active::before {
    /* 켜지면 보라/파랑 그라데이션으로 안이 채워지고 빛이 남 */
    background: linear-gradient(135deg, #c084fc, #3b82f6);
    border-color: transparent;
    box-shadow: 0 0 10px rgba(192, 132, 252, 0.8), inset 0 0 4px rgba(255, 255, 255, 0.6);
    transform: scale(1.1);
}

/* 리자몽 X, Y 전용 구슬 색상 (옵션) */
.mega-toggle-btn.active.mega-x::before {
    background: linear-gradient(135deg, #60a5fa, #1e3a8a);
    box-shadow: 0 0 10px rgba(96, 165, 250, 0.8);
}

.mega-toggle-btn.active.mega-y::before {
    background: linear-gradient(135deg, #fca5a5, #991b1b);
    box-shadow: 0 0 10px rgba(252, 165, 165, 0.8);
}

/* 비활성화 상태에서 마우스 올렸을 때 */
.mega-toggle-btn:hover:not(.active) {
    color: var(--text-main);
    background: rgba(255, 255, 255, 0.05);
}

/* 🌟 활성화 상태 (선택됨) */
.mega-toggle-btn.active {
    background: var(--card-bg);
    /* 패널과 같은 배경색으로 툭 튀어나온 입체감 */
    color: var(--text-main);
    border: 1px solid var(--border-light);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.mega-toggle-btn.active::before {
    opacity: 1;
}

/* 🌟 '메가진화' 버튼이 활성화되었을 때의 특별한 효과 (은은한 보라/파랑 포인트) */
.mega-toggle-btn.active:not(:first-child) {
    background: linear-gradient(135deg, rgba(139, 92, 246, 0.15), rgba(59, 130, 246, 0.15));
    border-color: rgba(139, 92, 246, 0.4);
    color: #c084fc;
    /* 밝은 보라색 텍스트 */
}

/* (옵션) 리자몽 X, Y 전용 특수 컬러 */
.mega-toggle-btn.active.mega-x {
    background: linear-gradient(135deg, rgba(30, 58, 138, 0.3), rgba(59, 130, 246, 0.2));
    border-color: rgba(59, 130, 246, 0.5);
    color: #60a5fa;
}

.mega-toggle-btn.active.mega-y {
    background: linear-gradient(135deg, rgba(153, 27, 27, 0.3), rgba(239, 68, 68, 0.2));
    border-color: rgba(239, 68, 68, 0.5);
    color: #fca5a5;
}

/* =========================================
   상성표 플로팅 버튼 & 사이드 패널
========================================= */

/* 1. 우측 하단 플로팅 버튼 */
.type-chart-toggle {
    position: fixed;
    bottom: 25px;
    right: 25px;
    z-index: 1001;
    /* 화면 가장 위에 뜨도록 */
    background: linear-gradient(135deg, var(--primary), #8b5cf6);
    color: white;
    border: none;
    padding: 14px 22px;
    border-radius: 30px;
    font-weight: 800;
    font-size: 15px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.4);
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
}

.type-chart-toggle:hover {
    transform: scale(1.05) translateY(-3px);
    box-shadow: 0 6px 20px rgba(139, 92, 246, 0.5);
}

.type-chart-toggle:active {
    transform: scale(0.95);
}

/* 2. 사이드 패널 기본 상태 (우측 화면 밖에 숨김) */
.type-chart-panel {
    position: fixed;
    top: 0;
    right: -450px;
    /* 패널 너비만큼 밖으로 빼놓음 */
    width: 400px;
    /* PC에서는 빈 여백에 쏙 들어가는 사이즈 */
    height: 100vh;
    background: rgba(15, 23, 42, 0.95);
    /* 다크모드 반투명 */
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    z-index: 1002;
    transition: right 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    border-left: 1px solid var(--border-light);
    display: flex;
    flex-direction: column;
    box-shadow: -10px 0 30px rgba(0, 0, 0, 0.6);
}

/* 토글 버튼 눌렀을 때 튀어나오는 클래스 */
.type-chart-panel.show {
    right: 0;
}

/* 3. 패널 내부 헤더 & 닫기 버튼 */
.chart-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    background: rgba(255, 255, 255, 0.03);
    border-bottom: 1px solid var(--border-light);
}

.close-chart-btn {
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 22px;
    font-weight: bold;
    cursor: pointer;
    transition: color 0.2s;
}

.close-chart-btn:hover {
    color: var(--danger);
}

/* 4. 이미지 컨텐츠 영역 */
.chart-content {
    flex: 1;
    overflow-y: auto;
    /* 상성표가 길면 스크롤 가능하게 */
    padding: 20px;
    text-align: center;
}

.chart-content::-webkit-scrollbar {
    width: 6px;
}

.chart-content::-webkit-scrollbar-thumb {
    background: var(--border-light);
    border-radius: 10px;
}

/* 📱 5. 모바일 최적화 (화면 전체 덮기) */
@media (max-width: 600px) {
    .type-chart-toggle {
        bottom: 20px;
        right: 20px;
        padding: 12px 18px;
        font-size: 13.5px;
    }

    .type-chart-panel {
        width: 100%;
        /* 모바일에서는 꽉 차게 */
        right: -100%;
    }
}

/* =========================================
   스마트 상성표 UI (버튼 & 결과창)
========================================= */

/* 18개 타입 버튼 그리드 */
.type-buttons-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
    margin-bottom: 20px;
}

@media (max-width: 400px) {
    .type-buttons-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

.type-btn {
    color: white;
    border: none;
    padding: 8px 4px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 800;
    cursor: pointer;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.5);
    /* 글씨가 잘 보이도록 그림자 */
    transition: transform 0.15s, filter 0.2s;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.type-btn:active {
    transform: scale(0.92);
}

.type-btn:hover {
    filter: brightness(1.1);
}

/* 상성 분석 결과창 영역 */
.type-result-area {
    background: rgba(0, 0, 0, 0.2);
    border-radius: 12px;
    padding: 15px;
    border: 1px solid var(--border-light);
    text-align: left;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(5px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.result-title {
    font-size: 18px;
    font-weight: 900;
    margin-bottom: 15px;
    text-align: center;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--border-light);
}

.matchup-row {
    margin-bottom: 12px;
}

.matchup-row:last-child {
    margin-bottom: 0;
}

.matchup-label {
    display: block;
    font-size: 13px;
    color: var(--text-muted);
    font-weight: bold;
    margin-bottom: 6px;
}

/* 결과창 안에 들어가는 작은 타입 배지 */
.type-badge {
    display: inline-block;
    color: white;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: bold;
    margin-right: 6px;
    margin-bottom: 6px;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.5);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}

.type-none {
    font-size: 13px;
    color: #64748b;
    font-style: italic;
}

/* =========================================
   [S]peed Battle ⚡ (미니게임)
========================================= */

.speed-arena {
    display: flex;
    flex-direction: column;
    /* 🌟 핵심: 가로가 아니라 위아래(세로)로 차곡차곡 쌓아라! */
    justify-content: flex-start;
    align-items: stretch;
    background: var(--card-bg);
    border: 1px solid var(--border-light);
    border-radius: 20px;
    padding: 25px 15px;
    margin: 0 auto 20px auto;
    position: relative;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}

.vs-badge {
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    background: linear-gradient(135deg, #ef4444, #f59e0b);
    color: white;
    font-weight: 500;
    font-size: 14px;
    font-style: italic;
    width: 35px;
    height: 35px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    border: 3px solid var(--card-bg);
    z-index: 10;
    box-shadow: 0 4px 10px rgba(239, 68, 68, 0.4);
}

.poke-fighter {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    cursor: pointer;
    padding: 15px 10px;
    border-radius: 16px;
    border: 2px solid transparent;
    transition: all 0.2s;
    text-align: center;
}

.poke-fighter:hover {
    background: rgba(255, 255, 255, 0.03);
    transform: translateY(-3px);
}

.fighter-img {
    width: 80px;
    height: 80px;
    object-fit: contain;
    margin-bottom: 10px;
}

.fighter-name {
    font-weight: 800;
    font-size: 18px;
    color: var(--text-main);
    margin-bottom: 5px;
}

/* 감춰진 조건 텍스트 박스 */
.fighter-cond {
    font-size: 18px;
    /* 기존 12px에서 14px로 크기 키움! (원하면 15px로 더 키워도 돼) */
    line-height: 1.4;
    /* 줄바꿈 시 위아래 간격 넉넉하게 */
    color: #cbd5e1;
    background: #334155;
    padding: 8px 12px;
    /* 상하좌우 여백 조금 늘림 */
    border-radius: 8px;
    margin-bottom: 15px;
    word-break: keep-all;
}

/* 감춰진 스피드 수치 */
.fighter-speed {
    font-size: 24px;
    font-weight: 900;
    color: var(--text-muted);
    letter-spacing: 1px;
}

/* 정답/오답 클릭 후 효과 */
.poke-fighter.winner {
    border-color: var(--success);
    background: rgba(16, 185, 129, 0.1);
}

.poke-fighter.winner .fighter-speed {
    color: var(--success);
}

.poke-fighter.loser {
    border-color: var(--danger);
    background: rgba(239, 68, 68, 0.1);
    opacity: 0.6;
}

.poke-fighter.loser .fighter-speed {
    color: var(--danger);
}

/* 배틀 결과창 */
.battle-result-box {
    background: var(--card-bg);
    border-radius: 12px;
    padding: 20px;
    border: 1px solid var(--border-light);
    text-align: center;
    animation: fadeIn 0.3s ease;
}

/* =========================================
   [D]ojo (블로그형 실전 강의 레이아웃)
========================================= */

/* 전체 화면 제한을 돌파해서 강제로 넓게 쓰는 비법 */
.dojo-layout {
    display: flex;
    gap: 30px;
    /* 사이드바와 본문 사이의 숨통을 좀 더 틔워줌 */
    align-items: flex-start;
    margin-bottom: 40px;

    /* 여기서부터가 핵심! (부모 컨테이너 너비를 무시하고 넓어짐) */
    width: 100vw;
    max-width: 1100px;
    /* 원하는 만큼 늘리세요! (1000px~1200px 추천) */
    position: relative;
    left: 50%;
    transform: translateX(-50%);
}

/* 왼쪽 사이드바 (목차) - 너비를 200px로 더 슬림하게 다이어트 */
.dojo-sidebar {
    width: 200px;
    flex-shrink: 0;
    background: var(--card-bg);
    border: 1px solid var(--border-light);
    border-radius: 16px;
    padding: 20px;
    position: sticky;
    top: 90px;
    text-align: left;
}

.sidebar-title {
    font-size: 16px;
    color: var(--text-main);
    margin-top: 0;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--border-light);
}

.lesson-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.lesson-item {
    font-size: 13.5px;
    color: var(--text-muted);
    padding: 10px 12px;
    border-radius: 8px;
    margin-bottom: 5px;
    cursor: pointer;
    transition: background 0.2s, color 0.2s;
}

.lesson-item:hover {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-main);
}

.lesson-item.active {
    background: rgba(16, 185, 129, 0.15);
    color: #10b981;
    font-weight: 800;
    border-left: 4px solid #10b981;
}

/* 오른쪽 메인 콘텐츠 (글 본문) - 남은 공간을 모두 차지함 */
.dojo-content {
    flex: 1;
    min-width: 0;
    background: var(--card-bg);
    border: 1px solid var(--border-light);
    border-radius: 16px;
    padding: 40px 50px;
    /* 글을 넓게 쓸 수 있도록 안쪽 여백도 시원하게 조절 */
    text-align: left;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
}

.article-title {
    font-size: 24px;
    font-weight: 900;
    color: var(--text-main);
    margin-top: 0;
    margin-bottom: 15px;
    line-height: 1.4;
}

.article-meta {
    font-size: 13px;
    color: var(--text-muted);
    margin-bottom: 30px;
    padding-bottom: 15px;
    border-bottom: 1px solid var(--border-light);
}

/* 본문 글 속성 유지 */
.article-body {
    font-size: 15.5px;
    line-height: 1.8;
    color: #cbd5e1;
    max-width: 100%;
}

.article-body p {
    margin-bottom: 20px;
}

.article-body h3 {
    font-size: 19px;
    color: #fbbf24;
    margin-top: 35px;
    margin-bottom: 15px;
}

.article-body strong {
    color: #f8fafc;
    font-weight: 800;
}

.article-list {
    margin-bottom: 20px;
    padding-left: 20px;
}

.article-list li {
    margin-bottom: 8px;
}

/* 하이라이트 박스 (핵심 요약) */
.highlight-box {
    background: rgba(59, 130, 246, 0.1);
    border-left: 4px solid var(--primary);
    padding: 15px 20px;
    border-radius: 0 8px 8px 0;
    margin: 25px 0;
    font-size: 14.5px;
    color: #e2e8f0;
}

/* 📱 모바일 반응형 (화면이 작아지면 위아래로 배치) */
@media (max-width: 768px) {
    .dojo-layout {
        flex-direction: column;
    }

    .dojo-sidebar {
        width: 100%;
        position: relative;
        top: 0;
    }

    .dojo-content {
        width: 100%;
        padding: 25px 20px;
    }

    .article-title {
        font-size: 20px;
    }
}

/* 📱 화면 가로폭이 380px 이하일 때만 발동 (폴드 커버 화면 등) */
@media (max-width: 380px) {

    /* 카드 자체의 뚱뚱한 양옆 여백을 줄여서 실제 내용이 들어갈 공간 확보 */
    .pokemon-card,
    .panel {
        padding: 12px 10px;
    }

    /* 타입 버튼/뱃지의 글자 크기와 안쪽 여백 다이어트 */
    .type-select-btn,
    .type-badge {
        font-size: 12px;
        /* 글자를 아주 살짝만 줄임 */
        padding: 4px 8px;
        /* 뱃지의 뚱뚱한 여백을 슬림하게 */
    }

    /* 퍼센트 뱃지 크기 최적화 */
    .percent-badge {
        font-size: 11.5px;
        padding: 2px 4px;
    }

    /* 리스트 기본 글자 크기 살짝 축소 */
    .list-item {
        font-size: 13.5px;
    }
}

/* 2. 통계/리스트 한 줄 정렬 및 줄바꿈 (추가) */
.list-item {
    display: flex;
    flex-wrap: wrap;
    /* 가로 공간 부족하면 아랫줄로 넘김 */
    align-items: center;
    gap: 6px;
}

/* 3. 뱃지 안에서 아이콘과 글자가 찢어지지 않게 보호 (추가) */
.type-select-btn,
.type-badge,
.percent-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    white-space: nowrap;
    /* 글자가 두 줄로 나뉘는 것 방지 */
}

/* 1. 메인 타이틀 여백 조정 */
.main-title {
    margin-top: 5px;
    /* 화면 맨 위에서 제목까지의 거리 */
    margin-bottom: 5px;
    /* 제목과 부제목 사이를 더 가깝게 */
    line-height: 1.1;
}

/* 2. 부제목 여백 조정 */
.main-subtitle {
    color: var(--text-muted);
    font-size: 14.5px;
    font-weight: 600;
    margin-top: 0;
    /* 위쪽 여백 제거 */
    margin-bottom: 0px;
    /* 부제목과 메뉴바 사이의 간격을 25px -> 15px로 단축 */
    letter-spacing: -0.5px;
}

.site-footer {
    margin-top: 60px;
    padding: 40px 20px;
    background: var(--card-bg);
    border-top: 1px solid var(--border-light);
    text-align: center;
    color: var(--text-muted);
    font-size: 12px;
    line-height: 1.8;
}

.footer-content {
    max-width: 800px;
    margin: 0 auto;
}

.copyright-notice {
    margin: 15px 0;
    font-size: 11px;
    opacity: 0.8;
}

.footer-links {
    margin: 20px 0;
}

.footer-links a {
    color: var(--text-main);
    text-decoration: none;
    margin: 0 10px;
    font-weight: 600;
}

.footer-links a:hover {
    color: var(--primary-color);
}

/* =========================================
   [S]peed Battle 추가 UI 개선 (수정됨)
========================================= */
/* 조작 버튼 영역 강조 */
.speed-battle-controls {
    background: rgba(255, 255, 255, 0.03);
    padding: 15px;
    border-radius: 15px;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

/* 🌟 숙련자용(기존) 버튼 디자인 */
.speed-battle-start-btn {
    background: transparent;
    border: 2px solid var(--accent);
    /* 포인트 컬러 (노란색/골드) */
    color: var(--accent);
    padding: 12px 24px;
    border-radius: 50px;
    font-size: 15px;
    font-weight: 800;
    cursor: pointer;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.speed-battle-start-btn:hover {
    background: var(--accent);
    color: #1e293b;
    box-shadow: 0 0 15px rgba(251, 191, 36, 0.4);
}

/* 🌟 입문자용 버튼 디자인 (초록/파랑 계열로 구분감 부여) */
.speed-battle-easy-btn {
    background: transparent;
    border: 2px solid var(--primary);
    /* 메인 컬러 (파란색) */
    color: var(--primary);
    padding: 12px 24px;
    border-radius: 50px;
    font-size: 15px;
    font-weight: 800;
    cursor: pointer;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.speed-battle-easy-btn:hover {
    background: var(--primary);
    color: #fff;
    box-shadow: 0 0 15px rgba(59, 130, 246, 0.4);
}

/* 플레이스홀더 애니메이션 효과 */
.speed-placeholder {
    padding: 40px 0;
    border: 2px dashed var(--border-light);
    border-radius: 20px;
    margin: 10px 0;
    background: rgba(255, 255, 255, 0.02);
}

/* 포켓몬 이미지 로딩 전 기본 배경 */
.fighter-img {
    width: 80px;
    height: 80px;
    object-fit: contain;
    margin-bottom: 10px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 50%;
    padding: 5px;
}

/* 포켓몬 박스 호버 효과 강화 및 내부 세로 정렬 🌟 */
.speed-pkmn-box {
    display: flex;
    flex-direction: column;
    /* 🌟 내용물을 위에서 아래로 세로로 쌓아라! */
    align-items: center;
    /* 🌟 가운데 정렬해라! */
    justify-content: center;
    transition: transform 0.2s ease, filter 0.2s ease;
    padding: 15px;
    border-radius: 15px;
}

.speed-pkmn-box:hover {
    transform: translateY(-5px);
    background: rgba(255, 255, 255, 0.05);
}

/* 기술 카테고리 (물리/특수/변화) 뱃지 디자인 */
.cat-badge {
    display: inline-block;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: bold;
    margin-left: 6px;
    vertical-align: middle;
}

.cat-물리 {
    background-color: #fca5a5;
    color: #7f1d1d;
}

/* 물리: 빨간색 계열 */
.cat-특수 {
    background-color: #93c5fd;
    color: #1e3a8a;
}

/* 특수: 파란색 계열 */
.cat-변화 {
    background-color: #cbd5e1;
    color: #1e293b;
}

/* 변화: 회색 계열 */