html,
body {
    max-width: 100%;
    overflow-x: hidden;
    -webkit-text-size-adjust: 100%;
}

img {
    max-width: 100%;
    height: auto;
}

#BingoContent,
#PageContent {
    max-width: 100%;
}

.dist-mobile-list {
    display: none;
}

.dist-heatmap {
    display: none;
}

.dist-heat-cell.heat-level-1 {
    color: #7c2d12;
    background: #ffedd5;
    border-color: #fed7aa;
}

.dist-heat-cell.heat-level-2 {
    color: #7c2d12;
    background: #fed7aa;
    border-color: #fdba74;
}

.dist-heat-cell.heat-level-3 {
    color: #ffffff;
    background: #f97316;
    border-color: #ea580c;
}

.dist-heat-cell.heat-level-4 {
    color: #ffffff;
    background: #dc2626;
    border-color: #b91c1c;
}

.dist-heat-cell.heat-level-5 {
    color: #ffffff;
    background: #7f1d1d;
    border-color: #450a0a;
}

@media (max-width: 768px) {
    html.dist-rwd-loading {
        background: #f4f7fb !important;
    }

    html.dist-rwd-loading body > * {
        opacity: 0;
    }

    html.dist-rwd-loading body::before {
        content: "\8f09\5165\4e2d";
        position: fixed;
        left: 50%;
        top: 50%;
        z-index: 99999;
        width: 84px;
        height: 84px;
        display: grid;
        place-items: center;
        color: #b91c1c;
        background: #ffffff;
        border: 1px solid #e2e8f0;
        border-radius: 14px;
        box-shadow: 0 12px 30px rgba(15, 23, 42, 0.16);
        font-size: 13px;
        font-weight: 900;
        transform: translate(-50%, -50%);
    }

    html.dist-rwd-loading body::after {
        content: "";
        position: fixed;
        left: 50%;
        top: calc(50% - 23px);
        z-index: 100000;
        width: 22px;
        height: 22px;
        border: 3px solid #fee2e2;
        border-top-color: #b91c1c;
        border-radius: 999px;
        transform: translate(-50%, -50%);
        animation: dist-spin 0.8s linear infinite;
    }

    @keyframes dist-spin {
        to {
            transform: translate(-50%, -50%) rotate(360deg);
        }
    }

    html.dist-rwd-active {
        background: #f4f7fb !important;
    }

    body {
        width: 100% !important;
        min-width: 0 !important;
        margin: 0 !important;
        background: #f4f7fb !important;
        color: #172033;
        font-family: Arial, "Microsoft JhengHei", sans-serif;
    }

    html.dist-rwd-active body > *:not(.dist-rwd-page) {
        display: none !important;
    }

    .dist-rwd-page {
        box-sizing: border-box;
        display: block;
        width: 100%;
        max-width: 430px;
        min-height: 100vh;
        margin: 0 auto;
        padding: 10px;
        background: #f4f7fb;
    }

    .dist-rwd-header {
        display: flex;
        align-items: center;
        justify-content: flex-start;
        gap: 10px;
        min-height: 44px;
        margin: 0 0 8px;
        padding: 0 4px;
    }

    .dist-rwd-back {
        flex: 0 0 auto;
        min-height: 34px;
        padding: 6px 10px;
        color: #334155;
        background: #ffffff;
        border: 1px solid #cbd5e1;
        border-radius: 8px;
        font-size: 13px;
        font-weight: 800;
    }

    .dist-rwd-title {
        min-width: 0;
        color: #111827;
        font-size: 18px;
        font-weight: 800;
        line-height: 1.25;
    }

    body > div[align="center"],
    table.hk,
    table[width="1000"],
    table[width="995"] {
        width: 100% !important;
        max-width: 100% !important;
        min-width: 0 !important;
        border: 0 !important;
    }

    table.hk > tbody > tr > td {
        display: block !important;
        width: 100% !important;
        max-width: 100% !important;
    }

    table[width="995"] > tbody > tr > td {
        display: block !important;
        width: 100% !important;
        max-width: 100% !important;
    }

    #BingoContent,
    #PageContent {
        box-sizing: border-box !important;
        width: 100% !important;
        max-width: 100% !important;
        overflow-x: hidden !important;
        -webkit-overflow-scrolling: touch;
        background: #ffffff;
        border: 1px solid #dbe3ef;
        border-radius: 8px;
        padding: 10px !important;
    }

    #BingoContent table,
    #PageContent table {
        max-width: 100% !important;
    }

    #BingoContent > table:first-child,
    #PageContent > div:first-child table:first-child {
        display: none !important;
    }

    #BingoContent > div[align="left"],
    #PageContent > div[align="left"],
    .dist-mobile-description {
        margin-left: 0 !important;
        margin-top: 10px !important;
        padding: 8px 10px !important;
        color: #334155;
        background: #f8fafc;
        border: 1px solid #e2e8f0;
        border-radius: 6px;
        font-size: 12px;
        line-height: 1.45;
        text-align: left !important;
        white-space: normal !important;
        overflow-wrap: anywhere;
    }

    #BingoContent table[border="1"],
    #PageContent table[border="1"] {
        width: max-content !important;
        min-width: 760px !important;
        table-layout: auto !important;
    }

    html.has-mobile-dist #BingoContent table[border="1"],
    html.has-mobile-dist #PageContent table[border="1"] {
        display: none !important;
    }

    #BingoContent table[border="1"] td,
    #PageContent table[border="1"] td {
        min-width: 18px;
        height: 24px !important;
        padding: 2px !important;
        font-size: 10px !important;
        line-height: 1.15 !important;
        white-space: nowrap;
    }

    #BingoContent table[border="1"] td:first-child,
    #PageContent table[border="1"] td:first-child {
        position: sticky;
        left: 0;
        z-index: 1;
        min-width: 58px;
        box-shadow: 1px 0 0 #111827;
    }

    .dist-mobile-list {
        display: grid;
        gap: 10px;
        width: 100%;
        margin-top: 12px;
    }

    .dist-heatmap {
        display: grid;
        gap: 12px;
        margin: 10px 0 0;
        padding: 12px;
        background: linear-gradient(180deg, #fff7ed 0%, #ffffff 58%);
        border: 1px solid #dbe3ef;
        border-radius: 8px;
        box-shadow: 0 8px 18px rgba(15, 23, 42, 0.08);
    }

    .dist-heatmap-title {
        color: #7f1d1d;
        font-size: 16px;
        font-weight: 900;
        line-height: 1.25;
        text-align: left;
    }

    .dist-heatmap-meta {
        color: #64748b;
        font-size: 12px;
        font-weight: 700;
        line-height: 1.35;
        text-align: left;
    }

    .dist-heatmap-hot {
        display: flex;
        align-items: center;
        gap: 6px;
        min-width: 0;
        overflow-x: auto;
        padding-bottom: 2px;
        scrollbar-width: none;
    }

    .dist-heatmap-hot::-webkit-scrollbar {
        display: none;
    }

    .dist-heatmap-hot-label {
        flex: 0 0 auto;
        color: #7f1d1d;
        font-size: 12px;
        font-weight: 900;
    }

    .dist-heatmap-hot-chip {
        flex: 0 0 auto;
        padding: 5px 8px;
        color: #ffffff;
        background: #b91c1c;
        border-radius: 999px;
        font-size: 11px;
        font-weight: 900;
        line-height: 1;
    }

    .dist-heatmap-grid {
        display: grid;
        grid-template-columns: repeat(10, 27px);
        justify-content: center;
        gap: 4px;
    }

    .dist-heat-cell {
        box-sizing: border-box;
        display: inline-grid;
        place-items: center;
        width: 27px;
        min-height: 38px;
        padding: 2px 1px;
        color: #475569;
        background: #f8fafc;
        border: 1px solid #e2e8f0;
        border-radius: 7px;
        line-height: 1;
    }

    .dist-heat-cell strong {
        display: block;
        font-size: 11px;
        font-weight: 900;
        line-height: 1;
    }

    .dist-heat-cell em {
        display: block;
        margin-top: 3px;
        font-size: 9px;
        font-style: normal;
        font-weight: 800;
        line-height: 1;
    }

    .dist-mobile-legend {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 8px;
        margin: 10px 0 0;
        padding: 10px;
        color: #334155;
        background: #f8fafc;
        border: 1px solid #e2e8f0;
        border-radius: 8px;
        font-size: 12px;
        font-weight: 700;
        text-align: left;
    }

    .dist-mobile-legend-item {
        display: inline-flex;
        align-items: center;
        gap: 6px;
        min-width: 0;
        line-height: 1.25;
    }

    .dist-mobile-legend-dot {
        display: inline-block;
        width: 14px;
        height: 14px;
        flex: 0 0 14px;
        border: 1px solid #dbe3ef;
        border-radius: 999px;
        background: #ffffff;
    }

    .dist-mobile-legend-dot.dist-mobile-hit {
        background: #d1fae5;
        border-color: #6ee7b7;
    }

    .dist-mobile-legend-dot.RK10DBlue {
        background: #2563eb;
        border-color: #1d4ed8;
    }

    .dist-mobile-legend-dot.RK10Red {
        background: #dc2626;
        border-color: #b91c1c;
    }

    .dist-mobile-card {
        display: grid;
        gap: 8px;
        padding: 8px;
        background: #ffffff;
        border: 1px solid #dbe3ef;
        border-radius: 8px;
        box-shadow: 0 2px 8px rgba(15, 23, 42, 0.06);
    }

    .dist-mobile-period {
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 8px;
        color: #10213a;
        font-size: 13px;
        font-weight: 800;
        line-height: 1.35;
    }

    .dist-mobile-period-badge {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        min-width: 38px;
        height: 20px;
        padding: 0 8px;
        border-radius: 999px;
        color: #ffffff;
        font-size: 11px;
        font-weight: 800;
        line-height: 1;
    }

    .dist-mobile-period-badge.RK10BB {
        background: #2563eb;
    }

    .dist-mobile-period-badge.RK10BS {
        background: #dc2626;
    }

    .dist-mobile-period-badge.RK10BN {
        color: #713f12;
        background: #fef3c7;
    }

    .dist-mobile-balls {
        display: grid;
        grid-template-columns: repeat(10, 24px);
        justify-content: center;
        gap: 5px;
        width: 100%;
    }

    .dist-mobile-ball,
    .dist-mobile-empty {
        box-sizing: border-box;
        width: 24px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        min-width: 0;
        min-height: 24px;
        padding: 1px;
        color: #0f172a;
        background: #f8fafc;
        border: 1px solid #dbe3ef;
        border-radius: 999px;
        font-size: 10px;
        font-weight: 800;
        line-height: 1;
    }

    .dist-mobile-hit {
        color: #065f46;
        background: #d1fae5;
        border-color: #6ee7b7;
    }

    .dist-mobile-miss {
        color: #94a3b8;
        background: #ffffff;
        border-color: #e5e7eb;
    }

    .dist-mobile-ball.RK10Green {
        color: #065f46;
        background: #d1fae5;
        border-color: #6ee7b7;
    }

    .dist-mobile-ball.RK10Red {
        color: #ffffff;
        background: #dc2626;
        border-color: #b91c1c;
    }

    .dist-mobile-ball.RK10DBlue {
        color: #ffffff;
        background: #2563eb;
        border-color: #1d4ed8;
    }

    .dist-mobile-empty {
        color: #94a3b8;
        background: #f8fafc;
        border-color: #e2e8f0;
    }
}

