@import url('https://fonts.googleapis.com/css2?family=Noto+Sans+KR:wght@400;500;600;700&display=swap');

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --sidebar-width: 260px;
    --sidebar-bg: #1a1f2e;
    --sidebar-hover: #252b3d;
    --sidebar-active: #2d3548;
    --primary-color: #5b9bd5;
    --primary-dark: #4a89c8;
    --accent-color: #70ad47;
    --text-primary: #1a1a1a;
    --text-secondary: #666;
    --bg-main: #f0f2f5;
    --card-bg: #ffffff;
    --border-color: #eee;
}

body {
    font-family: 'Noto Sans KR', 'Pretendard', 'Malgun Gothic', sans-serif;
    background-color: var(--bg-main);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
}

/* ===== 앱 레이아웃 ===== */
.app-layout {
    display: flex;
    min-height: 100vh;
}

/* ===== 사이드바 ===== */
.sidebar {
    width: var(--sidebar-width);
    background: var(--sidebar-bg);
    color: #fff;
    display: flex;
    flex-direction: column;
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    z-index: 100;
    box-shadow: 4px 0 20px rgba(0, 0, 0, 0.15);
}

.sidebar-header {
    padding: 24px 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.logo {
    display: flex;
    align-items: center;
    gap: 12px;
}

.logo-icon {
    font-size: 1.8rem;
}

.logo-text {
    font-size: 1.2rem;
    font-weight: 700;
    letter-spacing: -0.5px;
    background: linear-gradient(135deg, #fff 0%, #b8d4f0 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.sidebar-nav {
    flex: 1;
    padding: 20px 12px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 18px;
    border-radius: 12px;
    color: rgba(255, 255, 255, 0.7);
    text-decoration: none;
    font-weight: 500;
    font-size: 0.95rem;
    transition: all 0.2s ease;
    cursor: pointer;
}

.nav-item:hover {
    background: var(--sidebar-hover);
    color: #fff;
}

.nav-item.active {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-dark) 100%);
    color: #fff;
    box-shadow: 0 4px 15px rgba(91, 155, 213, 0.3);
}

.nav-icon {
    font-size: 1.3rem;
    width: 28px;
    text-align: center;
}

.nav-text {
    letter-spacing: -0.3px;
}

.sidebar-footer {
    padding: 20px;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.version-info {
    font-size: 0.8rem;
    color: rgba(255, 255, 255, 0.4);
    text-align: center;
}

/* ===== 메인 콘텐츠 ===== */
.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    min-height: 100vh;
}

/* ===== 페이지 ===== */
.page {
    display: none;
    animation: fadeIn 0.3s ease;
}

.page.active {
    display: block;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 40px 20px;
}

/* Header */
header {
    text-align: center;
    margin-bottom: 40px;
}

header h1 {
    font-size: 2.2rem;
    color: #1a1a1a;
    margin-bottom: 10px;
    letter-spacing: -0.5px;
}

header p {
    color: #666;
    font-size: 1.1rem;
}

/* Main Layout */
main {
    background: white;
    border-radius: 20px;
    padding: 40px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.05);
}

/* Input Section */
.input-section {
    margin-bottom: 16px;
    padding-bottom: 10px;
    border-bottom: 1px solid #eee;
}

.input-section h2 {
    font-size: 1.4rem;
    margin-bottom: 24px;
    color: #1a1a1a;
}

#analysisForm {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    align-items: flex-end;
}

.form-group {
    position: relative;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #444;
    font-size: 0.95rem;
}

.form-group input,
.form-group select {
    width: 100%;
    padding: 12px;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 1rem;
    transition: all 0.2s;
    background-color: #fff;
    height: 48px;
}

.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: #5b9bd5;
    box-shadow: 0 0 0 3px rgba(91, 155, 213, 0.1);
}

/* Experiment Description Box */
.exp-description-box {
    margin-top: 10px;
    padding-top: 8px;
    font-size: 1.05rem;
    color: #888;
    font-weight: 500;
    background: transparent;
    border-top: 1px solid #f0f0f0;
    width: 100%;
}

/* Buttons */
.btn-primary {
    background: #546e7a;
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    height: 48px;
    box-shadow: 0 2px 6px rgba(84, 110, 122, 0.2);
}

.btn-primary:hover {
    background: #455a64;
    box-shadow: 0 3px 8px rgba(84, 110, 122, 0.3);
    transform: translateY(-1px);
}

.btn-primary:disabled {
    background: #ccc;
    cursor: not-allowed;
    box-shadow: none;
    transform: none;
}

