/* 
 * TopLLMs 유틸리티 스타일
 * 
 * 이 파일은 툴팁, 유틸리티 클래스, 반응형 스타일 등을 정의합니다.
 * 다크 테마 기반으로 설계되었습니다.
 */

/* ===== 툴팁 스타일 (통합) ===== */
/* 툴팁 컨테이너 */
.tooltip {
    position: relative;
    display: inline-block;
    cursor: help;
    margin-left: var(--spacing-xs);
}

/* 툴팁 아이콘 */
.tooltip-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: var(--icon-size-sm);
    height: var(--icon-size-sm);
    margin-left: var(--spacing-xs);
    cursor: help;
    position: relative;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%23999'%3E%3Cpath d='M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm1 17h-2v-2h2v2zm2.07-7.75l-.9.92C13.45 12.9 13 13.5 13 15h-2v-.5c0-1.1.45-2.1 1.17-2.83l1.24-1.26c.37-.36.59-.86.59-1.41 0-1.1-.9-2-2-2s-2 .9-2 2H8c0-2.21 1.79-4 4-4s4 1.79 4 4c0 .88-.36 1.68-.93 2.25z'/%3E%3C/svg%3E");
    background-size: cover;
    background-repeat: no-repeat;
    background-position: center;
    transition: transform var(--transition-duration) ease;
}

.tooltip-icon {
    /* 호버 효과 제거 */
}

/* 툴팁 트리거 아이콘 */
.tooltip-icon.tooltip-trigger {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%23999'%3E%3Cpath d='M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm1 17h-2v-2h2v2zm2.07-7.75l-.9.92C13.45 12.9 13 13.5 13 15h-2v-.5c0-1.1.45-2.1 1.17-2.83l1.24-1.26c.37-.36.59-.86.59-1.41 0-1.1-.9-2-2-2s-2 .9-2 2H8c0-2.21 1.79-4 4-4s4 1.79 4 4c0 .88-.36 1.68-.93 2.25z'/%3E%3C/svg%3E");
    background-size: cover;
    background-repeat: no-repeat;
    background-position: center;
}

/* 툴팁 텍스트 */
.tooltip .tooltip-text {
    visibility: hidden;
    width: 300px;
    /* 글래스모피즘 배경 */
    background: rgba(30, 41, 59, 0.9);
    color: var(--primary-text);
    text-align: left;
    border-radius: var(--border-radius);
    padding: var(--spacing-md);
    position: absolute;
    z-index: 100;
    bottom: 125%;
    left: 50%;
    margin-left: -150px;
    opacity: 0;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    font-size: var(--font-size-sm);
    box-shadow: var(--glass-shadow);
    line-height: 1.5;
    pointer-events: none;
    border: 1px solid var(--glass-border);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
}

.tooltip .tooltip-text::after {
    content: "";
    position: absolute;
    top: 100%;
    left: 50%;
    margin-left: -5px;
    border-width: 5px;
    border-style: solid;
    border-color: rgba(30, 41, 59, 0.9) transparent transparent transparent;
}

/* 툴팁 모달 스타일 */
.tooltip-modal, .model-detail-tooltip {
    position: fixed;
    z-index: 10003;
    /* 글래스모피즘 배경 */
    background: rgba(30, 41, 59, 0.95);
    color: var(--primary-text);
    border-radius: var(--border-radius-lg);
    box-shadow: var(--glass-shadow), 0 0 50px rgba(59, 130, 246, 0.1);
    max-width: 80vw;
    max-height: 80vh;
    font-size: var(--font-size-md);
    line-height: 1.4;
    overflow: hidden;
    flex-direction: column;
    pointer-events: auto;
    display: none;
    border: 1px solid var(--glass-border);
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 500px;
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
}

