/* ==========================================================================
   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;
}

.container {
    width: 100%;
    max-width: 1100px;
    background: white;
    border-radius: 15px;
    box-shadow: 0 10px 25px rgba(0,0,0,0.05);
    padding: 25px;
    overflow: hidden;
}

h1 {
    text-align: center;
    color: var(--ba-blue);
    margin-bottom: 20px;
    font-weight: 800;
}

/* ==========================================================================
   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;
}

/* 카드 하단 컨트롤 (슬라이더/입력) */
.control-row {
    display: flex;
    align-items: center;
    gap: 4px;
    margin-top: auto;
}

input[type=range] {
    flex: 1;
    cursor: pointer;
    accent-color: var(--ba-blue);
    height: 5px;
    min-width: 0;
}

.qty-input-sm {
    width: 60px;
    padding: 6px 4px;
    border: 1px solid #ccc;
    border-radius: 6px;
    text-align: center;
    font-weight: bold;
    font-size: 0.9rem;
    background: white;
    box-sizing: border-box;
}

.qty-input-sm:focus {
    border-color: var(--ba-blue);
    outline: none;
}

/* ==========================================================================
   4. 계산 결과 영역
   ========================================================================== */
.inputs-row {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
}
.inputs-row .col {
    flex: 1; /* 3등분 */
}

.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: 140px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}

.rec-label { font-size: 0.75rem; color: #999; font-weight: bold; letter-spacing: 1px; margin-bottom: 5px; }
.rec-name { font-size: 1.3rem; font-weight: 900; color: var(--ba-blue); margin-bottom: 5px; white-space: normal; word-break: keep-all; line-height: 1.2; }
.rec-info { font-size: 0.85rem; color: #555; background: #f0f9ff; padding: 4px 10px; border-radius: 15px; display: inline-block; }

/* 결과 박스 (오른쪽) */
.result-box.compact-box {
    margin-top: 0;
    height: 100%;
    min-height: 140px;
    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;
}

.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);
}
.bonus-badge {
    position: absolute; top: -8px; right: -5px; background-color: var(--bonus-pink);
    color: white; font-size: 0.6rem; font-weight: bold; padding: 2px 6px; border-radius: 10px;
    box-shadow: 0 2px 2px rgba(0,0,0,0.2); z-index: 10; line-height: 1; border: 1px solid #fff;
}

.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; }
/* [수정됨] AP 배지 : 패딩을 줄여서 아이콘이 커져도 배지가 뚱뚱해지지 않게 함 */


.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;
}

.mini-icon { width: 18px; height: 18px; object-fit: contain; vertical-align: middle; margin-right: 2px; }
.mini-icon-white { width: 16px; height: 16px; object-fit: contain; vertical-align: middle; background: rgba(255,255,255,0.2); border-radius: 50%; }

/* ==========================================================================
   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. 반응형 (Media Queries)
   ========================================================================== */
