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

/* ===== 设计令牌：统一配色与间距，避免散落的魔法值 ===== */
:root {
    --brand: #c41e3a;
    --brand-dark: #8b0000;
    --brand-soft: #fff0f0;
    --ink: #333;
    --ink-2: #555;
    --ink-3: #666;
    --line: #e9ecef;
    --line-strong: #ddd;
    --surface: #fff;
    --surface-alt: #f8f9fa;
    --danger: #dc3545;
    --danger-dark: #c82333;
    --warn: #854d0e;
    --warn-bg: #fff8e6;
    --focus: #c41e3a;
}

/* （已移除废弃的登录/管理员样式：.login-*、.user-info、.admin-panel、#usersTable 等，
   HTML/JS 中均无引用，相关界面早已下线） */

body {
    font-family: 'Arial', sans-serif;
    background: linear-gradient(135deg, #e83e8c 0%, #6f42c1 100%);
    min-height: 100vh;
    padding: 20px;
}

.container {
    max-width: 800px;
    margin: 0 auto;
    background: white;
    border-radius: 15px;
    padding: 30px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
}

h1 {
    text-align: center;
    color: #8b0000;
    margin-bottom: 30px;
    font-size: 2.5em;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.1);
}

.editable-title {
    cursor: text;
    padding: 5px 10px;
    border-radius: 5px;
    transition: all 0.3s;
}

.editable-title:hover {
    background-color: rgba(203, 28, 62, 0.1);
}

.editable-title:focus {
    outline: 2px solid #c41e3a;
    background-color: white;
    box-shadow: 0 0 5px rgba(203, 28, 62, 0.3);
}

h2 {
    color: #8b0000;
    margin-bottom: 15px;
    font-size: 1.5em;
    border-bottom: 2px solid #c41e3a;
    padding-bottom: 5px;
}

/* 可折叠部分样式 */
.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 2px solid #c41e3a;
    margin-bottom: 15px;
    padding-bottom: 10px;
}

.section-header h2 {
    margin-bottom: 0;
    border-bottom: none;
    padding-bottom: 0;
}

.section-content {
    padding: 10px 0;
}

.input-section, .control-section, .image-upload-section, .search-section, .result-section {
    margin-bottom: 30px;
}

/* ===== 首屏信息架构：顶栏 + 卡片 ===== */
.topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
}
.topbar h1 {
    flex: 1;
    text-align: center;
    margin-bottom: 0;
}
.topbar-actions {
    display: flex;
    align-items: center;
    gap: 16px;
}
.switch-item {
    display: flex;
    align-items: center;
    gap: 6px;
    font-weight: bold;
    color: var(--ink-2);
    cursor: pointer;
    background: var(--surface);
    border: 1px solid var(--line-strong);
    padding: 8px 14px;
    border-radius: 999px;
    font-size: 14px;
}
.switch-item input {
    width: 18px;
    height: 18px;
    cursor: pointer;
}
.card {
    background: var(--surface-alt);
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 22px;
}
/* 抽取操作与抽取结果紧挨：间距缩小 */
.card-actions {
    margin-bottom: 12px;
}
.settings-row {
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
    margin-bottom: 15px;
}
.settings-row .control-group {
    flex: 1;
    min-width: 160px;
    margin-bottom: 0;
}
.btn-group {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}
.btn-group button {
    margin: 0;
}
.result-header-actions {
    display: flex;
    align-items: center;
    gap: 20px;
}

.database-row {
    margin-top: 16px;
    border-top: 1px dashed var(--line-strong);
    padding-top: 16px;
}

/* ===== 软件设置弹窗：分区导航 ===== */
.settings-nav {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 18px;
    border-bottom: 2px solid var(--line);
    padding-bottom: 12px;
}
.settings-nav button {
    margin: 0;
    border-radius: 999px;
    padding: 8px 18px;
    font-size: 14px;
    background: var(--surface);
    color: var(--ink-2);
    border: 1px solid var(--line-strong);
}
.settings-nav button.is-active {
    background: var(--brand);
    color: #fff;
    border-color: var(--brand);
    box-shadow: 0 4px 12px rgba(196, 30, 58, 0.3);
}
.settings-panel {
    display: none;
}
.settings-panel.is-active {
    display: block;
}

/* ===== 投影模式 =====
   配色与不投屏完全一致（沿用默认浅色主题，结果区仍是红底白字），
   只把字号和关键区域放大，让教室最后一排也能看清。
   投影的核心诉求是「大」，不是「黑」。 */
body.projection-mode .container {
    max-width: 1100px;
}

body.projection-mode .card-result {
    padding: 40px;
}

/* 结果区沿用默认红底白字，仅放大内边距与最小高度，方便大屏展示 */
body.projection-mode #resultDisplay {
    min-height: 220px;
    padding: 60px 40px;
}

/* 结果字号放大：短名字尽量大，长名字也不会溢出容器 */
body.projection-mode .current-item {
    font-size: clamp(48px, 7.5vw, 108px);
    line-height: 1.15;
    letter-spacing: 2px;
    word-break: break-word;
}

body.projection-mode #appTitle {
    font-size: 2em;
}

body.projection-mode #finalResults li {
    font-size: 30px;
    line-height: 1.5;
}

