/**
 * 走势图：控制栏 / 分页栏通用美化（PC + 移动端）
 * 移动端布局与横滑见下方 @media (max-width: 768px)
 */

/* 阶段 4：大表格行级 content-visibility，减少首屏绘制成本 */
.chart-scroll-wrapper #lottery-table tbody tr,
.mobile-scroll-wrapper #lottery-table tbody tr {
    content-visibility: auto;
    contain-intrinsic-size: auto 28px;
}

.chart-scroll-wrapper .my-pick-cell,
.mobile-scroll-wrapper .my-pick-cell {
    outline: 2px solid #f59e0b;
    outline-offset: -1px;
    background-color: rgba(245, 158, 11, 0.12) !important;
}

/* 控制栏 / 分页栏：统一字号（覆盖各模板内联 font-size） */
.chart-scroll-wrapper,
.mobile-scroll-wrapper {
    --chart-ui-font-size: 12px;
    --chart-ui-line-height: 1.25;
    overflow-x: auto;
    overflow-y: visible;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior-x: contain;
    max-width: 100%;
    min-width: 0;
    touch-action: pan-x pan-y;
}

/* 圆角外壳：裁剪子元素，避免横滑/纵滚时上角被白底「抹平」 */
.container.chart-page-shell,
#main-content.chart-page-shell,
.table-container.chart-page-shell {
    --chart-shell-radius: 15px;
    overflow: hidden;
    isolation: isolate;
}

.chart-scroll-wrapper > :is(.header, .zone-controls, .selection-controls, .controls):first-child {
    border-top-left-radius: var(--chart-shell-radius, 15px);
    border-top-right-radius: var(--chart-shell-radius, 15px);
}

.chart-scroll-wrapper :is(.controls, .controls-bottom, .selection-controls, .bottom-controls, .zone-controls, .pagination, .pagination-wrapper, .pagination-controls, .countdown-and-controls),
.mobile-scroll-wrapper :is(.controls, .controls-bottom, .selection-controls, .bottom-controls, .zone-controls, .pagination, .pagination-wrapper, .pagination-controls, .countdown-and-controls) {
    font-size: var(--chart-ui-font-size);
    line-height: var(--chart-ui-line-height);
}

.chart-scroll-wrapper :is(.controls, .controls-bottom, .selection-controls, .bottom-controls, .zone-controls, .pagination, .pagination-wrapper) :is(
    button,
    input:not([type="radio"]):not([type="checkbox"]),
    select,
    textarea
),
.mobile-scroll-wrapper :is(.controls, .controls-bottom, .selection-controls, .bottom-controls, .zone-controls, .pagination, .pagination-wrapper) :is(
    button,
    input:not([type="radio"]):not([type="checkbox"]),
    select,
    textarea
) {
    font-size: var(--chart-ui-font-size) !important;
    line-height: var(--chart-ui-line-height) !important;
}

.chart-scroll-wrapper :is(.controls, .controls-bottom, .selection-controls, .bottom-controls, .zone-controls, .pagination, .pagination-wrapper) :is(span, label),
.mobile-scroll-wrapper :is(.controls, .controls-bottom, .selection-controls, .bottom-controls, .zone-controls, .pagination, .pagination-wrapper) :is(span, label) {
    font-size: var(--chart-ui-font-size) !important;
    line-height: var(--chart-ui-line-height);
    font-weight: 500;
}

.chart-scroll-wrapper .search-box :is(.search-type, .search-type label),
.mobile-scroll-wrapper .search-box :is(.search-type, .search-type label) {
    font-size: var(--chart-ui-font-size) !important;
}

.chart-scroll-wrapper .control-group,
.mobile-scroll-wrapper .control-group {
    font-size: var(--chart-ui-font-size);
}

.chart-page-shell .tab-btn {
    font-size: var(--chart-ui-font-size);
}

.chart-scroll-wrapper .controls,
.chart-scroll-wrapper .selection-controls,
.chart-scroll-wrapper .bottom-controls,
.chart-scroll-wrapper .controls-bottom,
.chart-scroll-wrapper .zone-controls,
.mobile-scroll-wrapper .controls,
.mobile-scroll-wrapper .selection-controls,
.mobile-scroll-wrapper .bottom-controls,
.mobile-scroll-wrapper .controls-bottom,
.mobile-scroll-wrapper .zone-controls {
    height: auto;
    min-height: 0;
    margin: 0;
    padding: 6px;
    background: #f3f5f8;
    box-sizing: border-box;
}

.chart-scroll-wrapper .selection-controls,
.mobile-scroll-wrapper .selection-controls {
    border-bottom: 1px solid #e2e8f0;
}

.chart-scroll-wrapper .bottom-controls,
.mobile-scroll-wrapper .bottom-controls,
.chart-scroll-wrapper .controls-bottom,
.mobile-scroll-wrapper .controls-bottom {
    border-top: 1px solid #e2e8f0;
}

/* 浅色工具栏/分页栏：覆盖 base.css body{color:white} 的文字继承 */
.chart-scroll-wrapper :is(.controls, .selection-controls, .bottom-controls, .controls-bottom, .zone-controls, .pagination, .pagination-wrapper, .pagination-controls),
.mobile-scroll-wrapper :is(.controls, .selection-controls, .bottom-controls, .controls-bottom, .zone-controls, .pagination, .pagination-wrapper, .pagination-controls) {
    color: #334155;
}

.chart-scroll-wrapper :is(.controls, .selection-controls, .bottom-controls, .controls-bottom, .zone-controls, .pagination, .pagination-wrapper, .pagination-controls) :is(span, label),
.mobile-scroll-wrapper :is(.controls, .selection-controls, .bottom-controls, .controls-bottom, .zone-controls, .pagination, .pagination-wrapper, .pagination-controls) :is(span, label) {
    color: #475569;
}

/* 表格区：覆盖 base.css body{color:white}，避免单元格文字发灰/发白看不清 */
.chart-scroll-wrapper table :is(th, td),
.mobile-scroll-wrapper table :is(th, td) {
    color: #333;
}

.chart-scroll-wrapper table .period,
.chart-scroll-wrapper table .lottery-numbers,
.chart-scroll-wrapper table .numbers-column,
.chart-scroll-wrapper table .period-column,
.mobile-scroll-wrapper table .period,
.mobile-scroll-wrapper table .lottery-numbers,
.mobile-scroll-wrapper table .numbers-column,
.mobile-scroll-wrapper table .period-column {
    color: #333;
}

.chart-scroll-wrapper table .lottery-numbers,
.mobile-scroll-wrapper table .lottery-numbers {
    color: #000;
}

.chart-scroll-wrapper table .omission-value,
.mobile-scroll-wrapper table .omission-value {
    color: #b8860b;
}

.chart-scroll-wrapper table .shunzi,
.mobile-scroll-wrapper table .shunzi {
    color: #006400;
}

.chart-scroll-wrapper table .duizi .repeat,
.mobile-scroll-wrapper table .duizi .repeat {
    color: #ff0000;
}

.chart-scroll-wrapper table .hit,
.mobile-scroll-wrapper table .hit {
    color: #fff;
}

/* 双色球/七乐彩走势图：开奖落点格（覆盖 table td 的 #333，保证红蓝底上白字） */
.chart-scroll-wrapper table td.red-marked,
.chart-scroll-wrapper table td.blue-marked,
.mobile-scroll-wrapper table td.red-marked,
.mobile-scroll-wrapper table td.blue-marked {
    color: #fff !important;
}

