:root {
    --bg-primary: #ffffff;
    --bg-secondary: #f8fafc;
    --bg-card: #ffffff;
    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --border-color: #e2e8f0;
    --accent-color: #3b82f6;
    --accent-hover: #2563eb;
    --success-color: #10b981;
    --error-color: #ef4444;
    --warning-color: #f59e0b;
    --shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
    /* 统一视觉参数（便于移动端与主题同步调整） */
    --radius-card: 16px;
    --radius-control: 10px;
    --ring: 0 0 0 3px rgba(59, 130, 246, 0.18);
    --focus-outline: rgba(59, 130, 246, 0.55);
    --tap-min: 44px;
}

[data-theme="dark"] {
    /* 深色主题：页面背景更深、卡片更亮一档，形成层次 */
    --bg-primary: #0b1220;
    --bg-secondary: #0f172a;
    --bg-card: #111b2f;
    --text-primary: #f1f5f9;
    --text-secondary: #94a3b8;
    --border-color: #223047;
    --accent-color: #60a5fa;
    --accent-hover: #3b82f6;
    --shadow: 0 4px 6px -1px rgb(0 0 0 / 0.3);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.4);
    --ring: 0 0 0 3px rgba(96, 165, 250, 0.22);
    --focus-outline: rgba(96, 165, 250, 0.65);
}

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

html {
    -webkit-text-size-adjust: 100%;
    text-rendering: optimizeLegibility;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    /* 轻微光晕提升层次，移动端也更“干净” */
    background:
        radial-gradient(1200px 700px at 18% -12%, rgba(59, 130, 246, 0.14), transparent 60%),
        radial-gradient(900px 520px at 85% -5%, rgba(139, 92, 246, 0.12), transparent 55%),
        var(--bg-secondary);
    color: var(--text-primary);
    min-height: 100vh;
    min-height: 100dvh;
    transition: background 0.3s, color 0.3s;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

.container {
    max-width: 900px;
    margin: 0 auto;
    padding: 2rem 1rem;
    /* iOS 安全区适配 */
    padding-top: 2rem;
    padding-top: calc(2rem + env(safe-area-inset-top));
    padding-bottom: 2rem;
    padding-bottom: calc(2rem + env(safe-area-inset-bottom));
}

/* Header */
header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.logo {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    min-width: 0;
}

.logo-icon {
    width: 40px;
    height: 40px;
    border-radius: 12px;
    background-color: transparent;
    background-image: url("/static/logo.png");
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    box-shadow: var(--shadow);
    flex-shrink: 0;
}

.logo h1 {
    font-size: 1.5rem;
    font-weight: 600;
    line-height: 1.15;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.theme-toggle {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 0.5rem;
    cursor: pointer;
    color: var(--text-primary);
    transition: all 0.2s;
}

.theme-toggle:hover {
    background: var(--border-color);
}

/* Main Card */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-card);
    padding: 1.5rem;
    box-shadow: var(--shadow);
    margin-bottom: 1.5rem;
}

.card-title {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 1rem;
    color: var(--text-primary);
}

