/* @charset "UTF-8"; */
/* 修复微信浏览器样式被拦截 */

/* 移动端兼容性修复版 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-box-sizing: border-box; /* iOS 兼容 */
    font-family: 'Segoe UI', 'PingFang SC', 'Microsoft YaHei', sans-serif;
    -webkit-text-size-adjust: 100%; /* 禁止字体自动缩放 */
    -webkit-tap-highlight-color: transparent; /* 去除点击高亮 */
}

body {
    background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
    min-height: 100vh;
    width: 100%;
    overflow-x: hidden; /* 防止横向滚动 */
    display: flex;
    justify-content: center;
    align-items: flex-start; /* 改为顶部对齐 */
    padding: 0; /* 移除左右padding */
    -webkit-overflow-scrolling: touch; /* iOS 滚动顺滑 */
}

/* 主容器 - 改为百分比宽度 */
.survey-container {
    width: 100%;
    max-width: 100vw; /* 改为视口宽度 */
    background: white;
    border-radius: 0; /* 手机上去除圆角节省空间 */
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    overflow: hidden;
    min-height: 100vh; /* 填满屏幕 */
    position: relative;
}

/* 进度条 */
.progress-container {
    background: #f8f9fa;
    padding: 12px 20px; /* 减少padding */
    border-bottom: 1px solid #e9ecef;
    position: sticky; /* 固定顶部 */
    top: 0;
    z-index: 100;
}

.progress-bar {
    height: 4px; /* 更细 */
    background: #e9ecef;
    border-radius: 2px;
    overflow: hidden;
    margin-bottom: 6px;
}

.progress-bar::after {
    content: '';
    display: block;
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, #4facfe 0%, #00f2fe 100%);
    transition: width 0.5s ease;
    border-radius: 2px;
}

.progress-text {
    text-align: right;
    color: #6c757d;
    font-size: 12px; /* 更小字号 */
    font-weight: 500;
}

/* 标题区 */
.survey-header {
    padding: 20px 15px; /* 减少padding */
    text-align: center;
    background: linear-gradient(120deg, #a1c4fd 0%, #c2e9fb 100%);
    color: white;
}

#surveyTitle {
    font-size: 1.4rem; /* 使用rem单位 */
    margin-bottom: 8px;
    font-weight: 700;
    line-height: 1.3;
    padding: 0 10px;
}

#surveySubtitle {
    font-size: 0.9rem; /* 使用rem单位 */
    opacity: 0.9;
    padding: 0 10px;
}

/* 问题区域 - 关键修复 */
.question-area {
    padding: 20px 15px; /* 减少padding */
    min-height: calc(100vh - 180px); /* 动态高度 */
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
}

.question-container {
    margin-bottom: 20px;
    width: 100%;
}

.question-number {
    display: inline-block;
    background: #4facfe;
    color: white;
    width: 32px; /* 更小 */
    height: 32px;
    line-height: 32px;
    text-align: center;
    border-radius: 50%;
    font-weight: bold;
    margin-bottom: 12px;
    font-size: 16px;
}

.question-text {
    font-size: 1.2rem; /* 使用rem单位 */
    font-weight: 600;
    color: #343a40;
    margin-bottom: 20px;
    line-height: 1.4;
    word-break: break-word; /* 长单词换行 */
}

/* 选项容器 */
.options-container {
    display: flex;
    flex-direction: column;
    gap: 10px; /* 更小间距 */
    width: 100%;
}

/* 单选/多选选项样式 */
.option-item {
    padding: 16px 15px; /* 减少padding */
    background: #f8f9fa;
    border: 1.5px solid #e9ecef; /* 更细边框 */
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.2s ease;
    display: -webkit-box; /* 兼容前缀 */
    display: -webkit-flex;
    display: flex;
    -webkit-box-align: center;
    -webkit-align-items: center;
    align-items: center;
    font-size: 1rem; /* 使用rem单位 */
    color: #495057;
    width: 100%;
    -webkit-tap-highlight-color: transparent;
}

.option-item:hover {
    background: #e9ecef;
}

.option-item:active {
    transform: scale(0.98); /* 点击反馈 */
    background: #e9ecef;
}

.option-item.selected {
    background: #e3f2fd;
    border-color: #4facfe;
    color: #4facfe;
    font-weight: 500;
}

.option-letter {
    display: -webkit-inline-box;
    display: -webkit-inline-flex;
    display: inline-flex;
    -webkit-box-align: center;
    -webkit-align-items: center;
    align-items: center;
    -webkit-box-pack: center;
    -webkit-justify-content: center;
    justify-content: center;
    width: 26px; /* 更小 */
    height: 26px;
    background: #dee2e6;
    color: #495057;
    border-radius: 50%;
    margin-right: 12px; /* 减少间距 */
    font-weight: bold;
    font-size: 13px;
    flex-shrink: 0; /* 防止压缩 */
}

.option-item.selected .option-letter {
    background: #4facfe;
    color: white;
}

.option-text {
    flex: 1;
    word-break: break-word; /* 选项文字换行 */
    line-height: 1.4;
}

/* 输入框样式 */
.answer-input {
    width: 100%;
    padding: 14px 16px;
    border: 1.5px solid #e9ecef; /* 更细边框 */
    border-radius: 10px;
    font-size: 1rem;
    transition: border-color 0.3s;
    resize: vertical;
    min-height: 100px; /* 更小高度 */
    font-family: inherit;
    -webkit-appearance: none; /* 移除iOS默认样式 */
    -moz-appearance: none;
    appearance: none;
}

