/* -*- coding: utf-8 -*- */
/**
 * AI Sales Training System - Responsive Styles
 * Following design specs from UI设计参考文档.md
 */

/* ==================== CSS Variables ==================== */
:root {
    /* Primary Colors */
    --primary: #2563EB;
    --primary-light: #3B82F6;
    --primary-dark: #1D4ED8;

    /* Semantic Colors */
    --success: #10B981;
    --warning: #F59E0B;
    --error: #EF4444;
    --info: #3B82F6;

    /* Neutral Colors */
    --text-primary: #1F2937;
    --text-secondary: #6B7280;
    --text-muted: #9CA3AF;
    --border: #E5E7EB;
    --bg-light: #F9FAFB;
    --bg-white: #FFFFFF;

    /* Grade Colors */
    --grade-a: #10B981;
    --grade-b: #3B82F6;
    --grade-c: #F59E0B;
    --grade-d: #F97316;
    --grade-f: #EF4444;

    /* Spacing */
    --space-xs: 4px;
    --space-sm: 8px;
    --space-md: 16px;
    --space-lg: 24px;
    --space-xl: 32px;
    --space-2xl: 48px;

    /* Border Radius */
    --radius-sm: 4px;
    --radius-md: 8px;
    --radius-lg: 12px;
    --radius-xl: 16px;
    --radius-full: 9999px;

    /* Shadows */
    --shadow-sm: 0 1px 2px rgba(0,0,0,0.05);
    --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.1);
    --shadow-xl: 0 20px 25px -5px rgba(0,0,0,0.1);

    /* Typography */
    --font-family: "PingFang SC", "Microsoft YaHei", -apple-system, BlinkMacSystemFont, sans-serif;
    --font-size-xs: 12px;
    --font-size-sm: 14px;
    --font-size-md: 16px;
    --font-size-lg: 20px;
    --font-size-xl: 24px;
}

/* ==================== Reset & Base ==================== */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    font-size: 16px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: var(--font-family);
    font-size: var(--font-size-sm);
    line-height: 1.6;
    color: var(--text-primary);
    background: var(--bg-white);
    min-height: 100vh;
}

a {
    color: var(--primary);
    text-decoration: none;
}

a:hover {
    color: var(--primary-light);
}

/* ==================== Layout ==================== */
.app-container {
    max-width: 1200px;
    width: 90%;
    margin: 0 auto;
    padding: var(--space-lg);
    min-height: 100vh;
}

@media (max-width: 1024px) {
    .app-container {
        width: 95%;
        padding: var(--space-md);
    }
}

@media (max-width: 640px) {
    .app-container {
        width: 100%;
        padding: var(--space-sm);
    }
}

/* ==================== Page Header ==================== */
.page-header {
    margin-bottom: var(--space-xl);
    text-align: center;
    position: relative;
}

.header-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--space-md);
}

.header-actions {
    position: absolute;
    top: 0;
    right: 0;
    display: flex;
    gap: var(--space-sm);
}

.btn-small {
    padding: var(--space-xs) var(--space-sm);
    font-size: var(--font-size-xs);
}

.page-title {
    font-size: var(--font-size-xl);
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: var(--space-sm);
}

.page-subtitle {
    font-size: var(--font-size-sm);
    color: var(--text-secondary);
}

.back-link {
    display: inline-flex;
    align-items: center;
    gap: var(--space-xs);
    color: var(--text-secondary);
    margin-bottom: var(--space-md);
}

.back-link:hover {
    color: var(--primary);
}

/* ==================== Buttons ==================== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-sm);
    padding: 10px 20px;
    font-size: var(--font-size-sm);
    font-weight: 500;
    border: none;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-primary {
    background: var(--primary);
    color: white;
}

.btn-primary:hover {
    background: var(--primary-dark);
    color: white;
}

.btn-secondary {
    background: var(--bg-light);
    color: var(--text-primary);
    border: 1px solid var(--border);
}

.btn-secondary:hover {
    background: var(--border);
}

.btn-large {
    padding: 14px 28px;
    font-size: var(--font-size-md);
}

.btn-full {
    width: 100%;
}

/* ==================== Alerts ==================== */
.alert {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    padding: var(--space-md);
    border-radius: var(--radius-md);
    margin-bottom: var(--space-lg);
}

.alert-error {
    background: #FEF2F2;
    color: var(--error);
    border: 1px solid #FECACA;
}

.alert-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    background: var(--error);
    color: white;
    border-radius: var(--radius-full);
    font-size: 12px;
    font-weight: bold;
}

/* ==================== Task Cards ==================== */
.task-list {
    display: flex;
    flex-direction: column;
    gap: var(--space-md);
}

.task-card {
    background: var(--bg-white);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: var(--space-lg);
    box-shadow: var(--shadow-sm);
    transition: all 0.2s ease;
}

.task-card:hover {
    box-shadow: var(--shadow-md);
    border-color: var(--primary-light);
}

.task-header {
    display: flex;
    align-items: flex-start;
    gap: var(--space-md);
    margin-bottom: var(--space-md);
}

.task-icon {
    width: 48px;
    height: 48px;
    background: linear-gradient(135deg, var(--primary-light), var(--primary));
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    flex-shrink: 0;
}

