/* ===========================================
   CSS 变量 / 全局重置
   =========================================== */
:root {
    /* iOS 系统色系 */
    --primary-color: #007AFF;
    --warning-color: #FF9500;
    --purple-color: #5856D6;
    --text-primary: #1C1C1E;
    --text-secondary: #3A3A3C;
    --text-muted: #8E8E93;
    --border-color: rgba(60, 60, 67, 0.12);
    --bg-primary: #fff;
    --bg-secondary: #F2F2F7;
    --bg-tertiary: #E5E5EA;
    --text-inverse: #fff;
    /* 语义色：danger=危险/删除，win=赢/正数，loss=输/负数，risk=风险值 */
    --color-danger: #FF3B30;
    --color-win: #FF3B30;
    --color-loss: #1A7F37;
    --color-risk: #FF3B30;
    /* 号码波色（业务色，与语义色分开） */
    --wave-red: #FF3B30;
    --wave-green: #34C759;
    /* 毛玻璃与阴影 */
    --glass-bg: rgba(255, 255, 255, 0.82);
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.06);
    --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.08);
    --shadow-lg: 0 8px 30px rgba(0, 0, 0, 0.12);
    --border-radius: 12px;
    --border-radius-sm: 8px;
    --border-radius-lg: 20px;
    --transition: all 0.25s ease;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

/* 滚动容器：html 是唯一滚动容器
   body 用 flex column，footer 用 position: sticky; bottom: 0
   sticky 比 fixed 宽容——iOS Safari 上不会退化为 absolute，
   只有 overflow: hidden 才会破坏它（auto/scroll 没问题） */
html {
    overflow-y: auto;
    overflow-x: hidden;
}

html::-webkit-scrollbar, body::-webkit-scrollbar,
.main-content::-webkit-scrollbar,
#stats-content::-webkit-scrollbar {
    display: none;
    width: 0;
    height: 0;
}

html, body, .main-content, #stats-content {
    scrollbar-width: none;
    -ms-overflow-style: none;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Text', 'Segoe UI', Roboto, sans-serif;
    background-color: var(--bg-secondary);
    color: var(--text-primary);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    /* 金额/数字等宽对齐 */
    font-variant-numeric: tabular-nums;
    /* Flex column：header + 主内容 + footer */
    display: flex;
    flex-direction: column;
    min-height: 100dvh;
    overflow: visible;
}

input, textarea, select, button {
    font-family: inherit;
}

/* iOS 风格按压反馈 */
button {
    touch-action: manipulation;
    transition: var(--transition);
}
button:active {
    transform: scale(0.96);
    opacity: 0.85;
}

/* 按钮内 SVG 图标（SF Symbols 风格，随文字着色） */
button svg {
    width: 15px;
    height: 15px;
    flex-shrink: 0;
}

/* 图标+文字横排的按钮统一 flex 布局 */
.btn-manual, .btn-log, .btn-settings, .btn-account,
.btn-submit, .btn-cancel, .btn-redo, .btn-clear,
.btn-copy, .btn-report, .btn-history,
.btn-primary, .btn-secondary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
}

/* 非 button 胶囊的按压反馈（label/div 类控件） */
.log-filter-item, .dropdown-selected,
.rebate-label, .stats-control-btn, .tab {
    transition: var(--transition);
}
.log-filter-item:active, .dropdown-selected:active,
.rebate-label:active, .stats-control-btn:active, .tab:active {
    transform: scale(0.96);
    opacity: 0.85;
}

/* ===========================================
   顶部导航栏
   =========================================== */
.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 12px;
    gap: 8px;
    /* 毛玻璃顶栏 */
    background: var(--glass-bg);
    -webkit-backdrop-filter: saturate(180%) blur(20px);
    backdrop-filter: saturate(180%) blur(20px);
    border-bottom: 0.5px solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: 900;
    flex-shrink: 0;
}

/* 标题区：地区名与副标题同一行基线对齐 */
.header-left {
    display: flex;
    align-items: baseline;
    gap: 6px;
    min-width: 0;
    flex-shrink: 1;
    overflow: hidden;
}

.header-left h1 {
    font-size: 16px;
    font-weight: 700;
    color: var(--primary-color);
    white-space: nowrap;
    flex-shrink: 0;
}

.header-left p {
    font-size: 12px;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.header-right {
    display: flex;
    gap: 6px;
    flex-shrink: 0;
    align-items: center;
}

/* 兑奖界面：隐藏手册/日志，显示"上报对比"开关（置于设置按钮之前）；其他界面相反 */
.header-right .header-report-toggle {
    display: none;
}
body.is-prize-page .btn-manual,
body.is-prize-page .btn-log {
    display: none;
}
body.is-prize-page .header-report-toggle {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-left: 0;
    padding: 8px 14px;
    border-radius: 999px;
    background: rgba(0, 122, 255, 0.12);
    color: var(--primary-color);
    font-size: 14px;
    font-weight: 400;
    white-space: nowrap;
    flex-shrink: 0;
    cursor: pointer;
}
body.is-prize-page .header-report-toggle .auto-grow-label {
    font-size: 14px;
    font-weight: 400;
    color: var(--primary-color);
}

/* 顶部按钮：iOS 染色胶囊（手册/日志/设置/账号 外观一致） */
.btn-manual, .btn-log, .btn-settings, .btn-account {
    padding: 8px 14px;
    border: none;
    border-radius: 999px;
    font-size: 14px;
    font-weight: 400;
    cursor: pointer;
    min-width: 0;
    white-space: nowrap;
    background: rgba(0, 122, 255, 0.12);
    color: var(--primary-color);
}

/* ===========================================
   主要内容
   =========================================== */
.main-content {
    padding: 12px;
    flex: 1;
    min-height: 0;
}

/* ===========================================
   数据输入区域
   =========================================== */
.input-section {
    margin-bottom: 8px;
}

/* 标签切换 */
.tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 8px;
    align-items: center;
}

.btn-add-user {
    border: none;
    border-radius: 50%;
    background-color: var(--primary-color);
    color: var(--text-inverse);
    cursor: pointer;
    width: 30px;
    height: 30px;
    min-width: 30px;
    min-height: 30px;
    padding: 0;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-left: auto;
    box-shadow: var(--shadow-sm);
}

.btn-add-user svg {
    width: 16px;
    height: 16px;
}

/* 标签：iOS 胶囊 */
.tab, .tab-select {
    padding: 6px 12px;
    border: none;
    border-radius: 999px;
    background-color: var(--bg-tertiary);
    color: var(--text-secondary);
    cursor: pointer;
    transition: var(--transition);
}

.tab {
    font-size: 14px;
    min-width: 70px;
    max-width: 90px;
}

.tab-select {
    padding: 8px 30px 8px 12px;
    font-size: 16px;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    background: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="12" height="6" viewBox="0 0 12 6"><path fill="%23333" d="M0 0l6 6 6-6z"/></svg>') no-repeat right 8px center;
    min-width: 100px;
    max-width: 120px;
}

.tab.active {
    background-color: var(--primary-color);
    color: #fff;
    box-shadow: var(--shadow-sm);
}

.tab-select.active {
    background-color: var(--primary-color);
    color: #fff;
    background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="12" height="6" viewBox="0 0 12 6"><path fill="%23fff" d="M0 0l6 6 6-6z"/></svg>');
}

/* 自定义下拉框 */
.custom-dropdown {
    position: relative;
    display: inline-block;
    min-width: 100px;
    max-width: 120px;
    vertical-align: middle;
}

.dropdown-selected {
    padding: 6px 24px 6px 12px;
    border: none;
    border-radius: 999px;
    background: var(--bg-tertiary) url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="10" height="5" viewBox="0 0 10 5"><path fill="%23333" d="M0 0l5 5 5-5z"/></svg>') no-repeat right 10px center;
    font-size: 14px;
    font-weight: 500;
    color: var(--text-secondary);
    cursor: pointer;
    transition: var(--transition);
    min-height: 30px;
    display: flex;
    align-items: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.dropdown-selected:hover {
    background-color: #dcdce1;
}

.dropdown-selected.active {
    background-color: var(--primary-color);
    color: #fff;
    border-color: var(--primary-color);
    background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="12" height="6" viewBox="0 0 12 6"><path fill="%23fff" d="M0 0l6 6 6-6z"/></svg>');
}

.dropdown-list {
    position: absolute;
    inset: 100% 0 auto 0;
    background-color: var(--bg-primary);
    border: none;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-lg);
    z-index: 1000;
    max-height: 200px;
    overflow-y: auto;
    margin-top: 6px;
    min-width: 120px;
}

.dropdown-item {
    padding: 10px 12px;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: background-color 0.2s ease;
    border-bottom: 0.5px solid var(--border-color);
}

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

.dropdown-item:hover {
    background-color: var(--bg-secondary);
}

.dropdown-text {
    flex: 1;
    font-size: 16px;
    color: var(--text-primary);
}

.delete-btn {
    color: var(--color-danger);
    background: rgba(255, 59, 48, 0.12);
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    padding: 3px 10px;
    border-radius: 999px;
    transition: all 0.2s ease;
    line-height: 1.2;
    white-space: nowrap;
}