body.projection-mode .modal-header h3 {
    font-size: 1.7em;
}

body.projection-mode .modal-content {
    width: 88%;
    max-width: 760px;
}

/* 投影模式下这些说明文字原本仍是 12–13px，最后一排根本看不清。
   其中「完整数据」弹窗是点名后最常打开的，字段值看不清等于白打开。 */
body.projection-mode .hotkey-hint,
body.projection-mode .filter-hint,
body.projection-mode .weight-hint,
body.projection-mode .excel-hint,
body.projection-mode .preset-label {
    font-size: 18px;
}

body.projection-mode .hotkey-hint kbd {
    font-size: 17px;
    padding: 2px 10px;
}

body.projection-mode #modalDataList .modal-data-content {
    font-size: 22px;
    line-height: 1.7;
    padding: 14px;
}

body.projection-mode #modalDataList .modal-data-field,
body.projection-mode #modalDataList .modal-data-value {
    font-size: 22px;
}

/* ===== 快捷键提示（空格键开始/停止抽取） ===== */
.hotkey-hint {
    margin-top: 12px;
    margin-bottom: 0;
    font-size: 13px;
    color: var(--ink-3);
}
.hotkey-hint kbd {
    display: inline-block;
    padding: 1px 7px;
    margin: 0 2px;
    font-family: inherit;
    font-size: 12px;
    line-height: 1.6;
    background: var(--surface-alt);
    border: 1px solid var(--line-strong);
    border-bottom-width: 2px;
    border-radius: 5px;
    color: var(--ink-2);
}

.input-section {
    background: #f8f9fa;
    padding: 20px;
    border-radius: 10px;
    border: 2px solid #e9ecef;
}

/* 图片上传区域样式 */
.image-upload-section {
    background: #f8f9fa;
    padding: 20px;
    border-radius: 10px;
    border: 2px solid #e9ecef;
}

/* 搜索区域样式 */
.search-section {
    background: #f8f9fa;
    padding: 20px;
    border-radius: 10px;
    border: 2px solid #e9ecef;
}

#imageUpload {
    margin-bottom: 15px;
    padding: 10px;
    border: 2px dashed #ddd;
    border-radius: 8px;
    width: 100%;
    background: white;
    cursor: pointer;
    transition: border-color 0.3s;
}

#imageUpload:hover {
    border-color: #c41e3a;
}

#uploadImagesBtn {
    background: linear-gradient(135deg, #dc3545 0%, #721c24 100%);
}

#uploadImagesBtn:hover {
    box-shadow: 0 5px 15px rgba(220, 53, 69, 0.4);
}

#imageCount {
    margin-top: 10px;
    color: #666;
    font-weight: bold;
    font-size: 14px;
}

/* 图片预览区域样式 */
.image-display-container {
    background: #f8f9fa;
    padding: 15px;
    border-radius: 8px;
    border: 2px solid #e9ecef;
    margin-top: 15px;
}

.image-display-container h3 {
    color: #555;
    margin-bottom: 10px;
    font-size: 1.2em;
    border-bottom: 1px solid #ddd;
    padding-bottom: 5px;
}

.image-preview {
    width: 100%;
    height: 150px;
    background: #e9ecef;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s;
    position: relative;
    overflow: hidden;
    border: 2px dashed #667eea;
}

.image-preview:hover {
    background: #dee2e6;
    transform: scale(1.02);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
}

.image-preview p {
    color: #666;
    font-size: 16px;
    text-align: center;
    padding: 0 20px;
}

/* 未匹配到照片时的默认头像：只作兜底展示，不可点、不做悬浮放大，
   否则会让人以为点开有大图（其实根本没有这张照片） */
.image-preview-default {
    cursor: default;
    border-style: solid;
    border-color: #dee2e6;
}

.image-preview-default:hover {
    transform: none;
    box-shadow: none;
    background: #e9ecef;
}

/* 未匹配到照片的那一侧：整体调淡一档，与「有照片」那侧一眼可分 */
.image-display-missing {
    border-style: dashed;
    background: #fbfbfc;
}

.image-display-missing h3 {
    color: #999;
    border-bottom-color: #e3e6ea;
}

.image-preview-default .default-avatar {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    overflow: hidden;
    opacity: 0.9;
}

.image-info {
    margin-top: 10px;
    color: #666;
    font-size: 14px;
    text-align: center;
}

.image-info-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.hide-image-name-checkbox {
    margin-top: 5px;
    display: flex;
    align-items: center;
    gap: 5px;
}

.hide-image-name-checkbox label {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 13px;
    color: #555;
    cursor: pointer;
}

.hide-image-name-checkbox input[type="checkbox"] {
    width: 16px;
    height: 16px;
    cursor: pointer;
}

/* 大图显示样式 */
.image-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    animation: fadeIn 0.3s;
}

.full-image {
    max-width: 90%;
    max-height: 90vh;
    border-radius: 10px;
    box-shadow: 0 10px 50px rgba(255, 255, 255, 0.3);
    animation: slideIn 0.3s;
}

.close-full-image {
    position: absolute;
    top: 20px;
    right: 30px;
    color: white;
    font-size: 40px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s;
    z-index: 2100;
}

