html,
body {
    height: 100%;
    margin: 0;
}

#container_of_all {
    height: 100vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

#canvas_wrap {
    flex: 6;
    min-height: 0;
}

#game_canvas {
    width: 100%;
    height: 100%;
    display: block;
}



#container_of_ui {
    flex: 4;
    /* 40% */
    width: 100%;
    min-height: 0;
    /* critical: allow internal scroll */
    overflow: auto;
    padding: 10px;
    box-sizing: border-box;
}

/* Desktop layout */
@media (min-width: 900px) {
    #container_of_all {
        flex-direction: row;
    }

    #canvas_wrap {
        flex: 7;
    }

    #container_of_ui {
        flex: 3;
    }
}



#dev_menu.panel {
    width: 100%;
    box-sizing: border-box;
    background: rgba(0, 0, 0, 0.75);
    color: white;

    /* Responsive typography */
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
    font-size: 12px;
    line-height: 1.2;

    padding: 10px;
    border-radius: 10px;

    /* The important anti-clipping bits */
    overflow: hidden;
    /* prevents right-edge bleed */
}

/* header */
#dev_menu .panel_header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
}

#dev_menu .panel_stats {
    opacity: 0.9;
    text-align: right;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 55%;
}

/* buttons row */
#dev_menu .panel_buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 10px;
}

#dev_menu button {
    font: inherit;
    padding: 4px 8px;
    cursor: pointer;
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    background: rgba(255, 255, 255, 0.08);
    color: white;
}

#dev_menu button:active {
    transform: translateY(1px);
}

/* controls */
#dev_menu .panel_controls>div {
    margin-bottom: 8px;
}

#dev_menu input[type="range"] {
    width: 100%;
}

/* --- About modal --- */
#about_overlay {
    position: fixed;
    inset: 0;
    z-index: 99999;
}

#about_overlay .about_backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.55);
}

#about_overlay .about_modal {
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);

    width: min(560px, calc(100vw - 24px));
    max-height: min(70vh, calc(100dvh - 24px));
    overflow: auto;

    background: rgba(20, 20, 20, 0.95);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 12px;
    padding: 12px;

    box-sizing: border-box;
}

#about_overlay .about_header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    margin-bottom: 8px;
}

#about_overlay .about_title {
    font: 700 14px ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
}

#about_overlay .about_close {
    font: inherit;
    padding: 4px 8px;
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    background: rgba(255, 255, 255, 0.08);
    color: white;
    cursor: pointer;
}

#about_overlay .about_body {
    font: 12px/1.35 ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
}

#about_overlay .about_body p {
    margin: 0 0 10px 0;
}

#about_overlay .about_links a {
    color: white;
    text-decoration: underline;
}

/* Make sliders + text smaller on cramped screens */
@media (max-width: 600px) {
    #dev_menu.panel {
        font-size: 11px;
        padding: 8px;
        border-radius: 8px;
    }

    #dev_menu button {
        padding: 3px 7px;
    }

    #dev_menu input[type="range"] {
        height: 16px;
    }
}

#dev_menu .panel_row {
    margin-bottom: 6px;
}

/* Landscape: reduce font a touch so nothing clips horizontally */
@media (max-width: 900px) and (orientation: landscape) {
    #dev_menu.panel {
        font-size: 11px;
        padding: 8px;
    }

    #dev_menu .panel_stats {
        max-width: 45%;
    }
}