.chart-scroll-wrapper table .operation-row :is(.countdown-label, .operation-btn, .prediction-control-btn),
.mobile-scroll-wrapper table .operation-row :is(.countdown-label, .operation-btn, .prediction-control-btn) {
    color: #333;
}

.chart-scroll-wrapper table .countdown-timer,
.chart-scroll-wrapper table .period-red,
.mobile-scroll-wrapper table .countdown-timer,
.mobile-scroll-wrapper table .period-red {
    color: #dc3545;
}

.chart-scroll-wrapper :is(.controls, .selection-controls, .bottom-controls, .controls-bottom, .zone-controls, .pagination) :is(.search-input, .year-input, .period-input, .combo-input, .page-input, input, select),
.mobile-scroll-wrapper :is(.controls, .selection-controls, .bottom-controls, .controls-bottom, .zone-controls, .pagination) :is(.search-input, .year-input, .period-input, .combo-input, .page-input, input, select) {
    color: #334155;
}

.chart-scroll-wrapper :is(.controls, .controls-bottom) :is(.diagonal-toggle-btn, .miss-toggle-btn, .refresh-btn, .same-period-btn, .period-btn, button):not(.active),
.mobile-scroll-wrapper :is(.controls, .controls-bottom) :is(.diagonal-toggle-btn, .miss-toggle-btn, .refresh-btn, .same-period-btn, .period-btn, button):not(.active) {
    color: #444;
}

.chart-scroll-wrapper :is(.controls, .controls-bottom) :is(.period-btn, .diagonal-toggle-btn, .miss-toggle-btn).active,
.mobile-scroll-wrapper :is(.controls, .controls-bottom) :is(.period-btn, .diagonal-toggle-btn, .miss-toggle-btn).active {
    color: #fff;
    background: linear-gradient(135deg, #1976d2, #1565c0) !important;
    border-color: #1565c0 !important;
}

.chart-scroll-wrapper .combo-search,
.chart-scroll-wrapper .display-controls,
.chart-scroll-wrapper .period-query,
.chart-scroll-wrapper .control-group,
.chart-scroll-wrapper :is(.same-period-selector, .search-box, .periods-selector, .year-selector, .toggle-buttons),
.chart-scroll-wrapper .pagination-group,
.mobile-scroll-wrapper .combo-search,
.mobile-scroll-wrapper .display-controls,
.mobile-scroll-wrapper .period-query,
.mobile-scroll-wrapper .control-group,
.mobile-scroll-wrapper :is(.same-period-selector, .search-box, .periods-selector, .year-selector, .toggle-buttons),
.mobile-scroll-wrapper .pagination-group {
    display: flex;
    flex-wrap: nowrap;
    align-items: center;
    gap: 4px;
    padding: 4px 6px;
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(15, 23, 42, 0.04);
    box-sizing: border-box;
}

/* 搜索组：输入框缩窄，单选按钮单行排列 */
.chart-scroll-wrapper .control-group.search-box,
.mobile-scroll-wrapper .control-group.search-box,
.chart-scroll-wrapper .search-box,
.mobile-scroll-wrapper .search-box {
    flex-wrap: nowrap;
    align-items: center;
}

.chart-scroll-wrapper .search-box .search-input,
.mobile-scroll-wrapper .search-box .search-input {
    width: 12ch !important;
    min-width: 12ch;
    max-width: 12ch;
    flex: 0 0 12ch;
    padding-left: 6px;
    padding-right: 6px;
}

.chart-scroll-wrapper .search-box .search-options,
.mobile-scroll-wrapper .search-box .search-options {
    display: inline-flex;
    flex-direction: row;
    flex-wrap: nowrap;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
}

.chart-scroll-wrapper .search-box .search-type,
.mobile-scroll-wrapper .search-box .search-type {
    display: inline-flex;
    flex-direction: row;
    align-items: center;
    gap: 3px;
    white-space: nowrap;
    flex-shrink: 0;
}

.chart-scroll-wrapper .search-box .search-type label,
.mobile-scroll-wrapper .search-box .search-type label {
    white-space: nowrap;
    line-height: 1.2;
}

.chart-scroll-wrapper .search-box .search-type input[type="radio"],
.mobile-scroll-wrapper .search-box .search-type input[type="radio"] {
    margin: 0;
    flex-shrink: 0;
}

.chart-scroll-wrapper .pagination-wrapper,
.mobile-scroll-wrapper .pagination-wrapper {
    background: #f3f5f8;
    border-top: 1px solid #e2e8f0;
}

.chart-scroll-wrapper .pagination,
.mobile-scroll-wrapper .pagination {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 8px;
    row-gap: 8px;
    height: auto;
    min-height: 0;
    margin: 0;
    padding: 8px;
    background: #f3f5f8;
    border-top: none;
    border-radius: 0 0 8px 8px;
    box-sizing: border-box;
}

.chart-scroll-wrapper .pagination-summary,
.mobile-scroll-wrapper .pagination-summary {
    color: #475569;
}

.chart-scroll-wrapper .pagination-nav,
.mobile-scroll-wrapper .pagination-nav {
    gap: 6px;
}

.chart-scroll-wrapper .pagination-jump,
.mobile-scroll-wrapper .pagination-jump {
    gap: 6px;
}

.chart-scroll-wrapper .pagination-size,
.mobile-scroll-wrapper .pagination-size {
    padding: 6px 8px;
}

.chart-scroll-wrapper .page-size-buttons,
.mobile-scroll-wrapper .page-size-buttons {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
}

.chart-scroll-wrapper :is(.selection-controls, .controls, .zone-controls, .bottom-controls, .pagination) :is(.period-btn, .control-btn, .zone-btn, .divider-btn, .query-btn, .pagination-btn, .page-size-btn),
.chart-scroll-wrapper :is(.selection-controls, .bottom-controls) > .same-period-btn,
.chart-scroll-wrapper .same-period-group > .same-period-btn,
.chart-scroll-wrapper .pagination > button,
.chart-scroll-wrapper .pagination :is(.page-number, .page-btn),
.mobile-scroll-wrapper :is(.selection-controls, .controls, .zone-controls, .bottom-controls, .pagination) :is(.period-btn, .control-btn, .zone-btn, .divider-btn, .query-btn, .pagination-btn, .page-size-btn),
.mobile-scroll-wrapper :is(.selection-controls, .bottom-controls) > .same-period-btn,
.mobile-scroll-wrapper .same-period-group > .same-period-btn,
.mobile-scroll-wrapper .pagination > button,
.mobile-scroll-wrapper .pagination :is(.page-number, .page-btn) {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 26px;
    height: auto;
    padding: 3px 6px;
    font-size: var(--chart-ui-font-size, 12px);
    font-weight: 500;
    line-height: var(--chart-ui-line-height, 1.25);
    color: #444;
    background: #fff;
    border: 1px solid #d0d7de;
    border-radius: 6px;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.06);
    white-space: nowrap;
    cursor: pointer;
    transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease, box-shadow 0.15s ease;
}