.close-full-image:hover {
    transform: scale(1.2);
    color: #667eea;
}

#dataInput {
    width: 100%;
    height: 150px;
    padding: 15px;
    border: 2px solid #ddd;
    border-radius: 8px;
    font-size: 14px;
    font-family: 'Courier New', monospace;
    resize: vertical;
    margin-bottom: 10px;
    transition: border-color 0.3s;
}

#dataInput:focus {
    border-color: #c41e3a;
    outline: none;
    box-shadow: 0 0 0 3px rgba(203, 28, 62, 0.1);
}

/* ===== Excel 导入（模板下载 / 文件导入） ===== */

.excel-import-row {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.excel-option {
    margin-top: 8px;
}

.excel-hint {
    margin-top: 8px;
    font-size: 13px;
    line-height: 1.6;
    color: #666;
}


button {
    background: linear-gradient(135deg, #c41e3a 0%, #8b0000 100%);
    color: white;
    border: 2px solid rgba(255, 255, 255, 0.85);
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.28);
    padding: 10px 20px;
    border-radius: 8px;
    font-size: 14px;
    cursor: pointer;
    margin-right: 10px;
    margin-bottom: 10px;
    transition: all 0.3s;
}

button:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(203, 28, 62, 0.4);
}

button:active {
    transform: translateY(0);
}

button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

/* ===== 按钮三档：主 / 次 / 危险（尺寸修饰 .btn-sm 不算第四档） ===== */
.btn-secondary {
    background: var(--surface);
    color: var(--brand);
    border: 2px solid var(--brand);
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.22);
}
.btn-secondary:hover {
    background: var(--brand-soft);
    box-shadow: 0 5px 15px rgba(196, 30, 58, 0.15);
}
.btn-danger {
    background: var(--surface);
    color: var(--danger);
    border: 2px solid var(--danger);
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.22);
}
.btn-danger:hover {
    background: #fff0f0;
    box-shadow: 0 5px 15px rgba(220, 53, 69, 0.15);
}
.btn-danger-solid {
    background: linear-gradient(135deg, var(--danger) 0%, var(--danger-dark) 100%);
    color: #fff;
    border: 2px solid rgba(255, 255, 255, 0.85);
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.28);
}
.btn-danger-solid:hover {
    box-shadow: 0 5px 15px rgba(220, 53, 69, 0.4);
}
.btn-sm {
    padding: 6px 12px;
    font-size: 13px;
}

/* 统一焦点框 */
button:focus-visible,
select:focus-visible,
input:focus-visible,
.editable-title:focus-visible {
    outline: 2px solid var(--focus);
    outline-offset: 2px;
}

#dataCount {
    display: inline-block;
    margin-left: 10px;
    color: #666;
    font-weight: bold;
}

.control-group {
    margin-bottom: 15px;
}

.control-row {
    display: flex;
    gap: 20px;
    margin-bottom: 15px;
}

.control-row .control-group {
    margin-bottom: 0;
    flex: 1;
}

.data-statistics {
    display: flex;
    gap: 20px;
    margin-bottom: 15px;
    padding: 10px;
    background-color: #f8f9fa;
    border-radius: 8px;
    border: 1px solid #e9ecef;
}

.data-statistics div {
    flex: 1;
    text-align: center;
    font-weight: bold;
    color: #555;
}

.control-group label {
    width: 100px;
    color: #666;
    font-weight: bold;
}

.control-group input, .control-group select {
    padding: 8px;
    border: 2px solid #ddd;
    border-radius: 5px;
    font-size: 14px;
    transition: border-color 0.3s;
}

.control-group input:focus, .control-group select:focus {
    border-color: #c41e3a;
    outline: none;
    box-shadow: 0 0 0 3px rgba(203, 28, 62, 0.1);
}

.result-section {
    text-align: center;
}

.result-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.result-header h2 {
    margin-bottom: 0;
}

.mask-checkbox {
    display: flex;
    align-items: center;
    gap: 5px;
    font-weight: bold;
    color: #555;
    cursor: pointer;
}

.mask-checkbox input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
}

/*
 * 遮盖 = 真遮盖：文本在渲染前就被替换成占位符，原始内容根本不会写进 DOM。
 * 旧实现用 ::after 铺一层色块盖住，原文仍在节点里，选中复制 / F12 一眼看穿。
 */
.masked {
    position: relative;
    letter-spacing: 3px;
    user-select: none;
}

.current-item.masked {
    color: #ffd9d9;
}

.result-item.masked {
    background: #fff;
    color: #c41e3a;
    font-weight: bold;
}



#resultDisplay {
    background: linear-gradient(135deg, #c41e3a 0%, #8b0000 100%);
    color: white;
    padding: 40px;
    border-radius: 15px;
    margin-bottom: 20px;
    min-height: 120px;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
}

.current-item {
    font-size: 24px;
    font-weight: bold;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
    z-index: 2;
    position: relative;
}

/* 滚动特效 */
@keyframes roll {
    0% { opacity: 0; transform: scale(0.8); }
    50% { opacity: 1; transform: scale(1); }
    100% { opacity: 0; transform: scale(0.8); }
}

