:root {
    --main-fg-color: midnightblue;
    --main-bg-color: #ccc;
    --main-hl-color: #884400;
    --reverse-bg-color: midnightblue;
    --reverse-fg-color: wheat;
    --reverse-hl-color: lightblue;
}

[data-theme="light"] {
    --main-fg-color: midnightblue;
    --main-bg-color: #ccc;
    --main-hl-color: #884400;
    --reverse-bg-color: midnightblue;
    --reverse-fg-color: wheat;
    --reverse-hl-color: lightblue;
}

[data-theme="dark"] {
    --main-bg-color: midnightblue;
    --main-fg-color: wheat;
    --main-hl-color: lightblue;
    --reverse-fg-color: midnightblue;
    --reverse-bg-color: #ccc;
    --reverse-hl-color: #884400;
}



/* .app-menu-header {
    background: white;
    padding: 12px 20px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12);
    display: flex;
    align-items: center;
    justify-content: space-between;
} */

.app-menu-header-right {
    /* display: flex;
    align-items: center;
    gap: 8px;
    justify-content: end;
    justify-self: end;
    position: fixed; */
    width: fit-content;
    position: fixed;
    right: 0;
}

.app-menu-menu-button {
    width: 40px;
    height: 40px;
    border: none;
    background: transparent;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}

.app-menu-menu-button:hover {
    background: var(--main-bg-color);
}

.app-menu-menu-icon {
    width: 20px;
    height: 20px;
    display: grid;
    grid-template-columns: repeat(3, 5px);
    grid-template-rows: repeat(3, 5px);
    gap: 2px;
    padding: 0.15rem;
    background-color: var(--main-bg-color);
}

.app-menu-menu-icon span {
    width: 5px;
    height: 5px;
    background: var(--main-fg-color);
    border-radius: 1px;
}

/* .app-menu-menu-icon:hover span {
    background: var(--reverse-fg-color);
    color: var(--main-fg-color);
} */

.app-menu-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    display: none;
    /* display: flex; */
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: transform 0.2s;
}

.app-menu-avatar:hover {
    transform: scale(1.05);
}

.app-menu-menu-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.4);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s, visibility 0.3s;
    z-index: 998;
}

.app-menu-menu-overlay.active {
    opacity: 1;
    visibility: visible;
}

.app-menu {
    position: fixed;
    top: 2rem;
    right: 0;
    background: var(--reverse-bg-color);
    border-radius: 1rem;
    box-shadow: 0 2px 10px var(--main-fg-color);
    padding: 0.5rem 1rem;
    width: 80vw;
    max-height: calc(100vh - 2rem);
    overflow-y: auto;
    transform: scale(0.9);
    opacity: 0;
    visibility: hidden;
    transition: all 0.2s ease-out;
    transform-origin: top right;
    z-index: 999;
}

.app-menu.active {
    transform: scale(1);
    opacity: 1;
    visibility: visible;
}

.app-grid {
    /* display: grid;
    grid-template-columns: repeat(4, 1fr); */
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
}

.app-group {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}


.app-item {

    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 0.5rem;
    border-radius: 0.5rem;
    cursor: pointer;
    text-decoration: none;
    color: inherit;
    perspective: 60rem;
    height: 6rem;
}

.app-card {
    position: relative;
    width: 9rem;
    height: 100%;
    transition: transform 0.6s;
    transform-style: preserve-3d;
    color: var(--main-fg-color);
}

.app-item:hover .app-card {
    transform: rotateY(180deg);
}

.app-front,
.app-back {
    position: absolute;
    width: 100%;
    height: 100%;
    backface-visibility: hidden;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    border-radius: 0.5rem;
    border-color: var(--reverse-fg-color);
    border-style: solid;
    /* border-radius: 1rem; */
    border-width: 1px;
    /* color: var(--main-bg-color);
    background: var(--main-fg-color); */
    color: var(--reverse-fg-color);
    background-color: var(--reverse-bg-color);
}

.app-back {
    transform: rotateY(180deg);
    /* color: var(--reverse-fg-color);
    background-color: var(--reverse-bg-color); */
}

.app-description,
.app-documentation {
    font-size: 10px;
    text-align: center;
    line-height: 1.3;
}

.app-description {
    padding: 0 0.3rem;
    z-index: 20;
    bottom: 0.2rem;
    position: absolute;
}

.app-documentation {
    position: absolute;
    top: -1rem;
    right: 0;
}