.task-icon svg {
    width: 24px;
    height: 24px;
}

.task-info {
    flex: 1;
}

.task-name {
    font-size: var(--font-size-lg);
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: var(--space-xs);
}

.task-badge {
    display: inline-block;
    padding: 2px 8px;
    font-size: var(--font-size-xs);
    font-weight: 500;
    border-radius: var(--radius-full);
}

.badge-recommended {
    background: #DBEAFE;
    color: var(--primary);
}

.task-description {
    color: var(--text-secondary);
    margin-bottom: var(--space-md);
    line-height: 1.5;
}

.task-meta {
    display: flex;
    gap: var(--space-lg);
    margin-bottom: var(--space-lg);
}

.meta-item {
    display: flex;
    align-items: center;
    gap: var(--space-xs);
    color: var(--text-muted);
    font-size: var(--font-size-xs);
}

.task-actions {
    display: flex;
    gap: var(--space-sm);
}

.task-actions .btn-primary {
    flex: 1;
}

.task-actions .btn-secondary {
    padding: var(--space-sm);
    min-width: auto;
}

/* ==================== Empty State ==================== */
.empty-state {
    text-align: center;
    padding: var(--space-2xl);
    color: var(--text-secondary);
}

.empty-icon {
    margin-bottom: var(--space-md);
}

.empty-icon svg {
    width: 64px;
    height: 64px;
    color: var(--text-muted);
}

.empty-state h3 {
    font-size: var(--font-size-lg);
    margin-bottom: var(--space-sm);
}

/* ==================== Footer Hint ==================== */
.footer-hint {
    text-align: center;
    margin-top: var(--space-2xl);
    padding: var(--space-md);
    color: var(--text-muted);
    font-size: var(--font-size-xs);
}

.footer-hint code {
    background: var(--bg-light);
    padding: 2px 6px;
    border-radius: var(--radius-sm);
    font-family: monospace;
}

/* ==================== Task Detail / Setup Form ==================== */
.setup-form {
    background: var(--bg-white);
}

.form-section {
    margin-bottom: var(--space-xl);
}

.section-title {
    font-size: var(--font-size-md);
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: var(--space-md);
}

.scenario-list {
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
}

.scenario-card {
    display: flex;
    align-items: center;
    padding: var(--space-md);
    background: var(--bg-light);
    border: 2px solid transparent;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all 0.2s ease;
}

.scenario-card:hover {
    border-color: var(--primary-light);
}

.scenario-card input {
    display: none;
}

.scenario-card input:checked + .scenario-content + .radio-indicator {
    background: var(--primary);
    border-color: var(--primary);
}

.scenario-card input:checked + .scenario-content + .radio-indicator::after {
    content: '';
    position: absolute;
    width: 8px;
    height: 8px;
    background: white;
    border-radius: 50%;
}

.scenario-card:has(input:checked) {
    border-color: var(--primary);
    background: #EFF6FF;
}

.scenario-content {
    flex: 1;
}

.scenario-name {
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: 2px;
}

.scenario-desc {
    font-size: var(--font-size-xs);
    color: var(--text-secondary);
}

.radio-indicator {
    width: 20px;
    height: 20px;
    border: 2px solid var(--border);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    flex-shrink: 0;
}

/* Difficulty Slider */
.difficulty-slider {
    padding: var(--space-md);
    background: var(--bg-light);
    border-radius: var(--radius-md);
}

.slider {
    width: 100%;
    height: 8px;
    -webkit-appearance: none;
    appearance: none;
    background: var(--border);
    border-radius: var(--radius-full);
    outline: none;
    margin-bottom: var(--space-md);
}

.slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 24px;
    height: 24px;
    background: var(--primary);
    border-radius: 50%;
    cursor: pointer;
    box-shadow: var(--shadow-md);
}

.slider::-moz-range-thumb {
    width: 24px;
    height: 24px;
    background: var(--primary);
    border-radius: 50%;
    cursor: pointer;
    border: none;
}

.difficulty-labels {
    display: flex;
    justify-content: space-between;
    font-size: var(--font-size-xs);
    color: var(--text-muted);
    margin-bottom: var(--space-md);
}

.difficulty-display {
    text-align: center;
}

.difficulty-value {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    background: var(--primary);
    color: white;
    font-size: var(--font-size-lg);
    font-weight: 600;
    border-radius: 50%;
    margin-right: var(--space-sm);
}

.difficulty-text {
    color: var(--text-secondary);
}

.form-actions {
    margin-top: var(--space-xl);
}

/* ==================== Chat Interface ==================== */
.chat-container {
    display: flex;
    flex-direction: column;
    height: 100vh;
    background: var(--bg-light);
}

.chat-header {
    display: flex;
    align-items: center;
    padding: var(--space-md);
    background: var(--bg-white);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 100;
}

.back-btn, .end-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    background: none;
    border: none;
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s ease;
}

.back-btn:hover, .end-btn:hover {
    background: var(--bg-light);
    color: var(--text-primary);
}

.header-info {
    flex: 1;
    text-align: center;
}

.header-title {
    font-size: var(--font-size-md);
    font-weight: 600;
    color: var(--text-primary);
}

.header-meta {
    font-size: var(--font-size-xs);
    color: var(--text-muted);
}

