:root {
    --bg: #f5f6f8;
    --surface: #fff;
    --primary: #2C4977;
    --primary-hover: #1e3460;
    --text: #142e48;
    --text-secondary: #6b7d8e;
    --border: #e2e7ed;
    --shadow: 0 2px 12px rgba(0,0,0,0.06);
    --radius: 10px;
    --radius-sm: 6px;
    --success: #22c55e;
    --warning: #f59e0b;
    --danger: #ef4444;
    --font: 'Segoe UI','PingFang SC','Microsoft YaHei','Helvetica Neue',sans-serif;
}

* { margin:0; padding:0; box-sizing:border-box; }

body {
    font-family: var(--font);
    color: var(--text);
    min-height: 100vh;
    background: #000;
    position: relative;
}

/* 轮播背景 */
#carouselBackground {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    z-index: -1;
}
#carouselBackground .slide {
    position: absolute;
    top: 0; left: 0; width: 100%; height: 100%;
    background-size: 100% 100%;
    background-position: center;
    background-repeat: no-repeat;
    image-rendering: auto;
    opacity: 0;
    transition: opacity 1s ease-in-out;
}
#carouselBackground .slide.active {
    opacity: 1;
}

/* 欢迎覆盖层 */
#welcomeOverlay {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    transition: opacity 0.6s ease, visibility 0.6s;
}
#welcomeOverlay.fade-out {
    opacity: 0;
    visibility: hidden;
}

/* 粒子Canvas */
#particleCanvas {
    position: absolute;
    top: 0; left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 0;
}

.welcome-box {
    margin: 50px 50px 50px 50px;
    border: 5px solid transparent;
    border-radius: 40px;
    width: calc(100% - 100px);
    height: calc(100% - 100px);
    background: transparent;
    padding: 60px 40px;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    color: #7A6B47;
    position: relative;
    z-index: 1;
}

