/* ========== CSS 变量定义 (默认主题: 深色) ========== */
:root {
    --green: #27ae60;
    /* --green: #232528; */
    --red: #eb4d4b;
    --dark-blue: #34495e;
    --icon-gray: #95a5a6;
    --icon-active: #3498db;
    --bg-color: #1d1e20;
    --text-color: #e0e0e0;
    /* --text-color: #232528; */
    --input-border: #444;
    --card-bg: #2d2d2d;
    --orange: #F38020;
}

/* 亮色主题 */
[data-theme="light"] {
    --bg-color: #ffffff;
    --text-color: #333333;
    --dark-blue: #34495e;
    --input-border: #34495e;
    --card-bg: #f0f2f5;
    --icon-gray: #95a5a6;
}

/* ========== 基础布局 ========== */
body {
    background: var(--bg-color);
    color: var(--text-color);
    display: flex;
    flex-direction: column;
    align-items: center;
    padding-top: 50px;
    font-family: "PingFang SC", sans-serif;
    transition: background 0.3s, color 0.3s;
    margin: 0;
    min-height: 100vh;
}

/* ========== 顶部控制区 ========== */
.header-controls {
    position: absolute;
    top: 20px;
    right: 20px;
    display: flex;
    gap: 10px;
    align-items: center;
}

/* 主题选择器 */
.theme-selector {
    padding: 6px 12px;
    font-size: 14px;
    border: 1px solid var(--input-border);
    border-radius: 6px;
    background: var(--card-bg);
    color: var(--text-color);
    cursor: pointer;
    outline: none;
}

.theme-selector:hover {
    border-color: var(--icon-active);
}

.theme-selector:focus {
    border-color: var(--icon-active);
    box-shadow: 0 0 0 2px rgba(39, 174, 96, 0.2);
}

/* 取消切换用户按钮 */
.cancel-switch-btn {
    width: 100%;
    padding: 10px;
    font-size: 14px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    color: #fff;
    background: #7f8c8d;
    transition: background 0.2s;
}

.cancel-switch-btn:hover {
    background: #95a5a6;
}

.user-display {
    position: absolute;
    top: 20px;
    left: 20px;
    font-size: 14px;
    color: var(--icon-active);
    display: flex;
    align-items: center;
    gap: 10px;
}

.switch-user-btn {
    font-size: 12px;
    padding: 3px 8px;
    background: var(--card-bg);
    border: 1px solid var(--input-border);
    border-radius: 4px;
    cursor: pointer;
    color: var(--text-color);
}

.switch-user-btn:hover {
    border-color: var(--icon-active);
}

/* ========== 工具栏 ========== */
.toolbar {
    margin-bottom: 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
}

.btn-group {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    justify-content: center;
}

/* 模式指示器 */
.mode-indicator {
    font-size: 14px;
    font-weight: bold;
    padding: 5px 15px;
    border-radius: 20px;
    background: var(--card-bg);
    color: #7f8c8d;
}

.active-mode {
    background: #27ae6033;
    color: var(--green);
    border: 1px solid var(--green);
}

/* 主题切换按钮和设置按钮 */
.theme-toggle,
.settings-btn {
    padding: 5px 12px;
    cursor: pointer;
    background: var(--card-bg);
    border: 1px solid var(--icon-gray);
    border-radius: 4px;
    color: var(--text-color);
    font-size: 13px;
}

/* 文件标签按钮 */
.file-label {
    padding: 8px 15px;
    background: #34495e;
    color: white;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
}

.dict-label {
    padding: 8px 15px;
    background: #8e44ad;
    color: white;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
}

.file-label.disabled {
    opacity: 0.5;
    pointer-events: none;
}

/* 同步按钮 */
.sync-btn {
    padding: 8px 15px;
    background: #2980b9;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
}

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

/* 删除按钮 */
.del-btn {
    padding: 8px 15px;
    background: #c0392b;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
}

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

/* ========== 核心展示区 ========== */
#target-display {
    font-size: 52px;
    color: var(--green);
    margin-bottom: 20px;
    visibility: hidden;
    letter-spacing: 2px;
    font-weight: bold;
    height: 60px;
}