.delete-btn:hover {
    background-color: #FF3B30;
    color: #fff;
}

/* 输入容器 */
.input-container {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 8px;
}

.input-container textarea {
    width: 100%;
    min-height: 56px;
    padding: 10px;
    border: none;
    border-radius: var(--border-radius);
    background: var(--bg-primary);
    box-shadow: var(--shadow-sm);
    font-size: 14px;
    resize: none;
    margin-bottom: 4px;
    overflow-y: hidden;
    transition: box-shadow 0.2s ease;
}

.input-container textarea::placeholder {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-muted);
}

.input-container textarea:focus {
    outline: none;
    box-shadow: 0 0 0 2px rgba(0, 122, 255, 0.35);
}

.input-buttons {
    display: flex;
    gap: 6px;
    justify-content: space-between;
    flex-wrap: nowrap;
    width: 100%;
}

.btn-submit, .btn-cancel, .btn-redo, .btn-clear {
    flex: 1;
    padding: 8px 4px;
    border: none;
    border-radius: var(--border-radius);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    min-height: 36px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    box-shadow: var(--shadow-sm);
}

.btn-submit {
    background-color: var(--primary-color);
    color: #fff;
}

/* 撤销/重做：iOS 染色（橙=回退，紫=前进），与主操作区分 */
.btn-cancel {
    background-color: rgba(255, 149, 0, 0.14);
    color: var(--warning-color);
    box-shadow: none;
}

.btn-redo {
    background-color: rgba(88, 86, 214, 0.14);
    color: var(--purple-color);
    box-shadow: none;
}

/* 删除输入 / 删除全部：箭头朝上为删除输入（蓝），全选时朝下并转为危险红 */
.btn-clear {
    background-color: rgba(0, 122, 255, 0.14);
    color: var(--primary-color);
    gap: 4px;
}

.btn-clear .btn-clear-arrow {
    width: 12px;
    height: 12px;
    transition: transform 0.2s ease;
    flex-shrink: 0;
}

.btn-clear.is-all {
    background-color: var(--color-danger);
    color: #fff;
}

.btn-clear.is-all .btn-clear-arrow {
    transform: rotate(180deg);
}

/* ===========================================
   统计结果区域
   =========================================== */
.result-section {
    background-color: var(--bg-primary);
    border-radius: var(--border-radius-lg);
    padding: 8px 14px;
    box-shadow: var(--shadow-md);
}

.result-header {
    margin-bottom: 6px;
}

.result-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
}

.result-item {
    flex: 1;
    text-align: center;
    font-size: 14px;
    color: var(--text-primary);
}

.result-item:first-child {
    font-size: 16px;
    color: var(--primary-color);
    font-weight: bold;
    flex: 0 0 40px;
    text-align: left;
    cursor: pointer;
    user-select: none;
}

.result-item:nth-child(2) {
    font-size: 14px;
    color: var(--text-primary);
}

.total-amount {
    color: var(--color-win);
    font-weight: bold;
    font-variant-numeric: tabular-nums;
}

.rebate-amount {
    color: var(--primary-color);
    font-weight: bold;
}

.result-controls {
    display: flex;
    gap: 6px;
    margin-bottom: 8px;
    align-items: center;
    flex-wrap: nowrap;
}

/* 表头排序：点击表头切换升降序 */
#zodiac-table thead th[data-sort] {
    transition: var(--transition);
    cursor: pointer;
}

#zodiac-table thead th[data-sort]:active {
    opacity: 0.6;
}

/* 激活列：表头本身变蓝（号码生肖无箭头也能看出当前列） */
#zodiac-table thead th.sort-active {
    color: var(--primary-color);
}

/* 结果区操作按钮：统一胶囊，按功能 iOS 染色 */
.btn-copy, .btn-report, .btn-history {
    flex: 1;
    padding: 11px 16px;
    border: none;
    border-radius: 999px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
    min-width: 0;
}

/* 复制=蓝、上报=橙（醒目）、历史=紫 */
.btn-copy {
    background-color: rgba(0, 122, 255, 0.12);
    color: var(--primary-color);
}

.btn-report {
    background-color: rgba(255, 149, 0, 0.14);
    color: var(--warning-color);
}

.btn-history {
    background-color: rgba(88, 86, 214, 0.13);
    color: var(--purple-color);
}

.result-table {
    width: 100%;
    overflow: auto;
    max-height: calc(100vh - 300px);
    /* dvh 跟随动态视口（旧浏览器忽略此行，回退上一行 vh） */
    max-height: calc(100dvh - 300px);
    scrollbar-width: thin;
    scrollbar-color: var(--primary-color) #f0f0f0;
}

.result-table::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

.result-table::-webkit-scrollbar-track {
    background: #f0f0f0;
    border-radius: 3px;
}

.result-table::-webkit-scrollbar-thumb {
    background: var(--primary-color);
    border-radius: 3px;
}

.result-table::-webkit-scrollbar-thumb:hover {
    background: #0056b3;
}

table {
    width: 100%;
    border-collapse: collapse;
}

th, td {
    padding: 10px;
    text-align: left;
    border-bottom: 0.5px solid var(--border-color);
    font-size: 20px;
}

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

th {
    font-weight: 600;
    font-size: 16px;
    color: var(--text-muted);
    background-color: var(--bg-primary);
    padding: 0 8px;
    line-height: 1.2;
    position: sticky;
    top: 0;
    z-index: 2;
}

/* 序号列表头：紧凑且固定在表格顶部，可点击排序/全选 */
#zodiac-table thead th {
    cursor: pointer;
    user-select: none;
}

/* 号码波色 */
.number-red { color: var(--wave-red); }
.number-blue { color: var(--primary-color); }
.number-green { color: var(--wave-green); }

/* 风险值颜色（risk） */
.risk-high { color: var(--color-risk); }
.risk-low { color: var(--color-loss); }

/* 输赢结果色（win / loss），与风险色分开维护 */
.win { color: var(--color-win); }
.loss { color: var(--color-loss); }

/* 序号复选框：放大一点便于点击 */
.number-checkbox {
    transform: scale(1.1);
    margin-right: 6px;
    cursor: pointer;
    accent-color: var(--primary-color);
}

/* ===========================================
   底部导航栏
   =========================================== */
.footer {
    display: flex;
    justify-content: space-around;
    align-items: center;
    padding: 6px 8px calc(6px + env(safe-area-inset-bottom, 0px));
    /* 毛玻璃底栏 */
    background: var(--glass-bg);
    -webkit-backdrop-filter: saturate(180%) blur(20px);
    backdrop-filter: saturate(180%) blur(20px);
    border-top: 0.5px solid var(--border-color);
    /* sticky 比 fixed 更宽容（iOS Safari 不会退化为 absolute）
       在 flex column 中 sticky bottom:0 = 短内容贴底、长内容滚到它时贴视口 */
    position: sticky;
    bottom: 0;
    flex-shrink: 0;
    z-index: 900;
}

.footer-btn {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: center;
    background: none;
    border: none;
    cursor: pointer;
    padding: 8px 16px;
    min-width: 84px;
    gap: 6px;
    color: var(--text-muted);
    border-radius: var(--border-radius);
}

.footer-btn.active {
    color: var(--primary-color);
    background: rgba(0, 122, 255, 0.1);
}

.footer-icon {
    display: inline-flex;
    align-items: center;
}

.footer-icon svg {
    width: 18px;
    height: 18px;
}

.footer-btn span:last-child {
    font-size: 16px;
    font-weight: 700;
    letter-spacing: 0.5px;
}

/* ===========================================
   添加记录全屏弹窗
   =========================================== */
.popup {
    position: fixed;
    inset: 0;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 16px;
}

.popup.show {
    display: flex;
}

/* 弹窗卡片：桌面端居中、限宽；移动端由媒体查询切为全屏 */
.popup-card {
    background-color: var(--bg-secondary);
    border-radius: var(--border-radius-lg);
    width: 100%;
    max-width: 560px;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: var(--shadow-lg);
    animation: popupSlideIn 0.3s ease-out;
}

