* {
    box-sizing: border-box;
}

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

.top-header {
    width: 100%;
}

.top-main {
    min-height: 48px;
    padding: 0 30px;
    display: flex;
    align-items: center;
    gap: 22px;
    background: #202020;
}

.brand {
    color: #fff;
    text-decoration: none;
    font-size: 21px;
    white-space: nowrap;
}

.brand span {
    color: #bbb;
    font-weight: 400;
}

.search-box {
    width: 355px;
    height: 34px;
    display: flex;
    background: #fff;
    border-radius: 2px;
    overflow: hidden;
}

.search-box input {
    flex: 1;
    min-width: 0;
    padding: 0 12px;
    border: 0;
    outline: 0;
    color: #555;
}

.search-box button {
    width: 40px;
    border: 0;
    background: #fff;
    cursor: pointer;
}

.promo-btn {
    padding: 11px 20px;
    background: #f5a623;
    color: #111;
    text-decoration: none;
    font-size: 12px;
    font-weight: 700;
}

.account-links {
    display: flex;
    gap: 10px;
    margin-left: auto;
    color: #ddd;
    font-size: 11px;
}

.account-links a {
    color: #fff;
    text-decoration: none;
    font-weight: 700;
}

.main-nav {
    height: 38px;
    padding: 0 30px;
    display: flex;
    align-items: center;
    gap: 28px;
    background: #101010;
    overflow-x: auto;
}

.main-nav a {
    color: #ddd;
    text-decoration: none;
    white-space: nowrap;
    font-size: 11px;
    font-weight: 600;
}

.main-nav .wealth {
    color: #f3a51d;
}

.sub-nav {
    min-height: 34px;
    padding: 0 20px;
    display: flex;
    align-items: stretch;
    border-bottom: 1px solid #ddd;
    background: #f4f4f4;
    overflow-x: auto;
}

.sub-nav a {
    padding: 11px 14px 9px;
    color: #666;
    text-decoration: none;
    white-space: nowrap;
    font-size: 10px;
}

.sub-nav a.active {
    background: #fff;
    color: #111;
    font-weight: 700;
}

.sub-nav .smart {
    background: #e5e9ed;
    font-weight: 700;
}

.page-container {
    width: 950px;
    max-width: calc(100% - 40px);
    margin: 28px auto 70px;
}

.blue-title {
    width: 600px;
    max-width: 64%;
    height: 50px;
    margin-bottom: 18px;
    position: relative;
    display: flex;
    align-items: center;
    background: #07529b;
    color: #fff;
    font-size: 23px;
    font-weight: 700;
}

.blue-title span {
    padding-left: 10px;
    position: relative;
    z-index: 2;
}

.blue-title::after {
    content: "";
    width: 75px;
    height: 50px;
    position: absolute;
    top: 0;
    right: -45px;
    background: #07529b;
    transform: skew(45deg);
}

.content-grid {
    display: grid;
    grid-template-columns: minmax(0, 600px) 300px;
    gap: 34px;
}

.market-card {
    width: 100%;
}

.market-card h1 {
    margin: 0 0 18px 17px;
    color: #344054;
    font-size: 21px;
}

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

.market-info {
    padding-left: 17px;
}

.current-price {
    color: #10b981;
    font-size: 30px;
    font-weight: 700;
}

.change-line {
    margin-top: 10px;
    color: #10b981;
    font-size: 13px;
    font-weight: 700;
}

.stats-list {
    margin-top: 23px;
}

.stat-row {
    min-height: 36px;
    padding: 0 0 0 0;
    border-bottom: 1px solid #eee;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 15px;
    color: #666;
    font-size: 12px;
}

.stat-row strong {
    color: #46536a;
    font-weight: 400;
}

.chart-side {
    min-width: 0;
}

.chart-controls {
    height: 34px;
    display: flex;
    justify-content: flex-end;
    align-items: flex-end;
}

.chart-controls button {
    height: 28px;
    padding: 0 12px;
    border: 1px solid #ccc;
    border-right: 0;
    background: #fff;
    color: #555;
    font-size: 10px;
    cursor: pointer;
}

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