/* 모델 상세 정보 툴팁 스타일 (models_tooltip.css에서 통합) */
.model-detail-tooltip {
    position: fixed;
    z-index: 9999;
    /* 글래스모피즘 배경 */
    background: rgba(30, 41, 59, 0.95);
    color: var(--primary-text);
    border-radius: var(--border-radius-lg);
    box-shadow: var(--glass-shadow), 0 0 50px rgba(59, 130, 246, 0.1);
    max-width: 80vw;
    max-height: 80vh;
    font-size: var(--font-size-md);
    line-height: 1.4;
    overflow: hidden;
    flex-direction: column;
    pointer-events: auto;
    display: none; /* 기본적으로 숨김 상태로 설정 */
    border: 1px solid var(--glass-border);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
}

.model-detail-tooltip .tooltip-header {
    padding: var(--tooltip-header-padding);
    position: sticky;
    top: 0;
    /* 헤더도 글래스모피즘 효과 */
    background: rgba(30, 41, 59, 0.98);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    z-index: 1;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    margin-bottom: var(--spacing-xs);
}

.model-detail-tooltip .tooltip-title {
    font-weight: bold;
    font-size: var(--font-size-md);
    color: var(--primary-text);
    margin-right: var(--spacing-sm);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: calc(100% - 40px);
}

.model-detail-tooltip .tooltip-content {
    padding: var(--tooltip-content-padding);
    overflow-y: auto;
    white-space: pre-wrap;
    text-align: left;
    flex: 1;
}

.model-detail-tooltip .tooltip-close-button {
    background: none;
    border: none;
    color: var(--primary-text);
    font-size: 16px;
    cursor: pointer;
    padding: 0;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all var(--transition-duration);
    flex-shrink: 0;
    line-height: 1;
    font-weight: normal;
}

.model-detail-tooltip .tooltip-close-button svg {
    width: 16px;
    height: 16px;
    display: block;
    margin: 0;
    padding: 0;
}

.model-detail-tooltip .tooltip-close-button:hover {
    background: rgba(59, 130, 246, 0.2);
    color: var(--primary-brand);
    transform: scale(1.1);
}

.model-detail-tooltip .tooltip-close-button {
    /* 호버 효과 제거 */
}

/* 가격 기준 안내 툴팁 스타일 (models_tooltip.css에서 통합) */
.price-info-tooltip {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    /* 글래스모피즘 배경 */
    background: rgba(30, 41, 59, 0.95);
    color: var(--primary-text);
    padding: var(--spacing-lg);
    border-radius: var(--border-radius-lg);
    box-shadow: var(--glass-shadow), 0 0 50px rgba(59, 130, 246, 0.1);
    z-index: 10000;
    max-width: 90vw;
    max-height: 90vh;
    overflow-y: auto;
    border: 1px solid var(--glass-border);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
}

.price-info-tooltip h4 {
    color: var(--primary-text);
    margin-top: 0;
    margin-bottom: var(--spacing-sm);
    font-size: 1.2rem;
}

.price-info-tooltip p {
    margin-bottom: var(--spacing-xs);
    font-size: 0.9rem;
    line-height: 1.6;
}

.price-info-tooltip ul {
    margin-top: 0;
    margin-bottom: var(--spacing-xs);
    padding-left: var(--spacing-lg);
    font-size: 0.9rem;
    line-height: 1.6;
}

.price-info-tooltip li {
    margin-bottom: var(--spacing-xs);
}