@keyframes popupSlideIn {
    from {
        opacity: 0;
        transform: translateY(50px) scale(0.9);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* 弹窗顶栏：毛玻璃 + iOS 居中标题 */
.popup-header {
    background: var(--glass-bg);
    -webkit-backdrop-filter: saturate(180%) blur(20px);
    backdrop-filter: saturate(180%) blur(20px);
    color: var(--text-primary);
    padding: 8px 16px;
    display: flex;
    align-items: center;
    position: relative;
    height: 48px;
    min-height: 48px;
    border-bottom: 0.5px solid var(--border-color);
}

.popup-back {
    background: none;
    border: none;
    color: var(--primary-color);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    margin-right: 16px;
    padding: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.popup-header h2 {
    font-size: 16px;
    font-weight: 600;
    margin: 0;
    padding: 0;
    line-height: 1.5;
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
}

/* 输入框自适应高度开关（弹窗顶栏最右）：默认关=输入框固定大小，开=高度跟随文本 */
.auto-grow-toggle {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 4px;
    cursor: pointer;
    z-index: 1;
}
.auto-grow-toggle input {
    display: none;
}
.auto-grow-label {
    font-size: 11px;
    color: var(--text-secondary);
}
.auto-grow-slider {
    width: 32px;
    height: 18px;
    background: #ccc;
    border-radius: 9px;
    position: relative;
    transition: background 0.2s;
    flex-shrink: 0;
}
.auto-grow-slider::after {
    content: '';
    position: absolute;
    width: 14px;
    height: 14px;
    background: #fff;
    border-radius: 50%;
    top: 2px;
    left: 2px;
    transition: left 0.2s;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}
.auto-grow-toggle input:checked + .auto-grow-slider {
    background: var(--primary-color);
}
.auto-grow-toggle input:checked + .auto-grow-slider::after {
    left: 16px;
}

.popup-content {
    flex: 1;
    padding: 16px;
    overflow-y: auto;
    /* iOS 惯性滚动，避免滚动卡顿/穿透 */
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
}

.input-row {
    position: relative;
    margin-bottom: 20px;
}

.input-row.fixed-top {
    position: sticky;
    top: 0;
    background-color: var(--bg-secondary);
    padding: 10px 0;
    z-index: 10;
}

.input-row textarea {
    width: 100%;
    padding: 12px;
    border: none;
    border-radius: var(--border-radius);
    background: var(--bg-primary);
    box-shadow: var(--shadow-sm);
    font-size: 16px;
    box-sizing: border-box;
    resize: vertical;
    min-height: 100px;
}

.input-row textarea:focus {
    outline: none;
    box-shadow: 0 0 0 2px rgba(0, 122, 255, 0.35);
}

/* 输入高亮叠层：范围("至")=蓝底，无法解析/被跳过=红底。
 * textarea 文字保持可见，高亮层的文字透明、仅 span 背景透出。 */
.input-highlight-wrap {
    position: relative;
    background: var(--bg-primary);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-sm);
}
.input-highlight-wrap textarea {
    position: relative;
    background: transparent;
    box-shadow: none;
    line-height: 1.5;
    word-break: break-all;
    /* 自适应高度增长/收缩平滑过渡（测量瞬间由 JS 临时置 none 避免抖动） */
    transition: height 0.18s ease;
}
.input-highlight-layer {
    position: absolute;
    inset: 0;
    padding: 12px;
    font-size: 16px;
    line-height: 1.5;
    white-space: pre-wrap;
    word-break: break-all;
    overflow: hidden;
    pointer-events: none;
    color: transparent;
    box-sizing: border-box;
}
.input-highlight-layer .hl-range {
    background: rgba(0, 122, 255, 0.28);
    border-radius: 3px;
}
.input-highlight-layer .hl-unparsed {
    background: rgba(255, 59, 48, 0.35);
    border-radius: 3px;
}

/* 解析遗落/过滤提示 */
.parse-hint {
    margin: -12px 0 16px;
    padding: 10px 12px;
    border-radius: 8px;
    background: rgba(255, 149, 0, 0.12);
    border: 1px solid rgba(255, 149, 0, 0.35);
    color: #B85C00;
    font-size: 14px;
    line-height: 1.5;
}
.parse-hint[hidden] {
    display: none;
}
.parse-hint-item + .parse-hint-item {
    margin-top: 6px;
}
/* "超出号码范围"等错误提示：红色字体 */
.parse-hint-error {
    color: #d32f2f;
    font-weight: 600;
}

.input-clear {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(255, 59, 48, 0.12);
    color: var(--color-danger);
    border: none;
    border-radius: 999px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    padding: 6px 14px;
    display: flex;
    align-items: center;
    justify-content: center;
}

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

.result-section h3 {
    font-size: clamp(12px, 2.5vw, 16px);
    color: var(--text-primary);
    margin: 0;
}

.section-header .display-mode-radios {
    margin-left: 10px;
}

.result-summary {
    display: flex;
    justify-content: space-between;
    padding: 10px 12px;
    background-color: var(--bg-primary);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-sm);
    margin-bottom: 12px;
    font-size: 14px;
    font-weight: 600;
}

.record-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.record-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px;
    background-color: var(--bg-primary);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-sm);
}

/* 解析结果行：序号独立成列（右对齐、固定宽度），内容另起一列统一左对齐，
   多行时续行与首行内容左边界一致，不随序号宽度变化 */
.record-index {
    flex-shrink: 0;
    width: 2.2em;
    margin-right: 8px;
    text-align: right;
    font-variant-numeric: tabular-nums;
    color: var(--text-secondary);
}
.record-content {
    flex: 1;
    min-width: 0;
    white-space: pre-wrap;
    word-break: break-all;
    font-variant-numeric: tabular-nums;
}

/* 解析结果显示模式：详细/紧凑/属性 单选胶囊组 */
.display-mode-radios {
    display: flex;
    gap: 6px;
}

.mode-radio {
    padding: 4px 12px;
    border-radius: 999px;
    background: var(--bg-tertiary);
    color: var(--text-secondary);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    user-select: none;
    transition: var(--transition);
}

.mode-radio:has(input:checked),
.mode-radio.checked {
    background: var(--primary-color);
    color: #fff;
}

.mode-radio:active {
    transform: scale(0.96);
    opacity: 0.85;
}

.mode-radio input {
    display: none;
}

.popup-footer {
    padding: 16px;
    /* 全面屏底部安全区，防止按钮被 Home 指示条遮挡 */
    padding-bottom: calc(16px + env(safe-area-inset-bottom, 0px));
    border-top: 0.5px solid var(--border-color);
    display: flex;
    gap: 12px;
    flex-shrink: 0;
    background: var(--bg-secondary);
}

.btn-primary, .btn-secondary {
    flex: 1;
    padding: 12px 16px;
    border: none;
    border-radius: var(--border-radius);
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    min-height: 44px;
    box-shadow: var(--shadow-sm);
}

/* 弹窗底部：重新解析=紫染色（刷新），确定=实心蓝（主操作） */
.btn-primary {
    background-color: rgba(88, 86, 214, 0.14);
    color: var(--purple-color);
    box-shadow: none;
}

.btn-secondary {
    background-color: var(--primary-color);
    color: #fff;
}

/* ===========================================
   轻提示 / 输入弹窗 / 确认弹窗
   =========================================== */
.alert-box {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(30, 30, 30, 0.75);
    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);
    color: #fff;
    border-radius: 999px;
    padding: 12px 22px;
    font-size: 14px;
    font-weight: 500;
    text-align: center;
    z-index: 10100;
    box-shadow: var(--shadow-lg);
    animation: fadeInOut 1s ease-in-out;
}

@keyframes fadeInOut {
    0% { opacity: 0; transform: translate(-50%, -50%) scale(0.8); }
    20% { opacity: 1; transform: translate(-50%, -50%) scale(1); }
    80% { opacity: 1; transform: translate(-50%, -50%) scale(1); }
    100% { opacity: 0; transform: translate(-50%, -50%) scale(0.8); }
}

/* 超出号码范围等错误警告：红色字体突出 */
.alert-box.alert-box-error {
    background: rgba(180, 30, 30, 0.88);
    color: #ffe5e5;
    font-weight: 600;
}

/* 输入弹窗 */
.prompt-container {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
}

/* 吃水号码网格：金额标注（数字下方红字） */
.water-amt {
    font-size: 11px;
    font-weight: 600;
    color: #FF3B30;
    line-height: 1.2;
    min-height: 13px;
    font-variant-numeric: tabular-nums;
}

.prompt-dialog {
    background-color: white;
    padding: 20px;
    border-radius: var(--border-radius-lg);
    box-shadow: var(--shadow-lg);
    width: min(92%, 720px);
    max-height: 90vh;
    overflow-y: auto;
    animation: popupSlideIn 0.3s ease-out;
}

.prompt-message {
    margin: 0 0 16px 0;
    font-size: 16px;
    font-weight: 600;
}

.prompt-buttons {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
}

.prompt-button {
    padding: 8px 16px;
    border: none;
    border-radius: var(--border-radius-sm);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
}

.prompt-button.cancel {
    background-color: var(--bg-tertiary);
    color: var(--text-primary);
}

.prompt-button.confirm {
    background-color: var(--primary-color);
    color: white;
}

/* 设置弹窗：锁定状态下的年份输入框（灰色禁用） */
#year-input:disabled {
    background: var(--bg-tertiary);
    color: #8E8E93;
    cursor: not-allowed;
    opacity: 1;
    -webkit-text-fill-color: #8E8E93;
}

/* 确认对话框 */
.confirm-container {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 10200;
}

.confirm-box {
    background-color: var(--bg-primary);
    border-radius: var(--border-radius-lg);
    padding: 20px;
    width: min(86%, 340px);
    box-shadow: var(--shadow-lg);
    animation: popupSlideIn 0.3s ease-out;
}

.confirm-message {
    font-size: 16px;
    color: var(--text-primary);
    margin-bottom: 20px;
    text-align: center;
    word-break: break-all;
    white-space: pre-wrap;
}

.confirm-buttons {
    display: flex;
    justify-content: space-between;
    gap: 10px;
}

.confirm-button {
    flex: 1;
    padding: 10px;
    border: none;
    border-radius: var(--border-radius-sm);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
}

.confirm-button.cancel {
    background-color: var(--bg-tertiary);
    color: var(--text-primary);
}

