/* =========================================================
 * 百万秘籍 - 补充样式（在 style.css 之后加载）
 * 约定：所有需要查库的数据，未加载完成时统一显示「加载中」
 * ========================================================= */

.loading {
    display: block;
    color: #999;
    font-weight: 400;
    font-size: 14px;
    text-align: center;
    padding: 14px 0;
    letter-spacing: 1px;
}

/* 展示域名：对齐横幅卷轴框正中心（框在原图 x 475~977、y 251~342）
   left/top 用百分比，随图片等比缩放，任何屏幕都居中 */
.banner-ym {
    left: 52.8%;
    top: 77.2%;
    font-size: clamp(9px, 2.4vw, 20px);
    letter-spacing: 2px;
    text-align: center;
}

/* 预测资料：表格 */
.cat-block {
    margin-top: 8px;
}

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

/* 表头：弱化成辅助信息 */
.cat-table th {
    background: #fff;
    color: #aaa;
    font-weight: 400;
    font-size: 12px;
    letter-spacing: 1px;
    padding: 6px 10px;
    border-bottom: 1px solid #f0e2e2;
    text-align: left;
}

.cat-table th.col-status {
    text-align: right;
}

.cat-table td {
    padding: 10px 12px;
    border-bottom: 1px dashed #eee;
    vertical-align: middle;
    line-height: 1.45;
}

/* 只保留虚线分割，去掉隔行底色 */
.cat-table tbody tr:last-child td {
    border-bottom: 0;
}

.cat-table .col-range { width: 86px; }
.cat-table .col-status { width: 92px; }

/* 没有表头时，列宽由单元格决定 */
.cat-table td.cr-range { width: 86px; }
.cat-table td.cr-status { width: 92px; }

/* 期数：灰色小字，弱化 */
.cat-table td.cr-range {
    color: #999;
    font-weight: 500;
    font-size: 12px;
    white-space: nowrap;
    text-align: left;
    font-variant-numeric: tabular-nums;
}

.cat-table td.cr-range .cr-p {
    display: block;
    line-height: 1.5;
}

/* 内容：主视觉，居中显示（期数在左、状态在右，中间居中更平衡） */
.cat-table td.cr-data {
    color: #c8000f;
    font-weight: 700;
    font-size: 18px;
    letter-spacing: .06em;
    white-space: pre-line;
    word-break: normal;
    text-align: center;
}

/* 号码：蓝色等宽数字（避免与聚宝盆的 .num 圆形样式冲突） */
.cat-table td.cr-data .pnum {
    display: inline-block;
    padding: 0;
    margin-right: 5px;
    color: #2389e9;
    font-variant-numeric: tabular-nums;
    letter-spacing: 0;
    font-size: 16px;
}

/* 生肖：留出间距便于数清个数（本身不做底色，只有命中才高亮） */
.cat-table td.cr-data .pzod {
    display: inline-block;
    min-width: 1.45em;
    margin-right: 3px;
    text-align: center;
    letter-spacing: 0;
}

/* 命中的生肖字 / 号码：黄底高亮 */
.cat-table .hl {
    display: inline-block;
    background: #ffe600;
    color: #b00000;
    border-radius: 3px;
    padding: 0 2px;
    box-shadow: 0 0 0 1px #f5d000;
}

.cat-table .pnum.hl,
.cat-table .pzod.hl {
    background: #ffe600;
    color: #b00000;
    box-shadow: 0 0 0 1px #f5d000;
}

/* 藏头字（玄机诗）：单独用金色，和正文红字区分 */
.cat-table .lead {
    color: #b8860b;
    font-weight: 900;
    text-shadow: 0 1px 0 #ffe9a8;
}

.cat-table td.cr-status {
    font-weight: 700;
    font-size: 12px;
    text-align: right;
    line-height: 1.6;
    white-space: pre-line;
}