@keyframes highlight {
    0% { box-shadow: 0 0 0 0 rgba(255, 255, 255, 0.7); }
    70% { box-shadow: 0 0 0 10px rgba(255, 255, 255, 0); }
    100% { box-shadow: 0 0 0 0 rgba(255, 255, 255, 0); }
}

.rolling { 
    animation: roll 0.3s ease-in-out;
}

.highlighted { 
    animation: highlight 1s ease-out;
}

#finalResults {
    background: #f8f9fa;
    padding: 20px;
    border-radius: 10px;
    border: 2px solid #e9ecef;
}

#finalResults h3 {
    color: #333;
    margin-bottom: 15px;
}

#resultsList {
    list-style: none;
}

#resultsList li {
    background: white;
    padding: 10px 15px;
    margin-bottom: 8px;
    border-radius: 5px;
    border-left: 4px solid #c41e3a;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
    font-family: 'Courier New', monospace;
    transition: all 0.3s;
    cursor: pointer;
    position: relative;
}

#resultsList li:hover {
    transform: translateX(5px);
    box-shadow: 0 3px 8px rgba(0, 0, 0, 0.15);
}

#resultsList li.expanded {
    background: #fff0f0;
    border-left-color: #8b0000;
    box-shadow: 0 4px 12px rgba(203, 28, 62, 0.2);
}

.result-main {
    font-weight: bold;
    margin-bottom: 5px;
}

.result-full {
    background: rgba(203, 28, 62, 0.05);
    padding: 10px;
    border-radius: 5px;
    margin-top: 8px;
    border-left: 2px solid #c41e3a;
    font-size: 13px;
    line-height: 1.6;
    font-weight: normal;
    transition: all 0.3s ease;
}

#resultsList li::after {
    content: '▼';
    position: absolute;
    right: 15px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 12px;
    color: #c41e3a;
    transition: transform 0.3s ease;
}

#resultsList li.expanded::after {
    transform: translateY(-50%) rotate(180deg);
}

/* 粒子效果容器 */
.particles {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1;
}

.particle {
    position: absolute;
    width: 4px;
    height: 4px;
    background: #ffcccc;
    border-radius: 50%;
    opacity: 0.8;
    animation: particle-float 3s ease-out infinite;
}

@keyframes particle-float {
    0% {
        transform: translateY(0) rotate(0deg);
        opacity: 0.8;
    }
    100% {
        transform: translateY(-100px) rotate(360deg);
        opacity: 0;
    }
}

/* 复制字段设置样式 */
.modal-actions {
    text-align: right;
    margin-top: 20px;
}

.copy-settings {
    margin-bottom: 15px;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px;
    background-color: #f8f9fa;
    border-radius: 8px;
    border: 1px solid #e9ecef;
}

.copy-settings label {
    font-weight: bold;
    color: #555;
    white-space: nowrap;
}

.copy-settings select {
    flex: 1;
    padding: 8px;
    border: 2px solid #ddd;
    border-radius: 5px;
    font-size: 14px;
    transition: border-color 0.3s;
}

.copy-settings select:focus {
    border-color: #c41e3a;
    outline: none;
    box-shadow: 0 0 0 3px rgba(203, 28, 62, 0.1);
}

#copySettingsBtn {
    background: linear-gradient(135deg, #fd7e14 0%, #854d0e 100%);
    padding: 8px 16px;
    font-size: 14px;
    margin: 0;
}

#copySettingsBtn:hover {
    box-shadow: 0 5px 15px rgba(253, 126, 20, 0.4);
}

#copySettingsBtn:disabled {
    background: #ccc;
    cursor: not-allowed;
    box-shadow: none;
}

/* 弹窗样式 */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(5px);
    animation: fadeIn 0.3s;
}

/* 详情弹窗会被从「结果记录」里点开，而它在 DOM 里排第一 ——
   同 z-index 时会被记录弹窗盖住，点了像没反应。抬高一层让它在最上面。
   （closeTopModal 已改为按 z-index 判断最上层，不会因此关错弹窗） */
#dataModal {
    z-index: 1100;
}

.modal-content {
    background-color: white;
    margin: 5% auto;
    padding: 0;
    border-radius: 15px;
    width: 80%;
    max-width: 600px;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    animation: slideIn 0.3s;
}

.modal-header {
    padding: 15px 20px;
    background: linear-gradient(135deg, #c41e3a 0%, #8b0000 100%);
    color: white;
    border-radius: 15px 15px 0 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h3 {
    margin: 0;
    font-size: 1.5em;
}

.close {
    color: white;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    transition: transform 0.3s;
}

.close:hover {
    transform: scale(1.2);
}

.modal-body {
    padding: 20px;
}

#modalDataList {
    list-style: none;
    padding: 0;
    margin: 0;
}

#modalDataList li {
    background: #f8f9fa;
    padding: 10px 15px;
    margin-bottom: 8px;
    border-radius: 5px;
    border-left: 4px solid #e9ecef;
    cursor: pointer;
    transition: all 0.3s;
    position: relative;
}

#modalDataList li:hover {
    background: #e9ecef;
    transform: translateX(5px);
}

#modalDataList li.expanded {
    background: var(--brand);
    color: white;
    border-left-color: var(--brand-dark);
    box-shadow: 0 4px 12px rgba(196, 30, 58, 0.3);
}