@media (min-width: 769px) {
    html.dist-rwd-active {
        background: #f4f7fb !important;
    }

    html.dist-rwd-loading body > * {
        opacity: 0;
    }

    html.dist-rwd-active body {
        width: 100% !important;
        min-width: 0 !important;
        margin: 0 !important;
        background: #f4f7fb !important;
        color: #172033;
        font-family: Arial, "Microsoft JhengHei", sans-serif;
    }

    html.dist-rwd-active body > *:not(.dist-rwd-page) {
        display: none !important;
    }

    html.dist-rwd-active .dist-rwd-page {
        box-sizing: border-box;
        display: block;
        width: min(100%, 920px);
        min-height: 100vh;
        margin: 0 auto;
        padding: 18px;
        background: #f4f7fb;
    }

    html.dist-rwd-active .dist-rwd-header {
        display: flex;
        align-items: center;
        gap: 10px;
        min-height: 44px;
        margin: 0 0 10px;
    }

    html.dist-rwd-active .dist-rwd-back {
        flex: 0 0 auto;
        min-height: 36px;
        padding: 7px 12px;
        color: #334155;
        background: #ffffff;
        border: 1px solid #cbd5e1;
        border-radius: 8px;
        font-size: 13px;
        font-weight: 800;
        cursor: pointer;
    }

    html.dist-rwd-active .dist-rwd-title {
        min-width: 0;
        color: #111827;
        font-size: 20px;
        font-weight: 900;
        line-height: 1.25;
    }

    html.dist-rwd-active #BingoContent,
    html.dist-rwd-active #PageContent {
        box-sizing: border-box !important;
        width: 100% !important;
        max-width: 100% !important;
        overflow-x: hidden !important;
        background: #ffffff;
        border: 1px solid #dbe3ef;
        border-radius: 8px;
        padding: 14px !important;
    }

    html.dist-rwd-active #BingoContent > table:first-child,
    html.dist-rwd-active #PageContent > div:first-child table:first-child {
        display: none !important;
    }

    html.dist-rwd-active #BingoContent > div[align="left"],
    html.dist-rwd-active #PageContent > div[align="left"],
    html.dist-rwd-active .dist-mobile-description {
        margin-left: 0 !important;
        margin-top: 10px !important;
        padding: 9px 11px !important;
        color: #334155;
        background: #f8fafc;
        border: 1px solid #e2e8f0;
        border-radius: 6px;
        font-size: 12px;
        line-height: 1.5;
        text-align: left !important;
        white-space: normal !important;
        overflow-wrap: anywhere;
    }

    html.dist-rwd-active.has-mobile-dist #BingoContent table[border="1"],
    html.dist-rwd-active.has-mobile-dist #PageContent table[border="1"] {
        display: none !important;
    }

    html.dist-rwd-active .dist-mobile-list {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 12px;
        width: 100%;
        margin-top: 12px;
    }

    html.dist-rwd-active .dist-heatmap {
        display: grid;
        gap: 12px;
        margin: 10px 0 0;
        padding: 14px;
        background: linear-gradient(180deg, #fff7ed 0%, #ffffff 58%);
        border: 1px solid #dbe3ef;
        border-radius: 8px;
        box-shadow: 0 8px 18px rgba(15, 23, 42, 0.08);
    }

    html.dist-rwd-active .dist-heatmap-title {
        color: #7f1d1d;
        font-size: 17px;
        font-weight: 900;
        line-height: 1.25;
        text-align: left;
    }

    html.dist-rwd-active .dist-heatmap-meta {
        color: #64748b;
        font-size: 12px;
        font-weight: 700;
        line-height: 1.35;
        text-align: left;
    }

    html.dist-rwd-active .dist-heatmap-hot {
        display: flex;
        align-items: center;
        gap: 6px;
        min-width: 0;
        overflow-x: auto;
        padding-bottom: 2px;
        scrollbar-width: none;
    }

    html.dist-rwd-active .dist-heatmap-hot::-webkit-scrollbar {
        display: none;
    }

    html.dist-rwd-active .dist-heatmap-hot-label {
        flex: 0 0 auto;
        color: #7f1d1d;
        font-size: 12px;
        font-weight: 900;
    }

    html.dist-rwd-active .dist-heatmap-hot-chip {
        flex: 0 0 auto;
        padding: 5px 8px;
        color: #ffffff;
        background: #b91c1c;
        border-radius: 999px;
        font-size: 11px;
        font-weight: 900;
        line-height: 1;
    }

    html.dist-rwd-active .dist-heatmap-grid {
        display: grid;
        grid-template-columns: repeat(auto-fit, minmax(38px, 1fr));
        gap: 6px;
    }

    html.dist-rwd-active .dist-heat-cell {
        box-sizing: border-box;
        display: inline-grid;
        place-items: center;
        min-height: 42px;
        padding: 4px 2px;
        color: #475569;
        background: #f8fafc;
        border: 1px solid #e2e8f0;
        border-radius: 7px;
        line-height: 1;
    }

    html.dist-rwd-active .dist-heat-cell strong {
        display: block;
        font-size: 12px;
        font-weight: 900;
        line-height: 1;
    }

    html.dist-rwd-active .dist-heat-cell em {
        display: block;
        margin-top: 3px;
        font-size: 9px;
        font-style: normal;
        font-weight: 800;
        line-height: 1;
    }

    html.dist-rwd-active .dist-mobile-legend {
        display: grid;
        grid-template-columns: repeat(4, minmax(0, 1fr));
        gap: 8px;
        margin: 10px 0 0;
        padding: 10px;
        color: #334155;
        background: #f8fafc;
        border: 1px solid #e2e8f0;
        border-radius: 8px;
        font-size: 12px;
        font-weight: 700;
        text-align: left;
    }

    html.dist-rwd-active .dist-mobile-legend-item {
        display: inline-flex;
        align-items: center;
        gap: 6px;
        min-width: 0;
        line-height: 1.25;
    }

    html.dist-rwd-active .dist-mobile-legend-dot {
        display: inline-block;
        width: 14px;
        height: 14px;
        flex: 0 0 14px;
        border: 1px solid #dbe3ef;
        border-radius: 999px;
        background: #ffffff;
    }

    html.dist-rwd-active .dist-mobile-card {
        display: grid;
        gap: 8px;
        padding: 10px;
        background: #ffffff;
        border: 1px solid #dbe3ef;
        border-radius: 8px;
        box-shadow: 0 2px 8px rgba(15, 23, 42, 0.06);
    }

    html.dist-rwd-active .dist-mobile-period {
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 8px;
        color: #10213a;
        font-size: 13px;
        font-weight: 800;
        line-height: 1.35;
    }

    html.dist-rwd-active .dist-mobile-period-badge {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        min-width: 38px;
        height: 20px;
        padding: 0 8px;
        color: #ffffff;
        border-radius: 999px;
        font-size: 11px;
        font-weight: 800;
        line-height: 1;
    }

    html.dist-rwd-active .dist-mobile-balls {
        display: grid;
        grid-template-columns: repeat(10, 24px);
        justify-content: center;
        gap: 5px;
        width: 100%;
    }

    html.dist-rwd-active .dist-mobile-ball,
    html.dist-rwd-active .dist-mobile-empty {
        box-sizing: border-box;
        width: 24px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        min-width: 0;
        min-height: 24px;
        padding: 1px;
        color: #0f172a;
        background: #f8fafc;
        border: 1px solid #dbe3ef;
        border-radius: 999px;
        font-size: 10px;
        font-weight: 800;
        line-height: 1;
    }

    html.dist-rwd-active .dist-mobile-hit {
        color: #065f46;
        background: #d1fae5;
        border-color: #6ee7b7;
    }

    html.dist-rwd-active .dist-mobile-miss {
        color: #94a3b8;
        background: #ffffff;
        border-color: #e5e7eb;
    }

    html.dist-rwd-active .RK10DBlue {
        color: #ffffff;
        background: #2563eb;
        border-color: #1d4ed8;
    }

    html.dist-rwd-active .RK10Red {
        color: #ffffff;
        background: #dc2626;
        border-color: #b91c1c;
    }
}

.dist-heatmap .dist-heat-cell.heat-level-1,
html.dist-rwd-active .dist-heatmap .dist-heat-cell.heat-level-1 {
    color: #7c2d12;
    background: #ffedd5;
    border-color: #fed7aa;
}

.dist-heatmap .dist-heat-cell.heat-level-2,
html.dist-rwd-active .dist-heatmap .dist-heat-cell.heat-level-2 {
    color: #7c2d12;
    background: #fed7aa;
    border-color: #fdba74;
}

.dist-heatmap .dist-heat-cell.heat-level-3,
html.dist-rwd-active .dist-heatmap .dist-heat-cell.heat-level-3 {
    color: #ffffff;
    background: #f97316;
    border-color: #ea580c;
}

.dist-heatmap .dist-heat-cell.heat-level-4,
html.dist-rwd-active .dist-heatmap .dist-heat-cell.heat-level-4 {
    color: #ffffff;
    background: #dc2626;
    border-color: #b91c1c;
}

.dist-heatmap .dist-heat-cell.heat-level-5,
html.dist-rwd-active .dist-heatmap .dist-heat-cell.heat-level-5 {
    color: #ffffff;
    background: #7f1d1d;
    border-color: #450a0a;
}
