* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Microsoft YaHei', sans-serif;
    background: #f5f5f5;
    height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
}

/* ========== 登录页面 ========== */
.login-page {
    width: 100%;
    height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 50%, #0f3460 100%);
    position: relative;
    overflow: hidden;
}

.login-page::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(255,255,255,0.03) 1px, transparent 1px);
    background-size: 50px 50px;
    animation: bgMove 20s linear infinite;
}

@keyframes bgMove {
    0% { transform: translate(0, 0); }
    100% { transform: translate(50px, 50px); }
}

.login-card {
    background: rgba(255, 255, 255, 0.95);
    padding: 50px 45px;
    border-radius: 20px;
    box-shadow: 0 25px 50px rgba(0,0,0,0.3);
    width: 100%;
    max-width: 420px;
    text-align: center;
    position: relative;
    z-index: 1;
    backdrop-filter: blur(10px);
}


.login-logo {
    width: 70px;
    height: 70px;
    background: linear-gradient(135deg, #2c3e50 0%, #34495e 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 25px;
    box-shadow: 0 8px 25px rgba(44, 62, 80, 0.3);
}

.login-logo svg {
    width: 35px;
    height: 35px;
    fill: white;
}

.login-title {
    font-size: 26px;
    font-weight: 700;
    color: #2c3e50;
    margin-bottom: 8px;
    letter-spacing: 1px;
}

.login-subtitle {
    font-size: 14px;
    color: #7f8c8d;
    margin-bottom: 35px;
    text-align: center;
}

.login-banner {
    background: rgba(231, 76, 60, 0.12);
    border: 1px solid rgba(231, 76, 60, 0.4);
    color: #b03a2e;
    padding: 12px 14px;
    border-radius: 12px;
    font-size: 14px;
    line-height: 1.6;
    text-align: left;
    margin: 0 0 20px;
}

.login-form {
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.input-group {
    position: relative;
}

.input-icon {
    position: absolute;
    left: 16px;
    top: 50%;
    transform: translateY(-50%);
    width: 20px;
    height: 20px;
    fill: #bdc3c7;
    transition: fill 0.3s;
}

.login-input {
    width: 100%;
    padding: 16px 18px 16px 48px;
    border: 2px solid #ecf0f1;
    border-radius: 12px;
    font-size: 15px;
    outline: none;
    transition: all 0.3s;
    background: #f8f9fa;
}

.login-input:focus {
    border-color: #2c3e50;
    background: white;
    box-shadow: 0 0 0 4px rgba(44, 62, 80, 0.1);
}

.login-input:focus + .input-icon,
.login-input:not(:placeholder-shown) + .input-icon {
    fill: #2c3e50;
}

/* ========== 前测问卷 ========== */
.pretest-page .login-card {
    max-width: 840px;
    width: 90%;
    text-align: left;
}

.pretest-page .login-title {
    text-align: center;
    margin-bottom: 16px;
}

.pretest-page .login-btn {
    display: block;
    margin-left: auto;
    margin-right: auto;
    max-width: 280px;
}

.pretest-card {
    max-height: 90vh;
    overflow-y: auto;
    padding: 52px 60px;
}

.pretest-card::-webkit-scrollbar {
    width: 8px;
}

.pretest-card::-webkit-scrollbar-track {
    background: transparent;
}

.pretest-card::-webkit-scrollbar-thumb {
    background: rgba(44, 62, 80, 0.25);
    border-radius: 999px;
}

.pretest-card {
    scrollbar-width: thin;
    scrollbar-color: rgba(44, 62, 80, 0.35) transparent;
}

.pretest-scroll {
    padding-right: 54px;
}

.pretest-page .login-card.pretest-compact {
    max-width: 420px;
    width: 100%;
    padding: 50px 45px;
}

.pretest-save-card {
    padding: 50px 45px;
    text-align: center;
}

.pretest-text {
    font-size: 16px;
    line-height: 1.9;
    color: #2c3e50;
    margin: 22px 0 32px;
    text-align: left;
}

.pretest-section {
    margin-bottom: 22px;
}

.pretest-label {
    font-size: 15px;
    color: #2c3e50;
    margin-bottom: 8px;
    font-weight: 600;
}

.pretest-input {
    width: 100%;
    padding: 12px 14px;
    border: 2px solid #ecf0f1;
    border-radius: 12px;
    font-size: 15px;
    outline: none;
    background: #f8f9fa;
    transition: border-color 0.3s, box-shadow 0.3s;
}

.pretest-input:focus {
    border-color: #2c3e50;
    box-shadow: 0 0 0 4px rgba(44, 62, 80, 0.08);
}

.pretest-radio-group {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
}

.pretest-radio-group label {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    color: #2c3e50;
    padding: 8px 12px;
    border: 1px solid #e1e6eb;
    border-radius: 999px;
    background: #fafbfc;
}

.pretest-section-instruction {
    margin: 26px 0 18px;
    padding: 16px 18px;
    background: #f4f6f8;
    border: 1px solid #e1e6eb;
    border-radius: 12px;
    color: #34495e;
    font-size: 15px;
    line-height: 1.7;
    white-space: pre-line;
    font-weight: 600;
    text-align: left;
}

.pretest-question {
    padding: 18px 0;
    border-bottom: 1px solid #eef1f4;
}

.pretest-question-title {
    font-size: 15px;
    color: #2c3e50;
    margin-bottom: 10px;
    line-height: 1.7;
    font-weight: 600;
}
.pretest-question-title-normal {
    font-weight: 400;
}

.pretest-question-note {
    font-size: 13px;
    color: #7f8c8d;
    margin: -4px 0 12px;
    white-space: pre-line;
}

.likert-options {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.likert-option {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    color: #2c3e50;
    padding: 6px 10px;
    border-radius: 10px;
    background: #f8f9fb;
    border: 1px solid #e1e6eb;
}

.likert-option input {
    accent-color: #2c3e50;
}

.slider-row {
    display: flex;
    align-items: center;
    gap: 16px;
}

.slider-row input[type="range"] {
    flex: 1;
    -webkit-appearance: none;
    height: 6px;
    border-radius: 999px;
    background: #e4e9ef;
    outline: none;
}

.slider-row input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #9aa8b6;
    box-shadow: 0 3px 8px rgba(80, 96, 112, 0.25);
    cursor: pointer;
}

.slider-row input[type="range"]::-moz-range-thumb {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #9aa8b6;
    box-shadow: 0 3px 8px rgba(80, 96, 112, 0.25);
    cursor: pointer;
    border: none;
}

.slider-row input[type="range"]::-moz-range-track {
    height: 6px;
    border-radius: 999px;
    background: #e4e9ef;
}

.slider-value {
    min-width: 42px;
    text-align: right;
    font-weight: 600;
    color: #2c3e50;
}

.frequency-options {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.frequency-option {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    color: #2c3e50;
    padding: 8px 12px;
    border-radius: 12px;
    border: 1px solid #e1e6eb;
    background: #fafbfc;
}

.frequency-option input {
    accent-color: #2c3e50;
}

.login-btn.secondary {
    background: #ecf0f1;
    color: #2c3e50;
}

.login-btn {
    padding: 16px;
    background: linear-gradient(135deg, #2c3e50 0%, #34495e 100%);
    color: white;
    border: none;
    border-radius: 12px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    letter-spacing: 1px;
    margin-top: 5px;
}

.login-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(44, 62, 80, 0.35);
}

.login-btn:active {
    transform: translateY(0);
}

.divider {
    display: flex;
    align-items: center;
    margin: 28px 0;
    color: #bdc3c7;
    font-size: 12px;
}

.divider::before,
.divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: #ecf0f1;
}

.divider span {
    padding: 0 15px;
}

.test-channel {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.test-label {
    font-size: 13px;
    color: #95a5a6;
}

.test-btn {
    padding: 12px 24px;
    background: transparent;
    color: #7f8c8d;
    border: 2px dashed #dce0e3;
    border-radius: 10px;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.3s;
}

.test-btn:hover {
    border-color: #2c3e50;
    border-style: solid;
    color: #2c3e50;
    background: rgba(44, 62, 80, 0.05);
}

.login-footer {
    margin-top: 30px;
    padding-top: 20px;
    border-top: 1px solid #ecf0f1;
    font-size: 12px;
    color: #bdc3c7;
    text-align: center;
}

.welcome-card .login-title {
    margin-bottom: 16px;
}

.welcome-message {
    font-size: 15px;
    color: #2c3e50;
    line-height: 1.7;
    margin-bottom: 28px;
    text-align: left;
}

.welcome-message strong {
    color: #2c3e50;
}

.completion-actions {
    margin-top: 24px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

/* ========== 话题选择页面 ========== */
.topic-page {
    width: 100%;
    height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    background: #f5f5f5;
}

.topic-select-container {
    background: white;
    padding: 40px;
    border-radius: 16px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.1);
    width: 100%;
    max-width: 500px;
}

.topic-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    padding-bottom: 15px;
    border-bottom: 1px solid #eee;
}

.user-info {
    font-size: 14px;
    color: #666;
}

.logout-btn {
    padding: 6px 12px;
    background: transparent;
    color: #999;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.3s;
}

.logout-btn:hover {
    color: #e74c3c;
    border-color: #e74c3c;
}

.topic-title {
    font-size: 22px;
    font-weight: 600;
    color: #333;
    margin-bottom: 25px;
    text-align: center;
}

.topic-tree {
    border: 1px solid #e0e0e0;
    border-radius: 10px;
    overflow: hidden;
}

.topic-item {
    padding: 15px 20px;
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    transition: background 0.2s;
    border-bottom: 1px solid #eee;
}

.topic-item:last-child {
    border-bottom: none;
}

.topic-item:hover {
    background: #f8f9fa;
}

.topic-item.level-1 {
    background: #f8f9fa;
    font-weight: 600;
}

.topic-item.level-2 {
    padding-left: 40px;
    background: #fff;
}

.topic-item.level-3 {
    padding-left: 60px;
    background: #fff;
}

.topic-item.level-3:hover {
    background: linear-gradient(135deg, #667eea15 0%, #764ba215 100%);
}

.topic-icon {
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #e0e0e0;
    border-radius: 4px;
    font-size: 14px;
    font-weight: bold;
    color: #666;
}

.topic-item.level-3 .topic-icon {
    background: #667eea;
    color: white;
}

.topic-name {
    font-size: 15px;
    color: #333;
}

.topic-children {
    background: #fafafa;
}

/* ========== 返回按钮 ========== */
.header-left {
    display: flex;
    align-items: center;
    gap: 15px;
}

.back-btn {
    padding: 6px 12px;
    background: transparent;
    color: #666;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.3s;
}

.back-btn:hover {
    color: #333;
    border-color: #333;
}

.container {
    width: 100%;
    max-width: 1200px;
    height: 100vh;
    background: white;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    display: flex;
    flex-direction: column;
}

/* 顶部栏 */
.header {
    padding: 20px 30px;
    border-bottom: 1px solid #e0e0e0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.conversation-id {
    font-size: 16px;
    color: #666;
    display: flex;
    align-items: center;
    gap: 10px;
}

.topic-hint {
    font-size: 14px;
    color: #888;
    font-style: italic;
}

/* 对话区域 */
.chat-area {
    flex: 1;
    overflow-y: auto;
    padding: 16px 24px 24px;
    background: #fafafa;
}

/* 话题提示卡片 */
.topic-fixed {
    flex: 0 0 auto;
    padding: 10px 20px;
    background: #fafafa;
    border-bottom: 1px solid #e6e6e6;
    overflow: visible;
}

.topic-card {
    background: linear-gradient(135deg, #eef4ff 0%, #f7fbff 100%);
    color: #2c3e50;
    padding: 10px 12px;
    border-radius: 10px;
    margin: 0;
    border: 1px solid #d9e4f5;
    box-shadow: 0 2px 6px rgba(44, 62, 80, 0.08);
}

.topic-card-title {
    font-size: 12px;
    color: #5b6b7a;
    margin-bottom: 4px;
}

.topic-card-topic {
    font-size: 16px;
    font-weight: bold;
    margin-bottom: 6px;
}

.topic-card-instruction {
    font-size: 11px;
    line-height: 1.4;
    color: #5b6b7a;
}

.message {
    display: flex;
    gap: 15px;
    margin-bottom: 30px;
    max-width: 85%;
}

.message.ai {
    margin-right: auto;
}

.message.user {
    margin-left: auto;
    margin-right: 0;
    flex-direction: row-reverse;
}

.avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: #2c3e50;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    color: white;
    font-weight: bold;
    font-size: 18px;
}

.avatar.user-avatar {
    background: #95a5a6;
}

.message-content {
    background: #e8e8e8;
    padding: 12px 18px;
    border-radius: 18px;
    font-size: 15px;
    line-height: 1.6;
    color: #333;
}

/* 三个气泡加载动画 */
.typing-indicator {
    display: flex;
    gap: 15px;
    margin-bottom: 30px;
    max-width: 85%;
}

.typing-bubbles {
    background: #e8e8e8;
    padding: 18px 20px;
    border-radius: 18px;
    display: flex;
    gap: 6px;
    align-items: center;
}

.typing-dot {
    width: 10px;
    height: 10px;
    background: #999;
    border-radius: 50%;
    animation: typingBounce 1.4s infinite ease-in-out;
}

.typing-dot:nth-child(1) { animation-delay: 0s; }
.typing-dot:nth-child(2) { animation-delay: 0.2s; }
.typing-dot:nth-child(3) { animation-delay: 0.4s; }

@keyframes typingBounce {
    0%, 60%, 100% { transform: translateY(0); }
    30% { transform: translateY(-10px); }
}

/* 语音输入区域 */
.voice-input-area {
    height: 20vh;
    background: white;
    padding: 12px 20px;
    border-top: 1px solid #e0e0e0;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.voice-container {
    background: #f8f8f8;
    border-radius: 12px;
    padding: 16px;
    display: flex;
    align-items: center;
    gap: 16px;
}

.mic-button {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: #2c3e50;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: all 0.3s;
}

.mic-button:hover {
    background: #34495e;
    transform: scale(1.05);
}

.mic-button.active {
    background: #e74c3c;
    animation: pulse 1.5s infinite;
}

@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.1); }
}