.app-back>.app-documentation>input {
    /* border-radius: 1rem 1rem 0 0; */
    border-radius: 1rem;
    height: 2rem;
    width: 2rem;
    border-bottom: none;
    border-width: 2px;
    font-weight: bold;
    background-color: var(--reverse-bg-color);
    border-color: var(--main-bg-color);
}

.app-front>.app-documentation>input {
    border-radius: 100%;
    border-width: 2px;
    font-weight: bold;
    font-size: large;
    height: 3rem;
    width: 3rem;
    background-color: var(--reverse-bg-color);
    border-color: var(--main-bg-color);
}

.app-icon {
    width: 3rem;
    height: 3rem;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    margin-bottom: inherit;
    white-space: nowrap;
    overflow: hidden;
    font-family: monospace;
    font-weight: bold;
    border-width: 1px;
    border-style: solid;
    border-color: var(--main-bg-color);
    position: absolute;
    top: 0.2rem;
}

.app-name,
.group-label {
    font-size: 12px;
    text-align: center;
    margin: inherit auto;
}

.app-name {
    z-index: 10;
    position: absolute;
    bottom: 0.2rem;
    max-height: 3rem;
    overflow: hidden;
}

.app-back>.app-name {
    position: absolute;
    top: 0.2rem;
    font-weight: bold;
    font-size: large;
}



.group-label {
    font-size: 10px;
    font-style: italic;
    position: absolute;
    bottom: 0.2rem;
    /* transform: rotate(-90deg);
    left: 0;
    position: absolute;
    bottom: 0;
    transform-origin: top left;
    padding: 0 0.5em;
    border-radius: 1em; */
}

.app-item>label {
    height: 1rem;
    transform: rotate(-90deg);
    bottom: 0rem;
    left: 0.25rem;
    position: absolute;
    transform-origin: bottom left;
    color: var(--main-fg-color);
    font-size: smaller;
    max-width: 6rem;
    width: 6rem;
    background-color: var(--main-bg-color);
    padding: 0 0.5rem;
    border-radius: 0.5rem 0.5rem 0 0;
    overflow: visible;
}


.app-item-first,
.app-item-middle,
.app-item-last {
    /* border-style: solid; */
    border-style: none;
    border-color: var(--reverse-fg-color);
    border-radius: 0;
    border-width: 1px;
}

.app-flex-break {
    flex-basis: 100%;
    height: 0;
}

/* .app-item-first {
    border-right: none;
    border-radius: 0 0 0 0;
    margin-right: -0.5rem;
    border-width: 1px;
    padding-right: 0.5rem;
    margin-left: 0.5rem;
} */


/* .app-item-middle {
    border-left: none;
    border-right: none;
    margin-right: -0.75rem;
    margin-left: -0.75rem;
    border-width: 1px;
    padding-right: 0.5rem; 
    padding-left: 0.5rem;
}
*/

/* .app-item-last {
    margin-left: -0.5rem;
    border-radius: 0 1rem 1rem 0;
    border-left: none;
    border-width: 1px;
    margin-right: 1rem;
} */

div.app-back>a {
    text-decoration: none;
}


@media screen and (max-width: 55rem) {
    .app-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media screen and (max-width: 40rem) {
    .app-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 1rem;
        right: 1rem;
    }

    .app-menu {
        width: 80vw;
    }

}

@media screen and (max-width: 28rem) {
    .app-grid {
        grid-template-columns: repeat(1, 1fr);
        border-width: 1px;
        gap: 1rem;
    }

    .app-menu {
        right: 0;
        border-width: 1px;
        max-width: 90vw;
    }

    /* .app-item-first {
        border-radius: 0 1rem 0 0;
        border-style: solid solid none solid;
        margin-bottom: -1rem;
        padding-bottom: 1rem;
        margin-right: unset;
        border-width: 1px;
        margin-left: unset;
    }

    .app-item-middle {
        border-style: none solid none solid;
        margin-top: -1rem;
        margin-bottom: -1rem;
        margin-right: unset;
        margin-left: unset;
        padding-top: 1rem;
        border-width: 1px;
        padding-bottom: 1rem;
    }

    .app-item-last {
        border-radius: 0 0 1rem 1rem;
        border-style: none solid solid solid;
        margin-top: -1rem;
        margin-bottom: 1rem;
        margin-right: unset;
        border-width: 1px;
        margin-left: unset;
    }

    .app-item>label {
        transform: unset;
        top: -0.5rem;
        left: 0;
        border-width: 1px;
        background-color: var(--main-bg-color);
    } */
}