.confirm-button.confirm {
    background-color: var(--primary-color);
    color: #fff;
}

/* 用户名输入框 */
.user-input {
    margin: 0;
    padding: 6px 10px;
    border: none;
    border-radius: var(--border-radius-sm);
    background: var(--bg-tertiary);
    font-size: 14px;
    width: 120px;
    max-width: 120px;
}

.user-input:focus {
    outline: none;
    box-shadow: 0 0 0 2px rgba(0, 122, 255, 0.35);
}

/* ===========================================
   兑奖统计界面
   =========================================== */
.stats-container {
    padding: 16px;
    background-color: var(--bg-primary);
    border-radius: var(--border-radius-lg);
    box-shadow: var(--shadow-md);
    margin-bottom: 20px;
}

/* 兑奖区地区切换：与主界面 tabs 同风格胶囊，切换时视觉连续 */
.stats-nav {
    display: flex;
    gap: 8px;
    margin-bottom: 10px;
    align-items: center;
    flex-shrink: 1;
    min-width: 0;
}

.stats-nav-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    padding: 6px 20px;
    border: none;
    border-radius: 999px;
    background: var(--bg-tertiary);
    font-size: 14px;
    font-weight: 500;
    color: var(--text-secondary);
    cursor: pointer;
    transition: var(--transition);
    min-width: 0;
    flex-shrink: 1;
    flex: 1 1 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.stats-nav-btn svg {
    width: 15px;
    height: 15px;
    flex-shrink: 0;
}

.stats-nav-btn.active {
    background: var(--primary-color);
    color: #fff;
    box-shadow: var(--shadow-sm);
}

/* 兑奖号码输入框：背景随号码波色变化（红波/蓝波/绿波） */
#special-number.number-red {
    background: rgba(255, 59, 48, 0.16);
    color: var(--wave-red);
}

#special-number.number-blue {
    background: rgba(0, 122, 255, 0.15);
    color: var(--primary-color);
}

#special-number.number-green {
    background: rgba(52, 199, 89, 0.2);
    color: #1E9E4A;
}

/* 特码输入区域 */
.special-number-container {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 8px;
    padding: 8px;
    background: var(--bg-secondary);
    border-radius: var(--border-radius);
}

/* 第一行：期号 + 特码标签 + 输入框 */
.special-row {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: nowrap;
}

/* 单笔/解析/返点/取整 整体靠右：第一个按钮 margin-left:auto 即可 */
.special-row > .stats-control-btn:first-of-type {
    margin-left: auto;
}

/* 特码标签 + 输入框：底色一体 */
.special-label {
    font-size: 16px;
    font-weight: 900;
    color: var(--wave-red);
    white-space: nowrap;
    background: rgba(255, 59, 48, 0.08);
    padding: 2px 6px;
    border-radius: 6px;
    flex-shrink: 0;
}

.special-row > #special-number {
    background: rgba(255, 59, 48, 0.08);
    border: 1px solid rgba(255, 59, 48, 0.2);
    width: 52px;
    min-width: 40px;
    flex: 0 1 auto;
}

/* 顶部操作行：澳门/香港 + 记录/查看/删除 + 期数滑动 同一横排 */
.stats-top-row {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 6px;
    flex-wrap: nowrap;
}

/* 期数滚轮 + 记录/查看/删除按钮整体靠右 */
.stats-right-group {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-left: auto;
    flex-wrap: nowrap;
    flex-shrink: 1;
    min-width: 0;
}

.stats-top-row .stats-nav,
.stats-top-row .stats-action-row {
    display: flex;
    align-items: center;
    margin-bottom: 0;
    gap: 6px;
    flex-wrap: nowrap;
}

.special-number-container label {
    font-size: 14px;
    font-weight: 600;
    white-space: nowrap;
}

.special-number-container input[type="text"] {
    min-width: 40px;
    padding: 8px 8px;
    border: none;
    border-radius: var(--border-radius-sm);
    background: var(--bg-tertiary);
    font-size: 16px;
    font-weight: 700;
    text-align: center;
}

.special-number-container input[type="text"]:focus {
    outline: none;
    background: #fff;
    box-shadow: 0 0 0 2px rgba(0, 122, 255, 0.35);
}

/* 返点：与单笔/多笔、原文/解析一致的胶囊按钮（内部 checkbox 隐藏，勾选后变蓝） */
.rebate-label {
    user-select: none;
}

.rebate-label input {
    display: none;
}

.rebate-label.active {
    background: var(--primary-color);
    color: #fff;
}

/* 兑奖区控制按钮：灰色胶囊，自适应收缩 */
.stats-control-btn {
    padding: 7px 12px;
    font-size: 14px;
    font-weight: 600;
    flex-shrink: 1;
    white-space: nowrap;
    border: none;
    border-radius: 999px;
    background: var(--bg-tertiary);
    color: var(--text-primary);
    cursor: pointer;
    transition: var(--transition);
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
}

.stats-control-btn:hover {
    background: #dcdce1;
}

.stats-control-btn.active {
    background: var(--primary-color);
    color: #fff;
}

/* 三控件初始染色：返点=橙、单笔=蓝、解析=紫（激活后仍蓝底白字） */
.rebate-label.stats-control-btn {
    background: rgba(255, 149, 0, 0.14);
    color: var(--warning-color);
}

/* 激活态优先级必须高于橙色底，否则勾选返点后底色不变化 */
.rebate-label.stats-control-btn.active {
    background: var(--primary-color);
    color: #fff;
}

#stats-mode-toggle {
    background: rgba(0, 122, 255, 0.12);
    color: var(--primary-color);
}

/* 删除全部：红色警示 */
#stats-clear-all {
    background: rgba(255, 59, 48, 0.12);
    color: var(--color-danger);
}

/* 输赢数行尾删除按钮 */
/* 兑奖统计表：输赢+删除列靠右对齐 */
.stats-td-win-del {
    text-align: right !important;
}

.stats-td-win-del .stats-row-del {
    margin-left: 8px;
}

.stats-row-del {
    display: inline-block;
    background: rgba(255, 59, 48, 0.12);
    color: var(--color-danger);
    border-radius: 999px;
    padding: 2px 10px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    margin-left: 6px;
    white-space: nowrap;
}

/* 兑奖表格"上报对比"汇总行：文本样式与"全部数据"行一致，不额外着色 */
.stats-report-row td {
    background: transparent;
    color: inherit;
    font-weight: inherit;
}

/* 下注明细弹窗：每次录入一行 + 删除按钮 */
.purchase-entry-row {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    padding: 4px 0;
    border-bottom: 0.5px solid var(--border-color);
}

.purchase-entry-row:last-child {
    border-bottom: none;
}

.purchase-entry-time {
    color: var(--text-muted);
    font-size: 12px;
    white-space: nowrap;
    padding-top: 1px;
}

.purchase-entry-text {
    flex: 1;
    word-break: break-all;
}

.purchase-entry-del {
    background: rgba(255, 59, 48, 0.12);
    color: var(--color-danger);
    border-radius: 999px;
    padding: 2px 10px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    flex-shrink: 0;
}

/* ID 选择器优先级高，active 态需显式覆盖回蓝底白字 */
#stats-mode-toggle.active {
    background: var(--primary-color);
    color: #fff;
}

/* 期数滚轮控件（iOS 风格）：上下滑动调整期数 */
.period-picker-wrap {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    flex-shrink: 0;
    user-select: none;
    -webkit-user-select: none;
    outline: none;
}

/* ============================================================
 * iOS 风格滚轮（期数滚轮 / 时间滚轮 共用同一套结构规则）
 * 公共规则用逗号选择器合并；各滚轮的尺寸/字号差异在下方单列
 * ============================================================ */

/* 滚轮视口：尺寸（期数 48×60 / 时间 54×78） */
.period-picker {
    width: 48px;
    height: 60px;            /* 3 行 × 20px */
}
.time-picker {
    width: 54px;
    height: 78px;            /* 3 行 × 26px */
    flex-shrink: 0;
}

