/* ==========================================================================
   1. 기본 설정 (Variables & Reset)
   ========================================================================== */
:root {
    --ba-blue: #128CFF;
    --ba-cyan: #00D1FF;
    --ba-dark: #2B3A42;
    --ba-bg: #F3F7F8;
    --ba-gray: #D0D7DB;
    --tab-active: #FFE500;
    --bonus-pink: #ff4f94; 
}

* { box-sizing: border-box; }

body {
    font-family: 'Noto Sans KR', sans-serif;
    background-color: var(--ba-bg);
    color: var(--ba-dark);
    margin: 0;
    padding: 20px;
    display: flex;
    justify-content: center;
    min-height: 100vh;
}

/* ==========================================================================
   [수정됨] 반응형 레이아웃 (PC/Mobile 공용)
   : 화면 너비에 따라 '왼쪽 고정' vs '나란히 배치' 자동 전환
   ========================================================================== */

/* 1. 전체 틀 (Wrapper) - 기본: 아주 넓은 화면용 */
.app-wrapper {
    position: relative; /* 사이드바 절대 위치 기준 */
    width: 100%;
    max-width: 100%;    /* 전체 너비 사용 */
    margin: 0 auto;
    padding: 20px;
    
    /* 기본적으로 Flex를 쓰지만, 넓은 화면에선 absolute 사이드바가 뜸 */
    display: flex;
    justify-content: center; 
    align-items: flex-start;
    min-height: 100vh;
}