.price-info-tooltip .close-button {
    position: absolute;
    top: var(--spacing-sm);
    right: var(--spacing-sm);
    background: none;
    border: none;
    color: var(--secondary-text);
    font-size: 1.2rem;
    cursor: pointer;
    transition: all var(--transition-duration);
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

.price-info-tooltip .close-button:hover {
    background: rgba(59, 130, 246, 0.2);
    color: var(--primary-brand);
    transform: scale(1.1);
}

.price-info-tooltip .close-button {
    /* 호버 효과 제거 */
}

/* 모바일 반응형 가격 기준 안내 툴팁 스타일 */
@media (max-width: 768px) {
    .price-info-tooltip {
        padding: var(--spacing-sm);
        font-size: 0.85rem;
        line-height: 1.5;
    }

    .price-info-tooltip h4 {
        font-size: 1.1rem;
        margin-bottom: var(--spacing-xs);
    }

    .price-info-tooltip ul {
        padding-left: var(--spacing-md);
    }
}

/* 툴팁 표시/숨김 클래스 */
.tooltip-visible {
    display: flex !important;
}

.tooltip-hidden {
    display: none !important;
}

/* 툴팁 헤더 스타일 */
.tooltip-header {
    padding: var(--tooltip-header-padding);
    position: sticky;
    top: 0;
    /* 글래스모피즘 헤더 */
    background: rgba(30, 41, 59, 0.98);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    z-index: 1;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    margin-bottom: var(--spacing-xs);
}

/* 툴팁 제목 스타일 */
.tooltip-title {
    font-weight: bold;
    font-size: var(--font-size-md);
    color: var(--primary-text);
    margin-right: var(--spacing-sm);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: calc(100% - 40px);
}

/* 툴팁 닫기 버튼 스타일 */
.tooltip-close-button {
    background: none;
    border: none;
    color: var(--primary-text);
    font-size: 16px;
    cursor: pointer;
    padding: 0;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all var(--transition-duration);
    flex-shrink: 0;
    line-height: 1;
    font-weight: normal;
}

.tooltip-close-button svg {
    width: 16px;
    height: 16px;
    display: block;
    margin: 0;
    padding: 0;
}

.tooltip-close-button:hover {
    background: rgba(59, 130, 246, 0.2);
    color: var(--primary-brand);
    transform: scale(1.1);
}

/* 툴팁 닫기 버튼 호버 효과 */
.tooltip-close-button {
    /* 호버 효과 제거 */
}

/* 툴팁 닫기 버튼 스타일 - 호버 상태 */
.tooltip-button-hover {
    background-color: var(--hover-background);
}

/* 툴팁 내용 스타일 */
.tooltip-content {
    padding: var(--tooltip-content-padding);
    overflow-y: auto;
    white-space: pre-wrap;
    text-align: left;
    flex: 1;
    color: var(--primary-text);
}

/* ===== 바텀시트 스타일 (benchmark.css에서 통합) ===== */
/* 바텀시트 스타일 클래스 */
.bottom-sheet-active {
    visibility: visible;
    transform: translateY(0);
    transition: transform 0.3s ease, visibility 0s linear 0s;
}

/* 바텀시트 스타일 - 중복 스크롤바 문제 해결 */
.bottom-sheet {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 10002;
    visibility: hidden;
    transform: translateY(100%);
    transition: transform 0.3s ease, visibility 0s linear 0.3s;
    display: flex;
    flex-direction: column;
    max-height: 80vh;
    overflow: hidden !important;
    background-color: var(--secondary-background);
    border-radius: 12px 12px 0 0;
    box-shadow: var(--shadow-xl);
    border: 1px solid var(--border-color);
    border-bottom: none;
}

.bottom-sheet.active {
    visibility: visible;
    transform: translateY(0);
    transition: transform 0.3s ease, visibility 0s linear 0s;
}

/* 알파값 레이어 (배경 어둡게) */

/* 바텀시트 오버레이 */
.bottom-sheet-overlay,
.sheet-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(15, 23, 42, 0.3);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    z-index: 999;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.sheet-overlay.active {
    opacity: 1;
    visibility: visible;
}

.bottom-sheet.active .bottom-sheet-overlay {
    opacity: 1;
}

/* sheet-* 클래스 (bottom- 프리픽스 없는 버전) */
.sheet-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px;
    border-bottom: 1px solid var(--border-color);
    background-color: var(--secondary-background);
    position: relative;
    z-index: 3;
    flex-shrink: 0;
}

.sheet-title {
    margin: 0;
    font-size: 18px;
    color: var(--primary-text);
    font-weight: 600;
}

.sheet-close {
    background: none;
    border: none;
    color: var(--secondary-text);
    font-size: 20px;
    cursor: pointer;
    padding: 0;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    line-height: 1;
}