.chart-scroll-wrapper :is(.selection-controls, .controls, .zone-controls, .bottom-controls, .pagination) :is(.period-btn, .control-btn, .zone-btn, .divider-btn, .page-size-btn, .pagination-btn).active,
.chart-scroll-wrapper :is(.selection-controls, .bottom-controls) > .same-period-btn.active,
.mobile-scroll-wrapper :is(.selection-controls, .controls, .zone-controls, .bottom-controls, .pagination) :is(.period-btn, .control-btn, .zone-btn, .divider-btn, .page-size-btn, .pagination-btn).active,
.mobile-scroll-wrapper :is(.selection-controls, .bottom-controls) > .same-period-btn.active {
    color: #fff;
    background: linear-gradient(135deg, #1976d2, #1565c0);
    border-color: #1565c0;
    box-shadow: 0 2px 6px rgba(21, 101, 192, 0.28);
}

.chart-scroll-wrapper #combo-search,
.chart-scroll-wrapper #period-query,
.chart-scroll-wrapper #bottom-combo-search,
.chart-scroll-wrapper #bottom-period-query,
.chart-scroll-wrapper #go-to-page,
.mobile-scroll-wrapper #combo-search,
.mobile-scroll-wrapper #period-query,
.mobile-scroll-wrapper #go-to-page {
    color: #fff;
    background: linear-gradient(135deg, #e53935, #c62828);
    border-color: #c62828;
    box-shadow: 0 2px 6px rgba(198, 40, 40, 0.25);
    font-weight: 600;
}

.chart-scroll-wrapper :is(#searchBtn, #yearBtn, #searchBtnBottom, #yearBtnBottom, #gotoPageBtn),
.mobile-scroll-wrapper :is(#searchBtn, #yearBtn, #searchBtnBottom, #yearBtnBottom, #gotoPageBtn) {
    color: #fff;
    background: linear-gradient(135deg, #1976d2, #1565c0);
    border-color: #1565c0;
    box-shadow: 0 2px 6px rgba(21, 101, 192, 0.28);
    font-weight: 600;
}

.chart-scroll-wrapper :is(.selection-controls, .bottom-controls) > .same-period-btn,
.chart-scroll-wrapper .same-period-group > .same-period-btn,
.mobile-scroll-wrapper :is(.selection-controls, .bottom-controls) > .same-period-btn,
.mobile-scroll-wrapper .same-period-group > .same-period-btn {
    color: #1565c0;
    background: #e3f2fd;
    border-color: #90caf9;
    font-weight: 600;
}

.chart-scroll-wrapper :is(.selection-controls, .bottom-controls) > .same-period-btn.active,
.chart-scroll-wrapper .same-period-group > .same-period-btn.active,
.mobile-scroll-wrapper :is(.selection-controls, .bottom-controls) > .same-period-btn.active,
.mobile-scroll-wrapper .same-period-group > .same-period-btn.active {
    color: #fff;
    background: linear-gradient(135deg, #ff9800, #f57c00);
    border-color: #f57c00;
    box-shadow: 0 2px 6px rgba(245, 124, 0, 0.28);
}

.chart-scroll-wrapper #reset-search,
.chart-scroll-wrapper #bottom-reset-search,
.mobile-scroll-wrapper #reset-search {
    color: #666;
    background: #f5f5f5;
    border-color: #ddd;
}

.chart-scroll-wrapper :is(.selection-controls, .controls, .zone-controls, .bottom-controls, .pagination) :is(.period-btn, .control-btn, .pagination-btn, .page-size-btn):hover:not(:disabled):not(.active),
.mobile-scroll-wrapper :is(.selection-controls, .controls, .zone-controls, .bottom-controls, .pagination) :is(.period-btn, .control-btn, .pagination-btn, .page-size-btn):hover:not(:disabled):not(.active) {
    color: #334155;
    background: #eef2f7;
    border-color: #b6c0cc;
}

.chart-scroll-wrapper :is(.selection-controls, .controls, .zone-controls, .bottom-controls, .pagination) :is(.period-btn, .control-btn, .zone-btn, .page-size-btn, .pagination-btn).active:hover:not(:disabled),
.mobile-scroll-wrapper :is(.selection-controls, .controls, .zone-controls, .bottom-controls, .pagination) :is(.period-btn, .control-btn, .zone-btn, .page-size-btn, .pagination-btn).active:hover:not(:disabled) {
    color: #fff;
    background: linear-gradient(135deg, #1565c0, #0d47a1);
    border-color: #0d47a1;
    box-shadow: 0 2px 6px rgba(13, 71, 161, 0.32);
}

.chart-scroll-wrapper :is(.selection-controls, .bottom-controls) > .same-period-btn:hover:not(.active),
.chart-scroll-wrapper .same-period-group > .same-period-btn:hover:not(.active),
.mobile-scroll-wrapper :is(.selection-controls, .bottom-controls) > .same-period-btn:hover:not(.active),
.mobile-scroll-wrapper .same-period-group > .same-period-btn:hover:not(.active) {
    color: #1565c0;
    background: #dbeafe;
    border-color: #64b5f6;
}

.chart-scroll-wrapper :is(.selection-controls, .bottom-controls) > .same-period-btn.active:hover,
.chart-scroll-wrapper .same-period-group > .same-period-btn.active:hover,
.mobile-scroll-wrapper :is(.selection-controls, .bottom-controls) > .same-period-btn.active:hover,
.mobile-scroll-wrapper .same-period-group > .same-period-btn.active:hover {
    color: #fff;
    background: linear-gradient(135deg, #fb8c00, #ef6c00);
    border-color: #ef6c00;
    box-shadow: 0 2px 6px rgba(239, 108, 0, 0.32);
}

.chart-scroll-wrapper :is(#combo-search, #period-query, #bottom-combo-search, #bottom-period-query, #go-to-page):hover,
.mobile-scroll-wrapper :is(#combo-search, #period-query, #bottom-combo-search, #bottom-period-query, #go-to-page):hover {
    color: #fff;
    background: linear-gradient(135deg, #d32f2f, #b71c1c);
    border-color: #b71c1c;
    box-shadow: 0 2px 6px rgba(183, 28, 28, 0.32);
}

.chart-scroll-wrapper :is(#reset-search, #bottom-reset-search):hover,
.mobile-scroll-wrapper :is(#reset-search, #bottom-reset-search):hover {
    color: #475569;
    background: #eceff1;
    border-color: #cfd8e3;
}

.chart-scroll-wrapper :is(.selection-controls, .controls, .zone-controls, .bottom-controls, .pagination) :is(.period-btn, .control-btn, .zone-btn, .query-btn, .pagination-btn, .page-size-btn):active,
.mobile-scroll-wrapper :is(.selection-controls, .controls, .zone-controls, .bottom-controls, .pagination) :is(.period-btn, .control-btn, .zone-btn, .query-btn, .pagination-btn, .page-size-btn):active {
    transform: scale(0.98);
}

.chart-scroll-wrapper .pagination .pagination-btn:disabled,
.mobile-scroll-wrapper .pagination .pagination-btn:disabled {
    opacity: 0.45;
    cursor: not-allowed;
    box-shadow: none;
}

.chart-scroll-wrapper :is(.selection-controls, .controls, .zone-controls, .bottom-controls, .combo-search, .period-query, .pagination) :is(.query-input, .period-input, .combo-input, .page-input),
.mobile-scroll-wrapper :is(.selection-controls, .controls, .zone-controls, .bottom-controls, .combo-search, .period-query, .pagination) :is(.query-input, .period-input, .combo-input, .page-input) {
    min-height: 26px;
    height: auto;
    min-width: 0;
    padding: 3px 5px;
    font-size: var(--chart-ui-font-size, 12px);
    line-height: var(--chart-ui-line-height, 1.25);
    border: 1px solid #cfd8e3;
    border-radius: 6px;
    background: #fff;
    box-sizing: border-box;
    box-shadow: inset 0 1px 2px rgba(15, 23, 42, 0.04);
}

/* 期号：7 位数字 + 2 字符余量 */
.chart-scroll-wrapper :is(.combo-search, .period-query, .bottom-controls) :is(.period-input, #search-period, #bottom-search-period, #start-period, #end-period, #bottom-start-period, #bottom-end-period),
.mobile-scroll-wrapper :is(.combo-search, .period-query, .bottom-controls) :is(.period-input, #search-period, #bottom-search-period, #start-period, #end-period, #bottom-start-period, #bottom-end-period) {
    width: 9.5ch;
    min-width: 9.5ch;
    max-width: 9.5ch;
    padding-left: 2px;
    padding-right: 2px;
    text-align: center;
}

/* 红球：紧凑输入 */
.chart-scroll-wrapper :is(.combo-search, .bottom-controls .combo-search) :is(#search-red, #bottom-search-red),
.mobile-scroll-wrapper :is(.combo-search, .bottom-controls .combo-search) :is(#search-red, #bottom-search-red) {
    width: 10ch;
    min-width: 10ch;
    max-width: 10ch;
    flex: 0 0 10ch;
    text-align: left;
}

/* 蓝球：2 位 + 2 字符余量 */
.chart-scroll-wrapper :is(.combo-search, .bottom-controls .combo-search) .combo-input.small,
.mobile-scroll-wrapper :is(.combo-search, .bottom-controls .combo-search) .combo-input.small {
    width: 8ch;
    min-width: 8ch;
    max-width: 8ch;
    flex: 0 0 8ch;
    padding-left: 3px;
    padding-right: 3px;
    text-align: center;
}

/* 分页页码：最多 3 位 */
.chart-scroll-wrapper .pagination .page-input,
.mobile-scroll-wrapper .pagination .page-input {
    width: 4.5ch;
    min-width: 4.5ch;
    max-width: 4.5ch;
    padding-left: 2px;
    padding-right: 2px;
    text-align: center;
}

.chart-scroll-wrapper .combo-search label,
.chart-scroll-wrapper .period-query label,
.mobile-scroll-wrapper .combo-search label,
.mobile-scroll-wrapper .period-query label {
    display: none;
}

.chart-scroll-wrapper .period-separator,
.mobile-scroll-wrapper .period-separator {
    font-size: var(--chart-ui-font-size, 12px);
    padding: 0 1px;
}

.chart-scroll-wrapper .pagination-info,
.chart-scroll-wrapper .total-periods,
.chart-scroll-wrapper .total-count,
.mobile-scroll-wrapper .pagination-info,
.mobile-scroll-wrapper .total-periods,
.mobile-scroll-wrapper .total-count {
    font-size: var(--chart-ui-font-size, 12px);
    color: #64748b;
    font-weight: 500;
    white-space: nowrap;
}

.chart-scroll-wrapper .pagination .page-number.active,
.chart-scroll-wrapper .pagination .page-btn.active,
.mobile-scroll-wrapper .pagination .page-number.active,
.mobile-scroll-wrapper .pagination .page-btn.active {
    color: #fff;
    background: linear-gradient(135deg, #1976d2, #1565c0);
    border-color: #1565c0;
    box-shadow: 0 2px 6px rgba(21, 101, 192, 0.28);
}

.chart-scroll-wrapper .pagination .page-ellipsis,
.mobile-scroll-wrapper .pagination .page-ellipsis {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 20px;
    color: #94a3b8;
    font-size: var(--chart-ui-font-size, 12px);
}

/* 3D万能码：Tab 与内容区同宽（随表格列宽定宽，非固定 1060px） */
.wnm-chart-frame {
    width: fit-content;
    max-width: 100%;
    margin: 0 auto;
    box-sizing: border-box;
}

.wnm-chart-frame > .tab-navigation {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    align-items: center;
    gap: 6px;
    width: 100%;
    margin: 0 0 8px;
    padding: 8px 10px;
    background: #f3f5f8;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    box-sizing: border-box;
}

.wnm-chart-frame > .chart-scroll-wrapper {
    width: 100% !important;
    max-width: 100% !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
}

.chart-scroll-wrapper[data-lottery-type="3d-wnm"] .tab-content {
    width: 100%;
    box-sizing: border-box;
}

.chart-scroll-wrapper[data-lottery-type="3d-wnm"] .tab-content.active {
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 10px rgba(15, 23, 42, 0.08);
}

.chart-scroll-wrapper[data-lottery-type="3d-wnm"] .data-container,
.chart-scroll-wrapper[data-lottery-type="3d-wnm"] .table-container {
    width: max-content;
    max-width: 100%;
}

.chart-scroll-wrapper[data-lottery-type="3d-wnm"] table {
    width: auto !important;
    min-width: 0;
    max-width: none;
    table-layout: fixed;
    box-sizing: border-box;
}

.chart-page-shell .tab-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 30px;
    padding: 4px 12px;
    font-size: var(--chart-ui-font-size, 12px);
    font-weight: 500;
    color: #444;
    background: #fff;
    border: 1px solid #d0d7de;
    border-radius: 6px;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.06);
    cursor: pointer;
    transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
    white-space: nowrap;
}

.chart-page-shell .tab-btn:hover {
    background: #eef2f7;
    border-color: #b6c0cc;
}

.chart-page-shell .tab-btn.active {
    color: #fff;
    background: linear-gradient(135deg, #1976d2, #1565c0);
    border-color: #1565c0;
    box-shadow: 0 2px 6px rgba(21, 101, 192, 0.28);
}

/* PC：图表块水平居中；宽于视口时在 wrapper 内横滑 */
@media (min-width: 769px) {
    body:has(.chart-page-shell) .site-header {
        margin-bottom: 0;
    }

    .container.chart-page-shell,
    .table-container.chart-page-shell,
    #main-content.chart-page-shell {
        margin-top: 0;
        width: fit-content;
        max-width: 100%;
        margin-left: auto;
        margin-right: auto;
        overflow: hidden;
    }

    .chart-scroll-wrapper,
    .mobile-scroll-wrapper {
        width: max-content !important;
        max-width: 100%;
        margin-left: auto;
        margin-right: auto;
        overflow-x: auto !important;
    }

    .chart-scroll-wrapper .header,
    .mobile-scroll-wrapper .header {
        width: max-content !important;
        min-width: 0;
        max-width: none !important;
        box-sizing: border-box;
        overflow: visible !important;
    }

    .chart-page-shell > .header {
        width: max-content;
        max-width: 100%;
        box-sizing: border-box;
    }

    .chart-page-shell .header:has(.chart-scroll-wrapper) {
        padding: 0;
        border: 1px solid #e2e8f0;
        border-radius: 8px;
        box-shadow: 0 2px 10px rgba(15, 23, 42, 0.08);
        overflow: hidden;
        background: #fff;
    }

    /* 控制栏：宽屏单行居中；仅窄窗时才换行 */
    .chart-scroll-wrapper :is(.controls, .controls-bottom),
    .mobile-scroll-wrapper :is(.controls, .controls-bottom) {
        display: flex;
        flex-wrap: nowrap;
        justify-content: center;
        align-items: center;
        gap: 8px;
        width: 100%;
        max-width: 100%;
        min-width: 0;
        padding: 8px 10px;
        overflow-x: auto;
        overflow-y: hidden;
        box-sizing: border-box;
        scrollbar-width: thin;
    }

    .chart-scroll-wrapper :is(.controls, .controls-bottom)::-webkit-scrollbar,
    .mobile-scroll-wrapper :is(.controls, .controls-bottom)::-webkit-scrollbar {
        height: 6px;
    }

    .chart-scroll-wrapper :is(.selection-controls, .bottom-controls),
    .mobile-scroll-wrapper :is(.selection-controls, .bottom-controls) {
        gap: 8px;
        flex-wrap: nowrap;
        justify-content: center;
        align-items: stretch;
        width: 100%;
        max-width: 100%;
        box-sizing: border-box;
    }

    .chart-scroll-wrapper :is(.selection-controls, .bottom-controls) > .pagination-group,
    .chart-scroll-wrapper :is(.selection-controls, .bottom-controls) > .display-controls,
    .chart-scroll-wrapper :is(.selection-controls, .bottom-controls) > .period-query,
    .chart-scroll-wrapper :is(.selection-controls, .bottom-controls) > .combo-search,
    .mobile-scroll-wrapper :is(.selection-controls, .bottom-controls) > .pagination-group,
    .mobile-scroll-wrapper :is(.selection-controls, .bottom-controls) > .display-controls,
    .mobile-scroll-wrapper :is(.selection-controls, .bottom-controls) > .period-query,
    .mobile-scroll-wrapper :is(.selection-controls, .bottom-controls) > .combo-search {
        flex: 0 0 auto;
        width: max-content;
        max-width: 100%;
    }

    .chart-scroll-wrapper :is(.selection-controls, .bottom-controls) > .combo-search,
    .mobile-scroll-wrapper :is(.selection-controls, .bottom-controls) > .combo-search {
        flex-wrap: nowrap;
    }

    .chart-scroll-wrapper .combo-search,
    .chart-scroll-wrapper .display-controls,
    .chart-scroll-wrapper .period-query,
    .mobile-scroll-wrapper .combo-search,
    .mobile-scroll-wrapper .display-controls,
    .mobile-scroll-wrapper .period-query {
        gap: 4px;
        flex-wrap: nowrap;
    }

    .chart-scroll-wrapper .pagination,
    .mobile-scroll-wrapper .pagination {
        justify-content: center !important;
        flex-wrap: wrap !important;
        gap: 8px;
        row-gap: 8px;
        width: 100%;
        max-width: 100%;
        min-width: 0;
        box-sizing: border-box;
        background: #f3f5f8 !important;
        padding: 8px 10px;
        border-top: 1px solid #e2e8f0;
    }

    .chart-scroll-wrapper .pagination-wrapper,
    .mobile-scroll-wrapper .pagination-wrapper {
        width: 100%;
        max-width: 100%;
        min-width: 0;
        box-sizing: border-box;
    }

    .chart-scroll-wrapper .data-container,
    .mobile-scroll-wrapper .data-container {
        width: max-content;
        min-width: 0;
        max-width: none;
        box-sizing: border-box;
    }

    .chart-scroll-wrapper .table-container,
    .mobile-scroll-wrapper .table-container {
        width: max-content;
        min-width: 0;
        max-width: none;
        box-sizing: border-box;
    }

    /* 表格单元格内容居中（覆盖部分模板内联 left） */
    .chart-scroll-wrapper table :is(th, td),
    .mobile-scroll-wrapper table :is(th, td) {
        text-align: center;
    }

    /* 万能码：五码/七码等窄表在 PC 上于 Tab 内居中（控制栏较宽时） */
    .wnm-chart-frame {
        width: fit-content;
        max-width: 100%;
        margin-left: auto;
        margin-right: auto;
    }

    .wnm-chart-frame > .chart-scroll-wrapper {
        width: max-content !important;
        max-width: 100% !important;
        margin-left: auto !important;
        margin-right: auto !important;
    }

    .chart-scroll-wrapper[data-lottery-type="3d-wnm"] .tab-content {
        width: max-content;
        max-width: 100%;
        box-sizing: border-box;
    }

    .chart-scroll-wrapper[data-lottery-type="3d-wnm"] .tab-content.active {
        margin-left: auto;
        margin-right: auto;
        overflow-x: auto;
        overflow-y: visible;
    }

    .chart-scroll-wrapper[data-lottery-type="3d-wnm"] .controls {
        flex-wrap: wrap;
        justify-content: center;
        row-gap: 6px;
    }

    .chart-scroll-wrapper[data-lottery-type="3d-wnm"] .data-container,
    .chart-scroll-wrapper[data-lottery-type="3d-wnm"] .table-container {
        margin-left: auto;
        margin-right: auto;
    }

    /* 控制栏/分页宽度跟随 header（= max(表格宽, 控制栏内容宽)） */
    .chart-scroll-wrapper :is(.controls, .controls-bottom, .pagination-wrapper),
    .mobile-scroll-wrapper :is(.controls, .controls-bottom, .pagination-wrapper) {
        width: 100%;
        max-width: 100%;
        box-sizing: border-box;
    }

    .chart-scroll-wrapper .controls :is(.control-group, .same-period-selector, .search-box, .periods-selector, .year-selector, .toggle-buttons),
    .mobile-scroll-wrapper .controls :is(.control-group, .same-period-selector, .search-box, .periods-selector, .year-selector, .toggle-buttons) {
        flex: 0 0 auto;
        flex-shrink: 0;
        max-width: none;
    }

    .chart-scroll-wrapper .controls .search-box,
    .mobile-scroll-wrapper .controls .search-box {
        flex-wrap: nowrap;
    }

    /* 窄屏 PC：空间不足时再允许分组换行 */
    @media (max-width: 960px) {
        .chart-scroll-wrapper :is(.controls, .controls-bottom),
        .mobile-scroll-wrapper :is(.controls, .controls-bottom) {
            flex-wrap: wrap;
            justify-content: center;
            overflow-x: hidden;
        }

        .chart-scroll-wrapper .controls .search-box,
        .mobile-scroll-wrapper .controls .search-box {
            flex-wrap: wrap;
            row-gap: 6px;
        }

        .chart-scroll-wrapper .controls .search-box .search-options,
        .mobile-scroll-wrapper .controls .search-box .search-options {
            flex-wrap: nowrap;
        }

        .chart-scroll-wrapper .controls :is(.control-group, .same-period-selector, .search-box, .periods-selector, .year-selector, .toggle-buttons),
        .mobile-scroll-wrapper .controls :is(.control-group, .same-period-selector, .search-box, .periods-selector, .year-selector, .toggle-buttons) {
            flex: 0 1 auto;
            max-width: 100%;
        }
    }

    .chart-scroll-wrapper .pagination > .pagination-group,
    .mobile-scroll-wrapper .pagination > .pagination-group {
        flex: 0 0 auto;
    }

    .chart-scroll-wrapper .pagination > .pagination-jump,
    .mobile-scroll-wrapper .pagination > .pagination-jump {
        flex: 0 1 auto;
    }

    /* 3D 走势图：PC 底部控制栏（分页上方） */
    .chart-scroll-wrapper .controls.controls-bottom,
    .mobile-scroll-wrapper .controls.controls-bottom {
        border-top: 1px solid #e2e8f0;
    }
}

@media (max-width: 768px) {
    /* 移动端：略小字号 + 适中触控高度 */
    .chart-scroll-wrapper,
    .mobile-scroll-wrapper {
        --chart-ui-font-size: 11px;
        --chart-ui-line-height: 1.2;
        --chart-control-h: 32px;
    }

    /* 走势图页：减轻回弹，但不影响正常纵向滚动 */
    body.chart-page,
    body:has(.chart-scroll-wrapper),
    body:has(.mobile-scroll-wrapper) {
        overscroll-behavior-y: contain;
    }

    body.chart-page,
    body:has(.chart-scroll-wrapper),
    body:has(.mobile-scroll-wrapper) {
        display: block !important;
        overflow-x: clip;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
        width: 100%;
        max-width: 100%;
        height: auto !important;
        min-height: 100%;
        padding-bottom: 0;
    }

    /* 导航全宽；导航层叠在图表之上 */
    .site-header {
        position: relative !important;
        z-index: 500 !important;
        margin-bottom: 12px !important;
    }

    .site-header .header-inner {
        position: relative;
    }

    .site-header .header-nav.open {
        z-index: 501;
    }

    .site-footer,
    .skip-nav {
        width: 100% !important;
        max-width: 100% !important;
        min-width: 0 !important;
        box-sizing: border-box;
    }

    /* 图表页外壳：不占固定最小宽度 */
    .chart-page-shell,
    #main-content.chart-page-shell,
    .container.chart-page-shell {
        width: 100% !important;
        max-width: 100% !important;
        min-width: 0 !important;
        margin-left: 0 !important;
        margin-right: 0 !important;
        margin-top: 8px !important;
        margin-bottom: 8px !important;
        padding-left: 0 !important;
        padding-right: 0 !important;
        padding-bottom: 0 !important;
        --chart-shell-radius: 12px;
        border-radius: var(--chart-shell-radius) !important;
        box-shadow: none !important;
        overflow: hidden !important;
        contain: none !important;
        background: #fff !important;
    }

    /* 走势图 header 勿裁剪横滑内容（双指放大后尤其明显） */
    .chart-page-shell > .header,
    .chart-page-shell .header:has(.chart-scroll-wrapper),
    body:has(.chart-scroll-wrapper) .header,
    body:has(.mobile-scroll-wrapper) .header {
        overflow: visible !important;
    }

    #main-content.chart-page-shell.table-container {
        overflow: visible !important;
        contain: none !important;
        background: #fff !important;
    }

    /* 页脚在 #main-content 外，正常文档流 + 实色背景，避免只看到页面渐变 */
    body.chart-page .site-footer,
    body:has(.chart-scroll-wrapper) .site-footer,
    body:has(.mobile-scroll-wrapper) .site-footer {
        display: block !important;
        visibility: visible !important;
        opacity: 1 !important;
        position: relative !important;
        left: auto !important;
        right: auto !important;
        bottom: auto !important;
        width: 100% !important;
        min-width: 0 !important;
        min-height: 120px;
        margin-top: 20px !important;
        z-index: 1 !important;
        box-sizing: border-box;
        background-color: #1a0a0a !important;
        background-image: linear-gradient(135deg, #1a0a0a 0%, #8b1a1a 100%) !important;
        color: #fff !important;
        padding: 24px 15px calc(20px + env(safe-area-inset-bottom, 0px)) !important;
        box-shadow: none;
    }

    body.chart-page .site-footer .footer-inner,
    body:has(.chart-scroll-wrapper) .site-footer .footer-inner,
    body:has(.mobile-scroll-wrapper) .site-footer .footer-inner {
        position: relative;
        z-index: 1;
        width: 100% !important;
        max-width: 100% !important;
        min-width: 0 !important;
    }

    body.chart-page .site-footer .footer-copy,
    body.chart-page .site-footer .footer-copy p,
    body:has(.chart-scroll-wrapper) .site-footer .footer-copy,
    body:has(.chart-scroll-wrapper) .site-footer .footer-copy p,
    body:has(.mobile-scroll-wrapper) .site-footer .footer-copy,
    body:has(.mobile-scroll-wrapper) .site-footer .footer-copy p {
        color: rgba(255, 255, 255, 0.9) !important;
    }

    body.chart-page .back-to-top,
    body:has(.chart-scroll-wrapper) .back-to-top,
    body:has(.mobile-scroll-wrapper) .back-to-top {
        bottom: 30px !important;
        z-index: 401 !important;
    }

    /* 横滑容器：控制栏 + 表格 + 分页同一层横向滚动 */
    .chart-scroll-wrapper,
    .mobile-scroll-wrapper {
        overflow-x: auto;
        overflow-y: visible;
        overscroll-behavior-x: contain;
        overscroll-behavior-y: auto;
        -webkit-overflow-scrolling: touch;
        width: 100%;
        max-width: 100%;
        min-width: 0;
        background: #fff;
    }

    body:has(.chart-scroll-wrapper) .header,
    body:has(.mobile-scroll-wrapper) .header,
    .chart-page-shell .header {
        overflow: visible !important;
    }

    /* 内容区宽度由最宽子块（通常为表格）决定，控制栏/分页同层横滑 */
    .chart-scroll-wrapper .header,
    .mobile-scroll-wrapper .header,
    .chart-scroll-wrapper[data-lottery-type="3d-wnm"] .tab-content.active,
    .mobile-scroll-wrapper[data-lottery-type="3d-wnm"] .tab-content.active {
        width: max-content;
        min-width: 100%;
        max-width: none;
        box-sizing: border-box;
        overflow: visible !important;
    }

    .chart-scroll-wrapper .controls,
    .chart-scroll-wrapper .selection-controls,
    .chart-scroll-wrapper .controls-bottom,
    .chart-scroll-wrapper .zone-controls,
    .chart-scroll-wrapper .pagination-wrapper,
    .chart-scroll-wrapper .pagination-controls,
    .chart-scroll-wrapper .countdown-and-controls,
    .mobile-scroll-wrapper .controls,
    .mobile-scroll-wrapper .selection-controls,
    .mobile-scroll-wrapper .controls-bottom,
    .mobile-scroll-wrapper .zone-controls,
    .mobile-scroll-wrapper .pagination-wrapper,
    .mobile-scroll-wrapper .pagination-controls,
    .mobile-scroll-wrapper .countdown-and-controls {
        width: max-content;
        min-width: 100%;
        max-width: none;
        overflow-x: visible !important;
        box-sizing: border-box;
    }

    /* 表格区：仅 table 决定列宽，容器不叠加 min-width */
    .chart-scroll-wrapper .data-container,
    .chart-scroll-wrapper .table-container,
    .mobile-scroll-wrapper .data-container,
    .mobile-scroll-wrapper .table-container {
        width: max-content !important;
        min-width: 100%;
        max-width: none;
        overflow-x: visible !important;
        box-sizing: border-box;
    }

    .chart-scroll-wrapper .selection-controls,
    .mobile-scroll-wrapper .selection-controls {
        display: flex !important;
        flex-wrap: nowrap !important;
        flex-direction: row !important;
        align-items: stretch !important;
        justify-content: flex-start !important;
        gap: 8px !important;
        overflow: visible;
    }

    .chart-scroll-wrapper .controls,
    .mobile-scroll-wrapper .controls {
        display: flex !important;
        flex-wrap: nowrap !important;
        align-items: center !important;
        justify-content: flex-start !important;
        gap: 8px !important;
        white-space: nowrap;
        overflow-x: visible;
    }

    .chart-scroll-wrapper .controls :is(.control-group, .same-period-selector, .search-box, .periods-selector, .year-selector, .toggle-buttons),
    .mobile-scroll-wrapper .controls :is(.control-group, .same-period-selector, .search-box, .periods-selector, .year-selector, .toggle-buttons) {
        flex: 0 0 auto;
        flex-shrink: 0;
        max-width: none;
        align-items: center;
    }

    .chart-scroll-wrapper .selection-controls :is(.combo-search, .display-controls, .period-query, .pagination-group),
    .mobile-scroll-wrapper .selection-controls :is(.combo-search, .display-controls, .period-query, .pagination-group) {
        flex-wrap: nowrap !important;
        flex-shrink: 0;
    }

    .chart-scroll-wrapper .combo-search label,
    .chart-scroll-wrapper .period-query label,
    .mobile-scroll-wrapper .combo-search label,
    .mobile-scroll-wrapper .period-query label {
        display: none;
    }

    .chart-scroll-wrapper table,
    .mobile-scroll-wrapper table {
        width: max-content !important;
        min-width: 0 !important;
        max-width: none;
        overflow-x: visible !important;
    }

    .chart-scroll-wrapper th,
    .chart-scroll-wrapper td,
    .mobile-scroll-wrapper th,
    .mobile-scroll-wrapper td {
        font-size: 11px;
    }

    /* 期号列与 PC 一致，避免预测行首列被撑宽 */
    .chart-scroll-wrapper #lottery-table col.col-period,
    .mobile-scroll-wrapper #lottery-table col.col-period {
        width: 60px !important;
    }

    .chart-scroll-wrapper #lottery-table .period-col,
    .mobile-scroll-wrapper #lottery-table .period-col {
        width: 60px !important;
        min-width: 60px !important;
        max-width: 60px !important;
        box-sizing: border-box;
    }

    .chart-scroll-wrapper .pagination,
    .mobile-scroll-wrapper .pagination {
        width: max-content !important;
        min-width: 100% !important;
        max-width: none !important;
        flex-wrap: nowrap !important;
        justify-content: flex-start !important;
        gap: 6px;
        padding: 8px 6px calc(10px + env(safe-area-inset-bottom, 0px)) !important;
        border-radius: 0 !important;
    }

    .chart-scroll-wrapper .pagination-group,
    .mobile-scroll-wrapper .pagination-group {
        flex-wrap: nowrap;
        flex-shrink: 0;
        gap: 4px;
    }

    .chart-scroll-wrapper .pagination-nav,
    .mobile-scroll-wrapper .pagination-nav {
        flex-wrap: nowrap;
        flex-shrink: 0;
    }

    .chart-scroll-wrapper .page-numbers,
    .mobile-scroll-wrapper .page-numbers {
        flex-wrap: nowrap;
        flex-shrink: 0;
        gap: 4px;
    }

    .chart-scroll-wrapper .pagination-wrapper,
    .mobile-scroll-wrapper .pagination-wrapper {
        width: max-content;
        min-width: 100%;
        max-width: none;
    }

    /* 底部重复控制栏隐藏；顶部 selection-controls 保持显示 */
    .controls-bottom,
    .chart-scroll-wrapper .bottom-controls,
    .mobile-scroll-wrapper .bottom-controls {
        display: none !important;
    }

    /* 万能码：Tab 占满视口宽，表格区在内部横滑 */
    .wnm-chart-frame {
        width: 100%;
        max-width: 100%;
        min-width: 0;
    }

    .wnm-chart-frame > .tab-navigation {
        position: sticky;
        top: 0;
        z-index: 20;
        display: flex !important;
        flex-wrap: wrap !important;
        justify-content: center !important;
        align-items: center;
        gap: 6px;
        width: 100%;
        max-width: 100%;
        min-width: 0;
        margin: 0;
        padding: 6px 8px;
        border-radius: 0;
        border-left: none;
        border-right: none;
        box-shadow: 0 1px 0 #e2e8f0;
        overflow-x: visible;
    }

    .chart-scroll-wrapper[data-lottery-type="3d-wnm"],
    .mobile-scroll-wrapper[data-lottery-type="3d-wnm"] {
        width: 100%;
        max-width: 100%;
        min-width: 0;
    }

    .chart-scroll-wrapper[data-lottery-type="3d-wnm"] .tab-content.active,
    .mobile-scroll-wrapper[data-lottery-type="3d-wnm"] .tab-content.active {
        border-radius: 0;
        border-left: none;
        border-right: none;
        box-shadow: none;
        overflow: visible !important;
    }

    .chart-scroll-wrapper[data-lottery-type="3d-wnm"] table,
    .mobile-scroll-wrapper[data-lottery-type="3d-wnm"] table {
        width: auto !important;
        min-width: 0 !important;
        max-width: none !important;
        table-layout: fixed;
    }

    /* 万能码：表格区禁止 min-width:100% 撑宽，宽度由 JS/colgroup 精确对齐 */
    .chart-scroll-wrapper[data-lottery-type="3d-wnm"] .tab-content.active,
    .mobile-scroll-wrapper[data-lottery-type="3d-wnm"] .tab-content.active {
        min-width: 0 !important;
    }

    .chart-scroll-wrapper[data-lottery-type="3d-wnm"] .controls,
    .mobile-scroll-wrapper[data-lottery-type="3d-wnm"] .controls,
    .chart-scroll-wrapper[data-lottery-type="3d-wnm"] .pagination-wrapper,
    .mobile-scroll-wrapper[data-lottery-type="3d-wnm"] .pagination-wrapper {
        min-width: 0 !important;
    }

    .chart-scroll-wrapper[data-lottery-type="3d-wnm"] .data-container,
    .chart-scroll-wrapper[data-lottery-type="3d-wnm"] .table-container,
    .mobile-scroll-wrapper[data-lottery-type="3d-wnm"] .data-container,
    .mobile-scroll-wrapper[data-lottery-type="3d-wnm"] .table-container {
        min-width: 0 !important;
        max-width: none !important;
    }

    /* 万能码移动端：压缩控制栏，避免宽于表格导致右侧留白 */
    .chart-scroll-wrapper[data-lottery-type="3d-wnm"] .same-period-selector,
    .mobile-scroll-wrapper[data-lottery-type="3d-wnm"] .same-period-selector {
        display: none !important;
    }

    .chart-scroll-wrapper[data-lottery-type="3d-wnm"] .periods-selector > span,
    .mobile-scroll-wrapper[data-lottery-type="3d-wnm"] .periods-selector > span {
        display: none;
    }

    .chart-scroll-wrapper[data-lottery-type="3d-wnm"] .search-box .search-options,
    .mobile-scroll-wrapper[data-lottery-type="3d-wnm"] .search-box .search-options {
        display: none;
    }

    .chart-scroll-wrapper[data-lottery-type="3d-wnm"] .search-box .search-input,
    .mobile-scroll-wrapper[data-lottery-type="3d-wnm"] .search-box .search-input {
        width: 8ch !important;
        min-width: 8ch;
        max-width: 8ch;
        flex: 0 0 8ch;
    }

    .chart-scroll-wrapper[data-lottery-type="3d-wnm"] .controls :is(.period-btn, .query-btn, .refresh-btn, .same-period-btn),
    .mobile-scroll-wrapper[data-lottery-type="3d-wnm"] .controls :is(.period-btn, .query-btn, .refresh-btn, .same-period-btn) {
        padding-left: 5px !important;
        padding-right: 5px !important;
    }

    .tab-navigation {
        width: 100% !important;
        max-width: 100% !important;
        min-width: 0 !important;
        box-sizing: border-box;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        flex-wrap: nowrap !important;
        justify-content: flex-start !important;
        scrollbar-width: none;
    }

    .tab-navigation::-webkit-scrollbar {
        display: none;
    }

    .tab-btn {
        min-height: var(--chart-control-h, 32px) !important;
        height: var(--chart-control-h, 32px) !important;
        min-width: auto !important;
        padding: 0 10px !important;
        font-size: var(--chart-ui-font-size, 11px) !important;
        flex-shrink: 0;
        touch-action: manipulation;
        -webkit-tap-highlight-color: transparent;
    }

    .chart-scroll-wrapper .controls,
    .mobile-scroll-wrapper .controls,
    .chart-scroll-wrapper .selection-controls,
    .mobile-scroll-wrapper .selection-controls {
        padding: 6px 8px;
        gap: 6px;
        -webkit-tap-highlight-color: transparent;
    }

    .chart-scroll-wrapper .control-group,
    .mobile-scroll-wrapper .control-group,
    .chart-scroll-wrapper :is(.same-period-selector, .search-box, .periods-selector, .year-selector, .toggle-buttons),
    .mobile-scroll-wrapper :is(.same-period-selector, .search-box, .periods-selector, .year-selector, .toggle-buttons) {
        padding: 3px 5px;
        gap: 3px;
        flex-wrap: nowrap;
    }

    .chart-scroll-wrapper .search-box .search-input,
    .mobile-scroll-wrapper .search-box .search-input {
        width: 11ch !important;
        min-width: 11ch;
        max-width: 11ch;
        flex: 0 0 11ch;
    }

    .chart-scroll-wrapper .controls,
    .mobile-scroll-wrapper .controls {
        --chart-control-h: 32px;
        min-height: 0;
        padding: 6px 8px;
    }

    /* 移动端：控制栏内按钮/输入框统一高度（覆盖模板内联 height:24px） */
    .chart-scroll-wrapper .controls :is(
        button,
        input:not([type="radio"]):not([type="checkbox"]),
        select
    ),
    .chart-scroll-wrapper .controls-bottom :is(
        button,
        input:not([type="radio"]):not([type="checkbox"]),
        select
    ),
    .chart-scroll-wrapper .selection-controls :is(
        button,
        input:not([type="radio"]):not([type="checkbox"]),
        select
    ),
    .mobile-scroll-wrapper .controls :is(
        button,
        input:not([type="radio"]):not([type="checkbox"]),
        select
    ),
    .mobile-scroll-wrapper .controls-bottom :is(
        button,
        input:not([type="radio"]):not([type="checkbox"]),
        select
    ),
    .mobile-scroll-wrapper .selection-controls :is(
        button,
        input:not([type="radio"]):not([type="checkbox"]),
        select
    ),
    .chart-scroll-wrapper .pagination :is(
        button,
        input:not([type="radio"]):not([type="checkbox"]),
        select
    ),
    .mobile-scroll-wrapper .pagination :is(
        button,
        input:not([type="radio"]):not([type="checkbox"]),
        select
    ) {
        height: var(--chart-control-h) !important;
        min-height: var(--chart-control-h) !important;
        max-height: var(--chart-control-h) !important;
        font-size: var(--chart-ui-font-size, 12px) !important;
        line-height: var(--chart-ui-line-height, 1.25) !important;
        padding-top: 0 !important;
        padding-bottom: 0 !important;
        padding-left: 8px !important;
        padding-right: 8px !important;
        box-sizing: border-box !important;
        display: inline-flex !important;
        align-items: center !important;
        justify-content: center !important;
        touch-action: manipulation;
        -webkit-tap-highlight-color: transparent;
    }

    .chart-scroll-wrapper :is(.controls, .pagination, .pagination-wrapper) :is(span, label),
    .mobile-scroll-wrapper :is(.controls, .pagination, .pagination-wrapper) :is(span, label) {
        font-size: var(--chart-ui-font-size, 12px) !important;
        line-height: var(--chart-ui-line-height, 1.25) !important;
    }

    .chart-scroll-wrapper .controls :is(.search-input, .year-input, .query-input, .period-input, .combo-input, .page-input),
    .mobile-scroll-wrapper .controls :is(.search-input, .year-input, .query-input, .period-input, .combo-input, .page-input),
    .chart-scroll-wrapper .selection-controls :is(.search-input, .year-input, .query-input, .period-input, .combo-input, .page-input),
    .mobile-scroll-wrapper .selection-controls :is(.search-input, .year-input, .query-input, .period-input, .combo-input, .page-input) {
        justify-content: flex-start !important;
    }

    .chart-scroll-wrapper .controls .search-options,
    .mobile-scroll-wrapper .controls .search-options {
        display: inline-flex;
        align-items: center;
        gap: 6px;
        height: var(--chart-control-h);
        flex-shrink: 0;
    }

    .chart-scroll-wrapper .controls .search-type,
    .mobile-scroll-wrapper .controls .search-type {
        display: inline-flex;
        align-items: center;
        gap: 3px;
        height: var(--chart-control-h);
        line-height: var(--chart-ui-line-height, 1.25);
        font-size: var(--chart-ui-font-size, 12px) !important;
    }

    .chart-scroll-wrapper .controls .search-type label,
    .mobile-scroll-wrapper .controls .search-type label {
        font-size: var(--chart-ui-font-size, 12px) !important;
        line-height: var(--chart-ui-line-height, 1.25) !important;
    }

    .chart-scroll-wrapper .controls .search-type input[type="radio"],
    .mobile-scroll-wrapper .controls .search-type input[type="radio"] {
        width: 16px !important;
        height: 16px !important;
        min-height: 16px !important;
        max-height: 16px !important;
        margin: 0 !important;
        padding: 0 !important;
        flex-shrink: 0;
    }

    .chart-scroll-wrapper .controls .search-type label,
    .mobile-scroll-wrapper .controls .search-type label {
        line-height: var(--chart-control-h);
        white-space: nowrap;
    }

    .chart-page-shell .tab-navigation {
        max-width: 100% !important;
    }

    /*
     * 预测行第一列（期号/预测标签列）：单行显示，不换行、不撑高
     * 覆盖 3D / 双色球 / 七乐彩 / 快乐8 / 万能码等模板内联与局部 flex 样式
     */
    tr.prediction-row > td:first-child,
    tr.prediction-row > .period-column,
    tr.prediction-row > .period-col,
    tr.prediction-row > .prediction-period-col,
    tr.prediction-row > .period {
        display: table-cell !important;
        white-space: nowrap !important;
        overflow: hidden;
        vertical-align: middle !important;
        line-height: 1 !important;
        padding: 0 2px !important;
        box-sizing: border-box;
    }

    tr.prediction-row > td:first-child > div,
    tr.prediction-row .prediction-period,
    tr.prediction-row .period-column > div {
        display: inline-flex !important;
        flex-direction: row !important;
        flex-wrap: nowrap !important;
        align-items: center !important;
        justify-content: flex-start !important;
        white-space: nowrap !important;
        width: auto !important;
        max-width: 100% !important;
        height: auto !important;
        max-height: none !important;
        line-height: 1 !important;
        gap: 2px;
        padding: 0 !important;
        box-sizing: border-box;
    }

    /* 快乐8：标签 + 删除按钮同一行 */
    tr.prediction-row .prediction-period-col .prediction-label,
    tr.prediction-row .prediction-period-col .prediction-controls-container {
        display: inline-flex !important;
        align-items: center !important;
        justify-content: center !important;
        width: auto !important;
        max-width: none !important;
        flex: 0 0 auto !important;
        white-space: nowrap !important;
        vertical-align: middle;
        line-height: 1 !important;
    }

    tr.prediction-row .prediction-period-col .prediction-label {
        margin-right: 2px;
        font-size: 10px;
    }

    tr.prediction-row .prediction-period span,
    tr.prediction-row > td:first-child span,
    tr.prediction-row .prediction-label {
        white-space: nowrap !important;
        flex-shrink: 0;
        line-height: 1 !important;
    }

    tr.prediction-row .delete-btn,
    tr.prediction-row .prediction-delete-btn {
        flex-shrink: 0;
        width: 12px !important;
        height: 12px !important;
        min-width: 12px !important;
        min-height: 12px !important;
        padding: 0 !important;
        font-size: 10px !important;
        line-height: 1 !important;
    }
}
