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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Microsoft YaHei', sans-serif;
    background:
        radial-gradient(ellipse at 25% 25%, rgba(72, 88, 161, 0.8) 0%, transparent 50%),
        radial-gradient(ellipse at 75% 75%, rgba(43, 73, 106, 0.7) 0%, transparent 50%),
        radial-gradient(ellipse at 50% 90%, rgba(48, 128, 117, 0.6) 0%, transparent 40%),
        linear-gradient(135deg, #24246c 0%, #216873 15%, #3f386b 30%, #356389 50%, #457a7c 70%, #1c7272 85%, #392574 100%);
    background-attachment: fixed;
    min-height: 100vh;
    color: #2c3e50;
    line-height: 1.6;
    overflow-x: hidden;
}

header {
    background: rgba(231, 236, 241, 0.98);
    backdrop-filter: blur(20px);
    padding: clamp(16px, 2vh, 24px) clamp(16px, 2vw, 24px);
    text-align: center;
    box-shadow: 0 4px 32px rgba(0, 0, 0, 0.08);
    border-bottom: 1px solid rgba(255, 255, 255, 0.2);
    position: relative;
    z-index: 100;
}

header h1 {
    background: #191970;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: clamp(8px, 1vh, 12px);
    font-family: Georgia;
    font-weight: 700;
    font-size: clamp(1.3rem, 3vw, 2rem);
    letter-spacing: -0.5px;
}

header p {
    color: #64748b;
    font-size: clamp(14px, 2vw, 16px);
    font-weight: 400;
}

.container {
    max-width: 100%;
    margin: 0 auto;
    padding: clamp(12px, 1.5vw, 20px);
    min-height: auto;
    height: calc(100vh - 120px);
    display: flex;
    flex-direction: column;
}

.content-wrapper {
    display: flex;
    gap: clamp(16px, 2vw, 24px);
    margin-top: 0;
    align-items: flex-start;
    flex: 1;
    min-height: 0;
    overflow: hidden;
}

/* User Input Area */
.input-section {
    flex: 1;
    min-width: 0;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(20px);
    border-radius: 16px;
    padding: clamp(16px, 2vh, 24px);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.12);
    border: 1px solid rgba(255, 255, 255, 0.2);
    display: flex;
    flex-direction: column;
    height: 100%;
    min-height: 0;
    overflow: hidden;
}

.input-header h2 {
    background: #49498a;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    font-family: Georgia;
    margin-bottom: clamp(12px, 1.5vh, 18px);
    font-weight: 600;
    font-size: clamp(1rem, 2vw, 1.3rem);
}

#userInput {
    border: 2px solid #e2e8f0;
    border-radius: 12px;
    padding: clamp(12px, 1.5vh, 18px);
    font-size: clamp(14px, 1vw, 15px);
    line-height: 1.6;
    resize: none;
    outline: none;
    background: rgba(248, 250, 252, 0.8);
    font-family: inherit;
    flex: 1;
    min-height: 0;
    width: 100%;
    box-sizing: border-box;
}

#userInput:focus {
    border-color: #667eea;
    background: rgba(255, 255, 255, 0.9);
    box-shadow: 0 0 0 4px rgba(102, 126, 234, 0.1);
}

#userInput::placeholder {
    color: #94a3b8;
    font-style: italic;
}

.input-controls {
    display: flex;
    gap: 12px;
    margin-top: clamp(12px, 1.5vh, 18px);
    flex-wrap: wrap;
    flex-shrink: 0;
}

/* Intelligent Sending Control */
.auto-send-controls {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    padding: 12px 16px;
    background: rgba(248, 250, 252, 0.8);
    border: 2px solid #e2e8f0;
    border-radius: 12px;
    margin-bottom: 12px;
}

.auto-send-toggle {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    user-select: none;
}

.auto-send-toggle input[type="checkbox"] {
    display: none;
}

.toggle-slider {
    position: relative;
    width: 48px;
    height: 24px;
    background: #cbd5e1;
    border-radius: 12px;
}

