/* 通用样式 - 移动端优先 */
* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }
html, body { height: 100%; font-family: -apple-system, BlinkMacSystemFont, 'PingFang SC', 'Microsoft YaHei', sans-serif; background: #f5f7fa; color: #1f2937; -webkit-font-smoothing: antialiased; }
body { line-height: 1.6; font-size: 15px; }

.container { max-width: 640px; margin: 0 auto; padding: 20px 16px; min-height: 100vh; background: #fff; }
.page { padding-bottom: 100px; }

h1 { font-size: 22px; font-weight: 700; margin-bottom: 16px; color: #1e3a8a; }
h2 { font-size: 18px; font-weight: 600; margin: 20px 0 12px; color: #1f2937; }
h3 { font-size: 16px; font-weight: 600; margin: 16px 0 8px; }
p { margin-bottom: 12px; color: #4b5563; }

.btn { display: inline-block; padding: 14px 32px; background: #3b82f6; color: #fff; border: none; border-radius: 12px; font-size: 16px; font-weight: 600; cursor: pointer; transition: all 0.2s; text-decoration: none; text-align: center; min-width: 160px; }
.btn:hover { background: #2563eb; }
.btn:active { transform: scale(0.98); }
.btn:disabled { background: #d1d5db; cursor: not-allowed; }
.btn-block { display: block; width: 100%; }
.btn-outline { background: #fff; color: #3b82f6; border: 2px solid #3b82f6; }

.btn-bar { position: fixed; bottom: 0; left: 50%; transform: translateX(-50%); width: 100%; max-width: 640px; padding: 16px; background: #fff; border-top: 1px solid #e5e7eb; z-index: 100; }

.card { background: #fff; border-radius: 16px; padding: 16px; margin-bottom: 16px; box-shadow: 0 1px 3px rgba(0,0,0,0.05); border: 1px solid #f3f4f6; }
.card-info { background: linear-gradient(135deg, #dbeafe 0%, #e0e7ff 100%); border-color: #c7d2fe; }
.card-scenario { background: linear-gradient(135deg, #fef3c7 0%, #fce7f3 100%); border-color: #fbcfe8; padding: 20px; }

.form-group { margin-bottom: 20px; }
.form-label { display: block; font-weight: 600; margin-bottom: 8px; color: #1f2937; }
.form-input, .form-select { width: 100%; padding: 12px 14px; border: 2px solid #e5e7eb; border-radius: 10px; font-size: 15px; background: #fff; }
.form-input:focus, .form-select:focus { outline: none; border-color: #3b82f6; }

.radio-group { display: flex; flex-direction: column; gap: 8px; }
.radio-item { display: flex; align-items: center; padding: 12px; border: 2px solid #e5e7eb; border-radius: 10px; cursor: pointer; transition: all 0.2s; }
.radio-item input { margin-right: 10px; }
.radio-item:hover { border-color: #93c5fd; background: #eff6ff; }
.radio-item.checked { border-color: #3b82f6; background: #eff6ff; }

.scale { margin: 16px 0; padding: 12px 0; border-bottom: 1px solid #f3f4f6; }
.scale:last-child { border-bottom: none; }
.scale-question { font-size: 15px; margin-bottom: 12px; color: #1f2937; font-weight: 500; }
.scale-labels { display: flex; justify-content: space-between; font-size: 12px; color: #6b7280; margin-bottom: 8px; gap: 12px; }
.scale-options { display: flex; justify-content: space-between; gap: 4px; }
.scale-option { flex: 1; }
.scale-option input { display: none; }
.scale-option label { display: flex; align-items: center; justify-content: center; height: 40px; border: 2px solid #e5e7eb; border-radius: 8px; cursor: pointer; font-weight: 600; font-size: 13px; transition: all 0.15s; }
.scale-option input:checked + label { background: #3b82f6; color: #fff; border-color: #3b82f6; }
.scale-option label:hover { border-color: #93c5fd; }

.slider-wrap { padding: 12px 0; }
.slider-input { width: 100%; height: 8px; -webkit-appearance: none; background: #e5e7eb; border-radius: 4px; outline: none; }
.slider-input::-webkit-slider-thumb { -webkit-appearance: none; width: 28px; height: 28px; background: #3b82f6; border-radius: 50%; cursor: pointer; }
.slider-labels { display: flex; justify-content: space-between; margin-top: 8px; font-size: 13px; color: #6b7280; }
.slider-value { text-align: center; font-size: 18px; font-weight: 700; color: #3b82f6; margin-top: 12px; }

.countdown { text-align: center; padding: 16px; background: #fef3c7; border-radius: 10px; color: #92400e; font-weight: 600; margin: 16px 0; }

.progress { height: 4px; background: #e5e7eb; border-radius: 2px; overflow: hidden; margin-bottom: 20px; }
.progress-bar { height: 100%; background: #3b82f6; transition: width 0.3s; }

/* 对话页 */
.chat-page { display: flex; flex-direction: column; height: 100vh; max-width: 640px; margin: 0 auto; background: #f5f7fa; }
.chat-header { padding: 12px 16px; background: #fff; border-bottom: 1px solid #e5e7eb; display: flex; align-items: center; gap: 10px; }
.chat-avatar { width: 40px; height: 40px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 20px; flex-shrink: 0; }
.chat-avatar.exp { background: linear-gradient(135deg, #fce7f3, #fbcfe8); }
.chat-avatar.util { background: #e5e7eb; color: #6b7280; }
.chat-title { flex: 1; }
.chat-name { font-weight: 600; font-size: 15px; }
.chat-status { font-size: 12px; color: #6b7280; }
.chat-rounds { font-size: 12px; padding: 4px 10px; background: #eff6ff; color: #3b82f6; border-radius: 12px; font-weight: 600; }
.chat-rounds.done { background: #d1fae5; color: #059669; }

.chat-body { flex: 1; overflow-y: auto; padding: 16px; display: flex; flex-direction: column; gap: 10px; -webkit-overflow-scrolling: touch; }
.msg { max-width: 82%; padding: 10px 14px; border-radius: 16px; word-wrap: break-word; white-space: pre-wrap; font-size: 14.5px; line-height: 1.55; }
.msg.assistant { background: #fff; align-self: flex-start; border-bottom-left-radius: 4px; box-shadow: 0 1px 2px rgba(0,0,0,0.04); }
.msg.user { background: #3b82f6; color: #fff; align-self: flex-end; border-bottom-right-radius: 4px; }
.msg.system { align-self: center; font-size: 12px; color: #9ca3af; background: transparent; padding: 4px 0; max-width: 100%; text-align: center; }
.msg.loading { background: #fff; align-self: flex-start; padding: 14px 18px; }
.msg.loading .dots { display: inline-flex; gap: 4px; }
.msg.loading .dots span { width: 6px; height: 6px; background: #9ca3af; border-radius: 50%; animation: dot 1.4s infinite; }
.msg.loading .dots span:nth-child(2) { animation-delay: 0.2s; }
.msg.loading .dots span:nth-child(3) { animation-delay: 0.4s; }
@keyframes dot { 0%,80%,100% { opacity: 0.3; } 40% { opacity: 1; } }

.chat-input { padding: 10px 12px; background: #fff; border-top: 1px solid #e5e7eb; display: flex; gap: 8px; align-items: flex-end; }
.chat-input textarea { flex: 1; border: 1px solid #e5e7eb; border-radius: 18px; padding: 10px 14px; font-size: 15px; resize: none; max-height: 80px; min-height: 38px; font-family: inherit; outline: none; }
.chat-input textarea:focus { border-color: #3b82f6; }
.chat-send { background: #3b82f6; color: #fff; border: none; border-radius: 50%; width: 38px; height: 38px; cursor: pointer; flex-shrink: 0; display: flex; align-items: center; justify-content: center; }
.chat-send:disabled { background: #d1d5db; }

.chat-finish-bar { padding: 8px 12px; background: #fff; border-top: 1px solid #f3f4f6; }
.chat-finish-bar .btn { padding: 10px 24px; min-width: auto; font-size: 14px; }
