:root {
    --primary-color: #3f51b5;
    --primary-hover: #303f9f;
    --bg-color: #f8f9fa;
    --card-bg: #ffffff;
    --text-color: #2c3e50;
    --border-radius: 12px;
    --shadow: 0 8px 30px rgba(0,0,0,0.08);
}

body {
    font-family: 'Roboto', 'Segoe UI', sans-serif;
    background-color: var(--bg-color);
    color: var(--text-color);
    margin: 0;
    padding: 20px;
    display: flex;
    justify-content: center;
    min-height: 100vh;
    box-sizing: border-box;
}

.container {
    width: 100%;
    max-width: 1400px;
    background: transparent;
    display: flex;
    flex-direction: column;
    gap: 40px; /* <--- 这里改成了 40px，拉大整体垂直间距 */
}

header {
    text-align: center;
    background: var(--card-bg);
    padding: 20px;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
}

header h1 {
    margin: 0;
    color: var(--primary-color);
    font-weight: 500;
}

header p {
    margin: 5px 0 0;
    color: #7f8c8d;
}

/* Controls Section */
.controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 20px;
    padding: 20px 40px;
    background: var(--card-bg);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    flex-wrap: wrap;
    margin-bottom: 10px; /* <--- 额外增加一点底部边距 */
    position: relative; 
    z-index: 10; /* 确保控制栏在层级上高于下方的结果区 */
}

.upload-box {
    flex: 1;
    min-width: 300px;
    border: 2px dashed #cbd5e0;
    padding: 20px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    text-align: center;
    background: #fdfdfd;
    color: #718096;
}

.upload-box:hover {
    border-color: var(--primary-color);
    background: #eff6ff;
    color: var(--primary-color);
}

.model-selector {
    display: flex;
    align-items: center;
    gap: 10px;
}

select {
    padding: 10px 15px;
    border-radius: 6px;
    border: 1px solid #cbd5e0;
    font-size: 15px;
    background: white;
    min-width: 150px;
}

button {
    padding: 12px 35px;
    background-color: var(--primary-color);
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 16px;
    font-weight: 500;
    cursor: pointer;
    transition: background-color 0.3s, transform 0.1s;
    box-shadow: 0 4px 6px rgba(63, 81, 181, 0.3);
}

button:disabled {
    background-color: #a0aec0;
    box-shadow: none;
    cursor: not-allowed;
}

button:not(:disabled):hover {
    background-color: var(--primary-hover);
    transform: translateY(-1px);
}

/* --- 布局核心优化 --- */
.results-area {
    display: flex;
    gap: 20px;
    /* 设定高度为视窗的 65%，保证一屏能看完 */
    height: 65vh; 
    min-height: 500px;
}

.result-column {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

/* 左侧占比略大 */
.result-left {
    flex: 1.2; 
}

/* 右侧占比略小 */
.result-right {
    flex: 1; 
}

.image-card {
    background: var(--card-bg);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    padding: 15px;
    display: flex;
    flex-direction: column;
    /* 让卡片自动填满列的高度 */
    flex: 1; 
    min-height: 0; 
    transition: transform 0.2s;
}

.image-card:hover {
    transform: translateY(-2px); /* 鼠标悬停微动效果 */
}

.image-card h3 {
    margin: 0 0 10px 0;
    font-size: 16px;
    font-weight: 600;
    color: #4a5568;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 2px solid #f1f1f1;
    padding-bottom: 8px;
}

.img-container {
    /* 去掉深灰色背景，改用白色 */
    background: #fff; 
    /* 加上一个很淡的边框 */
    border: 1px solid #f0f0f0; 
    border-radius: 8px;
    width: 100%;
    flex: 1; /* 填满卡片剩余高度 */
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden;
    position: relative;
}

img {
    width: 100%;
    height: 100%;
    /* 关键：保持比例，留白部分显示背景色(白色) */
    object-fit: contain; 
}

.loader {
    border: 4px solid #f3f3f3;
    border-top: 4px solid var(--primary-color);
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
    position: absolute;
    z-index: 10;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

footer {
    text-align: center;
    margin-top: 10px;
    color: #a0aec0;
    font-size: 13px;
}

/* 响应式：屏幕变窄时改为上下堆叠 */
@media (max-width: 900px) {
    .results-area {
        flex-direction: column;
        height: auto;
    }
    .image-card {
        height: 400px; /* 移动端给固定高度 */
    }
}
