:root {
  --red: #f1434b;
  --deep-red: #e54040;
  --soft-red: #ff8a9c;
  --text: #535353;
  --line: #e3e3e3;
  --cream: #fcf1cf;
  --bottom-height: 50px;
  font-family: -apple-system, BlinkMacSystemFont, "Helvetica Neue", "Microsoft YaHei", Arial, sans-serif;
  color: var(--text);
  background: #f4f4f4;
}

* { box-sizing: border-box; }
html, body { margin: 0; width: 100%; min-height: 100%; background: #f4f4f4; }
body { min-width: 320px; -webkit-font-smoothing: antialiased; }
button { font: inherit; color: inherit; border: 0; background: none; padding: 0; -webkit-tap-highlight-color: transparent; }
button:active { opacity: .68; }
.app-shell { width: 100%; max-width: 540px; min-height: 100vh; margin: 0 auto; padding-bottom: calc(var(--bottom-height) + env(safe-area-inset-bottom)); background: #fff; overflow: hidden; }
.site-header { position: sticky; top: 0; z-index: 10; background: #fff; }
.brand-row { height: 50px; display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 0 14px; }
.brand-logo { display: block; flex: 0 1 132px; width: 132px; max-width: 42%; height: auto; object-fit: contain; }
.source-badges { flex: 0 1 auto; display: flex; align-items: center; justify-content: flex-end; gap: 3px; min-width: 0; color: #8b8b8b; }
.source-badges img { display: block; width: min(88px, 24vw); height: 21px; object-fit: contain; opacity: .9; }
.lottery-nav { height: 49px; display: flex; border-bottom: 1px solid #eee; }
.lottery-nav button { flex: 1; height: 49px; position: relative; font-size: 18px; font-weight: 700; color: #535353; }
.lottery-nav button.active { color: var(--deep-red); }
.lottery-nav button.active::after { content: ""; position: absolute; right: 0; bottom: -1px; left: 0; height: 3px; background: var(--red); }
.main-content { min-height: calc(100vh - 99px - var(--bottom-height)); background: #fff; }
.view { display: none; }
.view.active-view { display: block; }
.draw-panel { position: relative; height: 125px; padding: 16px; overflow: hidden; background: #fff; }
.draw-title { margin: 0 0 6px; font-size: 19px; line-height: 22px; color: #535353; }
.ball-row { display: inline-flex; align-items: center; gap: 9px; vertical-align: middle; }
.ball { width: 36px; height: 36px; display: inline-flex; align-items: center; justify-content: center; border-radius: 50%; background: var(--red); color: #fff; font-size: 20px; font-weight: 700; }
.draw-meta { display: inline-block; margin-left: 10px; vertical-align: middle; color: #17a545; font-size: 15px; line-height: 36px; }
.countdown-row { position: absolute; right: 16px; bottom: 14px; left: 16px; display: flex; align-items: center; gap: 8px; height: 19px; font-size: 15px; white-space: nowrap; }
.countdown-label { color: #535353; }
.progress-track { flex: 1; height: 5px; overflow: hidden; border-radius: 3px; background: #d5d5d5; }
.progress-track i { display: block; width: 5%; height: 100%; border-radius: 3px; background: #ec2e35; transition: width .35s; }
.countdown-row time { color: #f52d2d; }
.data-state { position: absolute; z-index: 11; top: 204px; right: 8px; left: auto; display: none; max-width: calc(100% - 16px); margin: 0; padding: 3px 7px; border: 1px solid #f2dfc5; border-radius: 3px; background: rgba(255, 248, 239, .96); color: #9a6b32; box-shadow: 0 2px 8px rgba(0, 0, 0, .08); font-size: 11px; line-height: 14px; text-align: center; }
.data-state.loading, .data-state.success, .data-state.fallback { display: block; }
.data-state.success { border-color: #d9efdd; background: rgba(244, 251, 245, .96); color: #43834f; }
.data-state.success::before { content: "✓"; margin-right: 5px; font-weight: 700; }
.data-state.loading::before { content: ""; display: inline-block; width: 9px; height: 9px; margin: 0 6px 0 1px; border: 1px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: data-spin .7s linear infinite; vertical-align: -1px; }
.data-state.fallback::before { content: "i"; display: inline-flex; width: 12px; height: 12px; margin-right: 6px; border: 1px solid currentColor; border-radius: 50%; align-items: center; justify-content: center; font-size: 9px; font-weight: 700; vertical-align: -1px; }
.data-retry { margin-left: 8px; color: inherit; font-size: 12px; font-weight: 700; text-decoration: underline; cursor: pointer; }
@keyframes data-spin { to { transform: rotate(360deg); } }
.divider { height: 8px; border-top: 1px solid #efefef; border-bottom: 1px solid #efefef; background: #f1f1f1; }
.divider.thin { height: 1px; border: 0; background: #dedede; }
.trend-tabs-wrap { background: #fff; }
.trend-tabs { height: 48px; display: flex; overflow-x: auto; scrollbar-width: none; scroll-snap-type: x proximity; }
.trend-tabs::-webkit-scrollbar, .trend-scroll::-webkit-scrollbar { display: none; }
.trend-tabs button { height: 48px; min-width: 76px; flex: 0 0 auto; padding: 0 12px; position: relative; color: #535353; font-size: 14px; white-space: nowrap; scroll-snap-align: start; }
.trend-tabs button.active { color: #ed1a1a; }
.trend-tabs button.active::after { content: ""; position: absolute; right: 13px; bottom: 0; left: 13px; height: 2px; background: var(--red); }
.trend-content { position: relative; }
.trend-scroll { position: relative; overflow-x: auto; overflow-y: hidden; border-top: 0; border-bottom: 1px solid #ddd; background: linear-gradient(90deg, transparent 86%, rgba(0, 0, 0, .07)); touch-action: pan-x; overscroll-behavior-x: contain; }
.table-canvas { min-width: 490px; position: relative; }
.trend-lines { position: absolute; z-index: 1; inset: 0 auto auto 0; width: 100%; height: 100%; overflow: visible; pointer-events: none; }
.trend-lines line { stroke: #f5aab7; stroke-width: 1; stroke-linecap: round; opacity: .78; }
.trend-table { position: relative; z-index: 2; width: max-content; min-width: 490px; border-collapse: collapse; table-layout: fixed; color: #171717; font-size: 13px; background: transparent; }
.trend-table th, .trend-table td { height: 26px; padding: 0; border-right: 1px solid #dbdede; border-bottom: 1px solid #dbdede; text-align: center; font-weight: 400; }
.trend-table thead th { height: 26px; background: var(--cream); font-size: 13px; font-weight: 700; white-space: nowrap; }
.trend-table .head-block, .trend-table .left-column { position: sticky; z-index: 4; background: var(--cream); }
.trend-table tbody .left-column { background: #fff; }
.trend-table .issue-column { left: 0; }
.trend-table .week-column { left: 80px; }
.trend-table .result-column { left: 120px; }
.trend-table .sum-column { left: 160px; border-right: 2px solid #c8c8c8; }
.trend-table .summary-label { position: sticky; left: 0; z-index: 5; background: #fbfbfb; }
.trend-table .num { color: #fd91a1; font-size: 13px; }
.trend-table .highlight { position: relative; z-index: 3; display: inline-flex; align-items: center; justify-content: center; min-width: 23px; height: 23px; padding: 0 2px; border-radius: 50%; background: var(--red); color: #fff; font-size: 13px; font-weight: 700; }
.trend-table .trend-hit { position: relative; }
.trend-table .trend-hit::before { content: none; }
.trend-table .gold { display: inline-block; min-width: 28px; padding: 3px 4px; background: #d9a13b; color: #fff; font-weight: 700; }
.trend-table .summary-cell { background: #fbfbfb; color: #656565; font-size: 12px; }
.range-footer { position: fixed; z-index: 19; right: auto; bottom: calc(var(--bottom-height) + env(safe-area-inset-bottom)); left: 50%; width: min(100%, 540px); transform: translateX(-50%); background: #fff; border-top: 1px solid #eee; border-bottom: 1px solid #ddd; box-shadow: 0 1px 4px rgba(0, 0, 0, .08); }
.range-tabs { height: 41px; display: flex; }
.range-tabs button, .period-controls button { flex: 1; border-right: 1px solid #e8e8e8; color: #666; font-size: 15px; }
.range-tabs button:last-child, .period-controls button:last-child { border-right: 0; }
.range-tabs button.active, .period-controls button.active { background: #ebe8e8; color: #333; }
.range-notice { position: absolute; right: 8px; bottom: calc(100% + 2px); min-height: 15px; margin: 0; padding: 1px 6px; border: 1px solid #f2dfc5; border-radius: 3px; background: rgba(255, 248, 239, .96); color: #9a6b32; font-size: 11px; line-height: 14px; }
.range-notice:empty { display: none; }
.bottom-nav { position: fixed; z-index: 20; bottom: 0; left: 50%; display: flex; width: min(100%, 540px); height: calc(var(--bottom-height) + env(safe-area-inset-bottom)); padding-bottom: env(safe-area-inset-bottom); transform: translateX(-50%); border-top: 1px solid #ededed; background: #f1f1f1; }
.bottom-nav button { flex: 1; height: var(--bottom-height); display: flex; align-items: center; justify-content: center; flex-direction: column; color: #666; font-size: 13px; line-height: 16px; }
.nav-icon { width: 31px; height: 27px; display: inline-flex; align-items: center; justify-content: center; margin-bottom: -1px; color: currentColor; }
.nav-icon svg { display: block; width: 21px; height: 21px; fill: none; stroke: currentColor; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; }
.bottom-nav button.active { color: var(--red); }
.simple-view { min-height: calc(100vh - 149px); padding: 13px 12px calc(22px + var(--bottom-height) + env(safe-area-inset-bottom)); background: #f4f4f4; }
.page-heading { margin-bottom: 12px; padding: 17px 16px; border-radius: 2px; background: #fff; }
.page-heading h1 { margin: 0 0 7px; color: #333; font-size: 21px; font-weight: 700; }
.page-heading p { margin: 0; color: #999; font-size: 14px; line-height: 1.5; }
.period-controls { height: 38px; display: flex; margin-bottom: 12px; background: #fff; }
.record-list, .info-list { background: #fff; }
.record-list article, .info-list article { display: flex; align-items: center; justify-content: space-between; min-height: 62px; padding: 14px 15px; border-bottom: 1px solid #eee; }
.record-list article:last-child, .info-list article:last-child { border: 0; }
.record-main { min-width: 0; padding-right: 10px; }
.record-main strong { display: block; margin-bottom: 5px; color: #333; font-size: 15px; }
.record-main small, .info-list p { display: block; margin: 0; color: #999; font-size: 13px; line-height: 1.55; }
.mini-balls { flex: 0 0 auto; display: flex; gap: 5px; }
.mini-balls b { display: inline-flex; align-items: center; justify-content: center; width: 25px; height: 25px; border-radius: 50%; background: var(--red); color: #fff; font-size: 13px; }
.info-list article { align-items: flex-start; }
.info-list h3 { margin: 0 0 5px; color: #444; font-size: 16px; }
.info-list a { color: #db4047; text-decoration: none; overflow-wrap: anywhere; }
.empty-state { padding: 34px 20px; color: #888; text-align: center; background: #fff; }
.empty-state strong { display: block; color: #555; font-size: 16px; font-weight: 500; }
.empty-state p { margin: 8px 0 0; color: #aaa; font-size: 13px; }
@media (max-width: 390px) { .simple-view { padding-right: 10px; padding-left: 10px; } .record-list article { padding-right: 12px; padding-left: 12px; } .mini-balls { gap: 3px; } .mini-balls b { width: 23px; height: 23px; } .record-main small { font-size: 12px; } }
@media (max-width: 370px) { .brand-row { padding: 0 12px; } .brand-logo { width: 125px; } .source-badges { gap: 2px; } .source-badges img { width: 82px; } .lottery-nav button { font-size: 16px; } }

/* Local-only tools and column management. */
.simple-view { overflow-x: hidden; }
.channel-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; margin-bottom: 10px; padding: 17px 16px; background: #fff; }
.channel-heading h1 { margin: 0 0 7px; color: #333; font-size: 21px; line-height: 1.25; }
.channel-heading p { margin: 0; color: #999; font-size: 13px; line-height: 1.5; }
.compact-action { flex: 0 0 auto; padding: 8px 9px; font-size: 12px; }
.secondary-action, .primary-action { min-height: 36px; padding: 8px 13px; border-radius: 3px; font-size: 14px; cursor: pointer; }
.primary-action { background: var(--red); color: #fff; }
.secondary-action { border: 1px solid #dfdfdf; background: #fff; color: #5c5c5c; }
.tool-card, .editor-panel { margin-bottom: 12px; padding: 15px; background: #fff; }
.tool-card label, .editor-panel label { display: block; margin-bottom: 12px; color: #555; font-size: 14px; }
.tool-card input, .tool-card select, .editor-panel input, .editor-panel textarea, .editor-panel select { width: 100%; min-height: 36px; margin-top: 6px; padding: 7px 9px; border: 1px solid #dedede; border-radius: 3px; background: #fff; color: #444; font: inherit; }
.editor-panel textarea { min-height: 84px; resize: vertical; line-height: 1.5; }
.digit-group { padding: 11px 0; border-top: 1px solid #eee; }
.digit-group-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 9px; color: #444; font-size: 14px; }
.text-action { margin-left: 12px; color: #db4047; font-size: 13px; }
.digit-options { display: grid; grid-template-columns: repeat(10, minmax(0, 1fr)); gap: 5px; }
.digit-option { height: 31px; border: 1px solid #ddd; border-radius: 3px; background: #fff; color: #666; font-size: 14px; }
.digit-option.selected { border-color: var(--red); background: #fff2f3; color: var(--deep-red); font-weight: 700; }
.filter-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 10px; margin-top: 8px; }
.filter-wide { grid-column: 1 / -1; }
.form-actions { display: flex; gap: 9px; margin-top: 8px; }
.tool-disclaimer, .local-warning, .community-guidance, .inline-notice { margin: 12px 0 0; padding: 9px 10px; border-left: 3px solid #efb04d; background: #fff9ed; color: #8b6b36; font-size: 12px; line-height: 1.55; }
.local-warning { border-left-color: var(--red); background: #fff5f5; color: #9a5555; }
.community-guidance { margin: 0 0 10px; }
.inline-notice { border-left-color: #65a971; background: #f4fbf5; color: #43834f; }
.result-summary { margin: 0 0 10px; padding: 11px 13px; background: #fff; color: #666; font-size: 14px; }
.result-summary strong { color: var(--deep-red); }
.combination-list { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; padding: 13px; background: #fff; }
.combination-list button { min-height: 34px; border: 1px solid #f0c7ca; border-radius: 3px; background: #fff8f8; color: #d9444b; font-size: 15px; letter-spacing: 1px; }
.category-filter { display: flex; gap: 8px; overflow-x: auto; margin: 0 0 10px; padding: 2px 0; scrollbar-width: none; }
.category-filter::-webkit-scrollbar { display: none; }
.category-filter button { flex: 0 0 auto; padding: 7px 11px; border: 1px solid #ddd; border-radius: 16px; background: #fff; color: #666; font-size: 13px; }
.category-filter button.active { border-color: var(--red); background: #fff4f5; color: var(--deep-red); }
.article-list { background: transparent; }
.article-card { margin-bottom: 10px; background: #fff; }
.article-open { display: block; width: 100%; padding: 15px; text-align: left; }
.article-meta { display: flex; align-items: center; gap: 7px; min-height: 18px; color: #999; font-size: 12px; }
.article-meta span { color: #bd666c; }
.article-meta b, .article-meta i { padding: 1px 5px; border-radius: 2px; background: #fff0f0; color: #db4047; font-style: normal; font-weight: 400; }
.article-meta i { background: #f4f4f4; color: #777; }
.article-card h2 { margin: 7px 0; overflow: hidden; color: #333; font-size: 17px; line-height: 1.35; text-overflow: ellipsis; white-space: nowrap; }
.article-card p { display: -webkit-box; overflow: hidden; margin: 0 0 8px; color: #888; font-size: 13px; line-height: 1.55; -webkit-box-orient: vertical; -webkit-line-clamp: 2; }
.article-card time { color: #aaa; font-size: 12px; }
.article-admin { display: flex; flex-wrap: wrap; gap: 7px; padding: 0 15px 13px; }
.article-admin button { padding: 5px 8px; border: 1px solid #ddd; border-radius: 3px; color: #666; font-size: 12px; }
.article-admin .danger-action { border-color: #f0b9bd; color: #ce3e46; }
.editor-panel h2 { margin: 0 0 13px; color: #444; font-size: 17px; }
.category-manage { margin: 14px 0; padding-top: 12px; border-top: 1px solid #eee; }
.category-manage strong { display: block; margin-bottom: 8px; color: #555; font-size: 14px; }
.category-manage > div { display: flex; gap: 8px; align-items: flex-end; }
.category-manage > div input { margin-top: 0; }
.category-manage > div button { flex: 0 0 auto; }
.back-link { margin: 0 0 8px; color: #db4047; font-size: 13px; }
.article-detail { padding: 18px 16px; background: #fff; color: #555; font-size: 15px; line-height: 1.8; overflow-wrap: anywhere; }
.article-summary { margin: 0 0 16px; padding-bottom: 13px; border-bottom: 1px solid #eee; color: #777; }
.article-body { white-space: normal; }
.official-note { margin: 20px 0 0; padding: 10px; border-radius: 2px; background: #fff8ea; color: #927448; font-size: 13px; line-height: 1.55; }
@media (max-width: 390px) { .bottom-nav button { font-size: 11px; } .nav-icon { width: 27px; } .channel-heading { padding: 15px 13px; } .filter-grid { gap: 0 8px; } .combination-list { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
