html,
body {
    margin: 0;
    padding: 0;
    height: 100%;
    width: 100%;
    overflow: hidden;
    background: #000000;
    font-family: monospace;
    font-size: 1.1rem;
}
body {
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    -khtml-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
}
body.alt {
    background: #222222;
}
main {
    display: block;
    max-width: 100%;
    max-height: 100%;
}
canvas {
    display: block;
    width: 100% !important;
    height: 100% !important;
}
#p5_loading {
    position: fixed;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    transform: translateY(-1%);
    color: #000000;
}
#p5_loading .label {
    margin-bottom: 8px;
}
#p5_loading .bar {
    width: 130px;
    height: 11px;
    border: 1px solid #000000;
    padding: 2px;
    box-sizing: border-box;
}
#p5_loading .bar-fill {
    height: 100%;
    width: 0%;
    background: #000000;
}
#p5_loading .sublabel {
    margin-top: 12px;
    font-size: 0.8rem;
    color: #000000;
}
.toast {
    position: fixed;
    left: 50%;
    bottom: 20px;
    transform: translateX(-50%) translateY(12px) scale(0.96);
    min-inline-size: 220px;
    inline-size: min(max-content, calc(100vw - 32px));
    padding: clamp(10px, 2vw, 16px) clamp(16px, 4vw, 32px);
    background: rgba(32, 32, 32, 0.96);
    color: #fff;
    border-radius: 12px;
    font-size: clamp(0.7rem, 2.5vw, 1.1rem);
    box-shadow:
        0 6px 20px rgba(0, 0, 0, 0.25),
        0 1px 0 rgba(255, 255, 255, 0.04);
    opacity: 0;
    pointer-events: none;
    z-index: 9;
    transition: opacity 0.25s ease, transform 0.25s ease;
    white-space: nowrap;
    text-align: center;
    cursor: default !important;
}
.toast.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0) scale(1);
    pointer-events: auto;
}
#controls_modal {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.82);
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: center;
}
#controls_modal .content {
    background: rgba(24, 24, 24, 0.9);
    color: #ffffff;
    border-radius: 16px;
    padding: 32px 24px 24px;
    width: 320px;
    max-width: calc(100vw - 40px);
    margin: 20px;
    display: flex;
    flex-direction: column;
    gap: 18px;
    box-shadow:
        0 12px 40px rgba(0, 0, 0, 0.35),
        0 1px 0 rgba(255, 255, 255, 0.04);
    transform: scale(0.96);
    opacity: 0;
    transition: transform 0.25s ease, opacity 0.2s ease;
    cursor: default !important;
}
#controls_modal.show .content {
    transform: scale(1);
    opacity: 1;
}
#controls_modal .title {
    font-size: 1.3rem;
    font-weight: bold;
    margin-bottom: 4px;
    text-align: center;
    cursor: default !important;
}
#fps_display {
    font-size: 1.1rem;
    text-align: center;
    margin-bottom: 8px;
    cursor: default !important;
}
#controls_modal button {
    font-size: 1.1rem;
    padding: 12px;
    border: none;
    border-radius: 10px;
    background: #2f2f2f;
    color: #ffffff;
    cursor: pointer;
    box-shadow:
        0 2px 6px rgba(0, 0, 0, 0.35),
        0 1px 0 rgba(255, 255, 255, 0.04);
    transition:
        background 0.15s ease,
        box-shadow 0.15s ease,
        transform 0.15s ease;
}
#controls_modal button:hover {
    background: #3a3a3a;
    box-shadow:
        0 4px 12px rgba(0, 0, 0, 0.45),
        0 1px 0 rgba(255, 255, 255, 0.05);
    transform: translateY(-1px);
}
#controls_modal button:active {
    background: #444444;
    box-shadow:
        0 1px 3px rgba(0, 0, 0, 0.4);
    transform: translateY(0);
}
#controls_modal #btn_close {
    margin-top: 12px;
    background: #2b2b2b;
}
#controls_modal #btn_close:hover {
    background: #353535;
}