/* 滚轮视口：公共外观（裁剪/底色/圆角/手势/顶底渐隐遮罩） */
.period-picker,
.time-picker {
    position: relative;
    overflow: hidden;
    background: var(--bg-tertiary);
    border-radius: 10px;
    touch-action: none;     /* 阻止页面滚动，让上下滑动专属于滚轮 */
    cursor: ns-resize;
    -webkit-mask: linear-gradient(to bottom, transparent 0%, rgba(0,0,0,0.25) 15%, #000 40%, #000 60%, rgba(0,0,0,0.25) 85%, transparent 100%);
    mask: linear-gradient(to bottom, transparent 0%, rgba(0,0,0,0.25) 15%, #000 40%, #000 60%, rgba(0,0,0,0.25) 85%, transparent 100%);
}

.period-picker:active {
    background: var(--bg-secondary);
}

/* 滚轮轨道（transform 由 JS 写） */
.period-picker-wheel,
.time-picker-wheel {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    will-change: transform;
}

/* 滚轮条目：行高（期数 20 / 时间 26）与未选字号（13 / 14）有差异 */
.period-picker-item {
    height: 20px;
    line-height: 20px;
    font-size: 14px;
}
.time-picker-item {
    height: 26px;
    line-height: 26px;
    font-size: 14px;
}

/* 滚轮条目：公共排版/未选颜色 */
.period-picker-item,
.time-picker-item {
    text-align: center;
    color: var(--text-secondary); /* 未选中：灰色 */
    user-select: none;
    -webkit-user-select: none;
}

/* 选中项：字号有差异（期数 16 / 时间 22） */
.period-picker-item.selected {
    font-size: 16px;
}
.time-picker-item.selected {
    font-size: 20px;
}

/* 选中项：公共加粗/蓝色 */
.period-picker-item.selected,
.time-picker-item.selected {
    font-weight: 700;
    color: var(--primary-color);
}

.period-picker-wrap .period-unit {
    font-size: 16px;
    font-weight: 700;
    color: var(--text-primary);
}

/* 未勾选自动记录时滚轮置灰 */
.time-picker.disabled {
    opacity: 0.35;
    cursor: default;
}

.time-picker-colon {
    font-size: 20px;
    font-weight: 700;
    color: var(--primary-color);
}

/* 设置/复制设置 分区线 */
.settings-divider {
    height: 1px;
    background: var(--separator-color, #E5E5EA);
    margin: 2px 0 14px;
}

/* 弹窗内文本输入框（替代重复内联样式） */
.dialog-text-input {
    width: 100%;
    padding: 10px;
    border: none;
    border-radius: 8px;
    background: var(--bg-secondary);
    font-size: 16px;
    box-sizing: border-box;
}

/* 记录/查看/删除 按钮：iOS 胶囊，与控制按钮风格一致 */
.stats-action-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 1;
    white-space: nowrap;
    gap: 4px;
    padding: 8px 10px;
    border: none;
    border-radius: 999px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    transition: var(--transition);
}

.stats-action-btn svg {
    width: 14px;
    height: 14px;
    flex-shrink: 0;
}

/* 记录=蓝、查看=紫、删除=红 */
#record-btn {
    background: rgba(0, 122, 255, 0.12);
    color: var(--primary-color);
}
#view-records-btn {
    background: rgba(88, 86, 214, 0.13);
    color: var(--purple-color);
}

/* 期数记录查看面板 */
.records-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 10001;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
}

.records-panel {
    background: var(--bg-primary);
    border-radius: var(--border-radius-lg);
    width: min(94vw, 680px);
    max-height: 86vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: var(--shadow-lg);
}

.records-panel-header {
    padding: 8px 12px;
    font-size: 14px;
    font-weight: bold;
    border-bottom: 0.5px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
    gap: 6px;
    flex-wrap: wrap;
}

/* header 左侧：标题 + 期数标签 */
.records-header-left {
    display: flex;
    align-items: center;
    gap: 8px;
}

/* header 右侧：按期数 / 按用户 切换按钮 */
.records-header-right {
    display: flex;
    gap: 6px;
    flex-shrink: 0;
}

/* 视图切换胶囊按钮 */
.stats-mode-btn {
    padding: 5px 12px;
    font-size: 14px;
    font-weight: 600;
    border: none;
    border-radius: 999px;
    background: var(--bg-tertiary);
    color: var(--text-secondary);
    cursor: pointer;
    transition: var(--transition);
}

.stats-mode-btn.active {
    background: var(--primary-color);
    color: #fff;
}

/* 记录面板：总输赢数值（按期数/按用户视图共用） */
.record-item-win {
    font-size: 12px;
    font-weight: 700;
    text-align: center;
}

.record-item-win.win {
    color: var(--color-win);
}

.record-item-win.loss {
    color: var(--color-loss);
}

/* ===========================================
   按用户视图：grid 表格对齐
   与按期数视图同策略：列随内容自适应 + space-between 统一间隔
   =========================================== */
.user-grid-row {
    display: grid;
    grid-template-columns: 22px repeat(6, max-content);
    justify-content: space-between;
    align-items: center;
    gap: 5px;
    padding: 6px 4px;
    border-bottom: 0.5px solid var(--border-color);
    font-size: 14px;
}

/* 主列表行（按期数 / 按用户）：中特与返点只占一列 */
.user-grid-row.user-grid-header,
.user-grid-row.user-grid-coltitle {
    grid-template-columns: 22px repeat(5, max-content);
}

/* 返点/中特二选一显示：列结构一致，无需覆盖 */
.records-list.show-rebate .user-grid-row.user-grid-header,
.records-list.show-rebate .user-grid-row.user-grid-coltitle {
    grid-template-columns: 22px repeat(5, max-content);
}

.user-grid-header {
    cursor: pointer;
    font-weight: bold;
    background: var(--bg-secondary);
    border-radius: 6px;
    padding-left: 8px;
}

/* 按用户视图列标题行（滚动时吸顶） */
.user-grid-coltitle {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-muted);
    background: var(--bg-primary);
    position: sticky;
    top: 0;
    z-index: 1;
    padding-top: 4px;
    cursor: default;
}

.user-grid-header:active {
    opacity: 0.7;
}

.user-grid-detail {
    padding-left: 8px;
    color: var(--text-secondary);
    font-size: 12px;
}

.user-grid-detail .cell-bet {
    color: var(--primary-color);
    cursor: pointer;
    text-decoration: underline;
}

/* 查看弹窗：Excel 式整列对齐——中间数值列统一居中（列宽由 JS syncColumnWidths 统一），
   期数/用户列保持靠左、删除列保持靠右 */
.record-item-header .num {
    text-align: center;
    font-variant-numeric: tabular-nums;
}

.user-grid-row .num {
    text-align: center;
    font-variant-numeric: tabular-nums;
}

.user-grid-row .cell-user {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.user-grid-row .cell-toggle {
    text-align: center;
    color: var(--text-muted);
}

/* 返点后的结果列 */
.user-grid-row .cell-rebate {
    text-align: center;
    font-variant-numeric: tabular-nums;
}

/* 行尾删除列 */
.user-grid-row .cell-del {
    display: flex;
    justify-content: flex-end;
    margin-right: -4px;
}

.user-grid-row .cell-del .record-del-btn {
    padding: 2px 8px;
}

.records-region-tag {
    font-size: 12px;
    font-weight: 600;
    padding: 4px 10px;
    border-radius: 999px;
    background: rgba(0, 122, 255, 0.12);
    color: var(--primary-color);
}

.records-close-btn {
    border: none;
    background: var(--bg-tertiary);
    color: var(--text-primary);
    border-radius: 999px;
    padding: 5px 12px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    flex-shrink: 0;
}

/* header 内的关闭按钮：红底白字，与按期数/按用户并排 */
.records-close-btn.records-close-in-header {
    background: rgba(255, 59, 48, 0.12);
    color: var(--color-danger);
    margin-left: 4px;
}

.records-close-btn.records-close-in-header:active {
    background: var(--color-danger);
    color: #fff;
}

/* ===========================================
   查看弹窗的第二级弹层：滚轮编辑器（特码/期数/日期）
   - 滚轮复用兑奖界面期数滚轮（尺寸/字号完全一致）
   - 点旁边空白只关闭本层，返回查看弹窗（一级级返回）
   =========================================== */
.picker-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.35);
    z-index: 10002;         /* 盖在查看弹窗（10001）之上 */
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
}

.picker-panel {
    background: var(--bg-primary);
    border-radius: var(--border-radius-lg);
    box-shadow: var(--shadow-lg);
    padding: 16px 18px 14px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    min-width: 230px;
    max-width: 92vw;
}

.picker-title {
    font-size: 16px;
    font-weight: 700;
    color: var(--text-primary);
}

/* 年/月/日 三个滚轮并排 */
.picker-wheel-row {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.picker-wheel-row .period-picker {
    flex-shrink: 0;
}

/* 特码输入框（二级弹层内） */
.picker-input-wrap {
    display: flex;
    justify-content: center;
    width: 100%;
    padding: 2px 0;
}

.picker-input {
    width: 150px;
    padding: 10px 12px;
    font-size: 16px;
    font-weight: 700;
    text-align: center;
    color: var(--text-primary);
    background: var(--bg-tertiary);
    border: 1.5px solid transparent;
    border-radius: 10px;
    outline: none;
    font-variant-numeric: tabular-nums;
    -webkit-appearance: none;
    appearance: none;
}

.picker-input:focus {
    border-color: var(--primary-color);
    background: var(--bg-primary);
}

.picker-input::placeholder {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-muted);
}

.picker-actions {
    display: flex;
    gap: 10px;
    width: 100%;
    margin-top: 2px;
}

.picker-btn {
    flex: 1;
    padding: 10px 0;
    border: none;
    border-radius: 10px;
    background: var(--bg-tertiary);
    color: var(--text-primary);
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
}

.picker-btn:active {
    opacity: 0.7;
}

.picker-btn.primary {
    background: var(--primary-color);
    color: #fff;
}

.records-list {
    overflow-y: auto;
    padding: 6px 12px;
    flex: 1;
}

.records-empty {
    text-align: center;
    color: var(--text-muted);
    padding: 40px 0;
    font-size: 14px;
}

