html,
body {
    margin: 0;
    padding: 0;
    height: 100%;
    overflow: hidden;
    font-family: "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
}

.video-background {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    z-index: -1;
}

.container {
    position: relative;
    width: 100%;
    height: 90%;
}

h1 {
    text-align: center;
    color: #fff;
    margin: 14px 0 6px;
    font-size: 32px;
    letter-spacing: 0.5px;
}

.chart1 {
    position: absolute;
    top: 5%;
    left: 2%;
    width: 32%;
    height: 100%;
}

.chart2 {
    position: absolute;
    top: 10%;
    left: 36%;
    right: 2%;
    width: auto;
    height: 95%;
}

#gexChart,
#priceChart {
    opacity: 1;
}

#eastern-time {
    position: absolute;
    top: 40px;
    right: 45px;
    color: #fff;
    font-size: 18px;
    font-weight: 700;
    font-family: Orbitron, sans-serif;
}

#current-time {
    position: absolute;
    top: 70px;
    right: 10px;
    color: #fff;
    font-size: 14px;
    font-weight: 700;
    font-family: Orbitron, sans-serif;
    display: none;
}

.time-bar {
    position: relative;
}

.view-switch {
    display: none;
}

.overlay-stage {
    display: none;
}

@media (max-width: 900px) {
    html,
    body {
        overflow-y: auto;
        overflow-x: hidden;
    }

    .video-background {
        position: fixed;
    }

    .container {
        height: auto;
        min-height: 100%;
        display: flex;
        flex-direction: column;
        gap: 16px;
        padding: 18px 14px calc(90px + env(safe-area-inset-bottom, 0px));
        box-sizing: border-box;
    }

    h1 {
        margin: 2px 2px 6px;
        font-size: 24px;
        text-align: center;
        line-height: 1.2;
        text-shadow: 0 4px 20px rgba(0, 0, 0, 0.35);
    }

    .chart1,
    .chart2 {
        position: relative;
        top: auto;
        left: auto;
        right: auto;
        width: 100%;
        border-radius: 18px;
        background: linear-gradient(160deg, rgba(18, 23, 32, 0.5), rgba(14, 16, 22, 0.3));
        border: 1px solid rgba(255, 255, 255, 0.16);
        box-shadow: 0 14px 35px rgba(0, 0, 0, 0.28), inset 0 1px 0 rgba(255, 255, 255, 0.13);
        backdrop-filter: blur(4px);
        -webkit-backdrop-filter: blur(4px);
    }

    .chart1 {
        height: 40vh;
        min-height: 280px;
    }

    .chart2 {
        height: 42vh;
        min-height: 300px;
    }

    .time-bar {
        position: fixed;
        left: 10px;
        right: 10px;
        bottom: calc(10px + env(safe-area-inset-bottom, 0px));
        z-index: 20;
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 10px;
        padding: 10px 12px;
        border-radius: 14px;
        background: rgba(8, 12, 20, 0.55);
        border: 1px solid rgba(255, 255, 255, 0.2);
        box-shadow: 0 10px 24px rgba(0, 0, 0, 0.3);
        backdrop-filter: blur(8px);
        -webkit-backdrop-filter: blur(8px);
    }

    #eastern-time,
    #current-time {
        position: static;
        display: block;
        margin: 0;
        font-size: 11px;
        line-height: 1.3;
        letter-spacing: 0.25px;
        white-space: nowrap;
    }
}

@media (max-width: 1024px) and (orientation: landscape) and (pointer: coarse) {
    .container {
        height: 100vh;
        min-height: 0;
        display: grid;
        grid-template-columns: 1fr 1fr;
        grid-template-rows: auto 1fr;
        column-gap: 12px;
        row-gap: 10px;
        padding: 10px 12px calc(60px + env(safe-area-inset-bottom, 0px));
        box-sizing: border-box;
    }

    h1 {
        grid-column: 1 / -1;
        margin: 0;
        font-size: 20px;
        text-align: center;
    }

    .chart1,
    .chart2 {
        min-height: 0;
        height: calc(100vh - 108px - env(safe-area-inset-bottom, 0px));
    }

    .chart1 {
        grid-column: 1;
    }

    .chart2 {
        grid-column: 2;
    }

    .time-bar {
        left: 12px;
        right: 12px;
        bottom: calc(6px + env(safe-area-inset-bottom, 0px));
        padding: 8px 10px;
    }

    #eastern-time,
    #current-time {
        font-size: 10px;
    }
}

@media (max-width: 900px) and (orientation: portrait) {
    .view-switch {
        display: flex;
        gap: 8px;
        align-self: center;
        margin-top: 30px;
        margin-bottom: 0;
    }

    .view-btn {
        border: 1px solid rgba(255, 255, 255, 0.4);
        background: rgba(0, 0, 0, 0.25);
        color: #fff;
        border-radius: 999px;
        padding: 6px 14px;
        font-size: 12px;
        font-weight: 600;
    }

    .view-btn.active {
        background: rgba(255, 255, 255, 0.18);
        border-color: rgba(255, 255, 255, 0.8);
    }

    body.mobile-view-2 .chart1,
    body.mobile-view-2 .chart2 {
        display: none;
    }

    body.mobile-view-2 .overlay-stage {
        display: block;
        width: 100%;
        height: 62vh;
        min-height: 430px;
        border-radius: 18px;
        background: linear-gradient(160deg, rgba(18, 23, 32, 0.5), rgba(14, 16, 22, 0.3));
        border: 1px solid rgba(255, 255, 255, 0.16);
        box-shadow: 0 14px 35px rgba(0, 0, 0, 0.28), inset 0 1px 0 rgba(255, 255, 255, 0.13);
        backdrop-filter: blur(4px);
        -webkit-backdrop-filter: blur(4px);
        margin-top: auto;
        margin-bottom: auto;
        transform: translateY(26px);
    }

    body.mobile-view-2 .container {
        justify-content: center;
    }


    .overlay-chart {
        width: 100%;
        height: 100%;
    }

    body.mobile-view-1 .chart1 {
        height: 42vh;
        min-height: 292px;
    }
}
