html, body {
    font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
}

a, .btn-link {
    color: #006bb7;
}

.btn-primary {
    color: #fff;
    background-color: #1b6ec2;
    border-color: #1861ac;
}

.btn:focus, .btn:active:focus, .btn-link.nav-link:focus, .form-control:focus, .form-check-input:focus {
  box-shadow: 0 0 0 0.1rem white, 0 0 0 0.25rem #258cfb;
}

.content {
    padding-top: 1.1rem;
}

h1:focus {
    outline: none;
}

.valid.modified:not([type=checkbox]) {
    outline: 1px solid #26b050;
}

.invalid {
    outline: 1px solid #e50000;
}

.validation-message {
    color: #e50000;
}

.blazor-error-boundary {
    background: url(data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNTYiIGhlaWdodD0iNDkiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIG92ZXJmbG93PSJoaWRkZW4iPjxkZWZzPjxjbGlwUGF0aCBpZD0iY2xpcDAiPjxyZWN0IHg9IjIzNSIgeT0iNTEiIHdpZHRoPSI1NiIgaGVpZ2h0PSI0OSIvPjwvY2xpcFBhdGg+PC9kZWZzPjxnIGNsaXAtcGF0aD0idXJsKCNjbGlwMCkiIHRyYW5zZm9ybT0idHJhbnNsYXRlKC0yMzUgLTUxKSI+PHBhdGggZD0iTTI2My41MDYgNTFDMjY0LjcxNyA1MSAyNjUuODEzIDUxLjQ4MzcgMjY2LjYwNiA1Mi4yNjU4TDI2Ny4wNTIgNTIuNzk4NyAyNjcuNTM5IDUzLjYyODMgMjkwLjE4NSA5Mi4xODMxIDI5MC41NDUgOTIuNzk1IDI5MC42NTYgOTIuOTk2QzI5MC44NzcgOTMuNTEzIDI5MSA5NC4wODE1IDI5MSA5NC42NzgyIDI5MSA5Ny4wNjUxIDI4OS4wMzggOTkgMjg2LjYxNyA5OUwyNDAuMzgzIDk5QzIzNy45NjMgOTkgMjM2IDk3LjA2NTEgMjM2IDk0LjY3ODIgMjM2IDk0LjM3OTkgMjM2LjAzMSA5NC4wODg2IDIzNi4wODkgOTMuODA3MkwyMzYuMzM4IDkzLjAxNjIgMjM2Ljg1OCA5Mi4xMzE0IDI1OS40NzMgNTMuNjI5NCAyNTkuOTYxIDUyLjc5ODUgMjYwLjQwNyA1Mi4yNjU4QzI2MS4yIDUxLjQ4MzcgMjYyLjI5NiA1MSAyNjMuNTA2IDUxWk0yNjMuNTg2IDY2LjAxODNDMjYwLjczNyA2Ni4wMTgzIDI1OS4zMTMgNjcuMTI0NSAyNTkuMzEzIDY5LjMzNyAyNTkuMzEzIDY5LjYxMDIgMjU5LjMzMiA2OS44NjA4IDI1OS4zNzEgNzAuMDg4N0wyNjEuNzk1IDg0LjAxNjEgMjY1LjM4IDg0LjAxNjEgMjY3LjgyMSA2OS43NDc1QzI2Ny44NiA2OS43MzA5IDI2Ny44NzkgNjkuNTg3NyAyNjcuODc5IDY5LjMxNzkgMjY3Ljg3OSA2Ny4xMTgyIDI2Ni40NDggNjYuMDE4MyAyNjMuNTg2IDY2LjAxODNaTTI2My41NzYgODYuMDU0N0MyNjEuMDQ5IDg2LjA1NDcgMjU5Ljc4NiA4Ny4zMDA1IDI1OS43ODYgODkuNzkyMSAyNTkuNzg2IDkyLjI4MzcgMjYxLjA0OSA5My41Mjk1IDI2My41NzYgOTMuNTI5NSAyNjYuMTE2IDkzLjUyOTUgMjY3LjM4NyA5Mi4yODM3IDI2Ny4zODcgODkuNzkyMSAyNjcuMzg3IDg3LjMwMDUgMjY2LjExNiA4Ni4wNTQ3IDI2My41NzYgODYuMDU0N1oiIGZpbGw9IiNGRkU1MDAiIGZpbGwtcnVsZT0iZXZlbm9kZCIvPjwvZz48L3N2Zz4=) no-repeat 1rem/1.8rem, #b32121;
    padding: 1rem 1rem 1rem 3.7rem;
    color: white;
}

    .blazor-error-boundary::after {
        content: "An error has occurred."
    }

#blazor-error-ui {
    color-scheme: light only;
    background: lightyellow;
    bottom: 0;
    box-shadow: 0 -1px 2px rgba(0, 0, 0, 0.2);
    box-sizing: border-box;
    display: none;
    left: 0;
    padding: 0.6rem 1.25rem 0.7rem 1.25rem;
    position: fixed;
    width: 100%;
    z-index: 1000;
}

#blazor-error-ui .dismiss {
    cursor: pointer;
    position: absolute;
    right: 0.75rem;
    top: 0.5rem;
}

.darker-border-checkbox.form-check-input {
    border-color: #929292;
}

/* Per-game history page. The Macau number-grid style intentionally mirrors the
   compact 820px public reference layout without depending on third-party CSS or images. */
.public-history-layout {
    min-height: 100vh;
    background: #fff;
    color: #333;
    font-family: "Microsoft YaHei", SimSun, "Helvetica Neue", Arial, sans-serif;
}

.history-loading,
.history-empty,
.public-history-standard {
    width: min(100% - 24px, 820px);
    margin: 0 auto;
    padding: 24px 0;
}

.macau-history {
    width: min(100%, 820px);
    margin: 0 auto;
    background: #fff;
}

.macau-history-toolbar {
    position: sticky;
    z-index: 20;
    top: 0;
    width: 100%;
    padding-bottom: 20px;
    background: #fff;
}

.macau-history-refresh,
.macau-history-pager button {
    appearance: none;
    border: 0;
    border-radius: 0;
    background: #00785e;
    color: #fff;
    cursor: pointer;
    font: inherit;
}

.macau-history-refresh {
    height: 31px;
    margin-bottom: 10px;
    padding: 0 10px;
    font-size: 16px;
}

.macau-history-options {
    min-height: 66px;
    padding: 10px;
    border: 1px solid #d3d3d3;
    color: #999;
    font-size: 14px;
    line-height: 22px;
}

.macau-history-options strong {
    color: #00785e;
}

.macau-history-options label {
    margin-right: 10px;
    cursor: pointer;
    white-space: nowrap;
}

.macau-history-options input {
    vertical-align: -1px;
}

.macau-history-list {
    border: 1px solid #eee;
    border-top: 0;
}

.macau-history-record {
    margin: 0;
    background: #fff;
}

.macau-history-title {
    height: 30px;
    padding: 0 10px;
    overflow: hidden;
    background: #eee;
    color: #777;
    font-size: 14px;
    line-height: 30px;
    white-space: nowrap;
}

.macau-history-title span {
    color: #007ffe;
    font-weight: 700;
}

.macau-history-numbers {
    display: grid;
    grid-template-columns: repeat(6, minmax(0, 1fr)) .53fr minmax(0, 1fr);
    min-height: 81px;
    padding-top: 8px;
    text-align: center;
}

.macau-history-number {
    min-width: 0;
}

