* {
    box-sizing: border-box;
}

html,
body {
    margin: 0;
    padding: 0;
}

body {
    font-family: Arial, Helvetica, sans-serif;
    color: #414854;
    background:
        radial-gradient(circle at 15% 35%, rgba(245, 231, 225, .6), transparent 30%),
        radial-gradient(circle at 90% 80%, rgba(239, 229, 215, .55), transparent 35%),
        #f8f8f8;
    min-height: 100vh;
}

.site-header {
    height: 72px;
    background:
        radial-gradient(circle at 4px 4px, rgba(224, 167, 46, .45) 1px, transparent 1.5px) 0 0 / 12px 12px,
        linear-gradient(120deg, #132442, #07162c 70%, #091b35);
    color: #fff;
}

.header-container {
    width: 100%;
    max-width: 1200px;
    height: 72px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: stretch;
}

.header-link {
    width: 180px;
    color: #fff;
    text-decoration: none;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    font-family: Georgia, serif;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
}

.header-link.active {
    background: linear-gradient(135deg, rgba(255,255,255,.04), rgba(255,255,255,0));
}

.header-icon {
    font-family: Arial, sans-serif;
    font-size: 26px;
    line-height: 26px;
    margin-bottom: 2px;
}

.page-container {
    width: calc(100% - 30px);
    max-width: 1090px;
    margin: 18px auto 80px;
}

.market-box {
    background: #fff;
    border: 1px solid #dedede;
    border-radius: 5px;
    box-shadow: 0 2px 6px rgba(0,0,0,.07);
    padding: 10px 16px 18px;
}

.market-box h1 {
    margin: 0 0 20px;
    font-size: 22px;
    line-height: 30px;
    color: #34455b;
    font-weight: 700;
}

.market-grid {
    display: grid;
    grid-template-columns: 260px minmax(0, 1fr);
    gap: 26px;
}

.market-left {
    padding: 2px 0 0;
}

.current-price {
    color: #10b981;
    font-size: 32px;
    line-height: 40px;
    font-weight: 700;
    margin-bottom: 7px;
}

.change-row {
    color: #10b981;
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 18px;
}

.stock-info > div {
    min-height: 37px;
    border-bottom: 1px solid #ececec;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 15px;
    font-size: 12px;
}

.stock-info span {
    color: #707783;
}

.stock-info strong {
    color: #596272;
    font-weight: 500;
}

.market-right {
    min-width: 0;
}

.chart-buttons {
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: flex-end;
}

.chart-buttons button {
    height: 29px;
    padding: 0 12px;
    background: #fff;
    color: #4d535c;
    border: 1px solid #c9cdd1;
    border-right: 0;
    font-size: 10px;
    cursor: pointer;
}

.chart-buttons button:first-child {
    border-radius: 2px 0 0 2px;
}

.chart-buttons button:last-child {
    border-right: 1px solid #c9cdd1;
    border-radius: 0 2px 2px 0;
}

.chart-buttons button.selected {
    color: #202020;
    border: 1px solid #19963a;
    font-weight: 700;
}

.chart-container {
    width: 100%;
    height: 275px;
    position: relative;
}

#myChart {
    width: 100% !important;
    height: 100% !important;
}

.result-strip {
    display: grid;
    grid-template-columns: 2fr 1fr .28fr 2fr .28fr;
    min-height: 36px;
    margin-top: 8px;
    border: 1px solid #c8c8c8;
    background: #fafafa;
}

.result-strip > div {
    border-right: 1px solid #c8c8c8;
    display: flex;
    justify-content: center;
    align-items: center;
    min-width: 0;
    font-size: 11px;
    font-weight: 600;
    color: #545d69;
}

.result-strip > div:last-child {
    border-right: 0;
}

.result-strip #custom-top,
.result-strip #custom-bottom {
    background: #fff;
    color: #222;
}

.market-date {
    text-align: right;
    color: #999;
    font-size: 9px;
    margin-top: 17px;
}

.lottery-cards {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 18px;
    margin-top: 18px;
}

.lottery-card {
    background: #fff;
    border: 1px solid #d8d8d8;
    border-radius: 4px;
    overflow: hidden;
    min-height: 475px;
    box-shadow: 0 2px 6px rgba(0,0,0,.06);
}

.lottery-card-header {
    min-height: 68px;
    padding: 11px 11px 8px;
    color: #fff;
}

.lottery-card-header h3 {
    margin: 0;
    text-align: center;
    font-size: 16px;
    line-height: 23px;
}

.lottery-card-header.red {
    background: #e51f2a;
}

.lottery-card-header.blue {
    background: #002f91;
}

.lottery-card-header.yellow {
    background: #ffed00;
    color: #111;
}

.draw-info {
    margin-top: 8px;
    padding-top: 6px;
    border-top: 1px solid rgba(255,255,255,.3);
    display: flex;
    justify-content: space-between;
    gap: 5px;
    font-size: 8px;
    font-weight: 400;
}

.yellow .draw-info {
    border-color: rgba(0,0,0,.2);
}

.lottery-body {
    padding: 15px 11px;
}

.black-title {
    height: 25px;
    background: #2e2e2e;
    color: #fff;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 9px;
    font-weight: 700;
    margin-bottom: 5px;
}

.second-title {
    margin-top: 18px;
}

.prize-grid {
    display: grid;
    grid-template-columns: 44px 1fr 44px 1fr;
    border-top: 1px solid #ddd;
    border-left: 1px solid #ddd;
}

.prize-grid span,
.prize-grid strong {
    min-height: 31px;
    border-right: 1px solid #ddd;
    border-bottom: 1px solid #ddd;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 11px;
}

.prize-grid span {
    font-weight: 700;
    color: #5e6670;
}

.prize-grid strong {
    color: #48546a;
}

