:root {
    /* PC 가로형 기본 배경 이미지 */
    --bg-image: url('/images/bg_desktop_dark.webp');
}

/* 다크 모드 배경 */
body[data-theme="dark"] {
    --bg-image: url('/images/bg_desktop_dark.webp');
}

/* 라이트 모드 배경 */
body[data-theme="light"] {
    --bg-image: url('/images/bg_desktop_light.webp');
}

/* 모바일 세로형 미디어 쿼리 */
@media (max-width: 768px) {
    :root, body[data-theme="dark"] {
        --bg-image: url('/images/bg_mobile_dark.webp');
    }
    body[data-theme="light"] {
        --bg-image: url('/images/bg_mobile_light.webp');
    }
}

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

body {
    width: 100%;
    min-height: 100vh;
    min-height: 100dvh;
    overflow-x: hidden;
    overflow-y: auto;
    position: relative;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Pretendard", sans-serif;
    color: var(--text-primary);
    background-color: var(--bg-main, #0b0f19);
}

/* 고정 배경 레이어 */
.bg-layer {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-repeat: no-repeat;
    background-position: center center;
    background-size: cover;
    background-image: var(--bg-image);
    z-index: 1;
    transition: background-image 0.3s ease;
}

/* 마우스 플래시라이트 블러 효과 레이어 */
.bg-blurred {
    filter: blur(1.5px) brightness(0.95);
    z-index: 2;
    -webkit-mask-image: radial-gradient(circle 400px at var(--x, -600px) var(--y, -600px), transparent 0%, transparent 45%, rgba(0, 0, 0, 0.6) 75%, black 100%);
    mask-image: radial-gradient(circle 400px at var(--x, -600px) var(--y, -600px), transparent 0%, transparent 45%, rgba(0, 0, 0, 0.6) 75%, black 100%);
}

/* 메인 컨테이너 (화면 좌우 양 끝단에 배치하여 중앙 배경 인물 시야 완전 확보) */
.intro-container {
    position: relative;
    z-index: 10;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    min-height: calc(100dvh - 60px);
    padding: 24px 36px;
    max-width: 100%;
    box-sizing: border-box;
}

.intro-content-wrapper {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    width: 100%;
    gap: 20px;
}

/* =========================================
   좌측 메뉴 카드 (최소 크기화 및 슬림화)
========================================= */
.menu-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
    width: 190px; /* 기존 220px -> 190px로 슬림화 */
    flex-shrink: 0;
}

.menu-card {
    position: relative;
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    padding: 9px 14px; /* 높이 슬림화 */
    border-radius: 10px;
    box-shadow: var(--shadow);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    cursor: pointer;
    transition: transform 0.2s cubic-bezier(0.16, 1, 0.3, 1), border-color 0.2s ease, background 0.2s ease, box-shadow 0.2s ease;
}

.menu-card:hover {
    background: var(--bg-card-hover);
    border-color: var(--accent-color);
    transform: translateX(4px);
    box-shadow: 0 4px 16px rgba(0, 230, 161, 0.2);
}

.menu-card.menu-card-infinity:hover {
    border-color: #3b82f6;
    box-shadow: 0 4px 16px rgba(59, 130, 246, 0.25);
}

.menu-card.menu-card-mock:hover {
    border-color: #a855f7;
    box-shadow: 0 4px 16px rgba(168, 85, 247, 0.25);
}

.menu-card.menu-card-timeattack:hover {
    border-color: #eab308;
    box-shadow: 0 4px 16px rgba(234, 179, 8, 0.25);
}

.card-icon {
    font-size: 16px;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    flex-shrink: 0;
}

.card-title {
    font-size: 13px;
    font-weight: 800;
    color: var(--text-primary);
    white-space: nowrap;
    letter-spacing: -0.3px;
}

/* 마우스 호버 툴팁 */
.menu-card .tooltip-desc {
    position: absolute;
    left: 105%;
    top: 50%;
    transform: translateY(-50%) translateX(10px);
    background: rgba(10, 22, 18, 0.95);
    color: #00E6A1;
    border: 1px solid var(--border-color);
    padding: 6px 12px;
    border-radius: 8px;
    font-size: 11px;
    font-weight: 600;
    white-space: nowrap;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.5);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease, transform 0.2s ease;
    z-index: 100;
}

body[data-theme="light"] .menu-card .tooltip-desc {
    background: rgba(255, 255, 255, 0.98);
    color: #059669;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
}

.menu-card .tooltip-desc::after {
    content: '';
    position: absolute;
    top: 50%;
    right: 100%;
    margin-top: -5px;
    border-width: 5px;
    border-style: solid;
    border-color: transparent rgba(10, 22, 18, 0.95) transparent transparent;
}

body[data-theme="light"] .menu-card .tooltip-desc::after {
    border-color: transparent rgba(255, 255, 255, 0.98) transparent transparent;
}

.menu-card:hover .tooltip-desc {
    opacity: 1;
    transform: translateY(-50%) translateX(0);
}

/* =========================================
   우측 위젯 컬럼 (합격자 발표 요약 + 공지사항)
========================================= */
.home-widgets-column {
    display: flex;
    flex-direction: column;
    gap: 10px;
    width: 220px; /* 기존 250px -> 220px로 슬림화 */
    flex-shrink: 0;
}