.sheet-close:hover {
    background-color: var(--hover-background);
    color: var(--primary-text);
}

.sheet-content {
    flex: 1;
    overflow-y: auto !important;
    overflow-x: hidden !important;
    background-color: var(--secondary-background);
    position: relative;
    z-index: 2;
    padding: 0 !important;
    -webkit-overflow-scrolling: touch;
}

.sheet-options {
    list-style: none;
    padding: 0;
    margin: 0;
    overflow-y: visible !important;
}

.sheet-option {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px;
    border-bottom: 1px solid var(--border-color);
    color: var(--primary-text);
    cursor: pointer;
    transition: all 0.2s ease;
}

.sheet-option .option-text {
    flex: 1;
}

.sheet-option:last-child {
    border-bottom: none;
}

.sheet-option.selected {
    color: var(--primary-brand);
    background-color: var(--brand-light);
    box-shadow: inset 0 0 0 2px var(--primary-brand);
    font-weight: 600;
}

.sheet-option .check-icon {
    width: 20px;
    height: 20px;
    color: var(--primary-brand);
    margin-left: 8px;
    flex-shrink: 0;
}

.sheet-option:hover {
    background-color: var(--hover-background);
    transform: translateX(5px);
}

.sheet-option:active {
    background-color: var(--brand-light);
}

/* 바텀시트 컨텐츠 - 스크롤 가능한 영역 */
.bottom-sheet-content {
    flex: 1;
    overflow-y: auto !important;
    overflow-x: hidden !important;
    background-color: var(--secondary-background);
    position: relative;
    z-index: 2;
    padding: 0 !important;
    -webkit-overflow-scrolling: touch;
}

/* 바텀시트 헤더 - 고정 영역 */
.bottom-sheet-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px;
    border-bottom: 1px solid var(--border-color);
    background-color: var(--secondary-background);
    position: relative;
    z-index: 3;
    flex-shrink: 0;
}

.bottom-sheet-header h3 {
    margin: 0;
    font-size: 18px;
    color: var(--primary-text);
}

/* 바텀시트 닫기 버튼 */
.bottom-sheet-close {
    background: none;
    border: none;
    color: var(--secondary-text);
    font-size: 16px;
    cursor: pointer;
    padding: 0;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    line-height: 1;
}

.bottom-sheet-close svg {
    width: 16px;
    height: 16px;
    display: block;
    margin: 0;
    position: relative;
}

.bottom-sheet-close:hover {
    background-color: var(--hover-background);
    color: var(--primary-text);
}

/* 바텀시트 옵션 목록 */
.bottom-sheet-options {
    list-style: none;
    padding: 0;
    margin: 0;
    overflow-y: visible !important;
}

.bottom-sheet-option {
    padding: 14px 16px;
    border-bottom: 1px solid var(--border-color);
    color: var(--primary-text);
    cursor: pointer;
    transition: all 0.2s ease;
}

.bottom-sheet-option:last-child {
    border-bottom: none;
}

.bottom-sheet-option.selected {
    color: var(--primary-brand);
    background-color: var(--brand-light);
    box-shadow: inset 0 0 0 2px var(--primary-brand);
}

.bottom-sheet-option:hover {
    background-color: var(--hover-background);
    transform: translateX(5px);
}

.bottom-sheet-option:active {
    background-color: var(--brand-light);
}

/* 바텀시트 열려있을 때 body 스크롤 방지 */
body.bottom-sheet-open {
    overflow: hidden;
}

/* 바텀시트 오버레이 활성화 상태 */
.overlay-active {
    opacity: 1;
}

/* 바텀시트 트리거 (PC 및 모바일용) */
.bottom-sheet-trigger {
    display: inline-block;
    width: 100%;
    padding: 10px 12px;
    background-color: var(--tertiary-background);
    color: var(--primary-text);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    text-align: left;
    cursor: pointer;
    position: relative;
    font-size: 14px;
    transition: all var(--transition-duration) ease;
}