.toggle-slider::before {
    content: '';
    position: absolute;
    top: 2px;
    left: 2px;
    width: 20px;
    height: 20px;
    background: white;
    border-radius: 50%;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.auto-send-toggle input:checked+.toggle-slider {
    background: #50598d;
}

.auto-send-toggle input:checked+.toggle-slider::before {
    transform: translateX(24px);
}

.toggle-label {
    font-weight: 500;
    color: #30415c;
    font-size: 14px;
}

.auto-send-status {
    flex: 1;
    text-align: right;
    font-size: 12px;
    font-weight: 500;
    padding: 4px 8px;
    border-radius: 8px;
}

.auto-send-status.ready {
    color: #045b3f;
    background: rgba(16, 185, 129, 0.1);
}

.auto-send-status.typing {
    color: #065c72;
    background: rgba(6, 182, 212, 0.1);
}

.auto-send-status.pending {
    color: #6c3b03;
    background: rgba(245, 158, 11, 0.1);
}

.auto-send-status.disabled {
    color: #6b7280;
    background: rgba(156, 163, 175, 0.1);
}

.send-btn {
    background: #50598d;
    color: white;
    border: none;
    padding: clamp(10px, 1.2vh, 12px) clamp(18px, 2vw, 24px);
    border-radius: 10px;
    cursor: pointer;
    font-size: clamp(13px, 1vw, 15px);
    font-weight: 600;
    flex: 1;
    min-width: 120px;
    box-shadow: 0 4px 16px rgba(102, 126, 234, 0.3);
}

.send-btn:hover {
    box-shadow: 0 8px 24px rgba(102, 126, 234, 0.4);
}

.send-btn:disabled {
    background: linear-gradient(135deg, #94a3b8, #cbd5e1);
    cursor: not-allowed;
    box-shadow: none;
}

.clear-btn {
    background: rgba(248, 250, 252, 0.9);
    color: #64748b;
    border: 2px solid #e2e8f0;
    padding: clamp(10px, 1.2vh, 12px) clamp(16px, 1.8vw, 20px);
    border-radius: 10px;
    cursor: pointer;
    font-weight: 500;
    font-size: clamp(13px, 1vw, 15px);
}

.clear-btn:hover {
    background: rgba(241, 245, 249, 1);
    border-color: #cbd5e1;
}

/* AI annotation area */
.ai-section {
    flex: 1;
    min-width: 0;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(20px);
    border-radius: 16px;
    padding: clamp(16px, 2vh, 24px);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.12);
    border: 1px solid rgba(255, 255, 255, 0.2);
    display: flex;
    flex-direction: column;
    height: 100%;
    min-height: 0;
    overflow: hidden;
}

.ai-header {
    margin-bottom: clamp(12px, 1.5vh, 18px);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-shrink: 0;
}

.ai-header h2 {
    background: #49498a;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    font-family: Georgia;
    margin-bottom: 0;
    font-weight: 600;
    font-size: clamp(1rem, 2vw, 1.3rem);
}

.ai-status {
    font-size: clamp(12px, 1vw, 14px);
    color: #64748b;
    padding: clamp(6px, 0.8vh, 8px) clamp(12px, 1.5vw, 16px);
    background: rgba(248, 250, 252, 0.8);
    border-radius: 20px;
    display: inline-block;
    font-weight: 500;
    border: 1px solid #e2e8f0;
    white-space: nowrap;
    flex-shrink: 0;
}

.ai-status.thinking {
    background: #356389;
    color: white;
    border-color: #356389;
}

/* ==================== 配色方案 ==================== */
/* 
主色调：蓝紫色系
强调色：橙色（用于追问）
中性色：灰色系
*/

/* ==================== AI评论区域 ==================== */
.ai-comments {
    overflow-y: auto;
    overflow-x: hidden;
    border: 2px solid #e2e8f0;
    border-radius: 12px;
    padding: clamp(12px, 1.5vh, 18px);
    background: rgba(248, 250, 252, 0.5);
    flex: 1;
    min-height: 0;
    width: 100%;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

/* 滚动条样式 */
.ai-comments::-webkit-scrollbar {
    width: 6px;
}

.ai-comments::-webkit-scrollbar-track {
    background: rgba(241, 245, 249, 0.5);
    border-radius: 3px;
}

.ai-comments::-webkit-scrollbar-thumb {
    background: #94a3b8;
    border-radius: 3px;
}

.ai-comments::-webkit-scrollbar-thumb:hover {
    background: #64748b;
}

/* ==================== AI评论卡片 - 统一样式 ==================== */
.ai-comment {
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.08), rgba(139, 92, 246, 0.05));
    border-left: 4px solid #667eea;
    padding: clamp(14px, 2vh, 20px);
    margin-bottom: 0;
    border-radius: 0 12px 12px 0;
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.15);
    display: flex;
    flex-direction: column;
    width: 100%;
    box-sizing: border-box;
    transition: box-shadow 0.3s ease;
}