/* Input */
.input-group {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.input-single {
    flex: 1;
    min-width: 0;
    padding: 0.875rem 1rem; /* 移除右侧随机按钮的额外填充 */
    border: 1px solid var(--border-color);
    border-radius: var(--radius-control);
    font-size: 1rem;
    background: var(--bg-secondary);
    color: var(--text-primary);
    transition: border-color 0.2s, box-shadow 0.2s;
    min-height: var(--tap-min); /* 确保点击区域足够大 */
}

.input-single:focus {
    outline: none;
    border-color: var(--accent-color);
    box-shadow: var(--ring);
}



/* Button */
.btn-primary {
    width: 100%;
    padding: 0.875rem 1.5rem;
    background: var(--accent-color);
    color: white;
    border: none;
    border-radius: var(--radius-control);
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.2s, transform 0.1s;
    /* margin-top: 1rem; */ /* 随新结构调整，这里不再需要 */
    min-height: var(--tap-min);
    touch-action: manipulation;
}

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

.btn-primary:active {
    transform: scale(0.98);
}

.btn-primary:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* Secondary Button - 新增用于随机按钮 */
.btn-secondary {
    padding: 0.5rem 1rem;
    border: 1px solid var(--border-color);
    background: var(--bg-card);
    border-radius: var(--radius-control);
    font-size: 0.875rem;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s;
    min-height: var(--tap-min);
    touch-action: manipulation;
    display: flex; /* 让图标和文字居中 */
    align-items: center;
    justify-content: center;
    gap: 0.3rem; /* 图标和文字间距 */
}

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

.btn-secondary:active {
    transform: scale(0.98);
}

.btn-secondary:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.input-group .btn-secondary {
    flex-shrink: 0;
}

/* 移除旧的 input-random-btn 样式 */
.input-random-btn {
    display: none;
}


/* Results */
.results-container {
    display: none;
}

.results-container.visible {
    display: block;
}

.result-item {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    margin-bottom: 1rem;
    overflow: hidden;
}

.result-header {
    padding: 1rem;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.result-input {
    font-family: 'SF Mono', Monaco, 'Courier New', monospace;
    font-size: 0.9rem;
    color: var(--accent-color);
    font-weight: 500;
}

.result-status {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.8rem;
}

.result-header-right {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
    row-gap: 0.5rem;
}

.btn-feedback {
    padding: 0.35rem 0.75rem;
    border-radius: 999px;
    border: none;
    background: var(--accent-color);
    font-size: 0.8rem;
    font-weight: 500;
    color: #ffffff;
    cursor: pointer;
    transition: all 0.2s;
    box-shadow: 0 2px 4px rgba(59, 130, 246, 0.3);
    min-height: 36px;
    touch-action: manipulation;
}

.btn-feedback:hover {
    background: var(--accent-hover);
    box-shadow: 0 4px 8px rgba(59, 130, 246, 0.4);
    transform: translateY(-1px);
}

.btn-feedback:active {
    transform: translateY(0);
    box-shadow: 0 2px 4px rgba(59, 130, 246, 0.3);
}

.btn-copy-debug {
    padding: 0.35rem 0.75rem;
    border-radius: 999px;
    border: none;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s;
    min-height: 36px;
    touch-action: manipulation;
}

.btn-copy-debug:hover {
    background: var(--border-color);
    color: var(--text-primary);
}

.btn-copy-debug:active {
    transform: scale(0.97);
}

.btn-copy-debug.copied {
    background: var(--success-color);
    border-color: var(--success-color);
    color: white;
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
}

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

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

.status-warning {
    background: var(--warning-color);
}

.result-body {
    padding: 1rem;
}

.feedback-panel {
    display: none;
    padding: 0.75rem 1rem 1rem;
    border-top: 1px dashed var(--border-color);
    background: var(--bg-secondary);
}

.feedback-panel.visible {
    display: block;
}

.feedback-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.feedback-header button {
    border: none;
    background: transparent;
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 0.9rem;
}

.feedback-header button:hover {
    color: var(--text-primary);
}

.feedback-textarea {
    width: 100%;
    min-height: 60px;
    resize: vertical;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    padding: 0.5rem 0.75rem;
    font-size: 0.85rem;
    font-family: inherit;
    background: var(--bg-card);
    color: var(--text-primary);
    box-sizing: border-box;
}

.feedback-textarea:focus {
    outline: none;
    border-color: var(--accent-color);
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.15);
}

.feedback-actions {
    margin-top: 0.5rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    justify-content: space-between;
}

.feedback-submit-btn {
    padding: 0.3rem 0.9rem;
    border-radius: 999px;
    border: none;
    background: var(--accent-color);
    color: #ffffff;
    font-size: 0.8rem;
    cursor: pointer;
    transition: background 0.2s, transform 0.1s;
    min-height: 32px;
    touch-action: manipulation;
}

.feedback-submit-btn:hover {
    background: var(--accent-hover);
}

.feedback-submit-btn:active {
    transform: scale(0.97);
}

.feedback-submit-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.feedback-status {
    font-size: 0.75rem;
    color: var(--text-secondary);
}

.feedback-status.success {
    color: var(--success-color);
}

.feedback-status.error {
    color: var(--error-color);
}

.result-section {
    margin-bottom: 1rem;
}

.result-section:last-child {
    margin-bottom: 0;
}

.section-title {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
}

.info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 0.75rem;
}