.input-wrapper {
    position: relative;
    width: 100%;
    max-width: 600px;
    height: 80px;
    border-bottom: 2px solid var(--input-border);
}

.pixel-font {
    font-family: 'Consolas', 'Monaco', monospace;
    font-weight: bold;
    font-size: 44px;
    letter-spacing: 8px;
    text-align: center;
    width: 100%;
    position: absolute;
    bottom: 10px;
    left: 0;
    white-space: pre;
    /* text-transform: lowercase;  -- Removed to allow uppercase input */
}

input {
    background: transparent;
    border: none;
    outline: none;
    z-index: 2;
    color: var(--text-color);
    width: 100%;
}

#result-overlay {
    z-index: 1;
    pointer-events: none;
    display: none;
}

/* 正误标记 */
.correct {
    color: var(--green);
}

.wrong {
    color: var(--red);
    text-decoration: line-through;
}

.gap {
    color: var(--red);
    opacity: 0.5;
}

/* ========== 底部信息区 ========== */
.footer-info {
    margin-top: 30px;
    text-align: center;
}

.combo-info {
    font-size: 18px;
    color: var(--green);
    margin-bottom: 10px;
    font-weight: bold;
}

.translation {
    font-size: 18px;
    color: var(--text-color);
    min-height: 30px;
    visibility: hidden;
    padding: 10px 20px;
    opacity: 0.9;
    max-width: 600px;
    line-height: 1.8;
}

.translation .phonetic {
    text-align: center;
    font-size: 20px;
    color: var(--icon-active);
    margin-bottom: 8px;
}

.translation .definitions {
    text-align: left;
}

.translation .def-line {
    padding-left: 2.5em;
    text-indent: -2.5em;
    margin-bottom: 4px;
}

/* 音频按钮 */
.audio-btn {
    margin-top: 20px;
    cursor: pointer;
    color: var(--icon-gray);
    display: inline-block;
    vertical-align: middle;
}

.audio-btn svg {
    width: 40px;
    height: 40px;
    fill: currentColor;
}

/* ========== 语音选择器 ========== */
.voice-selector {
    margin-bottom: 10px;
    font-size: 12px;
    display: flex;
    gap: 15px;
    justify-content: center;
}

.voice-opt {
    cursor: pointer;
    color: var(--icon-gray);
    padding: 2px 8px;
    border: 1px solid transparent;
}

.voice-opt.active {
    color: var(--icon-active);
    border-bottom: 1px solid var(--icon-active);
    font-weight: bold;
}

/* ========== 定时器组 ========== */
.timer-group {
    margin-top: 15px;
    display: flex;
    gap: 10px;
    justify-content: center;
    align-items: center;
}

.timer-btn {
    font-size: 12px;
    color: #7f8c8d;
    cursor: pointer;
    background: var(--card-bg);
    padding: 3px 8px;
    border-radius: 4px;
    border: 1px solid transparent;
}

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

.timer-display {
    font-family: monospace;
    font-size: 14px;
    color: var(--red);
    font-weight: bold;
    min-width: 60px;
}

.timer-pause-btn {
    font-size: 12px;
    color: #fff;
    cursor: pointer;
    background: #e67e22;
    padding: 3px 10px;
    border-radius: 4px;
    border: none;
    margin-left: 5px;
}

.timer-pause-btn:hover {
    background: #d35400;
}

.timer-pause-btn.paused {
    background: var(--green);
}

/* 同步状态 */
.sync-status {
    font-size: 12px;
    color: #888;
    margin-top: 15px;
}

/* ========== 词库选择面板 ========== */
.vocab-panel {
    position: fixed;
    left: 20px;
    top: 50%;
    transform: translateY(-50%);
    z-index: 100;
}

.vocab-toggle {
    background: var(--card-bg);
    border: 1px solid var(--input-border);
    border-radius: 8px;
    padding: 10px 14px;
    cursor: pointer;
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: all 0.2s;
}

.vocab-toggle:hover {
    border-color: var(--icon-active);
}

.vocab-toggle .arrow {
    transition: transform 0.3s;
}

.vocab-panel.open .vocab-toggle .arrow {
    transform: rotate(180deg);
}