.ai-comment:hover {
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.25);
}

.comment-content {
    width: 100%;
    flex-shrink: 0;
}

/* 评论类型统一配色 - 蓝紫色系 */
.ai-comment.question {
    border-left-color: #356389;
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.12), rgba(139, 92, 246, 0.06));
}

.ai-comment.concern {
    border-left-color: #356389;
    background: linear-gradient(135deg, rgba(167, 139, 250, 0.12), rgba(139, 92, 246, 0.06));
}

.ai-comment.clarification {
    border-left-color: #356389;
    background: linear-gradient(135deg, rgba(139, 92, 246, 0.12), rgba(102, 126, 234, 0.06));
}

.ai-comment.praise {
    border-left-color: #356389;
    background: linear-gradient(135deg, rgba(6, 182, 212, 0.12), rgba(8, 145, 178, 0.06));
}

.ai-comment strong {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #1e293b;
    font-size: clamp(14px, 1.1vw, 16px);
}

.ai-comment p {
    color: #475569;
    line-height: 1.7;
    margin: 0;
    font-size: clamp(13px, 1vw, 15px);
}

/* 欢迎消息 */
.welcome-message {
    display: none;
    text-align: center;
    color: #64748b;
    font-style: italic;
    padding: 40px 20px;
    background: rgba(255, 255, 255, 0.8);
    border-radius: 12px;
    border: 2px dashed #cbd5e1;
}

.welcome-message p {
    margin-bottom: 8px;
    font-size: 16px;
    line-height: 1.6;
}

/* analysis style */
.segment-divider,
.final-analysis-divider {
    margin: 20px 0 12px 0;
    padding: 8px 0;
    border-bottom: 2px solid #e2e8f0;
}

.segment-info,
.final-info {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 18px;
    color: #64748b;
    font-weight: 500;
}

.segment-icon,
.final-icon {
    font-size: 14px;
}

.final-analysis-divider {
    border-bottom-color: #356389;
}

.final-info {
    color: #356389;
    font-weight: 600;
}

.segment-comment {
    border-left-color: #356389;
    background: linear-gradient(135deg, rgba(6, 182, 212, 0.12), rgba(99, 102, 241, 0.08));
    margin-left: 12px;
    border-radius: 0 12px 12px 0;
}

.final-comment {
    border-left-color: #356389;
    background: linear-gradient(135deg, rgba(139, 92, 246, 0.15), rgba(167, 139, 250, 0.1));
    box-shadow: 0 3px 12px rgba(139, 92, 246, 0.2);
}

/* 回复区域样式 */
.response-section {
    margin-top: 16px;
    padding-top: 16px;
    border-top: 2px dashed #1c3c66;
    width: 100%;
}

.response-prompt {
    display: flex;
    align-items: center;
    margin-bottom: 12px;
    font-weight: 500;
    color: #1e293b;
}

.response-icon {
    margin-right: 8px;
    font-size: 1.1em;
}

.response-text {
    color: #64748b;
    font-size: 14px;
}

.response-input {
    width: 100%;
    box-sizing: border-box;
    border: 2px solid #4e6787;
    border-radius: 12px;
    padding: 12px 16px;
    font-size: 14px;
    line-height: 1.5;
    resize: vertical;
    outline: none;
    background: rgba(248, 250, 252, 0.8);
    font-family: inherit;
    min-height: 80px;
}