.btn-secondary {
    background: #f0f2f5;
    color: #333;
    border: 1px solid #ddd;
    padding: 10px 20px;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-secondary:hover {
    background: #e4e6eb;
}

/* Loading */
.loading {
    text-align: center;
    padding: 60px 0;
}

.spinner {
    border: 3px solid #f3f3f3;
    border-top: 3px solid #546e7a;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
    margin: 0 auto 20px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Token Section */
.token-section {
    margin-top: 0;
    margin-bottom: 20px;
    padding-bottom: 20px;
    border-bottom: 2px solid #f0f0f0;
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.section-header h2 {
    font-size: 1.4rem;
    color: #1a1a1a;
    margin: 0;
}

.section-header-badges {
    display: flex;
    align-items: center;
    gap: 10px;
}

.success-rate-badge {
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 0.9rem;
    font-weight: 600;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.success-rate-badge.success-high {
    background: linear-gradient(135deg, #4caf50 0%, #388e3c 100%);
    color: white;
    box-shadow: 0 2px 8px rgba(76, 175, 80, 0.3);
}

.success-rate-badge.success-medium {
    background: linear-gradient(135deg, #ff9800 0%, #f57c00 100%);
    color: white;
    box-shadow: 0 2px 8px rgba(255, 152, 0, 0.3);
}

.success-rate-badge.success-low {
    background: linear-gradient(135deg, #f44336 0%, #d32f2f 100%);
    color: white;
    box-shadow: 0 2px 8px rgba(244, 67, 54, 0.3);
}

.model-name {
    background: linear-gradient(135deg, #26a69a 0%, #00897b 100%);
    color: white;
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 0.9rem;
    font-weight: 600;
    box-shadow: 0 2px 8px rgba(38, 166, 154, 0.3);
}

.token-section h2 {
    font-size: 1.4rem;
    margin-bottom: 12px;
    color: #1a1a1a;
}

.token-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
}

.token-card {
    padding: 12px 16px;
    border-radius: 12px;
    color: white;
    transition: transform 0.2s;
    display: flex;
    align-items: center;
    gap: 8px;
}

.token-card:hover {
    transform: translateY(-2px);
}

.token-card.input {
    background: linear-gradient(135deg, #5c6bc0 0%, #3f51b5 100%);
    box-shadow: 0 2px 8px rgba(38, 166, 154, 0.15);
}

.token-card.input:hover {
    box-shadow: 0 4px 12px rgba(38, 166, 154, 0.25);
}

.token-card.output {
    background: linear-gradient(135deg, #5c6bc0 0%, #3f51b5 100%);
    box-shadow: 0 2px 8px rgba(92, 107, 192, 0.15);
}

.token-card.output:hover {
    box-shadow: 0 4px 12px rgba(92, 107, 192, 0.25);
}

.token-card.time {
    background: linear-gradient(135deg, #9575cd 0%, #7e57c2 100%);
    box-shadow: 0 2px 8px rgba(149, 117, 205, 0.15);
}

.token-card.time:hover {
    box-shadow: 0 4px 12px rgba(149, 117, 205, 0.25);
}

.token-card.cost {
    background: linear-gradient(135deg, #70ad47 0%, #5a9138 100%);
    box-shadow: 0 2px 8px rgba(112, 173, 71, 0.15);
}

.token-card.cost:hover {
    box-shadow: 0 4px 12px rgba(112, 173, 71, 0.25);
}

.token-icon {
    font-size: 1.3rem;
    flex-shrink: 0;
}

.token-label {
    font-size: 0.9rem;
    opacity: 0.9;
    font-weight: 500;
    flex-shrink: 0;
}

.token-value {
    font-size: 1.1rem;
    font-weight: 700;
    margin-left: auto;
    text-align: right;
}

.cost-sub {
    display: block;
    font-size: 0.8rem;
    font-weight: 500;
    opacity: 0.85;
    margin-top: 2px;
}

/* Stats Section */
.stats-section {
    margin-bottom: 40px;
}

.stats-section h2 {
    margin-bottom: 8px;
}

.max-pairs-info {
    color: #666;
    font-size: 0.95rem;
    margin-bottom: 20px;
    padding-left: 2px;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 16px;
    margin-bottom: 50px;
}

.stat-card {
    background: #f8f9fa;
    padding: 20px;
    border-radius: 12px;
    text-align: center;
    border: 1px solid #eee;
    transition: all 0.2s;
    cursor: pointer;
    position: relative;
}

.stat-card:hover {
    transform: translateY(-2px);
    border-color: #5b9bd5;
    box-shadow: 0 4px 12px rgba(91, 155, 213, 0.15);
}

.stat-card.active {
    background: #5b9bd5;
    color: white;
    border-color: #5b9bd5;
    box-shadow: 0 4px 15px rgba(91, 155, 213, 0.3);
    transform: translateY(-2px);
}

.stat-card.active .threshold {
    color: rgba(255, 255, 255, 0.8);
}

.stat-card.active .count {
    color: white;
}

.stat-card .threshold {
    font-size: 0.95rem;
    color: #666;
    margin-bottom: 10px;
    line-height: 1.4;
}

.stat-card .count {
    font-size: 2rem;
    font-weight: 700;
    color: #333;
}

.stat-card .percentage {
    font-size: 0.9rem;
    color: #888;
    margin-top: 4px;
}

.stat-card.active .percentage {
    color: rgba(255, 255, 255, 0.75);
}

/* Threshold Input */
.threshold-input {
    background: white;
    padding: 30px;
    border-radius: 16px;
    margin-top: 30px;
    border: 1px solid #eef2f6;
    box-shadow: 0 4px 20px rgba(0,0,0,0.03);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0;
}

.threshold-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    margin-bottom: 16px;
}

.threshold-input label {
    font-size: 1.1rem;
    font-weight: 700;
    color: #333;
    margin-bottom: 0;
    white-space: nowrap;
}

.input-group {
    display: flex;
    align-items: center;
    background: #f8f9fa;
    border: 2px solid #e9ecef;
    border-radius: 12px;
    padding: 6px;
    transition: all 0.2s;
    width: 100%;
    max-width: 360px;
}

.input-group:focus-within {
    border-color: #5b9bd5;
    box-shadow: 0 0 0 4px rgba(91, 155, 213, 0.1);
    background: white;
}

.input-group input {
    border: none !important;
    background: transparent !important;
    padding: 10px 20px;
    font-size: 1.2rem;
    font-weight: 700;
    color: #333;
    width: 100%;
    outline: none !important;
    box-shadow: none !important;
    height: auto;
}

.input-group button {
    background: #546e7a;
    color: white;
    border: none;
    padding: 10px 24px;
    border-radius: 8px;
    font-weight: 600;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
    box-shadow: 0 2px 8px rgba(84, 110, 122, 0.2);
    margin: 0;
}

.input-group button:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(84, 110, 122, 0.3);
    background: #455a64;
}

/* Range Input Group */
.range-input-group {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    justify-content: center;
}

.range-input-group input {
    width: 100px;
    padding: 12px 16px;
    border: 2px solid #e9ecef;
    border-radius: 10px;
    font-size: 1.1rem;
    font-weight: 600;
    text-align: center;
    background: #f8f9fa;
    transition: all 0.2s;
}

.range-input-group input:focus {
    outline: none;
    border-color: #5b9bd5;
    background: white;
    box-shadow: 0 0 0 4px rgba(91, 155, 213, 0.1);
}

.range-separator {
    font-size: 1rem;
    font-weight: 600;
    color: #555;
    white-space: nowrap;
}

.range-input-group button {
    background: #546e7a;
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 10px;
    font-weight: 600;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.2s;
    box-shadow: 0 2px 8px rgba(84, 110, 122, 0.2);
}

.range-input-group button:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(84, 110, 122, 0.3);
    background: #455a64;
}

/* 전체 문항 보기 버튼 */
.btn-all {
    background: linear-gradient(135deg, #5b9bd5 0%, #4a89c8 100%);
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 8px;
    font-weight: 600;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.2s;
    box-shadow: 0 2px 6px rgba(91, 155, 213, 0.25);
    white-space: nowrap;
}

.btn-all:hover {
    transform: translateY(-1px);
    box-shadow: 0 3px 10px rgba(91, 155, 213, 0.35);
    background: linear-gradient(135deg, #4a89c8 0%, #3a79b8 100%);
}

/* Results Section */
.results-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 2px solid #f0f0f0;
    flex-wrap: wrap;
    gap: 12px;
}

.results-header p {
    font-weight: 600;
    font-size: 1.1rem;
}

/* 정렬 버튼 */
.sort-buttons {
    display: flex;
    align-items: center;
    gap: 8px;
}

.sort-label {
    font-size: 0.9rem;
    color: #666;
    font-weight: 500;
}

.sort-btn {
    background: #f0f2f5;
    color: #555;
    border: 1px solid #ddd;
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.sort-btn:hover {
    background: #e4e6eb;
    border-color: #ccc;
}

.sort-btn.active {
    background: #546e7a;
    color: white;
    border-color: #546e7a;
}

.results-list {
    display: grid;
    gap: 16px;
}

/* Result Item */
.result-item {
    background: white;
    border: 1px solid #eee;
    border-radius: 12px;
    padding: 24px;
    cursor: pointer;
    transition: all 0.2s;
    position: relative;
    overflow: hidden;
}

.result-item:hover {
    border-color: #5b9bd5;
    box-shadow: 0 4px 12px rgba(91, 155, 213, 0.1);
    transform: translateY(-2px);
}

.result-item::before {
    content: "클릭하여 상세 보기";
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(0,0,0,0.7);
    color: white;
    padding: 8px 16px;
    border-radius: 20px;
    opacity: 0;
    transition: opacity 0.2s;
    pointer-events: none;
    font-size: 0.9rem;
    z-index: 10;
}

.result-item:hover::before {
    opacity: 1;
}

.result-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

.result-title {
    font-weight: 600;
    font-size: 1.1rem;
    color: #1a1a1a;
}

.similarity-badge {
    background: #ebf8ff;
    color: #0063cc;
    padding: 6px 12px;
    border-radius: 20px;
    font-weight: 700;
    font-size: 0.9rem;
}

/* Modal Styling */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    backdrop-filter: blur(4px);
}

.modal.hidden {
    display: none;
}

.modal-content {
    background: white;
    width: 90%;
    max-width: 1100px;
    height: 85vh;
    border-radius: 20px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.3);
    display: flex;
    flex-direction: column;
    animation: slideUp 0.3s ease-out;
}

@keyframes slideUp {
    from { transform: translateY(50px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

.modal-header {
    padding: 20px 30px;
    border-bottom: 1px solid #eee;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h2 {
    font-size: 1.4rem;
    color: #1a1a1a;
}

.close-btn {
    background: none;
    border: none;
    font-size: 2rem;
    line-height: 1;
    cursor: pointer;
    color: #999;
    padding: 0 10px;
}

.close-btn:hover {
    color: #333;
}

.modal-body {
    flex: 1;
    overflow-y: auto;
    padding: 30px;
    background: #f8f9fa;
}

/* Comparison Layout */
.comparison-container {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    gap: 20px;
    height: 100%;
}

.comparison-divider {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}

.comparison-divider .similarity-score {
    background: #5b9bd5;
    color: white;
    padding: 8px 16px;
    border-radius: 20px;
    font-weight: bold;
    font-size: 1.1rem;
}

.question-card {
    background: white;
    border-radius: 16px;
    padding: 24px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
    border: 1px solid #eee;
    display: flex;
    flex-direction: column;
}

.q-header {
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid #f0f0f0;
}

.q-header .badge {
    background: #f0f2f5;
    color: #555;
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 0.85rem;
    font-weight: 600;
}

.q-prompt {
    font-size: 1.1rem;
    font-weight: 600;
    color: #222;
    margin-bottom: 20px;
    line-height: 1.6;
}

.q-choices {
    list-style: none;
    padding: 0;
}

.q-choices li {
    padding: 10px 14px;
    margin-bottom: 8px;
    background: #fbfbfb;
    border: 1px solid #eee;
    border-radius: 8px;
    font-size: 0.95rem;
    color: #444;
    position: relative;
}

.q-choices li.correct-answer {
    background: #ffebee;
    border: 2px solid #ef5350;
    color: #c62828;
    font-weight: 600;
}

.q-choices li .checkbox {
    display: inline-block;
    width: 18px;
    height: 18px;
    line-height: 18px;
    text-align: center;
    background: #ef5350;
    color: white;
    border-radius: 4px;
    margin-right: 6px;
    font-size: 0.85rem;
    font-weight: bold;
    vertical-align: middle;
}

.prompt-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.prompt-box {
    background: #f8f9fa;
    padding: 16px;
    border-radius: 8px;
    font-size: 0.95rem;
}

.prompt-label {
    font-size: 0.8rem;
    color: #666;
    margin-bottom: 6px;
    font-weight: 600;
}

.prompt-text {
    white-space: pre-wrap;
    word-break: break-all;
}

footer {
    text-align: center;
    margin-top: 40px;
    color: #888;
    font-size: 0.9rem;
}

.hidden {
    display: none !important;
}

/* ===== 랭킹 페이지 스타일 ===== */
.ranking-tabs {
    display: flex;
    gap: 12px;
    margin-bottom: 30px;
    padding: 8px;
    background: #f8f9fa;
    border-radius: 16px;
}

.ranking-tab {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 16px 24px;
    background: transparent;
    border: none;
    border-radius: 12px;
    font-size: 1rem;
    font-weight: 600;
    color: #666;
    cursor: pointer;
    transition: all 0.2s ease;
}

.ranking-tab:hover {
    background: rgba(255, 255, 255, 0.8);
    color: #333;
}

.ranking-tab.active {
    background: white;
    color: var(--primary-color);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.08);
}

.tab-icon {
    font-size: 1.4rem;
}

.ranking-content {
    position: relative;
}

.ranking-area {
    display: none;
    animation: fadeIn 0.3s ease;
}

.ranking-area.active {
    display: block;
}

.area-header {
    margin-bottom: 24px;
    padding-bottom: 16px;
    border-bottom: 2px solid #f0f0f0;
}

.area-header h2 {
    font-size: 1.5rem;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.area-description {
    color: var(--text-secondary);
    font-size: 0.95rem;
}

.ranking-list {
    min-height: 300px;
}

.ranking-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 20px;
    background: #fafbfc;
    border-radius: 16px;
    border: 2px dashed #e0e0e0;
}

.placeholder-icon {
    font-size: 3rem;
    margin-bottom: 16px;
    opacity: 0.5;
}

.ranking-placeholder p {
    color: #888;
    font-size: 1.1rem;
    font-weight: 500;
}

/* ===== 반응형 ===== */
@media (max-width: 1024px) {
    .sidebar {
        width: 80px;
    }
    
    .sidebar-header {
        padding: 20px 10px;
    }
    
    .logo-text {
        display: none;
    }
    
    .logo-icon {
        font-size: 1.6rem;
    }
    
    .nav-item {
        padding: 14px;
        justify-content: center;
    }
    
    .nav-text {
        display: none;
    }
    
    .nav-icon {
        width: auto;
    }
    
    .version-info {
        font-size: 0.7rem;
    }
    
    .main-content {
        margin-left: 80px;
    }
}

@media (max-width: 768px) {
    .sidebar {
        width: 100%;
        height: auto;
        position: fixed;
        top: auto;
        bottom: 0;
        flex-direction: row;
        padding: 0;
    }
    
    .sidebar-header,
    .sidebar-footer {
        display: none;
    }
    
    .sidebar-nav {
        flex-direction: row;
        padding: 8px 12px;
        width: 100%;
        justify-content: space-around;
    }
    
    .nav-item {
        flex-direction: column;
        gap: 4px;
        padding: 10px 16px;
    }
    
    .nav-text {
        display: block;
        font-size: 0.75rem;
    }
    
    .nav-icon {
        font-size: 1.2rem;
    }
    
    .main-content {
        margin-left: 0;
        margin-bottom: 80px;
    }
    
    .comparison-container {
        grid-template-columns: 1fr;
        gap: 30px;
    }
    
    .modal-content {
        height: 95vh;
    }
    
    .prompt-container {
        grid-template-columns: 1fr;
    }
    
    .threshold-input {
        flex-direction: column;
        padding: 20px;
    }
    
    .input-group {
        max-width: 100%;
    }
    
    .token-grid {
        gap: 8px;
    }
    
    .token-card {
        padding: 10px 12px;
        gap: 6px;
    }
    
    .token-icon {
        font-size: 1.1rem;
    }
    
    .token-label {
        font-size: 0.8rem;
    }
    
    .token-value {
        font-size: 0.95rem;
    }
    
    .ranking-tabs {
        flex-direction: column;
        gap: 8px;
    }
    
    .ranking-tab {
        padding: 14px 20px;
    }
    
    .ranking-table-wrapper {
        overflow-x: auto;
    }
    
    .ranking-table th,
    .ranking-table td {
        padding: 10px 8px;
        font-size: 0.85rem;
    }
    
    .ranking-sort-controls {
        flex-wrap: wrap;
    }
}

/* ===== 순위 테이블 스타일 ===== */
.ranking-sort-controls {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 20px;
    padding: 16px 20px;
    background: #f8f9fa;
    border-radius: 12px;
}

.sort-control-label {
    font-weight: 600;
    color: #555;
    font-size: 0.9rem;
}

.sort-select {
    padding: 8px 16px;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 500;
    background: white;
    cursor: pointer;
    min-width: 140px;
}

.sort-select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(91, 155, 213, 0.1);
}

.sort-direction-btns {
    display: flex;
    gap: 4px;
}

.sort-dir-btn {
    width: 36px;
    height: 36px;
    border: 1px solid #ddd;
    border-radius: 8px;
    background: white;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.sort-dir-btn:hover {
    background: #f0f2f5;
    border-color: #ccc;
}

.sort-dir-btn.active {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

.ranking-table-wrapper {
    overflow-x: auto;
    border-radius: 12px;
    border: 1px solid #e0e0e0;
}

.ranking-table {
    width: 100%;
    border-collapse: collapse;
    background: white;
    min-width: 800px;
}

.ranking-table thead {
    background: linear-gradient(135deg, #37474f 0%, #263238 100%);
    color: white;
}

.ranking-table th {
    padding: 14px 16px;
    text-align: center;
    font-weight: 600;
    font-size: 0.9rem;
    white-space: nowrap;
}

.ranking-table th:first-child {
    border-radius: 12px 0 0 0;
}

.ranking-table th:last-child {
    border-radius: 0 12px 0 0;
}

.ranking-table tbody tr {
    border-bottom: 1px solid #eee;
    transition: all 0.15s;
}

.ranking-table tbody tr:last-child {
    border-bottom: none;
}

.ranking-table tbody tr:hover {
    background: #f8fbff;
}

.ranking-table td {
    padding: 14px 16px;
    font-size: 0.95rem;
    color: #333;
    text-align: center;
}

.ranking-table .info-id-link {
    color: var(--primary-color);
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.2s;
}

.ranking-table .info-id-link:hover {
    color: var(--primary-dark);
    text-decoration: underline;
}

.ranking-table .exp-badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 6px;
    font-weight: 600;
    font-size: 0.85rem;
}

/* 실험별 색상 구분 */
.ranking-table .exp-badge.exp-1 {
    background: #e3f2fd;
    color: #1565c0;
}

.ranking-table .exp-badge.exp-2 {
    background: #fce4ec;
    color: #c2185b;
}

.ranking-table .exp-badge.exp-3 {
    background: #e8f5e9;
    color: #2e7d32;
}

.ranking-table .exp-badge.exp-4 {
    background: #fff3e0;
    color: #e65100;
}

.ranking-table .exp-badge.exp-5 {
    background: #f3e5f5;
    color: #7b1fa2;
}

.ranking-table .question-count {
    font-weight: 600;
    color: #555;
}

.ranking-table .time-value {
    color: #546e7a;
    font-weight: 500;
}

.ranking-table .cost-value {
    color: #2e7d32;
    font-weight: 600;
}

.ranking-table .cost-dollar {
    color: #888;
    font-size: 0.85rem;
    font-weight: 400;
}

.ranking-table .similarity-value {
    font-weight: 700;
    padding: 4px 8px;
    border-radius: 4px;
}

/* 0-30%: 초록색 (좋음) */
.ranking-table .similarity-good {
    color: #1b5e20;
    background: #e8f5e9;
}

/* 31-79%: 주황색 (경고) */
.ranking-table .similarity-warning {
    color: #e65100;
    background: #fff3e0;
}

/* 80-100%: 빨간색 (나쁨) - 더 진한 빨강으로 구분 */
.ranking-table .similarity-bad {
    color: #fff;
    background: #b71c1c;
}

.ranking-table .similarity-na {
    color: #999;
    font-style: italic;
    background: transparent;
}

/* 성공률 테이블 스타일 */
.ranking-table .success-rate-value {
    font-weight: 700;
}

.ranking-table .success-rate-value.success-high {
    color: #2e7d32;
}

.ranking-table .success-rate-value.success-medium {
    color: #f57c00;
}

.ranking-table .success-rate-value.success-low {
    color: #c62828;
}

.ranking-table .success-rate-value.success-na {
    color: #999;
    font-style: italic;
}

.ranking-table .model-badge {
    display: inline-block;
    padding: 4px 10px;
    background: linear-gradient(135deg, #26a69a 0%, #00897b 100%);
    color: white;
    border-radius: 12px;
    font-size: 0.8rem;
    font-weight: 500;
}

/* 순위 표시 (1위, 2위, 3위 메달) */
.ranking-table .rank-medal {
    font-size: 1.2rem;
    margin-right: 4px;
}

.ranking-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 20px;
    background: #fafbfc;
    border-radius: 16px;
    border: 2px dashed #e0e0e0;
}

.placeholder-icon {
    font-size: 3rem;
    margin-bottom: 16px;
    opacity: 0.5;
}

.ranking-placeholder p {
    color: #888;
    font-size: 1.1rem;
    font-weight: 500;
}

/* ===== 선지 비교 페이지 스타일 ===== */
.answer-tabs {
    display: flex;
    gap: 12px;
    margin-bottom: 30px;
    padding: 8px;
    background: #f8f9fa;
    border-radius: 16px;
}

.answer-tab {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 16px 24px;
    background: transparent;
    border: none;
    border-radius: 12px;
    font-size: 1rem;
    font-weight: 600;
    color: #666;
    cursor: pointer;
    transition: all 0.2s ease;
}

.answer-tab:hover {
    background: rgba(255, 255, 255, 0.8);
    color: #333;
}

.answer-tab.active {
    background: white;
    color: var(--primary-color);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.08);
}

.answer-content {
    position: relative;
}

.answer-area {
    display: none;
    animation: fadeIn 0.3s ease;
}

.answer-area.active {
    display: block;
}

.answer-list {
    min-height: 300px;
}

/* 실험 카드 */
.answer-exp-card {
    background: white;
    border: 1px solid #e0e0e0;
    border-radius: 16px;
    margin-bottom: 20px;
    overflow: hidden;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.04);
}

.answer-exp-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 24px;
    background: linear-gradient(135deg, #37474f 0%, #263238 100%);
    color: white;
}

.answer-exp-id {
    font-weight: 700;
    font-size: 1.1rem;
}

.answer-status {
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 600;
}

.answer-status.status-warning {
    background: #fff3e0;
    color: #e65100;
}

.answer-status.status-good {
    background: #e8f5e9;
    color: #2e7d32;
}

.answer-status.status-info {
    background: #e3f2fd;
    color: #1565c0;
}

/* 선지 쌍 리스트 */
.answer-pairs-list {
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.answer-pair-item {
    background: #fafbfc;
    border: 1px solid #eee;
    border-radius: 12px;
    padding: 16px;
    transition: all 0.2s;
}

.answer-pair-item:hover {
    border-color: var(--primary-color);
    box-shadow: 0 4px 12px rgba(91, 155, 213, 0.1);
}

.answer-pair-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 14px;
    padding-bottom: 12px;
    border-bottom: 1px solid #eee;
}

.pair-title {
    font-weight: 700;
    font-size: 1rem;
    color: #333;
}

.pair-badges {
    display: flex;
    gap: 8px;
}

.sim-badge {
    padding: 4px 12px;
    border-radius: 16px;
    font-size: 0.85rem;
    font-weight: 600;
}

.sim-badge.question-sim {
    background: #e3f2fd;
    color: #1565c0;
}

.sim-badge.answer-sim {
    background: #fafafa;
    color: #666;
}

.sim-badge.answer-sim.sim-very-high {
    background: #ffebee;
    color: #c62828;
}

.sim-badge.answer-sim.sim-high {
    background: #fff3e0;
    color: #e65100;
}

.sim-badge.answer-sim.sim-medium {
    background: #fff8e1;
    color: #f9a825;
}

.sim-badge.answer-sim.sim-low {
    background: #e8f5e9;
    color: #2e7d32;
}

/* 정답 내용 박스 */
.answer-pair-content {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.answer-box {
    background: white;
    border: 1px solid #e0e0e0;
    border-radius: 10px;
    padding: 14px;
}

.answer-label {
    font-size: 0.85rem;
    color: #666;
    font-weight: 600;
    margin-bottom: 8px;
    padding-bottom: 8px;
    border-bottom: 1px dashed #eee;
}

.answer-text {
    font-size: 0.95rem;
    color: #333;
    line-height: 1.5;
    white-space: pre-wrap;
    word-break: break-word;
}

.loading-sub {
    font-size: 0.9rem;
    color: #aaa;
    margin-top: 8px;
}

/* 실험 선택 및 정렬 컨트롤 */
.answer-controls {
    display: flex;
    gap: 24px;
    padding: 16px 20px;
    background: #f8f9fa;
    border-radius: 12px;
    margin-bottom: 20px;
    align-items: center;
    flex-wrap: wrap;
}

.answer-controls .control-group {
    display: flex;
    align-items: center;
    gap: 10px;
}

.answer-controls label {
    font-weight: 600;
    color: #555;
    font-size: 0.9rem;
    white-space: nowrap;
}

.answer-controls .exp-select,
.answer-controls .sort-select-answer {
    padding: 10px 16px;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 0.95rem;
    font-weight: 500;
    background: white;
    cursor: pointer;
    min-width: 200px;
}

.answer-controls .sort-select-answer {
    min-width: 150px;
}

.answer-controls select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(91, 155, 213, 0.1);
}

/* 결과 카드 전체 래퍼 */
.answer-result-card {
    border: 1px solid #e0e0e0;
    border-radius: 12px;
    overflow: hidden;
    margin-bottom: 16px;
    background: white;
}

/* 결과 헤더 */
.answer-result-header {
    padding: 14px 20px;
    background: linear-gradient(135deg, #5b9bd5 0%, #4a89c8 100%);
    margin: 0;
}

.answer-result-header .result-title {
    font-weight: 700;
    font-size: 1.1rem;
    color: #ffffff;
}

/* 통계 바 */
.answer-stats-bar {
    display: flex;
    gap: 16px;
    padding: 16px 20px;
    background: #f5f7fa;
    border-bottom: 1px solid #e0e0e0;
}

.answer-stats-bar .stat-box {
    flex: 1;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    background: white;
    border-radius: 8px;
    border: 1px solid #e0e0e0;
}

.answer-stats-bar .stat-box .stat-label {
    font-size: 0.9rem;
    color: #555;
    font-weight: 500;
}

.answer-stats-bar .stat-box .stat-value {
    font-size: 1.1rem;
    font-weight: 700;
    color: #333;
}

.answer-stats-bar .stat-box .stat-percent {
    font-size: 0.85rem;
    font-weight: 500;
    color: #666;
}

.answer-stats-bar .stat-box.warning {
    background: #fff8e1;
    border-color: #ffca28;
}

.answer-stats-bar .stat-box.warning .stat-value {
    color: #e65100;
}

.answer-stats-bar .stat-box.safe {
    background: #e8f5e9;
    border-color: #81c784;
}

.answer-stats-bar .stat-box.safe .stat-value {
    color: #2e7d32;
}

/* 클릭 가능한 아이템 */
.answer-pair-item.clickable {
    cursor: pointer;
    position: relative;
}

.answer-pair-item.clickable:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(91, 155, 213, 0.15);
}

.answer-pair-item .click-hint {
    text-align: center;
    font-size: 0.85rem;
    color: #888;
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px dashed #eee;
    opacity: 0;
    transition: opacity 0.2s;
}

.answer-pair-item.clickable:hover .click-hint {
    opacity: 1;
}

/* 선지 비교 상세 모달 */
.answer-modal-content {
    max-width: 1200px;
}

.similarity-info-bar {
    display: flex;
    justify-content: center;
    gap: 40px;
    padding: 16px 24px;
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border-radius: 12px;
    margin-bottom: 24px;
}

.sim-info-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}

.sim-info-item .sim-info-label {
    font-size: 0.85rem;
    color: #666;
    font-weight: 500;
}

.sim-info-item .sim-info-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: #333;
}

.sim-info-item.highlight .sim-info-value {
    color: #5b9bd5;
    font-size: 1.8rem;
}

.vs-badge {
    background: #546e7a;
    color: white;
    padding: 10px 16px;
    border-radius: 50%;
    font-weight: 700;
    font-size: 0.9rem;
}

/* 선지 노트 */
.q-choices .choices-note {
    background: transparent;
    border: none;
    color: #999;
    font-style: italic;
    font-size: 0.85rem;
    padding: 8px 0;
}

/* 선지 비교 페이지 반응형 */
@media (max-width: 768px) {
    .answer-tabs {
        flex-direction: column;
        gap: 8px;
    }
    
    .answer-tab {
        padding: 14px 20px;
    }
    
    .answer-exp-header {
        flex-direction: column;
        gap: 10px;
        text-align: center;
    }
    
    .answer-pair-header {
        flex-direction: column;
        gap: 10px;
        align-items: flex-start;
    }
    
    .answer-pair-content {
        grid-template-columns: 1fr;
    }
    
    .answer-controls {
        flex-direction: column;
        gap: 12px;
        align-items: stretch;
    }
    
    .answer-controls .control-group {
        flex-direction: column;
        align-items: flex-start;
        gap: 6px;
    }
    
    .answer-controls .exp-select,
    .answer-controls .sort-select-answer {
        width: 100%;
        min-width: unset;
    }
    
    .similarity-info-bar {
        flex-direction: column;
        gap: 16px;
    }
    
    .answer-stats-bar {
        flex-direction: column;
        gap: 10px;
    }
    
    .answer-stats-bar .stat-box {
        flex-direction: column;
        align-items: flex-start;
        gap: 6px;
    }
}