.vocab-dropdown {
    position: absolute;
    left: 0;
    top: calc(100% + 8px);
    background: var(--card-bg);
    border: 1px solid var(--input-border);
    border-radius: 12px;
    padding: 12px;
    width: 240px;
    max-height: 50vh;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.3s;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
}

.vocab-panel.open .vocab-dropdown {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.vocab-list {
    max-height: calc(50vh - 40px);
    overflow-y: auto;
}

.vocab-item {
    padding: 10px 12px;
    margin: 4px 0;
    background: var(--bg-color);
    border: 1px solid var(--input-border);
    border-radius: 6px;
    cursor: pointer;
    font-size: 13px;
    transition: all 0.2s;
    word-break: break-all;
}

.vocab-item:hover {
    border-color: var(--icon-active);
    background: rgba(52, 152, 219, 0.1);
}

.vocab-item.selected {
    border-color: var(--green);
    background: rgba(39, 174, 96, 0.15);
    color: var(--green);
}

.vocab-item.loading {
    opacity: 0.6;
    pointer-events: none;
}

.vocab-loading {
    text-align: center;
    color: var(--icon-gray);
    padding: 20px;
    font-size: 12px;
}

.vocab-error {
    text-align: center;
    color: var(--red);
    padding: 10px;
    font-size: 12px;
}

/* ========== 登录模态框 ========== */
.login-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.85);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 2000;
}

.login-box {
    background: var(--card-bg);
    border: 1px solid var(--input-border);
    border-radius: 16px;
    padding: 30px 20px;
    /* 减小内边距适配小屏 */
    width: 90%;
    /* 使用百分比宽度 */
    max-width: 350px;
    /* 增加一点最大宽度给大屏 */
    text-align: center;
    box-sizing: border-box;
    /* 防止 padding 导致溢出 */
}

.login-box h2 {
    margin: 0 0 20px 0;
    font-size: 22px;
}

.login-box select {
    width: 100%;
    padding: 12px;
    font-size: 16px;
    border-radius: 8px;
    border: 1px solid var(--input-border);
    background: var(--bg-color);
    color: var(--text-color);
    margin-bottom: 20px;
}

.login-box .timer-options {
    display: flex;
    gap: 8px;
    margin-bottom: 20px;
    justify-content: center;
    flex-wrap: wrap;
    /* 允许换行防止溢出 */
}

.login-box .timer-opt {
    padding: 8px 12px;
    /* 减小按钮内边距 */
    background: var(--bg-color);
    border: 2px solid var(--input-border);
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.2s;
}

.login-box .timer-opt:hover {
    border-color: var(--icon-active);
}

.login-box .timer-opt.selected {
    border-color: var(--green);
    background: rgba(39, 174, 96, 0.15);
    color: var(--green);
}

.login-box button {
    width: 100%;
    padding: 12px;
    font-size: 16px;
    background: var(--icon-active);
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
}

.login-box button:hover {
    opacity: 0.9;
}

.login-box button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* 登录输入框统一样式 */
.login-input {
    width: 100%;
    box-sizing: border-box;
    padding: 12px 15px;
    margin-bottom: 15px;
    border: 2px solid var(--input-border);
    border-radius: 8px;
    background: var(--bg-color);
    color: var(--text-color);
    font-size: 15px;
    outline: none;
    transition: all 0.2s;
}

.login-input:focus {
    border-color: var(--icon-active);
    background: var(--card-bg);
    box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.2);
}

.login-input::placeholder {
    color: var(--icon-gray);
    opacity: 0.7;
}

/* ========== 设置模态框 ========== */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s;
}

.modal-overlay.open {
    opacity: 1;
    pointer-events: auto;
}

.modal-box {
    background: var(--card-bg);
    border: 1px solid var(--input-border);
    border-radius: 12px;
    padding: 25px;
    width: 420px;
    max-width: 90%;
    max-height: 80vh;
    overflow-y: auto;
}

.modal-box h2 {
    margin-top: 0;
    font-size: 18px;
    border-bottom: 1px solid var(--input-border);
    padding-bottom: 10px;
}

