/*
 * 1588 public reference replica
 *
 * This layer borrows the supplied 4901/ok.html visual language (720px
 * centered canvas, blue header, compact bordered modules, coral accents and
 * a persistent bottom rail) without importing its third-party links or data.
 * It deliberately only styles the existing PbootCMS markup; all API routes,
 * labels and visibility rules remain owned by the templates and public.js.
 */
:root {
    --1588-ref-width: 720px;
    --1588-ref-blue: #188ff4;
    --1588-ref-blue-dark: #0d70d4;
    --1588-ref-blue-soft: #edf7ff;
    --1588-ref-green: #07c160;
    --1588-ref-coral: #ff5d91;
    --1588-ref-coral-soft: #fff2f6;
    --1588-ref-line: #e7edf3;
    --1588-ref-text: #25364a;
    --1588-ref-muted: #7d8b99;
    --1588-ref-canvas: #ededed;
}

body[data-reference-ui="1"] {
    background: var(--1588-ref-canvas);
    color: var(--1588-ref-text);
}

body[data-reference-ui="1"] > .c1588-topbar {
    position: sticky;
    inset: 0 auto auto;
    z-index: 30;
    width: 100%;
    max-width: var(--1588-ref-width);
    min-height: 56px;
    margin: 0 auto;
    color: #fff;
    background: linear-gradient(90deg, #4292ef 0%, #5aa1f5 28%, #60a6f7 50%, #4e98ec 72%, #4292ef 100%);
    border: 0;
    box-shadow: 0 1px 5px rgba(38, 106, 170, .16);
}

body[data-reference-ui="1"] > .c1588-topbar .c1588-topbar__inner {
    width: 100%;
    max-width: var(--1588-ref-width);
    min-height: 56px;
    padding: 7px 12px;
    margin: 0 auto;
}

body[data-reference-ui="1"] .c1588-brand {
    flex: 0 0 auto;
    min-width: 0;
}

body[data-reference-ui="1"] .c1588-brand__logo {
    width: 104px;
    height: 38px;
    object-fit: contain;
}

body[data-reference-ui="1"] .c1588-topbar__title {
    color: #fff;
    font-size: 18px;
    font-weight: 800;
    letter-spacing: .02em;
}

body[data-reference-ui="1"] .c1588-site-nav {
    display: none !important;
}

body[data-reference-ui="1"] .c1588-header-actions,
body[data-reference-ui="1"] .c1588-header-actions a,
body[data-reference-ui="1"] .c1588-header-actions button {
    color: #fff;
}

body[data-reference-ui="1"] .c1588-header-actions--icons {
    gap: 6px;
}

body[data-reference-ui="1"] .c1588-header-actions--icons svg {
    stroke: currentColor;
}

body[data-reference-ui="1"] .c1588-portal,
body[data-reference-ui="1"] .c1588-secondary-page {
    width: 100%;
    max-width: var(--1588-ref-width);
    min-height: calc(100vh - 56px);
    padding: 0 0 84px;
    margin: 0 auto;
    background: #fff;
    box-shadow: 0 0 24px rgba(47, 76, 103, .08);
}

body[data-reference-ui="1"] .c1588-portal .c1588-container,
body[data-reference-ui="1"] .c1588-secondary-page .c1588-container {
    width: 100%;
    max-width: none;
    padding-inline: 4px;
}

body[data-reference-ui="1"] .c1588-portal__stack,
body[data-reference-ui="1"] .c1588-secondary-page .c1588-stack {
    gap: 4px;
}

/* The supplied design uses a full-bleed hero under the blue shell. */
body[data-reference-ui="1"] .c1588-banner-carousel {
    width: 100%;
    height: 176px !important;
    min-height: 0 !important;
    padding: 0 !important;
    margin: 0;
    border: 0;
    border-radius: 0;
    box-shadow: none;
}

body[data-reference-ui="1"] .c1588-banner-carousel__viewport,
body[data-reference-ui="1"] .c1588-banner-carousel__track,
body[data-reference-ui="1"] .c1588-banner-carousel__slide {
    height: 176px !important;
    min-height: 0;
    overflow: hidden;
}

body[data-reference-ui="1"] .c1588-banner-carousel__slide picture {
    display: block;
    width: 100%;
    height: 100%;
}
body[data-reference-ui="1"] .c1588-banner-carousel__slide img {
    width: 100%;
    height: 176px;
    object-fit: cover;
}

body[data-reference-ui="1"] .c1588-portal-notice {
    display: flex;
    align-items: center;
    min-height: 42px;
    margin: 0;
    padding: 7px 12px;
    border: 0;
    border-bottom: 1px solid var(--1588-ref-line);
    border-radius: 0;
    background: #fff;
    color: var(--1588-ref-text);
}

body[data-reference-ui="1"] .c1588-portal-notice__icon {
    margin-right: 8px;
}

body[data-reference-ui="1"] .c1588-portal-notice__text {
    display: flex;
    min-width: 0;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 6px;
}

body[data-reference-ui="1"] .c1588-portal-notice__text strong {
    color: var(--1588-ref-coral);
}

body[data-reference-ui="1"] .c1588-portal-reference-channels {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 4px;
    padding: 4px;
    margin: 0;
    border-bottom: 1px solid var(--1588-ref-line);
    background: #fff;
}

body[data-reference-ui="1"] .c1588-portal-reference-channels a {
    display: flex;
    min-height: 48px;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 4px 2px;
    border: 1px solid #d4eafd;
    border-radius: 3px;
    background: var(--1588-ref-blue-soft);
    color: var(--1588-ref-blue-dark);
    text-align: center;
}

body[data-reference-ui="1"] .c1588-portal-reference-channels a:nth-child(4n + 2) {
    border-color: #ffd3e1;
    background: var(--1588-ref-coral-soft);
    color: #d83f72;
}

body[data-reference-ui="1"] .c1588-portal-reference-channels b {
    font-size: 14px;
    line-height: 1.25;
}

body[data-reference-ui="1"] .c1588-portal-reference-channels small {
    margin-top: 2px;
    color: var(--1588-ref-muted);
    font-size: 11px;
}

/* Latest draw module: thin blue border and dense result row like ok.html. */
body[data-reference-ui="1"] .c1588-portal-draw {
    margin: 0;
    padding: 0;
    border: 1px solid var(--1588-ref-blue);
    border-radius: 2px;
    background: #fff;
    box-shadow: none;
}

body[data-reference-ui="1"] .c1588-portal-draw__tabs {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    min-height: 38px;
    background: #f7fbff;
    border-bottom: 1px solid #cfe6fb;
}

body[data-reference-ui="1"] .c1588-portal-draw__tabs button {
    min-height: 38px;
    padding: 4px 8px;
    border: 0;
    border-right: 1px solid #cfe6fb;
    border-radius: 0;
    background: transparent;
    color: var(--1588-ref-blue-dark);
    font-weight: 700;
}

body[data-reference-ui="1"] .c1588-portal-draw__tabs button.is-active {
    background: var(--1588-ref-green);
    color: #fff;
}

body[data-reference-ui="1"] .c1588-portal-draw__heading {
    display: grid;
    grid-template-columns: auto 1fr auto;
    align-items: center;
    gap: 8px;
    min-height: 54px;
    padding: 8px 12px;
    border-bottom: 1px solid var(--1588-ref-line);
}

body[data-reference-ui="1"] .c1588-portal-draw__heading > strong {
    color: var(--1588-ref-coral);
    font-size: 18px;
}

body[data-reference-ui="1"] .c1588-portal-draw__heading > span {
    color: var(--1588-ref-muted);
    font-size: 12px;
}

body[data-reference-ui="1"] .c1588-portal-draw__heading > a {
    color: var(--1588-ref-blue-dark);
    font-size: 12px;
    font-weight: 700;
}

body[data-reference-ui="1"] .c1588-portal-balls {
    display: flex;
    min-height: 94px;
    align-items: center;
    justify-content: center;
    gap: clamp(3px, 1.1vw, 10px);
    padding: 10px 8px 5px;
}

body[data-reference-ui="1"] .c1588-portal-ball {
    flex: 1 1 0;
    max-width: 66px;
}

body[data-reference-ui="1"] .c1588-portal-ball > b {
    width: clamp(34px, 8vw, 56px);
    height: clamp(34px, 8vw, 56px);
    border: 3px solid currentColor;
    box-shadow: none;
}

body[data-reference-ui="1"] .c1588-portal-ball small {
    color: var(--1588-ref-muted);
    font-size: 11px;
}

body[data-reference-ui="1"] .c1588-portal-plus {
    flex: 0 0 auto;
    color: var(--1588-ref-coral);
    font-size: 26px;
    font-weight: 800;
}

body[data-reference-ui="1"] .c1588-portal-draw__meta {
    min-height: 30px;
    margin: 0;
    padding: 6px 10px;
    border-top: 1px solid var(--1588-ref-line);
    color: var(--1588-ref-muted);
    font-size: 12px;
    text-align: center;
}

/* Three API-backed cards stay one row on desktop and one compact list on phones. */
body[data-reference-ui="1"] .c1588-home-draw-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 4px;
    padding: 0;
    margin: 0;
}