.info-item {
    background: var(--bg-secondary);
    padding: 0.75rem;
    border-radius: 8px;
}

.info-label {
    font-size: 0.7rem;
    color: var(--text-secondary);
    margin-bottom: 0.25rem;
}

.info-value {
    font-size: 0.95rem;
    font-weight: 500;
}

.abnormality-card {
    background: var(--bg-secondary);
    border-radius: 10px;
    padding: 1rem;
    margin-bottom: 0.75rem;
}

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

.clone-groups {
    display: flex;
    flex-direction: column;
    gap: 0.9rem;
}

.clone-group {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 0.75rem;
}

.clone-header {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.6rem;
}

.clone-empty {
    font-size: 0.85rem;
    color: var(--text-secondary);
    padding: 0.6rem 0;
    border-top: 1px dashed var(--border-color);
}

.abn-type {
    display: inline-block;
    padding: 0.25rem 0.5rem;
    background: var(--accent-color);
    color: white;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 500;
    margin-bottom: 0.5rem;
}

.abn-notation {
    font-family: 'SF Mono', Monaco, 'Courier New', monospace;
    font-size: 0.9rem;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
}

.abn-description {
    font-size: 0.9rem;
    color: var(--text-secondary);
    line-height: 1.5;
}

.abn-coords, .abn-cn {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
    font-family: 'SF Mono', Monaco, 'Courier New', monospace;
}

.interpretation {
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.1), rgba(139, 92, 246, 0.1));
    border-radius: 10px;
    padding: 1rem;
    font-size: 0.95rem;
    line-height: 1.6;
}

/* 解读口径切换（专业/通俗） */
body[data-interpretation-audience="public"] .interpretation-professional {
    display: none;
}

body[data-interpretation-audience="professional"] .interpretation-public {
    display: none;
}

.interpretation-details {
    margin-top: 0.75rem;
}

.interpretation-details summary {
    cursor: pointer;
    font-size: 0.8rem;
    color: var(--accent-color);
    user-select: none;
}

.interpretation-details summary:hover {
    color: var(--accent-hover);
}

.interpretation-embedded {
    margin-top: 0.5rem;
    background: var(--bg-primary);
    border: 1px dashed var(--border-color);
    border-radius: 10px;
}

.interpretation-paragraph {
    margin: 0;
    line-height: 1.65;
}

.interpretation-paragraph + .interpretation-paragraph {
    margin-top: 0.6rem;
}

.interpretation-section {
    margin-top: 0.85rem;
}

.interpretation-section-title {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 0.35rem;
}

.interpretation-label {
    font-weight: 600;
}

.interpretation-points {
    margin: 0;
    padding-left: 1.15rem;
    color: var(--text-primary);
}

.interpretation-points li {
    margin: 0.25rem 0;
}

.interpretation-suggestion .interpretation-paragraph {
    color: var(--text-primary);
}

.interpretation-disclaimer .interpretation-paragraph {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.warnings {
    background: rgba(245, 158, 11, 0.1);
    border-left: 3px solid var(--warning-color);
    border-radius: 0 8px 8px 0;
    padding: 0.75rem 1rem;
    font-size: 0.85rem;
    color: var(--warning-color);
}

.info-note {
    background: rgba(59, 130, 246, 0.08);
    border-left: 3px solid var(--accent-color);
    border-radius: 0 8px 8px 0;
    padding: 0.75rem 1rem;
    font-size: 0.85rem;
    color: var(--accent-color);
    margin-top: 0.5rem;
}

/* 备选诊断可能（or 连接） */
.alternatives-section {
    border: 1px dashed rgba(96, 165, 250, 0.4);
    border-radius: 12px;
    padding: 1rem;
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.05), rgba(147, 51, 234, 0.05));
}