#modalDataList .data-item {
    font-weight: bold;
    margin-bottom: 5px;
}

#modalDataList .data-full {
    display: none;
    background: rgba(255, 255, 255, 0.1);
    padding: 10px;
    border-radius: 5px;
    margin-top: 5px;
    border-left: 2px solid rgba(255, 255, 255, 0.3);
    font-size: 13px;
    font-family: 'Courier New', monospace;
    line-height: 1.6;
}

#modalDataList li.expanded .data-full {
    color: white;
}

/* 按钮样式优化 */
#countdownExtractBtn {
    background: linear-gradient(135deg, #e83e8c 0%, #6f42c1 100%);
}

#countdownExtractBtn:hover {
    box-shadow: 0 5px 15px rgba(232, 62, 140, 0.4);
}

/* 搜索框样式 */
.search-group {
    display: flex;
    margin-top: 15px;
    gap: 10px;
}

.search-scope {
    padding: 10px;
    border: 2px solid #ddd;
    border-radius: 8px;
    font-size: 14px;
    background: white;
    transition: border-color 0.3s;
    cursor: pointer;
}

.search-scope:focus {
    border-color: #c41e3a;
    outline: none;
    box-shadow: 0 0 0 3px rgba(203, 28, 62, 0.1);
}

#searchInput {
    flex: 1;
    padding: 10px;
    border: 2px solid #ddd;
    border-radius: 8px;
    font-size: 14px;
    transition: border-color 0.3s;
}

#searchInput:focus {
    border-color: #c41e3a;
    outline: none;
    box-shadow: 0 0 0 3px rgba(203, 28, 62, 0.1);
}

#searchBtn {
    background: linear-gradient(135deg, var(--brand) 0%, var(--brand-dark) 100%);
    padding: 10px 20px;
    border: none;
    border-radius: 8px;
    color: white;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.3s;
}

#searchBtn:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(200, 35, 51, 0.4);
}

/* 动画 */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes slideIn {
    from { transform: translateY(-50px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}


/* 展开字段设置样式 */
.setting-group {
    margin-bottom: 20px;
}

.setting-group h4 {
    color: #8b0000;
    margin-bottom: 10px;
    font-size: 14px;
    font-weight: bold;
}

.fields-container {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 10px;
    margin-bottom: 15px;
    padding: 15px;
    background-color: #f8f9fa;
    border-radius: 8px;
    border: 1px solid #e9ecef;
}

.field-option {
    display: flex;
    align-items: center;
}

.field-option label {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 13px;
    color: #555;
    cursor: pointer;
}

.field-option input[type="checkbox"] {
    width: 16px;
    height: 16px;
    cursor: pointer;
}

#expandFieldsSettingsBtn {
    padding: 8px 16px;
    font-size: 12px;
    background: linear-gradient(135deg, #fd7e14 0%, #854d0e 100%);
}

#expandFieldsSettingsBtn:hover {
    box-shadow: 0 5px 15px rgba(253, 126, 20, 0.4);
}

/* 注册切换按钮样式 */
.register-toggle {
    background: none;
    color: #c41e3a;
    border: 1px solid #c41e3a;
    margin-top: 10px;
    width: 100%;
}

.register-toggle:hover {
    background: #c41e3a;
    color: white;
    transform: translateY(0);
    box-shadow: 0 3px 8px rgba(203, 28, 62, 0.3);
}

/* 数据查看模态框样式 */
.view-data-section {
    margin-top: 15px;
    text-align: center;
}

#viewDataBtn, #viewImagesBtn, #databaseBtn {
    background: linear-gradient(135deg, #fd7e14 0%, #854d0e 100%);
}

#viewDataBtn:hover, #viewImagesBtn:hover, #databaseBtn:hover {
    box-shadow: 0 5px 15px rgba(253, 126, 20, 0.4);
}

/* 图片查看模态框样式 */
.image-view-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding: 15px;
    background-color: #f8f9fa;
    border-radius: 8px;
    border: 1px solid #e9ecef;
}

.select-all-section {
    display: flex;
    align-items: center;
    gap: 15px;
}

.select-all-section label {
    display: flex;
    align-items: center;
    gap: 5px;
    font-weight: bold;
    color: #555;
    cursor: pointer;
}

.select-all-section input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
}

#deleteSelectedImagesBtn {
    background: linear-gradient(135deg, #dc3545 0%, #721c24 100%);
    padding: 8px 16px;
    font-size: 14px;
}

#deleteSelectedImagesBtn:hover {
    box-shadow: 0 5px 15px rgba(220, 53, 69, 0.4);
}

.image-count {
    font-weight: bold;
    color: #c41e3a;
    display: flex;
    align-items: center;
    gap: 10px;
}

/* 照片匹配情况清单 */
.match-list {
    max-height: 260px;
    overflow-y: auto;
    margin: 0;
    padding-left: 20px;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    background: #fff;
}

.match-list li {
    padding: 4px 0;
    border-bottom: 1px solid #f1f3f5;
}

.match-list li:last-child {
    border-bottom: none;
}

/* 图片列表样式 */
.image-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 15px;
    margin-top: 15px;
}