/* 2. 사이드바 (이벤트 리스트) - 기본: 왼쪽 구석 고정 */
.sidebar {
    position: absolute;  /* 공중에 띄움 */
    left: 20px;          /* 왼쪽 벽 고정 */
    top: 20px;
    width: 260px;
    z-index: 10;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

/* 3. 계산기 메인 (Container) - 기본: 정중앙 */
.container {
    width: 100%;
    max-width: 1100px;   /* 1100px 크기 유지 */
    margin: 0 auto;      /* 정중앙 정렬 */
    position: relative;
    z-index: 1;
    background: white;
    border-radius: 15px;
    box-shadow: 0 10px 25px rgba(0,0,0,0.05);
    padding: 25px;
}

h1 {
    text-align: center;
    color: #29415A;
    margin-bottom: 20px;
    font-weight: 800;
    text-shadow: 
        2px 0 0 #fff, -2px 0 0 #fff, 0 2px 0 #fff, 0 -2px 0 #fff,
        1.5px 1.5px 0 #fff, -1.5px -1.5px 0 #fff, 1.5px -1.5px 0 #fff, -1.5px 1.5px 0 #fff,
        0 3px 5px rgba(0,0,0,0.15);
}

/* ==========================================================================
   2. 상단 탭 (Tabs)
   ========================================================================== */
.shop-tabs { 
    display: flex;
    gap: 8px;
    margin-bottom: 25px;
    justify-content: center;
    flex-wrap: wrap;
}

.tab-btn {
    padding: 10px 15px;
    border: 2px solid var(--ba-gray);
    background: white;
    border-radius: 30px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.2s;
    flex: 1;
    text-align: center;
    color: #777;
    min-width: 100px;
    white-space: nowrap;
    display: flex;
    align-items: center;
    justify-content: center;
}

.tab-btn.active {
    background-color: #2E4764;
    border-color: #2E4764;
    color: #FAD50A;
    transform: translateY(-2px);
    box-shadow: 0 4px 10px rgba(46, 71, 100, 0.4);
}

.tab-icon {
    width: 30px;
    height: 30px;
    object-fit: contain;
    margin-right: 6px;
}

/* ==========================================================================
   3. 아이템 카드 (Item Card)
   ========================================================================== */
.shop-section { display: none; }

.shop-section.active {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px; 
    margin-bottom: 30px;
    width: 100%;
}

.item-card {
    border: 2px solid #eee;
    border-radius: 12px;
    padding: 10px;
    text-align: center;
    background: #fff;
    position: relative;
    transition: all 0.15s cubic-bezier(0.25, 0.8, 0.25, 1);
    box-shadow: 0 4px 6px rgba(0,0,0,0.04); 
    cursor: pointer;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    min-width: 0;
}

.item-card:not(.disabled):hover {
    transform: translateY(3px);
    box-shadow: 0 1px 2px rgba(0,0,0,0.1);
    border-color: #ddd;
}

.item-card.selected {
    border-color: var(--ba-blue);
    background-color: #F0F9FF;
    box-shadow: 0 1px 2px rgba(18, 140, 255, 0.2);
    transform: translateY(3px);
}

.item-card.disabled {
    opacity: 0.6;
    background-color: #f9f9f9;
    pointer-events: none;
    box-shadow: none;
}

/* 체크박스 숨김 */
.item-checkbox {
    position: absolute;
    opacity: 0;
    width: 0; height: 0;
    pointer-events: none;
    z-index: -1;
}

/* 카드 내부 요소 */
.card-top {
    margin-bottom: 8px;
    border-bottom: 1px dashed #eee;
    padding-bottom: 8px;
}

.item-name {
    font-size: 0.85rem;
    font-weight: bold;
    color: #333;
    margin-bottom: 5px;
    white-space: pre-line;
    display: -webkit-box;
    -webkit-line-clamp: 2; 
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
    height: 2.6em; 
    line-height: 1.3;
    padding: 0 2px;
}

.img-box {
    width: 75px;
    height: 75px;
    margin: 0 auto 8px;
    background: #fafafa;
    border-radius: 10px;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid #e0e0e0;
}

.img-box img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.limit-badge {
    font-size: 0.7rem;
    background: #f0f0f0;
    color: #666;
    padding: 2px 6px;
    border-radius: 10px;
    display: inline-block;
    border: 1px solid #ddd;
    margin-bottom: 5px;
}

.limit-badge.unlimited {
    background-color: #E8F5E9;
    color: #2E7D32;
    border-color: #C8E6C9;
    font-weight: bold;
}

.price-tag {
    background-color: #EAF4FF;
    color: #128CFF;
    border-radius: 5px;
    padding: 4px 0;
    font-size: 0.85rem;
    font-weight: bold;
    margin: 0;
}

.price-tag span {
    font-size: 0.7rem;
    color: #7F9EB8;
    margin-right: 3px;
    font-weight: normal;
}

/* ==========================================================================
   [중요 수정] 아이템 카드 컨트롤 (항상 2단 구성)
   : PC/모바일 상관없이 입력창을 위로, 버튼을 아래로 배치하여 공간 확보
   ========================================================================== */

/* 1. 컨트롤 박스 전체 틀 */
.stepper-box {
    display: flex;
    flex-wrap: wrap;       /* 줄바꿈 허용 */
    gap: 5px;              /* 상하좌우 간격 */
    margin-top: 10px;      /* 위쪽 여백 */
    width: 100%;
}

/* 2. 입력창 (1층): 맨 위에 꽉 차게 배치 */
.qty-input-main {
    order: -1;             /* ★ 핵심: HTML 순서 상관없이 시각적으로 맨 앞으로 보냄 */
    flex: 0 0 100%;        /* 너비 100% 강제 (한 줄 독차지) */
    width: 100%;
    
    height: 36px;          /* 높이 적절히 */
    text-align: center;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 1.1rem;     /* 글자 크기 시원하게 */
    font-weight: bold;
    margin-bottom: 2px;    /* 버튼과 간격 */
    
    /* 모바일 브라우저 기본 스타일 제거 */
    -webkit-appearance: none; 
    margin: 0 0 4px 0;
}

.qty-input-main:focus {
    outline: none;
    border-color: #128CFF;
    background-color: #F0F9FF;
}

/* 3. 버튼들 (2층): 4개가 나란히 배치 */
.step-btn {
    flex: 1;               /* 4개 버튼이 남은 공간을 똑같이 나눠가짐 */
    min-width: 0;          /* 공간 부족해도 찌그러지면서 줄 맞춤 (터짐 방지) */
    
    height: 32px;
    border: 1px solid #ddd;
    background-color: #f8f9fa;
    border-radius: 4px;
    font-weight: bold;
    color: #555;
    cursor: pointer;
    
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.9rem;
    padding: 0;            /* 내부 여백 제거 */
    transition: all 0.1s;
}

.step-btn:hover {
    background-color: #eee;
    color: #333;
}

.step-btn:active {
    background-color: #ddd;
    transform: scale(0.96);
}

/* ==========================================================================
   4. 계산 결과 영역
   ========================================================================== */
.inputs-row {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
}
.inputs-row .col {
    flex: 1;
}

.result-row {
    display: flex;
    gap: 15px;
    align-items: stretch;
}

/* 추천 스테이지 박스 */
.recommend-box {
    background: #fff;
    border: 2px solid var(--ba-blue);
    border-radius: 10px;
    padding: 15px 5px;
    text-align: center;
    box-shadow: 0 4px 10px rgba(18, 140, 255, 0.1);
    height: 100%;
    min-height: 200px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    transition: none;
}

/* 통합된 추천 박스 스타일 */
.unified-box {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 12px 16px;
}

/* 상단 헤더 (이름 + 통계) */
.rec-header-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    padding-bottom: 8px;
    margin-bottom: 4px;
}