/* 위젯 박스 공통 */
.leaderboard-box-container, .notice-box-container {
    width: 100%;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 9px 12px;
    box-shadow: var(--shadow);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    display: flex;
    flex-direction: column;
    transition: padding 0.25s ease, border-color 0.25s ease;
}

.leaderboard-box-header, .notice-box-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 6px;
    padding-bottom: 4px;
    border-bottom: 1px solid var(--border-color);
    transition: margin 0.25s ease, padding 0.25s ease;
    cursor: pointer;
    user-select: none;
}

.leaderboard-box-title, .notice-box-title {
    font-size: 12px;
    font-weight: 800;
    color: var(--text-primary);
}

.header-action-group {
    display: flex;
    align-items: center;
    gap: 4px;
}

.btn-toggle-box {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    font-size: 9px;
    cursor: pointer;
    padding: 2px 3px;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.2s;
}

.btn-toggle-box:hover {
    color: var(--accent-color);
}

.toggle-icon {
    display: inline-block;
    transition: transform 0.25s ease;
}

/* 박스 접힘(collapsed) 처리 */
.collapsed {
    padding-bottom: 8px !important;
}

.collapsed .leaderboard-box-header,
.collapsed .notice-box-header {
    margin-bottom: 0 !important;
    padding-bottom: 0 !important;
    border-bottom: none !important;
}

.collapsed .leaderboard-box-list,
.collapsed .notice-box-list {
    display: none !important;
}

.collapsed .toggle-icon {
    transform: rotate(180deg);
}

.btn-more-leaderboard {
    font-size: 10px;
    font-weight: 700;
    color: var(--accent-color);
    text-decoration: none;
    transition: opacity 0.2s;
}

.btn-more-leaderboard:hover {
    opacity: 0.8;
    text-decoration: underline;
}

.btn-write-notice-home {
    background-color: #00E6A1;
    color: #000000;
    border: none;
    padding: 2px 5px;
    border-radius: 4px;
    font-size: 9px;
    font-weight: 800;
    cursor: pointer;
    transition: transform 0.2s ease;
}

.btn-write-notice-home:hover {
    transform: scale(1.05);
}

/* 리스트 항목 컴팩트 스타일 */
.leaderboard-box-list, .notice-box-list {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.leaderboard-summary-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 4px 6px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 6px;
    font-size: 11px;
}

.leaderboard-item-left {
    display: flex;
    align-items: center;
    gap: 5px;
}

.rank-badge-sm {
    font-size: 11px;
    width: 14px;
    text-align: center;
}

.leaderboard-nickname {
    font-weight: 700;
    color: var(--text-primary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 85px;
}

.leaderboard-score {
    font-weight: 800;
    color: var(--accent-color);
    font-size: 11px;
}

.notice-box-list {
    overflow-y: auto;
    max-height: 100px;
}

.notice-box-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 4px 6px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.2s, border-color 0.2s;
}

.notice-box-item:hover {
    background: rgba(0, 230, 161, 0.1);
    border-color: #00E6A1;
}

.notice-item-title {
    font-size: 10.5px;
    font-weight: 600;
    color: var(--text-primary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 125px;
}

.notice-item-date {
    font-size: 9px;
    color: var(--text-secondary);
    white-space: nowrap;
}

.notice-empty {
    text-align: center;
    padding: 8px 0;
    font-size: 10.5px;
    color: var(--text-secondary);
}

/* =========================================
   반응형 최적화 (768px 이하에서도 좌/우 양 끝 정렬 유지)
========================================= */
@media (max-width: 768px) {
    .intro-container {
        padding: 14px 12px;
        min-height: calc(100dvh - 52px);
    }

    /* 1열로 겹치지 않고 좌/우 양쪽으로 계속 배치 유지 */
    .intro-content-wrapper {
        flex-direction: row;
        justify-content: space-between;
        align-items: flex-start;
        gap: 10px;
        width: 100%;
    }

    /* 좌측 메뉴 모바일 폭 */
    .menu-list {
        width: 46%;
        max-width: 170px;
        gap: 8px;
    }

    /* 우측 위젯 모바일 폭 */
    .home-widgets-column {
        width: 48%;
        max-width: 180px;
        gap: 8px;
    }

    .menu-card {
        padding: 8px 10px;
        gap: 6px;
        border-radius: 8px;
    }

    .card-icon {
        font-size: 14px;
        width: 20px;
        height: 20px;
    }

    .card-title {
        font-size: 11px;
    }

    .menu-card .tooltip-desc {
        display: none !important;
    }

    .leaderboard-box-container, .notice-box-container {
        padding: 8px 10px;
        border-radius: 10px;
    }

    .leaderboard-box-title, .notice-box-title {
        font-size: 11px;
    }

    .leaderboard-nickname {
        max-width: 60px;
        font-size: 10px;
    }

    .notice-item-title {
        max-width: 90px;
        font-size: 10px;
    }

    .bg-blurred {
        filter: blur(1.5px) brightness(0.95);
        -webkit-mask-image: radial-gradient(circle 180px at var(--x, -600px) var(--y, -600px), transparent 0%, transparent 45%, rgba(0, 0, 0, 0.6) 75%, black 100%);
        mask-image: radial-gradient(circle 180px at var(--x, -600px) var(--y, -600px), transparent 0%, transparent 45%, rgba(0, 0, 0, 0.6) 75%, black 100%);
    }
}