.mic-icon {
    width: 24px;
    height: 24px;
    fill: white;
}

.voice-visual {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.waveform {
    display: flex;
    align-items: center;
    gap: 3px;
    height: 28px;
    opacity: 0;
    transition: opacity 0.3s;
}

.waveform.active {
    opacity: 1;
}

.wave-bar {
    width: 4px;
    background: linear-gradient(to top, #3498db, #5dade2);
    border-radius: 2px;
    animation: wave 1s ease-in-out infinite;
}

.wave-bar:nth-child(1) { animation-delay: 0s; }
.wave-bar:nth-child(2) { animation-delay: 0.1s; }
.wave-bar:nth-child(3) { animation-delay: 0.2s; }
.wave-bar:nth-child(4) { animation-delay: 0.3s; }
.wave-bar:nth-child(5) { animation-delay: 0.4s; }
.wave-bar:nth-child(6) { animation-delay: 0.3s; }
.wave-bar:nth-child(7) { animation-delay: 0.2s; }
.wave-bar:nth-child(8) { animation-delay: 0.1s; }

@keyframes wave {
    0%, 100% { height: 8px; }
    50% { height: 24px; }
}

.transcript-text {
    font-size: 16px;
    color: #555;
    min-height: 24px;
}

.transcript-text.interim {
    color: #999;
}

.timer-info {
    text-align: center;
    color: #888;
    font-size: 13px;
    margin-top: 6px;
}

/* 文字输入区域 */
.text-input-area {
    background: white;
    padding: 0 30px 25px;
    border-top: 1px solid #e0e0e0;
}

.text-input-container {
    background: #f8f8f8;
    border-radius: 12px;
    padding: 16px;
    display: flex;
    align-items: center;
    gap: 12px;
}

.text-input {
    flex: 1;
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 10px 12px;
    font-size: 15px;
    outline: none;
    background: white;
}

.text-input:focus {
    border-color: #2c3e50;
}

.send-button {
    padding: 10px 16px;
    background: #2c3e50;
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    flex-shrink: 0;
}

.send-button:hover {
    background: #34495e;
}

.send-button:disabled {
    background: #ccc;
    cursor: not-allowed;
}

/* 评分界面 */
.rating-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.5);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.rating-overlay.active {
    display: flex;
}

.rating-card {
    background: white;
    padding: 16px;
    border-radius: 12px;
    max-width: 500px;
    width: 90%;
}

.rating-card.rating-inline {
    margin: 10px auto;
}

.rating-title {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 12px;
    text-align: center;
    color: #333;
}

.rating-question {
    margin-bottom: 12px;
}

.question-label {
    font-size: 14px;
    color: #555;
    margin-bottom: 6px;
}

.choice-buttons {
    display: flex;
    gap: 12px;
}

.choice-btn {
    flex: 1;
    padding: 8px;
    border: 2px solid #ddd;
    background: white;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s;
    font-size: 13px;
}

.choice-btn:hover {
    border-color: #2c3e50;
}

.choice-btn.selected {
    background: #2c3e50;
    color: white;
    border-color: #2c3e50;
}

.scale-buttons {
    display: flex;
    gap: 8px;
    justify-content: center;
}

.scale-btn {
    width: 36px;
    height: 36px;
    border: 2px solid #ddd;
    background: white;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    transition: all 0.3s;
}

.scale-btn:hover {
    border-color: #2c3e50;
}

.scale-btn.selected {
    background: #2c3e50;
    color: white;
    border-color: #2c3e50;
}

.submit-btn {
    width: 100%;
    padding: 10px;
    background: #2c3e50;
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    /* margin-top: 12px; */
    transition: all 0.3s;
}

.submit-btn:hover {
    background: #34495e;
}

.submit-btn:disabled {
    background: #ccc;
    cursor: not-allowed;
}

/* 隐藏滚动条 */
.chat-area::-webkit-scrollbar {
    width: 6px;
}

.chat-area::-webkit-scrollbar-thumb {
    background: #ccc;
    border-radius: 3px;
}
