.k7-library-page,.k7-library-slot{min-height:100vh;background:#f6f7f9;font-family:-apple-system,BlinkMacSystemFont,"PingFang SC","Microsoft YaHei",sans-serif;color:#222}
.k7-library{--library-tabbar-height:50px;--library-switch-height:.92rem;--library-header-height:44px;width:100%;max-width:480px;margin:0 auto}
.k7-library *{box-sizing:border-box}
.k7-library button{font-family:inherit;cursor:pointer;-webkit-tap-highlight-color:transparent}
.k7-library button:focus-visible{outline:2px solid #087d40;outline-offset:2px}
.k7-library [hidden]{display:none!important}
.k7-library-header{position:fixed;z-index:70;top:0;left:50%;transform:translateX(-50%);width:100%;max-width:480px;height:var(--library-header-height);display:flex;align-items:center;justify-content:center;background:#fff;border-bottom:1px solid #ebedf0}
.k7-library-header h1{margin:0;color:#111;font-size:20px;font-weight:700;line-height:24px}
.k7-library-main{position:fixed;top:var(--library-header-height);bottom:calc(var(--library-tabbar-height) + var(--library-switch-height) + env(safe-area-inset-bottom,0px));left:50%;transform:translateX(-50%);width:100%;max-width:480px;overflow-y:auto;overflow-x:hidden;overscroll-behavior-y:contain;-webkit-overflow-scrolling:touch;background:#f6f7f9;padding-bottom:12px}
.k7-library.is-empty-lottery .k7-library-main{background:#fff}
.k7-library-categories{position:sticky;z-index:3;top:0;padding:12px 10px 9px;background:#fff;border-bottom:1px solid #eceef0}
.k7-library-category-list{display:flex;flex-wrap:wrap;gap:8px 7px;max-height:80px;overflow:hidden}
.k7-library-category-list.is-expanded{max-height:none}
.k7-library-category{flex:0 0 auto;min-height:32px;border:1px solid #e5e7eb;border-radius:16px;background:#fff;padding:4px 11px;color:#555;font-size:14px;line-height:22px;white-space:nowrap}
.k7-library-category.is-active{border-color:#bb1730;background:#bb1730;color:#fff;font-weight:600}
.k7-library-category-toggle{display:block;border:0;background:none;padding:8px 1px 0;color:#777;font-size:14px;line-height:22px}
.k7-library-cards{padding:10px 8px 0}
.k7-library-card{margin:0 0 12px;border:1px solid #f0d3d5;border-radius:11px;background:#fff;overflow:visible}
.k7-library-card-title{margin:0;padding:11px 12px;background:linear-gradient(105deg,#c31522,#f51b35);color:#fff;font-size:18px;line-height:23px;font-weight:700;overflow-wrap:anywhere;border-radius:10px 10px 0 0}
.k7-library-card.is-advert{border-color:#e4e7e5}
.k7-library-advert-label{display:block;margin:3px 8px 0;color:#999;font-size:13px;line-height:16px;text-align:right}
.k7-library-card-content a{overflow-wrap:anywhere;text-decoration:underline}
.k7-library-periods{display:flex;gap:7px;overflow-x:auto;overflow-y:hidden;padding:7px 7px 6px;border-bottom:1px solid #f2e5e6;scrollbar-width:thin}
.k7-library-period{flex:0 0 auto;min-height:27px;padding:3px 8px;border:0;border-radius:5px;background:#ead2d1;color:#a72a24;font-size:15px;line-height:21px;font-weight:700;white-space:nowrap}
.k7-library-period.is-active{background:#aa251a;color:#fff}
/* Rich source documents retain their own table, font, color and alignment rules. */
.k7-library-card-content{max-height:none;overflow:visible;padding:8px;color:#222;font-size:16px;line-height:1.5;overflow-wrap:normal;word-break:normal;white-space:normal;container-type:inline-size;container-name:k7-material}
.k7-library-card.has-periods .k7-library-card-content{padding:0}
.k7-library-card-content p,.k7-library-card-content div{margin:0}
.k7-library-card-content table{display:table;width:100%;max-width:100%;border-collapse:collapse;table-layout:auto;white-space:normal}
.k7-library-card-content thead{display:table-header-group}
.k7-library-card-content tbody{display:table-row-group}
.k7-library-card-content tfoot{display:table-footer-group}
.k7-library-card-content tr{display:table-row}
.k7-library-card-content th,.k7-library-card-content td{display:table-cell;padding:0 4px;border:1px solid #e7e9ed;vertical-align:middle;overflow-wrap:break-word;word-break:normal;font-size:inherit;line-height:normal}
.k7-library-card-content th p,.k7-library-card-content td p{margin:0}
.k7-library-card-content figure.table{width:100%;margin:0}
.k7-library-card-content colgroup{display:table-column-group}
.k7-library-card-content col{display:table-column}
.k7-library-card-content hr{height:0;margin:6px 0;border:0;border-top:1px solid #e5e7eb}
.k7-library-card-content blockquote{margin:0;padding:0 12px;border-left:3px solid #eee}
.k7-library-card-content pre{margin:0;white-space:pre-wrap;overflow-wrap:break-word}
.k7-library-card-content code{font-family:monospace;white-space:pre-wrap}
.k7-library-card-content mark{background:#fff59d;color:inherit}
.k7-library-content-image{display:block;max-width:100%;height:auto;margin:0 auto}
.k7-library-feedback{text-align:center;padding:4px 14px;color:#888;font-size:16px;line-height:22px}
.k7-library-feedback p{margin:15px 0}
.k7-library-retry,.k7-library-more{border:1px solid #07c160;border-radius:6px;background:#fff;color:#079c50;font-size:16px;font-weight:600;min-height:36px;padding:7px 22px}
.k7-library-pagination{text-align:center;padding:5px 12px 12px}
.k7-library-more:disabled{border-color:#d9dfdc;color:#999;cursor:default}
.k7-library-switch{position:fixed;z-index:80;bottom:calc(var(--library-tabbar-height) + env(safe-area-inset-bottom,0px));left:50%;transform:translateX(-50%);width:100%;max-width:480px;height:var(--library-switch-height);display:flex;gap:5px;padding:.16rem;background:#f6f7f9}
.k7-library-type{display:flex;flex:1 1 0;min-width:0;align-items:center;justify-content:center;gap:.08rem;border:.02rem solid #07c160;border-radius:.08rem;background:#fff;color:#07c160;font-size:16px;line-height:1.4;white-space:nowrap;padding:0;font-weight:400}
.k7-library-type img{width:.44rem;height:.44rem;flex:0 0 .44rem;object-fit:contain}
.k7-library-type-macau.is-active{background:#07c160;color:#fff}
.k7-library-type-hongkong{border-color:#c10707;color:#c10707}
.k7-library-type-hongkong.is-active{background:#c10707;color:#fff}
@media(prefers-reduced-motion:reduce){.k7-library *{scroll-behavior:auto!important}}

/* Canonical source templates: period/body/outcome stay beside one another.
   Widths follow content, not a forced percentage split. The mb15 and mb21
   templates alone have the two-tier structure present on the source site. */
.k7-library-card-content .k7lib-card-notes{margin:0 0 8px;padding:7px 8px;border-bottom:1px solid #eee;background:#fafafa;white-space:normal;line-height:1.5}
.k7-library-card-content .k7lib-note{margin:0;white-space:normal}
.k7-library-card-content .k7lib-legend{display:flex;flex-wrap:wrap;align-items:center;gap:6px 12px;margin:0;padding:6px 0;font-size:14px;line-height:1.5}
.k7-library-card-content .k7lib-row{display:grid;grid-template-columns:var(--k7-source-period-width,max-content) minmax(max-content,1fr) var(--k7-result-width,70px);align-items:center;column-gap:4px;row-gap:4px;margin:0;padding:6px 8px;border-bottom:1px solid #e5e7eb;white-space:normal}
.k7-library-card-content .k7lib-turn{grid-column:1;grid-row:1;min-width:0;text-align:left;font-size:var(--k7-period-font,16px);font-weight:400;line-height:1.5;white-space:nowrap}
.k7-library-card-content .k7lib-picks{grid-column:2;min-width:0;font-size:var(--k7-picks-font,16px);font-weight:500;line-height:1.5;white-space:nowrap;overflow-wrap:normal;word-break:normal}
.k7-library-card-content .k7lib-picks p{margin:0}
.k7-library-card-content .k7lib-result{grid-column:3;grid-row:1;display:flex;align-items:center;justify-content:flex-end;gap:2px;min-width:0;text-align:right;font-size:var(--k7-result-font,12px);font-weight:400;line-height:1.4;white-space:nowrap}
.k7-library-card-content .k7lib-result p,.k7-library-card-content .k7lib-result div{display:inline;margin:0;line-height:inherit;white-space:inherit}
.k7-library-card-content .k7lib-status{display:inline;font-weight:700;line-height:1;white-space:nowrap}
.k7-library-card-content .k7lib-status-win{color:#d71920}
.k7-library-card-content .k7lib-status-loss,.k7-library-card-content .k7lib-status-pending{color:#666}
.k7-library-card-content .k7lib-chip{position:relative;display:inline-flex;align-items:center;justify-content:center;vertical-align:middle;min-width:0;padding:1px 4px;margin:0 2px;border-radius:4px;line-height:1.4;font-size:var(--k7-chip-font,16px);font-weight:500;white-space:nowrap}
.k7-library-card-content .k7lib-chip-red{background:#e12a2a;color:#fff}
.k7-library-card-content .k7lib-chip-green{background:#08a75b;color:#fff}
.k7-library-card-content .k7lib-chip-blue{background:#2477d6;color:#fff}
.k7-library-card-content .k7lib-chip-neutral{background:#eee;color:#222}
.k7-library-card-content .k7lib-chip-circle{width:var(--k7-chip-size,28px);height:var(--k7-chip-size,28px);min-height:0;padding:0;border-radius:50%;line-height:1;flex:0 0 auto}
.k7-library-card-content .k7lib-chip-hit::after{content:"";position:absolute;right:-3px;top:-5px;width:10px;height:10px;border-radius:50%;background:#f2084a;box-shadow:0 0 0 1px #fff}
.k7-library-card-content .k7lib-grid{display:flex;flex-wrap:wrap;align-items:center;gap:4px;margin:0;white-space:normal}
.k7-library-card-content .k7lib-grid-2,.k7-library-card-content .k7lib-grid-3,.k7-library-card-content .k7lib-grid-4{display:grid;gap:6px}
.k7-library-card-content .k7lib-grid-2{grid-template-columns:repeat(2,minmax(0,1fr))}
.k7-library-card-content .k7lib-grid-3{grid-template-columns:repeat(3,minmax(0,1fr))}
.k7-library-card-content .k7lib-grid-4{grid-template-columns:repeat(4,minmax(0,1fr))}
.k7-library-card-content .k7lib-legend.k7lib-grid{display:flex}
.k7-library-card-content .k7lib-table{table-layout:auto;white-space:normal}
.k7-library-card-content .k7lib-figure{margin:0;max-width:100%;text-align:center;white-space:normal}
.k7-library-card-content .k7lib-caption{margin:4px 0;color:#666;font-size:14px;line-height:1.5;text-align:center;white-space:normal}
.k7-library-card-content .k7-library-content-image.k7lib-icon{display:inline-block;width:12px;height:12px;max-width:12px;object-fit:contain;vertical-align:middle;margin:0 2px}
.k7-library-card-content .k7lib-document-image{display:block;max-width:100%;height:auto;margin:0 auto}

/* Template markers are derived from the sanitized source DOM, never its title. */
[data-source-template="mb06"]{--k7-chip-size:24px;--k7-chip-font:14px;--k7-period-font:14px}
[data-source-template="mb07"]{--k7-chip-size:28px;--k7-chip-font:16px}
[data-source-template="mb13"]{--k7-chip-size:28px;--k7-chip-font:16px;--k7-result-width:102px}
[data-source-template="mb17"]{--k7-period-font:16px;--k7-picks-font:14px;--k7-result-font:12px}
[data-source-template="mb01"]{--k7-chip-size:30px;--k7-chip-font:16px;--k7-period-font:12px;--k7-result-width:max-content}
[data-source-template="mb09"]{--k7-chip-font:16px}
[data-source-template="mb15"]{--k7-chip-size:28px;--k7-chip-font:16px}
[data-source-template="mb06"] .k7lib-picks,[data-source-template="mb07"] .k7lib-picks,[data-source-template="mb13"] .k7lib-picks,[data-source-template="mb01"] .k7lib-picks{display:flex;align-items:center;gap:4px;white-space:nowrap}
[data-source-template="mb06"] .k7lib-chip,[data-source-template="mb07"] .k7lib-chip,[data-source-template="mb13"] .k7lib-chip,[data-source-template="mb01"] .k7lib-chip{margin:0}
[data-source-template="mb17"] .k7lib-picks p,[data-source-template="mb17"] .k7lib-result span{white-space:nowrap}
[data-source-template="mb01"] .k7lib-turn{padding:2px 8px;border-radius:8px;line-height:1.3}
[data-source-template="mb01"] .k7lib-row{column-gap:8px;padding-top:8px;padding-bottom:8px}
[data-source-template="mb01"] .k7lib-picks:has(>.k7lib-chip:nth-child(7)){--k7-chip-size:27px;--k7-chip-font:14px}
[data-source-template="mb01"] .k7lib-picks:has(>.k7lib-chip:nth-child(8)){--k7-chip-size:24px;--k7-chip-font:14px}
[data-source-template="mb01"] .k7lib-picks:has(>.k7lib-chip:nth-child(9)){--k7-chip-size:20px;--k7-chip-font:12px}
[data-source-template="mb01"] .k7lib-picks:has(>.k7lib-chip:nth-child(10)){--k7-chip-size:18px;--k7-chip-font:12px}
[data-source-template="mb01"] .k7lib-picks:has(>.k7lib-chip:nth-child(11)){--k7-chip-size:16px;--k7-chip-font:12px}
[data-source-template="mb01"] .k7lib-picks:has(>.k7lib-chip:nth-child(12)){--k7-chip-size:14px;--k7-chip-font:10px}

/* MB15: a source mini-card with one summary row and one 解特肖 row. */
.k7-library-card-content .k7lib-row-stack:has(>.k7lib-picks+.k7lib-picks),[data-source-template="mb15"] .k7lib-row-stack{grid-template-columns:max-content minmax(0,1fr) 70px;margin:8px 0;padding:12px 8px;border:1px solid #e2f2ec;border-radius:8px;background:#fff}
.k7-library-card-content .k7lib-row-stack:has(>.k7lib-picks+.k7lib-picks)>.k7lib-turn,[data-source-template="mb15"] .k7lib-turn{color:#222725!important;background:#d0f3e8!important;border-radius:6px;padding:0 8px}
.k7-library-card-content .k7lib-row-stack:has(>.k7lib-picks+.k7lib-picks)>.k7lib-picks:nth-of-type(2),[data-source-template="mb15"] .k7lib-row-stack>.k7lib-picks:nth-of-type(2){grid-column:1/-1;grid-row:2;display:flex;align-items:center;flex-wrap:nowrap;gap:4px;margin-top:4px;font-weight:600}
.k7-library-card-content .k7lib-row-stack:has(>.k7lib-picks+.k7lib-picks)>.k7lib-picks:nth-of-type(2)>.k7lib-chip:first-child{font-size:12px;padding:2px 8px;margin-right:8px;font-weight:600}
.k7-library-card-content .k7lib-row-stack:has(>.k7lib-picks+.k7lib-picks)>.k7lib-picks:nth-of-type(2)>.k7lib-chip{margin:0}

/* MB21: source period/result header, then its full rich body. */
.k7-library-card-content .k7lib-row-stack:not(:has(>.k7lib-picks+.k7lib-picks)),[data-source-template="mb21"] .k7lib-row-stack{grid-template-columns:minmax(0,1fr) 70px;margin:8px 0;padding:8px;border:1px solid #edf2e9;border-radius:8px;background:#fff}
.k7-library-card-content .k7lib-row-stack:not(:has(>.k7lib-picks+.k7lib-picks))>.k7lib-turn,[data-source-template="mb21"] .k7lib-turn{justify-self:start;border-radius:14px;padding:0 12px}
.k7-library-card-content .k7lib-row-stack:not(:has(>.k7lib-picks+.k7lib-picks))>.k7lib-result,[data-source-template="mb21"] .k7lib-result{grid-column:2;grid-row:1}
.k7-library-card-content .k7lib-row-stack:not(:has(>.k7lib-picks+.k7lib-picks))>.k7lib-picks,[data-source-template="mb21"] .k7lib-row-stack>.k7lib-picks{grid-column:1/-1;grid-row:2;margin-top:4px;line-height:1.5;text-align:left}

/* Component-size queries keep desktop admin previews identical to mobile. */
@container k7-material (max-width:342px){
 [data-source-template="mb06"] .k7lib-row{--k7-chip-size:20px;--k7-chip-font:12px;--k7-period-font:12px}
 [data-source-template="mb17"] .k7lib-row{--k7-period-font:12px;--k7-picks-font:11px;--k7-result-font:10px}
 [data-source-template="mb01"] .k7lib-row{--k7-chip-size:26px;--k7-chip-font:14px}
 [data-source-template="mb01"] .k7lib-picks{gap:3px}
 [data-source-template="mb01"] .k7lib-picks:has(>.k7lib-chip:nth-child(6)){--k7-chip-size:25px}
 [data-source-template="mb01"] .k7lib-picks:has(>.k7lib-chip:nth-child(7)){--k7-chip-size:22px;--k7-chip-font:13px}
 [data-source-template="mb01"] .k7lib-picks:has(>.k7lib-chip:nth-child(8)){--k7-chip-size:18px;--k7-chip-font:13px}
 [data-source-template="mb01"] .k7lib-picks:has(>.k7lib-chip:nth-child(9)){--k7-chip-size:16px;--k7-chip-font:11px}
 [data-source-template="mb01"] .k7lib-picks:has(>.k7lib-chip:nth-child(10)){--k7-chip-size:15px;--k7-chip-font:10px}
 [data-source-template="mb01"] .k7lib-picks:has(>.k7lib-chip:nth-child(11)){--k7-chip-size:13px;--k7-chip-font:9px}
 [data-source-template="mb01"] .k7lib-picks:has(>.k7lib-chip:nth-child(12)){--k7-chip-size:12px;--k7-chip-font:9px}
}
@container k7-material (max-width:318px){
 [data-source-template="mb15"] .k7lib-row{--k7-chip-size:20px;--k7-chip-font:11px}
 .k7-library-card-content .k7lib-row-stack:has(>.k7lib-picks+.k7lib-picks)>.k7lib-picks:nth-of-type(2){gap:3px}
}

/* Keep source three-column period/result labels on their original line.
   Content can exceed the viewport; the shared renderer then scales the whole
   table, retaining every column rather than breaking labels into two rows. */
.k7-library-card-content table.k7-library-source-three-column{table-layout:auto}
.k7-library-card-content table.k7-library-source-three-column tr>:first-child,
.k7-library-card-content table.k7-library-source-three-column tr>:last-child{white-space:nowrap;overflow-wrap:normal;word-break:normal}
.k7-library-card-content table.k7-library-source-three-column tr>:first-child *,
.k7-library-card-content table.k7-library-source-three-column tr>:last-child *{white-space:nowrap!important;overflow-wrap:normal;word-break:normal}

/* Related records share column tracks and a scale; digits never shift a row. */
.k7-library-card-content{font-variant-numeric:tabular-nums;font-feature-settings:"tnum" 1}
.k7-library-card-content .k7-source-period-row{display:grid;grid-template-columns:var(--k7-source-line-width,max-content) max-content;align-items:baseline;column-gap:4px;box-sizing:border-box;margin:0;padding:7px 0;border-bottom:1px solid #e5e7eb;white-space:nowrap;overflow-wrap:normal;word-break:normal}
.k7-library-card-content .k7-source-line-turn{display:block;white-space:nowrap}
.k7-library-card-content .k7-source-line-body{display:block;white-space:nowrap}
.k7-library-card-content .k7-source-period-row:last-child{border-bottom-color:#e5e7eb}

.k7-library-card-content .k7lib-row-wide-result{--k7-result-width:100px}

.k7-library-card-content .k7lib-generated-poster{width:440px;max-width:none;box-sizing:border-box}
.k7-library-card-content .k7lib-generated-poster p{white-space:nowrap}

/* Prevent iOS text inflation after fitting source tables to the viewport. */
.k7-library-card-content{-webkit-text-size-adjust:100%;text-size-adjust:100%;box-sizing:border-box;min-width:0;width:100%}
.k7-source-fit-shell{display:block;position:relative;min-width:0;max-width:100%;padding:0;border:0;overflow:visible}
