* {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    margin: 0;
    background: #ffffff;
    color: #333;
    font-family: Arial, Helvetica, sans-serif;
}

.top-header {
    width: calc(100% - 46px);
    max-width: 1500px;
    height: 112px;
    margin: 10px auto 0;
    position: relative;
    background: #0e5505;
    overflow: hidden;
}

.header-brand {
    width: 44%;
    height: 63px;
    padding: 16px 15px;
    position: relative;
    background: #0e5505;
    color: #fff;
    font-size: 27px;
    line-height: 30px;
    font-weight: 700;
    font-style: italic;
}

.header-brand::after {
    content: "";
    position: absolute;
    top: 0;
    right: -65px;
    width: 130px;
    height: 63px;
    background: #fff;
    transform: skew(45deg);
}

.main-nav {
    height: 49px;
    padding-right: 15px;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 26px;
}

.main-nav a {
    color: #fff;
    text-decoration: none;
    font-size: 14px;
    white-space: nowrap;
}

.main-nav a:hover {
    text-decoration: underline;
}

.page-container {
    width: calc(100% - 46px);
    max-width: 1500px;
    margin: 0 auto;
    background: #fff;
}

.market-section {
    padding: 42px 25px 0;
}

.market-section h1 {
    margin: 0 0 4px;
    color: #111;
    font-size: 19px;
    font-weight: 700;
}

.price-line {
    min-height: 47px;
    display: flex;
    align-items: center;
    gap: 12px;
}

#current-price {
    color: #10b981;
    font-size: 37px;
    line-height: 45px;
    font-weight: 700;
}

.change-wrap {
    color: #10b981;
    font-size: 15px;
    font-weight: 600;
}

.market-status {
    margin-top: 0;
    color: #777;
    font-size: 11px;
}

.market-status a {
    color: #555;
}

.divider {
    height: 1px;
    margin-top: 12px;
    background: #ddd;
}

.time-controls {
    display: flex;
    margin-top: 13px;
}

.time-controls button {
    min-width: 39px;
    height: 27px;
    padding: 0 10px;
    border: 1px solid #ccc;
    border-right: 0;
    background: #fff;
    color: #444;
    font-size: 11px;
    cursor: pointer;
}

.time-controls button:last-child {
    border-right: 1px solid #ccc;
}

.time-controls button.active {
    border-color: #087bea;
    background: #087bea;
    color: #fff;
}

.chart-container {
    width: 100%;
    height: 300px;
    margin-top: 12px;
    border-bottom: 1px solid #ddd;
    position: relative;
}

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

.market-data {
    margin-top: 13px;
    border-top: 1px solid #ddd;
}

.market-data-row {
    min-height: 35px;
    border-bottom: 1px solid #ddd;
    display: grid;
    grid-template-columns: 1fr 1fr 1fr 1fr;
    align-items: center;
}

.data-label {
    padding-left: 10px;
    color: #666;
    font-size: 12px;
}

.data-value {
    padding-right: 10px;
    color: #45536a;
    text-align: right;
    font-size: 12px;
    font-weight: 700;
}

.data-label.right {
    text-align: right;
}

.data-value.right {
    text-align: right;
}

.result-bar {
    width: 100%;
    height: 40px;
    margin-top: 13px;
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    background: #282828;
}

.result-bar > div {
    border-right: 1px solid #111;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 12px;
    font-weight: 700;
}

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

.result-number {
    background: #202020;
}

.update-time {
    margin-top: 10px;
    color: #999;
    text-align: right;
    font-size: 9px;
}

.history-section {
    padding: 60px 0 55px;
}

.history-section h2 {
    margin: 0 0 17px 5px;
    color: #333;
    font-size: 22px;
    font-weight: 700;
}

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

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

#sgxHistoryTable th {
    height: 36px;
    padding: 8px;
    border: 1px solid #d5d5d5;
    background: #f0f0f0;
    color: #333;
    text-align: center;
    font-size: 11px;
    font-weight: 700;
}

#sgxHistoryTable td {
    height: 36px;
    padding: 8px;
    border: 1px solid #d8d8d8;
    background: #fff;
    color: #3c3c3c;
    text-align: center;
    font-size: 13px;
}

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

.footer {
    width: calc(100% - 46px);
    max-width: 1500px;
    min-height: 53px;
    margin: 0 auto;
    padding: 11px 10px;
    background: #0e5505;
    color: #ddd;
    font-size: 12px;
    line-height: 19px;
}

@media (max-width: 900px) {
    .top-header {
        height: auto;
    }

    .header-brand {
        width: 100%;
    }

    .header-brand::after {
        display: none;
    }

    .main-nav {
        padding: 12px 15px;
        height: auto;
        justify-content: flex-start;
        gap: 18px;
        overflow-x: auto;
    }

    .market-data-row {
        grid-template-columns: 1fr 1fr;
    }

    .data-label.right {
        padding-top: 10px;
        text-align: left;
    }

    .data-value.right {
        padding-top: 10px;
    }
}

@media (max-width: 600px) {
    .top-header,
    .page-container,
    .footer {
        width: 100%;
    }

    .header-brand {
        font-size: 22px;
    }

    .market-section {
        padding: 25px 12px 0;
    }

    .market-section h1 {
        font-size: 17px;
    }

    #current-price {
        font-size: 30px;
    }

    .change-wrap {
        font-size: 13px;
    }

    .time-controls {
        overflow-x: auto;
    }

    .time-controls button {
        flex-shrink: 0;
    }

    .chart-container {
        height: 260px;
    }

    .result-bar {
        grid-template-columns: 1.1fr .8fr .8fr 1fr .8fr;
    }

    .history-section {
        padding-top: 45px;
    }

    .history-section h2 {
        font-size: 19px;
        margin-left: 12px;
    }

    #sgxHistoryTable {
        min-width: 600px;
    }
}