.bottom-sheet-trigger:hover {
    background-color: var(--hover-background);
    border-color: var(--primary-brand);
    box-shadow: var(--shadow-sm);
}

.bottom-sheet-trigger::after {
    content: '';
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    width: 0;
    height: 0;
    border-left: 5px solid transparent;
    border-right: 5px solid transparent;
    border-top: 5px solid var(--secondary-text);
    transition: border-color var(--transition-duration);
}

.bottom-sheet-trigger:hover::after {
    border-top-color: var(--primary-brand);
}

/* 호버용 바닐라 툴팁 */
.vanilla-tooltip {
    position: absolute;
    /* 글래스모피즘 배경 */
    background: rgba(30, 41, 59, 0.9);
    color: var(--primary-text);
    padding: var(--spacing-sm) var(--spacing-md);
    border-radius: var(--border-radius);
    font-size: var(--font-size-md);
    z-index: 10003;
    max-width: var(--tooltip-max-width);
    word-wrap: break-word;
    box-shadow: var(--glass-shadow);
    opacity: 0;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    pointer-events: none;
    border: 1px solid var(--glass-border);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
}

.vanilla-tooltip.show {
    opacity: 1;
}

/* ===== 추가 툴팁 관련 스타일 (tooltip.css에서 통합) ===== */
/* 툴팁 컨테이너 스타일 */
.tooltip-container {
    position: relative;
    display: inline-block;
    cursor: pointer;
}

/* 툴팁 트리거 스타일 */
.tooltip-trigger {
    cursor: pointer;
    color: var(--primary-brand);
    transition: all var(--transition-duration) ease;
}

.tooltip-trigger:hover {
    color: var(--secondary-brand);
    text-shadow: 0 0 10px var(--brand-light);
}

/* 가격 정보 링크 스타일 */
.price-info-link, .price-info-link:hover, .price-info-link:focus, .price-info-link:active, .price-info-link:visited {
    color: var(--secondary-text) !important;
    text-decoration: none !important;
    transition: none !important;
}

/* 물음표 아이콘 스타일 - 사이드바 버튼과 동일한 크기 */
.question-icon:not(.tooltip-icon-unified) {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    background-color: var(--tertiary-background);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    color: var(--secondary-text);
    font-size: 14px;
    margin-left: 8px;
    cursor: pointer;
    transition: all var(--transition-duration) ease;
}

.question-icon:not(.tooltip-icon-unified):hover {
    background-color: var(--hover-background);
    color: var(--primary-text);
    border-color: var(--primary-brand);
    box-shadow: var(--shadow-sm);
}

/* 레거시 스타일 - 더 이상 사용하지 않음 */
.price-info-link .question-icon, .price-info-link:hover .question-icon, .price-info-link:focus .question-icon, .price-info-link:active .question-icon {
    color: var(--secondary-text) !important;
    background-color: var(--tertiary-background) !important;
    transition: none !important;
}

/* 구분선 스타일 */
.separator {
    display: inline;
    margin: 0 8px;
    color: var(--secondary-text);
    white-space: normal;
}

/* info-links 섹션 스타일 */
.info-links {
    margin-bottom: 20px;
}

.info-links p {
    display: block;
    white-space: normal;
    line-height: 1.6;
}

.info-links a,
.info-links span {
    display: inline;
    white-space: normal;
}

/* 정보 링크 텍스트 스타일 */
.info-link-text {
    color: var(--secondary-text);
    font-size: var(--font-size-md);
}

/* 마진 스타일 */
.margin-bottom-20 {
    margin-bottom: 20px;
}

/* ===== 유틸리티 클래스 ===== */
/* 텍스트 정렬 */
.text-center { text-align: center; }

/* 여백 */
.mt-2 { margin-top: var(--spacing-sm); }
.mb-3 { margin-bottom: var(--spacing-md); }

/* 플렉스 */
.d-flex { display: flex; }
.justify-content-end { justify-content: flex-end; }
.gap-3 { gap: var(--spacing-md); }