.turn-counter {
    display: inline-block;
    padding: 2px 8px;
    background: var(--bg-light);
    border-radius: var(--radius-full);
}

/* Scenario Banner */
.scenario-banner {
    background: var(--bg-white);
    border-bottom: 1px solid var(--border);
    overflow: hidden;
}

.scenario-toggle {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    padding: var(--space-sm) var(--space-md);
    cursor: pointer;
    color: var(--text-secondary);
    font-size: var(--font-size-xs);
}

.scenario-toggle .chevron {
    margin-left: auto;
    transition: transform 0.2s ease;
}

.scenario-banner.collapsed .chevron {
    transform: rotate(-90deg);
}

.scenario-banner.collapsed .scenario-content {
    display: none;
}

.scenario-content {
    padding: 0 var(--space-md) var(--space-md);
}

.scenario-content p {
    font-size: var(--font-size-sm);
    color: var(--text-primary);
    line-height: 1.6;
}

/* Actor info in scenario banner */
.scenario-content .actor-info {
    font-size: var(--font-size-xs);
    color: var(--primary);
    font-weight: 500;
    margin-bottom: var(--space-xs);
    padding-bottom: var(--space-xs);
    border-bottom: 1px solid var(--border);
}

.scenario-content .scenario-desc {
    font-size: var(--font-size-sm);
    color: var(--text-primary);
    line-height: 1.6;
}

/* Chat Messages */
.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: var(--space-md);
    display: flex;
    flex-direction: column;
    gap: var(--space-md);
}