/* 单条记录标题行（可点击展开/收起） */
/* 按期数视图：7列全部 max-content（整列随最宽内容自适应）；
   gap 5px 为最小间隔，justify-content: space-between 把多余空间均分到每个间隔
   → 间隔始终统一、期数贴最左、删除贴最右 */
.record-item-header {
    display: grid;
    grid-template-columns: repeat(7, max-content);
    justify-content: space-between;
    align-items: center;
    gap: 5px;
    padding: 6px 0 4px;
    font-size: 14px;
    font-weight: bold;
    color: var(--text-primary);
    cursor: pointer;
    user-select: none;
    border-bottom: 0.5px solid var(--border-color);
}

/* 按期数视图表头行 */
.record-item-coltitle {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-muted);
    background: var(--bg-primary);
    position: sticky;
    top: 0;
    z-index: 1;
    padding-top: 4px;
    cursor: default;
}

.record-item-toggle {
    color: var(--primary-color);
    font-size: 12px;
    text-align: center;
}

/* 期数+日期 合并单元格 */
.record-item-period-date {
    display: flex;
    align-items: center;
    gap: 2px;
    overflow: hidden;
    white-space: nowrap;
}

.record-item-period {
    color: var(--primary-color);
    flex-shrink: 0;
}

.record-item-date {
    color: var(--text-muted);
    font-weight: normal;
    font-size: 12px;
    flex-shrink: 0;
}

/* 中特金额列 */
.record-item-special-amt {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    font-variant-numeric: tabular-nums;
}

/* 删除列：按钮靠右对齐 */
.record-item-del {
    display: flex;
    justify-content: flex-end;
    margin-right: -8px;
}

.record-item-del .record-del-btn {
    padding: 2px 8px;
}

/* 下注金额可点击链接 */
.record-bet-link {
    color: var(--primary-color);
    text-decoration: underline;
    cursor: pointer;
    font-weight: 600;
    transition: var(--transition);
}

.record-bet-link:active {
    opacity: 0.6;
}

/* 单条记录删除按钮（查看面板内） */
.record-del-btn {
    color: var(--color-danger);
    background: rgba(255, 59, 48, 0.12);
    cursor: pointer;
    font-size: 12px;
    font-weight: 600;
    padding: 2px 10px;
    border-radius: 999px;
    flex-shrink: 0;
    transition: var(--transition);
    white-space: nowrap;
}

.record-del-btn:active {
    background: var(--color-danger);
    color: #fff;
}

/* 查看面板底部：总 / 赢 / 返 区域 */
.records-total-right {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 2px 6px;
    margin-right: 8px;
}

.records-total-item {
    display: inline-flex;
    align-items: baseline;
    font-size: 14px;
}

.records-total-label {
    font-size: 12px;
    color: var(--text-muted);
    font-weight: normal;
}

.records-total-bet {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    font-variant-numeric: tabular-nums;
}

.records-total-win {
    font-size: 14px;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}

.records-total-win.win {
    color: var(--color-win);
}

.records-total-win.loss {
    color: var(--color-loss);
}

.records-total-rebate {
    font-size: 14px;
    font-weight: 600;
    color: var(--primary-color);
    font-variant-numeric: tabular-nums;
}

/* 底部右侧操作区：中特-返点切换 + 删除全部 */
.records-total-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

.records-coltoggle-btn {
    border: none;
    border-radius: 999px;
    padding: 4px 10px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    flex-shrink: 0;
}

/* data-state=special 表示当前显示中特列（按钮写"返点"）→ 蓝色
   data-state=rebate 表示当前显示返点列（按钮写"中特"）→ 红色 */
.records-coltoggle-btn[data-state="special"] {
    background: rgba(0, 122, 255, 0.14);
    color: var(--primary-color);
}
.records-coltoggle-btn[data-state="rebate"] {
    background: rgba(255, 59, 48, 0.14);
    color: var(--color-win);
}

.records-coltoggle-btn:active {
    background: var(--primary-color) !important;
    color: #fff !important;
}

.records-delall-btn {
    border: none;
    border-radius: 999px;
    padding: 4px 10px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    background: rgba(255, 59, 48, 0.12);
    color: var(--color-danger);
    transition: var(--transition);
    flex-shrink: 0;
}

.records-delall-btn:active {
    background: var(--color-danger);
    color: #fff;
}

/* 购买内容弹窗 */
.purchase-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.45);
    z-index: 10100;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.purchase-panel {
    background: var(--bg-primary);
    border-radius: var(--border-radius-lg);
    box-shadow: var(--shadow-lg);
    max-width: 560px;
    width: 100%;
    max-height: 80vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.purchase-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px;
    font-size: 16px;
    font-weight: 700;
    border-bottom: 0.5px solid var(--border-color);
}

.purchase-close {
    color: #FF3B30;
    font-size: 20px;
    cursor: pointer;
    padding: 2px 8px;
    line-height: 1;
}

.purchase-meta {
    display: flex;
    gap: 12px;
    padding: 10px 16px;
    font-size: 14px;
    color: var(--text-secondary);
    border-bottom: 0.5px solid var(--border-color);
    flex-wrap: wrap;
}

.purchase-body {
    padding: 16px;
    font-size: 14px;
    line-height: 1.8;
    color: var(--text-primary);
    word-break: break-all;
    overflow-y: auto;
    flex: 1;
}

/* 购买弹窗标题栏右侧：解析/原文切换 + 关闭 */
.purchase-header-right {
    display: flex;
    align-items: center;
    gap: 10px;
}

.purchase-mode-btn {
    border: none;
    border-radius: 999px;
    padding: 4px 12px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    background: var(--bg-tertiary);
    color: var(--text-secondary);
    transition: var(--transition);
}

.purchase-mode-btn.active {
    background: var(--primary-color);
    color: #fff;
}

/* 兑奖统计表：多笔模式可展开的用户名 */
.user-expand-toggle {
    color: var(--primary-color);
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
    user-select: none;
}

/* 多笔明细块：相邻用户斑马纹区分 */
#stats-table .detail-row.grp-b td {
    background: var(--bg-secondary);
}

.record-item-bet {
    color: var(--text-secondary);
    font-size: 14px;
    font-weight: 500;
    font-variant-numeric: tabular-nums;
    text-align: right;
}

.record-item-special {
    color: var(--text-secondary);
    font-size: 14px;
    font-weight: 600;
    /* 特码为双击/双击触摸编辑入口：保证空值时也有可点击区域 */
    display: flex;
    align-items: center;
    justify-content: flex-end;
    min-height: 22px;
    cursor: pointer;
}

/* 表头「特码」只是列名，不显示可点击手型、保持表头字号 */
.record-item-coltitle .record-item-special {
    cursor: default;
    font-size: inherit;
    font-weight: inherit;
}

/* 折叠行：返点金额（字号与中特列一致 14px） */
.record-item-rebate {
    font-size: 14px;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    text-align: center;
}

.record-item-rebate-label {
    font-size: 12px;
    font-weight: normal;
    color: var(--text-muted);
}

/* 展开的明细：平码 + 各用户明细 */
.record-detail {
    padding: 6px 0 10px 18px;
    font-size: 14px;
    border-bottom: 1px dashed var(--border-color);
}

/* 按期数展开明细：列标题与每个用户行共用同一套 grid 列契约，保证上下对齐
   列顺序：用户 | 下注/中特 | 输赢 | 返点后 | 操作 */
.period-detail-grid {
    display: grid;
    grid-template-columns: repeat(5, max-content);
    justify-content: space-between;
    align-items: center;
    gap: 5px;
    padding: 3px 0;
    color: var(--text-secondary);
}

/* 明细列标题行 */
.period-detail-title {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-muted);
    padding-bottom: 4px;
    margin-bottom: 2px;
    border-bottom: 0.5px solid var(--border-color);
}

.period-detail-grid .pd-num {
    text-align: center;
    font-variant-numeric: tabular-nums;
}

.period-detail-grid .pd-del {
    display: flex;
    justify-content: flex-end;
}

/* 明细底部返点参数说明（整行） */
.period-detail-info {
    padding: 5px 0 0;
    font-size: 12px;
    color: var(--text-muted);
}

.record-detail-user {
    color: var(--text-primary);
    font-weight: 600;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.record-detail-nums {
    color: var(--text-muted);
    font-size: 12px;
    word-break: break-all;
    text-align: center;
}

.record-detail-amt {
    color: var(--text-secondary);
    font-size: 12px;
}

/* 底部统计行：所有记录总输赢 */
.records-total {
    padding: 8px 12px;
    border-top: 0.5px solid var(--border-color);
    background: var(--bg-secondary);
    flex-shrink: 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 14px;
    font-weight: 700;
}

.records-total .rebate-hint {
    font-size: 12px;
    color: var(--text-muted);
    font-weight: normal;
}

/* 兑奖区：与主内容区统一，flex 撑满 */
#stats-content {
    flex: 1;
    min-height: 0;
    padding: 12px;
}

/* 统计列表 */
.stats-table-container {
    overflow-x: auto;
    background: var(--bg-primary);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-sm);
}

#stats-table {
    width: 100%;
    border-collapse: collapse;
}

