/* ============================================================
   game_iwm 사용자 페이지 - Type B 테마 (크림/오렌지 라이트)
   ============================================================ */

/* ===== Reset & Base ===== */
* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
    /* Type B 시안(hub-type-b.tsx)과 동일한 폰트 스택 */
    font-family: -apple-system, 'Apple SD Gothic Neo', 'Malgun Gothic', sans-serif;
    background: #fdf6ef;
    color: #1a1208;
    line-height: 1.5;
}
a { color: inherit; text-decoration: none; }
img { display: block; max-width: 100%; }
button { font: inherit; cursor: pointer; border: none; background: none; }

/* ===== 카테고리 팔레트 (id % 5 로 순환 배정) ===== */
.cat-c0 { --cat: #ff6b2b; --cat-light: #fff3ed; }
.cat-c1 { --cat: #0ea5e9; --cat-light: #e8f6fd; }
.cat-c2 { --cat: #f43f5e; --cat-light: #fef1f4; }
.cat-c3 { --cat: #16a34a; --cat-light: #edfaf3; }
.cat-c4 { --cat: #8b5cf6; --cat-light: #f3eefe; }

/* ===== 헤더 ===== */
.hub-header {
    position: fixed; top: 0; left: 0; right: 0; height: 66px; z-index: 40;
    background: #fff;
    border-bottom: 2px solid #ffe4cc;
    display: flex; align-items: center; padding: 0 28px; gap: 12px;
}
.logo-badge {
    width: 40px; height: 40px; border-radius: 50%;
    background: #ff6b2b;
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0;
    box-shadow: 0 4px 12px rgba(255, 107, 43, 0.35);
}
.logo-text {
    font-size: 24px; font-weight: 900; letter-spacing: -0.03em;
    color: #ff6b2b; white-space: nowrap;
}
.search-form {
    display: flex; align-items: center; flex: 1; max-width: 420px; margin-left: 16px;
    background: #fff;
    border: 1.5px solid #ffc4a8; border-radius: 20px; overflow: hidden;
    transition: border-color 0.15s, box-shadow 0.15s;
}
.search-form:focus-within {
    border-color: #ff6b2b;
    box-shadow: 0 0 0 3px rgba(255, 107, 43, 0.12);
}
.search-input {
    flex: 1; padding: 8px 16px; border: none; outline: none;
    font-size: 16px; background: transparent; color: #1a1208;
}
.search-input::placeholder { color: #c8b0a0; }
.search-btn { padding: 0 14px; color: #ff6b2b; font-size: 17px; }
.header-right { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.total-badge {
    background: #fff3ed; color: #ff6b2b;
    border: 1.5px solid #ffc4a8; border-radius: 20px;
    padding: 5px 16px; font-size: 14px; font-weight: 700; white-space: nowrap;
}

/* ===== 사이드바 ===== */
.hub-sidebar {
    position: fixed; top: 66px; left: 0; width: 232px; bottom: 0; z-index: 30;
    background: #fff;
    border-right: 2px solid #ffe4cc;
    overflow-y: auto; padding: 20px 12px;
}
.sidebar-head {
    font-size: 13px; color: #c8b0a0; font-weight: 700;
    letter-spacing: 0.1em; text-transform: uppercase;
    padding: 0 6px 10px; margin-bottom: 10px;
    border-bottom: 1.5px solid #ffe4cc;
}
.cat-btn {
    width: 100%; display: flex; align-items: center; gap: 10px;
    padding: 10px 12px; border-radius: 14px;
    color: #a08070; font-size: 16px; font-weight: 500;
    transition: all 0.18s ease; text-align: left; margin-bottom: 4px;
}
.cat-btn:hover { background: #fff5ef; color: #ff6b2b; }
.cat-icon {
    width: 32px; height: 32px; border-radius: 50%; flex-shrink: 0;
    display: flex; align-items: center; justify-content: center;
    background: var(--cat-light, #fff3ed);
    font-size: 16px; line-height: 1;
    transition: all 0.18s ease;
}
.cat-name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cat-count {
    font-size: 13px; padding: 2px 8px; border-radius: 10px;
    background: #fff0e8; color: #ff6b2b;
    font-weight: 700; font-variant-numeric: tabular-nums;
}
.cat-btn.is-active {
    background: var(--cat, #ff6b2b);
    color: #fff; font-weight: 700;
}
.cat-btn.is-active .cat-icon,
.cat-btn.is-active .cat-count {
    background: rgba(255, 255, 255, 0.22);
    color: #fff;
}

/* ===== 메인 ===== */
.hub-main {
    margin-left: 232px; margin-top: 66px;
    padding: 36px 32px 40px;
    min-height: calc(100vh - 66px);
    display: flex; flex-direction: column;
}
.page-head { margin-bottom: 28px; }
.page-title {
    font-size: 28px; font-weight: 900;
    color: #1a1208; letter-spacing: -0.02em;
}
.page-sub { color: #a08070; font-size: 15px; margin-top: 4px; }

/* ===== 게임 그리드 & 카드 ===== */
.game-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(188px, 1fr));
    gap: 22px;
}
.game-card {
    display: block; background: #fff; border-radius: 22px;
    border: 2px solid #f5e4d4; overflow: hidden;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.06);
    transition: all 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.game-card:hover {
    box-shadow: 0 12px 36px rgba(255, 107, 43, 0.18), 0 2px 8px rgba(0, 0, 0, 0.06);
    transform: translateY(-6px) scale(1.015);
    border-color: #ffb088;
}
.thumb-wrap { position: relative; aspect-ratio: 1 / 1; overflow: hidden; }
.game-thumb { width: 100%; height: 100%; object-fit: cover; }
.game-thumb--placeholder {
    display: flex; align-items: center; justify-content: center;
    font-size: 50px; background: #fff3ed;
}
.card-cat-badge {
    position: absolute; top: 8px; left: 8px;
    background: var(--cat, #ff6b2b); color: #fff;
    font-size: 12px; font-weight: 800; padding: 3px 9px; border-radius: 10px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}
.play-badge {
    position: absolute; bottom: 10px; left: 50%; transform: translateX(-50%);
    background: #ff6b2b; color: #fff;
    font-size: 13px; font-weight: 800; padding: 5px 16px; border-radius: 20px;
    white-space: nowrap; opacity: 0; transition: opacity 0.2s;
    box-shadow: 0 3px 10px rgba(255, 107, 43, 0.55);
}
.game-card:hover .play-badge { opacity: 1; }
.game-info { padding: 12px 15px; }
.game-title {
    font-size: 16px; font-weight: 800; color: #1a1208;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

/* ===== 섹션 (추천/신작/인기/전체, 같은 장르 게임 등) ===== */
.game-section { margin-bottom: 40px; }
.section-title {
    font-size: 22px; font-weight: 900; margin-bottom: 14px;
    color: #1a1208; letter-spacing: -0.01em;
}
.section-head { margin-bottom: 14px; }
.section-head .section-title { margin-bottom: 0; }

/* ===== 빈 상태 ===== */
.empty-state {
    text-align: center; padding: 70px 20px;
    background: #fff; border: 2px solid #f5e4d4; border-radius: 22px;
    color: #a08070;
}
.empty-state h2 { color: #1a1208; font-size: 22px; font-weight: 800; margin-bottom: 8px; }
.cta-btn {
    display: inline-block; margin-top: 20px; padding: 12px 28px;
    background: #ff6b2b; color: #fff; border-radius: 24px; font-weight: 800;
    box-shadow: 0 4px 14px rgba(255, 107, 43, 0.35);
    transition: transform 0.15s, box-shadow 0.15s;
}
.cta-btn:hover { transform: translateY(-2px); box-shadow: 0 8px 20px rgba(255, 107, 43, 0.4); }

/* ===== 페이지네이션 ===== */
.pagination {
    display: flex; justify-content: center; align-items: center;
    gap: 14px; margin-top: 32px;
}
.page-btn {
    padding: 8px 20px; background: #fff;
    border: 1.5px solid #ffc4a8; border-radius: 20px;
    color: #ff6b2b; font-size: 15px; font-weight: 700;
    transition: all 0.15s;
}
.page-btn:hover { background: #ff6b2b; border-color: #ff6b2b; color: #fff; }
.page-current { color: #a08070; font-size: 15px; font-weight: 700; }

/* ===== 게임 플레이어 ===== */
.game-frame-container {
    position: relative; width: 100%; aspect-ratio: 16 / 9;
    background: #1a1208; border-radius: 22px; overflow: hidden;
    border: 2px solid #f5e4d4;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.06);
    margin-bottom: 24px;
}
.game-iframe { width: 100%; height: 100%; border: 0; display: block; }
.game-pre-play {
    position: absolute; inset: 0;
    display: flex; flex-direction: column;
    align-items: center; justify-content: center; gap: 16px;
    background: linear-gradient(180deg, #fff7ef, #ffe9d6);
    overflow-y: auto; /* 프레임보다 내용이 커져도 플레이 버튼 접근 보장 */
}
.pre-play-thumb {
    width: 180px; aspect-ratio: 1 / 1; border-radius: 22px; object-fit: cover;
    border: 2px solid #fff;
    box-shadow: 0 12px 32px rgba(255, 107, 43, 0.25);
}
.pre-play-title {
    font-size: 28px; font-weight: 900; color: #1a1208;
    letter-spacing: -0.02em; text-align: center; padding: 0 16px;
}
.play-btn {
    padding: 13px 40px; background: #ff6b2b; color: #fff;
    border-radius: 30px; font-size: 19px; font-weight: 800;
    box-shadow: 0 6px 18px rgba(255, 107, 43, 0.45);
    transition: transform 0.15s, box-shadow 0.15s;
}
.play-btn:hover { transform: translateY(-2px); box-shadow: 0 10px 24px rgba(255, 107, 43, 0.5); }

/* ===== 게임 상세 ===== */
.game-detail {
    background: #fff; padding: 20px 24px; border-radius: 22px;
    border: 2px solid #f5e4d4; margin-bottom: 32px;
}
.game-detail h1 {
    font-size: 24px; font-weight: 900; letter-spacing: -0.02em;
    margin-bottom: 10px;
}
.game-meta-row {
    display: flex; gap: 10px; flex-wrap: wrap; align-items: center;
    color: #a08070; font-size: 15px;
}
.game-stat {
    background: #fff3ed; color: #ff6b2b; font-weight: 700;
    padding: 4px 12px; border-radius: 14px;
}
.game-category-link {
    background: #fff3ed; border: 1.5px solid #ffc4a8; color: #ff6b2b;
    padding: 3px 12px; border-radius: 14px; font-weight: 700;
    transition: all 0.15s;
}
.game-category-link:hover { background: #ff6b2b; color: #fff; border-color: #ff6b2b; }

/* ===== 푸터 ===== */
.footer {
    margin-top: auto; padding: 32px 0 8px;
    text-align: center; color: #c8b0a0; font-size: 15px;
}

/* ===== 모바일 ===== */
@media (max-width: 860px) {
    .hub-header { padding: 0 14px; gap: 8px; }
    .logo-text { font-size: 20px; }
    .total-badge { display: none; }
    .search-form { margin-left: 4px; }

    /* 사이드바 → 가로 스크롤 카테고리 바 */
    .hub-sidebar {
        top: 66px; left: 0; right: 0; bottom: auto; width: auto;
        display: flex; align-items: center; gap: 4px;
        padding: 8px 10px;
        overflow-x: auto; overflow-y: hidden;
        border-right: none; border-bottom: 2px solid #ffe4cc;
        white-space: nowrap;
        scrollbar-width: none;
    }
    .hub-sidebar::-webkit-scrollbar { display: none; }
    .sidebar-head { display: none; }
    .cat-btn { width: auto; flex-shrink: 0; margin-bottom: 0; padding: 6px 10px; gap: 6px; }
    .cat-icon { width: 26px; height: 26px; font-size: 14px; }

    .hub-main { margin-left: 0; margin-top: 126px; padding: 20px 14px 32px; }
    .game-grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 14px; }
    .page-title { font-size: 24px; }
    .game-pre-play { gap: 10px; }
    .pre-play-thumb { width: 90px; }
    .pre-play-title { font-size: 22px; }
    .play-btn { padding: 11px 32px; font-size: 17px; }
}