/* select 요소 항상 숨김 - PC 및 모바일 모두 적용 */
select {
  display: none;
}

/* 레이아웃 조정 클래스 */
.width-full {
    width: 100% !important;
}

.width-auto {
    width: auto !important;
}

.display-none {
    display: none !important;
}

.display-block {
    display: block !important;
}

.display-flex {
    display: flex !important;
}

.flex-grow {
    flex: 1 !important;
}

/* 텍스트 스타일 클래스 */
.text-bold {
    font-weight: bold !important;
}

/* z-index 스타일 클래스 */
.z-index-10 {
    z-index: 10 !important;
}

.z-index-20 {
    z-index: 20 !important;
}

.z-index-30 {
    z-index: 30 !important;
}

/* ===== 반응형 스타일 ===== */
@media (max-width: 991px) {
  :root {
    --container-padding: 0 1rem;
  }
  
  .chart-container {
    height: 300px;
  }
  
}

@media (max-width: 768px) {
  /* 태블릿 크기 화면에 대한 최적화 */
  .custom-select-wrapper {
    display: none; /* PC용 커스텀 셀렉트 숨김 */
  }
  
  
  /* 랭킹 페이지 모바일 최적화 */
  .rank-page-container {
    padding: 15px; /* 페이지 전체 컨테이너 패딩 조정 */
  }
  
  .container {
    padding: 15px; /* 컨테이너 내부 패딩 조정 */
    margin-bottom: 20px; /* 컨테이너 간 마진 조정 */
  }
  
  h1 {
    font-size: 1.6rem; /* 제목 폰트 크기 조정 */
    margin-bottom: 20px;
    padding-bottom: 12px;
  }

  h2 {
    font-size: 1.4rem;
  }

  h3 {
    font-size: 1.2rem;
  }
  
  .form-container {
    flex-direction: column;
    gap: 6px; /* 폼 그룹 간 간격 더 축소 */
  }
  
  .form-group {
    min-width: 100%;
    flex: 0 1 auto; /* flex-basis를 auto로 설정하여 내용에 따라 높이 결정 */
  }

  label {
    font-size: 0.9rem; /* 라벨 폰트 크기 원복 */
    margin-bottom: 4px; /* 라벨 하단 마진 축소 */
  }

  select, input[type="number"], input[type="text"], .bottom-sheet-trigger {
    padding: 10px 12px; /* 입력 필드 패딩 축소 */
    font-size: 0.95rem; /* 입력 필드 폰트 크기 약간 축소 */
  }
  
  .checkbox-container {
    margin-top: 6px; /* 체크박스 컨테이너 상단 마진 축소 */
    padding: 4px 0; /* 체크박스 컨테이너 내부 패딩 축소 */
  }

  button[type="submit"] {
    width: 100%;
    padding: 12px 20px; /* 버튼 패딩 축소 */
    margin-top: 8px; /* 버튼 상단 마진 축소 */
    font-size: 1rem; /* 버튼 폰트 크기 원복 */
  }
  
  .tabs {
    justify-content: flex-start;
    overflow-x: auto;
    padding: 0 5px 8px 5px; /* 탭 컨테이너 좌우 패딩 추가, 하단 패딩 유지 */
    margin-left: -5px; /* 좌우 패딩으로 인한 어긋남 보정 */
    margin-right: -5px;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none; /* Firefox */
    -ms-overflow-style: none; /* IE and Edge */
  }
  
  .tabs::-webkit-scrollbar {
    display: none; /* Chrome, Safari, Opera */
  }
  
  .tab {
    padding: 10px 15px; /* 탭 패딩 조정 */
    font-size: 0.9rem; 
    flex: 0 0 auto;
    margin-right: 5px; /* 탭 간 간격 살짝 추가 */
  }

  .tab:last-child {
    margin-right: 0;
  }
  
  table {
    font-size: 0.85rem; /* 테이블 폰트 크기 미세 조정 */
  }
  
  th, td {
    padding: 12px 10px; /* 테이블 셀 패딩 조정 */
    word-break: break-word; /* 긴 텍스트 줄바꿈 */
  }

  td a {
    font-size: 0.85rem; /* 링크 폰트 크기 조정 */
  }
  
  /* 정렬 콤보박스 모바일 스타일 */
  .sort-control-select {
    padding: 10px 12px;
    font-size: 0.9rem;
  }
  
  /* 랭킹 페이지 체크박스 라벨 모바일 스타일 */
  .checkbox-container label {
    font-size: 0.95rem; /* 체크박스 라벨 폰트 크기 조정 */
  }
  
  .header-content {
    flex-direction: column;
    align-items: flex-start;
  }

  .logo {
    margin-bottom: 15px;
  }

  .tab-button {
    padding: 8px 12px;
    font-size: 0.9rem;
  }

  .chart-and-legend-container {
    flex-direction: column;
    align-items: center;
    max-width: none;
  }

  .chart-container {
    min-height: 400px;
    max-height: 60vh;
    width: 100%;
    max-width: none;
    padding: 15px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin: 0 auto 15px auto;
  }

  .chart-container canvas {
    margin: 0 auto;
    display: block;
  }

  .chart-container:hover {
    box-shadow: var(--shadow-lg);
    transform: translateY(0);
  }

  .tab1-controls {
    flex-direction: column;
    align-items: flex-start;
  }

  .tab1-controls form {
    margin-top: 15px;
  }

  .filter-buttons {
    flex-direction: column;
    gap: 5px;
  }

  .filter-buttons form {
    flex-direction: column;
    gap: 5px;
  }

  #chart-tooltip {
    max-width: 80vw;
    font-size: 12px;
    padding: 10px 14px;
    z-index: 10000;
    box-shadow: var(--shadow-xl);
    border-radius: 10px;
    text-align: center;
    left: 50% !important;
    transform: translateX(-50%) !important;
    top: 30% !important;
    width: auto !important;
  }
  
  #chart-tooltip strong {
    font-size: 14px;
    margin-bottom: 6px;
    display: block;
  }
  
  table {
    display: block;
    overflow-x: auto;
    white-space: nowrap;
    -webkit-overflow-scrolling: touch;
  }

  html {
    font-size: 15px;
  }
  
  /* 모바일 헤더 조정 */
  .site-header {
    height: 60px;
    padding: 0;
    width: 100%;
    margin: 0;
    max-width: 100%;
    box-sizing: border-box;
  }
  
  .site-logo {
    margin-left: var(--spacing-sm);
  }
  
  .header-right {
    margin-right: var(--spacing-sm);
  }
  
  .main-nav {
    display: none;
  }
  
  .mobile-menu-toggle {
    display: flex !important;
  }
  
  .mobile-menu-container {
    top: 60px;
    height: calc(100vh - 60px);
    width: 100%;
  }
  
  .header-button {
    width: 36px;
    height: 36px;
  }
  
  .chart-container {
    height: 250px;
    padding: var(--spacing-sm);
  }
  

  .tooltip .tooltip-text {
    width: 220px;
    margin-left: -110px;
    font-size: 0.85rem;
    padding: 10px;
  }
}