.alternatives-hint {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-bottom: 1rem;
    font-style: italic;
}

.alternative-card {
    background: var(--bg-secondary);
    border-radius: 10px;
    padding: 1rem;
    margin-bottom: 0.75rem;
    border-left: 3px solid rgba(147, 51, 234, 0.6);
}

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

.alt-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 0.75rem;
    flex-wrap: wrap;
}

.alt-label {
    display: inline-block;
    padding: 0.2rem 0.5rem;
    background: linear-gradient(135deg, #8b5cf6, #6366f1);
    color: white;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 600;
}

.alt-input {
    font-family: 'SF Mono', Monaco, 'Courier New', monospace;
    font-size: 0.9rem;
    color: var(--accent-color);
    font-weight: 500;
}

.alt-abnormalities {
    margin-top: 0.5rem;
}

.alt-abn-item {
    padding: 0.5rem 0;
    border-top: 1px solid var(--border-color);
}

.alt-abn-item:first-child {
    border-top: none;
    padding-top: 0;
}

.alt-abn-notation {
    font-family: 'SF Mono', Monaco, 'Courier New', monospace;
    font-size: 0.85rem;
    color: var(--text-primary);
    margin-left: 0.5rem;
}

.alt-abn-desc {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-top: 0.25rem;
    line-height: 1.4;
}

.alt-error {
    color: var(--error-color);
    font-size: 0.85rem;
    margin-top: 0.5rem;
}

/* 综合征提示卡片 */
.syndrome-card {
    background: linear-gradient(135deg, rgba(168, 85, 247, 0.12), rgba(236, 72, 153, 0.12));
    border: 1px solid rgba(168, 85, 247, 0.3);
    border-radius: 12px;
    padding: 1rem 1.25rem;
    margin-bottom: 1rem;
}

.syndrome-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
    font-size: 0.8rem;
    color: var(--text-secondary);
    font-weight: 500;
}

.syndrome-header-icon {
    font-size: 1rem;
}

.syndrome-name-cn {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.25rem;
}

.syndrome-name-en {
    font-size: 0.9rem;
    color: var(--text-secondary);
    font-style: italic;
    margin-bottom: 0.75rem;
}

.syndrome-tags {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.syndrome-tag {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.25rem 0.6rem;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 500;
}

.syndrome-tag.mosaic {
    background: rgba(245, 158, 11, 0.15);
    color: #d97706;
    border: 1px solid rgba(245, 158, 11, 0.3);
}

.syndrome-tag.non-mosaic {
    background: rgba(16, 185, 129, 0.15);
    color: #059669;
    border: 1px solid rgba(16, 185, 129, 0.3);
}

.syndrome-tag.suggested {
    background: rgba(99, 102, 241, 0.15);
    color: #6366f1;
    border: 1px solid rgba(99, 102, 241, 0.3);
}

.syndrome-tag.confirmed {
    background: rgba(168, 85, 247, 0.15);
    color: #9333ea;
    border: 1px solid rgba(168, 85, 247, 0.3);
}

/* clinical_markers 置信度（high/medium/low） */
.syndrome-tag.high {
    background: rgba(16, 185, 129, 0.15);
    color: #059669;
    border: 1px solid rgba(16, 185, 129, 0.3);
}

.syndrome-tag.medium {
    background: rgba(245, 158, 11, 0.15);
    color: #d97706;
    border: 1px solid rgba(245, 158, 11, 0.3);
}

.syndrome-tag.low {
    background: rgba(100, 116, 139, 0.12);
    color: #64748b;
    border: 1px solid rgba(100, 116, 139, 0.3);
}

/* 临床提示通用卡片（非综合征场景预留） */
.marker-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 1rem 1.25rem;
    margin-bottom: 1rem;
}