/* 用伪元素绘制渐变边框，同时支持圆角 */
.welcome-box::before {
    content: '';
    position: absolute;
    top: -5px; left: -5px; right: -5px; bottom: -5px;
    border-radius: 40px;
    background: rgba(255, 255, 255, 0.5);
    backdrop-filter: blur(8px);
    z-index: -1;
    -webkit-mask:
        linear-gradient(#fff 0 0) content-box,
        linear-gradient(#fff 0 0);
    mask:
        linear-gradient(#fff 0 0) content-box,
        linear-gradient(#fff 0 0);
    -webkit-mask-composite: xor;
    mask-composite: exclude;
    padding: 5px;
}

.welcome-img {
    max-width: 80%;
    height: auto;
    margin-bottom: 20px;
    transition: transform 0.1s;
}
.welcome-img:hover {
    transform: translateY(-2px);
}

.welcome-desc {
    font-size: 1.5rem;
    color: #000;
    margin-bottom: 32px;
    line-height: 1.6;
    font-family: 'KaiTi', '楷体', 'STKaiti', serif;
}

.welcome-btn {
    background: #306055;
    color: #D5C9B0;
    border: 2px solid rgba(255, 255, 255, 0.7);
    border-radius: 50px;
    padding: 8px 40px;
    font-size: 1.5rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.3s, transform 0.1s;
}
.welcome-btn:hover {
    background: #1f4d41;
    transform: translateY(-2px);
}

/* 主内容层 */
#appOverlay {
    position: relative;
    z-index: 1;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* 导航栏 */
.navbar {
    background: rgba(255,255,255,0.6);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid rgba(255,255,255,0.3);
    padding: 0 20px;
    height: 56px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    box-shadow: 0 2px 12px rgba(0,0,0,0.1);
    position: sticky;
    top: 0;
    z-index: 100;
    flex-wrap: wrap;
}
.navbar .logo {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--primary);
    white-space: nowrap;
}
.navbar .logo .icon {
    width: 32px; height: 32px;
    background: var(--primary);
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 1rem;
}
.logo-text { display: inline; }
.nav-actions {
    display: flex;
    gap: 8px;
    align-items: center;
    flex-wrap: wrap;
}
.nav-actions select {
    padding: 6px 10px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    font-size: 0.85rem;
    font-family: var(--font);
    background: rgba(255,255,255,0.7);
    backdrop-filter: blur(8px);
    cursor: pointer;
    min-width: 160px;
    color: var(--text);
}
.nav-actions .btn { padding: 6px 12px; font-size: 0.85rem; }

@media (max-width: 700px) {
    .navbar {
        height: auto;
        padding: 10px 15px;
    }
    .logo-text { display: none; }
    .nav-actions {
        width: 100%;
        justify-content: space-between;
        margin-top: 8px;
    }
    .nav-actions select {
        min-width: 120px;
        flex: 1;
    }
    .nav-actions .btn {
        font-size: 0.8rem;
        padding: 6px 10px;
    }
}

/* 主内容区 */
.main-container {
    flex: 1;
    padding: 24px 20px;
    width: 100%;
    max-width: 1400px;
    margin: 0 auto;
}

/* 数据集内容纵向排列，卡片独占一行 */
.dataset-content {
    display: flex;
    flex-direction: column;
    gap: 20px;
}
.dataset-content > .card {
    width: 100%;
}

/* 卡片玻璃效果 */
.glass-card {
    background: rgba(255,255,255,0.65) !important;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255,255,255,0.4) !important;
    box-shadow: 0 4px 16px rgba(0,0,0,0.1) !important;
    display: flex;
    flex-direction: column;
    border-radius: var(--radius);
    overflow: hidden;
    margin: 0;
}
.card-header {
    padding: 16px 20px;
    border-bottom: 1px solid rgba(255,255,255,0.3);
    font-weight: 700;
    font-size: 0.95rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: rgba(255,255,255,0.3);
}
.card-body { padding: 20px; flex: 1; }
.card-body.no-padding { padding: 0; }

/* 去除分析结果卡片的宽度限制 */
#analysisResultCard,
.results-area .card {
    width: 100% !important;
    max-width: none !important;
}

/* 按钮磨砂效果 */
.btn {
    background: rgba(255,255,255,0.75);
    backdrop-filter: blur(8px);
    border: 1px solid rgba(255,255,255,0.7);
    color: var(--text);
    transition: 0.2s;
    border-radius: var(--radius-sm);
    padding: 9px 18px;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    font-family: var(--font);
    display: inline-flex;
    align-items: center;
    gap: 6px;
    white-space: nowrap;
}
.btn:hover {
    background: rgba(255,255,255,0.9);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}
.btn:disabled {
    opacity: 0.55;
    cursor: not-allowed;
    transform: none !important;
}

.btn-primary { background: var(--primary); color: #fff; border-color: var(--primary); }
.btn-primary:hover:not(:disabled) { background: var(--primary-hover); }
.btn-outline { background: transparent; border: 1.5px solid rgba(255,255,255,0.6); }
.btn-ghost { background: transparent; border: 1.5px solid transparent; }
.btn-ghost:hover { background: rgba(255,255,255,0.3); }
.btn-warning { background: rgba(245,158,11,0.8); color: #fff; border-color: rgba(245,158,11,0.8); }
.btn-warning:hover:not(:disabled) { background: rgba(245,158,11,0.95); }
.btn-success { background: rgba(34,197,94,0.8); color: #fff; border-color: rgba(34,197,94,0.8); }
.btn-success:hover:not(:disabled) { background: rgba(34,197,94,0.95); }
.btn-save { background: rgba(9,132,227,0.8); color: #fff; border-color: rgba(9,132,227,0.8); }
.btn-save:hover:not(:disabled) { background: rgba(9,132,227,0.95); }
.btn-sm { padding: 4px 10px; font-size: 0.8rem; }
.btn-block { width: 100%; justify-content: center; }

/* 操作行 */
.action-row {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

/* 表格 */
.table-wrapper {
    overflow-x: auto;
    max-height: 400px;
    overflow-y: auto;
}
table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
    margin: 0 auto;
}
table th, table td {
    padding: 6px 12px;
    font-weight: 700;
    text-align: center;                  /* 改为居中 */
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
}
table th {
    background: #f8f9fb;
    font-weight: 700;
    color: var(--text-secondary);
    position: sticky;
    top: 0;
    text-transform: uppercase;
    font-size: 0.8rem;
}
table td {
    font-weight: 700;
}
table tbody tr:hover { background: #f8faff; }

.badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
}
.badge-ready { background: #dcfce7; color: #166534; }
.badge-info { background: #dbeafe; color: #1e40af; }

/* 空状态 */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-secondary);
    display: flex;
    flex-direction: column;
    align-items: center;
}
.empty-state .icon-big { font-size: 4rem; margin-bottom: 16px; }
.empty-state h2 { color: var(--text); margin-bottom: 8px; }
.empty-state p { margin-bottom: 20px; font-size: 0.9rem; }
.hint-text { font-size: 0.78rem; color: #999; margin-top: 12px; line-height: 1.6; }

.loading-text, .placeholder-text {
    color: var(--text-secondary);
    text-align: center;
    padding: 30px;
}

/* 维度 Tab */
.dimension-tabs {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 20px;
    border-bottom: 2px solid rgba(255,255,255,0.3);
    padding-bottom: 10px;
}
.tab-btn {
    padding: 8px 16px;
    border: none;
    background: rgba(255,255,255,0.3);
    backdrop-filter: blur(5px);
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-secondary);
    cursor: pointer;
    border-radius: 6px 6px 0 0;
    transition: 0.2s;
}
.tab-btn.active {
    color: var(--primary);
    background: rgba(44, 73, 119, 0.15);
    border-bottom: 2px solid var(--primary);
}
.tab-btn:hover { color: var(--primary); }

/* 指标卡片 */
.metrics-row {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 24px;
}
.metric-card {
    background: rgba(255,255,255,0.5);
    backdrop-filter: blur(5px);
    border: 1px solid rgba(255,255,255,0.4);
    border-radius: var(--radius-sm);
    padding: 16px;
    min-width: 150px;
    text-align: center;
    flex: 1 1 auto;
}
.metric-card .metric-label { font-size:0.85rem; color:var(--text-secondary); margin-bottom:4px; }
.metric-card .metric-value { font-size:1.8rem; font-weight:700; color: var(--primary); }
.metric-card .metric-desc { font-size:0.75rem; color:#999; margin-top:4px; }

/* 图表容器 */
.chart-container { margin-bottom: 30px; }
.chart-title { font-size:1rem; font-weight:600; margin-bottom:8px; }
.chart-desc { font-size:0.8rem; color:var(--text-secondary); margin-top:6px; }
.chart-box {
    background: rgba(255,255,255,0.4);
    backdrop-filter: blur(3px);
    border: 1px solid rgba(255,255,255,0.3);
    border-radius: var(--radius-sm);
    width: 100%;
    height: 300px;
}
@media (max-width: 700px) {
    .chart-box {
        height: 220px;
    }
}

/* 模态框 */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.45);
    z-index: 200;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.2s ease;
}
@keyframes fadeIn { from { opacity:0; } to { opacity:1; } }
.modal {
    background: rgba(255,255,255,0.65);
    backdrop-filter: blur(15px);
    border-radius: var(--radius);
    box-shadow: 0 20px 60px rgba(0,0,0,0.2);
    width: 90%;
    max-width: 600px;
    max-height: 85vh;
    overflow-y: auto;
    animation: slideUp 0.25s ease;
}
@keyframes slideUp { from { transform:translateY(30px); opacity:0; } to { transform:translateY(0); opacity:1; } }
.modal-header {
    padding: 18px 22px;
    border-bottom: 1px solid rgba(255,255,255,0.3);
    display: flex;
    justify-content: space-between;
    font-weight: 700;
    background: rgba(255,255,255,0.65);
    border-radius: var(--radius) var(--radius) 0 0;
}
.modal-close {
    width: 32px; height: 32px;
    border-radius: 50%;
    border: none;
    background: transparent;
    cursor: pointer;
    font-size: 1.2rem;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
}
.modal-close:hover { background: rgba(255,255,255,0.5); color: var(--text); }
.modal-body { padding: 20px 22px; }
.upload-option-row {
    display: flex;
    gap: 10px;
    margin-bottom: 14px;
}
.upload-option-row label {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.9rem;
    padding: 10px 16px;
    border-radius: var(--radius-sm);
    border: 2px solid rgba(255,255,255,0.6);
    flex: 1;
    justify-content: center;
    font-weight: 600;
    cursor: pointer;
    transition: 0.2s;
    background: rgba(255,255,255,0.4);
}
.upload-option-row label:has(input:checked) {
    border-color: var(--primary);
    background: rgba(44, 73, 119, 0.2);
    color: var(--primary);
}
.file-list {
    list-style: none;
    margin: 10px 0;
    max-height: 200px;
    overflow-y: auto;
}
.file-list li {
    padding: 8px 10px;
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
    display: flex;
    align-items: center;
    gap: 8px;
    border-bottom: 1px solid rgba(255,255,255,0.3);
}
.progress-bar-wrap {
    background: rgba(255,255,255,0.5);
    border-radius: 10px;
    height: 8px;
    margin: 10px 0;
    overflow: hidden;
}
.progress-bar-fill {
    height: 100%;
    background: var(--primary);
    border-radius: 10px;
    transition: width 0.3s ease;
    width: 0%;
}
.progress-text {
    font-size: 0.8rem;
    color: var(--text-secondary);
    text-align: center;
}
.modal-actions {
    display: flex;
    gap: 10px;
    margin-top: 12px;
}
.modal-actions button { flex: 1; justify-content: center; }

/* Toast */
.toast {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 300;
    background: #1f2937;
    color: #fff;
    padding: 12px 20px;
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
    box-shadow: 0 8px 24px rgba(0,0,0,0.25);
    animation: slideIn 0.3s ease;
    max-width: 420px;
}
@keyframes slideIn { from { transform: translateX(120%); opacity:0; } to { transform: translateX(0); opacity:1; } }
.toast.error { border-left: 4px solid var(--danger); }
.toast.success { border-left: 4px solid var(--success); }