@media (max-width: 575px) {
  html {
    font-size: 14px;
  }
  
  .card {
    padding: var(--spacing-md);
  }
  
  .chart-container {
    height: 200px;
  }
  

  .tooltip .tooltip-text {
    width: 200px;
    margin-left: -100px;
    font-size: 0.8rem;
  }
}

/* 모바일 480px 이하에서의 랭킹 페이지 스타일 */
@media (max-width: 480px) {
  .rank-page-container {
    padding: 10px;
  }

  .container {
    padding: 10px;
    margin-bottom: 15px;
    border-radius: 6px;
  }

  .form-container {
    gap: 5px; /* 480px 이하에서 간격 더 축소 */
  }
  
  h1 {
    font-size: 1.4rem; /* 제목 폰트 크기 조정 */
    margin-bottom: 15px;
    padding-bottom: 10px;
  }
  
  h2 {
    font-size: 1.25rem;
  }

  h3 {
    font-size: 1.1rem;
  }

  label {
    font-size: 0.85rem; /* 라벨 폰트 크기 더 축소 */
    margin-bottom: 3px; /* 라벨 하단 마진 더 축소 */
  }

  select, input[type="number"], input[type="text"], .bottom-sheet-trigger {
    padding: 9px 10px; /* 입력 필드 패딩 더 축소 */
    font-size: 0.9rem; /* 입력 필드 폰트 크기 더 축소 */
  }

  .checkbox-container {
    margin-top: 5px; /* 체크박스 컨테이너 상단 마진 더 축소 */
    padding: 3px 0; /* 체크박스 컨테이너 내부 패딩 더 축소 */
  }
  
  .checkbox-container label {
    font-size: 0.85rem; /* 체크박스 라벨 폰트 크기 조정 */
  }

  button[type="submit"] {
    padding: 10px 16px; /* 버튼 패딩 더 축소 */
    font-size: 0.95rem; /* 버튼 폰트 크기 약간 축소 */
    margin-top: 6px; /* 버튼 상단 마진 축소 */
  }
  
  .tab {
    padding: 9px 12px; /* 탭 패딩 조정 */
    font-size: 0.85rem; /* 탭 폰트 크기 조정 */
  }
  
  th, td {
    padding: 10px 8px; /* 테이블 셀 패딩 조정 */
    font-size: 0.8rem; /* 테이블 폰트 크기 조정 */
  }
  
  .badge {
    padding: 4px 7px; /* 배지 패딩 조정 */
    font-size: 0.75rem; /* 배지 폰트 크기 조정 */
    min-width: 55px;
  }
  
  /* 정렬 콤보박스 모바일 스타일 (더 작은 화면) */
  .sort-control-select {
    padding: 9px 10px;
    font-size: 0.85rem;
  }
}