@media (max-width: 1100px) {
    body { flex-direction: column; align-items: center; }
    .ap-widget { position: static; width: 100%; max-width: 900px; margin-bottom: 20px; }
    .ap-header { border-radius: 10px 10px 0 0; }
}
@media (max-width: 800px) {
    .shop-section.active { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 600px) {
    .container { padding: 15px; }
    .inputs-row, .result-row { flex-direction: column; gap: 15px; }
    .recommend-box, .result-box.compact-box { min-height: auto; padding: 20px; }
    
    /* [Fix] 모바일 상점 2열 강제 */
    .shop-section.active { 
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 8px !important;
    }
    .qty-input-sm { width: 35px; font-size: 0.8rem; }
    .img-box { width: 50px; height: 50px; }
    .stage-row { flex-direction: column; align-items: flex-start; gap: 10px; }
    .stage-items { width: 100%; justify-content: flex-start; }
    .drop-table-header { display: none; }
    .stage-info { width: 100%; border-right: none; border-bottom: 1px dashed #eee; padding-bottom: 5px; flex-direction: row; justify-content: space-between; align-items: center; }
    .base-area, .bonus-area { justify-content: flex-start; border-left: none; }
    .bonus-area { background-color: #fff5f8; }
}

/* ==========================================================================
   8. [복구됨] AP 존버 가이드 모달 스타일 (누락분 복구)
   ========================================================================== */
.ap-guide-btn {
    background: #4A90E2; color: white; border: none; padding: 10px 20px;
    border-radius: 20px; cursor: pointer; font-weight: bold;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1); transition: 0.2s;
}
.ap-guide-btn:hover { background: #357ABD; transform: translateY(-2px); }

.modal-overlay {
    display: none; position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0, 0, 0, 0.5); z-index: 1000;
    justify-content: center; align-items: center;
}
.modal-window {
    background: white; width: 90%; max-width: 500px;
    border-radius: 12px; overflow: hidden; box-shadow: 0 10px 25px rgba(0,0,0,0.3);
}
.modal-header {
    background: #2D3E50; color: white; padding: 15px;
    display: flex; justify-content: space-between; align-items: center;
}
.close-btn { font-size: 24px; cursor: pointer; }
.modal-body { padding: 20px; max-height: 80vh; overflow-y: auto; }

.guide-settings { background: #F3F5F7; padding: 15px; border-radius: 8px; margin-bottom: 20px; }
.g-row { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; font-size: 14px; }
.g-row input[type="number"], .g-row select { padding: 5px; border: 1px solid #ddd; border-radius: 4px; width: 80px; text-align: center; }
.calc-guide-btn {
    width: 100%; background: #E91E63; color: white; border: none;
    padding: 10px; border-radius: 6px; font-weight: bold; cursor: pointer; margin-top: 10px;
}

.guide-step { margin-bottom: 15px; border-left: 4px solid #4A90E2; padding-left: 10px; }
.guide-step h4 { margin: 0 0 5px 0; color: #2D3E50; }
.guide-step p { margin: 2px 0; font-size: 13px; color: #555; }
.guide-total {
    background: #E3F2FD; padding: 15px; border-radius: 8px; text-align: center;
    font-weight: bold; color: #1565C0; font-size: 1.1em;
}

/* ==========================================================================
   9. 지역 필터링 (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; }

/* ==========================================================================
   10. [NEW] 학생 보너스 위젯 스타일 (블루 아카이브 UI) - 중복
   ========================================================================== */
.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; }
.total-badge {
    background: #FF4F94; color: white; padding: 2px 10px; border-radius: 12px;
    font-size: 0.9rem; font-weight: 900;
}

/* 내용 박스 (배경색 여기로 이동) */
.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 (빨강) --- */
/* 1. 안 눌린 상태: 글자 빨강 / 배경 연회색 */
.s-tab.striker {
    color: #D32F2F;
}
/* 2. 눌린 상태: 글자 흰색 / 배경 빨강 */
.s-tab.striker.active {
    background: #D32F2F;
    color: white;
    border-color: #D32F2F;
    box-shadow: 0 2px 6px rgba(211, 47, 47, 0.3);
}

/* --- SPECIAL (파랑) --- */
/* 1. 안 눌린 상태: 글자 파랑 / 배경 연회색 */
.s-tab.special {
    color: #128CFF;
}
/* 2. 눌린 상태: 글자 흰색 / 배경 파랑 */
.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;                /* 50% 투명도 */
    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; }

/* ==========================================================================
   11. [Mobile] 학생 보너스 그리드 4열 강제 적용 (추가됨) - 중복
   ========================================================================== */
@media (max-width: 600px) {
    .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;
    }
}

/* ==========================================================================
   [NEW] 추가된 패치 (보너스 현황판 + 아이콘 크기 고정)
   ========================================================================== */

/* 1. 보너스 현황판 대시보드 */
.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; }
.bd-val { font-weight: 900; font-size: 1.1rem; color: var(--ba-blue); margin-top: 4px;}
.bd-line { width: 1px; height: 30px; background: #e0e0e0; }

/* ==========================================================================
   [Emergency Fix] 보너스 아이콘 크기 강제 고정 (최종)
   ========================================================================== */

/* 1. 아이콘을 감싸는 동그라미 박스 크기 */
.bonus-dashboard .bd-item .bd-icon-box {
    width: 85px !important;   /* 박스 지름 32px */
    height: 85px !important;
    min-width: 50px !important; /* 찌그러짐 방지 */
    border-radius: 20%;
    overflow: hidden;         /* 이미지가 박스 밖으로 넘치면 자름 */
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f8f9fa;
    border: 1px solid #eee;
}

/* 2. 내부 이미지 크기 (클래스 이름 없어도 적용되게 수정함) */
.bonus-dashboard .bd-item .bd-icon-box img {
    width: 100% !important;   /* 이미지 크기 20px */
    height: 100% !important;
    object-fit: contain !important; /* 비율 유지 */
    max-width: 100%;
    display: block;
}
/* ==========================================================================
   6. AP 계산기 위젯 (iOS Style - 아이콘 토글형)
   ========================================================================== */
.ap-ios-wrapper {
    position: fixed;
    top: 20px;
    left: 20px;
    z-index: 2000;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
}

/* 1. 둥근 아이콘 버튼 (평소에 보이는 것) */
.ap-ios-icon {
    width: 55px;
    height: 55px;
    background: rgba(255, 255, 255, 0.85); /* 반투명 흰색 */
    backdrop-filter: blur(12px);            /* 블러 효과 */
    -webkit-backdrop-filter: blur(12px);
    border-radius: 50%;                     /* 완전 원형 */
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.15);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    border: 1px solid rgba(255, 255, 255, 0.6);
    transition: transform 0.2s cubic-bezier(0.3, 1.5, 0.5, 1);
}

.ap-ios-icon:hover {
    transform: scale(1.1); /* 호버 시 확대 */
    background: rgba(255, 255, 255, 0.95);
}

.ap-ios-icon img {
    width: 60%;
    height: 60%;
    object-fit: contain;
}

/* 2. 팝업창 (클릭하면 뜨는 것) */
.ap-ios-popup {
    margin-top: 15px;
    width: 260px;
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-radius: 24px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.5);
    overflow: hidden;
    animation: popupScale 0.25s cubic-bezier(0.2, 0.8, 0.2, 1);
    transform-origin: top left;
}

/* 숨김 클래스 */
.ap-ios-popup.hidden {
    display: none;
}

/* 헤더 */
.ap-ios-header {
    padding: 15px 20px;
    font-weight: 900;
    font-size: 1rem;
    color: #333;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}

.close-btn-ios {
    background: none;
    border: none;
    font-size: 1.2rem;
    color: #999;
    cursor: pointer;
    padding: 0;
    line-height: 1;
}

/* 바디 */
.ap-ios-body {
    padding: 20px;
    text-align: center;
}

/* 입력 컨트롤 */
.ap-input-row {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    margin-bottom: 8px;
}

.ap-input-row input {
    width: 80px;
    padding: 10px;
    border: none;
    border-radius: 12px;
    background: rgba(0, 0, 0, 0.05);
    text-align: center;
    font-weight: bold;
    font-size: 1.2rem;
    color: #333;
    outline: none;
}

.ap-circle-btn {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: none;
    background: white;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    color: var(--ba-blue);
    font-weight: bold;
    font-size: 1.2rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}
.ap-circle-btn:active { transform: scale(0.9); }

.ap-status-text {
    font-size: 0.8rem;
    color: #888;
    margin-bottom: 15px;
}
.max-ap-text { color: #333; font-weight: bold; }

/* 결과 텍스트 */
.ap-ios-result {
    background: white;
    padding: 12px;
    border-radius: 16px;
    font-size: 0.9rem;
    color: #555;
    box-shadow: 0 2px 8px rgba(0,0,0,0.03);
}

/* 팝업 애니메이션 */
@keyframes popupScale {
    from { opacity: 0; transform: scale(0.8); }
    to { opacity: 1; transform: scale(1); }
}

/* 모바일 위치 조정 */
@media (max-width: 1100px) {
    .ap-ios-wrapper {
        top: 15px;
        left: 15px;
    }
}
/* [Fix] AP 배지 내부 아이콘 크기 확대 */
.stage-ap-badge img {
    width: 50px !important;  /* 기존 14px -> 22px로 확대 (원하는 대로 조절하세요) */
    height: 22px !important;
    object-fit: contain;     /* 비율 유지 */
    vertical-align: middle;  /* 수직 정렬 보정 */
    margin-bottom: 2px;      /* 숫자와 높이 맞추기 미세 조정 */
}

/* ==========================================================================
   [Real Final Fix] AP 배지 아이콘 강제 확대 (여백 제거 효과)
   ========================================================================== */

/* 1. 배지 틀 (높이 고정, 넘치는 이미지 숨김 안 함) */
.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; /* 아이콘과 글자 사이 간격 좁힘 */
}

/* 2. 아이콘 이미지 (강제 확대) */
.stage-ap-badge img {
    width: 24px !important;  /* 박스 크기는 24px */
    height: 24px !important;
    object-fit: contain;
    
    /* ▼▼▼ 여기가 핵심! 이미지를 1.6배 뻥튀기해서 여백을 없앰 ▼▼▼ */
    transform: scale(1.6) translateY(-1px); 
    
    /* 필요시 좌우 여백 미세 조정 */
    margin-right: -2px; 
}

/* [수정됨] 3종 보너스 현황판 (클릭 가능하게 변경) */
.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;
}

/* [NEW] 선택된 상태 (파란 테두리) */
.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;
}

/* 아이콘 이미지 */
.bd-icon { 
    width: 20px !important; height: 20px !important; 
    object-fit: contain; 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; }