* {
    box-sizing: border-box;
}

body {
    margin: 0;
    min-height: 100vh;
    background: #1d1d1d;
    color: #eee;
    font-family: Arial, Helvetica, sans-serif;

    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;

    padding: clamp(16px, 3vw, 32px);
    user-select: none;
}

#toolbar {
    width: min(78vmin, 720px);

    display: flex;
    gap: 8px;

    margin-bottom: 12px;
}

#eq {
    flex: 1;

    background: #2b2b2b;
    color: white;

    border: 1px solid #555;
    outline: none;

    padding: 8px 10px;

    font-size: 16px;
    user-select: text;
}

#eq:focus {
    border-color: #888;
}

button {
    background: #333;
    color: white;

    border: 1px solid #666;

    min-height: 40px;
    padding: 8px 14px;

    cursor: pointer;
    
    transition: background .15s;
    touch-action: manipulation;
}

button:hover {
    background: #444;
}

button:active {
    background: #555;
}

.toggle {
    display: flex;
    align-items: center;
    gap: 5px;
    white-space: nowrap;
    cursor: pointer;
    touch-action: manipulation;
}

.toggle input {
    margin: 0;
}

canvas {
    width: min(78vmin, 720px) !important;
    height: min(78vmin, 720px) !important;

    border: 1px solid #666;

    image-rendering: pixelated;
    image-rendering: crisp-edges;

    background: black;
}

@media (max-width: 560px) {

    body {
        padding: 10px;
    }

    #toolbar {
        width: 100%;
        display: grid;
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
        margin-bottom: 10px;
    }

    #eq {
        grid-column: 1 / -1;
        min-height: 44px;
        padding: 10px 12px;
        font-size: 18px;
    }

    button {
        min-height: 52px;
        padding-inline: 8px;
        font-size: 16px;
    }

    .toggle {
        justify-content: center;
        min-height: 52px;
        background: #333;
        border: 1px solid #666;
        font-size: 16px;
    }

    canvas {
        width: calc(100vw - 20px) !important;
        height: calc(100vw - 20px) !important;
    }

}