.message {
    display: flex;
    gap: var(--space-sm);
    max-width: 80%;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.message-user {
    align-self: flex-end;
    flex-direction: row-reverse;
}

.message-ai {
    align-self: flex-start;
}

.message-avatar {
    width: 36px;
    height: 36px;
    background: var(--bg-light);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
    flex-shrink: 0;
}

.message-content {
    display: flex;
    flex-direction: column;
    gap: var(--space-xs);
}

.message-user .message-content {
    align-items: flex-end;
}

.message-bubble {
    padding: var(--space-sm) var(--space-md);
    border-radius: var(--radius-xl);
    line-height: 1.5;
    white-space: pre-wrap;
    word-break: break-word;
}

.message-user .message-bubble {
    background: var(--primary);
    color: white;
    border-bottom-right-radius: var(--radius-sm);
}

.message-ai .message-bubble {
    background: var(--bg-white);
    color: var(--text-primary);
    border-bottom-left-radius: var(--radius-sm);
    box-shadow: var(--shadow-sm);
}

.message-sender {
    font-size: var(--font-size-xs);
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 2px;
}

.message-time {
    font-size: 10px;
    color: var(--text-muted);
}

/* System Message */
.system-message {
    align-self: center;
    padding: var(--space-sm) var(--space-md);
    background: var(--bg-white);
    border-radius: var(--radius-full);
    font-size: var(--font-size-xs);
    color: var(--text-secondary);
    box-shadow: var(--shadow-sm);
}

.system-error {
    background: #FEF2F2;
    color: var(--error);
}

/* System Hint Message - 系统提示样式（如退出提示） */
.message-system-hint {
    align-self: center;
    max-width: 90%;
}

.message-system-hint .message-bubble {
    background: linear-gradient(135deg, #fefce8 0%, #fef9c3 100%);
    color: #854d0e;
    border: 1px dashed #facc15;
    border-radius: var(--radius-lg);
    text-align: center;
    padding: var(--space-sm) var(--space-md);
    font-size: var(--font-size-xs);
    font-weight: 500;
}

.message-system-hint .message-avatar {
    display: none;
}

.message-system-hint .message-sender {
    display: none;
}

.message-system-hint .message-content {
    align-items: center;
}

.message-system-hint .message-time {
    display: none;
}

/* Session End Message - 会话结束消息样式 */
.message-system-end {
    align-self: center;
    max-width: 90%;
}

.message-system-end .message-bubble {
    background: linear-gradient(135deg, #f0f9ff 0%, #e0f2fe 100%);
    color: var(--text-secondary);
    border: 1px dashed var(--primary-light);
    border-radius: var(--radius-lg);
    text-align: center;
    padding: var(--space-md) var(--space-lg);
    font-size: var(--font-size-sm);
}

.message-system-end .message-avatar {
    display: none;
}

.message-system-end .message-sender {
    display: none;
}

.message-system-end .message-content {
    align-items: center;
}

.message-system-end .message-time {
    text-align: center;
}

/* Loading Indicator */
.loading-indicator {
    display: none;
    align-self: flex-start;
    padding: var(--space-sm) var(--space-md);
    background: var(--bg-white);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-sm);
}

.loading-indicator.visible {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
}

.typing-dots {
    display: flex;
    gap: 4px;
}

.typing-dots span {
    width: 8px;
    height: 8px;
    background: var(--text-muted);
    border-radius: 50%;
    animation: bounce 1.4s ease-in-out infinite;
}

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

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

.loading-text {
    font-size: var(--font-size-xs);
    color: var(--text-muted);
}

/* Input Area */
.chat-input-area {
    padding: var(--space-md);
    background: var(--bg-white);
    border-top: 1px solid var(--border);
}

.chat-input-area.disabled {
    opacity: 0.5;
    pointer-events: none;
}

.input-wrapper {
    display: flex;
    gap: var(--space-sm);
    align-items: flex-end;
}

.message-input {
    flex: 1;
    padding: var(--space-sm) var(--space-md);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    font-size: var(--font-size-sm);
    font-family: inherit;
    resize: none;
    outline: none;
    max-height: 120px;
    transition: border-color 0.2s ease;
}

.message-input:focus {
    border-color: var(--primary);
}

.send-btn {
    width: 44px;
    height: 44px;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: var(--radius-md);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s ease;
    flex-shrink: 0;
}

.send-btn:hover {
    background: var(--primary-dark);
}

.send-btn:disabled {
    background: var(--text-muted);
    cursor: not-allowed;
}

.input-hint {
    text-align: center;
    font-size: 10px;
    color: var(--text-muted);
    margin-top: var(--space-xs);
}

/* Modal */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: var(--space-md);
}

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

.modal-content {
    background: var(--bg-white);
    border-radius: var(--radius-xl);
    padding: var(--space-xl);
    max-width: 400px;
    width: 100%;
    text-align: center;
    box-shadow: var(--shadow-xl);
}

.modal-warning {
    border-top: 4px solid var(--warning);
}

.modal-icon {
    margin-bottom: var(--space-md);
    color: var(--warning);
}

.modal-content h2 {
    font-size: var(--font-size-lg);
    margin-bottom: var(--space-sm);
}

.modal-content p {
    color: var(--text-secondary);
    margin-bottom: var(--space-lg);
}

.modal-actions {
    display: flex;
    gap: var(--space-sm);
    justify-content: center;
    flex-wrap: wrap;
}

/* ==================== Report Page ==================== */
.report-container {
    max-width: 900px;
    width: 90%;
    margin: 0 auto;
    padding: var(--space-lg);
}

@media (min-width: 1400px) {
    .report-container {
        max-width: 1000px;
    }
}

@media (max-width: 768px) {
    .report-container {
        width: 95%;
        padding: var(--space-md);
    }
}

@media (max-width: 480px) {
    .report-container {
        width: 100%;
        padding: var(--space-sm);
    }
}

.report-header {
    margin-bottom: var(--space-lg);
}

.report-title {
    font-size: var(--font-size-xl);
    font-weight: 600;
    text-align: center;
    margin-top: var(--space-md);
}

/* Loading */
.report-loading {
    text-align: center;
    padding: var(--space-2xl);
}

.loading-spinner {
    width: 48px;
    height: 48px;
    border: 4px solid var(--border);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto var(--space-md);
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.loading-hint {
    font-size: var(--font-size-xs);
    color: var(--text-muted);
    margin-top: var(--space-sm);
}

/* Score Card */
.score-card {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    border-radius: var(--radius-xl);
    padding: var(--space-xl);
    color: white;
    margin-bottom: var(--space-lg);
}

.score-main {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-lg);
    margin-bottom: var(--space-lg);
}

.score-circle {
    width: 100px;
    height: 100px;
    background: rgba(255,255,255,0.2);
    border-radius: 50%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.score-circle.grade-a { background: rgba(16, 185, 129, 0.3); }
.score-circle.grade-b { background: rgba(59, 130, 246, 0.3); }
.score-circle.grade-c { background: rgba(245, 158, 11, 0.3); }
.score-circle.grade-d { background: rgba(249, 115, 22, 0.3); }
.score-circle.grade-f { background: rgba(239, 68, 68, 0.3); }

.score-value {
    font-size: 36px;
    font-weight: 700;
    line-height: 1;
}

.score-total {
    font-size: var(--font-size-sm);
    opacity: 0.8;
}

.score-grade {
    font-size: 48px;
    font-weight: 700;
}

.score-dimensions {
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
}

.dimension-item {
    background: rgba(255,255,255,0.1);
    border-radius: var(--radius-md);
    padding: var(--space-sm) var(--space-md);
}

.dimension-header {
    display: flex;
    justify-content: space-between;
    font-size: var(--font-size-xs);
    margin-bottom: var(--space-xs);
}

.dimension-bar {
    height: 6px;
    background: rgba(255,255,255,0.2);
    border-radius: var(--radius-full);
    overflow: hidden;
}

.dimension-fill {
    height: 100%;
    background: white;
    border-radius: var(--radius-full);
    transition: width 0.5s ease;
}

/* Report Sections */
.report-section {
    background: var(--bg-white);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: var(--space-lg);
    margin-bottom: var(--space-md);
}

.report-section .section-title {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    margin-bottom: var(--space-md);
}

.highlight-title {
    color: var(--success);
}

.improvement-title {
    color: var(--warning);
}

.summary-content p {
    color: var(--text-primary);
    line-height: 1.6;
    margin-bottom: var(--space-md);
}

.summary-meta {
    display: flex;
    gap: var(--space-sm);
    flex-wrap: wrap;
}

.meta-tag {
    display: none;
    padding: 4px 12px;
    background: var(--bg-light);
    border-radius: var(--radius-full);
    font-size: var(--font-size-xs);
    color: var(--text-secondary);
}

/* Feedback Cards */
.feedback-card {
    padding: var(--space-md);
    background: var(--bg-light);
    border-radius: var(--radius-md);
    margin-bottom: var(--space-sm);
}

.feedback-card:last-child {
    margin-bottom: 0;
}

.highlight-card {
    border-left: 3px solid var(--success);
}

.improvement-card {
    border-left: 3px solid var(--warning);
}

.feedback-quote {
    font-style: italic;
    color: var(--text-secondary);
    margin-bottom: var(--space-sm);
    padding-left: var(--space-md);
    border-left: 2px solid var(--border);
}

.quote-turn {
    display: block;
    font-style: normal;
    font-size: var(--font-size-xs);
    color: var(--text-muted);
    margin-bottom: var(--space-xs);
}

.feedback-analysis, .feedback-issue, .feedback-suggestion {
    display: flex;
    gap: var(--space-sm);
    font-size: var(--font-size-sm);
    margin-top: var(--space-sm);
}

.feedback-icon {
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    font-size: 12px;
    font-weight: bold;
    flex-shrink: 0;
}

.feedback-analysis .feedback-icon {
    background: var(--success);
    color: white;
}

.feedback-issue .feedback-icon {
    background: var(--warning);
    color: white;
}

.feedback-suggestion .feedback-icon {
    background: var(--info);
    color: white;
}

/* Action Items */
.action-item {
    display: flex;
    gap: var(--space-sm);
    padding: var(--space-sm) 0;
    border-bottom: 1px solid var(--border);
}

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

.action-number {
    width: 24px;
    height: 24px;
    background: var(--primary);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: var(--font-size-xs);
    font-weight: 600;
    flex-shrink: 0;
}

.action-text {
    line-height: 24px;
}

/* Report Actions */
.report-actions {
    text-align: center;
    margin-top: var(--space-xl);
}

/* Error Page */
.error-page, .report-error {
    text-align: center;
    padding: var(--space-2xl);
}

.error-icon {
    color: var(--error);
    margin-bottom: var(--space-md);
}

.error-page h1, .report-error h2 {
    font-size: var(--font-size-xl);
    margin-bottom: var(--space-sm);
}

.error-message {
    color: var(--text-secondary);
    margin-bottom: var(--space-lg);
}

/* ==================== Responsive ==================== */
@media (max-width: 640px) {
    .app-container {
        padding: var(--space-sm);
    }

    .task-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .task-meta {
        flex-direction: column;
        gap: var(--space-sm);
    }

    .message {
        max-width: 90%;
    }

    .score-main {
        flex-direction: column;
    }

    .modal-actions {
        flex-direction: column;
    }

    .modal-actions .btn {
        width: 100%;
    }
}

@media (min-width: 1024px) {
    .app-container {
        padding: var(--space-xl);
    }

    .task-list {
        display: grid;
        grid-template-columns: repeat(2, 1fr);
    }

    .chat-container {
        max-width: 900px;
        margin: 0 auto;
        border-left: 1px solid var(--border);
        border-right: 1px solid var(--border);
    }
}

@media (min-width: 1400px) {
    .chat-container {
        max-width: 1000px;
    }
}

/* ==================== History Page ==================== */
.history-list {
    display: flex;
    flex-direction: column;
    gap: var(--space-md);
}

.history-card {
    background: var(--bg-white);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: var(--space-lg);
    box-shadow: var(--shadow-sm);
    transition: all 0.2s ease;
}

.history-card:hover {
    box-shadow: var(--shadow-md);
}

.history-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: var(--space-md);
    margin-bottom: var(--space-md);
}

.history-info {
    flex: 1;
}

.history-title {
    font-size: var(--font-size-md);
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: var(--space-xs);
}

.history-meta {
    display: flex;
    gap: var(--space-md);
    flex-wrap: wrap;
}

.history-score {
    display: flex;
    flex-direction: column;
    align-items: center;
    min-width: 60px;
}

.history-score .score-value {
    font-size: 24px;
    font-weight: 700;
    color: var(--primary);
}

.history-score .score-grade {
    font-size: var(--font-size-sm);
    font-weight: 600;
    color: var(--text-secondary);
}

.history-score.status-completed .score-value { color: var(--success); }
.history-score.status-terminated .score-value { color: var(--error); }

.status-badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: var(--radius-full);
    font-size: var(--font-size-xs);
    font-weight: 500;
}

