@import url(https://fonts.googleapis.com/css?family=Righteous);

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

body {
    font-family: 'Microsoft YaHei', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background:
        radial-gradient(at 50% 0, transparent, #080808),
        repeating-conic-gradient(
            hsla(0, 0%, 0%, .235) 0% 25%,
            transparent 0% 50%
        ) 0 0 / 0.375em 0.375em,
        #3b3b3b;
    min-height: 100vh;
    padding: 0;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
}

/* 移除网格线背景 wrapper，不再需要 */
#background-wrapper {
    display: none;
}

.page-container {
    max-width: 96%; /* 为了容纳双栏结构，拓宽了最大宽度 */
    margin: 0 auto;
    width: 100%;
    position: relative;
    z-index: 2;
    flex: 1;
    padding: 20px 1rem;
}

/* Navbar (aligned with SRT2TXT/ExcelGrep) */
.navbar {
    position: sticky;
    top: 0;
    z-index: 50;
    width: 100%;
    align-self: stretch;
    background-color: rgba(0, 0, 0, 0.4);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(12px) saturate(1.2);
    -webkit-backdrop-filter: blur(12px) saturate(1.2);
}

.nav-content {
    max-width: 80rem;
    margin: 0 auto;
    padding: 0.75rem 1rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

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

.logo-icon {
    width: 2.25rem;
    height: 2.25rem;
    border-radius: 50%;
    box-shadow: 0 4px 10px rgba(0,0,0,0.3);
    object-fit: cover;
}

.logo-text-desktop {
    font-weight: 900;
    color: hsl(0 0% 95%);
    letter-spacing: 0.05em;
    font-size: 1.125rem;
    font-family: 'Righteous', 'Microsoft YaHei', sans-serif;
}

.nav-actions {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex: 1;
    justify-content: flex-end;
}

.nav-btn {
    -webkit-tap-highlight-color: #0000;
    cursor: pointer;
    border-radius: 12px;
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
    background: #0000;
    border: 1px solid #0000;
    position: relative;
    color: white;
    transition: translate 0.1s ease-out, scale 0.1s ease-out;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    justify-content: center;
    text-decoration: none;
}

.nav-btn::before,
.nav-btn::after {
    content: '';
    position: absolute;
    inset: -1px;
    border-radius: inherit;
    pointer-events: none;
}

.nav-btn::before {
    z-index: -1;
    background: linear-gradient(
        hsl(0 0% 100% / 0.18),
        hsl(0 0% 4% / 0.7)
    );
    backdrop-filter: saturate(2) contrast(1) blur(10px);
}

.nav-btn::after {
    box-shadow: 0 0 1px 0.8px hsl(0 0% 100% / 0.8) inset;
    mask: linear-gradient(-35deg, #ffffff80, #ffffff30 30% 60%, #fff);
}

.nav-btn:active:not(:disabled) {
    scale: 0.98;
    translate: 0 1px;
}

.nav-btn:hover:not(:disabled) {
    scale: 1.02;
}

/* 标题区域 */
.header {
    text-align: center;
    margin-bottom: 2rem;
}

.header h1 {
    display: inline-block;
    color: hsl(0 0% 90%);
    font-family: 'Righteous', 'Microsoft YaHei', serif;
    font-size: 3.5em;
    text-shadow: .03em .03em 0 hsla(230,40%,50%,1);
    position: relative;
    line-height: 1.2;
    margin-bottom: 1rem;
}

.header h1::after {
    content: attr(data-shadow);
    position: absolute;
    top: .06em;
    left: .06em;
    width: 100%;
    height: 100%;
    z-index: -1;
    text-shadow: none;
    background-image: linear-gradient(
        45deg,
        transparent 45%,
        hsla(48,20%,90%,1) 45%,
        hsla(48,20%,90%,1) 55%,
        transparent 0
    );
    background-size: .05em .05em;
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    display: flex;
    justify-content: center;
    align-items: center;
    white-space: nowrap;
    animation: shad-anim 60s linear infinite;
}

@keyframes shad-anim {
    0% { background-position: 0 0; }
    100% { background-position: 100% -100%; }
}

.subtitle {
    font-size: 1rem;
    color: hsl(0 0% 75%);
    margin-top: 0.5rem;
}

/* 主体左右布局 */
.main-layout {
    display: flex;
    flex-direction: column;
    gap: 24px;
    width: 100%;
    align-items: flex-start;
}

.left-panel {
    flex: 4;
    min-width: 0;
    width: 100%;
}

.right-panel {
    flex: 6;
    min-width: 0;
    width: 100%;
}

.sticky-panel {
    position: sticky;
    top: 24px;
}

.right-content {
    padding: 2rem;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

/* 桌面端左右布局 */
@media (min-width: 1024px) {
    .main-layout {
        flex-direction: row;
    }
}

/* 容器 */
.container {
    background: rgba(255, 255, 255, 0.03);
    backdrop-filter: blur(20px) saturate(1.2);
    border-radius: 16px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    overflow: hidden;
}

/* 区块样式 */
.section {
    padding: 2rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.section:last-child {
    border-bottom: none;
}

.section h2 {
    color: hsl(0 0% 95%);
    font-size: 1.3rem;
    margin-bottom: 1.5rem;
    font-weight: 600;
    display: flex;
    align-items: center;
}

.section h2::before {
    content: '';
    display: inline-block;
    width: 4px;
    height: 20px;
    background: hsl(0 0% 80%);
    margin-right: 10px;
    border-radius: 2px;
}

.section h3 {
    color: hsl(0 0% 90%);
    font-size: 1.1rem;
    margin-bottom: 1rem;
    font-weight: 600;
}

/* 上传区域 */
.upload-area {
    display: flex;
    flex-direction: column;
    gap: 20px;
    margin-bottom: 20px;
}

.file-upload {
    text-align: center;
}

.file-upload-area {
    border: 3px dashed rgba(255, 255, 255, 0.2);
    border-radius: 12px;
    padding: 40px 20px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s;
    background: rgba(255, 255, 255, 0.03);
}

.file-upload-area:hover {
    border-color: rgba(255, 255, 255, 0.4);
    background: rgba(255, 255, 255, 0.05);
}

.file-upload-area.drag-over {
    border-color: rgba(255, 255, 255, 0.5);
    background: rgba(255, 255, 255, 0.08);
    transform: scale(1.02);
}

.upload-icon {
    font-size: 3rem;
    margin-bottom: 15px;
}

.upload-text {
    font-size: 1.1rem;
    color: hsl(0 0% 90%);
    margin-bottom: 8px;
    font-weight: 600;
}

.upload-hint {
    font-size: 0.9rem;
    color: hsl(0 0% 70%);
}

.file-name {
    display: block;
    margin-top: 15px;
    color: hsl(122 40% 70%);
    font-weight: 600;
    font-size: 0.95rem;
}

#encodingSelect {
    padding: 8px 12px;
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.05);
    color: hsl(0 0% 90%);
    font-size: 0.9rem;
    cursor: pointer;
}

#encodingSelect option {
    background: #2a2a2a;
    color: white;
}

/* CSV编码格式 label 样式增强 */
.file-upload label {
    color: hsl(0 0% 90%);
    font-weight: 500;
}

.divider {
    text-align: center;
    color: hsl(0 0% 70%);
    position: relative;
    font-size: 0.9rem;
}

.divider::before,
.divider::after {
    content: '';
    position: absolute;
    top: 50%;
    width: 40%;
    height: 1px;
    background: rgba(255, 255, 255, 0.2);
}

.divider::before {
    left: 0;
}

.divider::after {
    right: 0;
}

.text-input textarea {
    width: 100%;
    min-height: 150px;
    padding: 15px;
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 12px;
    font-size: 1rem;
    font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
    resize: vertical;
    transition: all 0.3s;
    background: rgba(255, 255, 255, 0.05);
    color: hsl(0 0% 95%);
    backdrop-filter: blur(10px);
}

.text-input textarea::placeholder {
    color: hsl(0 0% 60%);
}

.text-input textarea:focus {
    outline: none;
    border-color: rgba(255, 255, 255, 0.3);
    box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.1);
    background: rgba(255, 255, 255, 0.08);
}

/* 按钮样式 */
.btn {
    -webkit-tap-highlight-color: #0000;
    cursor: pointer;
    border-radius: 12px;
    padding: 12px 30px;
    font-size: 1rem;
    background: #0000;
    border: 1px solid #0000;
    position: relative;
    color: white;
    transition-property: translate, scale;
    transition-duration: 0.1s;
    transition-timing-function: ease-out;
    display: inline-block;
    font-weight: 500;
}

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

.btn:active:not(:disabled) {
    scale: 0.98;
    translate: 0 1px;
}

.btn::before,
.btn::after {
    content: '';
    position: absolute;
    inset: -1px;
    border-radius: inherit;
    pointer-events: none;
}

.btn::before {
    z-index: -1;
    background: linear-gradient(
        hsl(0 0% 100% / 0.18),
        hsl(0 0% 4% / 0.7)
    );
    backdrop-filter: saturate(2) contrast(1) blur(10px);
}

.btn::after {
    box-shadow: 0 0 1px 0.8px hsl(0 0% 100% / 0.8) inset;
    mask: linear-gradient(-35deg, #ffffff80, #ffffff30 30% 60%, #fff);
}

.btn:hover:not(:disabled) {
    scale: 1.02;
}

.btn-primary, .btn-success, .btn-secondary {
    /* 使用相同的毛玻璃效果 */
}

/* 单选选项 */
.logic-type {
    background: rgba(255, 255, 255, 0.03);
    backdrop-filter: blur(10px);
    padding: 15px;
    border-radius: 12px;
    margin-bottom: 20px;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.logic-type > label:first-child {
    display: block;
    font-weight: 500;
    color: hsl(0 0% 90%);
    margin-bottom: 10px;
}

.radio-option {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px;
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s;
    color: hsl(0 0% 85%);
    user-select: none;
    margin-bottom: 10px;
}

.radio-option:hover {
    border-color: rgba(255, 255, 255, 0.3);
    background: rgba(255, 255, 255, 0.05);
}

.radio-option input[type="radio"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
    accent-color: hsl(0 0% 80%);
}

.radio-option input[type="text"] {
    padding: 8px;
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 5px;
    font-size: 0.9rem;
    width: 200px;
    background: rgba(255, 255, 255, 0.05);
    color: hsl(0 0% 95%);
}

.radio-option input[type="text"]:focus {
    outline: none;
    border-color: rgba(255, 255, 255, 0.3);
}

/* 表格预览 */
.table-preview {
    margin-top: 20px;
}

.table-info {
    background: rgba(255, 255, 255, 0.03);
    padding: 15px;
    border-radius: 12px;
    margin-bottom: 15px;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.table-info p {
    margin: 8px 0;
    color: hsl(0 0% 85%);
}

.table-info label {
    color: hsl(0 0% 90%);
    font-weight: 500;
}

.column-tag {
    display: inline-block;
    background: rgba(255, 255, 255, 0.15);
    color: hsl(0 0% 95%);
    padding: 4px 10px;
    border-radius: 15px;
    font-size: 0.85rem;
    margin: 3px;
}

.table-wrapper {
    overflow-x: auto;
    overflow-y: auto;         /* 开启垂直滚动条 */
    max-height: 400px;        /* 限制表格最大高度，超出部分滑动 */
    margin: 15px 0;
    border-radius: 12px;
    background: rgba(0, 0, 0, 0.3);
    /* 针对一些浏览器的滚动条样式优化 */
    scrollbar-width: thin;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

.data-table thead {
    position: sticky;         /* 表头吸顶 */
    top: 0;                   /* 吸顶位置 */
    z-index: 10;              /* 确保表头在数据之上 */
}

/* 将背景和毛玻璃效果移到 th 上，防止滚动时透明底色导致文字重叠 */
.data-table th {
    background: rgba(40, 40, 40, 0.9); 
    backdrop-filter: blur(10px);
    padding: 12px;
    text-align: left;
    font-weight: 500;
    color: hsl(0 0% 95%);
    white-space: nowrap;
    border-bottom: 2px solid rgba(255, 255, 255, 0.2);
}

.data-table td {
    padding: 10px 12px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    color: hsl(0 0% 85%);
}

.data-table tbody tr:hover {
    background: rgba(255, 255, 255, 0.05);
}

.data-table tbody tr:last-child td {
    border-bottom: none;
}

.preview-note {
    color: hsl(0 0% 70%);
    font-size: 0.85rem;
    text-align: center;
    margin-top: 10px;
}

/* 搜索条件 */
.search-config {
    margin-bottom: 20px;
}

.search-conditions {
    margin: 15px 0;
}

.condition-item {
    margin-bottom: 15px;
}

.condition-row {
    display: flex;
    gap: 10px;
    align-items: center;
    padding: 15px;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    transition: border-color 0.3s;
}

.condition-row:hover {
    border-color: rgba(255, 255, 255, 0.2);
}

.column-select,
.keyword-input {
    padding: 10px;
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 8px;
    font-size: 0.95rem;
    background: rgba(255, 255, 255, 0.05);
    color: hsl(0 0% 95%);
    cursor: pointer;
}

.column-select {
    flex: 1;
}

.keyword-input {
    flex: 2;
}

.column-select option {
    background: #2a2a2a;
    color: white;
}

.column-select:focus,
.keyword-input:focus {
    outline: none;
    border-color: rgba(255, 255, 255, 0.3);
    background: rgba(255, 255, 255, 0.08);
}

.btn-remove {
    padding: 8px 12px;
    background: rgba(244, 67, 54, 0.8);
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 1.2rem;
    transition: all 0.3s;
}

.btn-remove:hover {
    background: rgba(244, 67, 54, 1);
}

/* 搜索结果 */
.search-results {
    margin-top: 20px;
}

.result-header {
    padding: 15px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 12px;
    margin-bottom: 15px;
    font-weight: 500;
    color: hsl(0 0% 90%);
}

.result-header.success {
    background: rgba(76, 175, 80, 0.15);
    color: hsl(122 40% 75%);
    border: 1px solid rgba(76, 175, 80, 0.3);
}

.result-header.error {
    background: rgba(244, 67, 54, 0.15);
    color: hsl(4 80% 75%);
    border: 1px solid rgba(244, 67, 54, 0.3);
}

.result-item {
    padding: 15px;
    margin: 10px 0;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    backdrop-filter: blur(10px);
}

.result-item-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
    color: hsl(0 0% 90%);
    font-weight: 500;
}

.result-item-content {
    color: hsl(0 0% 85%);
    line-height: 1.6;
    word-wrap: break-word;
}

.highlight {
    background: rgba(255, 193, 7, 0.3);
    padding: 2px 4px;
    border-radius: 3px;
    font-weight: 500;
    color: hsl(45 100% 80%);
}

/* 关键词分组 */
.keyword-group {
    margin: 20px 0;
    padding: 15px;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.keyword-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 15px;
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    color: hsl(0 0% 95%);
    border-radius: 10px;
    margin-bottom: 15px;
    font-weight: 500;
}

.keyword-header.not-found {
    background: rgba(244, 67, 54, 0.2);
}

.keyword-text {
    font-size: 1rem;
}

.keyword-count {
    background: rgba(255, 255, 255, 0.2);
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.85rem;
}

.keyword-group .result-item {
    margin-left: 0;
}

/* 导出区域 */
.export-area {
    margin-top: 20px;
    padding: 20px;
    background: rgba(76, 175, 80, 0.1);
    border-radius: 12px;
    border: 1px solid rgba(76, 175, 80, 0.3);
}

.export-area h3 {
    color: hsl(122 40% 75%);
    margin-bottom: 15px;
    font-size: 1.1rem;
}

.export-buttons {
    display: flex;
    gap: 15px;
}

/* 响应式设计 */
@media screen and (max-width: 768px) {
    body {
        padding: 0;
    }

    .header h1 {
        font-size: 2.5em;
    }

    .section {
        padding: 1.5rem;
    }

    .condition-row {
        flex-direction: column;
        align-items: stretch;
    }

    .export-buttons {
        flex-direction: column;
    }

    .data-table {
        font-size: 0.8rem;
    }

    .data-table th,
    .data-table td {
        padding: 8px;
    }

    .column-tag {
        font-size: 0.75rem;
        padding: 3px 8px;
    }
}

@media screen and (max-width: 480px) {
    .header h1 {
        font-size: 2em;
    }

    .section {
        padding: 1rem;
    }

    .btn {
        width: 100%;
    }

    .file-label {
        width: 100%;
    }

    .data-table {
        font-size: 0.75rem;
    }

    .data-table th,
    .data-table td {
        padding: 6px;
    }
}

@media (max-width: 639px) {
    .nav-content {
        flex-direction: column;
        gap: 0.75rem;
        align-items: center;
        padding: 0.75rem 1rem;
    }

    .logo-wrapper {
        justify-content: center;
        width: 100%;
    }

    .nav-actions {
        justify-content: center;
        width: 100%;
        gap: 0.75rem;
        flex-wrap: wrap;
    }
}

@media (min-width: 640px) {
    .nav-content {
        flex-direction: row;
        padding: 0.75rem 1.5rem;
    }
}

/* 滚动条样式 */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.3);
}

/* ===== 日间模式样式 ===== */
body.day-mode {
    background: #f0f4f8;
    background-image: url(../../../../assets/image/day-background.png);
    background-size: auto;
    background-repeat: repeat;
    font-family: 'Microsoft YaHei', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

body.day-mode #background-wrapper {
    background-color: transparent;
}


body.day-mode .container {
    background: hsla(0, 0%, 100%, 0.4);
    border-color: rgba(200, 200, 200, 0.4);
    box-shadow: 5px 3px 30px rgba(0, 0, 0, 0.1);
}

body.day-mode .header h1 {
    color: #2d3748;
    text-shadow: .03em .03em 0 hsla(200, 60%, 60%, 1);
}

body.day-mode .subtitle {
    color: #4a5568;
}

body.day-mode .section h2,
body.day-mode .section h3 {
    color: #2d3748;
}

body.day-mode .file-upload-area {
    background: rgba(255, 255, 255, 0.6);
    border-color: rgba(0, 0, 0, 0.15);
}

body.day-mode .file-upload-area:hover {
    background: rgba(255, 255, 255, 0.8);
    border-color: rgba(0, 0, 0, 0.25);
}

body.day-mode .upload-text {
    color: #2d3748;
}

body.day-mode .upload-hint {
    color: #718096;
}

body.day-mode .file-name {
    color: #2d3748;
}

body.day-mode textarea,
body.day-mode select,
body.day-mode input[type="text"],
body.day-mode input[type="number"] {
    background: rgba(255, 255, 255, 0.7);
    border-color: rgba(0, 0, 0, 0.15);
    color: #1a202c;
}

body.day-mode textarea::placeholder {
    color: #a0aec0;
}

body.day-mode label {
    color: #1a202c;
    font-weight: 500;
}

body.day-mode select {
    color: #1a202c;
    font-weight: 500;
}

/* 1. 修改基础按钮样式 */
body.day-mode .btn {
    background: #ffffff; /* 改为纯白色 */
    color: #1a202c;
    border: 2px solid #cbd5e0; /* 稍微深一点的边框，让白色按钮在浅色背景下更清晰 */
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
    transition: all 0.3s ease;
}

/* 2. 必须清除伪元素的背景渐变，否则白色会被遮盖 */
body.day-mode .btn::before {
    background: none; 
    backdrop-filter: none;
}

/* 3. 如果你的“载入文本”按钮使用了 btn-primary 等类，也要同步改为白色 */
body.day-mode .btn-primary,
body.day-mode .btn-success,
body.day-mode .btn-secondary {
    background: #ffffff;
    color: #1a202c;
}

/* 4. 悬停效果：增加一点灰色或加深边框 */
body.day-mode .btn:hover:not(:disabled) {
    background: #f7fafc; /* 悬停时微灰 */
    border-color: #a0aec0;
    transform: translateY(-1px);
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

body.day-mode .navbar {
    background-color: rgba(255, 255, 255, 0.7);
    border-bottom: 1px solid rgba(0, 0, 0, 0.1);
}

body.day-mode .logo-text-desktop {
    color: #1a202c;
    font-weight: bold;
    text-shadow: none;
}

body.day-mode .nav-btn {
    background: #ffffff;
    color: #1a202c;
    border: 2px solid #cbd5e0;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

body.day-mode .nav-btn::before {
    background: none;
    backdrop-filter: none;
}

body.day-mode .nav-btn::after {
    display: none;
}

body.day-mode .nav-btn:hover:not(:disabled) {
    background: #f7fafc;
    border-color: #a0aec0;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

body.day-mode .divider {
    color: #718096;
}

body.day-mode .divider::before,
body.day-mode .divider::after {
    background: rgba(0, 0, 0, 0.3);
}

body.day-mode .radio-option span {
    color: #2d3748;
}

body.day-mode .table-preview,
body.day-mode .search-results {
    background: rgba(255, 255, 255, 0.5);
    border-color: rgba(0, 0, 0, 0.1);
}

body.day-mode .data-table {
    background: rgba(255, 255, 255, 0.7);
}

body.day-mode .data-table th {
    background: rgba(240, 248, 255, 0.95);
    color: #1e40af;
}

body.day-mode .data-table td {
    color: #2d3748;
    border-color: rgba(0, 0, 0, 0.1);
}

body.day-mode .data-table tr:hover {
    background: rgba(59, 130, 246, 0.1);
}

body.day-mode .search-condition {
    background: rgba(255, 255, 255, 0.6);
    border-color: rgba(0, 0, 0, 0.1);
}

body.day-mode .condition-input,
body.day-mode .condition-select {
    background: rgba(255, 255, 255, 0.8);
    border-color: rgba(0, 0, 0, 0.15);
    color: #1a202c;
}

body.day-mode .export-area {
    background: rgba(255, 255, 255, 0.3);
    border-color: rgba(0, 0, 0, 0.1);
}

body.day-mode .table-info {
    background: rgba(255, 255, 255, 0.6);
    border-color: rgba(0, 0, 0, 0.15);
}

body.day-mode .table-info p {
    color: #1a202c;
    font-weight: 500;
}

body.day-mode .table-info label {
    color: #1a202c;
    font-weight: 600;
}

body.day-mode .column-tag {
    background: rgba(59, 130, 246, 0.2);
    color: #1e40af;
    font-weight: 500;
}

body.day-mode ::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.05);
}

body.day-mode ::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.2);
}

body.day-mode ::-webkit-scrollbar-thumb:hover {
    background: rgba(0, 0, 0, 0.3);
}

/* ===== 日夜切换器样式 ===== */
.theme-toggle {
  --theme-toggle-scale: 0.52;
  position: fixed;
  top: clamp(12px, 2vw, 20px);
  right: clamp(12px, 2vw, 20px);
  z-index: 1000;
  user-select: none;
  transform: scale(var(--theme-toggle-scale));
  transform-origin: top right;
}

.theme-toggle__checkbox {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

.theme-toggle__btn {
  display: block;
  position: relative;
  width: 125px;
  height: 70px;
  border-radius: 70px;
  border: 5px solid #1c1c1c;
  background-color: #3c4145;
  cursor: pointer;
  transition: all 350ms ease-in;
  -webkit-tap-highlight-color: transparent;
}

.theme-toggle__checkbox:focus-visible + .theme-toggle__btn {
  outline: 3px solid rgba(255, 255, 255, 0.8);
  outline-offset: 4px;
}

body.day-mode .theme-toggle__checkbox:focus-visible + .theme-toggle__btn {
  outline-color: rgba(0, 0, 0, 0.55);
}

.theme-toggle__btn::before {
  content: '';
  position: absolute;
  top: 2px;
  left: 2px;
  width: 46px;
  height: 46px;
  border-radius: 50%;
  background-color: #fff;
  border: 5px solid #e3e3c7;
  transition: all 250ms ease-in;
}

.theme-toggle__btn::after {
  content: '';
  position: absolute;
  top: 62%;
  left: 39px;
  z-index: 10;
  width: 9.2px;
  height: 9.2px;
  opacity: 0;
  background-color: #fff;
  border-radius: 50%;
  box-shadow:
    #fff 0 0,
    #fff 2.5px 0,
    #fff 5px 0,
    #fff 7.5px 0,
    #fff 9px 0,
    #fff 11.5px 0,
    #fff 13px 0,
    #fff 17px -1px 0 1px,
    #fff 13px -6px 0 -2px,
    #fff 6px -6px 0 1px,
    #d3d3d3 0 0 0 3.5px,
    #d3d3d3 5px 0 0 3.5px,
    #d3d3d3 9px 0 0 3.5px,
    #d3d3d3 13px 0 0 3.5px,
    #d3d3d3 17px -1px 0 4.5px,
    #d3d3d3 13px -6px 0 1px,
    #d3d3d3 6px -6px 0 4.5px;
  transition: opacity 100ms ease-in;
}

.theme-toggle__feature {
  display: block;
  position: absolute;
  top: 9px;
  left: 52.5%;
  z-index: 20;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background-color: #fff;
  box-shadow:
    rgba(255,255,255,0.1) 30px -3px 0 0,
    rgba(255,255,255,0.1) 12px 10px 0 -1px,
    #fff 38px 18px 0 1px,
    rgba(255,255,255,0.1) 32px 34px 0 0,
    #fff 20px 24px 0 -1.5px,
    rgba(255,255,255,0.1) 5px 38px 0 1px;
  animation: starry_star 5s ease-in-out infinite;
}

.theme-toggle__feature::before {
  content: '';
  position: absolute;
  top: -2px;
  left: -25px;
  width: 15px;
  height: 15px;
  background-color: #fff;
  border-radius: 50%;
  border: 4px solid #e3e3c7;
  box-shadow:
    #e3e3c7 -28px 0 0 -3px,
    #e3e3c7 -8px 24px 0 -2px;
  transform-origin: -6px 130%;
  transition: all 250ms ease-in;
}

@keyframes starry_star {
  50% {
    background-color: rgba(255,255,255,0.1);
    box-shadow:
      #fff 30px -3px 0 0,
      #fff 12px 10px 0 -1px,
      rgba(255,255,255,0.1) 38px 18px 0 1px,
      #fff 32px 34px 0 0,
      rgba(255,255,255,0.1) 20px 24px 0 -1.5px,
      #fff 5px 38px 0 1px;
  }
}

@keyframes bounceIn {
  0% {
    opacity: 0;
    transform: scale(.3);
  }
  50% {
    opacity: 1;
    transform: scale(1.1);
  }
  55% {
    transform: scale(1.1);
  }
  75% {
    transform: scale(.9);
  }
  100% {
    opacity: 1;
    transform: scale(1);
  }
}

.theme-toggle__checkbox:checked + .theme-toggle__btn {
  background-color: #9ee3fb;
  border: 5px solid #86c3d7;
}

.theme-toggle__checkbox:checked + .theme-toggle__btn::before {
  left: 57px;
  background-color: #ffdf6d;
  border: 5px solid #e1c348;
}

.theme-toggle__checkbox:checked + .theme-toggle__btn::after {
  opacity: 1;
  animation-name: bounceIn;
  animation-duration: 0.60s;
  animation-delay: 0.10s;
  animation-fill-mode: backwards;
  animation-timing-function: ease-in-out;
}

.theme-toggle__checkbox:checked + .theme-toggle__btn .theme-toggle__feature {
  opacity: 0;
  box-shadow:
    rgba(255,255,255,0.1) 30px -3px 0 -4px,
    rgba(255,255,255,0.1) 12px 10px 0 -5px,
    #fff 38px 18px 0 -3px,
    rgba(255,255,255,0.1) 32px 34px 0 -4px,
    #fff 20px 24px 0 -5.5px,
    rgba(255,255,255,0.1) 5px 38px 0 -3px;
  animation: none;
}

.theme-toggle__checkbox:checked + .theme-toggle__btn .theme-toggle__feature::before {
  left: 25px;
  transform: rotate(70deg);
}

@media (min-width: 769px) and (max-width: 1024px) {
  .theme-toggle {
    --theme-toggle-scale: 0.47;
  }
}

@media (max-width: 768px) {
  .theme-toggle {
    --theme-toggle-scale: 0.42;
    position: absolute;
    top: calc(env(safe-area-inset-top, 0px) + 10px);
    right: 10px;
    z-index: 2;
  }
}

.navbar .theme-toggle-container {
  width: 60px;
  height: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.navbar .theme-toggle {
  position: relative;
  top: auto;
  right: auto;
  bottom: auto;
  left: auto;
  z-index: 1000;
  user-select: none;
  transform: scale(0.45);
  transform-origin: center;
}

/* ===== 页脚样式 ===== */
.footer {
  position: relative;
  z-index: 1;
  width: 100%;
  padding: 2rem 1rem;
  text-align: center;
  margin-top: 3rem;
  border-top: 1px solid rgba(255, 255, 255, 0.05);
}

.footer p {
  margin: 0;
  font-size: 0.85rem;
  color: rgba(255, 255, 255, 0.4);
  transition: color 300ms ease-out;
  line-height: 1.8;
}

/* 日间模式页脚样式 */
body.day-mode .footer p {
  color: rgba(0, 0, 0, 0.5);
}

body.day-mode .footer {
  border-top-color: rgba(0,0,0,0.1);
}

/* 页脚响应式 */
@media (max-width: 768px) {
  .footer {
    padding: 1.5rem 1rem;
  }

  .footer p {
    font-size: 0.75rem;
  }
}

/* ===== 颜色工具专属样式补充 ===== */

/* 色系选择区 (默认夜间模式) */
.scheme-select-group {
    margin-bottom: 20px;
    display: flex;
    align-items: center;
}

.scheme-select-group label {
    color: hsl(0 0% 90%);
    font-size: 0.95rem;
    font-weight: 500;
}

.scheme-select-group select {
    margin-left: 10px;
    flex: 1;
    max-width: 300px;
}

/* 适配日间模式 */
body.day-mode .scheme-select-group label {
    color: #1a202c;
}

/* 色块和匹配结果表格样式 */
.color-display {
    display: flex;
    align-items: center;
    gap: 10px;
}

.color-swatch {
    display: inline-block;
    width: 24px;
    height: 24px;
    border-radius: 6px;
    border: 1px solid rgba(128, 128, 128, 0.4);
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.badge {
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: bold;
    display: inline-block;
}

.badge.success {
    background-color: rgba(76, 175, 80, 0.2);
    color: #81c784;
    border: 1px solid #4caf50;
}

.badge.warning {
    background-color: rgba(255, 152, 0, 0.2);
    color: #ffb74d;
    border: 1px solid #ff9800;
}

.badge.error {
    background-color: rgba(244, 67, 54, 0.2);
    color: #e57373;
    border: 1px solid #f44336;
}

.error-text {
    color: #e57373;
    font-style: italic;
}

/* 适配明亮模式下的徽章 */
body.day-mode .badge.success { color: #2e7d32; border-color: #4caf50; background-color: rgba(76, 175, 80, 0.1); }
body.day-mode .badge.warning { color: #ed6c02; border-color: #ff9800; background-color: rgba(255, 152, 0, 0.1); }
body.day-mode .badge.error { color: #d32f2f; border-color: #f44336; background-color: rgba(244, 67, 54, 0.1); }
body.day-mode .error-text { color: #d32f2f; }

.preview-title {
    color: hsl(0 0% 90%); /* 浅灰偏白 */
}

.preview-hint {
    color: #aaaaaa; /* 稍暗的灰色 */
}

/* 适配日间模式 */
body.day-mode .preview-title {
    color: #1a202c; /* 深灰色 */
}

body.day-mode .preview-hint {
    color: #666666; /* 较深的灰色 */
}

.color-picker-swatch {
    width: 32px;
    height: 32px;
    border-radius: 4px;
    border: 2px solid transparent;
    cursor: pointer;
    box-shadow: 0 1px 3px rgba(0,0,0,0.2);
    transition: transform 0.1s, border-color 0.1s, box-shadow 0.1s;
    flex-shrink: 0;
}

.color-picker-swatch:hover {
    transform: scale(1.15);
    z-index: 10;
}

/* 选中状态的明显高亮环 */
.color-picker-swatch.selected {
    transform: scale(1.15);
    box-shadow: 0 0 0 2px #fff, 0 0 0 4px #007bff;
    z-index: 10;
}

/* 适配夜间模式的选中高亮环 */
body.day-mode .color-picker-swatch.selected {
    box-shadow: 0 0 0 2px #1a202c, 0 0 0 4px #4299e1;
}

/* 自定义色卡区的滚动条以保持美观 */
#colorPickerGrid::-webkit-scrollbar {
    width: 8px;
}
#colorPickerGrid::-webkit-scrollbar-track {
    background: rgba(128, 128, 128, 0.1);
    border-radius: 4px;
}
#colorPickerGrid::-webkit-scrollbar-thumb {
    background: rgba(128, 128, 128, 0.4);
    border-radius: 4px;
}
#colorPickerGrid::-webkit-scrollbar-thumb:hover {
    background: rgba(128, 128, 128, 0.6);
}

/* 右侧预览区容器样式（不再在内部做左右分割，改为完全随容器向下堆叠） */
.preview-tweak-layout {
    display: none; /* JS 中控制显示为 flex */
    flex-direction: column;
}

/* --- 画布区样式 --- */
.panel-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    margin-bottom: 10px;
}
.preview-title { margin: 0; font-size: 1.1rem; color: hsl(0 0% 90%); }
.preview-hint { font-size: 0.85rem; color: #aaaaaa; }
.preview-panel {
    width: 100%;
}
.canvas-container {
    overflow: auto;
    max-height: 500px;
    border: 1px solid rgba(128,128,128,0.3);
    border-radius: 8px;
    background: rgba(0,0,0,0.1);
    position: relative;
}
#previewCanvas {
    display: block;
    margin: 0 auto;
    image-rendering: pixelated;
    transform-origin: 0 0;
}

/* --- 控制功能区（含日夜间模式） --- */
.control-panel {
    display: flex;
    flex-direction: column;
    gap: 20px;
    width: 100%;
}
.tweak-section, .export-section {
    background: rgba(255, 255, 255, 0.05); /* 夜间深灰背景 */
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    padding: 18px;
}
.section-title { margin-top: 0; margin-bottom: 10px; font-size: 1.1rem; color: hsl(0 0% 90%); }
.tweak-desc { font-size: 0.85rem; color: #aaa; margin-bottom: 15px; }
.export-hint { font-size: 0.8rem; color: #888; text-align: center; margin: 10px 0 0 0; }

.tweak-cards {
    display: flex;
    gap: 12px;
    margin-bottom: 15px;
    align-items: stretch;
}
.tweak-card {
    background: rgba(0, 0, 0, 0.2); /* 夜间卡片更深的底色 */
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 6px;
    padding: 12px;
    display: flex;
    flex-direction: column;
}
.tweak-card h4 { margin: 0 0 10px 0; font-size: 0.95rem; color: hsl(0 0% 85%); text-align: center; }

/* 调整比例 */
.tweak-card-small { flex: 0 0 90px; } /* 原色框缩小 */
.tweak-card-large { flex: 1; min-width: 0; } /* 色卡框放大 */

.color-display-box {
    height: 40px;
    border-radius: 6px;
    border: 2px dashed #666;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    color: #888;
    transition: all 0.3s;
    text-align: center;
    margin-bottom: 8px;
}
#selectedOriginalCode { font-size: 0.8rem; margin: 0; color: #888; text-align: center; word-break: break-all; }

/* 滚动色卡区 */
.color-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    height: 140px;             /* 默认初始高度 */
    min-height: 100px;         /* 最小高度限制 */
    max-height: 60vh;          /* 最大高度限制 */
    overflow-y: auto;
    padding: 4px;
    align-content: flex-start;
    resize: vertical;          /* 开启垂直拉伸 */
    border-bottom: 2px solid rgba(255, 255, 255, 0.2); /* 底部加上稍微明显的拖拽边框提示 */
}
.color-grid::-webkit-scrollbar { width: 6px; }
.color-grid::-webkit-scrollbar-track { background: rgba(128, 128, 128, 0.1); border-radius: 3px; }
.color-grid::-webkit-scrollbar-thumb { background: rgba(128, 128, 128, 0.4); border-radius: 3px; }

body.day-mode .color-grid {
    border-bottom: 2px solid rgba(0, 0, 0, 0.2);
}

/* 按钮统一 */
.full-width-btn { width: 100%; padding: 12px !important; }
.export-buttons { display: flex; flex-direction: column; gap: 12px; }
.export-buttons .btn { width: 100%; padding: 12px !important; }

/* --- 适配日间模式 --- */
body.day-mode .preview-title, body.day-mode .section-title { color: #1a202c; }
body.day-mode .preview-hint, body.day-mode .tweak-desc { color: #666; }
body.day-mode .tweak-section, body.day-mode .export-section {
    background: #ffffff;
    border-color: #e2e8f0;
    box-shadow: 0 2px 8px rgba(0,0,0,0.03);
}
body.day-mode .tweak-card {
    background: #f8fafc;
    border-color: #e2e8f0;
}
body.day-mode .tweak-card h4 { color: #4a5568; }
body.day-mode .color-display-box { border-color: #a0aec0; color: #4a5568; }

.image-extract-panel {
    background: rgba(0, 0, 0, 0.2);
    border: 1px dashed rgba(255, 255, 255, 0.3);
    border-radius: 12px;
    padding: 15px 20px;
    margin-top: -10px; /* 拉近与上传框的距离 */
    animation: bounceIn 0.3s ease-out;
}

body.day-mode .image-extract-panel {
    background: rgba(255, 255, 255, 0.5);
    border-color: rgba(0, 0, 0, 0.2);
}

.unmatched-toggle-label {
    color: hsl(0 0% 90%);
    font-size: 0.95rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    user-select: none;
}
body.day-mode .unmatched-toggle-label {
    color: #1a202c;
}
body.day-mode .unmatched-section {
    border-top-color: rgba(0,0,0,0.1) !important;
}
.unmatched-color-text {
    font-size: 10px;
    color: white;
    text-shadow: 0 0 2px black, 0 0 1px black;
    font-weight: bold;
    text-align: center;
    line-height: 1.1;
    word-break: break-all;
    pointer-events: none;
}

.image-extract-panel h3 {
    color: hsl(0 0% 90%);
}
.image-extract-panel label {
    color: #ddd;
}

/* 图片网格采样设置 - 日间文字颜色 */
body.day-mode .image-extract-panel h3 {
    color: #1a202c;
}
body.day-mode .image-extract-panel label {
    color: #2d3748;
}

body.day-mode .column-select:focus,
body.day-mode select:focus,
body.day-mode textarea:focus,
body.day-mode input[type="text"]:focus,
body.day-mode input[type="number"]:focus {
    border-color: rgba(59, 130, 246, 0.5); /* 聚焦时显示柔和的蓝色边框 */
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15); /* 增加微弱的蓝色焦点光晕 */
    outline: none;
}

/* 2. 针对 value 为空（即 "-- 请选择 --" 等占位选项）进行单独降级样式 */
body.day-mode select option[value=""] {
    color: #a0aec0; /* 颜色变淡，使用浅蓝灰色 */
    font-weight: 400; /* 取消加粗，恢复普通字重 */
}
