/* Mobile presentation. Keep every rule inside this boundary even when imported elsewhere. */
@media (max-width: 768px) {
    :root { --mobile-space: 12px; --mobile-radius: 14px; }
    html { scrollbar-gutter: auto; scroll-padding-top: 72px; }
    body { background: #f3f6fa; font-size: 14px; line-height: 1.6; }
    [hidden] { display: none !important; }
    button, a, input, select, textarea { -webkit-tap-highlight-color: transparent; }
    button, a { touch-action: manipulation; }
    input, select, textarea { max-width: 100%; box-sizing: border-box; }
    button:focus-visible, a:focus-visible { outline: 2px solid #3984e9; outline-offset: 3px; }
    #desktopHeader, #fixed-left-nav, #siteAssist, .prediction-contact { display: none !important; }
    body:has(#main-content) .prediction-contact { display: none !important; }
    .navbar, .navbar.reference-sticky { position: fixed; inset: 0 0 auto; height: 56px; min-height: 56px; box-shadow: 0 2px 12px #245aa51a; }
    .navbar .navbar-inner { width: 100%; height: 56px; min-height: 56px; padding: 0 16px; box-sizing: border-box; }
    .navbar .navbar-brand img { height: 36px; max-width: 180px; object-fit: contain; }
    .navbar-toggle { width: 44px; height: 44px; align-items: center; justify-content: center; }
    .main-container, #main-content.main-container { width: 100%; max-width: none; min-width: 0; margin: 0; padding: 68px 12px 24px; box-sizing: border-box; }
    body:not(.reference-embedded) #main-content.main-container { left: 0; margin: 0; padding: 68px 12px 24px; }
    body:has(.simplicity-layout) #main-content { padding-top: 68px; }
    body.reference-embedded #main-content { padding: 0; margin: 0; }
    .main-layout { gap: 16px; }
    .main-layout > .main-content, .main-layout > .sidebar { width: 100%; min-width: 0; max-width: 100%; flex: none; }
    .card, .sidebar-card { border-radius: var(--mobile-radius); box-shadow: 0 2px 12px #1f395306; }
    .mobile-menu { width: min(320px, 88vw); right: 0; transform: translateX(105%); visibility: hidden; transition: transform .2s, visibility .2s; padding: 0 12px 24px; border-radius: 18px 0 0 18px; }
    .mobile-menu.active { transform: translateX(0); visibility: visible; }
    .mobile-menu-header { margin: 0 -12px 8px; height: 64px; }
    .mobile-menu > a { display: flex; align-items: center; min-height: 48px; padding: 10px 16px; border-radius: 9px; font-size: 15px; box-sizing: border-box; }
    .mobile-menu > a.active { background: #edf5ff; color: #347ee0; }
    .mobile-menu-close { width: 44px; height: 44px; }
    .reference-footer { margin-top: 8px; padding: 24px 16px; }
    .reference-footer-inner { width: 100%; min-width: 0; gap: 20px; }
    .reference-footer-nav { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); width: 100%; gap: 12px; }
    .reference-footer-nav dl { min-width: 0; margin: 0; flex: none; }
    .reference-footer-nav a { display: block; padding: 5px 0; font-size: 12px; }
    .reference-footer-copy { max-width: 100%; font-size: 11px; line-height: 1.8; }

    /* Home: identity, numbers, results and actions each occupy their own row. */
    .reference-home { gap: 16px; }
    .reference-home > .main-content, .reference-home > .sidebar { width: 100%; flex: none; min-width: 0; }
    .reference-home .home-hero { padding: 8px; border-radius: 14px; margin-bottom: 12px; }
    .reference-home .home-controls { height: auto; min-height: 48px; overflow-x: auto; justify-content: flex-start; padding: 0 4px; scrollbar-width: none; }
    .reference-home .home-category { flex: 0 0 auto; min-height: 48px; height: auto; padding: 0 14px; font-size: 14px; }
    .reference-home #homeLotteryGrid { padding: 12px; gap: 12px; }
    .reference-home #homeLotteryGrid .lottery-card { width: 100%; max-width: none; height: auto; min-height: 0; margin: 0; padding: 14px 12px 0; border-radius: 12px; overflow: visible; }
    .reference-home #homeLotteryGrid .home-card-top { display: grid; grid-template-columns: 44px minmax(0, 1fr); gap: 12px; align-items: center; height: auto; }
    .reference-home #homeLotteryGrid .lottery-card-logo-wrap { display: block; position: static; grid-column: 1; grid-row: 1; width: 44px; height: 44px; }
    .reference-home #homeLotteryGrid .lottery-card-logo, .reference-home #homeLotteryGrid .lottery-card-logo-fallback { width: 44px; height: 44px; font-size: 16px; }
    .reference-home #homeLotteryGrid .lottery-card-info { grid-column: 2; grid-row: 1; width: 100% !important; margin: 0; padding: 0; min-width: 0; text-align: left; }
    .reference-home .reference-card-title { min-height: 0; flex-wrap: wrap; gap: 0 8px; }
    .reference-home .reference-card-title h3 { flex-basis: 100%; max-width: 100%; font-size: 16px; font-weight: 600; line-height: 24px; }
    .reference-home .reference-card-title .period { font-size: 12px; line-height: 22px; overflow-wrap: anywhere; }
    .reference-home .reference-card-title .row-progress { font-size: 11px; line-height: 20px; color: #8993a3; }
    .reference-home #homeLotteryGrid .lottery-card-countdown-line { position: static; max-width: 100%; display: flex; flex-direction: row; flex-wrap: wrap; justify-content: flex-start; align-items: center; gap: 4px; margin-top: 4px; }
    .reference-home #homeLotteryGrid .lottery-card-countdown-line .countdown-value { font-size: 18px; line-height: 24px; }
    .reference-home #homeLotteryGrid .lottery-card-numbers { grid-column: 1 / -1; width: 100%; min-width: 0; margin: 4px 0 0; min-height: 36px; justify-content: center; }
    .reference-home #homeLotteryGrid .ball-row { justify-content: center; flex-wrap: wrap; gap: 5px; }
    .reference-home #homeLotteryGrid .lottery-card-numbers .ball { width: 28px; height: 28px; min-width: 28px; font-size: 13px; }
    .reference-home #homeLotteryGrid .lottery-card[data-category=pk10] .ball-row { display: grid; grid-template-columns: repeat(10, minmax(0, 1fr)); width: 100%; max-width: 340px; gap: 3px; }
    .reference-home #homeLotteryGrid .lottery-card[data-category=pk10] .ball { width: 100%; min-width: 0; height: 27px; font-size: 12px; }
    .reference-home #homeLotteryGrid .lottery-card[data-category=lhc] .ball-row { flex-wrap: nowrap; gap: 4px; }
    .reference-home #homeLotteryGrid .ball-wrapper { flex: none; }
    .reference-home #homeLotteryGrid .ball-plus { width: 12px; padding: 0; font-size: 15px; }
    .reference-home #homeLotteryGrid .zodiac { font-size: 11px; }
    .reference-home .home-result-wrap { position: static; width: 100%; margin: 12px 0 0; overflow-x: auto; }
    .reference-home .home-result-table { width: 100%; table-layout: fixed; font-size: 12px; }
    .reference-home .home-result-table th, .reference-home .home-result-table td { padding: 6px 2px; font-size: 11px; white-space: normal; }
    .reference-home #homeLotteryGrid .lottery-card-links { position: static; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0; height: auto; margin: 10px -12px 0; padding: 4px 6px; border-top: 1px solid #edf1f6; }
    .reference-home #homeLotteryGrid .lottery-card-links > a, .reference-home #homeLotteryGrid .lottery-card-links > button { min-width: 0; min-height: 40px; display: flex; align-items: center; justify-content: center; gap: 3px; padding: 4px 0; font-size: 12px; white-space: normal; }
    .reference-home .home-new-badge { display: none; }
    .reference-home .home-more-panel { max-width: calc(100vw - 48px); right: 0; left: auto; }
    .reference-home > .sidebar { display: flex; gap: 12px; }

    /* Shared latest result card, including analysis pages. */
    #detailLatest .detail-top, .family-summary-host .detail-top { height: auto; min-height: 0; display: flex; flex-direction: column; padding: 18px 12px; gap: 14px; }
    #detailLatest .detail-col-logo, .family-summary-host .detail-col-logo { display: none !important; }
    #detailLatest .detail-col-main, .family-summary-host .detail-col-main { width: 100%; max-width: 100%; min-width: 0; flex: none; margin: 0; }
    #detailLatest .detail-row-info, .family-summary-host .detail-row-info { height: auto; min-height: 0; display: flex; justify-content: center; flex-wrap: wrap; gap: 2px 8px; margin: 0 0 14px; white-space: normal; text-align: center; }
    #detailLatest .detail-name, .family-summary-host .detail-name { flex-basis: 100%; font-size: 18px; font-weight: 600; line-height: 28px; }
    #detailLatest .detail-period, .family-summary-host .detail-period { font-size: 12px; line-height: 22px; }
    #detailLatest .detail-interval, #detailLatest .detail-schedule-text, .family-summary-host .detail-interval, .family-summary-host .detail-schedule-text { font-size: 12px; line-height: 22px; white-space: normal; }
    #detailLatest .detail-row-numbers, .family-summary-host .detail-row-numbers { width: 100%; height: auto; margin: 0; }
    #detailLatest .ball-row, .family-summary-host .ball-row { justify-content: center; flex-wrap: wrap; gap: 5px; }
    #detailLatest .detail-top[data-family=pk10] .ball-row, .family-summary-host .detail-top[data-family=pk10] .ball-row { display: grid; grid-template-columns: repeat(5, 32px); justify-content: center; gap: 8px; }
    #detailLatest .pc28-summary-equation, .family-summary-host .pc28-summary-equation { display: flex; width: 100%; justify-content: center; align-items: center; gap: 10px; }
    #detailLatest .five-summary-balls, .family-summary-host .five-summary-balls { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); justify-items: center; width: 100%; max-width: 360px; margin: auto; transform: none; padding: 0; gap: 8px; box-sizing: border-box; }
    #detailLatest .detail-top[data-family=ssc] .five-summary-balls { width: 100%; max-width: 100%; margin: 0; padding: 0; transform: none; }
    #detailLatest .detail-col-right, .family-summary-host .detail-col-right { flex: none; width: 100%; min-width: 0; height: auto; margin: 0; padding: 12px 0 0; border-top: 1px solid #edf1f6; display: flex !important; flex-direction: column; gap: 10px; align-items: center; }
    #detailLatest .detail-countdown, .family-summary-host .detail-countdown { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; width: 100%; }
    #detailLatest .countdown-label, .family-summary-host .countdown-label { font-size: 12px; margin: 0; white-space: normal; }
    #detailLatest .countdown-timer { max-width: 100%; margin: 0; }
    #detailLatest:has(.summary-controls) .detail-video { display: none; }
    .family-summary-host .summary-controls, #analysisLatest.family-summary-host .summary-controls, .lhc-analysis-summary.family-summary-host .summary-controls { display: flex; flex-direction: row; flex-wrap: wrap; justify-content: center; gap: 6px; width: 100%; min-width: 0; margin: 0; }
    .summary-controls > button, .summary-controls > a { min-height: 36px; }
    .detail-tools, .analysis-route-nav { display: flex; flex-wrap: nowrap; justify-content: flex-start; overflow-x: auto; height: auto; min-height: 48px; padding: 0 6px; gap: 4px; scrollbar-width: none; }
    body:has(.lhc-history-table) #detailLatest + .detail-tools { display: flex; flex-wrap: nowrap; padding: 0 6px; gap: 4px; }
    .detail-tools > a, body:has(.lhc-history-table) #detailLatest + .detail-tools > a, .analysis-route-nav > a { flex: 0 0 auto; height: 48px; min-height: 48px; padding: 0 12px; display: flex; align-items: center; justify-content: center; line-height: 20px; font-size: 13px; white-space: nowrap; }
    #lhcAnalysisNav, #analysisRouteNav { display: flex; flex-wrap: nowrap; justify-content: flex-start; overflow-x: auto; height: auto; padding: 0 6px; }
    #lhcAnalysisNav > a, #analysisRouteNav > a { flex: 0 0 auto; min-width: max-content; min-height: 48px; height: auto; padding: 0 12px; font-size: 13px; white-space: nowrap; }
    #detailHistory .history-header, #detailHistory:has(.lhc-history-table) .history-header { display: flex; flex-direction: row; flex-wrap: wrap; height: auto; min-height: 0; padding: 16px 12px; gap: 12px 8px; }
    #detailHistory .history-header h3 { flex-basis: 100%; margin: 0; font-size: 18px; }
    #detailHistory .date-filter { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; width: 100%; margin: 0; }
    #detailHistory .date-filter input { height: 36px; min-width: 0; max-width: 160px; }
    #detailHistory .history-toggle-btn { min-height: 36px; height: auto; padding: 6px 10px; font-size: 12px; }
    #detailHistory .history-scroll-hint { margin: 0 12px 10px; }
    #detailHistory .history-table-wrapper { margin: 0 12px; width: auto; max-width: calc(100% - 24px); border-radius: 8px; }
    #detailHistory #numberDistributionFilters, #detailHistory:has(.reference-record-table[data-family=ssc]) #numberDistributionFilters { display: flex; flex-wrap: wrap; width: auto; padding: 12px; margin: 0 12px 12px; gap: 8px; }
    #detailHistory #numberDistributionFilters button { min-height: 34px; }
    .mobile-history-loader { width: calc(100% - 24px); margin: 12px; min-height: 44px; }
    .detail-daily-stats, .daily-stats-panel { max-width: 100%; overflow-x: auto; }

    /* Analysis: controls wrap, charts keep readable dimensions and scroll internally. */
    .reference-analysis, .reference-analysis[data-mode=trend] { display: block; padding: 16px 12px; min-width: 0; }
    .reference-analysis .analysis-tip { font-size: 12px; line-height: 20px; padding: 0; }
    .analysis-position-tabs, .analysis-tabs { justify-content: flex-start; flex-wrap: nowrap; overflow-x: auto; padding: 4px 0; gap: 6px; }
    .analysis-position-tabs button, .analysis-tabs button { flex: 0 0 auto; min-height: 36px; }
    .reference-analysis .analysis-query { margin: 12px 0; gap: 8px; }
    .reference-analysis .analysis-display-settings { display: flex; flex-wrap: wrap; gap: 10px 12px; margin: 12px 0; }
    .reference-analysis .analysis-content { padding: 0; min-width: 0; max-width: 100%; }
    .analysis-chart-scroll, .analysis-table-scroll, .road-chart-scroll, .trend-matrix-scroll, .heat-table-scroll { max-width: 100%; overflow-x: auto; overscroll-behavior-x: contain; }
    .analysis-chart { min-width: 640px; }
    .road-ask { gap: 8px; }
    .road-ask button { min-width: 0; flex: 1; gap: 8px; font-size: 14px; min-height: 44px; }
    .road-mode-tabs { display: flex; flex-wrap: nowrap; justify-content: flex-start; overflow-x: auto; gap: 6px; padding-bottom: 6px; }
    .road-mode-tabs button { flex: 0 0 auto; white-space: nowrap; min-height: 40px; padding: 8px 12px; }
    .analysis-year-picker .lhc-year-popup { position: fixed; top: 50%; left: 50%; right: auto; transform: translate(-50%, -50%); max-width: calc(100vw - 24px); z-index: 1001; }
    .reference-trend-hub .trend-hub-groups { height: auto; min-height: 48px; flex-wrap: nowrap; justify-content: flex-start; overflow-x: auto; gap: 6px; padding: 4px 8px; box-sizing: border-box; }
    .reference-trend-hub .trend-hub-groups button, .reference-trend-hub .trend-hub-groups button.active { flex: 0 0 auto; width: auto; min-width: max-content; min-height: 40px; height: auto; gap: 6px; padding: 8px 12px; white-space: nowrap; box-sizing: border-box; }
    .reference-trend-hub .trend-hub-chart-shell { display: block; height: 250px; overflow-x: auto; max-width: 100%; }
    .reference-trend-hub .trend-hub-chart-shell svg { min-width: 640px; height: 250px; }
    .reference-trend-hub .trend-lottery-entry { grid-template-columns: 1fr; gap: 12px; padding: 16px 12px; }
    .reference-trend-hub .trend-entry-links > div { display: flex; flex-wrap: wrap; gap: 8px; }

    /* Prediction tables remain complete inside a scrollable panel. */
    .prediction-shell { width: 100%; min-width: 0; left: auto; }
    .prediction-shell .prediction-shell-filter, .prediction-shell .prediction-plan-filter { height: auto; min-height: 0; padding: 16px 12px; flex-wrap: wrap; gap: 10px; }
    .prediction-shell .prediction-shell-results { padding: 12px; overflow-x: auto; }
    .prediction-shell .prediction-shell-results > table { min-width: 650px; }
    .prediction-shell .prediction-plan-panel { padding: 12px; overflow-x: auto; }
    .prediction-shell .prediction-plan-top { display: flex; flex-direction: column; gap: 16px; }
    .prediction-shell .prediction-plan-program, .prediction-shell .prediction-plan-statistics { width: 100%; min-width: 0; }
    .prediction-shell .prediction-plan-statistics { overflow-x: auto; }
    .prediction-shell .prediction-plan-statistics table { min-width: 580px; }
    .prediction-shell .prediction-plan-history { min-width: 580px; }
    .prediction-shell .prediction-play-panel { position: fixed; top: 50%; left: 50%; right: auto; transform: translate(-50%, -50%); width: min(340px, calc(100vw - 32px)); max-height: 70dvh; overflow-y: auto; z-index: 1002; }
    .prediction-shell-tools > button, .prediction-shell-tools .prediction-ring-wrap > button { min-height: 36px; }
    .prediction-shell[data-family=pk10] .prediction-shell-balls { display: grid; grid-template-columns: repeat(5, 30px); justify-content: center; gap: 8px; }
    .prediction-shell .prediction-ring-panel { right: 0; left: auto; max-width: calc(100vw - 24px); }

    /* Editorial and utility pages. */
    .reference-articles .reference-editorial-main { width: 100%; min-width: 0; }
    .reference-articles #articlesTagBar { display: flex; flex-wrap: nowrap; overflow-x: auto; padding: 0 8px; }
    .reference-articles #articlesTagBar .articles-pill { flex: 0 0 auto; height: 48px; white-space: nowrap; padding: 12px; }
    .reference-articles .article-card-item { padding: 16px 0; gap: 12px; }
    .reference-articles .article-list-thumb, .reference-articles .article-list-placeholder { width: 88px; height: 70px; flex: 0 0 88px; object-fit: cover; }
    .reference-articles .article-list-copy { min-width: 0; }
    .reference-articles .article-card-title { font-size: 15px; line-height: 22px; }
    .reference-articles .article-detail { padding: 18px 14px; }
    .reference-articles .article-detail-title { font-size: 22px; line-height: 1.5; overflow-wrap: anywhere; }
    .reference-articles .article-detail-content { font-size: 15px; line-height: 1.9; overflow-wrap: anywhere; }
    .reference-articles .article-detail-content img { max-width: 100%; height: auto; }
    .dragon-layout { display: flex; flex-direction: column; gap: 12px; }
    .dragon-layout .dragon-selector, .dragon-layout .dragon-content { width: 100%; min-width: 0; flex: none; }
    .dragon-layout .dragon-header { height: auto; flex-wrap: wrap; gap: 8px; padding: 12px; }
    .dragon-selector #dragonTypes summary { min-height: 48px; }
    .simplicity-layout { display: flex; flex-direction: column; gap: 12px; }
    .simplicity-layout .simple-groups { display: flex; width: 100%; overflow-x: auto; }
    .simplicity-layout .simple-groups button { flex: 0 0 auto; min-width: 64px; }
    .simplicity-layout .simple-main { width: 100%; min-width: 0; }
    .simplicity-layout .simple-tabs { display: flex; overflow-x: auto; height: auto; }
    .simplicity-layout .simple-tabs button { flex: 0 0 auto; min-height: 44px; }
    .simplicity-layout .simple-actions { display: flex; gap: 8px; padding: 12px; }
    .simplicity-layout .simple-actions input { flex: 1 1 100%; width: 100%; }
    .simplicity-layout .simple-table-head { display: none; }
    .simplicity-layout .simple-row { display: grid; grid-template-columns: minmax(0, 1fr); gap: 12px; height: auto; padding: 16px 12px; }
    .simplicity-layout .simple-row > * { grid-column: 1; grid-row: auto; position: static; width: 100%; min-width: 0; margin: 0; padding: 0; box-sizing: border-box; }
    .simplicity-layout .simple-codes .ball-row { justify-content: flex-start; flex-wrap: wrap; gap: 5px; max-width: 100%; }
    .simplicity-layout .simple-time { display: flex; flex-direction: row; flex-wrap: wrap; gap: 8px; align-items: center; text-align: left; }
    .simplicity-layout .simple-analysis { display: flex; flex-wrap: wrap; width: 100%; justify-content: flex-start; }
    .simplicity-layout .simple-row .simple-analysis a { width: auto; min-height: 36px; padding: 6px 10px; }
    .reference-call { padding: 16px 12px; }
    .reference-call .call-mode-tabs { display: flex; flex-wrap: nowrap; overflow-x: auto; gap: 4px; }
    .reference-call .call-mode-tabs button { flex: 0 0 auto; min-height: 44px; padding: 10px; font-size: 13px; }
    .reference-call .call-selection-head, .reference-call .call-selection-actions, .reference-call .call-options { display: flex; flex-wrap: wrap; gap: 10px; height: auto; }
    .reference-call .call-selection-actions input { width: 100%; flex: 1 1 100%; min-height: 40px; }
    .reference-call .call-options label { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
    .reference-call .call-type-choices { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
    .reference-call .call-type-choices label { min-width: 0; min-height: 44px; white-space: normal; }
    .reference-call .call-help { overflow-x: auto; }
    #callCodePanel { width: calc(100vw - 24px); max-width: 560px; max-height: calc(100dvh - 32px); padding: 18px 12px; background: #fff; color: #374151; border: 1px solid #e8edf5; border-radius: 16px; box-sizing: border-box; overflow-y: auto; }
    #callCodePanel footer { display: flex; flex-wrap: wrap; gap: 8px; }
    .rules-layout { gap: 12px; }
    .rules-content { min-width: 0; padding: 18px 14px; }
    .rules-content p { line-height: 1.9; }
    .lhc-analysis-body { padding: 16px 12px; }
    .lhc-shell-heading { height: auto; display: flex; flex-wrap: wrap; gap: 12px; align-items: center; }
    .lhc-shell-heading h2 { flex-basis: 100%; font-size: 18px; }
    #lhcShellActions { display: flex; flex-wrap: wrap; gap: 10px; height: auto; }
    #lhcShellActions label { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
    .lhc-analysis-attributes { display: flex; flex-wrap: nowrap; justify-content: flex-start; overflow-x: auto; }
    .lhc-analysis-attributes button { flex: 0 0 auto; min-height: 44px; }
    .lhc-analysis-choices { display: flex; flex-wrap: wrap; gap: 8px; }
    .lhc-analysis-choices button { min-height: 36px; }
    #lhcSelectionInput { width: 100%; min-height: 100px; }
    #lhcSpecialPanel { max-width: 100%; overflow-x: auto; }
    .lhc-special-table { min-width: 640px; }
    #lhcShellActions .lhc-year-popup { position: fixed; left: 50%; top: 50%; right: auto; transform: translate(-50%, -50%); max-width: calc(100vw - 24px); z-index: 1001; }
    .reference-tools { padding: 16px 12px; }
    .reference-page-head, .tools-choice { flex-wrap: wrap; gap: 12px; height: auto; }
    .line-navigation { width: 100%; min-width: 0; padding: 12px; box-sizing: border-box; }
    .line-route-list { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
    .line-route-card { padding: 14px 8px; }
    .layui-layer:not(.layui-layer-tips) { max-width: calc(100vw - 24px); box-sizing: border-box; }
    .forum-auth-layer .layui-layer-content { max-height: calc(100dvh - 100px); overflow-y: auto; }
}

@media (max-width: 359px) {
    .reference-home #homeLotteryGrid { padding: 8px; }
    .reference-home #homeLotteryGrid .lottery-card { padding-left: 8px; padding-right: 8px; }
    .reference-home #homeLotteryGrid .lottery-card-numbers .ball { width: 25px; height: 25px; min-width: 25px; font-size: 12px; }
    .reference-home #homeLotteryGrid .lottery-card[data-category=pk10] .ball { width: 100%; min-width: 0; font-size: 10px; }
    .reference-home #homeLotteryGrid .lottery-card-links > a, .reference-home #homeLotteryGrid .lottery-card-links > button { font-size: 11px; }
    .line-route-list { grid-template-columns: 1fr; }
}

/* Keep contact actions within the reserved mobile navigation area. */
@media (max-width: 768px) {
    body .floating-contact { top: 8px; right: 64px; bottom: auto; left: auto; z-index: 1000; flex-direction: row; gap: 4px; max-width: calc(100vw - 180px); overflow-x: auto; scrollbar-width: none; }
    body .floating-contact::-webkit-scrollbar { display: none; }
    .floating-contact .floating-item { flex: 0 0 auto; }
    .floating-contact .floating-btn { width: 40px; height: 40px; box-sizing: border-box; }
    .floating-contact .floating-tooltip { position: fixed; top: 60px; right: 16px; max-width: calc(100vw - 32px); box-sizing: border-box; white-space: normal; transform: none; }
    .floating-contact .floating-tooltip::after { display: none; }
    .navbar .navbar-brand { max-width: calc(100% - 220px); }
    .navbar .navbar-brand img { max-width: 100%; }
    .reference-trend-hub .trend-hub-chart-shell { display: block; place-items: start; width: 100%; height: 266px; overflow-x: auto; overflow-y: hidden; scroll-behavior: auto; }
    .reference-trend-hub .trend-hub-chart-shell svg { display: block; width: 1224px; min-width: 1224px; max-width: none; height: 250px; }
    .reference-trend-hub .trend-hub-chart-shell svg text { font-size: 13px; }
}