/* 分子事件（molecular_findings）展示 */
.molecular-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 1rem 1.25rem;
    margin-bottom: 0.75rem;
}

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

.molecular-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
    flex-wrap: wrap;
}

.molecular-tags {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.molecular-tag {
    display: inline-flex;
    align-items: center;
    padding: 0.2rem 0.55rem;
    border-radius: 999px;
    font-size: 0.75rem;
    border: 1px solid rgba(59, 130, 246, 0.25);
    background: rgba(59, 130, 246, 0.08);
    color: var(--accent-color);
}

.molecular-title {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.35rem;
}

.molecular-subtitle {
    font-size: 0.85rem;
    color: var(--text-secondary);
    line-height: 1.5;
}

/* 临床提示分组展示 */
.marker-group {
    margin-bottom: 1rem;
}

.marker-group:last-child {
    margin-bottom: 0;
}

.marker-group-title {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
    display: flex;
    align-items: center;
    gap: 0.35rem;
}

.marker-group-title .count {
    font-weight: normal;
    opacity: 0.85;
}

.marker-evidence-summary {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-top: 0.5rem;
    line-height: 1.5;
}

.marker-evidence-details {
    margin-top: 0.5rem;
}

.marker-evidence-details summary {
    cursor: pointer;
    font-size: 0.8rem;
    color: var(--accent-color);
    user-select: none;
}

.marker-evidence-details summary:hover {
    color: var(--accent-hover);
}

.marker-note {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-top: 0.5rem;
    line-height: 1.5;
}

.marker-evidence {
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin-top: 0.5rem;
    font-family: 'SF Mono', Monaco, 'Courier New', monospace;
    white-space: pre-wrap;
    background: var(--bg-primary);
    border: 1px dashed var(--border-color);
    border-radius: 8px;
    padding: 0.5rem 0.75rem;
}

.syndrome-tag.kind {
    background: rgba(100, 116, 139, 0.12);
    color: var(--text-secondary);
    border: 1px solid rgba(100, 116, 139, 0.3);
}

[data-theme="dark"] .syndrome-card {
    background: linear-gradient(135deg, rgba(168, 85, 247, 0.15), rgba(236, 72, 153, 0.15));
    border-color: rgba(168, 85, 247, 0.4);
}

[data-theme="dark"] .syndrome-tag.mosaic {
    background: rgba(245, 158, 11, 0.2);
    color: #fbbf24;
}

[data-theme="dark"] .syndrome-tag.non-mosaic {
    background: rgba(16, 185, 129, 0.2);
    color: #34d399;
}

[data-theme="dark"] .syndrome-tag.suggested {
    background: rgba(99, 102, 241, 0.2);
    color: #818cf8;
}

[data-theme="dark"] .syndrome-tag.confirmed {
    background: rgba(168, 85, 247, 0.2);
    color: #c084fc;
}

[data-theme="dark"] .syndrome-tag.high {
    background: rgba(16, 185, 129, 0.2);
    color: #34d399;
}

[data-theme="dark"] .syndrome-tag.medium {
    background: rgba(245, 158, 11, 0.2);
    color: #fbbf24;
}

[data-theme="dark"] .syndrome-tag.low {
    background: rgba(100, 116, 139, 0.2);
    color: #cbd5e1;
}

.error-message {
    background: rgba(239, 68, 68, 0.1);
    border-left: 3px solid var(--error-color);
    border-radius: 0 8px 8px 0;
    padding: 0.75rem 1rem;
    font-size: 0.85rem;
    color: var(--error-color);
}

/* AI 验证区域 - 默认隐藏，点击验证后显示 */
.ai-verify-section {
    display: none;
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px dashed var(--border-color);
}

.ai-verify-section.visible {
    display: block;
}

.btn-ai-verify {
    padding: 0.35rem 0.75rem;
    border-radius: 999px;
    border: none;
    background: linear-gradient(135deg, #8b5cf6, #3b82f6);
    color: white;
    font-size: 0.8rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    box-shadow: 0 2px 4px rgba(139, 92, 246, 0.3);
    min-height: 36px;
    touch-action: manipulation;
}

.btn-ai-verify:hover:not(:disabled) {
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(139, 92, 246, 0.4);
}

.btn-ai-verify:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.btn-ai-verify.verified {
    background: var(--text-secondary);
}

.btn-ai-verify.error {
    background: var(--error-color);
}

.ai-result {
    background: linear-gradient(135deg, rgba(139, 92, 246, 0.1), rgba(59, 130, 246, 0.1));
    border-radius: 10px;
    padding: 1rem;
    margin-top: 0.75rem;
    font-size: 0.95rem;
    line-height: 1.6;
    min-height: 2.5rem;
    display: none;
}

.ai-result.visible {
    display: block;
}

.ai-result.error {
    background: rgba(239, 68, 68, 0.1);
    color: var(--error-color);
}

/* AI 免责声明 */
.ai-disclaimer {
    display: none;
    margin-top: 0.5rem;
    padding: 0.5rem 0.75rem;
    font-size: 0.75rem;
    color: var(--text-secondary);
    background: var(--bg-secondary);
    border-radius: 6px;
    line-height: 1.4;
}

.ai-disclaimer.visible {
    display: block;
}

/* 打字机光标 */
.ai-cursor {
    display: inline-block;
    width: 2px;
    height: 1.1em;
    background: var(--accent-color);
    margin-left: 2px;
    vertical-align: text-bottom;
    animation: blink 0.8s infinite;
}

@keyframes blink {
    0%, 50% {
        opacity: 1;
    }
    51%, 100% {
        opacity: 0;
    }
}

/* Summary */
.summary {
    display: flex;
    gap: 1rem;
    padding: 1rem;
    background: var(--bg-secondary);
    border-radius: 10px;
    margin-bottom: 1rem;
}

.summary-item {
    text-align: center;
    flex: 1;
}

.summary-value {
    font-size: 1.5rem;
    font-weight: 600;
}

.summary-label {
    font-size: 0.75rem;
    color: var(--text-secondary);
}

/* Loading */
.loading {
    display: none;
    text-align: center;
    padding: 2rem;
}

.loading.visible {
    display: block;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--border-color);
    border-top-color: var(--accent-color);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin: 0 auto 1rem;
}

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

/* Footer */
footer {
    text-align: center;
    padding: 2rem;
    color: var(--text-secondary);
    font-size: 0.85rem;
}

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

/* History Panel */
.header-actions {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.btn-icon {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 0.5rem;
    cursor: pointer;
    color: var(--text-primary);
    transition: all 0.2s;
    position: relative;
    min-height: var(--tap-min);
    min-width: var(--tap-min);
    touch-action: manipulation;
}

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

.btn-icon .badge {
    position: absolute;
    top: -4px;
    right: -4px;
    background: var(--accent-color);
    color: white;
    font-size: 0.65rem;
    min-width: 16px;
    height: 16px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
}

.history-panel {
    position: fixed;
    top: 0;
    right: -400px;
    width: 400px;
    max-width: 100vw;
    height: 100vh;
    height: 100dvh;
    background: var(--bg-card);
    border-left: 1px solid var(--border-color);
    box-shadow: var(--shadow-lg);
    z-index: 1000;
    transition: right 0.3s ease;
    display: flex;
    flex-direction: column;
}

.history-panel.visible {
    right: 0;
}

.history-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.3);
    z-index: 999;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s, visibility 0.3s;
}