/* 추천 스테이지 리스트 컨테이너 */
.rec-info-list {
    display: flex;
    flex-direction: column;
    gap: 10px; /* 카드 사이 간격 */
    margin-top: 10px;
}

/* ★ 4번째 사진 스타일: 흰색 카드 디자인 ★ */
.rec-card {
    background-color: #ffffff; /* 흰색 배경 */
    border-radius: 12px;       /* 둥근 모서리 */
    padding: 15px 20px;        /* 내부 여백 넉넉하게 */
    
    /* 배치 설정 */
    display: flex;
    justify-content: space-between; 
    align-items: center;       
    
    /* 그림자 및 테두리 */
    box-shadow: 0 4px 6px rgba(0,0,0,0.05); 
    border: 1px solid #f0f0f0; 
}

/* 왼쪽: 스테이지 번호 & 아이콘 */
.rec-card-left {
    display: flex;
    flex-direction: column;
    gap: 6px; /* 이름과 아이콘 사이 간격 */
    align-items: flex-start;
}

.rec-stage-name {
    font-size: 1.0rem;
    font-weight: 600; /* 아주 굵게 */
    color: #444;      /* 진한 회색 */
    line-height: 1;
}

.rec-drop-icons {
    display: flex;
    align-items: center;
}

.rec-drop-icons img {
    width: 26px;  /* 아이콘 크기 */
    height: 26px;
    margin-right: 5px;
    object-fit: contain;
}

/* 오른쪽: 횟수 & AP */
.rec-card-right {
    display: flex;
    flex-direction: column;
    align-items: flex-end; /* 오른쪽 정렬 */
    gap: 2px;
}

.rec-run-count {
    font-size: 1.0rem;
    font-weight: 900;
    color: #128CFF; /* 파란색 (사진과 동일) */
    line-height: 1;
}

.rec-ap-cost {
    font-size: 0.95rem;
    color: #999; /* 연한 회색 */
    font-weight: 500;
}

/* 상단 헤더 숨김 처리 */
.rec-stats-group {
    display: none !important;
}

/* 메시지 스타일 */
.rec-message {
    text-align: center;
    padding: 20px;
    color: #aaa;
    font-size: 0.95rem;
}

/* 결과 박스 (오른쪽) */
.result-box.compact-box {
    margin-top: 0;
    height: 100%;
    min-height: 200px;
    padding: 15px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    background: linear-gradient(135deg, var(--ba-blue), var(--ba-cyan));
    box-shadow: 0 5px 15px rgba(18, 140, 255, 0.2);
    border-radius: 15px;
    color: white;
    transition: none;
}

.res-mini-title { font-size: 0.85rem; opacity: 0.8; margin-bottom: 5px; font-weight: bold; }
.res-value-sm { font-size: 2.0rem; font-weight: 900; margin: 5px 0; }
.res-sub-sm { font-size: 0.85rem; opacity: 0.9; }
.res-surplus-sm {
    margin-top: 8px; padding-top: 8px; border-top: 1px dashed rgba(255,255,255,0.3);
    font-size: 0.8rem; line-height: 1.3;
}