@media (max-width: 480px) {
  /* 작은 모바일 화면에 대한 추가 최적화 */
  .chart-container {
    padding: 0;
    min-height: 350px;
    max-height: 50vh;
    margin-bottom: 15px;
    border-radius: 8px;
  }
  
  .chart-container canvas {
    touch-action: auto;
    height: auto !important;
    width: 100% !important;
    max-width: 100%;
    pointer-events: auto;
  }
  
  h1 {
    font-size: 1.5rem;
    margin-top: 1rem;
    margin-bottom: 0.8rem;
  }
  
  h2 {
    font-size: 1.2rem;
    margin-top: 1rem;
    margin-bottom: 0.8rem;
  }
  
  table {
    font-size: 0.9rem;
  }
  
  th, td {
    padding: 8px 10px;
  }
  
  .tab-container {
    display: flex;
    overflow-x: visible;
    white-space: normal;
    flex-wrap: wrap;
    margin: 15px 0;
    padding-bottom: 5px;
  }
  
  .tab-button {
    flex: 0 0 auto;
    font-size: 0.85rem;
    padding: 6px 10px;
  }
  
  .card {
    padding: 15px;
    margin-bottom: 15px;
    border-radius: 8px;
  }
  
  #chart-tooltip {
    max-width: 90vw;
    padding: 12px 16px;
    font-size: 13px;
  }
}

@media (max-width: 896px) and (orientation: landscape) {
  /* 모바일 가로 모드 최적화 */
  .chart-and-legend-container {
    flex-direction: row;
  }

  .chart-container {
    min-height: 300px;
    max-height: 70vh;
  }
  
  .tab-content {
    padding: 15px;
  }
  
  .filter-buttons {
    flex-direction: row;
    flex-wrap: wrap;
    gap: 5px;
  }
  
  .filter-buttons form {
    flex-direction: row;
    flex-wrap: wrap;
    gap: 5px;
  }
  
  th, td {
    padding: 6px 8px;
    font-size: 0.85rem;
  }
}