/* 主界面 stats-table：数字列（下注/中特/返点/输赢）靠左对齐，删除按钮单独靠右 */
#stats-table td,
#stats-table th {
    padding: 10px 12px;
    text-align: left;
    border-bottom: 0.5px solid var(--border-color);
}
#stats-table .stats-td-win-del {
    text-align: right !important;
}

#stats-table th {
    background-color: transparent;
    font-weight: 600;
    font-size: 14px;
    color: var(--text-muted);
    position: sticky;
    top: 0;
}

#stats-table tr:hover {
    background-color: var(--bg-secondary);
}

#stats-table tr:first-child {
    background-color: rgba(0, 122, 255, 0.06);
    font-weight: bold;
}

/* 多笔明细行 */
#stats-table tr.detail-row {
    background-color: var(--bg-secondary);
    font-size: 12px;
}

#stats-table tr.detail-row td {
    padding: 8px 12px;
    border-bottom: 1px dashed var(--border-color);
}

#stats-table tr.detail-row td:first-child {
    padding-left: 24px;
    color: var(--text-secondary);
    font-size: 12px;
}

/* ===========================================
   日志窗口
   =========================================== */
.log-window {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    touch-action: none;
    overflow: hidden;
}

.log-content {
    background-color: white;
    border-radius: var(--border-radius-lg);
    width: 90%;
    max-height: 90vh;
    min-height: clamp(500px, 60vh, 1000px);
    display: flex;
    flex-direction: column;
    box-shadow: var(--shadow-lg);
    transform: translateZ(0);
    position: relative;
}

/* 日志头部：标题 + 过滤胶囊 + 清空/关闭，单行排列 */
.log-header {
    padding: 10px 12px;
    border-bottom: 0.5px solid var(--border-color);
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: nowrap;
}

.log-title {
    margin: 0;
    font-size: 16px;
    font-weight: 700;
    flex-shrink: 0;
}

.log-clear-btn {
    padding: 4px 11px;
    border: none;
    border-radius: 999px;
    background-color: rgba(255, 59, 48, 0.12);
    color: var(--color-danger);
    font-size: 14px;
    cursor: pointer;
    font-weight: 600;
    text-align: center;
    white-space: nowrap;
    flex-shrink: 0;
    margin-left: auto;
}

.log-close-btn {
    padding: 4px 11px;
    border: none;
    border-radius: 999px;
    background-color: rgba(0, 122, 255, 0.12);
    color: var(--primary-color);
    font-size: 14px;
    cursor: pointer;
    font-weight: 600;
    text-align: center;
    white-space: nowrap;
    flex-shrink: 0;
}

.log-list {
    flex: 1;
    padding: 16px;
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
    word-break: break-all;
    overflow-wrap: break-word;
}

.log-item {
    padding: 12px;
    border-bottom: none;
    font-size: clamp(12px, 2.5vw, 16px);
    margin-bottom: 8px;
    background-color: var(--bg-secondary);
    border-radius: var(--border-radius);
    word-break: break-all;
    overflow-wrap: break-word;
}

.log-empty {
    text-align: center;
    color: var(--text-muted);
    padding: 40px 0;
}

/* 时间行：时间/用户/类型在上，单条删除按钮靠最右 */
.log-item-head {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
}

.log-del-btn {
    margin-left: auto;
    flex-shrink: 0;
    padding: 2px 9px;
    border: none;
    border-radius: 999px;
    background-color: rgba(255, 59, 48, 0.12);
    color: var(--color-danger);
    font-size: 12px;
    font-weight: 600;
    line-height: 1.4;
    white-space: nowrap;
    cursor: pointer;
    transition: var(--transition);
    -webkit-tap-highlight-color: transparent;
}

.log-del-btn:active {
    background-color: var(--color-danger);
    color: #fff;
}

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

.log-time,
.log-user,
.log-action {
    margin-right: 8px;
}

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

.log-user,
.log-content-text {
    color: var(--text-primary);
}

.log-user {
    font-weight: 500;
}

.log-action {
    color: var(--primary-color);
}

.log-content-text {
    margin-top: 8px;
    line-height: 1.6;
    word-break: break-all;
    overflow-wrap: break-word;
}

.log-content-line {
    margin-bottom: 6px;
    padding: 4px 0;
    border-bottom: 1px dashed #f0f0f0;
}

.log-content-line:last-child {
    border-bottom: none;
    margin-bottom: 0;
}

.log-content-continuation {
    margin-bottom: 6px;
    padding-left: 16px;
    color: var(--text-secondary);
    font-size: 0.95em;
}

/* 日志过滤器：胶囊开关，勾选后按类型染色高亮 */
.log-filter {
    display: flex;
    gap: 5px;
    align-items: center;
    flex: 0 1 auto;
    min-width: 0;
}

.log-filter-item {
    display: inline-flex;
    align-items: center;
    padding: 4px 10px;
    border-radius: 999px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    background: var(--bg-tertiary);
    color: var(--text-muted);
    user-select: none;
    transition: var(--transition);
    white-space: nowrap;
}

.log-filter-item input[type="checkbox"] {
    display: none;
}