.image-item {
    background: #f8f9fa;
    border: 2px solid #e9ecef;
    border-radius: 8px;
    padding: 10px;
    text-align: center;
    transition: all 0.3s ease;
    position: relative;
}

.image-item:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    transform: translateY(-2px);
    border-color: #c41e3a;
}

.image-item-checkbox {
    position: absolute;
    top: 5px;
    left: 5px;
    width: 18px;
    height: 18px;
    cursor: pointer;
    z-index: 10;
}

.image-item-preview {
    width: 100%;
    height: 80px;
    background: #e9ecef;
    border-radius: 5px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    overflow: hidden;
    margin-bottom: 10px;
}

.image-item-preview img {
    max-width: 100%;
    max-height: 100%;
    object-fit: cover;
}

.image-item-name {
    font-size: 12px;
    color: #666;
    margin-bottom: 10px;
    word-break: break-all;
}

.image-item-delete {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    padding: 5px 10px;
    font-size: 12px;
    border: none;
    border-radius: 5px;
    color: white;
    cursor: pointer;
    transition: all 0.3s;
}

.image-item-delete:hover {
    box-shadow: 0 3px 8px rgba(240, 147, 251, 0.3);
    transform: translateY(-1px);
}

/* 无图片提示样式 */
.no-images {
    text-align: center;
    padding: 40px 20px;
    color: #666;
    font-size: 16px;
    background: #f8f9fa;
    border-radius: 8px;
    border: 2px dashed #e9ecef;
}

/* 数据列表样式 */
.data-list {
    margin-top: 15px;
}

.data-item {
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    margin-bottom: 10px;
    overflow: hidden;
    transition: all 0.3s ease;
}

.data-item:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    transform: translateY(-2px);
}

.data-item-content {
    display: flex;
    align-items: center;
    padding: 10px;
    gap: 10px;
}

.data-item-index {
    background: linear-gradient(135deg, #c41e3a 0%, #8b0000 100%);
    color: white;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 14px;
    flex-shrink: 0;
}

.data-item-edit {
    flex: 1;
}

.data-item-text {
    width: 100%;
    padding: 8px;
    border: 2px solid #ddd;
    border-radius: 5px;
    font-size: 14px;
    font-family: 'Courier New', monospace;
    resize: vertical;
    min-height: 36px;
    transition: border-color 0.3s ease;
}

.data-item-text:focus {
    border-color: #c41e3a;
    outline: none;
    box-shadow: 0 0 0 3px rgba(203, 28, 62, 0.1);
}

.data-item-actions {
    display: flex;
    gap: 5px;
    flex-shrink: 0;
}

.data-item-actions button {
    padding: 6px 12px;
    font-size: 12px;
    margin: 0;
    flex-shrink: 0;
}

.save-data-btn {
    background: linear-gradient(135deg, #fd7e14 0%, #854d0e 100%) !important;
}

.delete-data-btn {
    background: linear-gradient(135deg, #dc3545 0%, #721c24 100%) !important;
}

/* 数据查看：顶部工具条 */
.data-view-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    padding: 10px 12px;
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    margin-bottom: 12px;
}

.data-view-toolbar .dv-select-all {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 14px;
    color: #495057;
    white-space: nowrap;
}

/* 「共 N 条」推到最右边，避免按钮换行时它夹在中间 */
.data-view-toolbar .dv-count {
    margin-left: auto;
    font-size: 13px;
    color: #868e96;
}

.data-view-replace-bar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    padding: 10px 12px;
    background: #fff;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    margin-bottom: 12px;
}

.data-view-replace-bar .dv-input {
    flex: 1 1 160px;
    min-width: 140px;
    padding: 6px 10px;
    border: 1px solid #ced4da;
    border-radius: 5px;
    font-size: 14px;
}

.data-view-replace-bar .dv-input:focus {
    border-color: #c41e3a;
    outline: none;
}

.data-view-replace-bar .dv-case {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 13px;
    color: #495057;
    white-space: nowrap;
}

.data-view-replace-bar .dv-find-info {
    font-size: 13px;
    color: #c41e3a;
    min-width: 90px;
}

/* 查找命中的整行：左侧竖条 + 浅黄底，
   用 outline 而不是 border，免得撑开行高把下面的行顶下去 */
.data-item.is-hit {
    background: #fff8e1;
    border-color: #ffd54f;
    box-shadow: inset 4px 0 0 #ffb300;
}

.data-item-checkbox {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
    cursor: pointer;
}

.data-view-empty {
    color: #868e96;
    font-size: 14px;
    padding: 12px 0;
}

/* 响应式设计 */
@media (max-width: 600px) {
    .container {
        padding: 20px;
    }
    
    h1 {
        font-size: 2em;
    }
    
    .control-group {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .control-group label {
        margin-bottom: 5px;
    }
    
    button {
        width: 100%;
        margin-right: 0;
    }

    /* 行内小按钮不跟着撑满：工具条里「新增行 / 删除选中 / 查找」各占一行的排布，
       会让弹窗底部操作区竖排后超出 max-height 需要滚动，反而更难按。 */
    button.btn-sm {
        width: auto;
    }

    .modal-content {
        width: 95%;
        margin: 10% auto;
    }
    
    /* 数据查看响应式设计 */
    .data-item-content {
        flex-direction: column;
        align-items: stretch;
    }
    
    .data-item-index {
        align-self: flex-start;
    }
    
    .data-item-actions {
        margin-top: 10px;
    }
    
    .data-item-actions button {
        flex: 1;
    }

    /* 首屏新结构在窄屏下的适配 */
    .topbar {
        flex-direction: column;
        gap: 12px;
    }
    .topbar h1 {
        text-align: center;
    }
    .control-row {
        flex-direction: column;
        align-items: stretch;
    }
    .settings-row {
        flex-direction: column;
    }
    .card {
        padding: 16px;
    }
}
/* ===== 补充缺失样式：字段设置 / 完整数据弹窗 / 图片分页 ===== */

/* 字段设置弹窗中的单个字段组（此前无任何样式） */
.field-group {
    margin-bottom: 15px;
    padding: 12px 15px;
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 8px;
}

.field-group > label,
.field-group div > label {
    font-weight: bold;
    color: #555;
    white-space: nowrap;
}

.field-group input[type="text"] {
    width: 100%;
    margin-top: 8px;
    padding: 10px 12px;
    border: 2px solid #e9ecef;
    border-radius: 8px;
    font-size: 14px;
    transition: border-color 0.3s ease;
}

.field-group input[type="text"]:focus {
    border-color: #667eea;
    outline: none;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.field-group input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
}

/* 完整数据弹窗：字段条目（此前 JS 生成的类名与样式表中的选择器不一致） */
#modalDataList .modal-data-title {
    font-weight: bold;
    display: flex;
    align-items: center;
    gap: 6px;
}

#modalDataList .modal-data-title::before {
    content: '\25B8';
    font-size: 12px;
    line-height: 1;
}

