* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --navy: #07152c;
    --navy2: #0b1e3b;
    --blue: #006cff;
    --blue2: #2f80ff;
    --light: #f4f7fb;
    --white: #ffffff;
    --text: #14213d;
    --muted: #78869b;
    --border: #dce4ef;
    --green: #00ad76;
    --red: #ef3340;
}

body {
    font-family: Arial, Helvetica, sans-serif;
    background: var(--light);
    color: var(--text);
}

a {
    color: inherit;
    text-decoration: none;
}

.page-width {
    width: min(1180px, calc(100% - 40px));
    margin: auto;
}

.site-header {
    position: sticky;
    top: 0;
    z-index: 1000;
    background: #fff;
    border-bottom: 1px solid var(--border);
}

.header-inner {
    width: min(1300px, calc(100% - 40px));
    height: 72px;
    margin: auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.logo {
    display: flex;
    align-items: center;
    gap: 12px;
}

.logo-mark {
    width: 42px;
    height: 42px;
    display: grid;
    place-items: center;
    border-radius: 8px;
    background: linear-gradient(135deg, #0057ff, #00a3ff);
    color: #fff;
    font-size: 24px;
    font-weight: 900;
}

.logo strong {
    display: block;
    color: var(--navy);
    font-size: 17px;
}

.logo span {
    color: var(--blue);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 2px;
}

.header-inner nav {
    display: flex;
    gap: 35px;
}

.header-inner nav a {
    color: #526077;
    font-size: 12px;
    font-weight: 600;
}

.header-inner nav a:hover {
    color: var(--blue);
}

.menu-btn {
    display: none;
    border: 0;
    background: none;
    color: var(--navy);
    font-size: 25px;
}

.mobile-menu {
    display: none;
}

.hero {
    padding: 75px 0;
    background:
        radial-gradient(circle at 80% 40%, rgba(0,108,255,.4), transparent 35%),
        linear-gradient(120deg, #061326, #0b2147);
    color: #fff;
}

.hero-tag {
    display: inline-block;
    padding: 7px 12px;
    margin-bottom: 20px;
    border: 1px solid rgba(255,255,255,.2);
    border-radius: 5px;
    color: #8ec0ff;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 1px;
}

.hero h1 {
    font-size: clamp(38px, 5vw, 62px);
    line-height: 1.05;
    letter-spacing: -2px;
}

.hero h1 span {
    color: #4c9aff;
}

.hero p {
    max-width: 570px;
    margin-top: 20px;
    color: #9cabc1;
    font-size: 15px;
    line-height: 1.7;
}

.market-section,
.trending-section,
.history-section {
    padding: 55px 0 0;
}

.section-head {
    margin-bottom: 20px;
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
}

.section-label {
    display: block;
    margin-bottom: 5px;
    color: var(--blue);
    font-size: 10px;
    font-weight: 800;
    letter-spacing: 1.8px;
}

.section-head h2 {
    color: var(--navy);
    font-size: 25px;
}

.live-status {
    display: flex;
    align-items: center;
    gap: 7px;
    color: var(--muted);
    font-size: 10px;
    font-weight: 700;
}

.live-status span {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--green);
    box-shadow: 0 0 0 4px rgba(0,173,118,.12);
}

.market-card {
    display: grid;
    grid-template-columns: 280px 1fr;
    overflow: hidden;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: #fff;
    box-shadow: 0 8px 30px rgba(17,42,77,.06);
}

.market-info {
    padding: 28px;
    background: #fafcff;
    border-right: 1px solid var(--border);
}

.symbol-name {
    color: var(--muted);
    font-size: 11px;
    font-weight: 700;
}

.current-price {
    margin-top: 8px;
    color: var(--green);
    font-size: 34px;
    font-weight: 800;
}

.change {
    display: flex;
    gap: 5px;
    margin-top: 4px;
    color: var(--green);
    font-size: 11px;
}

.market-stats {
    margin-top: 25px;
}

.market-stats > div {
    min-height: 39px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid #e9eef5;
}

.market-stats span {
    color: var(--muted);
    font-size: 11px;
}

.market-stats strong {
    font-size: 11px;
    font-weight: 600;
}

.chart-area {
    min-width: 0;
    padding: 25px;
}

.chart-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
}

.chart-top > div:first-child strong {
    display: block;
    font-size: 14px;
}

.chart-top > div:first-child span {
    display: block;
    margin-top: 3px;
    color: var(--muted);
    font-size: 10px;
}

.chart-buttons {
    display: flex;
    gap: 4px;
}

.chart-buttons button {
    height: 28px;
    padding: 0 10px;
    border: 1px solid var(--border);
    border-radius: 4px;
    background: #fff;
    color: var(--muted);
    font-size: 9px;
    cursor: pointer;
}

.chart-buttons button.active {
    border-color: var(--blue);
    background: var(--blue);
    color: white;
}

.chart-container {
    width: 100%;
    height: 320px;
    margin-top: 15px;
}

.chart-container canvas {
    width: 100% !important;
    height: 100% !important;
}

.result-panel {
    min-height: 60px;
    margin-top: 15px;
    display: grid;
    grid-template-columns: 1fr 160px 160px;
    overflow: hidden;
    border: 1px solid var(--border);
    border-radius: 6px;
}

.result-label,
.result-number {
    display: flex;
    align-items: center;
    padding: 0 18px;
}

.result-label {
    gap: 9px;
    color: var(--muted);
    font-size: 10px;
    font-weight: 700;
}

.pulse {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--blue);
    box-shadow: 0 0 0 4px rgba(0,108,255,.12);
}