.log-filter-item.log-filter-parse.active { background: rgba(255, 59, 48, 0.12); color: #FF3B30; }
.log-filter-item.log-filter-submit.active { background: rgba(0, 122, 255, 0.12); color: var(--primary-color); }
.log-filter-item.log-filter-undo.active { background: rgba(52, 199, 89, 0.12); color: #34C759; }

/* 日志类型颜色 */
.log-parse { color: #FF3B30; }
.log-submit { color: var(--primary-color); }
.log-undo { color: #34C759; }

.log-parse .log-action,
.log-submit .log-action,
.log-undo .log-action,
.log-parse .log-content-text,
.log-submit .log-content-text,
.log-undo .log-content-text {
    color: inherit;
}

/* ===========================================
   提交记录历史面板
   =========================================== */
.history-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 10001;
    display: flex;
    align-items: center;
    justify-content: center;
}

.history-panel {
    background: var(--bg-primary);
    border-radius: var(--border-radius-lg);
    width: min(92vw, 560px);
    max-height: 70vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: var(--shadow-lg);
}

.history-panel-header {
    padding: 14px 16px;
    font-size: 16px;
    font-weight: bold;
    border-bottom: 0.5px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.history-toggle-btn {
    border: none;
    background: rgba(88, 86, 214, 0.13);
    color: var(--purple-color);
    border-radius: 999px;
    padding: 8px 16px;
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
    flex-shrink: 0;
    transition: var(--transition);
    box-shadow: var(--shadow-sm);
}

.history-toggle-btn:active {
    transform: scale(0.96);
    opacity: 0.85;
}

.history-toggle-btn.active {
    background: var(--primary-color);
    color: #fff;
    box-shadow: 0 0 0 2px rgba(0, 122, 255, 0.35);
}

.history-list {
    overflow-y: auto;
    padding: 8px 14px;
}

/* 用户标题行（可点击展开/收起） */
.history-user-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 0 6px;
    font-size: 14px;
    font-weight: bold;
    color: var(--text-primary);
    cursor: pointer;
    user-select: none;
    border-bottom: 0.5px solid var(--border-color);
}

.history-user-name {
    color: var(--primary-color);
    cursor: pointer;
}

.history-user-meta {
    color: var(--text-muted);
    font-weight: normal;
    font-size: 12px;
}

.history-user-preview {
    color: var(--text-secondary);
    font-weight: normal;
    font-size: 12px;
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.history-user-amount {
    color: var(--text-secondary);
    font-size: 12px;
    flex-shrink: 0;
}

/* 展开的明细行 */
.history-entry-row {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    padding: 8px 0 8px 24px;
    border-bottom: 1px dashed var(--border-color);
    font-size: 14px;
}

.history-entry-time {
    color: var(--text-muted);
    flex-shrink: 0;
    padding-top: 2px;
}

.history-entry-content {
    flex: 1;
    word-break: break-all;
    white-space: pre-wrap;
}

.history-entry-amount {
    color: var(--text-secondary);
    flex-shrink: 0;
    padding-top: 2px;
}

.history-del-btn {
    border: none;
    background: rgba(255, 59, 48, 0.12);
    color: var(--color-danger);
    border-radius: 999px;
    padding: 4px 12px;
    font-size: 12px;
    font-weight: 600;
    flex-shrink: 0;
    cursor: pointer;
    transition: var(--transition);
}

.history-close-btn {
    margin: 0 16px 10px;
    border: none;
    background: var(--bg-tertiary);
    color: var(--text-primary);
    border-radius: var(--border-radius);
    padding: 10px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
}

/* ===========================================
   响应式适配（移动端）
   =========================================== */
@media (max-width: 480px) {
    /* 移动端滚动时 backdrop-filter 重绘开销极大，会导致 sticky 顶/底栏下方内容
       （如输入框）被盖住 1-2 秒后才重绘显示；移动端改为实色背景，根除重绘卡顿 */
    .header, .footer {
        -webkit-backdrop-filter: none;
        backdrop-filter: none;
        background: var(--bg-primary);
    }

    .header {
        padding: 8px 10px;
        gap: 6px;
    }

    .header-left h1 {
        font-size: 16px;
    }

    .header-left p {
        font-size: 12px;
    }

    .header-right {
        gap: 4px;
    }

    .btn-manual, .btn-log, .btn-settings, .btn-account {
        padding: 7px 11px;
        font-size: 14px;
    }

    .result-controls {
        flex-wrap: nowrap;
        gap: 6px;
    }

    .btn-copy, .btn-report, .btn-history {
        flex: 1;
        font-size: 14px;
        padding: 10px 10px;
    }

    /* 移动端表格 */
    .result-table {
        max-height: calc(100vh - 320px);
        max-height: calc(100dvh - 320px);
        overflow-y: auto;
        overflow-x: auto;
        scrollbar-width: thin;
        scrollbar-color: var(--primary-color) #f0f0f0;
    }

    #zodiac-table {
        width: 100%;
        table-layout: fixed;
    }

    #zodiac-table th:first-child,
    #zodiac-table td:first-child {
        width: 60px;
        min-width: 60px;
        max-width: 60px;
    }

    #zodiac-table th:nth-child(2),
    #zodiac-table td:nth-child(2) {
        width: 80px;
        min-width: 80px;
        max-width: 100px;
    }

    #zodiac-table th:nth-child(3),
    #zodiac-table td:nth-child(3) {
        width: 80px;
        min-width: 80px;
        text-align: right;
    }

    #zodiac-table th:nth-child(4),
    #zodiac-table td:nth-child(4) {
        width: 80px;
        min-width: 80px;
        text-align: right;
    }

    th, td {
        padding: 10px 8px;
        font-size: 14px;
    }

    th {
        padding: 0 6px;
        line-height: 1.2;
        font-size: 16px;
    }

    .number-checkbox {
        transform: scale(1.2);
        margin-right: 6px;
    }

    /* 弹窗动画与尺寸 */
    /* 移动端：添加记录弹窗占满全屏。
       iOS 浏览器工具栏随滚动伸缩时，fixed inset:0 按布局视口计算高度，
       弹窗底部按钮（重新解析/确定）会被裁出可视区；
       改用 100dvh 动态视口高度，按钮始终留在屏内 */
    .popup {
        padding: 0;
        height: 100dvh;
    }

    .popup-card {
        max-width: none;
        width: 100%;
        height: 100%;
        max-height: 100dvh;
        border-radius: 0;
        box-shadow: none;
    }

    .prompt-dialog {
        width: 95%;
        padding: 16px;
    }

    .confirm-box {
        width: 90%;
        padding: 16px;
    }

    .prompt-button,
    .confirm-button {
        padding: 12px 20px;
        font-size: 16px;
        min-height: 44px;
        transition: all 0.2s ease;
        border-radius: 8px;
    }

    .prompt-button:active,
    .confirm-button:active {
        transform: scale(0.95);
        opacity: 0.8;
    }

    /* 兑奖界面 */
    .stats-nav {
        gap: 4px;
    }

    .stats-nav-btn {
        padding: 6px 10px;
        font-size: 14px;
    }

    /* 移动端：期数滚轮压缩 */
    .period-picker {
        width: 42px;
        height: 54px;            /* 3 行 × 18px */
    }

    .period-picker-item {
        height: 18px;
        line-height: 18px;
        font-size: 12px;
    }

    .period-picker-item.selected {
        font-size: 16px;
    }

    /* 移动端：时间滚轮（中间大、上下小） */
    .time-picker {
        width: 50px;
        height: 69px;            /* 3 行 × 23px */
    }

    .time-picker-item {
        height: 23px;
        line-height: 23px;
        font-size: 14px;
    }

    .time-picker-item.selected {
        font-size: 20px;
    }

    .stats-action-btn {
        padding: 7px 6px;
        font-size: 12px;
        gap: 2px;
    }

    .stats-action-btn svg {
        width: 13px;
        height: 13px;
    }

    .special-number-container {
        gap: 8px;
    }

    .special-row {
        gap: 6px;
        flex-wrap: wrap; /* 窄屏下 特码+5个控件 一行放不下，允许换行防止溢出 */
        row-gap: 8px;
    }

    .special-number-container label {
        margin-bottom: 0;
    }

    .special-number-container input {
        min-width: 36px;
    }

    .stats-control-btn {
        padding: 6px 8px;
        font-size: 14px;
    }

    #stats-table th,
    #stats-table td {
        padding: 10px 8px;
        font-size: 14px;
    }

    /* 日志窗口 */
    .log-content {
        width: 95%;
        max-height: 85%;
    }

    .log-header {
        padding: 10px 12px;
        gap: 6px;
        flex-wrap: wrap;   /* 「全部删除」文字更长，窄屏允许换行避免挤压 */
        row-gap: 6px;
    }

    .log-title {
        font-size: 14px;
    }

    .log-filter {
        gap: 4px;
    }

    .log-clear-btn, .log-close-btn {
        padding: 4px 10px;
        font-size: 14px;
    }

    .log-filter-item {
        padding: 4px 9px;
        font-size: 14px;
    }

    .log-list {
        padding: 12px;
    }

    .log-item {
        padding: 10px;
        font-size: 14px;
    }
}

/* ==================== 响应式补充：平板 / 宽屏 / 触控 / 横屏 ==================== */

/* 平板/宽屏：内容自适应全宽（不再限宽，避免 PC 上出现手机竖屏般的窄栏） */
@media (min-width: 481px) {
    body > header,
    body > main,
    body > section,
    body > footer {
        width: 100%;
        max-width: none;
        margin-left: 0;
        margin-right: 0;
    }
}

/* 手机端：按钮统一最小触控高度 36px，便于点按 */
@media (max-width: 480px) {
    button {
        min-height: 36px;
    }
}

/* 手机横屏（高度不足）：压缩头部与底栏内边距，减少对内容的遮挡 */
@media (max-height: 450px) and (orientation: landscape) {
    header {
        padding-top: 4px;
        padding-bottom: 4px;
    }
    footer {
        padding-top: 4px;
        padding-bottom: 4px;
    }
    body {
        padding-bottom: 52px;
    }
}

/* ==================== 键盘焦点 / 下拉搜索 / 记录筛选 ==================== */

/* 键盘 Tab 焦点可见（鼠标点击不显示） */
:focus-visible {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

input:focus-visible,
textarea:focus-visible,
select:focus-visible,
button:focus-visible,
[tabindex]:focus-visible {
    outline: 2px solid var(--primary-color) !important;
    outline-offset: 2px;
}

/* 用户下拉：搜索框吸附在列表顶部 */
.dropdown-search-wrap {
    position: sticky;
    top: 0;
    z-index: 2;
    padding: 8px;
    background: var(--bg-primary);
    border-bottom: 0.5px solid var(--border-color);
}

.dropdown-search {
    width: 100%;
    height: 34px;
    padding: 0 10px;
    border: none;
    border-radius: 8px;
    background: var(--bg-secondary);
    color: var(--text-primary);
    font-size: 14px;
}

.dropdown-empty {
    padding: 14px 12px;
    text-align: center;
    color: var(--text-muted);
    font-size: 12px;
}

/* 自动记录：地区分段控件与下次记录时间 */
.stats-nav.auto-region-seg {
    margin-bottom: 0;
}

.auto-next-record {
    font-size: 12px;
    color: var(--text-muted);
}



/* ===========================================
   登录页（login.html）
   =========================================== */
.login-body {
    background: #F2F2F7;
}

.login-page {
    min-height: 100vh;
    min-height: 100dvh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    box-sizing: border-box;
}

.login-card {
    width: min(92%, 360px);
    background: #FFFFFF;
    border-radius: 18px;
    box-shadow: var(--shadow-lg, 0 12px 32px rgba(0, 0, 0, 0.12));
    padding: 28px 22px 24px;
    box-sizing: border-box;
}

.login-title {
    margin: 0 0 6px 0;
    font-size: 20px;
    font-weight: 700;
    color: var(--text-primary, #1C1C1E);
}

.login-sub {
    margin: 0 0 22px 0;
    font-size: 13px;
    color: var(--text-muted, #8E8E93);
}

.login-field {
    margin-bottom: 14px;
}

.login-field label {
    display: block;
    margin-bottom: 6px;
    font-size: 13px;
    color: var(--text-muted, #8E8E93);
}

.login-field input {
    width: 100%;
    padding: 12px;
    border: none;
    border-radius: 10px;
    background: #F2F2F7;
    font-size: 16px;
    box-sizing: border-box;
    color: var(--text-primary, #1C1C1E);
}

.login-field input:focus {
    outline: 2px solid rgba(0, 122, 255, 0.35);
    outline-offset: -2px;
}

.login-error {
    min-height: 18px;
    margin: 4px 0 10px;
    font-size: 13px;
    color: #FF3B30;
    line-height: 1.4;
}

.login-btn {
    width: 100%;
    padding: 13px;
    border: none;
    border-radius: 12px;
    background: var(--primary-color, #007AFF);
    color: #FFFFFF;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.15s ease, opacity 0.15s ease;
}

.login-btn:active {
    transform: scale(0.98);
    opacity: 0.9;
}

.login-btn:disabled {
    opacity: 0.6;
    cursor: default;
}

.login-notice {
    margin: 14px 0 0;
    font-size: 12px;
    line-height: 1.6;
    color: #FF9500;
}