.macau-history-ball {
    position: relative;
    width: 35px;
    height: 35px;
    margin: 0 auto;
    border-radius: 50%;
    color: #222;
    font-size: 18px;
    font-weight: 700;
    line-height: 31px;
    text-align: center;
    text-shadow: 0 1px 0 #fff;
    box-shadow: inset 0 0 0 2px var(--history-ball-color), 0 1px 1px rgba(0, 0, 0, .22);
    background:
        radial-gradient(circle at 34% 28%, rgba(255, 255, 255, .98) 0 27%, rgba(255, 255, 255, .25) 45%, transparent 47%),
        linear-gradient(145deg, #fff 0 55%, var(--history-ball-color) 56% 75%, #eee 76% 100%);
}

.macau-history-ball::after {
    position: absolute;
    right: 3px;
    bottom: 3px;
    width: 9px;
    height: 5px;
    border-radius: 50%;
    background: rgba(255, 255, 255, .78);
    content: "";
    transform: rotate(-30deg);
}

.macau-history-ball--red { --history-ball-color: #e41f26; }
.macau-history-ball--blue { --history-ball-color: #1684bd; }
.macau-history-ball--green { --history-ball-color: #51a531; }
.macau-history-ball--neutral { --history-ball-color: #999; }

.macau-history-attribute,
.macau-history-wave {
    min-height: 30px;
    margin-top: 8px;
    border-top: 1px solid #eee;
    font-size: 16px;
    line-height: 30px;
}

.macau-history-slash { color: #c6c6c6; }
.macau-history-five--metal { color: #6bca79; }
.macau-history-five--wood { color: #61c879; }
.macau-history-five--water { color: #4ac792; }
.macau-history-five--fire { color: #78c86a; }
.macau-history-five--earth { color: #62c879; }
.macau-history-five--none { color: #aaa; }
.macau-history-wave--red { color: #e41f26; }
.macau-history-wave--blue { color: #1684bd; }
.macau-history-wave--green { color: #51a531; }
.macau-history-wave--neutral { color: #999; }

.macau-history-plus {
    height: 35px;
    color: #cfcfcf;
    font-size: 49px;
    font-weight: 800;
    line-height: 31px;
}

.macau-history-pager {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 14px;
    min-height: 56px;
    color: #777;
    font-size: 14px;
}

.macau-history-pager button {
    padding: 6px 12px;
}

@media (max-width: 600px) {
    .macau-history-toolbar {
        padding-bottom: 12px;
    }

    .macau-history-options {
        min-height: 72px;
        font-size: 13px;
    }

    .macau-history-options label {
        margin-right: 4px;
    }

    .macau-history-title {
        padding: 0 6px;
        font-size: 12px;
    }

    .macau-history-numbers {
        min-height: 73px;
    }

    .macau-history-ball {
        width: 31px;
        height: 31px;
        font-size: 16px;
        line-height: 28px;
    }

    .macau-history-plus {
        height: 31px;
        font-size: 42px;
        line-height: 27px;
    }

    .macau-history-attribute,
    .macau-history-wave {
        min-height: 26px;
        margin-top: 7px;
        font-size: 13px;
        line-height: 26px;
    }
}

:root {
    --ink: #18211d;
    --muted: #66736c;
    --line: #dfe7e1;
    --surface: #ffffff;
    --canvas: #f3f6f2;
    --accent: #176b4d;
    --accent-soft: #e7f3ed;
}

html, body {
    color: var(--ink);
    background: var(--canvas);
    font-family: Inter, "Segoe UI", "Microsoft YaHei", sans-serif;
}

h1, h2, h3 {
    letter-spacing: -0.025em;
}

h1 {
    font-size: clamp(2rem, 4vw, 3rem);
    font-weight: 720;
}

h2 {
    font-size: 1.15rem;
    font-weight: 700;
}

h3 {
    font-size: 1rem;
    font-weight: 700;
}

.content {
    width: min(1500px, 100%);
    margin: 0 auto;
    padding-bottom: 4rem;
}

.btn-primary {
    background: var(--accent);
    border-color: var(--accent);
}

.btn-primary:hover {
    background: #10563d;
    border-color: #10563d;
}

.page-heading {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 1.5rem;
    margin: 1.25rem 0 1.75rem;
}

.eyebrow {
    margin: 0 0 .35rem;
    color: var(--accent);
    font-size: .72rem;
    font-weight: 800;
    letter-spacing: .16em;
}

.panel,
.status-card,
.game-card,
.empty-state,
.auth-panel {
    border: 1px solid var(--line);
    border-radius: 14px;
    background: var(--surface);
    box-shadow: 0 8px 30px rgba(24, 33, 29, .04);
}

.panel {
    padding: 1.25rem;
}

.order-list-filters {
    padding: 1rem;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: var(--accent-soft);
}

.order-list-filters .form-label {
    margin-bottom: .35rem;
    font-weight: 700;
}

.empty-state,
.auth-panel,
.status-page {
    padding: 2.5rem;
}

.auth-panel {
    width: min(580px, 100%);
    margin: 3rem auto;
}

.game-card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1rem;
}

.game-card {
    padding: 1.25rem;
}

.game-card-head,
.setup-summary,
.breakdown-row {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
}

.game-code,
.summary-chip {
    border-radius: 999px;
    background: var(--accent-soft);
    color: var(--accent);
    padding: .3rem .7rem;
    font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
    font-size: .76rem;
    font-weight: 700;
}

.status-dot::before {
    display: inline-block;
    width: .5rem;
    height: .5rem;
    margin-right: .35rem;
    border-radius: 50%;
    background: #9ba59f;
    content: "";
}

.status-dot.active::before {
    background: #1b9b65;
    box-shadow: 0 0 0 4px rgba(27, 155, 101, .12);
}

.card-metrics {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: .75rem;
    margin: 1.5rem 0 0;
}

.card-metrics div {
    border-top: 1px solid var(--line);
    padding-top: .75rem;
}

.card-metrics dt {
    color: var(--muted);
    font-size: .72rem;
}

.card-metrics dd {
    margin: .15rem 0 0;
    font-weight: 700;
}

.waiting-label {
    margin-top: 1.5rem;
    border: 1px dashed #b9c7be;
    border-radius: 10px;
    padding: .9rem;
    color: var(--muted);
    text-align: center;
}

.status-grid,
.risk-summary {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 1rem;
}

.status-card,
.risk-summary > div {
    padding: 1.25rem;
}

.status-card span,
.status-card small,
.risk-summary span {
    display: block;
    color: var(--muted);
    font-size: .8rem;
}

.status-card strong,
.risk-summary strong {
    display: block;
    margin: .35rem 0;
    font-size: 1.25rem;
}

.game-switcher {
    display: flex;
    align-items: center;
    gap: .6rem;
    margin-right: auto;
}

.game-switcher label,
.app-version {
    color: var(--muted);
    font-size: .78rem;
}

.game-switcher select {
    min-width: 180px;
}

.number-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(46px, 1fr));
    gap: .5rem;
}

.number-pick,
.risk-number {
    display: inline-grid;
    place-items: center;
    border-radius: 50%;
    font-weight: 800;
}

.number-pick {
    aspect-ratio: 1;
    border: 2px solid var(--ink);
    background: #f8f9fa; /* 浅灰色背景，提高对比度 */
    color: #212529;
    transition: all 0.2s ease;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.number-pick:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.15);
    border-color: var(--accent);
}

.number-pick.selected {
    border-color: var(--accent);
    background: var(--accent);
    color: white;
}

.calculated-total {
    min-height: 38px;
    border-radius: 8px;
    background: var(--accent-soft);
    padding: .55rem .75rem;
}

.risk-columns {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    margin-top: 1rem;
}

.risk-summary {
    border: 1px solid var(--line);
    border-radius: 14px;
    background: #18211d;
    color: white;
}

.risk-number {
    width: 2rem;
    height: 2rem;
    background: #eef3ef;
}

.risk-row {
    cursor: pointer;
}

.risk-row:hover {
    background: var(--accent-soft);
}

.risk-badge {
    border-radius: 999px;
    padding: .25rem .55rem;
    font-size: .72rem;
    font-weight: 800;
}

.risk-badge.safe { background: #dff4e9; color: #13623f; }
.risk-badge.normal { background: #e9f0ff; color: #29518b; }
.risk-badge.high { background: #fff0d2; color: #855800; }
.risk-badge.critical { background: #ffe0e0; color: #9c2525; }

.filter-pills {
    display: flex;
    flex-wrap: wrap;
    gap: .5rem;
}

.filter-pills label,
.setup-summary span {
    border: 1px solid var(--line);
    border-radius: 999px;
    padding: .4rem .7rem;
    font-size: .8rem;
}

.breakdown-row {
    border-bottom: 1px solid var(--line);
    padding: .65rem 0;
}

.draw-section-heading,
.home-draw-result-head,
.draw-action-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.draw-section-heading h2,
.draw-section-heading p {
    margin-bottom: 0;
}

.draw-section-heading p,
.draw-confirm-panel p,
.draw-confirm-panel small {
    color: var(--muted);
}

.draw-filter-grid {
    display: grid;
    grid-template-columns: minmax(220px, 1fr) minmax(220px, 1fr) minmax(220px, .8fr);
    gap: 1rem;
    margin-top: 1rem;
}

.draw-period-meta {
    display: grid;
    align-content: center;
    border: 1px solid var(--line);
    border-radius: 10px;
    padding: .7rem .85rem;
}

.draw-period-meta span,
.draw-period-meta small {
    color: var(--muted);
    font-size: .75rem;
}

.draw-number-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 1rem;
}

.draw-number-section {
    min-width: 0;
}

.draw-count {
    display: inline-grid;
    place-items: center;
    width: 2.4rem;
    height: 2.4rem;
    border: 1px solid var(--line);
    border-radius: 50%;
    color: var(--muted);
    font-weight: 800;
}

.draw-count.complete {
    border-color: var(--accent);
    background: var(--accent-soft);
    color: var(--accent);
}

.draw-count.special.complete {
    border-color: #b64a32;
    background: #fff0eb;
    color: #a23a25;
}

.selection-tray {
    display: flex;
    min-height: 3rem;
    align-items: center;
    flex-wrap: wrap;
    gap: .45rem;
    margin-top: 1rem;
    border: 1px dashed #bcc9c1;
    border-radius: 10px;
    padding: .55rem;
}

.selection-token {
    border: 0;
    border-radius: 999px;
    padding: .35rem .65rem;
    background: var(--accent);
    color: white;
    font-weight: 800;
}

.selection-token.special {
    background: #b64a32;
}

.selection-token:disabled {
    opacity: .6;
}

.number-pick {
    position: relative;
}

.number-pick small {
    position: absolute;
    right: -.2rem;
    top: -.25rem;
    display: grid;
    min-width: 1.25rem;
    min-height: 1.25rem;
    place-items: center;
    border-radius: 999px;
    background: #18211d;
    color: white;
    font-size: .62rem;
}

.number-pick.special.selected {
    border-color: #b64a32;
    background: #b64a32;
}

.number-pick:disabled:not(.selected) {
    cursor: not-allowed;
    opacity: .38;
}

.draw-live-indicator {
    display: inline-flex;
    align-items: center;
    gap: .4rem;
    color: #91620a;
    font-size: .78rem;
    font-weight: 800;
}

.draw-live-indicator::before {
    width: .55rem;
    height: .55rem;
    border-radius: 50%;
    background: #dca62d;
    box-shadow: 0 0 0 4px rgba(220, 166, 45, .15);
    content: "";
}

.draw-live-indicator.ready {
    color: var(--accent);
}

.draw-live-indicator.ready::before {
    background: #1b9b65;
    box-shadow: 0 0 0 4px rgba(27, 155, 101, .12);
}

.draw-preview-placeholder,
.draw-result-waiting {
    border: 1px dashed #bcc9c1;
    border-radius: 10px;
    padding: 1rem;
    color: var(--muted);
    text-align: center;
}

.draw-preview-placeholder {
    margin-top: 1rem;
}

.draw-metric-grid {
    display: grid;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    gap: .75rem;
    margin-top: 1rem;
}

.draw-metric-grid > div {
    border: 1px solid var(--line);
    border-radius: 10px;
    padding: .8rem;
}

.draw-metric-grid span {
    display: block;
    color: var(--muted);
    font-size: .72rem;
}

.draw-metric-grid strong {
    display: block;
    margin-top: .25rem;
    font-size: 1.15rem;
}

.draw-metric-grid .positive strong {
    color: var(--accent);
}

.draw-metric-grid .negative strong {
    color: #b02d2d;
}

.draw-breakdown-grid,
.draw-history-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 1rem;
}

.draw-action-bar {
    justify-content: flex-start;
    flex-wrap: wrap;
    border-top: 1px solid var(--line);
    padding-top: 1rem;
}

.draw-action-bar > span {
    margin-left: auto;
    font-size: .8rem;
}

.draw-confirm-panel {
    border: 1px solid #e7b0a5;
    border-left: 5px solid #b64a32;
    border-radius: 14px;
    background: #fff9f7;
    box-shadow: 0 10px 35px rgba(120, 47, 31, .08);
    padding: 1.4rem;
}

.draw-confirm-panel.correction {
    border-color: #e7cc8c;
    border-left-color: #b17700;
    background: #fffbef;
}

.draw-confirm-panel h2 {
    margin-bottom: .35rem;
}

.draw-confirm-summary {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: .7rem;
    margin-top: 1rem;
}

.draw-confirm-summary span {
    border: 1px solid rgba(145, 98, 10, .2);
    border-radius: 9px;
    background: rgba(255, 255, 255, .7);
    padding: .7rem;
    color: var(--muted);
    font-size: .75rem;
}

.draw-confirm-summary strong {
    display: block;
    margin-top: .2rem;
    color: var(--ink);
    font-size: 1rem;
}

.home-draw-result {
    margin-top: 1rem;
    border-top: 1px solid var(--line);
    padding-top: 1rem;
}

.home-draw-result-head {
    color: var(--muted);
    font-size: .76rem;
}

.draw-ball-row {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: .4rem;
    margin: .8rem 0;
}

.draw-ball {
    display: inline-grid;
    width: 2rem;
    height: 2rem;
    place-items: center;
    border-radius: 50%;
    background: var(--accent);
    color: white;
    font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
    font-size: .75rem;
    font-weight: 800;
}

.draw-ball.special {
    background: #b64a32;
    box-shadow: 0 0 0 3px rgba(182, 74, 50, .12);
}

.draw-ball-separator {
    color: var(--muted);
    font-weight: 800;
}

.home-settlement-summary {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: .5rem;
    margin: 0;
}

.home-settlement-summary div {
    border-radius: 8px;
    background: #f5f8f5;
    padding: .55rem;
}

.home-settlement-summary dt {
    color: var(--muted);
    font-size: .65rem;
}

.home-settlement-summary dd {
    margin: .15rem 0 0;
    font-size: .8rem;
    font-weight: 800;
}

.draw-result-waiting {
    margin-top: 1rem;
    padding: .7rem;
    font-size: .78rem;
}

@media (max-width: 900px) {
    .risk-columns,
    .status-grid,
    .risk-summary,
    .draw-number-layout,
    .draw-breakdown-grid,
    .draw-history-grid {
        grid-template-columns: 1fr 1fr;
    }

    .draw-filter-grid {
        grid-template-columns: 1fr 1fr;
    }

    .draw-period-meta {
        grid-column: 1 / -1;
    }

    .draw-metric-grid,
    .draw-confirm-summary {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

@media (max-width: 640px) {
    .risk-columns,
    .status-grid,
    .risk-summary,
    .card-metrics,
    .draw-number-layout,
    .draw-breakdown-grid,
    .draw-history-grid,
    .draw-filter-grid,
    .draw-metric-grid,
    .draw-confirm-summary {
        grid-template-columns: 1fr;
    }

    .page-heading {
        display: block;
    }

    .draw-period-meta {
        grid-column: auto;
    }

    .draw-action-bar > span {
        width: 100%;
        margin-left: 0;
    }

    .home-settlement-summary {
        grid-template-columns: 1fr 1fr;
    }
}

.form-floating > .form-control-plaintext::placeholder, .form-floating > .form-control::placeholder {
    color: var(--bs-secondary-color);
    text-align: end;
}

.form-floating > .form-control-plaintext:focus::placeholder, .form-floating > .form-control:focus::placeholder {
    text-align: start;
}

.bet-parser-panel {
    border-color: rgba(88, 101, 242, 0.2);
    background:
        radial-gradient(circle at 95% 0%, rgba(88, 101, 242, 0.1), transparent 28rem),
        var(--surface);
}

.parser-safety-badge {
    border: 1px solid rgba(35, 137, 94, 0.3);
    border-radius: 999px;
    padding: 0.45rem 0.8rem;
    color: #176844;
    background: rgba(35, 137, 94, 0.08);
    font-size: 0.82rem;
    font-weight: 700;
}

.parser-source {
    min-height: 9rem;
    max-height: 32rem;
    overflow-y: hidden;
    resize: vertical;
    font-family: var(--bs-font-monospace);
}

.bet-format-examples {
    border: 1px solid var(--border);
    border-radius: 0.8rem;
    padding: 0.8rem;
    background: color-mix(in srgb, var(--surface) 94%, var(--primary) 6%);
}

.bet-format-examples > summary {
    cursor: pointer;
    font-weight: 800;
}

.bet-format-examples > p {
    margin: 0.65rem 0;
    color: var(--muted);
}

.bet-format-example-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 0.75rem;
}

.bet-format-example-card {
    display: grid;
    align-content: start;
    gap: 0.6rem;
    min-width: 0;
    padding: 0.75rem;
    border: 1px solid var(--border);
    border-radius: 0.7rem;
    background: var(--surface);
}

.bet-format-example-card small {
    display: block;
    margin-top: 0.2rem;
    color: var(--muted);
}

.bet-format-example-card pre {
    max-height: 12rem;
    margin: 0;
    padding: 0.65rem;
    overflow: auto;
    border-radius: 0.55rem;
    color: var(--text);
    background: color-mix(in srgb, var(--surface-2) 88%, transparent);
    font-size: 0.82rem;
    white-space: pre-wrap;
}

.parser-table-shell {
    border: 1px solid var(--border);
    border-radius: .85rem;
    background: color-mix(in srgb, var(--surface) 96%, transparent);
}

.parser-table {
    min-width: 940px;
    margin-bottom: 0;
    table-layout: fixed;
}

.parser-table th,
.parser-table td {
    padding: .8rem .65rem;
}

.parser-table th {
    color: var(--muted);
    font-size: .78rem;
    white-space: nowrap;
}

.parser-table td {
    vertical-align: middle;
}

.parser-table th:nth-child(1) { width: 23%; }
.parser-table th:nth-child(2) { width: 12%; }
.parser-table th:nth-child(3) { width: 19%; }
.parser-table th:nth-child(4) { width: 16%; }
.parser-table th:nth-child(5) { width: auto; }
.parser-table th:nth-child(6) { width: 7rem; }

.parser-action-heading,
.parser-cell-action {
    text-align: center;
}

.parser-line-chip {
    display: inline-flex;
    margin-right: .45rem;
    padding: .15rem .4rem;
    border-radius: 999px;
    color: var(--muted);
    background: color-mix(in srgb, var(--surface-2) 88%, transparent);
    font-size: .72rem;
    font-weight: 700;
    line-height: 1.2;
    white-space: nowrap;
}

.parser-original {
    display: inline-block;
    width: calc(100% - 4.35rem);
    max-width: calc(100% - 4.35rem);
    overflow: hidden;
    text-overflow: ellipsis;
    vertical-align: middle;
    white-space: nowrap;
}

.order-history-table {
    min-width: 1040px;
}

.order-history-content {
    display: block;
    width: 20rem;
    max-width: 20rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.play-template-group {
    margin-top: 1.1rem;
}

.play-template-group h3 {
    margin-bottom: 0.65rem;
    font-size: 1rem;
}

.play-template-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 0.65rem;
}

.play-template-option {
    display: flex;
    align-items: flex-start;
    gap: 0.65rem;
    min-height: 5.1rem;
    padding: 0.75rem;
    border: 1px solid var(--border);
    border-radius: 0.75rem;
    background: color-mix(in srgb, var(--surface) 92%, var(--primary) 8%);
    cursor: pointer;
}

.play-template-option input {
    margin-top: 0.25rem;
    flex: 0 0 auto;
}

.play-template-option span,
.play-template-option small {
    display: block;
}

.play-template-option small {
    margin-top: 0.25rem;
    line-height: 1.35;
}

.parser-number-input {
    width: 100%;
    min-width: 0;
}

.parser-amount-input {
    width: 100%;
    min-width: 0;
    max-width: 8rem;
}

.parser-total-line {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .5rem;
    margin-top: .4rem;
    color: var(--muted);
    font-size: .78rem;
    white-space: nowrap;
}

.parser-play-badge {
    display: inline-flex;
    align-items: center;
    min-width: 5.5rem;
    justify-content: center;
    border: 1px solid transparent;
    border-radius: 999px;
    padding: 0.28rem 0.65rem;
    font-size: 0.82rem;
    font-weight: 800;
    line-height: 1.25;
    white-space: nowrap;
}

.parser-play-badge--special {
    color: #9f1239;
    border-color: rgba(225, 29, 72, 0.28);
    background: rgba(244, 63, 94, 0.13);
}

.parser-play-badge--flat {
    color: #075985;
    border-color: rgba(2, 132, 199, 0.3);
    background: rgba(14, 165, 233, 0.14);
}

.parser-play-badge--zodiac {
    color: #92400e;
    border-color: rgba(217, 119, 6, 0.32);
    background: rgba(245, 158, 11, 0.16);
}

.parser-play-badge--tail {
    color: #6b21a8;
    border-color: rgba(147, 51, 234, 0.3);
    background: rgba(168, 85, 247, 0.14);
}

.parser-play-badge--not-in {
    color: #0f766e;
    border-color: rgba(13, 148, 136, 0.3);
    background: rgba(20, 184, 166, 0.14);
}

.parser-play-badge--hit {
    color: #3730a3;
    border-color: rgba(79, 70, 229, 0.3);
    background: rgba(99, 102, 241, 0.14);
}

.parser-play-badge--property {
    color: #334155;
    border-color: rgba(71, 85, 105, 0.3);
    background: rgba(100, 116, 139, 0.14);
}

.parser-play-badge--red-wave {
    color: #b91c1c;
    border-color: rgba(220, 38, 38, 0.3);
    background: rgba(239, 68, 68, 0.14);
}

.parser-play-badge--blue-wave {
    color: #1d4ed8;
    border-color: rgba(37, 99, 235, 0.3);
    background: rgba(59, 130, 246, 0.14);
}

.parser-play-badge--green-wave {
    color: #15803d;
    border-color: rgba(22, 163, 74, 0.3);
    background: rgba(34, 197, 94, 0.14);
}

.parser-play-badge--wave {
    color: #9a3412;
    border-color: rgba(234, 88, 12, 0.3);
    background: rgba(249, 115, 22, 0.14);
}

.parser-play-badge--other {
    color: var(--text);
    border-color: var(--border);
    background: color-mix(in srgb, var(--surface) 82%, var(--primary) 18%);
}

[data-theme="dark"] .parser-play-badge--special { color: #fda4af; }
[data-theme="dark"] .parser-play-badge--flat { color: #7dd3fc; }
[data-theme="dark"] .parser-play-badge--zodiac { color: #fcd34d; }
[data-theme="dark"] .parser-play-badge--tail { color: #d8b4fe; }
[data-theme="dark"] .parser-play-badge--not-in { color: #5eead4; }
[data-theme="dark"] .parser-play-badge--hit { color: #a5b4fc; }
[data-theme="dark"] .parser-play-badge--property { color: #cbd5e1; }
[data-theme="dark"] .parser-play-badge--red-wave { color: #fca5a5; }
[data-theme="dark"] .parser-play-badge--blue-wave { color: #93c5fd; }
[data-theme="dark"] .parser-play-badge--green-wave { color: #86efac; }
[data-theme="dark"] .parser-play-badge--wave { color: #fdba74; }

.confidence-chip {
    display: inline-flex;
    border-radius: 999px;
    padding: 0.2rem 0.55rem;
    background: rgba(88, 101, 242, 0.1);
    color: #3340a7;
    font-weight: 700;
}

.parser-review-summary {
    display: flex;
    align-items: center;
    min-width: 0;
    gap: .5rem;
    font-size: .82rem;
}

.parser-review-summary > :last-child {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.parser-review-details {
    margin-top: .45rem;
    font-size: 0.82rem;
}

.parser-review-details summary {
    width: max-content;
    max-width: 100%;
    color: var(--primary);
    cursor: pointer;
    font-weight: 700;
    white-space: nowrap;
}

.parser-review-details-body {
    display: grid;
    gap: .3rem;
    margin-top: .5rem;
    padding: .6rem;
    border: 1px solid var(--border);
    border-radius: .6rem;
    background: color-mix(in srgb, var(--surface-2) 84%, transparent);
    line-height: 1.5;
}

.parser-save-button {
    min-width: 5.5rem;
    padding-inline: .7rem;
    white-space: nowrap;
}

.parser-warning {
    color: #9a6700;
    margin-bottom: 0.25rem;
}

.parser-error {
    color: #b42318;
    margin-bottom: 0.25rem;
}

.parser-success {
    color: #176844;
    margin-bottom: 0.25rem;
}

.parser-row-error > td {
    background: rgba(180, 35, 24, 0.035);
}

.parser-row-submitted > td {
    background: rgba(35, 137, 94, 0.05);
}

@media (max-width: 760px) {
    .parser-table-shell {
        overflow: visible;
        border: 0;
        background: transparent;
    }

    .parser-table,
    .parser-table tbody,
    .parser-table tr,
    .parser-table td {
        display: block;
        width: 100%;
    }

    .parser-table {
        min-width: 0;
    }

    .parser-table thead {
        display: none;
    }

    .parser-table tbody {
        display: grid;
        gap: .8rem;
    }

    .parser-table tr {
        overflow: hidden;
        border: 1px solid var(--border);
        border-radius: .8rem;
        background: var(--surface);
    }

    .parser-table td {
        padding: .6rem .75rem;
        border-bottom: 1px solid var(--border);
        text-align: left;
    }

    .parser-table td:last-child {
        border-bottom: 0;
    }

    .parser-table td::before {
        display: block;
        margin-bottom: .35rem;
        color: var(--muted);
        content: attr(data-label);
        font-size: .72rem;
        font-weight: 800;
    }

    .parser-original {
        width: calc(100% - 4.35rem);
        max-width: calc(100% - 4.35rem);
    }

    .parser-amount-input {
        max-width: none;
    }

    .parser-cell-action .parser-save-button {
        width: 100%;
    }
}

/* ==========================================================================
   Admin layout
   ========================================================================== */

.admin-page {
    display: flex;
    min-height: 100vh;
}

.admin-sidebar {
    width: 260px;
    flex-shrink: 0;
    background: #18211d;
}

.admin-main {
    flex: 1;
    min-width: 0;
}

.admin-top-row {
    display: flex;
    align-items: center;
    gap: 1rem;
    height: 3.5rem;
    border-bottom: 1px solid var(--line);
    background: var(--surface);
}

.admin-top-links {
    display: flex;
    align-items: center;
    gap: .75rem;
    margin-left: auto;
}

.admin-content {
    width: min(1500px, 100%);
    margin: 0 auto;
    padding-bottom: 4rem;
    padding-top: 1.1rem;
}

/* ==========================================================================
   Public site layout & styles
   ========================================================================== */

:root {
    --pub-bg: #4169e1;
    --pub-bg-deep: #2a4bc4;
    --pub-surface: #ffffff;
    --pub-ink: #1a1a1a;
    --pub-muted: #6b7280;
    --pub-line: #dbe3f8;
    --pub-red: #dc2626;
    --pub-red-soft: #fef2f2;
    --pub-gold: #d97706;
    --pub-gold-soft: #fffbeb;
    --pub-accent: #b91c1c;
    --pub-green: #2e9e46;
    --pub-orange: #f08300;
}

.public-site {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    background: var(--pub-bg);
    color: var(--pub-ink);
}

.public-header {
    background: linear-gradient(180deg, #3a5fd9 0%, var(--pub-bg-deep) 100%);
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 2px 8px rgba(0, 0, 0, .2);
}

.public-header-inner {
    text-align: center;
    padding: 1rem 1rem .7rem;
}

.public-brand {
    display: inline-flex;
    align-items: center;
    flex-direction: row;
    gap: .2rem;
    text-decoration: none;
}

.public-brand-logo {
    display: block;
    width: auto;
    max-width: 180px;
    height: auto;
    max-height: 58px;
    margin-right: .65rem;
    object-fit: contain;
}

.public-brand-text {
    display: inline-flex;
    flex-direction: column;
    gap: .2rem;
}

.public-brand-name {
    color: #fff;
    font-size: 1.6rem;
    font-weight: 900;
    letter-spacing: .3em;
    text-indent: .3em;
    text-shadow: 0 2px 4px rgba(0, 0, 0, .3);
}

.public-brand-sub {
    color: rgba(255, 255, 255, .85);
    font-size: .75rem;
    letter-spacing: .08em;
}

.public-nav {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1.75rem;
    background: rgba(0, 0, 0, .18);
    padding: .5rem 1rem;
}

.public-nav a {
    color: #fff;
    text-decoration: none;
    font-size: .9rem;
    font-weight: 600;
}

.public-nav a:hover {
    color: #ffd76a;
}

.public-admin-link {
    border: 1px solid rgba(255, 255, 255, .45);
    border-radius: 6px;
    padding: .15rem .6rem;
    font-size: .8rem;
}

.public-main {
    flex: 1;
    max-width: 760px;
    width: 100%;
    margin: 0 auto;
    padding: 1rem 1rem 3rem;
}

.public-footer {
    border-top: 1px solid rgba(255, 255, 255, .25);
    background: transparent;
    text-align: center;
    padding: 1.5rem;
    color: rgba(255, 255, 255, .8);
    font-size: .8rem;
}

.public-eyebrow {
    font-size: .72rem;
    font-weight: 800;
    letter-spacing: .16em;
    text-transform: uppercase;
    color: rgba(255, 255, 255, .75);
    margin-bottom: .5rem;
}

.public-btn-primary {
    display: inline-block;
    background: var(--pub-gold);
    color: white;
    border: none;
    border-radius: 8px;
    padding: .6rem 1.5rem;
    font-weight: 700;
    text-decoration: none;
    font-size: .9rem;
}

.public-btn-primary:hover {
    background: #b45309;
    color: white;
}

.public-btn-outline {
    display: inline-block;
    background: transparent;
    color: white;
    border: 1px solid rgba(255,255,255,.5);
    border-radius: 8px;
    padding: .6rem 1.5rem;
    font-weight: 700;
    text-decoration: none;
    font-size: .9rem;
}

.public-btn-outline:hover {
    background: rgba(255,255,255,.15);
    color: white;
}

/* Public sections */
.public-section {
    margin-bottom: 2.5rem;
}

.public-section-title {
    font-size: 1.2rem;
    font-weight: 700;
    margin-bottom: 1rem;
    padding-bottom: .5rem;
    border-bottom: 2px solid #ffd76a;
    display: inline-block;
    color: #fff;
}

.public-page-head {
    margin-bottom: 1.5rem;
}

.public-page-head h1 {
    font-size: clamp(1.4rem, 3vw, 1.9rem);
    font-weight: 800;
    margin-bottom: .25rem;
    color: #fff;
}

.public-sub {
    color: rgba(255, 255, 255, .85);
    font-size: .9rem;
}

.public-sub a {
    color: #ffd76a;
    text-decoration: none;
}

/* Public balls */
.public-ball-row {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: .35rem;
    margin: .5rem 0;
}

.public-ball {
    display: inline-flex;
    flex-direction: column;
    width: 3.15rem;
    height: 3.15rem;
    overflow: hidden;
    border-radius: 50%;
    background: var(--pub-red);
    color: white;
    font-weight: 800;
    font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
    text-align: center;
}

.public-ball.special {
    background: var(--pub-gold);
    box-shadow: 0 0 0 3px rgba(217, 119, 6, .15);
}

.public-ball-sep {
    color: var(--pub-muted);
    font-weight: 800;
    margin: 0 .15rem;
}

.public-ball .result-ball-number {
    display: grid;
    flex: 1 1 auto;
    min-height: 0;
    place-items: center;
    font-size: 1rem;
    line-height: 1;
}

.public-ball .result-ball-meta {
    display: grid;
    flex: 0 0 18px;
    place-items: center;
    width: 100%;
    overflow: hidden;
    padding: 0 2px;
    color: #111;
    background: rgba(255,255,255,.94);
    font-family: "Microsoft YaHei", sans-serif;
    font-size: .56rem;
    line-height: 1.05;
}

/* Public cards */
.public-result-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1rem;
}

.public-result-card {
    background: var(--pub-surface);
    border: 1px solid var(--pub-line);
    border-radius: 12px;
    padding: 1.25rem;
}

.public-result-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: .5rem;
}

.public-game-tag {
    background: var(--pub-red-soft);
    color: var(--pub-red);
    padding: .2rem .6rem;
    border-radius: 999px;
    font-size: .78rem;
    font-weight: 700;
}

.public-period {
    font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
    font-size: .82rem;
    font-weight: 600;
    color: var(--pub-muted);
}

.public-date {
    color: var(--pub-muted);
    font-size: .8rem;
}

.public-result-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: .5rem;
    font-size: .8rem;
    color: var(--pub-muted);
}

.public-result-meta a {
    color: var(--pub-red);
    text-decoration: none;
    font-weight: 600;
}

.public-result-list {
    display: flex;
    flex-direction: column;
    gap: .75rem;
}

.public-result-row {
    background: var(--pub-surface);
    border: 1px solid var(--pub-line);
    border-radius: 10px;
    padding: 1rem 1.25rem;
}

.public-result-row-head {
    display: flex;
    gap: 1rem;
    align-items: center;
    margin-bottom: .25rem;
}

/* Public game grid */
.public-game-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1rem;
}

.public-game-card {
    background: var(--pub-surface);
    border: 1px solid var(--pub-line);
    border-radius: 12px;
    padding: 1.25rem;
}

.public-game-card h3 {
    font-size: 1.1rem;
    font-weight: 700;
    margin-bottom: .5rem;
}

.public-game-card p {
    color: var(--pub-muted);
    font-size: .85rem;
    margin-bottom: .75rem;
}

.public-game-status {
    border-top: 1px solid var(--pub-line);
    padding-top: .75rem;
    margin-top: .5rem;
}

.public-status-label {
    display: block;
    font-size: .72rem;
    color: var(--pub-muted);
}

.public-game-status strong {
    display: block;
    font-size: 1.1rem;
    margin: .15rem 0;
}

.public-status-sub {
    font-size: .78rem;
    color: var(--pub-muted);
}

.public-game-links {
    display: flex;
    gap: 1rem;
    margin-top: .75rem;
    padding-top: .75rem;
    border-top: 1px solid var(--pub-line);
}

.public-game-links a {
    color: var(--pub-red);
    text-decoration: none;
    font-size: .82rem;
    font-weight: 600;
}

.public-game-list {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1rem;
}

.public-game-link-card {
    background: var(--pub-surface);
    border: 1px solid var(--pub-line);
    border-radius: 12px;
    padding: 1.25rem;
}

.public-game-link-card h3 {
    margin-bottom: .5rem;
}

.public-game-link-card a {
    color: var(--pub-red);
    text-decoration: none;
    font-weight: 600;
}

/* Public materials */
.public-material-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1rem;
}

.public-material-card {
    background: var(--pub-surface);
    border: 1px solid var(--pub-line);
    border-radius: 12px;
    padding: 1.25rem;
}

.public-material-cat {
    display: inline-block;
    background: var(--pub-gold-soft);
    color: var(--pub-gold);
    padding: .15rem .5rem;
    border-radius: 999px;
    font-size: .72rem;
    font-weight: 700;
    margin-bottom: .5rem;
}

.public-material-card h3 {
    font-size: 1rem;
    margin-bottom: .35rem;
}

.public-material-preview {
    color: var(--pub-muted);
    font-size: .82rem;
    margin-bottom: .5rem;
}

.public-material-period {
    font-size: .75rem;
    color: var(--pub-muted);
}

.public-material-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.public-material-detail {
    background: var(--pub-surface);
    border: 1px solid var(--pub-line);
    border-radius: 12px;
    padding: 1.5rem;
}

.public-material-head {
    display: flex;
    gap: .75rem;
    align-items: center;
    margin-bottom: .5rem;
}

.public-material-body {
    line-height: 1.7;
    font-size: .9rem;
}

.public-eval-badge {
    display: inline-block;
    margin-top: .75rem;
    background: var(--pub-gold-soft);
    color: var(--pub-gold);
    padding: .25rem .75rem;
    border-radius: 999px;
    font-size: .78rem;
    font-weight: 700;
}

/* Public info card */
.public-info-card {
    display: flex;
    gap: 2rem;
    background: var(--pub-surface);
    border: 1px solid var(--pub-line);
    border-radius: 12px;
    padding: 1.25rem;
    margin-bottom: 2rem;
}

.public-info-card div {
    flex: 1;
}

.public-info-card span {
    display: block;
    font-size: .72rem;
    color: var(--pub-muted);
}

.public-info-card strong {
    display: block;
    font-size: 1.1rem;
    margin-top: .15rem;
}

.public-nav-cards {
    display: flex;
    gap: 1rem;
    margin-top: 2rem;
}

.public-nav-cards a {
    flex: 1;
    text-align: center;
    background: var(--pub-surface);
    border: 1px solid var(--pub-line);
    border-radius: 10px;
    padding: 1rem;
    color: var(--pub-red);
    text-decoration: none;
    font-weight: 600;
}

.public-nav-cards a:hover {
    border-color: var(--pub-red);
}

/* Public empty / loading */
.public-empty,
.public-loading {
    text-align: center;
    padding: 3rem 1.5rem;
    color: rgba(255, 255, 255, .85);
}

.public-empty h1,
.public-empty h2 {
    color: #fff;
}

/* Public filter bar */
.public-filter-bar {
    margin-bottom: 1.5rem;
}

.public-select {
    border: 1px solid var(--pub-line);
    border-radius: 8px;
    padding: .5rem .75rem;
    font-size: .85rem;
    background: var(--pub-surface);
    min-width: 200px;
}

/* Public pager */
.public-pager {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1.5rem;
    margin-top: 1.5rem;
    font-size: .85rem;
}

.public-pager a {
    color: var(--pub-red);
    text-decoration: none;
    font-weight: 600;
}

/* Public about */
.public-about-section {
    margin-bottom: 1.5rem;
}

.public-about-section h2 {
    font-size: 1.1rem;
    font-weight: 700;
    margin-bottom: .5rem;
    color: var(--pub-red);
}

.public-about-section ul {
    padding-left: 1.5rem;
}

.public-about-section li {
    margin-bottom: .35rem;
    line-height: 1.6;
}

.public-about-footer {
    margin-top: 2rem;
}

.public-about-footer .public-btn-outline {
    color: #fff;
    border-color: rgba(255, 255, 255, .6);
}

/* Public home: reproduce the reference portal's non-material shell with local data. */
.public-home-route {
    display: contents;
}

.public-site:has(.public-home-route) .public-header {
    display: none;
}

.public-site:has(.public-home-route) .public-nav,
.public-site:has(.public-home-route) .public-footer {
    display: none;
}

.public-site:has(.public-home-route) .public-main,
.public-main.public-main--home {
    max-width: 720px;
    padding: 0;
}

.public-home {
    padding-top: 211px;
    font-size: 17px;
}

.pub-home-fixed {
    position: fixed;
    top: 0;
    left: 50%;
    z-index: 99;
    width: 100%;
    max-width: 720px;
    height: 208px;
    overflow: hidden;
    transform: translateX(-50%);
    border-bottom: 1px solid #4169e1;
    border-radius: 0 0 5px 5px;
    background: #4169e1;
}

.pub-reference-brand {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    height: 51px;
    padding: 0 10px;
    overflow: hidden;
    border-top: 1px solid #000;
    border-radius: 0 0 12px 12px;
    color: #fff;
    text-align: center;
}

.pub-site-logo {
    display: block;
    flex: 0 1 auto;
    width: auto;
    max-width: min(36%, 180px);
    height: auto;
    max-height: 43px;
    object-fit: contain;
}

.pub-site-brand-text {
    min-width: 0;
}

.pub-reference-brand h1 {
    margin: 0;
    color: #fff;
    font-size: 16pt;
    font-weight: 700;
    line-height: 26px;
}

.pub-reference-brand p {
    margin: 0;
    color: #fff;
    font-size: 15px;
    line-height: 20px;
}

.pub-tabs {
    position: relative;
    display: flex;
    width: 100%;
    height: 30px;
    margin: 0;
    padding: 0;
    background: transparent;
}

.pub-tab-label {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.pub-tab-spinner {
    display: none;
    flex: 0 0 14px;
    width: 14px;
    height: 14px;
    margin-left: 5px;
    border: 2px solid rgba(255,255,255,.45);
    border-top-color: #fff;
    border-radius: 50%;
    animation: pub-tab-spin .65s linear infinite;
}

.pub-tab.is-loading .pub-tab-spinner {
    display: inline-block;
}

.pub-tab.is-loading {
    color: #fff;
    background: #1d4ed8;
    box-shadow: inset 0 0 0 2px rgba(255,255,255,.75);
}

.public-home.game-nav-loading .pub-tab:not(.is-loading) {
    opacity: .58;
}

.pub-tab.is-current-confirmed {
    animation: pub-tab-confirm .42s ease-out;
}

.pub-game-nav-feedback {
    position: absolute;
    top: 84px;
    left: 50%;
    z-index: 4;
    max-width: calc(100% - 24px);
    padding: .35rem .8rem;
    transform: translateX(-50%);
    border-radius: 999px;
    color: #fff;
    background: rgba(15, 23, 42, .9);
    box-shadow: 0 4px 12px rgba(15,23,42,.28);
    font-size: .82rem;
    font-weight: 700;
    line-height: 1.2;
    white-space: nowrap;
}

@keyframes pub-tab-spin {
    to { transform: rotate(360deg); }
}

@keyframes pub-tab-confirm {
    50% { filter: brightness(1.35); transform: scale(.97); }
}

.pub-tab {
    display: inline-flex;
    flex: 1 1 0;
    align-items: center;
    justify-content: center;
    height: 30px;
    min-width: 0;
    padding: 0 6px;
    overflow: hidden;
    border: 0;
    border-top: 1px solid #fff;
    border-right: 1px solid #fff;
    border-radius: 0;
    color: rgba(255,255,255,.86);
    background: #ff8c00;
    box-shadow: none;
    font-size: 20px;
    font-weight: 800;
    line-height: 29px;
    text-overflow: ellipsis;
    white-space: nowrap;
    cursor: pointer;
    text-decoration: none;
}

.pub-tab:link,
.pub-tab:visited,
.pub-tab:hover,
.pub-tab:focus,
.pub-tab:active,
.pub-tab-label {
    text-decoration: none !important;
}

.pub-tab:last-child {
    border-radius: 0 6px 0 0;
}

.pub-tab.active {
    color: #fff;
    background: #00785e;
    text-shadow: 0 0 3px rgba(0,0,0,.6);
}

.pub-tab:nth-child(2).active {
    background: #e71607;
}

.pub-tab:nth-child(3).active {
    background: #2389e9;
}

.pub-tab:nth-child(4).active {
    background: #b907c1;
}

.pub-draw-panel {
    position: relative;
    width: 100%;
    height: 125px;
    margin: 0;
    padding: 0 8px;
    overflow: hidden;
    border: 0;
    border-radius: 0;
    background: #fff;
    box-shadow: none;
}

.pub-draw-summary {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    gap: .5rem;
    height: 30px;
    color: #222;
    font-size: 17px;
}

.pub-draw-title {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.pub-draw-period {
    color: red;
}

.pub-draw-countdown {
    color: #111;
    font-size: 19px;
    font-weight: 800;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.pub-history-link {
    justify-self: end;
    color: red;
    font-size: 17px;
    font-weight: 400;
    text-decoration: none;
    white-space: nowrap;
}

.pub-draw-pending {
    height: 95px;
    color: #666;
    font-size: 15px;
    line-height: 95px;
    text-align: center;
}

.pub-result-row {
    padding: 0;
}

.pub-ball-row {
    display: flex;
    align-items: flex-start;
    justify-content: center;
    gap: 5px;
    height: 65px;
    padding: 3px 0 2px;
    overflow: hidden;
}

.pub-ball-wrap {
    display: flex;
    flex: 1 1 0;
    align-items: center;
    max-width: 91px;
    min-width: 0;
}

.pub-ball-reveal {
    animation: pub-draw-reveal .52s cubic-bezier(.18,.88,.32,1.25) both;
    animation-delay: var(--draw-delay, 0ms);
    transform-origin: center;
}

.pub-ball-row-pending {
    filter: saturate(.15);
}

.pub-ball.pub-ball-pending {
    align-items: center;
    justify-content: center;
    border: 1px solid #9ca3af;
    background: linear-gradient(145deg, #d1d5db, #9ca3af);
    color: #374151;
    box-shadow: inset 0 1px 0 rgba(255,255,255,.65), 0 2px 5px rgba(31,41,55,.2);
}

.pub-ball.pub-ball-pending-special {
    background: linear-gradient(145deg, #c7cbd1, #858c96);
}

.pub-ball.pub-ball-live {
    opacity: 1;
}

/* Do not rely on the HTML hidden attribute alone: mobile portal templates and
   Safari can resolve flex/display rules differently. Simulation reveals this
   class one ball at a time. */
.pub-ball[hidden],
.pub-ball.pub-ball-simulation-hidden {
    display: none !important;
}

.pub-ball-live-enter {
    animation: pub-draw-reveal .52s cubic-bezier(.18,.88,.32,1.25) both;
}

.pub-ball-wait-text {
    display: -webkit-box;
    max-width: 100%;
    overflow: hidden;
    padding: 0 .2rem;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    color: #374151;
    font-family: system-ui, sans-serif;
    font-size: clamp(.62rem, 1.8vw, .82rem);
    font-weight: 800;
    line-height: 1.05;
    text-align: center;
    text-shadow: 0 1px 0 rgba(255,255,255,.65);
}

@keyframes pub-draw-reveal {
    0% {
        opacity: 0;
        transform: translateY(-18px) rotate(-9deg) scale(.72);
    }
    55% {
        opacity: 1;
        transform: translateY(4px) rotate(4deg) scale(1.06);
    }
    100% {
        opacity: 1;
        transform: translateY(0) rotate(0) scale(1);
    }
}

.pub-ball {
    display: flex;
    flex-direction: column;
    width: 100%;
    height: 60px;
    overflow: hidden;
    border-radius: 5px;
    color: #fff;
    font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
    box-shadow: none;
    text-align: center;
}

.pub-ball .result-ball-number {
    display: grid;
    flex: 1 1 auto;
    min-height: 0;
    height: 38px;
    place-items: center;
    color: #fff;
    font-size: clamp(1.2rem, 4.2vw, 1.9rem);
    font-weight: 900;
    line-height: 1;
    text-shadow: 0 2px 2px rgba(0,0,0,.75);
}

.pub-ball .result-ball-meta {
    display: block;
    flex: 0 0 22px;
    height: 22px;
    overflow: hidden;
    padding: 0 2px;
    color: #111;
    background: rgba(255,255,255,.94);
    font-family: "Microsoft YaHei", sans-serif;
    font-size: clamp(.62rem, 2.4vw, .88rem);
    line-height: 22px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.result-ball-no-meta .result-ball-number {
    height: 100%;
}

.pub-ball.wave-red {
    background: #e51b0e;
}

.pub-ball.wave-blue {
    background: #218cec;
}

.pub-ball.wave-green {
    background: #0eae27;
}

.pub-ball.wave-none {
    background: #6b7280;
}

.public-ball.wave-red,
.result-ball-preview-item.wave-red {
    background: #e51b0e;
}

.public-ball.wave-blue,
.result-ball-preview-item.wave-blue {
    background: #218cec;
}

.public-ball.wave-green,
.result-ball-preview-item.wave-green {
    background: #0eae27;
}

.public-ball.wave-none,
.result-ball-preview-item.wave-none {
    background: #6b7280;
}

/* Site-selectable public result-ball shapes. The same class is used by the
   home page, game page, history pages and the administration preview. */
.result-ball-preview-item {
    display: inline-flex;
    flex-direction: column;
    width: 58px;
    height: 58px;
    overflow: hidden;
    color: #fff;
    font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
    font-weight: 900;
    text-align: center;
}

.result-ball-preview-item .result-ball-number {
    display: grid;
    flex: 1 1 auto;
    min-height: 0;
    place-items: center;
    font-size: 1.15rem;
    line-height: 1;
    text-shadow: 0 2px 2px rgba(0,0,0,.65);
}

.result-ball-preview-item .result-ball-meta {
    flex: 0 0 18px;
    overflow: hidden;
    padding: 0 2px;
    color: #111;
    background: rgba(255,255,255,.94);
    font-family: "Microsoft YaHei", sans-serif;
    font-size: .56rem;
    font-weight: 700;
    line-height: 18px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Per-site ball size. Medium is the safe default; larger choices preserve
   readable metadata by scrolling on narrow screens instead of clipping it. */
.ball-size--small .public-ball {
    width: 3rem;
    height: 3rem;
}

.ball-size--medium .public-ball {
    width: 3.75rem;
    height: 3.75rem;
}

.ball-size--large .public-ball {
    width: 4.5rem;
    height: 4.5rem;
}

.ball-size--small .pub-ball-wrap { flex: 0 0 52px; max-width: 52px; }
.ball-size--medium .pub-ball-wrap { flex: 0 0 64px; max-width: 64px; }
.ball-size--large .pub-ball-wrap { flex: 0 0 78px; max-width: 78px; }

.ball-size--small .pub-ball { height: 52px; }
.ball-size--medium .pub-ball { height: 64px; }
.ball-size--large .pub-ball { height: 78px; }

.ball-size--small .result-ball-preview-item { width: 52px; height: 52px; }
.ball-size--medium .result-ball-preview-item { width: 64px; height: 64px; }
.ball-size--large .result-ball-preview-item { width: 76px; height: 76px; }

/* Per-site result-ball typography. Ball geometry and text size are intentionally
   separate so an operator can enlarge text without changing the selected shape. */
.ball-text--small :is(.public-ball, .pub-ball, .result-ball-preview-item) .result-ball-number { font-size: 1rem !important; }
.ball-text--medium :is(.public-ball, .pub-ball, .result-ball-preview-item) .result-ball-number { font-size: 1.25rem !important; }
.ball-text--large :is(.public-ball, .pub-ball, .result-ball-preview-item) .result-ball-number { font-size: 1.5rem !important; }
.ball-text--small :is(.public-ball, .pub-ball, .result-ball-preview-item) .result-ball-meta { font-size: .55rem !important; }
.ball-text--medium :is(.public-ball, .pub-ball, .result-ball-preview-item) .result-ball-meta { font-size: .65rem !important; }
.ball-text--large :is(.public-ball, .pub-ball, .result-ball-preview-item) .result-ball-meta { font-size: .76rem !important; }

.ball-size--medium :is(.public-ball, .pub-ball, .result-ball-preview-item) .result-ball-meta,
.ball-size--large :is(.public-ball, .pub-ball, .result-ball-preview-item) .result-ball-meta {
    display: grid;
    place-items: center;
    overflow-wrap: anywhere;
    text-overflow: clip;
    white-space: normal;
}

.ball-size--medium .public-ball .result-ball-number { font-size: 1.16rem; }
.ball-size--large .public-ball .result-ball-number { font-size: 1.38rem; }
.ball-size--medium .public-ball .result-ball-meta { font-size: .64rem; }
.ball-size--large .public-ball .result-ball-meta { font-size: .72rem; }

.ball-size--medium .pub-ball-row,
.ball-size--large .pub-ball-row {
    justify-content: flex-start;
    overflow-x: auto;
    overflow-y: hidden;
    scrollbar-width: thin;
}

@media (min-width: 620px) {
    .ball-size--medium .pub-ball-row,
    .ball-size--large .pub-ball-row {
        justify-content: center;
    }
}

.public-home.ball-size--large {
    padding-top: 227px;
}

.public-home.ball-size--large .pub-home-fixed {
    height: 224px;
}

.public-home.ball-size--large .pub-draw-panel {
    height: 141px;
}

.public-home.ball-size--large .pub-ball-row {
    height: 81px;
}

.ball-style--classic-card :is(.pub-ball, .public-ball, .result-ball-preview-item) {
    border: 1px solid rgba(15,23,42,.18);
    border-radius: 5px;
    box-shadow: 0 2px 5px rgba(15,23,42,.16);
}

.ball-style--long-card :is(.pub-ball, .public-ball, .result-ball-preview-item) {
    border: 2px solid rgba(255,255,255,.75);
    border-radius: 3px;
    box-shadow: 0 3px 0 rgba(15,23,42,.26);
}

.ball-style--long-card .public-ball {
    width: 4.25rem;
}

.ball-style--glass-card :is(.pub-ball, .public-ball, .result-ball-preview-item) {
    border: 1px solid rgba(255,255,255,.72);
    border-radius: 10px;
    background-image: linear-gradient(145deg, rgba(255,255,255,.38), transparent 42%);
    box-shadow: inset 0 1px 0 rgba(255,255,255,.82), 0 5px 12px rgba(15,23,42,.22);
}

.ball-style--plain-glass-card :is(.pub-ball, .public-ball, .result-ball-preview-item) {
    border: 1px solid rgba(15,23,42,.2);
    border-radius: 10px;
    background-image: none;
    box-shadow: none;
}

.ball-style--soft-square :is(.pub-ball, .public-ball, .result-ball-preview-item) {
    border: 1px solid rgba(255,255,255,.65);
    border-radius: 14px;
    box-shadow: 0 4px 10px rgba(15,23,42,.2);
}

.ball-style--bold-square :is(.pub-ball, .public-ball, .result-ball-preview-item) {
    border: 3px solid #172033;
    border-radius: 2px;
    box-shadow: 3px 3px 0 rgba(15,23,42,.35);
}

:is(.ball-style--flat-round, .ball-style--glossy-round, .ball-style--ring-round, .ball-style--neon-round, .ball-style--gold-medal) .pub-ball-wrap {
    max-width: 64px;
}

:is(.ball-style--flat-round, .ball-style--glossy-round, .ball-style--ring-round, .ball-style--neon-round, .ball-style--gold-medal) .pub-ball {
    height: auto;
    aspect-ratio: 1;
}

:is(.ball-style--flat-round, .ball-style--glossy-round, .ball-style--ring-round, .ball-style--neon-round, .ball-style--gold-medal) :is(.pub-ball, .public-ball, .result-ball-preview-item) {
    border-radius: 50%;
}

.ball-style--flat-round :is(.pub-ball, .public-ball, .result-ball-preview-item) {
    border: 2px solid rgba(255,255,255,.8);
    box-shadow: 0 2px 5px rgba(15,23,42,.28);
}

.ball-style--glossy-round :is(.pub-ball, .public-ball, .result-ball-preview-item) {
    border: 2px solid rgba(255,255,255,.82);
    background-image: radial-gradient(circle at 31% 23%, rgba(255,255,255,.92) 0 7%, rgba(255,255,255,.35) 8% 18%, transparent 19%);
    box-shadow: inset -7px -8px 12px rgba(15,23,42,.25), 0 5px 9px rgba(15,23,42,.32);
}

.ball-style--ring-round :is(.pub-ball, .public-ball, .result-ball-preview-item) {
    border: 4px solid currentColor;
    background: #fff;
    box-shadow: 0 2px 7px rgba(15,23,42,.18);
}

.ball-style--ring-round :is(.wave-red) { color: #e51b0e; }
.ball-style--ring-round :is(.wave-blue) { color: #218cec; }
.ball-style--ring-round :is(.wave-green) { color: #0eae27; }
.ball-style--ring-round :is(.wave-none) { color: #6b7280; }
.ball-style--ring-round .result-ball-number {
    color: currentColor;
    text-shadow: none;
}

.ball-style--capsule :is(.pub-ball, .public-ball, .result-ball-preview-item) {
    border: 2px solid rgba(255,255,255,.8);
    border-radius: 999px;
    box-shadow: inset 0 2px 3px rgba(255,255,255,.35), 0 3px 7px rgba(15,23,42,.25);
}

.ball-style--capsule .public-ball {
    width: 4rem;
}

.ball-style--capsule .pub-ball {
    height: auto;
    aspect-ratio: 1.2;
}

.ball-style--hexagon :is(.pub-ball, .public-ball, .result-ball-preview-item) {
    border-radius: 0;
    clip-path: polygon(25% 3%, 75% 3%, 100% 50%, 75% 97%, 25% 97%, 0 50%);
    box-shadow: none;
}

.ball-style--hexagon .pub-ball {
    height: auto;
    aspect-ratio: 1;
}

.ball-style--neon-round :is(.pub-ball, .public-ball, .result-ball-preview-item) {
    border: 2px solid #dffcff;
    background-color: #07111f;
    background-image: radial-gradient(circle at 50% 35%, rgba(255,255,255,.18), transparent 58%);
    box-shadow: 0 0 5px currentColor, 0 0 13px currentColor, inset 0 0 8px rgba(255,255,255,.25);
}

.ball-style--neon-round :is(.wave-red) { color: #ff5d70; }
.ball-style--neon-round :is(.wave-blue) { color: #55c9ff; }
.ball-style--neon-round :is(.wave-green) { color: #5dff9a; }
.ball-style--neon-round :is(.wave-none) { color: #d1d5db; }
.ball-style--neon-round .result-ball-number {
    color: #fff;
}

.ball-style--gold-medal :is(.pub-ball, .public-ball, .result-ball-preview-item) {
    border: 5px double #ffd45a;
    box-shadow: inset 0 0 0 2px rgba(120,72,0,.35), 0 3px 8px rgba(95,57,0,.38);
}

.ball-style--gold-medal .result-ball-meta,
.ball-style--glossy-round .result-ball-meta,
.ball-style--flat-round .result-ball-meta,
.ball-style--ring-round .result-ball-meta,
.ball-style--neon-round .result-ball-meta {
    margin: 0 5px 4px;
    border-radius: 0 0 999px 999px;
    line-height: 17px;
}

.ball-size--large:is(.ball-style--flat-round, .ball-style--glossy-round, .ball-style--ring-round, .ball-style--neon-round, .ball-style--gold-medal) .pub-ball-wrap {
    max-width: 78px;
}

.pub-ball-plus {
    align-self: center;
    flex: 0 0 20px;
    margin: 0;
    color: #222;
    font-size: 1.65rem;
    font-weight: 900;
}

.pub-next-row {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: .5rem;
    height: 30px;
    margin: 0;
    padding: 0 64px 0 0;
    overflow: hidden;
    border-top: 1px dashed #ccc;
    color: #222;
    font-size: 17px;
    line-height: 30px;
    white-space: nowrap;
}

/* Reference-style two-column category directory. */
.pub-link-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0;
    width: 100%;
    margin: 5px 0;
    padding: 2px;
    overflow: hidden;
    border: 3px double #4169e1;
    border-radius: 5px;
    background-image: linear-gradient(to right, #e0a31c, #e0a82b, #e2ac32, #e6a515, #eaad26, #f1b227, #e0a31c);
}

.pub-link-grid a {
    display: block;
    min-width: 0;
    padding: 2px;
    overflow: hidden;
    border: 1px solid #ddd;
    border-radius: 8px;
    color: red;
    background: #eee;
    background-image: linear-gradient(to top, #fff, #eee, #fff);
    box-shadow: 0 2px 5px rgba(0,0,0,.1);
    font-size: 20pt;
    font-weight: 800;
    line-height: 40px;
    text-align: center;
    text-decoration: none;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.pub-link-grid a:hover {
    color: red;
    text-decoration: none;
}

.pub-link-grid a:link,
.pub-link-grid a:visited,
.pub-link-grid a:hover,
.pub-link-grid a:focus,
.pub-link-grid a:active {
    text-decoration: none !important;
}

.pub-draw-refresh {
    position: absolute;
    right: 7px;
    bottom: 4px;
    z-index: 4;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 3px;
    min-width: 52px;
    height: 23px;
    padding: 0 6px;
    border: 1px solid #94a3b8;
    border-radius: 4px;
    color: #334155;
    background: linear-gradient(to bottom, #ffffff, #e2e8f0);
    box-shadow: 0 1px 2px rgba(15, 23, 42, .18);
    font-family: inherit;
    font-size: 13px;
    font-weight: 700;
    line-height: 21px;
    cursor: pointer;
}

.pub-draw-refresh:hover,
.pub-draw-refresh:focus-visible {
    color: #ffffff;
    border-color: #2563eb;
    background: #2563eb;
    outline: none;
}

.pub-draw-refresh:disabled {
    cursor: wait;
    opacity: .7;
}

.pub-draw-refresh.is-refreshing .pub-draw-refresh-icon {
    animation: pub-draw-refresh-spin .7s linear infinite;
}

.pub-draw-refresh.is-error {
    color: #ffffff;
    border-color: #dc2626;
    background: #dc2626;
}

.pub-draw-simulate {
    position: absolute;
    right: 66px;
    bottom: 4px;
    z-index: 4;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 3px;
    min-width: 92px;
    height: 23px;
    padding: 0 7px;
    border: 1px solid #059669;
    border-radius: 4px;
    color: #047857;
    background: linear-gradient(to bottom, #ffffff, #d1fae5);
    box-shadow: 0 1px 2px rgba(15, 23, 42, .18);
    font-family: inherit;
    font-size: 13px;
    font-weight: 700;
    line-height: 21px;
    cursor: pointer;
}

.pub-draw-simulate:hover,
.pub-draw-simulate:focus-visible,
.pub-draw-simulate.is-simulating {
    border-color: #047857;
    color: #ffffff;
    background: #059669;
    outline: none;
}

.pub-draw-simulate:disabled {
    cursor: wait;
    opacity: .8;
}

.pub-draw-panel:has(.pub-draw-simulate) .pub-draw-refresh-status {
    right: 164px;
    max-width: min(220px, calc(100% - 230px));
}

.pub-ball-simulation-placeholder {
    flex: 1 1 auto;
    width: 100%;
}

.pub-draw-refresh-status {
    position: absolute;
    right: 65px;
    bottom: 5px;
    z-index: 3;
    max-width: min(240px, calc(100% - 132px));
    overflow: hidden;
    color: #475569;
    font-size: 12px;
    line-height: 21px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

@keyframes pub-draw-refresh-spin {
    to { transform: rotate(360deg); }
}

/* Material display stays on DrawRisk's established presentation. */
.pub-material-block {
    overflow: hidden;
    margin-bottom: 1rem;
    border-radius: 10px;
    background: var(--pub-surface);
    box-shadow: 0 2px 8px rgba(0,0,0,.18);
    scroll-margin-top: 211px;
}

html {
    scroll-behavior: smooth;
}

.pub-material-block-head {
    padding: .55rem;
    color: #fff;
    background: linear-gradient(180deg, #3a5fd9 0%, var(--pub-bg-deep) 100%);
    font-weight: 800;
    font-size: 1.18rem;
    letter-spacing: .15em;
    text-align: center;
}

.pub-material-block-body {
    padding: 1rem;
    text-align: center;
}

.pub-material-block-title {
    margin-bottom: .5rem;
    color: var(--pub-red);
    font-weight: 800;
}

.pub-material-block-body p {
    margin-bottom: .5rem;
    line-height: 1.8;
    white-space: pre-line;
}

/* Logical sites still vary only the material composition. */
.public-home--compact .pub-material-block {
    margin-bottom: 10px;
}

.public-home--compact .pub-material-lines {
    font-size: 1.06rem;
    line-height: 1.7;
}

.public-home--cards {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
}

.public-home--cards > .pub-link-grid {
    grid-column: 1 / -1;
}

.public-home--cards .pub-material-block {
    margin: 0;
}

@media (max-width: 760px) {
    .public-home--cards {
        grid-template-columns: 1fr;
    }
}

.pub-result-label {
    display: inline-block;
    padding: .2rem .8rem;
    border-radius: 999px;
    color: var(--pub-red);
    background: var(--pub-red-soft);
    font-size: .85rem;
    font-weight: 800;
}

.pub-material-lines {
    padding: .7rem 1rem;
}

.pub-material-line {
    padding: .48rem 0;
    border-bottom: 1px dashed rgba(255,255,255,.08);
    font-size: 1.08rem;
    line-height: 1.8;
    white-space: pre-line;
    word-break: break-all;
}

.pub-material-line:last-child {
    border-bottom: none;
}

.pub-material-image-wrap {
    padding: .75rem;
    text-align: center;
}

.pub-material-image {
    display: block;
    width: auto;
    max-width: 100%;
    max-height: 760px;
    margin: 0 auto;
    border-radius: 6px;
    object-fit: contain;
}

.pub-material-fixed-text {
    padding: .9rem 1rem;
    color: var(--pub-text);
    font-size: 1.06rem;
    line-height: 1.75;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}

.pub-material-empty {
    padding: 1.25rem;
    color: var(--pub-muted);
    text-align: center;
}

@media (max-width: 580px) {
    .pub-link-grid a {
        font-size: 18pt;
    }
}

@media (max-width: 480px) {
    .pub-link-grid a {
        font-size: 15pt;
        line-height: 35px;
    }
}

@media (max-width: 408px) {
    .pub-link-grid a {
        font-size: 13pt;
        line-height: 30px;
    }

    .pub-ball-row {
        gap: 2px;
    }

    .pub-draw-panel {
        padding-right: 4px;
        padding-left: 4px;
    }

    .pub-draw-summary,
    .pub-next-row {
        font-size: 14px;
    }

    .pub-draw-countdown {
        font-size: 16px;
    }

    .pub-history-link {
        font-size: 14px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .pub-ball-reveal {
        animation: none;
    }
}

@media (max-width: 358px) {
    .pub-link-grid a {
        font-size: 12pt;
    }
}

/* Public responsive */
@media (max-width: 768px) {
    .public-brand-name {
        font-size: 1.35rem;
    }

    .public-nav {
        gap: 1rem;
    }

    .public-nav a {
        font-size: .82rem;
    }

    .public-main {
        padding: .65rem .5rem 2.5rem;
    }

    .public-info-card {
        flex-direction: column;
        gap: 1rem;
    }

    .public-result-grid,
    .public-game-grid,
    .public-material-grid {
        grid-template-columns: 1fr;
    }

    .public-nav-cards {
        flex-direction: column;
    }
}