.status-progress {
    background: #DBEAFE;
    color: var(--primary);
}

.status-completed {
    background: #D1FAE5;
    color: var(--success);
}

.status-terminated {
    background: #FEE2E2;
    color: var(--error);
}

.history-card-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: var(--space-md);
    border-top: 1px solid var(--border);
}

.scenario-tag {
    display: inline-block;
    padding: 4px 12px;
    background: var(--bg-light);
    border-radius: var(--radius-full);
    font-size: var(--font-size-xs);
    color: var(--text-secondary);
}

.history-actions-inline {
    display: flex;
    gap: var(--space-xs);
}

.btn-icon {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: none;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-icon:hover {
    background: var(--bg-light);
    color: var(--primary);
    border-color: var(--primary-light);
}

.btn-icon.delete-btn:hover {
    color: var(--error);
    border-color: var(--error);
}

.history-actions {
    text-align: center;
    margin-top: var(--space-xl);
    padding-top: var(--space-lg);
    border-top: 1px solid var(--border);
}

.btn-danger {
    background: var(--error);
    color: white;
}

.btn-danger:hover {
    background: #DC2626;
}

/* History Modal */
.modal-large {
    max-width: 95vw;
    width: 1000px;
    max-height: 90vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

@media (min-width: 1400px) {
    .modal-large {
        width: 1100px;
    }
}

@media (max-width: 1024px) {
    .modal-large {
        width: 90vw;
    }
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-bottom: var(--space-md);
    border-bottom: 1px solid var(--border);
    margin-bottom: var(--space-md);
}

.modal-close {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: none;
    border: none;
    font-size: 24px;
    color: var(--text-muted);
    cursor: pointer;
}

.modal-close:hover {
    color: var(--text-primary);
}

.modal-body {
    flex: 1;
    overflow-y: auto;
    padding-right: var(--space-sm);
}

.detail-section {
    margin-bottom: var(--space-lg);
}

.detail-section h3 {
    font-size: var(--font-size-sm);
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: var(--space-sm);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.detail-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: var(--space-md);
}

.detail-item {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.detail-item label {
    font-size: var(--font-size-xs);
    color: var(--text-muted);
}

.detail-item span {
    font-size: var(--font-size-sm);
    color: var(--text-primary);
}

.score-display {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-md);
    padding: var(--space-lg);
    background: var(--bg-light);
    border-radius: var(--radius-lg);
    margin-bottom: var(--space-md);
}

.score-display .score-circle {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: var(--primary);
    color: white;
}

.score-display .score-circle.grade-a { background: var(--success); }
.score-display .score-circle.grade-b { background: var(--primary); }
.score-display .score-circle.grade-c { background: var(--warning); }
.score-display .score-circle.grade-d { background: var(--grade-d); }
.score-display .score-circle.grade-f { background: var(--error); }

.score-display .score-number {
    font-size: 24px;
    font-weight: 700;
    line-height: 1;
}

.score-display .score-total {
    font-size: var(--font-size-xs);
    opacity: 0.8;
}

.score-grade-large {
    font-size: 48px;
    font-weight: 700;
    color: var(--text-primary);
}

.summary-text {
    color: var(--text-secondary);
    line-height: 1.6;
}

.conversation-list {
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
    max-height: 300px;
    overflow-y: auto;
}

.conv-message {
    padding: var(--space-sm) var(--space-md);
    border-radius: var(--radius-md);
}

.conv-user {
    background: var(--primary);
    color: white;
    margin-left: 20%;
}

.conv-ai {
    background: var(--bg-light);
    margin-right: 20%;
}

.conv-sender {
    font-size: var(--font-size-xs);
    font-weight: 500;
    margin-bottom: 2px;
    opacity: 0.8;
}

.conv-content {
    font-size: var(--font-size-sm);
    line-height: 1.5;
    white-space: pre-wrap;
}

.conv-time {
    font-size: 10px;
    opacity: 0.6;
    margin-top: 4px;
    text-align: right;
}

/* Responsive adjustments for history */
@media (max-width: 640px) {
    .history-card-header {
        flex-direction: column;
    }

    .history-score {
        flex-direction: row;
        gap: var(--space-sm);
    }

    .detail-grid {
        grid-template-columns: 1fr;
    }

    .conv-user {
        margin-left: 10%;
    }

    .conv-ai {
        margin-right: 10%;
    }
}

/* ==================== Detailed Evaluation Table ==================== */
.evaluation-table {
    display: flex;
    flex-direction: column;
    gap: var(--space-md);
}

.eval-dimension {
    background: var(--bg-white);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    overflow: hidden;
}

.eval-dimension-header {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    padding: var(--space-md);
    background: var(--bg-light);
    border-bottom: 1px solid var(--border);
}

.eval-dim-number {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    background: var(--primary);
    color: white;
    border-radius: var(--radius-full);
    font-size: var(--font-size-xs);
    font-weight: 600;
}

.eval-dim-name {
    flex: 1;
    font-weight: 600;
    color: var(--text-primary);
}

.eval-dim-score {
    font-weight: 600;
    color: var(--primary);
    font-size: var(--font-size-md);
}

.eval-sub-items {
    padding: var(--space-md);
    display: flex;
    flex-direction: column;
    gap: var(--space-md);
}

.eval-sub-item {
    padding-bottom: var(--space-md);
    border-bottom: 1px solid var(--border);
}

.eval-sub-item:last-child {
    padding-bottom: 0;
    border-bottom: none;
}

.sub-item-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--space-xs);
}

