/* ===== 全局重置 & 变量 ===== */
:root {
    --primary: #4a6fa5;
    --secondary: #6c63ff;
    --accent: #ff6584;
    --success: #28a745;
    --warning: #ffc107;
    --light-bg: #f8f9fa;
    --dark: #343a40;
    --gray: #adb5bd;
    --gradient-blue: linear-gradient(135deg, #4a6fa5 0%, #6c63ff 100%);
    --gradient-orange: linear-gradient(135deg, #ff9a3c 0%, #ff6b6b 100%);
    --card-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    --transition: all 0.2s ease;
    --radius: 12px;
}
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}
body {
    font-family: 'Segoe UI', 'Microsoft YaHei', sans-serif;
    background: #eef2f7;
    color: #1e293b;
    line-height: 1.4;
    padding: 12px;
    min-height: 100vh;
}
.container {
    max-width: 1100px;
    width: 100%;
    margin: 0 auto;
}

/* 头部 */
header {
    text-align: center;
    padding: 1.2rem 1rem;
    background: var(--gradient-blue);
    color: white;
    border-radius: var(--radius);
    margin-bottom: 1rem;
    box-shadow: var(--card-shadow);
}
h1 {
    font-size: 1.6rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    flex-wrap: wrap;
}
.subtitle {
    font-size: 0.9rem;
    opacity: 0.9;
}

/* 卡片通用 */
.info-box, .progress-container, .question-card, .result-card {
    background: white;
    border-radius: var(--radius);
    padding: 1.2rem;
    margin-bottom: 1rem;
    box-shadow: var(--card-shadow);
}
.info-box {
    border-left: 4px solid var(--primary);
}
.auto-next-hint {
    background: rgba(74, 111, 165, 0.08);
    padding: 0.6rem;
    border-radius: 10px;
    margin-top: 0.8rem;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.9rem;
}

/* 进度条 */
.progress-header {
    display: flex;
    justify-content: space-between;
    font-weight: 600;
    margin-bottom: 8px;
    font-size: 0.9rem;
}
.progress-bar-bg {
    height: 8px;
    background: #e2e8f0;
    border-radius: 10px;
}
.progress-bar {
    height: 100%;
    background: var(--gradient-blue);
    width: 0%;
    transition: width 0.3s;
    border-radius: 10px;
}

/* 问题卡片 */
.question-card {
    position: relative;
}
.question-number {
    position: absolute;
    top: -12px;
    left: 16px;
    background: var(--accent);
    color: white;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 1.1rem;
}
.question-title {
    font-size: 1.1rem;
    margin: 0.5rem 0 1.2rem;
    font-weight: 600;
    line-height: 1.4;
}
.options-container {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 1.2rem;
}
.option {
    padding: 10px 14px;
    border: 1px solid #e2e8f0;
    border-radius: 40px;
    cursor: pointer;
    transition: 0.2s;
    display: flex;
    align-items: center;
    gap: 10px;
    background: white;
}
.option:hover {
    border-color: var(--primary);
    background: #f1f5f9;
}
.option.selected {
    border-color: var(--secondary);
    background: rgba(108, 99, 255, 0.08);
}
.option-value {
    background: #e2e8f0;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 0.9rem;
}
.option.selected .option-value {
    background: var(--gradient-blue);
    color: white;
}

/* 按钮 */
.button-group {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}
button {
    padding: 10px 20px;
    border: none;
    border-radius: 40px;
    font-weight: 600;
    font-size: 0.9rem;
    cursor: pointer;
    background: #e2e8f0;
}
.btn-primary {
    background: var(--gradient-blue);
    color: white;
}
.btn-primary:hover:not(:disabled) {
    transform: translateY(-1px);
    filter: brightness(0.97);
}
.btn-secondary {
    background: #f1f5f9;
    border: 1px solid #cbd5e1;
}
.btn-accent {
    background: var(--gradient-orange);
    color: white;
}
button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* ===== 结果卡片 & 条状看板（重点修复） ===== */
.result-card {
    display: none;
    padding: 1rem;
    max-height: 90vh;
    overflow-y: auto;
}
.total-score {
    font-size: 1.3rem;
    font-weight: 800;
    text-align: center;
    background: #f1f5f9;
    padding: 0.6rem;
    border-radius: 40px;
    margin: 0.5rem 0;
}

/* 通用结果容器（双列布局） */
.result-container {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    margin: 15px 0;
}
.result-item {
    background: #f8fafc;
    border-radius: 12px;
    padding: 10px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}
.result-item-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 8px;
    font-weight: 600;
    font-size: 0.9rem;
}
.result-value {
    font-weight: 700;
    color: var(--primary);
}
/* 条状看板 - 关键样式 */
.result-bar-container {
    height: 10px;
    background: #e2e8f0;
    border-radius: 12px;
    overflow: hidden;
}
.result-bar {
    height: 100%;
    width: 0%;
    background: var(--gradient-blue);
    border-radius: 12px;
    transition: width 0.8s ease;
}