.answer-input:focus {
    outline: none;
    border-color: #4facfe;
    box-shadow: 0 0 0 2px rgba(79, 172, 254, 0.1);
}

/* 导航菜单 */
.navigation-menu {
    padding: 15px; /* 减少padding */
    background: #f8f9fa;
    border-top: 1px solid #e9ecef; /* 更细边框 */
    display: -webkit-box;
    display: -webkit-flex;
    display: flex;
    -webkit-box-pack: justify;
    -webkit-justify-content: space-between;
    justify-content: space-between;
    -webkit-box-align: center;
    -webkit-align-items: center;
    align-items: center;
    position: sticky;
    bottom: 0;
    z-index: 100;
    width: 100%;
}

.nav-btn {
    padding: 10px 16px; /* 更小padding */
    background: #4facfe;
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 0.9rem; /* 更小字号 */
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    display: -webkit-inline-box;
    display: -webkit-inline-flex;
    display: inline-flex;
    -webkit-box-align: center;
    -webkit-align-items: center;
    align-items: center;
    gap: 6px; /* 更小间距 */
    white-space: nowrap;
    -webkit-tap-highlight-color: transparent;
}

.nav-btn:hover:not(:disabled) {
    background: #3a9cf5;
}

.nav-btn:active:not(:disabled) {
    transform: scale(0.95);
}

.nav-btn:disabled {
    background: #adb5bd;
    cursor: not-allowed;
    opacity: 0.6;
}

.nav-btn.secondary {
    background: #6c757d;
}

.nav-btn.secondary:hover {
    background: #5a6268;
}

.nav-center {
    display: -webkit-box;
    display: -webkit-flex;
    display: flex;
    gap: 8px;
}

/* 目录侧边栏 */
.sidebar {
    position: fixed;
    top: 0;
    right: -100%; /* 改为100% */
    width: 85%; /* 占屏幕85%宽度 */
    height: 100%;
    background: white;
    box-shadow: -5px 0 20px rgba(0, 0, 0, 0.15);
    transition: right 0.3s ease;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.sidebar.show {
    right: 0;
}

.sidebar-header {
    padding: 20px 15px;
    background: linear-gradient(120deg, #a1c4fd 0%, #c2e9fb 100%);
    color: white;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0;
}

.sidebar-header h3 {
    font-size: 1.1rem;
    font-weight: 600;
}

.close-btn {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    width: 34px;
    height: 34px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.3s;
    -webkit-tap-highlight-color: transparent;
}

.close-btn:active {
    background: rgba(255, 255, 255, 0.3);
}

.question-list {
    padding: 15px;
    overflow-y: auto;
    flex: 1;
    -webkit-overflow-scrolling: touch; /* iOS滚动顺滑 */
}

.question-list-item {
    padding: 12px 15px;
    margin-bottom: 8px;
    background: #f8f9fa;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s;
    border-left: 4px solid transparent;
    font-size: 0.9rem;
}

.question-list-item:active {
    background: #e9ecef;
    transform: translateX(-3px);
}

.question-list-item.current {
    background: #e3f2fd;
    border-left-color: #4facfe;
    font-weight: 500;
}

.question-list-item.answered {
    border-left-color: #20c997;
}

.question-list-index {
    font-weight: bold;
    color: #4facfe;
    margin-right: 8px;
    display: inline-block;
    min-width: 20px;
}

.sidebar-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 999;
    display: none;
    opacity: 0;
    transition: opacity 0.3s;
}

.sidebar-overlay.show {
    display: block;
    opacity: 1;
}

/* 完成页面样式 */
.completion-screen {
    text-align: center;
    padding: 40px 20px;
    width: 100%;
}

.completion-icon {
    width: 80px; /* 更小 */
    height: 80px;
    background: #4facfe;
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 25px;
    font-size: 36px;
}

.stats-container {
    background: #f8f9fa;
    padding: 20px 15px;
    border-radius: 10px;
    margin: 25px auto;
    max-width: 100%;
    width: 100%;
}

.stat-item {
    display: inline-block;
    margin: 0 15px; /* 减少间距 */
}

.stat-number {
    font-size: 1.8rem; /* 使用rem单位 */
    color: #4facfe;
    font-weight: bold;
    display: block;
    margin-bottom: 5px;
}

.stat-label {
    color: #6c757d;
    font-size: 0.85rem;
    display: block;
}

/* 特殊修复：iPhone 底部安全区域 */
@supports (padding-bottom: env(safe-area-inset-bottom)) {
    .navigation-menu {
        padding-bottom: calc(15px + env(safe-area-inset-bottom));
    }
}

/* 安卓 Chrome 特殊修复 */
@media screen and (-webkit-min-device-pixel-ratio: 0) {
    .survey-container {
        -webkit-transform: translateZ(0); /* 强制GPU加速 */
    }
}

/* 超小屏幕设备（iPhone SE等） */
@media (max-width: 375px) {
    .question-text {
        font-size: 1.1rem;
    }
    
    .option-item {
        padding: 14px 12px;
    }
    
    .nav-btn {
        padding: 8px 12px;
        font-size: 0.85rem;
    }
    
    .stat-item {
        margin: 0 10px;
    }
}

/* 横屏模式 */
@media (orientation: landscape) and (max-height: 600px) {
    .survey-header {
        padding: 15px;
    }
    
    .question-area {
        padding: 15px;
        min-height: calc(100vh - 150px);
    }
    
    .option-item {
        padding: 12px 15px;
    }
    
    .answer-input {
        min-height: 80px;
    }
}