.response-input:focus {
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.response-input::placeholder {
    color: #94a3b8;
    font-style: italic;
}

.response-controls {
    display: flex;
    gap: 8px;
    margin-top: 12px;
    flex-wrap: wrap;
}

.response-btn {
    background: #356389;
    color: white;
    font-weight: 600;
    border: none;
    padding: 10px 20px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    flex: 1;
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.3);
}

.response-btn:hover {
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
    background: #356389;
}

.response-btn:disabled {
    background: #356389;
    cursor: not-allowed;
    box-shadow: none;
}

.skip-btn {
    background: rgba(248, 250, 252, 0.9);
    color: #64748b;
    border: 2px solid #e2e8f0;
    padding: 10px 16px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
}

.skip-btn:hover {
    background: rgba(241, 245, 249, 1);
    border-color: #cbd5e1;
}

/* Feedback area style - 蓝紫色系 */
.response-feedback {
    margin-top: 16px;
    padding: 16px;
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.12), rgba(139, 92, 246, 0.08));
    border: 2px solid #e2e8f0;
    border-radius: 12px;
    width: 100%;
    box-sizing: border-box;
}

.feedback-header {
    display: flex;
    align-items: center;
    margin-bottom: 8px;
    font-weight: 600;
    color: #356389;
}

.feedback-icon {
    margin-right: 8px;
    font-size: 1.1em;
    flex-shrink: 0;
}

.feedback-title {
    color: #356389;
    flex: 1;
}

.feedback-content {
    color: #356389;
    line-height: 1.5;
    margin: 0;
    word-wrap: break-word;
}

/* Skip state style */
.response-skipped {
    margin-top: 16px;
    padding: 12px 16px;
    background: rgba(156, 163, 175, 0.1);
    border: 2px dashed #d1d5db;
    border-radius: 12px;
    display: flex;
    align-items: center;
    color: #6b7280;
    font-style: italic;
}

.skip-icon {
    margin-right: 8px;
}

/* Notification Style */
.notification {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 12px 20px;
    border-radius: 8px;
    color: white;
    font-weight: 500;
    z-index: 1000;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
}

.notification.show {
    display: block;
}

