:root {
    font-family: Arial, sans-serif;
    --background-color: #f4f4f4;
    --background-color2: #ffffff;
    --text-color: #000000;
    --accent-color: #51c207;

    background-color: var(--background-color);
    color: var(--text-color);
}

@media (prefers-color-scheme: dark) {
    :root {
        --background-color: #121212;
        --background-color2: #1e1e1e;
        --text-color: #ffffff;
    }
}

html {
    height: 100%;
}

body {
    height: 100%;
    margin: 0;
    display: flex;
    flex-direction: column;
}

h1 {
    display: none;
}

main {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.element {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 8px;
    border-radius: 8px;
    user-select: none;
    -webkit-user-select: none;
    -moz-user-select: none;
}

.element img {
    height: 4em;
    width: auto;
}

.playground {
    flex: 2;
    position: relative;
    overflow: hidden;
    touch-action: none;
}

.playground .element {
    position: absolute;
    transform: translate(-50%, -50%);
    cursor: grab;
    z-index: 100;
}

.playground .element.grabbed {
    cursor: grabbing;
    background: rgba(0, 0, 0, 0.1);
    z-index: 200;
}

.playground .element.merging {
    animation: mergingAnimation 0.5s infinite;
}

@keyframes mergingAnimation {
    0% { transform: translate(-50%, -50%) scale(1); }
    50% { transform: translate(-50%, -50%) scale(1.2); }
    100% { transform: translate(-50%, -50%) scale(1); }
}

.menus {
    flex: 1;
    position: relative;
    display: flex;
    flex-direction: column;
}

.menus > nav {
    position: absolute;
    bottom: 100%;
    left: 0;
    display: flex;
    flex-direction: row;
    margin: 0 32px;
    gap: 8px;
}

.menus > nav button {
    border-radius: 8px 8px 0 0;
    padding: 8px;
    border: 0;
    cursor: pointer;
    background-color: var(--accent-color);
    font-weight: bold;
    box-shadow: 0 -2px 8px rgba(0, 0, 0, 0.1);
}

.menus > nav button:not(.selected) {
    filter: brightness(0.6);
}
    

.catalog, .cookbook, .options {
    flex: 1 1 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 16px;
    gap: 16px;
    border-radius: 16px 16px 0 0;
    background-color: var(--background-color2);
    box-shadow: 0 -2px 8px rgba(0, 0, 0, 0.1);
    overflow: auto;
}

.cookbook .tip, .options .tip {
    margin: 1em 0 auto 0;
    font-style: italic;
}

.elements {
    flex: 1;
    align-self: stretch;
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    justify-content: space-evenly;
    align-content: start;
    gap: 16px;
}

.catalog .element, .cookbook .element {
    cursor: pointer;
}

.cookbook .element-detail {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 16px;
}

.cookbook .element-detail img {
    max-width: 4em;
    max-height: 4em;
}

.cookbook hr {
    width: 90%;
}

.recipe {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: center;
}

.options button {
    align-self: stretch;
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-weight: bold;
    cursor: pointer;
    background-color: var(--background-color);
    color: var(--text-color);
}

@media (orientation: landscape) {
    main {
        flex-direction: row;
    }

    .menus > nav {
        top: 0;
        right: 100%;
        bottom: auto;
        left: auto;
        flex-direction: column;
        margin: 32px 0;
    }

    .menus > nav button {
        border-radius: 8px 0 0 8px;
        writing-mode: sideways-lr;
    }

    .catalog, .cookbook, .options {
        border-radius: 16px 0 0 16px;
    }

    .cookbook, .options {
        padding-top: 64px;
    }

    .cookbook .element-detail {
        flex-direction: column;
    }

    .cookbook .element-detail img {
        max-width: 8em;
        max-height: 8em;
    }
}