.history-overlay.visible {
    opacity: 1;
    visibility: visible;
}

.history-header {
    padding: 1rem 1.25rem;
    padding-top: 1rem;
    padding-top: calc(1rem + env(safe-area-inset-top));
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0;
}

.history-title {
    font-size: 1rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.history-count {
    font-size: 0.75rem;
    color: var(--text-secondary);
    font-weight: normal;
}

.history-actions {
    display: flex;
    gap: 0.5rem;
}

.btn-small {
    padding: 0.4rem 0.75rem;
    border: 1px solid var(--border-color);
    background: var(--bg-secondary);
    color: var(--text-secondary);
    font-size: 0.75rem;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
    min-height: 32px;
    touch-action: manipulation;
}

.btn-small:hover {
    background: var(--border-color);
    color: var(--text-primary);
}

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

.btn-close {
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 0.25rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

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

.history-list {
    flex: 1;
    overflow-y: auto;
    padding: 0.75rem;
    padding-bottom: 0.75rem;
    padding-bottom: calc(0.75rem + env(safe-area-inset-bottom));
}

.history-empty {
    text-align: center;
    padding: 3rem 1rem;
    color: var(--text-secondary);
}

.history-empty-icon {
    font-size: 2.5rem;
    margin-bottom: 0.75rem;
    opacity: 0.5;
}

.history-item {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 0.875rem;
    margin-bottom: 0.625rem;
    cursor: pointer;
    transition: all 0.2s;
}

.history-item:hover {
    border-color: var(--accent-color);
    box-shadow: 0 2px 8px rgba(59, 130, 246, 0.1);
}

.history-item:last-child {
    margin-bottom: 0;
}

.history-item-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 0.5rem;
}

.history-item-input {
    font-family: 'SF Mono', Monaco, 'Courier New', monospace;
    font-size: 0.85rem;
    color: var(--accent-color);
    font-weight: 500;
    word-break: break-all;
    flex: 1;
    margin-right: 0.5rem;
}

.history-item-delete {
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 0.125rem;
    opacity: 0;
    transition: all 0.2s;
    flex-shrink: 0;
}

.history-item:hover .history-item-delete {
    opacity: 1;
}

.history-item-delete:hover {
    color: var(--error-color);
}

.history-item-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.75rem;
    color: var(--text-secondary);
}