.form-row {
    margin-bottom: 15px;
}

.form-row label {
    display: block;
    font-size: 12px;
    color: var(--icon-gray);
    margin-bottom: 5px;
}

.form-row input {
    width: 100%;
    box-sizing: border-box;
    padding: 8px 10px;
    background: var(--bg-color);
    border: 1px solid var(--input-border);
    border-radius: 4px;
    color: var(--text-color);
    font-family: monospace;
    font-size: 13px;
}

.form-row input:focus {
    border-color: var(--icon-active);
    outline: none;
}

.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 20px;
    padding-top: 15px;
    border-top: 1px solid var(--input-border);
}

.modal-btn {
    padding: 8px 16px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 13px;
    border: none;
}

.modal-btn.cancel {
    background: var(--card-bg);
    border: 1px solid var(--icon-gray);
    color: var(--text-color);
}

.modal-btn.save {
    background: var(--icon-active);
    color: white;
}

/* ========== 工具类 ========== */
.hide-cursor,
.hide-cursor * {
    cursor: none !important;
}

/* 提交按钮 - 全设备可见 */
.mobile-submit-btn {
    display: block;
    width: 100%;
    max-width: 200px;
    margin: 20px auto 0;
    padding: 12px 24px;
    font-size: 18px;
    font-weight: bold;
    background: #3498db;
    color: #fff;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.2s;
}

.mobile-submit-btn:hover {
    background: #2980b9;
}

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

.mobile-submit-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    background: #7f8c8d;
}

/* ========== 响应式布局 - 平板 (≤768px) ========== */
@media screen and (max-width: 768px) {
    body {
        padding: 10px;
        padding-top: 10px;
    }

    /* 顶部控制区调整 - 不使用 fixed，避免遮挡 */
    .header-controls {
        position: relative;
        top: auto;
        right: auto;
        gap: 5px;
        z-index: 50;
        justify-content: flex-end;
        margin-bottom: 10px;
    }

    .user-display {
        position: relative;
        top: auto;
        left: auto;
        z-index: 50;
        flex-wrap: wrap;
        max-width: 100%;
        margin-bottom: 10px;
    }

    /* 词库面板 - 相对定位 */
    .vocab-panel {
        position: relative;
        left: auto;
        top: auto;
        width: 100%;
        max-width: none;
        z-index: 50;
        margin-bottom: 15px;
    }

    .vocab-dropdown {
        max-height: 40vh;
    }

    /* 核心显示区 */
    #target-display {
        font-size: 36px;
        height: auto;
        min-height: 45px;
        padding: 0 10px;
        word-break: break-word;
    }

    .input-wrapper {
        max-width: 100%;
        height: 60px;
        padding: 0;
        box-sizing: border-box;
        margin: 0 10px;
    }

    .pixel-font {
        font-size: 28px;
        letter-spacing: 4px;
        padding: 0 10px;
        box-sizing: border-box;
    }

    /* 确保 overlay 正确显示 */
    #result-overlay {
        overflow: hidden;
        text-overflow: ellipsis;
    }

    /* 翻译区域 */
    .translation {
        font-size: 16px;
        max-width: 100%;
        padding: 10px;
    }

    /* 按钮改为触摸友好大小 */
    .file-label,
    .dict-label,
    .sync-btn,
    .del-btn {
        padding: 10px 12px;
        font-size: 13px;
        min-height: 40px;
    }

    /* 工具栏 - 移动端优化 */
    .toolbar {
        flex-direction: column;
        gap: 10px;
        align-items: stretch;
    }

    .toolbar .btn-group {
        display: flex;
        flex-wrap: wrap;
        gap: 8px;
        justify-content: center;
    }

    /* 提交按钮移动端微调 */
    .mobile-submit-btn {
        margin: 15px auto 0;
    }

    .timer-opt {
        padding: 10px 16px;
        font-size: 14px;
        min-height: 44px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
    }

    /* 登录框 */
    .login-box {
        width: 95%;
        max-width: 400px;
        padding: 20px;
        margin: 10px;
    }

    .login-input {
        padding: 14px;
        font-size: 16px;
    }

    /* 模态框 */
    .progress-modal,
    .settings-modal {
        width: 95%;
        max-width: 400px;
        max-height: 85vh;
        padding: 15px;
    }

    /* 底部控制区 */
    .bottom-controls {
        flex-wrap: wrap;
        gap: 8px;
        padding: 10px;
    }

    /* 功能按钮组 */
    .func-group {
        flex-wrap: wrap;
        justify-content: center;
        gap: 8px;
    }

    /* 倒计时显示 */
    #timer-display {
        font-size: 18px;
    }

    #timer-pause-btn {
        padding: 8px 12px;
        min-height: 44px;
    }
}