.six-d-main {
    min-height: 31px;
    display: grid;
    grid-template-columns: 65px 1fr;
    border: 1px solid #ddd;
}

.six-d-main span,
.six-d-main strong {
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 11px;
}

.six-d-main span {
    border-right: 1px solid #ddd;
    font-weight: 700;
}

.six-d-main strong {
    color: #ef202a;
    font-size: 14px;
}

.six-row {
    min-height: 30px;
    display: grid;
    grid-template-columns: 65px 1fr 38px 1fr;
    border-left: 1px solid #ddd;
    border-bottom: 1px solid #ddd;
}

.six-row > * {
    border-right: 1px solid #ddd;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
}

.ball-row {
    display: flex;
    justify-content: center;
    align-items: center;
    flex-wrap: wrap;
    gap: 7px;
    padding: 8px 0;
}

.ball-row span,
.winning-balls span {
    width: 25px;
    height: 25px;
    border-radius: 50%;
    border: 1px solid #c9cdd2;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 9px;
    font-weight: 700;
    background: #fff;
}

.ball-row .red-ball {
    background: #e92731;
    color: #fff;
    border-color: #e92731;
}

.jackpot {
    font-size: 10px;
    font-weight: 700;
}

.jackpot strong {
    color: #e41e2b;
}

.rank-result {
    min-height: 55px;
    display: grid;
    grid-template-columns: 80px 1fr 60px;
    align-items: center;
    border-bottom: 1px solid #eee;
}

.rank-result span {
    font-size: 10px;
    font-weight: 700;
}

.rank-result strong {
    text-align: center;
    font-size: 16px;
    color: #444;
}

.rank-result em {
    background: #e31f2a;
    color: #fff;
    font-size: 7px;
    padding: 4px 3px;
    text-align: center;
    font-style: normal;
}

.bonus-text {
    text-align: right;
    color: #aaa;
    font-size: 8px;
    margin: 4px 0 8px;
}

.special-number-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 4px;
}

.special-number-grid span {
    min-height: 30px;
    border: 1px solid #ddd;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #637083;
    font-size: 10px;
}

.winning-balls {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 7px;
    margin: 10px 0 17px;
}

.gold-text {
    text-align: center;
    color: #b18b00;
    font-size: 11px;
    font-weight: 700;
    margin-bottom: 16px;
}

.jackpot-boxes {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 3px;
    margin: 10px 0;
}

.jackpot-boxes span {
    width: 23px;
    height: 21px;
    border: 1px solid #aaa;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 9px;
    font-weight: 700;
}

.jackpot-boxes .red-box {
    color: #fff;
    background: #e11d2c;
    border-color: #e11d2c;
}

.big-jackpot {
    text-align: center;
    color: #e31f2b;
    font-weight: 700;
    font-size: 12px;
}

.history-section {
    margin-top: 20px;
}

.history-section h2 {
    margin: 0 0 13px 3px;
    color: #303030;
    font-size: 21px;
    font-weight: 700;
}

.table-scroll {
    width: 100%;
    overflow-x: auto;
}

#sgxHistoryTable {
    width: 100%;
    border-collapse: collapse;
    table-layout: fixed;
    background: #fff;
}

#sgxHistoryTable th {
    height: 38px;
    border: 1px solid #cfd1d3;
    background: #f4f4f4;
    color: #333;
    text-align: center;
    font-size: 11px;
}

#sgxHistoryTable td {
    height: 38px;
    padding: 5px 10px;
    border: 1px solid #d2d4d6;
    color: #444;
    text-align: center;
    font-size: 11px;
}

#sgxHistoryTable tbody tr:hover td {
    background: #fafafa;
}

.promo-grid {
    margin-top: 40px;
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 14px;
}

.promo-placeholder {
    min-height: 265px;
    padding: 15px;
    display: flex;
    align-items: center;
    justify-content: center;
    background:
        radial-gradient(circle at 30% 30%, #ffdc4b 0 5%, transparent 6%),
        radial-gradient(circle at 70% 70%, #ff4d20 0 5%, transparent 6%),
        linear-gradient(135deg, #ff5c17, #ffbd18);
    border: 1px solid #ddd;
    color: #fff;
    text-align: center;
    font-size: 20px;
    font-weight: 800;
}

.dark-promo {
    flex-direction: column;
    background: linear-gradient(135deg, #5d0000, #c00000);
}

.dark-promo strong {
    font-size: 24px;
    margin-bottom: 15px;
}

.dark-promo span {
    font-size: 14px;
}

@media (max-width: 850px) {
    .market-grid {
        grid-template-columns: 1fr;
    }

    .lottery-cards {
        grid-template-columns: 1fr;
    }

    .lottery-card {
        min-height: auto;
    }

    .promo-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .chart-container {
        height: 260px;
    }
}

@media (max-width: 560px) {
    .site-header,
    .header-container {
        height: 60px;
    }

    .header-link {
        width: 33.333%;
        font-size: 9px;
    }

    .page-container {
        width: calc(100% - 16px);
        margin-top: 8px;
    }

    .market-box {
        padding: 12px;
    }

    .market-box h1 {
        font-size: 19px;
    }

    .current-price {
        font-size: 29px;
    }

    .chart-buttons {
        justify-content: flex-start;
        overflow-x: auto;
    }

    .chart-buttons button {
        flex-shrink: 0;
    }

    .chart-container {
        height: 230px;
    }

    .result-strip {
        grid-template-columns: 1.5fr .8fr .5fr 1fr .5fr;
    }

    #sgxHistoryTable {
        min-width: 550px;
    }

    .promo-grid {
        grid-template-columns: 1fr 1fr;
        gap: 8px;
    }

    .promo-placeholder {
        min-height: 180px;
    }
}