:root {
    font-family: Arial, "Microsoft YaHei", sans-serif;
    color: #17273a;
    background: #f4f2ed;
    letter-spacing: 0;
    font-synthesis: none;
}

* { box-sizing: border-box; }
html, body { min-width: 320px; min-height: 100%; margin: 0; letter-spacing: 0; }
body { background: #f5f3ef url('./assets/pattern.png') repeat; }
button, input, a { font: inherit; letter-spacing: 0; }

.hero {
    position: relative;
    height: 156px;
    overflow: hidden;
    background: #07203f url('./assets/banner.jpg') center 44% / cover no-repeat;
    color: #fff;
}
.hero::after { content: ""; position: absolute; inset: 0; background: rgba(0, 21, 55, .3); }
.hero-content {
    position: relative;
    z-index: 1;
    width: min(1180px, calc(100% - 36px));
    margin: auto;
    padding-top: 30px;
    text-shadow: 0 2px 4px rgba(0, 0, 0, .55);
}
.hero-content span { color: #56d9ff; font-size: 11px; font-weight: 700; }
.hero-content h1 { margin: 7px 0 4px; font-size: 36px; letter-spacing: 0; }
.hero-content p { margin: 0; color: #d6ecff; font-size: 14px; }

.notice-bar {
    height: 28px;
    display: grid;
    grid-template-columns: 24px 1fr auto;
    align-items: center;
    gap: 7px;
    padding: 0 12px;
    border-bottom: 1px solid #d7dde2;
    background: #f7f9fb;
    font-size: 11px;
}
.notice-icon { color: #657483; }
.notice-bar time { color: #566879; font-variant-numeric: tabular-nums; }
.domain-bar {
    height: 34px;
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    align-items: center;
    background: #ff671b;
    color: #fff;
    text-align: center;
    font-size: 13px;
}
.domain-bar span:first-child { border-right: 1px solid rgba(255, 255, 255, .55); }
.domain-bar span:last-child { border-left: 1px solid rgba(255, 255, 255, .55); }
.domain-bar b { color: #fff839; font-style: italic; }
.domain-bar strong { font-size: 15px; }
.category-nav {
    height: 36px;
    display: flex;
    justify-content: center;
    border-bottom: 1px solid #c7cdd3;
    background: #fff;
}
.category-nav span {
    width: min(320px, 55vw);
    height: 36px;
    display: grid;
    place-items: center;
    border-bottom: 3px solid #173f76;
    color: #173f76;
    font-size: 14px;
    font-weight: 800;
}

.game-list {
    width: min(1400px, calc(100% - 18px));
    min-height: 350px;
    display: grid;
    gap: 10px;
    margin: 10px auto;
}
.game-card {
    min-height: 128px;
    display: grid;
    grid-template-columns: 150px minmax(0, 1fr) 98px;
    overflow: hidden;
    border: 1px solid #e3e5e7;
    border-radius: 4px;
    background: #fff;
    box-shadow: 0 2px 7px rgba(35, 50, 65, .08);
}
.game-logo-block {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 10px;
    border-right: 1px solid #e3e7ea;
    text-align: center;
}
.game-logo-block img { width: 60px; height: 60px; object-fit: contain; }
.game-logo-block h2 { margin: 4px 0 1px; color: #384a5c; font-size: 13px; }
.game-logo-block p { margin: 0; color: #71808d; font-size: 10px; }
.game-logo-block p b { color: #ee313d; }
.game-result {
    min-width: 0;
    display: grid;
    grid-template-rows: 28px 1fr 30px;
    padding: 9px 20px;
}
.next-period { color: #596a78; font-size: 12px; font-weight: 700; }
.next-period b { color: #ec303b; }
.latest-balls, .detail-balls, .history-balls {
    min-width: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
}
.latest-balls { min-height: 44px; overflow: visible; padding: 2px; }

/* These are the same number assets and dimensions used by the betting site. */
.draw-ball.race {
    width: 20px;
    height: 20px;
    flex: 0 0 20px;
    overflow: hidden;
    background-image: url('./assets/ball-pk10.png');
    background-repeat: no-repeat;
    color: transparent;
    font-size: 0;
}
.draw-ball.race.ball-1 { background-position: 0 0; }
.draw-ball.race.ball-2 { background-position: 0 -21px; }
.draw-ball.race.ball-3 { background-position: 0 -42px; }
.draw-ball.race.ball-4 { background-position: 0 -63px; }
.draw-ball.race.ball-5 { background-position: 0 -84px; }
.draw-ball.race.ball-6 { background-position: 0 -105px; }
.draw-ball.race.ball-7 { background-position: 0 -126px; }
.draw-ball.race.ball-8 { background-position: 0 -147px; }
.draw-ball.race.ball-9 { background-position: 0 -168px; }
.draw-ball.race.ball-10 { background-position: 0 -189px; }
.ssc-ball-image { width: 26px; height: 26px; flex: 0 0 26px; display: block; object-fit: contain; }
.happy-ball {
    position: relative;
    width: 26px;
    height: 26px;
    flex: 0 0 26px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: url('./assets/ball-ssc-0.png') center / 26px 26px no-repeat;
}
.happy-ball::before { content: ""; position: absolute; inset: 6px; border-radius: 50%; background: #f8fbfd; }
.happy-ball i { position: relative; z-index: 1; color: #17324a; font-size: 11px; font-style: normal; font-weight: 700; line-height: 1; }
.happy-ball.special::before { background: #fff5f5; }
.happy-ball.special i { color: #cf3232; }
.dice-face {
    width: 31px;
    height: 31px;
    flex: 0 0 31px;
    display: inline-grid;
    grid-template-columns: repeat(3, 1fr);
    grid-template-rows: repeat(3, 1fr);
    padding: 4px;
    border: 1px solid #87939f;
    border-radius: 6px;
    background: #fff;
    box-shadow: inset 0 0 0 1px #f2f4f5;
}
.dice-face i { width: 0; height: 0; display: block; align-self: center; justify-self: center; border-radius: 50%; background: #263746; }
.dice-face i.active { width: 5px; height: 5px; }
.dice-face.red-pips i.active { background: #e3262e; }
.draw-ball.small { width: 20px; height: 20px; flex-basis: 20px; }
.ssc-ball-image.small, .happy-ball.small { width: 22px; height: 22px; flex-basis: 22px; background-size: 22px 22px; }
.happy-ball.small::before { inset: 5px; }
.happy-ball.small i { font-size: 9px; }
.dice-face.small { width: 26px; height: 26px; flex-basis: 26px; padding: 3px; }

.draw-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    border-top: 1px solid #edf0f2;
    color: #88949e;
    font-size: 10px;
}
.draw-meta a {
    height: 25px;
    display: inline-flex;
    align-items: center;
    padding: 0 12px;
    border: 1px solid #9da9b2;
    border-radius: 3px;
    background: #fff;
    color: #3d4d5b;
    text-decoration: none;
}
.draw-meta a:hover { border-color: #1e75ac; color: #1e75ac; }
.countdown {
    display: grid;
    grid-template-columns: 1fr 1fr;
    align-content: center;
    justify-items: center;
    background: #0d3062;
    color: #fff;
    font-variant-numeric: tabular-nums;
}
.countdown b { font-size: 21px; line-height: 1; }
.countdown small { margin: 2px 0 9px; color: #bcd2eb; font-size: 9px; }
.waiting { color: #98a4ad; font-size: 12px; }
.loading-state { min-height: 260px; display: grid; place-items: center; background: #fff; color: #7c8b97; }
.loading-state.error { color: #c34b4b; }
.site-footer { padding: 20px; color: #8996a1; text-align: center; font-size: 10px; }

/* Dedicated draw-history view. */
.history-page { width: min(980px, calc(100% - 20px)); min-height: 450px; margin: 12px auto 22px; }
.history-shell { overflow: hidden; border: 1px solid #d4dce2; border-radius: 4px; background: #fff; box-shadow: 0 2px 9px rgba(26, 43, 60, .08); }
.history-nav {
    height: 45px;
    display: grid;
    grid-template-columns: 45px 1fr 45px;
    align-items: center;
    background: #0d3062;
    color: #fff;
}
.history-nav h1 { margin: 0; text-align: center; font-size: 16px; }
.back-button {
    width: 45px;
    height: 45px;
    display: grid;
    place-items: center;
    color: #fff;
    text-decoration: none;
    font-size: 34px;
    line-height: 1;
}
.history-game-summary {
    min-height: 98px;
    display: grid;
    grid-template-columns: 1fr auto 122px;
    align-items: center;
    gap: 16px;
    padding: 13px 22px;
    border-bottom: 1px solid #dce2e7;
    background: #f7fafc;
}
.history-game-identity { min-width: 0; display: flex; align-items: center; gap: 12px; }
.history-game-identity img { width: 68px; height: 68px; object-fit: contain; }
.history-game-identity h2 { margin: 0 0 5px; color: #253b50; font-size: 18px; }
.history-game-identity p { margin: 0; color: #71808d; font-size: 12px; }
.detail-countdown-label { color: #5a6976; font-size: 12px; }
.detail-countdown { display: grid; grid-template-columns: repeat(2, 1fr); border-radius: 3px; background: #0d3062; color: #fff; }
.detail-countdown > span { min-width: 58px; height: 62px; display: grid; grid-template-columns: 1fr auto; align-items: center; padding: 0 8px; border-right: 1px solid rgba(255, 255, 255, .18); }
.detail-countdown > span:last-child { border-right: 0; }
.detail-countdown b { font-size: 24px; font-variant-numeric: tabular-nums; }
.detail-countdown small { color: #bcd2eb; font-size: 9px; }
.detail-countdown .drawing { grid-column: 1 / -1; justify-content: center; border: 0; }
.current-draw { padding: 14px 22px 18px; border-bottom: 1px solid #dce2e7; }
.current-draw-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; color: #61717f; font-size: 12px; }
.current-draw-heading b { color: #ee313d; }
.current-draw-heading time { color: #8b98a2; font-size: 10px; }
.detail-balls { min-height: 48px; margin-top: 10px; gap: 6px; }
.history-toolbar { height: 45px; display: flex; align-items: end; justify-content: space-between; padding: 0 16px; border-bottom: 1px solid #cbd4db; }
.history-tab { height: 34px; display: flex; align-items: center; gap: 5px; padding: 0 12px; border-bottom: 3px solid #ff671b; color: #173f76; font-size: 14px; font-weight: 700; }
.history-toolbar label { height: 36px; display: flex; align-items: center; gap: 8px; color: #657584; font-size: 12px; }
.history-toolbar input { width: 138px; height: 28px; padding: 0 7px; border: 1px solid #aeb8c1; border-radius: 3px; color: #374b5d; background: #fff; }
.history-pagination { min-height: 42px; display: flex; align-items: center; justify-content: center; gap: 5px; padding: 7px; background: #f7f9fa; }
.history-pagination:empty { display: none; }
.history-pagination button { width: 29px; height: 28px; border: 1px solid #b7c0c7; border-radius: 3px; background: #fff; color: #526575; cursor: pointer; }
.history-pagination button.active { border-color: #0d3062; background: #0d3062; color: #fff; }
.page-gap { padding: 0 3px; color: #7a8995; }
.history-table-wrap { width: 100%; overflow-x: auto; overscroll-behavior-inline: contain; }
.history-table { width: 100%; min-width: 640px; border-collapse: collapse; table-layout: fixed; font-size: 12px; }
.history-table th { height: 42px; border: 1px solid #cbd3da; background: #edf2f5; color: #455b6d; font-weight: 700; }
.history-table td { height: 56px; padding: 6px 10px; border: 1px solid #d8dee3; color: #526575; text-align: center; }
.history-table th:nth-child(1) { width: 155px; }
.history-table th:nth-child(2) { width: 145px; }
.history-table th:nth-child(3) { width: auto; }
.history-table td:first-child b, .history-date { display: block; font-weight: 400; line-height: 18px; }
.history-date { color: #8a97a1; font-size: 10px; }
.history-table .history-balls { flex-wrap: wrap; gap: 4px; }
.empty-history { height: 120px !important; color: #8b98a2 !important; }

@media (max-width: 720px) {
    .hero { height: 105px; }
    .hero-content { width: calc(100% - 28px); padding-top: 19px; }
    .hero-content span { font-size: 8px; }
    .hero-content h1 { margin-top: 4px; font-size: 25px; }
    .hero-content p { font-size: 11px; }
    .notice-bar { height: 31px; grid-template-columns: 20px 1fr; padding: 0 8px; font-size: 9px; }
    .notice-bar time { display: none; }
    .domain-bar { height: 31px; grid-template-columns: 1fr; }
    .domain-bar span { display: none; }
    .domain-bar strong { font-size: 13px; }
    .category-nav, .category-nav span { height: 34px; }
    .game-list { width: calc(100% - 12px); margin: 6px auto; gap: 7px; }
    .game-card { min-height: 124px; grid-template-columns: 76px minmax(0, 1fr) 55px; }
    .game-logo-block { padding: 7px 3px; }
    .game-logo-block img { width: 47px; height: 47px; }
    .game-logo-block h2 { font-size: 10px; }
    .game-logo-block p { overflow-wrap: anywhere; font-size: 8px; }
    .game-result { grid-template-rows: 24px 1fr 27px; padding: 8px 7px; }
    .next-period { overflow-wrap: anywhere; font-size: 9px; }
    .latest-balls { justify-content: flex-start; gap: 3px; }
    .draw-meta { font-size: 8px; }
    .draw-meta > span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
    .draw-meta a { height: 23px; flex: 0 0 auto; padding: 0 7px; font-size: 9px; }
    .countdown b { font-size: 15px; }
    .countdown small { font-size: 7px; }

    .history-view .hero { height: 82px; }
    .history-view .hero-content { padding-top: 13px; }
    .history-view .hero-content h1 { font-size: 22px; }
    .history-view .hero-content p { display: none; }
    .history-view .category-nav { display: none; }
    .history-page { width: 100%; margin: 0; }
    .history-shell { border: 0; border-radius: 0; box-shadow: none; }
    .history-game-summary { min-height: 87px; grid-template-columns: minmax(0, 1fr) 99px; gap: 7px; padding: 10px; }
    .history-game-identity { gap: 7px; }
    .history-game-identity img { width: 53px; height: 53px; }
    .history-game-identity h2 { margin-bottom: 3px; font-size: 14px; }
    .history-game-identity p { overflow-wrap: anywhere; font-size: 9px; }
    .detail-countdown-label { display: none; }
    .detail-countdown > span { min-width: 0; height: 54px; padding: 0 6px; }
    .detail-countdown b { font-size: 19px; }
    .current-draw { padding: 11px 10px 13px; }
    .current-draw-heading { font-size: 10px; }
    .current-draw-heading time { font-size: 8px; }
    .detail-balls { min-height: 39px; margin-top: 7px; gap: 4px; }
    .history-toolbar { height: 80px; align-items: stretch; flex-direction: column; padding: 0; }
    .history-tab { width: max-content; height: 35px; margin-left: 7px; padding: 0 8px; }
    .history-toolbar label { height: 44px; justify-content: space-between; padding: 0 10px; border-top: 1px solid #e1e6ea; }
    .history-toolbar input { width: 150px; }
    .history-pagination { justify-content: flex-start; overflow-x: auto; }
    .history-pagination button { flex: 0 0 29px; }
    .history-table { min-width: 100%; font-size: 11px; }
    .history-table th:nth-child(1) { width: 105px; }
    .history-table th:nth-child(2) { width: 112px; }
    .history-table td { height: 53px; padding: 5px 7px; }
    .history-table .history-balls { justify-content: center; }
}