#modalDataList .modal-data-item.expanded .modal-data-title::before {
    content: '\25BE';
}

#modalDataList .modal-data-content {
    background: rgba(255, 255, 255, 0.1);
    padding: 10px;
    border-radius: 5px;
    margin-top: 8px;
    border-left: 2px solid rgba(255, 255, 255, 0.3);
    font-size: 13px;
    line-height: 1.6;
    word-break: break-all;
    white-space: pre-wrap;
}

#modalDataList .modal-data-item.expanded .modal-data-content {
    color: #fff;
}

/* 图片查看弹窗底部间距 */
.image-pagination {
    margin-bottom: 10px;
}

/* ===== 抽取条件折叠面板（条件抽取 / 排除近期 / 权重抽取） ===== */
.filter-panel {
    margin-top: 14px;
    padding-top: 14px;
    border-top: 1px dashed #e0e0e0;
}

/* 折叠头：整行可点，左侧箭头 + 标题，右侧一行「当前启用了什么」的摘要 */
.filter-panel-header {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 9px 12px;
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    font: inherit;
    font-size: 14px;
    color: #333;
    text-align: left;
    cursor: pointer;
    transition: background 0.2s, border-color 0.2s;
}

.filter-panel-header:hover {
    background: #f1f3f5;
    border-color: #dfe3e8;
}

.filter-panel-arrow {
    font-size: 12px;
    line-height: 1;
    color: #c41e3a;
    transition: transform 0.2s ease;
}

.filter-panel.expanded .filter-panel-arrow {
    transform: rotate(90deg);
}

.filter-panel-title {
    font-weight: bold;
    white-space: nowrap;
}

/* 摘要：默认灰字表示「都没启用」；有启用项时变红加粗，
   提醒用户"条件开着呢"，免得抽出来的人少了却找不到原因 */
.filter-panel-summary {
    font-size: 12px;
    color: #999;
    /* min-width:0 是必需的：flex 子项默认 min-width:auto，不加这一条
       长摘要不会收缩，ellipsis 形同虚设，会把标题挤出容器 */
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.filter-panel-summary.active {
    font-weight: bold;
    color: #c41e3a;
}

/* 折叠体：默认不显示。用类切换而不是行内 style，样式集中可控 */
.filter-panel-body {
    display: none;
    padding-top: 14px;
}

.filter-panel.expanded .filter-panel-body {
    display: block;
}

.filter-panel .control-row {
    margin-bottom: 10px;
    flex-wrap: wrap;
}

.filter-panel .control-row .control-group {
    flex: 0 1 auto;
    min-width: 150px;
}

.filter-hint {
    margin: 4px 0 0;
    font-size: 12px;
    color: #888;
    line-height: 1.6;
}

.mode-row {
    align-items: flex-end;
    flex-wrap: wrap;
}

.mode-row .control-group {
    flex: 0 1 auto;
}

#groupParams label {
    margin-left: 10px;
}

/* ===== 权重抽取 ===== */
.weight-panel {
    margin-top: 10px;
    padding-top: 12px;
    border-top: 1px dashed #e0e0e0;
}

.weight-panel .control-row {
    margin-bottom: 8px;
    flex-wrap: wrap;
}

.weight-panel .control-group {
    flex: 0 1 auto;
    min-width: 130px;
}

.weight-hint {
    margin: 4px 0 0;
    font-size: 12px;
    color: #888;
    line-height: 1.6;
}