/* ========== 响应式布局 - 手机 (≤480px) ========== */
@media screen and (max-width: 480px) {
    body {
        padding: 5px;
        padding-top: 50px;
    }

    /* 顶部控制区更紧凑 */
    .header-controls {
        top: 5px;
        right: 5px;
    }

    .theme-selector {
        padding: 4px 8px;
        font-size: 12px;
    }

    .user-display {
        top: 5px;
        left: 5px;
        font-size: 12px;
    }

    .switch-user-btn {
        font-size: 11px;
        padding: 2px 6px;
    }

    /* 更小的目标词显示 */
    #target-display {
        font-size: 28px;
        min-height: 35px;
    }

    /* 更小的输入框 */
    .input-wrapper {
        height: 50px;
    }

    .pixel-font {
        font-size: 22px;
        letter-spacing: 2px;
    }

    /* 翻译区更紧凑 */
    .translation {
        font-size: 14px;
        line-height: 1.6;
    }

    .translation .phonetic {
        font-size: 16px;
    }

    /* 进度/连击显示 */
    .combo-info {
        font-size: 16px;
    }

    /* 模式指示 */
    .mode-indicator {
        font-size: 13px;
        padding: 4px 10px;
    }

    /* 时长选择更紧凑 */
    .timer-options {
        gap: 5px;
    }

    .timer-opt {
        padding: 8px 12px;
        font-size: 12px;
    }

    /* 登录框 */
    .login-box {
        padding: 15px;
    }

    .login-box h2 {
        font-size: 18px;
    }

    /* 功能按钮 */
    .file-label,
    .dict-label,
    .sync-btn,
    .del-btn {
        padding: 10px 14px;
        font-size: 14px;
    }

    /* 词库面板 */
    .vocab-toggle {
        font-size: 14px;
        padding: 8px 12px;
    }

    .vocab-item {
        padding: 10px 12px;
        font-size: 13px;
    }

    /* 进度选择模态框 */
    .progress-item {
        padding: 10px;
    }

    .progress-label {
        font-size: 13px;
    }

    .progress-actions button {
        padding: 6px 10px;
        font-size: 12px;
    }

    /* 隐藏一些非必要元素 */
    .speed-control label {
        font-size: 12px;
    }

    .speed-control select {
        font-size: 12px;
        padding: 4px;
    }
}

/* ========== 触摸设备优化 ========== */
@media (hover: none) and (pointer: coarse) {

    /* 增大所有可点击元素 */
    button,
    .timer-opt,
    .vocab-item,
    a {
        min-height: 44px;
        min-width: 44px;
    }

    /* 移除 hover 效果避免粘滞 */
    .timer-opt:hover,
    .vocab-item:hover,
    button:hover {
        transform: none;
    }

    /* 激活状态反馈 */
    .timer-opt:active,
    .vocab-item:active,
    button:active {
        opacity: 0.7;
        transform: scale(0.98);
    }
}

/* ========== 横屏手机优化 ========== */
@media screen and (max-height: 500px) and (orientation: landscape) {
    body {
        padding-top: 10px;
    }

    .header-controls,
    .user-display {
        position: relative;
        top: 0;
        left: 0;
        right: 0;
    }

    #target-display {
        font-size: 24px;
        margin-bottom: 10px;
    }

    .input-wrapper {
        height: 45px;
    }

    .pixel-font {
        font-size: 20px;
    }

    .footer-info {
        margin-top: 10px;
    }

    .translation {
        font-size: 13px;
        padding: 5px;
    }
}

