@media (min-width: 769px) {

    /* Body is a flex column: main content + footer share 100vh.
       overflow:hidden prevents touchscreen bounce without clipping the footer. */
    html {
        height: 100vh;
        overflow: hidden !important;
    }
    body {
        height: 100vh;
        overflow: hidden !important;
        display: flex;
        flex-direction: column;
    }

    /* Main content area grows to fill whatever height remains after the footer */
    .scroll-portrait {
        flex: 1 1 0;
        min-height: 0;
        overflow: hidden;
    }

    .scroll-portrait>.container-fluid,
    .scroll-portrait>.container-fluid>.row {
        height: 100%;
    }

    .scroll-portrait>.container-fluid>.row {
        display: flex;
        align-items: stretch;
        flex-wrap: nowrap;
    }

    .scroll-portrait>.container-fluid>.row>.col {
        display: flex;
        flex-direction: column;
        min-width: 0;
        min-height: 0;
    }

    /* Left column: board column.
       Formula: min(60vw, calc(100vh - 78px))
         - 100vh minus footer (~30px) minus board overhead (~48px) = 78px total
         - 60vw: caps the board column on very wide monitors so the right
           column always gets at least 40% of the viewport width.
       The right column (flex: 1 1 0) takes whatever is left. */
    .scroll-portrait>.container-fluid>.row>.col:first-child {
        flex: 0 0 min(60vw, calc(100vh - 78px));
        width: min(60vw, calc(100vh - 78px));
    }

    /* Right column: flex column, fills remaining height */
    #col-info {
        flex: 1 1 0;
        min-height: 0;
        display: flex;
        flex-direction: column;
    }

    #right-panel {
        flex: 1;
        min-height: 0;
    }

    /* Footer: fixed height at the bottom of the flex body */
    #pico-footer {
        flex-shrink: 0;
    }

}@media (prefers-color-scheme: dark) {
    .continuation-moves {
        color: #adb5bd;
    }
}

@media (min-width: 800px) and (min-height: 600px) {
    .scroll_movelist {
        height: 25vh;
        min-height: 160px;
        max-height: 25vh;
        overflow-y: auto;
        overflow-x: hidden;
    }
}