/* 雷达图（用于i.html） */
.radar-chart-container {
    max-width: 300px;
    height: 240px;
    margin: 0 auto 0.8rem auto;
}

/* 维度摘要卡片（可选） */
.dimension-summary {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: 6px;
    margin: 10px 0;
}
.dim-badge {
    flex: 1;
    text-align: center;
    background: #f8fafc;
    border-radius: 20px;
    padding: 6px 4px;
    font-size: 0.7rem;
    font-weight: 600;
}

/* 方面卡片（i.html专用） */
.facet-scroll-area {
    max-height: 280px;
    overflow-y: auto;
    margin: 8px 0;
    padding-right: 4px;
}
.facet-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
}
.facet-card {
    background: #f8fafc;
    padding: 8px;
    border-radius: 12px;
    border-left: 3px solid var(--primary);
    font-size: 0.8rem;
}
.facet-header {
    display: flex;
    justify-content: space-between;
    font-weight: 600;
    margin-bottom: 4px;
}
.facet-bar-container {
    height: 6px;
    background: #e2e8f0;
    border-radius: 6px;
    margin-top: 4px;
}
.facet-bar {
    height: 100%;
    width: 0%;
    background: var(--gradient-blue);
    border-radius: 6px;
    transition: width 0.6s ease;
}

/* 结果解释区域 */
.interpretation {
    background: #f0f9ff;
    padding: 0.8rem;
    border-radius: 12px;
    font-size: 0.85rem;
    margin-top: 10px;
    max-height: 120px;
    overflow-y: auto;
}

/* 水平指示器 (抑郁量表专用) */
.level-indicator {
    display: flex;
    justify-content: space-between;
    background: #f8f9fa;
    border-radius: 30px;
    padding: 6px;
    margin: 10px 0;
}
.level {
    text-align: center;
    font-size: 0.7rem;
    flex: 1;
}
.level-dot {
    width: 10px;
    height: 10px;
    background: #ccc;
    border-radius: 50%;
    margin: 0 auto 4px;
}
.level.active .level-dot {
    background: var(--primary);
}

/* 响应式：手机 & 800x600 屏幕优化 */
@media (max-width: 800px), (max-height: 650px) {
    body { padding: 8px; }
    h1 { font-size: 1.4rem; }
    .info-box, .progress-container, .question-card, .result-card { padding: 0.8rem; margin-bottom: 0.8rem; }
    .question-title { font-size: 1rem; }
    .option { padding: 8px 12px; }
    .option-value { width: 26px; height: 26px; font-size: 0.8rem; }
    button { padding: 8px 16px; font-size: 0.85rem; }
    .radar-chart-container { height: 200px; max-width: 260px; }
    .result-container { grid-template-columns: 1fr; gap: 8px; }  /* 小屏单列 */
    .facet-grid { grid-template-columns: 1fr; }
    .facet-scroll-area { max-height: 220px; }
    .interpretation { max-height: 100px; font-size: 0.8rem; }
    .total-score { font-size: 1.1rem; padding: 0.4rem; }
    .dim-badge { font-size: 0.65rem; }
    /* 条状看板在小屏上高度稍增，保持可见 */
    .result-bar-container { height: 8px; }
    .facet-bar-container { height: 5px; }
}

@media (max-width: 480px) {
    .button-group { flex-direction: column; }
    button { width: 100%; justify-content: center; }
    .facet-scroll-area { max-height: 200px; }
    .radar-chart-container { height: 180px; }
}