.result-number {
    justify-content: space-between;
    border-left: 1px solid var(--border);
}

.result-number span {
    color: var(--muted);
    font-size: 9px;
}

.result-number strong {
    color: var(--blue);
    font-size: 19px;
}

.last-update {
    margin-top: 9px;
    color: #9aa6b6;
    font-size: 9px;
    text-align: right;
}

.index-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
}

.index-card {
    position: relative;
    padding: 22px;
    overflow: hidden;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: #fff;
    box-shadow: 0 4px 15px rgba(17,42,77,.04);
}

.index-card::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    width: 3px;
    height: 100%;
    background: var(--blue);
}

.index-code {
    color: var(--navy);
    font-size: 13px;
    font-weight: 800;
}

.index-name {
    margin-top: 3px;
    color: var(--muted);
    font-size: 10px;
}

.index-value {
    margin-top: 22px;
    color: var(--navy);
    font-size: 20px;
    font-weight: 700;
}

.index-down {
    margin-top: 6px;
    color: var(--red);
    font-size: 10px;
}

.latest-text {
    color: var(--muted);
    font-size: 10px;
}

.history-section {
    padding-bottom: 70px;
}

.history-card {
    overflow: hidden;
    border: 1px solid var(--border);
    border-radius: 9px;
    background: #fff;
    box-shadow: 0 8px 30px rgba(17,42,77,.05);
}

.table-scroll {
    overflow-x: auto;
}

#sgxHistoryTable {
    width: 100%;
    min-width: 600px;
    border-collapse: collapse;
    text-align: center;
}

#sgxHistoryTable th {
    padding: 15px;
    background: #f3f7fc;
    border-bottom: 1px solid var(--border);
    color: #5d6a7d;
    font-size: 9px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .7px;
}

#sgxHistoryTable td {
    padding: 13px 15px;
    border-bottom: 1px solid #e8edf4;
    color: #173765;
    font-size: 11px;
    font-weight: 600;
}

#sgxHistoryTable tbody tr:hover {
    background: #f5f9ff;
}

#sgxHistoryTable tbody tr:last-child td {
    border-bottom: 0;
}

footer {
    background: var(--navy);
    color: #fff;
}

.footer-grid {
    padding: 50px 0;
    display: grid;
    grid-template-columns: 1.5fr 1fr 1fr 1fr;
    gap: 50px;
}

.footer-logo {
    font-size: 18px;
    font-weight: 800;
}

.footer-logo span {
    color: #4c9aff;
}

footer p {
    max-width: 270px;
    margin-top: 15px;
    color: #7f90a9;
    font-size: 11px;
    line-height: 1.7;
}

footer h4 {
    margin-bottom: 15px;
    font-size: 10px;
}

footer a {
    display: block;
    margin-bottom: 9px;
    color: #8191a9;
    font-size: 10px;
}

footer a:hover {
    color: white;
}

.copyright {
    padding: 17px;
    border-top: 1px solid rgba(255,255,255,.08);
    color: #62738e;
    font-size: 9px;
    text-align: center;
}

@media (max-width: 900px) {
    .header-inner nav {
        display: none;
    }

    .menu-btn {
        display: block;
    }

    .mobile-menu.show {
        display: flex;
        padding: 5px 20px 20px;
        flex-direction: column;
        background: #fff;
    }

    .mobile-menu a {
        padding: 12px 5px;
        border-bottom: 1px solid var(--border);
        font-size: 12px;
    }

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

    .market-info {
        border-right: 0;
        border-bottom: 1px solid var(--border);
    }

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

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

@media (max-width: 600px) {
    .page-width,
    .header-inner {
        width: calc(100% - 24px);
    }

    .header-inner {
        height: 62px;
    }

    .hero {
        padding: 55px 0;
    }

    .hero h1 {
        font-size: 38px;
    }

    .market-section,
    .trending-section,
    .history-section {
        padding-top: 40px;
    }

    .market-info,
    .chart-area {
        padding: 18px;
    }

    .chart-top {
        align-items: flex-start;
        flex-direction: column;
    }

    .chart-buttons {
        width: 100%;
    }

    .chart-buttons button {
        flex: 1;
        padding: 0 4px;
    }

    .chart-container {
        height: 250px;
    }

    .result-panel {
        grid-template-columns: 1fr 1fr;
    }

    .result-label {
        grid-column: 1 / -1;
        min-height: 40px;
        border-bottom: 1px solid var(--border);
    }

    .result-number {
        min-height: 55px;
    }

    .result-number:nth-child(2) {
        border-left: 0;
    }

    .section-head {
        align-items: flex-start;
        flex-direction: column;
        gap: 8px;
    }

    .footer-grid {
        grid-template-columns: 1fr;
        gap: 30px;
    }
}