.sub-item-name {
    font-size: var(--font-size-sm);
    color: var(--text-primary);
}

.sub-item-score {
    font-weight: 600;
    font-size: var(--font-size-sm);
    padding: 2px 8px;
    border-radius: var(--radius-sm);
}

.sub-item-score.score-high {
    background: rgba(16, 185, 129, 0.1);
    color: var(--success);
}

.sub-item-score.score-medium {
    background: rgba(245, 158, 11, 0.1);
    color: var(--warning);
}

.sub-item-score.score-low {
    background: rgba(239, 68, 68, 0.1);
    color: var(--error);
}

.sub-item-bar {
    height: 4px;
    background: var(--border);
    border-radius: var(--radius-full);
    margin-bottom: var(--space-sm);
    overflow: hidden;
}

.sub-item-fill {
    height: 100%;
    border-radius: var(--radius-full);
    transition: width 0.5s ease;
}

.sub-item-fill.score-high {
    background: var(--success);
}

.sub-item-fill.score-medium {
    background: var(--warning);
}

.sub-item-fill.score-low {
    background: var(--error);
}

.sub-item-eval {
    font-size: var(--font-size-xs);
    color: var(--text-secondary);
    line-height: 1.5;
    margin: 0;
}

/* Penalties Section */
.penalties-section {
    margin-top: var(--space-md);
    padding: var(--space-md);
    background: rgba(239, 68, 68, 0.05);
    border: 1px solid rgba(239, 68, 68, 0.2);
    border-radius: var(--radius-lg);
}