.cat-table td.cr-status.pending { color: #ff8c00; }
.cat-table td.cr-status.hit     { color: #0a8f3c; }
.cat-table td.cr-status.miss    { color: #d0021b; }
.cat-table td.cr-status.missing { color: #bbb; }

/* 多段判定（头尾/一肖诗）：命中绿、未中灰 */
.cat-table .pt-ok { color: #0a8f3c; }
.cat-table .pt-no { color: #c4c4c4; }

/* 玄学栏目：楷体、居中、行距放大，去掉表头感 */
.cat-table.no-status td.cr-data {
    font-family: "STKaiti", "KaiTi", "楷体", serif;
    font-size: 18px;
    font-weight: 500;
    line-height: 2;
    letter-spacing: .08em;
    text-align: center;
    padding: 14px 20px;
    color: #5b2d8e;
}

.cat-table.no-status td.cr-range {
    vertical-align: middle;
}

/* 聚宝盆【九码九肖】 */
.treasure {
    margin-top: 8px;
}

.treasure-group {
    background: #0b0b0b;
}

.treasure-group + .treasure-group {
    margin-top: 8px;
}

.treasure-head {
    background-image: linear-gradient(90deg, #1b5e20, #2e8b57, #4caf78, #2e8b57, #1b5e20);
    background-size: 220% 100%;
    background-position: 0% 50%;
    animation: titleFlow 8s ease-in-out infinite alternate;
    color: #fff;
    text-align: center;
    font-size: 18px;
    font-weight: 900;
    letter-spacing: 2px;
    line-height: 38px;
    text-shadow: 0 2px 4px rgba(0, 0, 0, .35);
}

.treasure-row {
    display: grid;
    grid-template-columns: auto 1fr auto;
    gap: 8px;
    align-items: center;
    padding: 9px 10px;
    border-bottom: 1px solid #1c1c1c;
}

.treasure-row:last-child {
    border-bottom: 0;
}

.tr-label {
    color: #fff;
    font-size: 13px;
    white-space: nowrap;
}

.tr-content {
    color: #ff3b30;
    font-weight: 700;
    font-size: 16px;
    text-align: center;
    word-break: break-all;
}

.tr-res {
    color: #fff;
    font-size: 14px;
    white-space: nowrap;
}

.tr-content .hl {
    background: #ffe600;
    color: #000;
    border-radius: 3px;
    padding: 0 2px;
}

.tr-content.tr-miss {
    color: #888;
    font-size: 15px;
}

/* 安全提示（横幅下方） */
.safe-tip {
    margin: 8px 10px;
    padding: 10px 12px;
    background: #fffbeb;
    border: 1px dashed #e6a23c;
    border-radius: 8px;
}

/* 玄机图区块（插在文字栏目之间，无标题） */
.img-block {
    margin: 8px 10px;
}

.img-block .img-wrap {
    background: #fff;
    border-radius: 6px;
    overflow: hidden;
    line-height: 0;
}

.img-block .img-wrap img {
    display: block;
    width: 100%;
    height: auto;
    border-radius: 6px;
}

.img-block .img-tip {
    display: none;
    color: #999;
    text-align: center;
    padding: 24px 0;
    font-size: 13px;
}

.img-block .img-wrap.img-miss .img-tip {
    display: block;
}

/* 安全提示下方的配图（tishi.gif） */
.safe-img-box {
    margin: 0 10px 8px;
    line-height: 0;
}

.safe-img {
    display: block;
    width: 100%;
    height: auto;
    border-radius: 6px;
}

.safe-head {
    text-align: center;
    font-size: 19px;
    font-weight: 900;
    color: #c8000f;
    letter-spacing: 2px;
    line-height: 28px;
    margin-bottom: 6px;
}

.safe-icon {
    margin-right: 2px;
}

.safe-body p {
    font-size: 15px;
    font-weight: 400;
    color: #7a4b00;
    line-height: 1.95;
    text-align: center;
    letter-spacing: .5px;
}

/* 彩种切换标签 */
.kj-tabs {
    background: #fff;
}

.kj-tab {
    font-size: 16px;
    padding: 9px 2px;
    transition: color .15s, background .15s;
}

.kj-tab.active {
    color: #e60012;
    background: #fff5f5;
}

/* 新澳门 / 香港：外链直播画面 */
.live-panel {
    position: relative;
    padding: 0 !important;
    background: #fff;
    line-height: 0;
}

.live-loading {
    position: absolute;
    left: 0; right: 0; top: 0; bottom: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #999;
    font-size: 13px;
    font-weight: 400;
    background: #fff;
    line-height: 1;
}

.live-frame {
    position: relative;
    display: block;
    width: 100%;
    height: 130px;
    border: 0;
    background: #fff;
    opacity: 0;
    transition: opacity .15s;
}

.live-frame.ready {
    opacity: 1;
}

/* ===== 开奖结果区：版式参照 D:\xgfc-tt ===== */
.kj-panel {
    padding: 8px !important;
    box-sizing: border-box;
}

/* 号码球补充色 */
.ball.grey {
    background: #b8b8b8;
}

/* 顶部信息行：彩种名 / 倒计时 / 历史记录 */
.kj-info {
    display: flex;
    align-items: center;
    padding: 0;
    height: 17px;
    line-height: 17px;
    font-size: 16px;
}

.kj-lot {
    font-size: 16px;
    font-weight: 500;
    color: #333;
    white-space: nowrap;
}

.kj-lot em {
    font-size: 16px;
    color: #f00;
    font-style: normal;
}

.kj-clock {
    flex: 1;
    text-align: center;
    font-size: 17px;
    line-height: 17px;
    font-weight: 700;
    color: #333;
}

.kj-history {
    font-size: 16px;
    color: #f00;
    font-weight: 500;
    white-space: nowrap;
}

/* 7 球：等分铺满、高 60、圆角 4 */
.kj-balls {
    display: flex;
    flex-wrap: nowrap;
    gap: 0;
    margin: 8px 0;
    padding: 0;
}

.kj-balls .ball {
    flex: 1 1 0;
    min-width: 40px;
    width: auto;
    max-width: none;
    height: 60px;
    aspect-ratio: auto;
    border-radius: 4px;
    margin-right: 5px;
    padding: 3px 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    font-size: 23px;
    font-weight: 900;
    line-height: 20px;
    box-shadow: none;
}

.kj-balls .ball:last-child {
    margin-right: 0;
}

.kj-balls .ball-red {
    background: #e71607;
}

.kj-balls .ball-blue {
    background: #2389e9;
}

.kj-balls .ball-green {
    background: #1fb61d;
}

.kj-balls .ball i {
    display: inline-block;
    height: 18px;
    line-height: 18px;
    margin-top: 7px;
    padding: 0 3px;
    border-radius: 2px;
    background: #fff;
    color: #333;
    font-size: 12px;
    font-weight: 400;
    font-style: normal;
    white-space: nowrap;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
}

.kj-balls .kj-plus {
    display: flex;
    align-items: center;
    flex: 0 0 auto;
    margin-right: 8px;
    font-size: 28px;
    font-weight: 700;
}

/* 底部：下期预告 + 刷新 */
.kj-next {
    display: flex;
    align-items: center;
    padding: 0;
    margin: 0;
    font-size: 15px;
    line-height: 20px;
}

.kj-next p {
    flex: 1;
    margin: 0;
    font-size: 15px;
    line-height: 20px;
}

.kj-refresh {
    flex: 0 0 auto;
    width: 40px;
    height: 20px;
    line-height: 20px;
    padding: 0;
    text-align: center;
    color: #fff;
    border-radius: 4px;
    background: #ff9900;
    font-size: 13px;
}

/* 特码：与其它球同尺寸，不加光圈 */

/* 特码通栏：文字与号码同一行 */
.bzbm span {
    display: inline;
    font-size: 20px;
    margin-left: 4px;
}

/* 通用区块 */
.sec {
    background: #fff;
    margin-top: 8px;
    padding-bottom: 8px;
}

.sec-title {
    text-align: center;
    font-size: 18px;
    font-weight: 900;
    color: #fff;
    background-image: linear-gradient(90deg, #8a0f18, #e60012, #ff9f1a, #e60012, #8a0f18);
    background-size: 220% 100%;
    background-position: 0% 50%;
    animation: titleFlow 8s ease-in-out infinite alternate;
    line-height: 36px;
    letter-spacing: 2px;
    text-shadow: 0 2px 4px rgba(0, 0, 0, .35);
}

/* 每个栏目一套配色：渐变底色缓慢流动 */
.tone-0 { background-image: linear-gradient(90deg, #8a0f18, #e60012, #ff9f1a, #e60012, #8a0f18); }
.tone-1 { background-image: linear-gradient(90deg, #4a148c, #8e24aa, #ec407a, #8e24aa, #4a148c); }
.tone-2 { background-image: linear-gradient(90deg, #004d40, #00897b, #26c6da, #00897b, #004d40); }
.tone-3 { background-image: linear-gradient(90deg, #0d47a1, #1976d2, #4fc3f7, #1976d2, #0d47a1); }
.tone-4 { background-image: linear-gradient(90deg, #880e4f, #c2185b, #ff5c8d, #c2185b, #880e4f); }
.tone-5 { background-image: linear-gradient(90deg, #1b5e20, #388e3c, #8bc34a, #388e3c, #1b5e20); }
.tone-6 { background-image: linear-gradient(90deg, #795548, #b8860b, #ffd54f, #b8860b, #795548); }
.tone-7 { background-image: linear-gradient(90deg, #1a237e, #3949ab, #7986cb, #3949ab, #1a237e); }
.tone-8 { background-image: linear-gradient(90deg, #bf360c, #e64a19, #ffab40, #e64a19, #bf360c); }
.tone-9 { background-image: linear-gradient(90deg, #311b92, #5e35b1, #9575cd, #5e35b1, #311b92); }

@keyframes titleFlow {
    from { background-position: 0% 50%; }
    to   { background-position: 100% 50%; }
}

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

/* 生肖 / 五行 / 波色 网格 */
.meta-grid {
    display: grid;
    /* minmax(0,1fr)：允许列宽收缩到内容以下，窄屏不撑破容器 */
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 6px;
    padding: 8px;
}

.meta-item {
    min-width: 0;
    border: 1px solid #eee;
    border-radius: 8px;
    padding: 6px 4px;
    text-align: center;
    background: #fffdf8;
}

.mi-name {
    display: block;
    font-size: 15px;
    font-weight: 900;
    color: #e60012;
    line-height: 22px;
}

.mi-nums {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    line-height: 20px;
}

.num {
    display: inline-block;
    width: 21px;
    height: 21px;
    line-height: 21px;
    margin: 1px;
    border-radius: 50%;
    background: #f00;
    color: #fff;
    font-size: 12px;
    font-weight: 700;
    text-align: center;
}

.num.green { background: #009933; }
.num.blue  { background: #3366ff; }

/* PC 端仍为居中窄栏：内容宽度由 body 的 max-width 控制，这里只做轻微放大 */
@media (min-width: 760px) {
    .meta-grid { grid-template-columns: repeat(3, 1fr); gap: 8px; }
}

/* ===== 悬浮按钮：刷新 / 回到顶部 / 搜索资料 ===== */
.fab-wrap {
    position: fixed;
    right: 12px;
    bottom: 24px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    z-index: 60;
}

.fab {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    height: 36px;
    padding: 0 12px 0 9px;
    border: 0;
    border-radius: 18px;
    background: #fff;
    color: #c8000f;
    box-shadow: 0 2px 10px rgba(0, 0, 0, .2);
    cursor: pointer;
    font-size: 13px;
    font-weight: 700;
    line-height: 1;
    opacity: .96;
    -webkit-tap-highlight-color: transparent;
}

.fab-txt {
    letter-spacing: .5px;
}

.fab:active {
    transform: scale(.94);
    background: #fff5f5;
}

/* ===== 搜索资料浮层 ===== */
.search-mask {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, .38);
    display: none;
    z-index: 200;
}

.search-mask.show {
    display: block;
}

.search-box {
    background: #fff;
    margin: 12px;
    border-radius: 10px;
    overflow: hidden;
    max-width: 640px;
    margin-left: auto;
    margin-right: auto;
}

.search-bar {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px;
    border-bottom: 1px solid #f2e2e2;
}

.search-bar input {
    flex: 1;
    min-width: 0;
    border: 1px solid #e8d8d8;
    border-radius: 8px;
    padding: 9px 12px;
    font-size: 16px;
    outline: none;
    color: #333;
}

.search-bar input:focus {
    border-color: #e60012;
}

.search-cancel {
    border: 0;
    background: transparent;
    color: #c8000f;
    font-size: 15px;
    padding: 0 4px;
    cursor: pointer;
}

.search-list {
    max-height: 62vh;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

.search-item {
    display: block;
    width: 100%;
    text-align: left;
    border: 0;
    border-bottom: 1px solid #f8f0f0;
    background: #fff;
    padding: 12px 14px;
    font-size: 15px;
    color: #333;
    cursor: pointer;
}

.search-item:active {
    background: #fff5f5;
}

.search-empty {
    color: #999;
    text-align: center;
    padding: 24px 0;
    font-size: 14px;
}
/* ==================== 窄屏适配 ==================== */
/* 资料表格：压缩列宽，6~10 肖一行排下 */
@media (max-width: 420px) {
    .cat-table td { padding: 9px 6px; }
    .cat-table td.cr-range { width: 58px; font-size: 11px; }
    .cat-table td.cr-status { width: 78px; font-size: 10.5px; white-space: pre-line; }
    .cat-table td.cr-data { font-size: 16px; letter-spacing: 0; }
    .cat-table td.cr-data .pzod { min-width: 1.2em; margin-right: 1px; }
    .cat-table td.cr-data .pnum { margin-right: 4px; font-size: 14px; }
    .cat-table td.cr-data .hl { padding: 0 1px; }
}

/* 聚宝盆：九码一行排下 */
@media (max-width: 420px) {
    .treasure-row { gap: 5px; padding: 7px 8px; }
    .treasure-row .tr-label { font-size: 12px; }
    .treasure-row .tr-content { font-size: 13px; letter-spacing: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
    .treasure-row .tr-res { font-size: 11px; }
    .kj-next p { font-size: 14px; }
}

@media (max-width: 380px) {
    .treasure-row .tr-content { font-size: 12px; }
    .treasure-row .tr-label { font-size: 11px; }
}

/* 开奖球：参照 xgfc-tt，flex 均分保证一行 */
@media (max-width: 420px) {
    .kj-balls { gap: 0; flex-wrap: nowrap; padding: 8px 0 4px; }
    .kj-balls .ball { margin-right: 4px; }
    .kj-balls .ball:last-child { margin-right: 0; }
}

@media (max-width: 360px) {
    .kj-balls .ball { min-width: 0; margin-right: 3px; height: 52px; font-size: 20px; }
    .kj-balls .ball i { height: 15px; line-height: 15px; font-size: 11px; margin-top: 5px; }
    .kj-balls .kj-plus { font-size: 20px; }
}

/* ==================== 图片放大查看 ==================== */
.img-block .img-wrap img { cursor: zoom-in; }

body.viewer-open { overflow: hidden; }

.img-viewer {
    position: fixed;
    inset: 0;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    background: rgba(0, 0, 0, .88);
    opacity: 0;
    pointer-events: none;
    transition: opacity .18s ease;
}

.img-viewer.open {
    opacity: 1;
    pointer-events: auto;
}

.img-viewer img {
    max-width: 96vw;
    max-height: 90vh;
    width: auto;
    height: auto;
    border-radius: 6px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, .55);
    cursor: zoom-out;
}

.img-viewer .iv-close {
    position: absolute;
    top: 14px;
    right: 14px;
    width: 38px;
    height: 38px;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, .92);
    color: #333;
    font-size: 24px;
    line-height: 38px;
    text-align: center;
    cursor: pointer;
    box-shadow: 0 2px 10px rgba(0, 0, 0, .3);
}

/* ==================== iOS 输入框：字号 ≥16px，避免聚焦自动放大 ==================== */
@media (max-width: 768px) {
    input, select, textarea {
        font-size: 16px !important;
    }
}