body[data-reference-ui="1"] .c1588-home-draw-grid article {
    width: 100%;
    padding: 8px 10px;
    border: 1px solid var(--1588-ref-blue);
    border-radius: 2px;
    background: #fff;
}

body[data-reference-ui="1"] .c1588-home-draw-grid article p {
    color: var(--1588-ref-text);
}

body[data-reference-ui="1"] .c1588-home-draw-title,
body[data-reference-ui="1"] .c1588-home-countdown {
    color: var(--1588-ref-blue-dark);
}

body[data-reference-ui="1"] .c1588-home-draw-grid p > a {
    color: var(--1588-ref-coral);
}

body[data-reference-ui="1"] .c1588-home-balls {
    min-width: 0;
    overflow-x: auto;
    scrollbar-width: thin;
}

body[data-reference-ui="1"] .c1588-home-mini-ball {
    min-width: 46px;
    padding: 5px 4px !important;
    border: 2px solid currentColor;
    border-radius: 3px;
    background: #fff !important;
    color: var(--1588-ref-text) !important;
}

body[data-reference-ui="1"] .c1588-home-mini-ball strong {
    color: var(--1588-ref-text) !important;
}

body[data-reference-ui="1"] .c1588-home-mini-ball.red { border-color: #ef4d5b; }
body[data-reference-ui="1"] .c1588-home-mini-ball.blue { border-color: #388fe8; }
body[data-reference-ui="1"] .c1588-home-mini-ball.green { border-color: #28ae68; }

body[data-reference-ui="1"] .c1588-home-mini-ball small {
    background: transparent;
    color: var(--1588-ref-muted);
}

/* Coral news tiles and the existing shortcut/gallery modules form the lower portal. */
body[data-reference-ui="1"] .c1588-portal-links {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 4px;
    padding: 4px;
    margin: 0;
    border: 1px solid #ffd5e2;
    border-radius: 2px;
    background: var(--1588-ref-coral-soft);
}

body[data-reference-ui="1"] .c1588-portal-links a {
    display: flex;
    min-height: 38px;
    align-items: center;
    justify-content: center;
    padding: 4px 3px;
    border: 1px solid #ffd5e2;
    border-radius: 2px;
    background: #fff;
    color: #d83f72;
    font-size: 13px;
    font-weight: 700;
    text-align: center;
}

body[data-reference-ui="1"] .c1588-portal-tools {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 0;
    padding: 8px 4px;
    margin: 0;
    border-top: 1px solid var(--1588-ref-line);
    border-bottom: 1px solid var(--1588-ref-line);
    background: #fff;
}

body[data-reference-ui="1"] .c1588-portal-tools a {
    min-width: 0;
    padding: 5px 2px;
    color: var(--1588-ref-text);
    font-size: 11px;
    text-align: center;
}

body[data-reference-ui="1"] .c1588-portal-tools img,
body[data-reference-ui="1"] .c1588-portal-tools i {
    width: 34px;
    height: 34px;
    margin: 0 auto 4px;
}

body[data-reference-ui="1"] .c1588-portal-years {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 4px;
    padding: 4px;
    margin: 0;
}

body[data-reference-ui="1"] .c1588-portal-years a {
    min-height: 42px;
    border: 1px solid #d4eafd;
    border-radius: 2px;
    background: var(--1588-ref-blue-soft);
    color: var(--1588-ref-blue-dark);
    font-size: 12px;
}

body[data-reference-ui="1"] .c1588-portal-gallery,
body[data-reference-ui="1"] .c1588-portal-forum {
    margin: 0;
    border: 1px solid var(--1588-ref-line);
    border-radius: 2px;
    box-shadow: none;
}

body[data-reference-ui="1"] .c1588-portal-gallery__header,
body[data-reference-ui="1"] .c1588-portal-forum .c1588-card__header {
    min-height: 42px;
    padding: 8px 10px;
    border-bottom: 1px solid var(--1588-ref-line);
}

body[data-reference-ui="1"] .c1588-portal-gallery__header h2,
body[data-reference-ui="1"] .c1588-portal-forum .c1588-card__title {
    color: var(--1588-ref-blue-dark);
}

body[data-reference-ui="1"] .c1588-portal-gallery__series {
    gap: 4px;
    padding: 4px;
}

body[data-reference-ui="1"] .c1588-portal-gallery__series a.is-active {
    background: var(--1588-ref-green);
}

body[data-reference-ui="1"] .c1588-forum-list__item {
    min-height: 42px;
    padding: 8px 10px;
    border-bottom: 1px solid #ffe0e9;
}

body[data-reference-ui="1"] .c1588-forum-list__title {
    color: #c73c6b;
}

/* History and forum pages reuse one compact bordered canvas. */
body[data-reference-ui="1"] .c1588-secondary-page .c1588-card,
body[data-reference-ui="1"] .c1588-secondary-page .c1588-empty-state {
    border: 1px solid var(--1588-ref-blue);
    border-radius: 2px;
    box-shadow: none;
}

body[data-reference-ui="1"] .c1588-secondary-page .c1588-secondary-hero .c1588-card__header,
body[data-reference-ui="1"] .c1588-secondary-page .c1588-secondary-results > .c1588-card__header,
body[data-reference-ui="1"] .c1588-secondary-page .c1588-secondary-article > .c1588-card__header {
    color: #fff;
    background: linear-gradient(90deg, #4292ef, #5aa1f5);
    border-bottom: 0;
}

body[data-reference-ui="1"] .c1588-secondary-page .c1588-card__title {
    color: inherit;
}

body[data-reference-ui="1"] .c1588-secondary-page .c1588-secondary-hero > .c1588-card__body {
    padding: 12px;
}

body[data-reference-ui="1"] .c1588-secondary-page .c1588-secondary-filter {
    border-color: #cfe6fb;
}

body[data-reference-ui="1"] .c1588-secondary-page .c1588-form__control {
    min-height: 36px;
    border: 1px solid #c7d9e9;
    border-radius: 2px;
}

body[data-reference-ui="1"] .c1588-secondary-page .c1588-button {
    min-height: 36px;
    border-radius: 2px;
}

body[data-reference-ui="1"] .c1588-secondary-page .c1588-button--primary {
    background: var(--1588-ref-green);
    border-color: var(--1588-ref-green);
}

body[data-reference-ui="1"] .c1588-secondary-page .c1588-table-wrap {
    overflow-x: auto;
}

body[data-reference-ui="1"] .c1588-secondary-page .c1588-table th {
    background: var(--1588-ref-blue-soft);
    color: var(--1588-ref-blue-dark);
}

body[data-reference-ui="1"] .c1588-secondary-page .c1588-table td,
body[data-reference-ui="1"] .c1588-secondary-page .c1588-table th {
    border-color: var(--1588-ref-line);
}

body[data-reference-ui="1"] .c1588-secondary-page .c1588-forum-tabs {
    gap: 4px;
}

body[data-reference-ui="1"] .c1588-secondary-page .c1588-forum-tabs__link {
    border: 1px solid #cfe6fb;
    border-radius: 2px;
    background: var(--1588-ref-blue-soft);
    color: var(--1588-ref-blue-dark);
}

body[data-reference-ui="1"] .c1588-secondary-page .c1588-forum-tabs__link.is-active {
    background: var(--1588-ref-green);
    border-color: var(--1588-ref-green);
    color: #fff;
}

body[data-reference-ui="1"] .c1588-secondary-page .c1588-forum-list {
    border: 0;
}

body[data-reference-ui="1"] .c1588-secondary-page .c1588-forum-list__item {
    border-bottom-color: #ffe0e9;
}

body[data-reference-ui="1"] .c1588-site-footer {
    width: 100%;
    max-width: var(--1588-ref-width);
    margin: 0 auto;
    border-radius: 0;
    box-shadow: none;
}

body[data-reference-ui="1"] .c1588-mobile-nav {
    right: auto;
    bottom: 0;
    left: 50%;
    z-index: 40;
    width: min(100%, var(--1588-ref-width));
    min-height: 66px;
    transform: translateX(-50%);
    border-top: 1px solid #dbe6ef;
    border-radius: 0;
    background: rgba(255, 255, 255, .98);
    box-shadow: 0 -2px 12px rgba(31, 73, 106, .12);
}

body[data-reference-ui="1"] .c1588-mobile-nav__link {
    min-height: 66px;
    color: #7d8b99;
}

body[data-reference-ui="1"] .c1588-mobile-nav__link.is-active,
body[data-reference-ui="1"] .c1588-mobile-nav__link:hover {
    color: var(--1588-ref-blue);
}

body[data-reference-ui="1"] .c1588-mobile-nav__link--featured {
    color: #fff;
}

body[data-reference-ui="1"] .c1588-mobile-nav__link--featured span {
    background: var(--1588-ref-green);
    border-color: var(--1588-ref-green);
}

@media (min-width: 721px) {
    body[data-reference-ui="1"] .c1588-home-draw-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    body[data-reference-ui="1"] .c1588-home-draw-grid article {
        min-width: 0;
    }

    body[data-reference-ui="1"] .c1588-home-draw-grid article p {
        display: block !important;
    }

    body[data-reference-ui="1"] .c1588-home-balls {
        flex-wrap: wrap;
    }

    body[data-reference-ui="1"] .c1588-home-draw-grid p > a {
        float: none;
    }
}

@media (max-width: 480px) {
    body[data-reference-ui="1"] .c1588-topbar__title {
        font-size: 16px;
    }

    body[data-reference-ui="1"] .c1588-portal-reference-channels {
        grid-template-columns: repeat(4, minmax(0, 1fr));
    }

    body[data-reference-ui="1"] .c1588-portal-reference-channels a:last-child {
        grid-column: span 2;
    }

    body[data-reference-ui="1"] .c1588-portal-draw__heading {
        grid-template-columns: 1fr auto;
    }

    body[data-reference-ui="1"] .c1588-portal-draw__heading > span {
        grid-column: 1 / -1;
        grid-row: 2;
    }

    body[data-reference-ui="1"] .c1588-portal-draw__heading > a {
        grid-column: 2;
        grid-row: 1;
    }

    body[data-reference-ui="1"] .c1588-portal-tools {
        grid-template-columns: repeat(4, minmax(0, 1fr));
    }

    body[data-reference-ui="1"] .c1588-portal-links a {
        min-height: 34px;
        font-size: 12px;
    }
}

@media (max-width: 360px) {
    body[data-reference-ui="1"] .c1588-brand__logo {
        width: 88px;
    }

    body[data-reference-ui="1"] .c1588-topbar__title {
        display: none;
    }

    body[data-reference-ui="1"] .c1588-portal-balls {
        gap: 1px;
        padding-inline: 2px;
    }

    body[data-reference-ui="1"] .c1588-portal-ball > b {
        width: 34px;
        height: 34px;
    }
}
/* 1588 RED THEME OVERRIDES 20260930 */
:root {
    --1588-ref-blue: #b21f35;
    --1588-ref-blue-dark: #7f1123;
    --1588-ref-blue-soft: #fff0f2;
    --1588-ref-coral: #d73b50;
    --1588-ref-coral-soft: #fff3f4;
    --1588-ref-line: #efd9dd;
    --1588-ref-text: #4b2830;
    --1588-ref-muted: #9a6b73;
    --1588-ref-canvas: #f6e9eb;
    --1588-ref-green: #b21f35;
}
body[data-reference-ui="1"] > .c1588-topbar {
    background: linear-gradient(90deg, #8f1326 0%, #b21f35 28%, #cf3b50 50%, #b21f35 72%, #8f1326 100%);
    box-shadow: 0 1px 5px rgba(127, 17, 35, .22);
}
body[data-reference-ui="1"] .c1588-secondary-page .c1588-secondary-hero > .c1588-card__header,
body[data-reference-ui="1"] .c1588-secondary-page .c1588-secondary-results > .c1588-card__header,
body[data-reference-ui="1"] .c1588-secondary-page .c1588-secondary-article > .c1588-card__header {
    background: linear-gradient(90deg, #8f1326, #cf3b50);
}
body[data-reference-ui="1"] .c1588-mobile-nav__link--featured span {
    background: #b21f35;
    border-color: #b21f35;
}

/* Compact the topbar actions into a single line. */
body[data-site="1588"] .c1588-header-actions--icons {
    width: min(25vw, 95px);
    max-width: calc(100% - 112px);
    flex: 0 1 auto;
    align-items: center;
    justify-content: space-between;
    gap: 2px;
    margin-left: auto;
}
body[data-site="1588"] .c1588-header-actions--icons > a,
body[data-site="1588"] .c1588-header-actions--icons > button {
    display: inline-flex;
    width: auto;
    min-height: 30px;
    flex-direction: row;
    align-items: center;
    justify-content: center;
    gap: 2px;
    padding: 0 2px;
    white-space: nowrap;
}
body[data-site="1588"] .c1588-header-actions--icons svg {
    display: none;
}
body[data-site="1588"] .c1588-header-actions--icons small {
    margin: 0;
    font-size: 9px;
    line-height: 1;
    white-space: nowrap;
}
body[data-site="1588"] .c1588-header-public-note {
    flex: 0 0 auto;
    font-size: 9px;
    line-height: 1;
    white-space: nowrap;
}
@media (max-width: 360px) {
    body[data-site="1588"] .c1588-header-actions--icons { gap: 1px; }
    body[data-site="1588"] .c1588-header-actions--icons > a,
    body[data-site="1588"] .c1588-header-actions--icons > button { gap: 2px; padding-inline: 0; }
    body[data-site="1588"] .c1588-header-actions--icons svg { width: 14px; height: 14px; flex-basis: 14px; }
    body[data-site="1588"] .c1588-header-actions--icons small { font-size: 8px; }
    body[data-site="1588"] .c1588-header-public-note { font-size: 8px; }
}


/* Keep every homepage banner uncropped and size the carousel to the active artwork. */
body[data-reference-ui="1"] .c1588-banner-carousel {
    height: auto !important;
    aspect-ratio: var(--banner-aspect-ratio, 2.68) !important;
}
body[data-reference-ui="1"] .c1588-banner-carousel__viewport,
body[data-reference-ui="1"] .c1588-banner-carousel__track,
body[data-reference-ui="1"] .c1588-banner-carousel__slide {
    height: 100% !important;
    min-height: 0 !important;
}
body[data-reference-ui="1"] .c1588-banner-carousel__slide img {
    width: 100%;
    height: 100% !important;
    object-fit: contain !important;
    object-position: center;
    background: #fff;
}


/* Render the active banner directly so every slide paints reliably. */
body[data-reference-ui="1"] .c1588-banner-carousel__track {
    position: absolute !important;
    inset: 0;
    display: block !important;
    width: 100%;
    transform: none !important;
    transition: none !important;
    will-change: auto !important;
}
body[data-reference-ui="1"] .c1588-banner-carousel__slide {
    position: absolute !important;
    inset: 0;
    display: none !important;
    width: 100%;
    min-width: 0 !important;
}
body[data-reference-ui="1"] .c1588-banner-carousel__slide.is-active {
    display: block !important;
}


/* Match each homepage result label to the wave color of its number. */
body[data-reference-ui="1"] .c1588-home-draw-grid .ref-home-result-card .ref-home-ball__label {
    background: var(--ref-home-ball-color) !important;
    color: #ffffff !important;
}


/* Match all four flat-card number and zodiac/element bands to the live topbar colors. */
body[data-reference-ui="1"] .c1588-home-draw-grid .ref-home-ball--red { --ref-home-ball-color: #e8190c; }
body[data-reference-ui="1"] .c1588-home-draw-grid .ref-home-ball--blue { --ref-home-ball-color: #2389e8; }
body[data-reference-ui="1"] .c1588-home-draw-grid .ref-home-ball--green { --ref-home-ball-color: #22b322; }


/* Home result card typography: smaller action links and regular Heiti for balls. */
body[data-reference-ui="1"] .c1588-home-draw-grid .ref-home-result-card .c1588-home-draw-links a {
    font-size: 10.8px !important;
    font-weight: 400 !important;
}
body[data-reference-ui="1"] .c1588-home-draw-grid .ref-home-result-card .ref-home-ball__num,
body[data-reference-ui="1"] .c1588-home-draw-grid .ref-home-result-card .ref-home-ball__label,
body[data-reference-ui="1"] .c1588-home-draw-grid .ref-home-result-card .ref-home-ball__label i {
    font-family: "SimHei", "黑体", "Microsoft YaHei", sans-serif !important;
    font-weight: 400 !important;
}
\n\n

/* Reproduce the supplied four-lottery draw-card layout. */
body[data-reference-ui="1"] .c1588-home-draw-grid {
    display: block !important;
    box-sizing: border-box;
    width: 100%;
    padding: 4px 6px !important;
    gap: 0 !important;
    border: 1px solid #2389e8 !important;
    border-radius: 2px !important;
    background: #ffffff !important;
}
body[data-reference-ui="1"] .c1588-home-draw-grid .ref-home-result-card {
    display: grid !important;
    grid-template-columns: minmax(0, 36fr) minmax(0, 24fr) minmax(0, 40fr) !important;
    grid-template-rows: auto auto auto !important;
    align-items: center !important;
    column-gap: 0 !important;
    row-gap: 2px !important;
    box-sizing: border-box;
    margin: 0 !important;
    padding: 5px 2px 6px !important;
    border: 0 !important;
    border-radius: 0 !important;
    box-shadow: none !important;
    background: #ffffff !important;
    color: #333333 !important;
    font-family: "SimHei", "黑体", "Microsoft YaHei", sans-serif !important;
    font-size: clamp(14px, 2.9vw, 24px) !important;
    line-height: 1.35;
}
body[data-reference-ui="1"] .c1588-home-draw-grid .ref-home-result-card > h2 {
    grid-column: 1;
    grid-row: 1;
    display: block !important;
    min-width: 0;
    margin: 0 !important;
    color: #333333 !important;
    font-size: 1em !important;
    font-weight: 400 !important;
    line-height: 1.2;
    white-space: nowrap;
}
body[data-reference-ui="1"] .c1588-home-draw-grid .ref-home-result-card .c1588-home-current-issue,
body[data-reference-ui="1"] .c1588-home-draw-grid .ref-home-result-card .c1588-home-next-issue {
    color: #e8190c !important;
    font-weight: 400 !important;
}
body[data-reference-ui="1"] .c1588-home-draw-grid .ref-home-result-card > .ref-home-result-card__meta {
    display: contents !important;
    margin: 0 !important;
    padding: 0 !important;
}
body[data-reference-ui="1"] .c1588-home-draw-grid .ref-home-result-card .c1588-home-countdown {
    grid-column: 2;
    grid-row: 1;
    display: block;
    min-width: 0;
    color: #333333 !important;
    font-size: 1em !important;
    font-weight: 700 !important;
    text-align: center;
    white-space: nowrap;
}
body[data-reference-ui="1"] .c1588-home-draw-grid .ref-home-result-card .c1588-home-draw-links {
    grid-column: 3;
    grid-row: 1;
    display: inline-flex !important;
    align-items: center;
    justify-content: flex-end !important;
    gap: 0.3em !important;
    min-width: 0;
    white-space: nowrap;
}
body[data-reference-ui="1"] .c1588-home-draw-grid .ref-home-result-card .c1588-home-draw-links a {
    color: #e8190c !important;
    font-size: 1em !important;
    font-weight: 400 !important;
    line-height: 1.2;
    text-decoration: none;
}
body[data-reference-ui="1"] .c1588-home-draw-grid .c1588-home-history-link::before {
    content: "" !important;
    margin: 0 !important;
}
body[data-reference-ui="1"] .c1588-home-draw-grid .ref-home-result-card .c1588-home-balls {
    grid-column: 1 / -1;
    grid-row: 2;
    display: flex !important;
    align-items: stretch;
    justify-content: space-between;
    gap: clamp(2px, 0.5vw, 6px) !important;
    width: 100%;
    min-width: 0;
    margin: 0 !important;
}
body[data-reference-ui="1"] .c1588-home-draw-grid .ref-home-result-card .c1588-home-mini-ball {
    display: flex !important;
    flex: 1 1 0 !important;
    flex-direction: column !important;
    align-items: center !important;
    justify-content: flex-start !important;
    box-sizing: border-box;
    min-width: 0;
    margin: 0 !important;
    padding: 0 3px 7px !important;
    overflow: hidden;
    border-radius: 4px !important;
    background: var(--ref-home-ball-color) !important;
}
body[data-reference-ui="1"] .c1588-home-draw-grid .ref-home-result-card .ref-home-ball__num {
    display: block;
    width: 100%;
    margin: 0 !important;
    padding: 5px 0 !important;
    background: transparent !important;
    color: #ffffff !important;
    font-family: "SimHei", "黑体", "Microsoft YaHei", sans-serif !important;
    font-size: 1.5em !important;
    font-weight: 900 !important;
    line-height: 1 !important;
    text-align: center;
}
body[data-reference-ui="1"] .c1588-home-draw-grid .ref-home-result-card .ref-home-ball__label {
    display: block !important;
    width: max-content;
    max-width: 100%;
    min-height: 0 !important;
    margin: 0 auto !important;
    padding: 0 4px !important;
    border-radius: 4px !important;
    background: #ffffff !important;
    color: #333333 !important;
    font-family: "SimHei", "黑体", "Microsoft YaHei", sans-serif !important;
    font-size: 0.8em !important;
    font-weight: 400 !important;
    line-height: 1.5 !important;
    white-space: nowrap !important;
}
body[data-reference-ui="1"] .c1588-home-draw-grid .ref-home-result-card .ref-home-ball__label i {
    color: inherit !important;
    font-family: inherit !important;
    font-style: normal !important;
    font-weight: 400 !important;
}
body[data-reference-ui="1"] .c1588-home-draw-grid .ref-home-result-card .c1588-home-plus {
    display: flex !important;
    flex: 0 0 clamp(18px, 4vw, 44px) !important;
    align-items: center;
    justify-content: center;
    margin: 0 !important;
    padding: 0 !important;
    color: #333333 !important;
    font-size: 2em !important;
    font-weight: 900 !important;
    line-height: 1;
}
body[data-reference-ui="1"] .c1588-home-draw-grid .ref-home-result-card .c1588-home-next-row {
    grid-column: 1 / -1;
    grid-row: 3;
    display: flex !important;
    align-items: center;
    justify-content: space-between;
    gap: 0.35em;
    width: 100%;
    min-width: 0;
    margin: 0 !important;
    padding: 3px 0 !important;
    border-bottom: 1px dashed #cccccc;
    color: #333333 !important;
    font-size: 0.95em !important;
    font-weight: 400 !important;
    line-height: 1.35;
}
body[data-reference-ui="1"] .c1588-home-draw-grid .ref-home-result-card .c1588-home-next {
    display: block;
    flex: 1 1 auto;
    min-width: 0;
    margin: 0 !important;
    padding: 0 !important;
    border: 0 !important;
    color: #333333 !important;
    font-size: 1em !important;
    font-weight: 400 !important;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
body[data-reference-ui="1"] .c1588-home-draw-grid .ref-home-result-card .c1588-home-refresh {
    display: inline-flex;
    flex: 0 0 auto;
    align-items: center;
    justify-content: center;
    margin: 0 0 0 auto !important;
    padding: 2px 4px !important;
    border: 0 !important;
    border-radius: 4px !important;
    background: #ff9900 !important;
    color: #ffffff !important;
    font-family: inherit !important;
    font-size: 0.9em !important;
    font-weight: 400 !important;
    line-height: 1 !important;
    cursor: pointer;
}
@media (max-width: 560px) {
    body[data-reference-ui="1"] .c1588-home-draw-grid .ref-home-result-card {
        grid-template-columns: minmax(0, 1fr) minmax(0, 0.8fr) minmax(0, 1.15fr) !important;
        font-size: clamp(12px, 3.2vw, 16px) !important;
    }
    body[data-reference-ui="1"] .c1588-home-draw-grid .ref-home-result-card .c1588-home-countdown { font-size: 0.82em !important; }
    body[data-reference-ui="1"] .c1588-home-draw-grid .ref-home-result-card .c1588-home-draw-links { gap: 0.2em !important; }
    body[data-reference-ui="1"] .c1588-home-draw-grid .ref-home-result-card .c1588-home-draw-links a { font-size: 0.72em !important; }
    body[data-reference-ui="1"] .c1588-home-draw-grid .ref-home-result-card .c1588-home-balls { gap: 2px !important; }
    body[data-reference-ui="1"] .c1588-home-draw-grid .ref-home-result-card .c1588-home-mini-ball { padding: 0 1px 4px !important; }
    body[data-reference-ui="1"] .c1588-home-draw-grid .ref-home-result-card .ref-home-ball__num { font-size: 1.25em !important; }
    body[data-reference-ui="1"] .c1588-home-draw-grid .ref-home-result-card .ref-home-ball__label { padding: 0 2px !important; font-size: 0.62em !important; }
    body[data-reference-ui="1"] .c1588-home-draw-grid .ref-home-result-card .c1588-home-plus { flex-basis: 12px !important; font-size: 1.5em !important; }
    body[data-reference-ui="1"] .c1588-home-draw-grid .ref-home-result-card .c1588-home-next-row { font-size: 0.8em !important; }
}

body[data-reference-ui="1"] .c1588-home-draw-grid.ref-home-result-list { border-color: #2389e8 !important; }


/* Final sizing pass so the four cards keep the reference proportions on wide and narrow screens. */
body[data-reference-ui="1"] section.c1588-home-draw-grid.ref-home-result-list {
    border: 1px solid #2389e8 !important;
}
body[data-reference-ui="1"] .c1588-home-draw-grid .ref-home-result-card .c1588-home-countdown,
body[data-reference-ui="1"] .c1588-home-draw-grid .ref-home-result-card .c1588-home-draw-links,
body[data-reference-ui="1"] .c1588-home-draw-grid .ref-home-result-card .c1588-home-next-row,
body[data-reference-ui="1"] .c1588-home-draw-grid .ref-home-result-card .c1588-home-mini-ball {
    font-size: clamp(14px, 2.9vw, 24px) !important;
}
@media (max-width: 560px) {
    body[data-reference-ui="1"] .c1588-home-draw-grid .ref-home-result-card .c1588-home-countdown,
    body[data-reference-ui="1"] .c1588-home-draw-grid .ref-home-result-card .c1588-home-draw-links,
    body[data-reference-ui="1"] .c1588-home-draw-grid .ref-home-result-card .c1588-home-draw-links a,
    body[data-reference-ui="1"] .c1588-home-draw-grid .ref-home-result-card .c1588-home-next-row,
    body[data-reference-ui="1"] .c1588-home-draw-grid .ref-home-result-card .c1588-home-mini-ball {
        font-size: clamp(14px, 3vw, 18px) !important;
    }
    body[data-reference-ui="1"] .c1588-home-draw-grid .ref-home-result-card .ref-home-ball__num { font-size: 1.5em !important; }
    body[data-reference-ui="1"] .c1588-home-draw-grid .ref-home-result-card .ref-home-ball__label { font-size: 0.8em !important; }
    body[data-reference-ui="1"] .c1588-home-draw-grid .ref-home-result-card .c1588-home-plus { font-size: 2em !important; }
}