.notification-info {
    background: linear-gradient(135deg, #3b82f6, #2563eb);
}

.notification-warning {
    background: linear-gradient(135deg, #f59e0b, #d97706);
}

.notification-error {
    background: linear-gradient(135deg, #ef4444, #dc2626);
}

.notification-success {
    background: linear-gradient(135deg, #10b981, #059669);
}

/* Responsive Design */
@media (max-width: 1024px) {
    .container {
        height: auto;
        min-height: 100vh;
    }

    .content-wrapper {
        flex-direction: column;
        height: auto;
        min-height: 0;
        gap: clamp(12px, 2vh, 20px);
        overflow: visible;
    }

    .input-section,
    .ai-section {
        min-width: 0;
        width: 100%;
        height: auto;
        min-height: 300px;
    }

    #userInput {
        min-height: 150px;
        height: 200px;
    }

    .ai-comments {
        min-height: 200px;
        max-height: 400px;
    }
}

@media (max-width: 768px) {

    .input-section,
    .ai-section {
        padding: clamp(14px, 2vh, 20px);
    }
}

@media (max-width: 480px) {
    .input-controls {
        flex-direction: column;
    }

    .send-btn {
        width: 100%;
    }

    .ai-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }
}

/* ==================== 追问反馈样式 ==================== */

/* ==================== 反馈样式 - 统一配色 ==================== */

/* 完全理解的反馈 - 蓝紫色系 */
.response-feedback.understood {
    background: #d3d7db;
    border: 2px solid #b4d3ec;
}

.understood-badge {
    margin-top: 16px;
    padding: 12px 16px;
    background: #356389;
    border-radius: 8px;
    display: flex;
    align-items: center;
    gap: 10px;
    color: white;
    font-weight: 600;
    box-shadow: 0 2px 8px rgba(139, 92, 246, 0.35);
    width: 100%;
    box-sizing: border-box;
}

.understood-badge .badge-icon {
    font-size: 1.2em;
    flex-shrink: 0;
}

.understood-badge .badge-text {
    font-size: 0.95em;
    flex: 1;
}

/* 部分理解的反馈 - 蓝紫色系 */
.response-feedback.follow-up {
    background: #fdfdfd;
    border: 2px solid #356389;
}

.understood-badge.partial {
    background: #356389;
    border: 2px solid #356389;
    box-shadow: 0 2px 8px rgba(99, 102, 241, 0.35);
}

.understood-badge.partial .badge-icon {
    color: white;
}

.understood-badge.partial .badge-text {
    color: white;
}

/* 响应式优化 */
@media (max-width: 768px) {

    .understood-badge,
    .follow-up-section {
        padding: 10px 12px;
    }

    .follow-up-question {
        padding: 8px 0;
        font-size: 0.9em;
    }

    .follow-up-header,
    .follow-up-prompt {
        font-size: 0.85em;
    }

    .follow-up-nested-section {
        padding: 12px;
        padding-left: 16px;
        margin-top: 16px;
    }

    .follow-up-question-box {
        padding: 10px 12px;
    }

    .response-input {
        font-size: 13px;
        padding: 10px 14px;
        min-height: 70px;
    }

    .response-controls {
        gap: 6px;
    }
}

@media (max-width: 480px) {
    .understood-badge {
        flex-direction: column;
        text-align: center;
        gap: 6px;
    }

    .follow-up-section {
        padding: 12px;
    }

    .follow-up-nested-section {
        padding: 10px;
        padding-left: 12px;
        margin-top: 12px;
    }

    .follow-up-question-box {
        padding: 8px 10px;
    }

    .response-input {
        font-size: 12px;
        padding: 8px 12px;
        min-height: 60px;
    }

    .response-btn,
    .skip-btn {
        font-size: 13px;
        padding: 8px 14px;
    }
}

/* ==================== 追问部分 - 统一蓝紫色系 ==================== */
.follow-up-nested-section {
    margin-top: 20px;
    padding: 18px;
    padding-left: 22px;
    border-left: 4px solid #356389;
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.08), rgba(129, 140, 248, 0.04));
    border-radius: 0 12px 12px 0;
    animation: slideInFromLeft 0.4s ease-out;
    width: 100%;
    box-sizing: border-box;
}

.follow-up-divider {
    height: 3px;
    background: #356389;
    margin-bottom: 18px;
    opacity: 0.6;
    border-radius: 2px;
}

.follow-up-question-box {
    background: #ecedef;
    border-radius: 10px;
    padding: 16px 20px;
    margin-bottom: 18px;
    border: 2px solid #356389;
    width: 100%;
    box-sizing: border-box;
    box-shadow: 0 2px 8px rgba(99, 102, 241, 0.15);
}

.follow-up-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 12px;
    color: #356389;
    font-weight: 700;
    font-size: 0.96em;
}

.follow-up-icon {
    font-size: 1.4em;
    flex-shrink: 0;
}

.follow-up-title {
    flex: 1;
    color: #356389;
    letter-spacing: 0.3px;
}

.follow-up-question {
    color: #356389;
    line-height: 1.8;
    font-size: 0.96em;
    margin: 0;
    padding: 8px 0;
    font-weight: 500;
}

/* 追问部分的响应区域 */
.follow-up-nested-section .response-section {
    background: rgba(255, 255, 255, 0.6);
    margin-top: 12px;
    padding: 12px;
    border-radius: 8px;
    border-top: 2px dashed #c7d2fe;
}

.follow-up-nested-section .response-input {
    border: 2px solid #356389;
    background: white;
    box-sizing: border-box;
}

.follow-up-nested-section .response-input:focus {
    border-color: #356389;
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

/* 确保追问部分不会溢出 */
.follow-up-nested-section * {
    max-width: 100%;
    box-sizing: border-box;
}

/* 追问动画 */
@keyframes slideInFromLeft {
    from {
        opacity: 0;
        transform: translateX(-20px);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}