:root {
    --mobile-width: 60rem;
    --laptop-width: 120rem;
    --ui-mode: "unknown";
    --panel-gutter: 0.5rem;
    --panel-gap: 0.5rem;
    --panel-padding: 0.5rem;
    --panel-background-color: #f8f8f8;
    --panel-border-width: 2px;
    --panel-border-color: #808080;
    --panel-border-radius: .5rem;
    --text-area-padding: .5rem;
    --text-area-background-color: #ffffff;
    --text-area-border-width: 2px;
    --text-area-border-color: #404040;
    --text-area-border-radius: .5rem;

    /* --apple-blue: #007AFF;
    --apple-blue-dark: #0058BB;
    --apple-blue-darker: #003A88; */
}

/*
html and body
*/

body {
    display: flex;
    flex-direction: column;
}

/*
header and footer
*/

header,
footer {
    padding: 1rem;
}

/*
panels
*/

.panel-container {
    display: flex;
    padding: var(--panel-gutter);
    gap: var(--panel-gap);
    min-height: 0;
}

.panel {
    display: flex;
    flex-direction: column;
    padding: var(--panel-padding);
    background-color: var(--panel-background-color);
    border: var(--panel-border-width) solid var(--panel-border-color);
    border-radius: var(--panel-border-radius);
    min-height: 0;
}

.panel label {
    font-weight: bold;
    font-size: 90%;
    margin-bottom: 0.5rem;
}

.panel textarea {
    width: 100%;
    padding: var(--text-area-padding);
    border: var(--text-area-border-width) solid var(--text-area-border-color);
    border-radius: var(--text-area-border-radius);
    margin-bottom: 0.5rem;
    resize: none;
    font-family: "JetBrains Mono", monospace;
    font-optical-sizing: auto;
    font-size: 90%;
}

.panel .controls {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;
    font-size: 90%;
}

.panel .controls select {
    height: 2rem;
    padding: 0 0.5rem;
    background-color: #f0f0f0;
    border: 2px solid #404040;
    border-radius: 0.5rem;
    cursor: pointer;
}

.panel .controls select:hover {
    background-color: #fff;
}

.panel .controls select:active {
    background-color: #ddd;
}

.panel .controls button {
    color: inherit;
    height: 2rem;
    padding: 0 0.5rem;
    background-color: #f0f0f0;
    border: 2px solid #404040;
    border-radius: 0.5rem;
    cursor: pointer;
}

.panel .controls button:hover {
    background-color: #fff;
}

.panel .controls button:active {
    background-color: #ddd;
}

/*
Reactive styling
*/

/* MOBILE ONLY */
@media (width < 60rem /* mobile-width */) {

    /* Allow the body to expand and scroll */
    html,
    body {
        height: auto;
    }

    .panel-container {
        flex: 0;
        flex-direction: column;
        flex-wrap: nowrap;
    }

    .panel {
        flex: 0 1 auto;
        max-height: 32rem;
    }

    .panel textarea {
        flex: 0 0 auto;
        min-height: 5rem;
        overflow-y: auto;
    }

}


/* LAPTOP & DESKTOP */
@media (width >= 60rem /* mobile-width */) {
    
    /* Allow the textfields to scroll instead */
    html,
    body {
        height: 100%;
    }

}

/* LAPTOP ONLY */
@media (width >= 60rem) and (width < 120rem) {

    .panel-container {
        flex: 1;
        flex-direction: row;
        flex-wrap: wrap;
    }

    .panel {
        /* Width per panel = (100% - (gap * (N - 1))) / N */
        flex: 1 1 calc((100% - var(--panel-gap)) / 2);
    }

    .panel textarea {
        flex: 1;
        overflow-y: auto;
    }
}

/* DESKTOP ONLY */
@media (width >= 120rem) {

    .panel-container {
        flex-direction: row;
        flex: 1;
        flex-wrap: nowrap;
    }

    .panel {
        flex: 1;
    }

    .panel textarea {
        flex: 1;
        min-height: auto;
        overflow-y: auto;
    }

}