/* ===== 模板预设 ===== */
.preset-row {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 12px;
    padding-bottom: 12px;
    border-bottom: 1px dashed #e0e0e0;
}

.preset-label {
    font-size: 13px;
    color: #666;
}

.preset-status {
    font-size: 12px;
    color: #667eea;
    margin-left: 4px;
}

/* ===== 导入校验报告 ===== */
.report-ok {
    color: #2f9e44;
    font-weight: 600;
}

.report-block {
    margin: 12px 0;
    padding: 10px 12px;
    background: #fff8f0;
    border-left: 3px solid #f0a020;
    border-radius: 4px;
}

.report-block h4 {
    margin: 0 0 6px;
    font-size: 14px;
    color: #b35c00;
}

.report-block p {
    margin: 4px 0;
    font-size: 13px;
    line-height: 1.6;
    word-break: break-all;
}

.report-note {
    color: #888;
    font-size: 12px;
}

/* ===== 图片查看 ===== */
.page-size-label {
    font-size: 12px;
    color: #666;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    margin-left: 8px;
}

#groupParams input[type="number"] {
    width: 70px;
}

/* ===== 结果列表：组标题与排队序号 ===== */
#resultsList li.result-group-header {
    background: #c41e3a;
    color: #fff;
    font-weight: bold;
    border-left-color: #8b0000;
    cursor: default;
    font-family: inherit;
    letter-spacing: 1px;
}

#resultsList li.result-group-header:hover {
    transform: none;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

.result-tag {
    display: inline-block;
    min-width: 2.2em;
    margin-right: 8px;
    color: #c41e3a;
    font-weight: bold;
}

.result-text {
    display: inline;
}

/* 结果入场：从「透明 + 下移 6px」过渡到自然状态。
   刻意不把 opacity: 0 写在元素本身上，只用 backwards 填充延迟期 ——
   万一动画没跑起来（老浏览器 / 被扩展禁用），结果仍然可见，不会白屏。
   逐条的延迟由 showFinalResults 按模式算好，写在行内 animation-delay 上。 */
@keyframes resultItemIn {
    from { opacity: 0; transform: translateY(6px); }
    to { opacity: 1; transform: translateY(0); }
}

.result-item,
.result-group-header {
    animation: resultItemIn 0.26s ease-out backwards;
}

@media (prefers-reduced-motion: reduce) {
    .result-item,
    .result-group-header {
        animation: none;
    }
}

/* ===== 结果记录弹窗操作条 ===== */
.records-actions {
    display: flex;
    gap: 10px;
    margin-bottom: 14px;
    flex-wrap: wrap;
}

/* ===== 非阻塞提示条 =====
   用于「需要让你知道、但不需要你做任何事」的场景，替代原先的 alert 弹窗：
   不遮挡内容、不阻塞操作、几秒后自己消失，也可以点 × 立刻收起。
   z-index 高于所有弹窗（#dataModal 为 1100），保证投影时也压在正确层级。 */
.app-notice {
    position: fixed;
    top: 16px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 1200;
    display: flex;
    align-items: center;
    gap: 12px;
    max-width: min(560px, calc(100vw - 32px));
    padding: 12px 14px;
    background: var(--surface);
    border-left: 4px solid var(--brand);
    border-radius: 8px;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.18);
    color: var(--ink);
    font-size: 14px;
    line-height: 1.5;
    animation: noticeIn 0.24s ease-out;
}

/* display:flex 会盖掉浏览器默认的 [hidden]{display:none}，必须显式补一条 */
.app-notice[hidden] {
    display: none;
}

.app-notice-warn {
    background: var(--warn-bg);
    border-left-color: #e0a800;
    color: var(--warn);
}

.app-notice-text {
    white-space: pre-line;
}

.app-notice-close {
    flex: none;
    width: 24px;
    height: 24px;
    border: none;
    border-radius: 50%;
    background: transparent;
    color: inherit;
    font-size: 18px;
    line-height: 1;
    cursor: pointer;
    opacity: 0.6;
    transition: opacity 0.2s, background 0.2s;
}

.app-notice-close:hover {
    opacity: 1;
    background: rgba(0, 0, 0, 0.06);
}

@keyframes noticeIn {
    from { opacity: 0; transform: translate(-50%, -10px); }
    to { opacity: 1; transform: translate(-50%, 0); }
}

@media (prefers-reduced-motion: reduce) {
    .app-notice {
        animation: none;
    }
}

/* ===== 复选框竖排容器 =====
   label 默认是 inline 元素，多个勾选会挤在同一行（width/margin 对 inline 也不生效）。
   凡是「一列勾选项」的位置都要套这里：复位弹窗的 7 个操作、左侧的 不重复/音效 开关。 */
.reset-options,
.checkbox-row {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.reset-options label,
.checkbox-row label {
    display: flex;
    align-items: center;
    gap: 8px;
    width: auto;
    margin: 0;
    font-weight: normal;
    color: var(--ink, #333);
    cursor: pointer;
    line-height: 1.5;
}

.reset-options input[type="checkbox"],
.checkbox-row input[type="checkbox"] {
    flex: none;
    width: 16px;
    height: 16px;
    margin: 0;
    cursor: pointer;
}