.penalty-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--space-sm);
}

.penalty-title {
    font-weight: 600;
    color: var(--error);
}

.penalty-score {
    font-weight: 700;
    color: var(--error);
    font-size: var(--font-size-md);
}

.penalty-detail {
    font-size: var(--font-size-sm);
    color: var(--text-secondary);
    margin: 0;
}

/* Mobile responsive for evaluation table */
@media (max-width: 640px) {
    .eval-dimension-header {
        flex-wrap: wrap;
    }

    .eval-dim-score {
        width: 100%;
        text-align: right;
        margin-top: var(--space-xs);
    }
}

/* ==================== History Detail Evaluation Styles ==================== */
.history-eval-table {
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
}

.history-eval-dimension {
    background: var(--bg-light);
    border-radius: var(--radius-md);
    overflow: hidden;
}

.history-dim-header {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    padding: var(--space-sm) var(--space-md);
    background: var(--bg-white);
    border-bottom: 1px solid var(--border);
}

.history-dim-number {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    background: var(--primary);
    color: white;
    border-radius: var(--radius-full);
    font-size: 11px;
    font-weight: 600;
    flex-shrink: 0;
}

.history-dim-name {
    flex: 1;
    font-weight: 600;
    font-size: var(--font-size-sm);
    color: var(--text-primary);
}

.history-dim-score {
    font-weight: 600;
    color: var(--primary);
    font-size: var(--font-size-sm);
}

.history-sub-items {
    padding: var(--space-sm) var(--space-md);
}

.history-sub-item {
    padding: var(--space-xs) 0;
    border-bottom: 1px solid var(--border);
}

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

.history-sub-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2px;
}

.history-sub-name {
    font-size: var(--font-size-xs);
    color: var(--text-primary);
}

.history-sub-score {
    font-weight: 600;
    font-size: var(--font-size-xs);
    padding: 1px 6px;
    border-radius: var(--radius-sm);
}

.history-sub-score.score-high {
    background: rgba(16, 185, 129, 0.1);
    color: var(--success);
}

.history-sub-score.score-medium {
    background: rgba(245, 158, 11, 0.1);
    color: var(--warning);
}

.history-sub-score.score-low {
    background: rgba(239, 68, 68, 0.1);
    color: var(--error);
}

.history-sub-eval {
    font-size: 11px;
    color: var(--text-secondary);
    line-height: 1.4;
    margin: 0;
}

.history-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.history-list li {
    padding: var(--space-xs) 0;
    padding-left: var(--space-md);
    position: relative;
    font-size: var(--font-size-sm);
    color: var(--text-primary);
    line-height: 1.5;
}

.history-list li::before {
    content: '';
    position: absolute;
    left: 0;
    top: 10px;
    width: 6px;
    height: 6px;
    border-radius: 50%;
}

.highlight-list li::before {
    background: var(--success);
}

.improvement-list li::before {
    background: var(--warning);
}

/* History Modal Responsive */
@media (max-width: 768px) {
    .modal-large {
        width: 100%;
        max-width: 100%;
        max-height: 100vh;
        border-radius: 0;
        margin: 0;
    }

    .modal-content {
        border-radius: var(--radius-lg) var(--radius-lg) 0 0;
        max-height: 90vh;
    }

    .modal-body {
        padding-right: 0;
    }

    .detail-grid {
        grid-template-columns: 1fr;
        gap: var(--space-sm);
    }

    .history-dim-header {
        flex-wrap: wrap;
    }

    .history-dim-score {
        width: 100%;
        text-align: right;
        margin-top: var(--space-xs);
    }

    .score-display {
        flex-direction: column;
    }

    .conv-user {
        margin-left: 5%;
    }

    .conv-ai {
        margin-right: 5%;
    }
}

@media (max-width: 480px) {
    .modal-content {
        padding: var(--space-md);
    }

    .history-sub-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 2px;
    }

    .history-sub-score {
        align-self: flex-end;
    }
}

/* ==================== Reveal Info Section ==================== */
/* 揭示信息区域样式（revealed_after 动态变量） */