/* 결과창 아이템 스타일 */
.gain-item {
    position: relative; display: inline-flex; align-items: center; margin: 0 6px;
    background: white; padding: 4px 8px; border-radius: 8px; border: 2px solid #E0E0E0;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

.row { display: flex; gap: 20px; margin-bottom: 40px; flex-wrap: wrap; }
.col { flex: 1; min-width: 250px; }
label { display: block; font-size: 0.9rem; font-weight: bold; color: #555; margin-bottom: 5px;}
select, .main-input { padding: 10px; border: 2px solid #ccc; border-radius: 8px; width: 100%; box-sizing: border-box; }
.main-input[readonly] { background: #eee; color: var(--ba-blue); font-weight: bold; }

/* ==========================================================================
   5. 하단 드랍 테이블 (Drop Table)
   ========================================================================== */
.drop-info-area {
    margin-top: 40px;
    border-top: 2px dashed #eee;
    padding-top: 20px;
}

.drop-info-area h2 { font-size: 1.2rem; color: #555; margin-bottom: 15px; text-align: center; }

.drop-table-header {
    display: flex;
    justify-content: space-between;
    padding: 0 15px 8px;
    font-size: 0.85rem;
    font-weight: bold;
    color: #999;
    border-bottom: 1px solid #eee;
    margin-bottom: 10px;
}

.stage-row {
    display: flex;
    align-items: center;
    background: white;
    border: 1px solid #eee;
    border-radius: 10px;
    padding: 10px 15px;
    margin-bottom: 8px;
    gap: 10px;
}

.stage-row:hover {
    border-color: var(--ba-cyan);
    box-shadow: 0 2px 8px rgba(0, 209, 255, 0.1);
}

.stage-info {
    width: 280px;       /* 기존 110px -> 180px로 변경 */
    flex-shrink: 0;     /* 너비 줄어들지 않게 고정 */
    border-right: 1px dashed #eee;
    display: flex;
    flex-direction: column;
    gap: 4px;
    justify-content: center; /* 세로 중앙 정렬 추가 */
}

.stage-title { font-weight: bold; color: #333; font-size: 0.95rem; }

.base-area {
    flex: 1; display: flex; flex-wrap: wrap; gap: 5px; justify-content: center;
}

.bonus-area {
    flex: 1; display: flex; flex-wrap: wrap; gap: 5px; justify-content: flex-end;
    padding-left: 10px; border-left: 2px solid #f0f0f0; background-color: #fafafa;
    padding: 5px; border-radius: 8px; min-height: 40px; align-items: center;
}

.drop-badge {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 45px;
    height: 45px;
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    box-shadow: 0 1px 2px rgba(0,0,0,0.05);
}

.drop-badge img { width: 100%; height: 100%; object-fit: contain; padding: 4px; }
.drop-badge span:not(.table-bonus-badge) {
    position: absolute; bottom: 0; right: 2px; font-size: 0.75rem; font-weight: 900;
    color: #333; text-shadow: -1px -1px 0 #fff, 1px 1px 0 #fff, 0 0 3px white;
}

.drop-badge.bonus-drop { border-color: #FF4081; background-color: #FFF0F5; }
.drop-badge.bonus-drop span:not(.table-bonus-badge) { color: #D81B60; }

.table-bonus-badge {
    position: absolute; top: -6px; right: -6px; background-color: #FF4081; color: white;
    font-size: 9px; font-weight: bold; padding: 1px 5px; border-radius: 8px;
    box-shadow: 1px 1px 2px rgba(0,0,0,0.2); z-index: 5;
}

/* ==========================================================================
   6. AP 계산기 위젯
   ========================================================================== */
.ap-widget {
    position: fixed; top: 20px; left: 20px; background: white; padding: 0;
    border-radius: 15px; box-shadow: 0 5px 15px rgba(0,0,0,0.1); border: 2px solid var(--ba-blue);
    width: 240px; z-index: 1000; font-family: 'Noto Sans KR', sans-serif;
    overflow: hidden; transition: all 0.3s ease;
}

.ap-header {
    font-size: 0.9rem; font-weight: bold; color: white; background-color: var(--ba-blue);
    padding: 10px 15px; display: flex; justify-content: space-between; align-items: center; cursor: pointer;
}

.ap-body { padding: 15px; transition: all 0.3s ease; }
.ap-body.hidden { display: none; }
.ap-input-row { display: flex; align-items: center; justify-content: center; gap: 5px; margin-bottom: 10px; }
input[type=number]::-webkit-inner-spin-button, input[type=number]::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
.ap-input-row input {
    width: 80px; padding: 8px; text-align: center; border: 1px solid #ccc; border-radius: 5px;
    font-weight: bold; font-size: 1.1rem; -moz-appearance: textfield;
}
.ap-input-row input:focus { border-color: var(--ba-blue); outline: none; }
.ap-btn {
    width: 35px; height: 35px; background-color: #F0F9FF; border: 1px solid var(--ba-blue);
    border-radius: 5px; color: var(--ba-blue); font-weight: bold; font-size: 1.2rem;
    cursor: pointer; display: flex; align-items: center; justify-content: center; padding: 0;
}
.ap-btn:active { background-color: #dfefff; transform: scale(0.95); }
.max-ap-text { font-weight: 900; color: #555; font-size: 1rem; margin-left: 5px; }
.slash { font-weight: bold; color: #ccc; }
.ap-result { text-align: center; font-size: 0.85rem; color: #555; background: #F0F9FF; padding: 8px; border-radius: 8px; }

/* ==========================================================================
   7. 지역 필터링 (Stage Filter)
   ========================================================================== */
.filter-section {
    background: #fff; border: 1px solid #ddd; border-radius: 12px; padding: 15px; margin-bottom: 30px;
}
.filter-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.filter-header h3 { margin: 0; font-size: 1rem; color: #333; }
.filter-btns { display: flex; gap: 5px; }

.small-btn {
    font-family: 'Noto Sans KR', sans-serif; font-weight: 900; font-size: 0.85rem; padding: 6px 18px;
    cursor: pointer; border-radius: 6px; transform: skewX(-10deg);
    transition: all 0.2s cubic-bezier(0.25, 0.8, 0.25, 1); display: inline-flex;
    align-items: center; justify-content: center; border: none; box-shadow: 2px 3px 5px rgba(0, 0, 0, 0.15);
}
.small-btn:not(.outline) {
    background: linear-gradient(180deg, #95F3FF 0%, #46C3FF 100%); color: #1A2F45; border: 1px solid #8BEFFF;
}
.small-btn.outline {
    background: #FFFFFF; color: #6B7D8C; border: 2px solid #D0D7DB;
}
.small-btn:hover {
    transform: skewX(-10deg) translateY(-2px); box-shadow: 2px 6px 10px rgba(70, 195, 255, 0.3); filter: brightness(1.05);
}
.small-btn:active { transform: skewX(-10deg) translateY(0); box-shadow: 1px 2px 3px rgba(0,0,0,0.1); }

.filter-grid { display: flex; flex-wrap: wrap; gap: 8px; }
.filter-check-input { display: none; }
.filter-label {
    display: inline-block; padding: 6px 12px; background: #f0f0f0; color: #888;
    border-radius: 20px; font-size: 0.85rem; font-weight: bold; cursor: pointer;
    border: 2px solid transparent; transition: all 0.2s; user-select: none;
}
.filter-check-input:checked + .filter-label {
    background: #EAF4FF; color: var(--ba-blue); border-color: var(--ba-blue);
    box-shadow: 0 2px 5px rgba(18, 140, 255, 0.2);
}
.filter-label:hover { background: #e0e0e0; }

/* ==========================================================================
   8. 학생 보너스 위젯 스타일
   ========================================================================== */
.bonus-widget-container {
    width: 100%;             /* 꽉 차게 설정 */
    margin: 0 0 25px 0;      /* 아래 여백만 줌 (왼쪽 쏠림 해결) */
    background: transparent; /* 닫혔을 때 흰색 박스 제거 */
    border-radius: 8px;
    box-shadow: 0 4px 10px rgba(0,0,0,0.05);
    border: 1px solid #ddd;
    overflow: hidden;
}

.bonus-toggle-header {
    background: #f8f9fa; padding: 12px 20px; cursor: pointer;
    display: flex; justify-content: space-between; align-items: center; transition: background 0.2s;
}
.bonus-toggle-header:hover { background: #eef1f3; }

.b-title { display: flex; align-items: center; gap: 10px; font-weight: bold; color: #444; }

/* 내용 박스 (배경색 여기로 이동) */
.student-selector-body {
    background: #E3F2FD; padding: 15px; border-top: 1px solid #ddd;
}
.student-selector-body.hidden { display: none; }

/* 탭 스타일 (수정됨: 색상 반전 로직 적용) */
.student-tabs { display: flex; gap: 6px; margin-bottom: 12px; }

.s-tab {
    flex: 1; text-align: center; padding: 8px;
    border-radius: 6px 6px 0 0;
    font-weight: 900; font-size: 0.85rem;
    cursor: pointer; letter-spacing: 0.5px;
    transition: all 0.2s;
    border: 1px solid #e0e0e0; border-bottom: none;
    background: #fafafa;
}

/* STRIKER */
.s-tab.striker { color: #D32F2F; }
.s-tab.striker.active {
    background: #D32F2F; color: white; border-color: #D32F2F;
    box-shadow: 0 2px 6px rgba(211, 47, 47, 0.3);
}

/* SPECIAL */
.s-tab.special { color: #128CFF; }
.s-tab.special.active {
    background: #128CFF; color: white; border-color: #128CFF;
    box-shadow: 0 2px 6px rgba(18, 140, 255, 0.3);
}

.s-tab:hover:not(.active) { background: #f0f0f0; transform: translateY(-1px); }

.student-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(90px, 1fr));
    gap: 10px;
}

.student-card {
    background: white; border-radius: 8px; overflow: hidden; cursor: pointer; position: relative;
    border: 3px solid transparent; opacity: 0.8; filter: grayscale(100%); transition: all 0.2s ease;
}

.student-card:hover { opacity: 0.8; filter: grayscale(0%); transform: translateY(-2px); }
.student-card.selected {
    opacity: 1; filter: grayscale(0%); border-color: #FFE500;
    box-shadow: 0 0 0 1px #FFE500, 0 4px 10px rgba(255, 229, 0, 0.5); z-index: 1; transform: translateY(-2px);
}
.student-card:active { transform: scale(0.95); }

.card-inner { position: relative; width: 100%; padding-top: 100%; background: #f0f0f0; }
.student-img { position: absolute; top: 0; left: 0; width: 100%; height: 100%; object-fit: cover; }

.bonus-tag-bar {
    background: #343E4E; color: white; text-align: center;
    font-size: 0.9rem; font-weight: 900; padding: 5px 0;
}
.check-badge { display: none !important; }
.student-card.selected .check-badge { display: flex; }

/* ==========================================================================
   9. 보너스 현황판 (Bonus Dashboard)
   ========================================================================== */
.bonus-dashboard {
    display: flex; align-items: center; justify-content: space-around;
    background: white; border-radius: 8px; padding: 10px; margin-bottom: 15px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
}

.bd-item { 
    display: flex; flex-direction: column; align-items: center; flex: 1; 
    cursor: pointer; border-radius: 8px; padding: 5px; transition: all 0.2s;
    border: 2px solid transparent;
}
.bd-item:hover { background-color: #f8f9fa; }
.bd-item.active {
    background-color: #F0F9FF; border-color: var(--ba-blue);
    transform: translateY(-2px); box-shadow: 0 4px 8px rgba(18, 140, 255, 0.15);
}

.bd-icon-box {
    width: 32px !important; height: 32px !important;
    background: #fff; border-radius: 50%; display: flex;
    align-items: center; justify-content: center; margin-bottom: 4px;
    border: 1px solid #eee; overflow: hidden;
}
.bonus-dashboard .bd-item .bd-icon-box {
    width: 85px !important; height: 85px !important;
    min-width: 50px !important; border-radius: 20%;
    background: #f8f9fa; border: 1px solid #eee;
}
.bonus-dashboard .bd-item .bd-icon-box img {
    width: 100% !important; height: 100% !important; object-fit: contain !important;
    max-width: 100%; display: block;
}

.bd-val { font-weight: 900; font-size: 1.1rem; color: var(--ba-blue); margin-top: 2px; }
.bd-line { width: 1px; height: 30px; background: #e0e0e0; }

.bd-manual-input {
    width: 40px; height: 18px; font-size: 11px; text-align: center;
    border: 1px solid rgba(255, 255, 255, 0.3); background: rgba(0, 0, 0, 0.2);
    color: #fff; border-radius: 4px; margin-top: 2px;
}
.bd-manual-input::placeholder { color: rgba(255, 255, 255, 0.5); font-size: 10px; }
.bd-manual-input:focus { outline: none; border-color: #128CFF; background: rgba(0, 0, 0, 0.5); }

/* ==========================================================================
   10. 이벤트 배너 및 상태 배지
   ========================================================================== */
.banner-area {
    width: 100%; cursor: pointer; border-radius: 12px; overflow: hidden;
    box-shadow: 0 4px 10px rgba(0,0,0,0.1); background: white;
    transition: transform 0.2s; text-align: center; position: relative; 
}
.banner-area:hover { transform: translateY(-2px); }
.banner-area img { width: 100%; display: block; }
.banner-placeholder { 
    padding: 20px; font-weight: bold; color: #29415A;
    text-shadow: 2px 0 0 #fff, -2px 0 0 #fff, 0 2px 0 #fff, 0 -2px 0 #fff,
                 1.5px 1.5px 0 #fff, -1.5px -1.5px 0 #fff, 1.5px -1.5px 0 #fff, -1.5px 1.5px 0 #fff,
                 0 3px 5px rgba(0,0,0,0.15);
}

.event-list-box {
    background: white; border-radius: 12px; box-shadow: 0 4px 10px rgba(0,0,0,0.1);
    padding: 10px; border: 1px solid #eee;
}
.event-list-box.hidden { display: none; }

.event-item {
    padding: 8px; border-bottom: 1px dashed #eee; cursor: pointer;
    transition: all 0.2s; background: transparent;
}
.event-item:last-child { border-bottom: none; }
.event-item:hover { background: transparent; transform: scale(1.02); }

.event-item.active {
    background-color: transparent !important; border: none !important; padding: 8px;
}
.event-item.active .banner-wrapper {
    border: 3px solid var(--ba-blue); box-shadow: 0 0 10px rgba(18, 140, 255, 0.3);
}

.banner-wrapper {
    position: relative; width: 100%; border-radius: 8px; overflow: hidden;
    border: 1px solid #eee; line-height: 0;
}
.list-banner-img { width: 100%; height: auto; display: block; object-fit: cover; }

/* 상태 배지 */
.status-badge-overlay {
    position: absolute; top: 6px; left: 6px; display: inline-flex; align-items: center;
    justify-content: center; width: auto; height: 24px; padding: 0 10px;
    color: #ffffff; font-size: 0.75rem; font-weight: 700; font-family: 'Noto Sans KR', sans-serif;
    letter-spacing: -0.5px; white-space: nowrap; background-color: rgba(45, 62, 80, 0.9);
    border: none; border-radius: 30px; box-shadow: 0 2px 4px rgba(0, 0, 0, 0.25); z-index: 10;
}
.status-badge-overlay.ing { background-color: rgba(45, 62, 80, 0.9); }
.status-badge-overlay.end { background-color: rgba(0, 0, 0, 0.8); color: #cccccc; }
.status-badge-overlay.ready { background-color: rgba(255, 140, 0, 0.9); color: white; }

/* ==========================================================================
   11. 기타 및 성능 최적화
   ========================================================================== */
.calc-area { min-height: 380px; contain: content; }

.version-info {
    text-align: center; font-size: 0.75rem; color: #aaa; margin-top: 40px;
    padding-top: 20px; border-top: 1px solid #eee; font-family: monospace;
}

/* AP 배지 아이콘 강제 확대 */
.stage-ap-badge {
    font-size: 0.85rem; color: #444; background: #f5f5f5; height: 24px; 
    padding: 0 8px 0 4px; border-radius: 12px; width: fit-content; font-weight: 900;
    display: inline-flex; align-items: center; justify-content: center; gap: 2px;
}
.stage-ap-badge img {
    width: 24px !important; height: 24px !important; object-fit: contain;
    transform: scale(1.6) translateY(-1px); margin-right: -2px;
}

/* ==========================================================================
   12. 반응형 미디어 쿼리 (Media Queries)
   ========================================================================== */

/* 화면이 1700px 이하일 때 (노트북, 일반 데스크탑) */
@media (max-width: 1700px) {
    .app-wrapper {
        justify-content: center; gap: 30px;
    }
    .sidebar {
        position: sticky; left: auto; top: 20px; height: fit-content; margin-right: 0;
    }
    .container {
        margin: 0; max-width: 1100px; flex: 1; min-width: 0;
    }
}

/* 태블릿/모바일 (1100px 이하) */
@media (max-width: 1100px) {
    .app-wrapper {
        flex-direction: column; align-items: center;
    }
    .sidebar {
        position: static; width: 100%; max-width: 600px; margin-bottom: 20px; order: -1;
    }
    .container {
        width: 100%; max-width: 100%;
    }
}

/* 모바일 전용 (600px 이하) - 2열 유지 & 화면 확장 */
@media (max-width: 600px) {
    .app-wrapper { padding: 5px !important; width: 100% !important; }
    .container { padding: 10px !important; width: 100% !important; max-width: 100% !important; border-radius: 8px; }
    
    .shop-section.active {
        grid-template-columns: repeat(2, 1fr) !important; gap: 8px !important;
    }
    
    .student-grid {
        grid-template-columns: repeat(4, 1fr) !important; gap: 5px !important;
    }
    .bonus-tag-bar { font-size: 0.7rem !important; padding: 3px 0 !important; }
    .check-badge { width: 16px !important; height: 16px !important; top: 3px !important; right: 3px !important; font-size: 10px !important; }
    
    .item-name { font-size: 0.8rem; height: 2.4em; }
    .price-tag { font-size: 0.8rem; }
    
    /* 입력창과 버튼은 상단의 글로벌 설정으로 이미 2단 분리됨 */
}
/* ==========================================================================
   [Mobile Drop Table] 드랍 테이블 모바일 카드형 레이아웃
   : 제목을 위로, 아이템을 아래로 배치하여 가독성 확보
   ========================================================================== */
@media (max-width: 600px) {
    /* 1. 테이블 헤더(설명줄) 숨김 -> 카드형이라 굳이 필요 없음 */
    .drop-table-header {
        display: none !important;
    }

    /* 2. 행(Row)을 세로 배치로 변경 */
    .stage-row {
        flex-direction: column !important; /* 세로 정렬 강제 */
        align-items: stretch !important;   /* 가로 꽉 채우기 */
        gap: 0 !important;                 /* 내부 간격 제거 (구역별 패딩으로 대체) */
        padding: 0 !important;             /* 전체 패딩 제거 */
        overflow: hidden;                  /* 둥근 모서리 유지 */
    }

    /* 3. 상단: 스테이지 정보 (제목 + AP) */
    .stage-info {
        width: 100% !important;
        border-right: none !important;
        border-bottom: 1px solid #eee;     /* 아래쪽 구분선 추가 */
        padding: 12px 15px !important;     /* 넉넉한 터치 영역 */
        
        /* 제목과 AP를 양옆으로 찢어서 배치 */
        flex-direction: row !important;
        justify-content: space-between !important;
        align-items: center !important;
        background-color: #fcfcfc;         /* 아주 연한 회색 배경 */
    }

    /* 제목 글자 크기 살짝 키움 */
    .stage-title {
        font-size: 1rem !important;
    }

    /* 4. 하단: 아이템 드랍 영역 (기본 + 보너스) */
    .base-area, .bonus-area {
        width: 100% !important;
        justify-content: flex-start !important; /* 왼쪽 정렬 */
        padding: 10px 15px !important;
        border-left: none !important;      /* PC용 왼쪽 선 제거 */
        min-height: auto !important;       /* 높이 제한 해제 */
    }

    /* 보너스 영역 스타일링 (구분을 위해 배경색 유지) */
    .bonus-area {
        background-color: #fffafc !important; /* 연한 핑크빛 배경 */
        border-top: 1px dashed #eee;          /* 위쪽 점선 추가 */
        padding-top: 12px !important;
    }
}
/* ==========================================================================
   [Mobile UI Final Patch] 보너스 위젯 & 상점 탭 최적화
   1. 보너스 현황판: 화면 좁으면 2단 배치 + 크기 축소 + 구분선 숨김
   2. 상점 탭: 화면 좁으면 2단 배치 (2개씩 줄바꿈)
   ========================================================================== */
@media (max-width: 600px) {

    /* --- 1. 보너스 현황판 (Bonus Dashboard) 수정 --- */
    
    .bonus-dashboard {
        flex-wrap: wrap;       /* 줄바꿈 허용 */
        gap: 10px;             /* 위아래/좌우 간격 */
        padding: 10px 5px;     /* 패딩 약간 축소 */
    }

    .bd-item {
        /* [핵심] 한 줄에 2개씩 배치 (약 48% 너비) */
        flex: 0 0 45% !important; 
        max-width: 50% !important;
        margin-bottom: 5px;
    }

    /* 구분선(세로줄)은 2단 배치 시 보기 싫으므로 숨김 */
    .bd-line {
        display: none !important;
    }

    /* 아이콘 박스 크기 축소 (85px -> 55px) */
    .bonus-dashboard .bd-item .bd-icon-box {
        width: 55px !important;
        height: 55px !important;
        border-radius: 16px !important; /* 모서리도 살짝 덜 둥글게 */
    }

    /* 퍼센트 글자 크기 축소 */
    .bd-val {
        font-size: 0.95rem !important;
        margin-top: 2px;
    }

    /* 수기입력 창 크기 조정 */
    .bd-manual-input {
        width: 100%;       /* 너비 꽉 차게 */
        max-width: 60px;   /* 너무 늘어나진 않게 제한 */
        height: 24px;      /* 터치 편하게 높이 키움 */
        font-size: 12px;
    }


    /* --- 2. 상점 탭 (Shop Tabs) 수정 --- */

    .shop-tabs {
        flex-wrap: wrap;       /* 줄바꿈 허용 */
        gap: 8px;              /* 버튼 사이 간격 */
    }

    .tab-btn {
        /* [핵심] 한 줄에 2개씩 배치 */
        flex: 1 1 45% !important; /* 남은 공간 채우되 기본 45% 차지 */
        min-width: 120px;         /* 너무 작아짐 방지 */
        
        padding: 8px 10px;        /* 패딩 축소 */
        font-size: 0.9rem;        /* 글자 크기 조정 */
        margin: 0;                /* 마진 초기화 */
    }
}