/* ========== 深色模式下的移动端优化 ========== */
@media screen and (max-width: 768px) {

    /* 确保在移动端触摸时有足够对比度 */
    .timer-opt.selected {
        box-shadow: 0 0 0 2px var(--green);
    }

    .vocab-item.selected {
        box-shadow: 0 0 0 2px var(--icon-active);
    }
}

/* ========== 安全区域适配 (iPhone X 等刘海屏) ========== */
@supports (padding: max(0px)) {

    .login-overlay,
    .progress-modal-overlay {
        padding-left: max(10px, env(safe-area-inset-left));
        padding-right: max(10px, env(safe-area-inset-right));
        padding-bottom: max(10px, env(safe-area-inset-bottom));
    }

    .bottom-controls {
        padding-bottom: max(10px, env(safe-area-inset-bottom));
    }
}

/* ========== 统计信息面板 ========== */
.stats-panel {
    position: fixed;
    right: 20px;
    top: 50%;
    transform: translateY(-50%);
    z-index: 100;
}

.stats-toggle {
    background: var(--card-bg);
    border: 1px solid var(--input-border);
    border-radius: 8px;
    padding: 10px 14px;
    cursor: pointer;
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: all 0.2s;
    color: var(--text-color);
}

.stats-toggle:hover {
    border-color: var(--icon-active);
}

.stats-arrow {
    transition: transform 0.3s;
    font-size: 10px;
}

.stats-panel.open .stats-toggle .stats-arrow {
    transform: rotate(180deg);
}

.stats-content {
    position: absolute;
    right: 0;
    top: calc(100% + 8px);
    background: var(--card-bg);
    border: 1px solid var(--input-border);
    border-radius: 12px;
    padding: 15px;
    width: 600px;
    max-width: 85vw;
    height: 500px;
    max-height: 70vh;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.3s;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
    display: flex;
    flex-direction: column;
}

.stats-panel.open .stats-content {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.stats-header {
    font-size: 16px;
    font-weight: bold;
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--input-border);
    color: var(--icon-active);
}

.stats-table-wrapper {
    flex: 1;
    overflow-y: auto;
    border-radius: 8px;
    background: rgba(0, 0, 0, 0.15);
}

.stats-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
    table-layout: fixed;
}

.stats-table th {
    position: sticky;
    top: 0;
    background: var(--dark-blue);
    color: white;
    padding: 10px;
    text-align: left;
    font-weight: normal;
    z-index: 10;
}

.stats-table td {
    padding: 12px 10px;
    border-bottom: 1px solid var(--input-border);
    color: var(--text-color);
    word-break: break-all;
}

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

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

/* 列宽分配 */
.stats-table th:nth-child(1),
.stats-table td:nth-child(1) {
    width: 130px;
}

.stats-table th:nth-child(2),
.stats-table td:nth-child(2) {
    width: auto;
}

.stats-table th:nth-child(3),
.stats-table td:nth-child(3) {
    width: 50px;
    text-align: center;
}

.stats-table th:nth-child(4),
.stats-table td:nth-child(4) {
    width: 60px;
    text-align: center;
}

.stats-table th:nth-child(5),
.stats-table td:nth-child(5) {
    width: 60px;
    text-align: center;
}

.stats-table th:nth-child(6),
.stats-table td:nth-child(6) {
    width: 60px;
    text-align: center;
}

.stats-table th:nth-child(7),
.stats-table td:nth-child(7) {
    width: 60px;
    text-align: center;
}

.stats-mode-new {
    color: var(--green);
}

.stats-mode-error {
    color: var(--red);
}

.stats-table td.stats-count {
    color: var(--orange) !important;
    font-weight: bold;
}

/* 响应式适配 */
@media screen and (max-width: 768px) {
    .stats-panel {
        position: relative;
        right: auto;
        top: auto;
        transform: none;
        width: 100%;
        margin-bottom: 15px;
    }

    .stats-toggle {
        width: auto;
        justify-content: space-between;
    }

    .stats-content {
        position: absolute;
        width: 100%;
        max-width: none;
        left: 0;
        right: 0;
        top: calc(100% + 5px);
        height: 60vh;
    }
}