.reveal-section {
    border: 2px dashed var(--info);
    background: linear-gradient(135deg, #eff6ff 0%, #f0fdf4 100%);
}

.reveal-title {
    color: var(--info);
}

.reveal-intro {
    color: var(--text-secondary);
    font-size: var(--font-size-sm);
    margin-bottom: var(--space-md);
    padding: var(--space-sm) var(--space-md);
    background: rgba(59, 130, 246, 0.1);
    border-radius: var(--radius-md);
}

.reveal-content {
    display: flex;
    flex-direction: column;
    gap: var(--space-md);
}

.reveal-card {
    background: var(--bg-white);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: var(--space-lg);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.reveal-card-title {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    font-size: var(--font-size-base);
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: var(--space-md);
    padding-bottom: var(--space-sm);
    border-bottom: 1px solid var(--border);
}

.reveal-icon {
    font-size: 1.2em;
}

.reveal-description {
    color: var(--text-secondary);
    margin-bottom: var(--space-sm);
    line-height: 1.6;
}

.reveal-meta {
    margin-bottom: var(--space-md);
}

.reveal-tag {
    display: inline-block;
    padding: var(--space-xs) var(--space-sm);
    background: var(--bg-light);
    border-radius: var(--radius-full);
    font-size: var(--font-size-xs);
    color: var(--text-secondary);
}

.reveal-hint {
    color: var(--text-secondary);
    font-style: italic;
    margin-bottom: var(--space-md);
    padding: var(--space-sm);
    background: #fef3c7;
    border-radius: var(--radius-sm);
    border-left: 3px solid var(--warning);
}

.reveal-list {
    margin-bottom: var(--space-md);
}

.reveal-list h4 {
    font-size: var(--font-size-sm);
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: var(--space-xs);
}

.reveal-list ul {
    list-style: disc;
    padding-left: var(--space-lg);
    color: var(--text-secondary);
    font-size: var(--font-size-sm);
}

.reveal-list ul li {
    margin-bottom: var(--space-xs);
    line-height: 1.5;
}

.reveal-actor-info p {
    margin-bottom: var(--space-xs);
    font-size: var(--font-size-sm);
    color: var(--text-secondary);
}

.reveal-actor-info p strong {
    color: var(--text-primary);
}

.reveal-notes {
    display: flex;
    flex-direction: column;
    gap: var(--space-md);
}

.reveal-note {
    padding: var(--space-md);
    background: var(--bg-light);
    border-radius: var(--radius-md);
    border-left: 3px solid var(--primary);
}

.note-context {
    font-weight: 600;
    color: var(--primary);
    margin-bottom: var(--space-xs);
    font-size: var(--font-size-sm);
}

.note-detail,
.note-test {
    font-size: var(--font-size-sm);
    color: var(--text-secondary);
    margin-bottom: var(--space-xs);
    line-height: 1.5;
}

.note-detail strong,
.note-test strong {
    color: var(--text-primary);
}

/* Dynamic content styles */
.reveal-dynamic-content {
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
}

.reveal-field {
    font-size: var(--font-size-sm);
    color: var(--text-secondary);
    margin: 0;
    line-height: 1.5;
}

.reveal-field strong {
    color: var(--text-primary);
}

.reveal-nested {
    margin-top: var(--space-sm);
    padding-left: var(--space-md);
    border-left: 2px solid var(--border);
}

.reveal-nested h4 {
    font-size: var(--font-size-sm);
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: var(--space-xs);
}

/* Responsive for reveal section */
@media (max-width: 640px) {
    .reveal-card {
        padding: var(--space-md);
    }

    .reveal-card-title {
        font-size: var(--font-size-sm);
    }

    .reveal-list ul {
        padding-left: var(--space-md);
    }
}

/* ==================== Coach Notice (实时辅导提示) ==================== */
.coach-notice {
    position: fixed;
    bottom: 100px;
    left: 50%;
    transform: translateX(-50%);
    max-width: 90%;
    width: auto;
    padding: 8px 16px;
    background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
    border: 1px solid #f59e0b;
    border-radius: var(--radius-lg);
    box-shadow: 0 4px 12px rgba(245, 158, 11, 0.25);
    z-index: 50;
    display: none;
    align-items: center;
    gap: 8px;
    animation: coachSlideIn 0.3s ease;
}

.coach-notice.visible {
    display: flex;
}

@keyframes coachSlideIn {
    from {
        opacity: 0;
        transform: translateX(-50%) translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateX(-50%) translateY(0);
    }
}

.coach-notice-icon {
    width: 20px;
    height: 20px;
    background: #f59e0b;
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: bold;
    flex-shrink: 0;
}

.coach-notice-text {
    font-size: 13px;
    color: #78350f;
    line-height: 1.4;
    flex: 1;
}

.coach-notice-close {
    width: 18px;
    height: 18px;
    background: none;
    border: none;
    color: #92400e;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    opacity: 0.6;
    flex-shrink: 0;
}

.coach-notice-close:hover {
    opacity: 1;
}

/* 大屏幕上居中对齐chat-container */
@media (min-width: 1024px) {
    .coach-notice {
        max-width: 600px;
    }
}

/* 手机上全宽 */
@media (max-width: 640px) {
    .coach-notice {
        bottom: 90px;
        left: 10px;
        right: 10px;
        transform: none;
        max-width: none;
        padding: 6px 12px;
    }

    .coach-notice-text {
        font-size: 12px;
    }
}