.history-item-status {
    display: flex;
    align-items: center;
    gap: 0.375rem;
}

.history-item-time {
    opacity: 0.8;
}

@media (max-width: 480px) {
    .history-panel {
        width: 100vw;
        right: -100vw;
    }
}

/* Responsive */
@media (max-width: 640px) {
    .container {
        padding: 1.25rem 0.9rem;
        padding-top: 1.25rem;
        padding-top: calc(1.25rem + env(safe-area-inset-top));
        padding-bottom: 1.5rem;
        padding-bottom: calc(1.5rem + env(safe-area-inset-bottom));
    }

    header {
        margin-bottom: 1.25rem;
    }

    .logo-icon {
        width: 36px;
        height: 36px;
        border-radius: 10px;
    }

    .logo h1 {
        font-size: 1.15rem;
    }

    .card {
        padding: 1.1rem;
        border-radius: 14px;
    }

    .options {
        flex-direction: column;
        gap: 1rem;
    }

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

    /* 结果卡片头部移动端适配 */
    .result-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.75rem;
    }

    .result-header-right {
        width: 100%;
        justify-content: flex-start;
    }

    .result-input {
        word-break: break-all;
        width: 100%;
    }

    .result-status {
        width: 100%;
    }

    /* Tool Bar 移动端适配 */
    .tool-bar {
        flex-direction: column;
        align-items: stretch;
        gap: 0.75rem;
    }

    .option-group {
        width: 100%;
        justify-content: space-between;
    }
}

/* 更小屏幕下的通用触控适配 */
@media (max-width: 480px) {
    .btn-feedback,
    .btn-copy-debug,
    .btn-ai-verify,
    .btn-small,
    .feedback-submit-btn,
    .btn-secondary {
        min-height: var(--tap-min);
    }

    footer {
        padding: 1.25rem 0.5rem;
    }
}

/* 键盘与可访问性：只在键盘导航时显示焦点环 */
:focus-visible {
    outline: 3px solid var(--focus-outline);
    outline-offset: 2px;
}

/* 降低动画：尊重系统设置 */
@media (prefers-reduced-motion: reduce) {
    * {
        transition: none !important;
        animation: none !important;
    }
}