.chart-controls button.active {
    border: 1px solid #17851c;
}

.chart-container {
    width: 100%;
    height: 255px;
    border-left: 1px solid #eee;
    position: relative;
}

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

.result-bar {
    width: 100%;
    height: 33px;
    margin-top: 12px;
    display: grid;
    grid-template-columns: 1.5fr .75fr .18fr 1.45fr .18fr;
    border: 1px solid #ccc;
}

.result-bar div {
    display: flex;
    align-items: center;
    justify-content: center;
    border-right: 1px solid #ccc;
    background: #fafafa;
    color: #3d4758;
    font-size: 11px;
    font-weight: 700;
}

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

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

.market-sidebar {
    min-height: 440px;
    border: 1px solid #ddd;
    border-radius: 7px;
    overflow: hidden;
}

.challenge-btn {
    height: 34px;
    margin: 11px 10px 5px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 3px;
    background: #1261aa;
    color: #fff;
    text-decoration: underline;
    font-size: 12px;
    font-weight: 700;
}

.sidebar-title {
    padding: 0 11px 8px;
    color: #222;
    font-size: 14px;
    font-weight: 700;
}

.sidebar-tabs {
    height: 31px;
    padding-left: 10px;
    display: flex;
    border-bottom: 1px solid #ddd;
}

.sidebar-tabs button {
    padding: 0 8px;
    border: 0;
    background: transparent;
    color: #555;
    font-size: 10px;
}

.sidebar-tabs button.active {
    border-bottom: 2px solid #2173bd;
    color: #1261aa;
    font-weight: 700;
}

.stock-head,
.stock-row {
    display: grid;
    grid-template-columns: 1.5fr .55fr .7fr .65fr;
    align-items: center;
    gap: 5px;
}

.stock-head {
    padding: 10px;
    color: #777;
    font-size: 8px;
}

.stock-row {
    min-height: 37px;
    padding: 0 10px;
    border-top: 1px solid #eee;
    color: #333;
    font-size: 10px;
}

.stock-row strong {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.up {
    color: #18a65b;
    font-weight: 700;
}

.down {
    color: #e53535;
    font-weight: 700;
}

.ad-text {
    padding: 12px;
    color: #aaa;
    text-align: center;
    font-size: 8px;
}

.history-section {
    width: 600px;
    max-width: 64%;
    margin-top: 80px;
}

.history-section h2 {
    margin: 0 0 13px 5px;
    color: #333;
    font-size: 21px;
}

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

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

#sgxHistoryTable th {
    height: 34px;
    padding: 8px;
    border: 1px solid #d6d6d6;
    background: #eee;
    color: #333;
    text-align: center;
    font-size: 11px;
}

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

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

.site-footer {
    min-height: 170px;
    padding: 28px 20px;
    border-top: 3px solid #292929;
    background: #111;
    color: #777;
    font-size: 9px;
    line-height: 1.7;
}

.site-footer p {
    max-width: 1400px;
    margin: 0 auto 18px;
}

@media (max-width: 900px) {
    .top-main {
        padding: 8px 15px;
        flex-wrap: wrap;
    }

    .search-box {
        width: 100%;
        order: 5;
    }

    .promo-btn {
        display: none;
    }

    .main-nav {
        padding: 0 15px;
    }

    .page-container {
        max-width: calc(100% - 24px);
    }

    .blue-title {
        max-width: 100%;
        width: calc(100% - 45px);
    }

    .content-grid {
        grid-template-columns: 1fr;
    }

    .market-sidebar {
        display: none;
    }

    .market-layout {
        grid-template-columns: 220px minmax(0, 1fr);
    }

    .history-section {
        width: 100%;
        max-width: 100%;
    }
}

@media (max-width: 650px) {
    .brand {
        font-size: 18px;
    }

    .account-links {
        display: none;
    }

    .blue-title {
        font-size: 19px;
    }

    .market-card h1 {
        margin-left: 0;
    }

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

    .market-info {
        padding-left: 0;
    }

    .chart-container {
        height: 260px;
    }

    .chart-controls {
        justify-content: flex-start;
    }

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

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