.mana_toggle {
    box-sizing: border-box;
    width: 64px;
    height: 64px;
    position: fixed;
    z-index: 1;
    padding: 9px;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    grid-template-rows: repeat(2, 1fr);
    background-color: #222;
    border-radius: 8px;
}

.mana_dot {
    width: 12px;
    height: 12px;
    align-self: center;
    justify-self: center;
    border-radius: 50%;
}

.mana_panel {
    display: none;
    position: fixed;
    box-sizing: border-box;
    background-color: #000;
    z-index: 10;
}

.mana_panel.open {
    display: block;
}

.mana_grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    grid-template-rows: repeat(2, 1fr);
    gap: 2px;
    width: 100%;
    height: 100%;
}

.mana_cell {
    position: relative;
    overflow: hidden;
}

.mana_count {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 44px;
    color: #fff;
    text-shadow: 0 0 6px #000;
}

.mana_label {
    position: absolute;
    top: 4px;
    left: 8px;
    font-size: 18px;
    color: #fff;
    opacity: 0.7;
    text-shadow: 0 0 4px #000;
}

.mana_button {
    position: absolute;
    left: 0;
    width: 100%;
    height: 50%;
    margin: 0;
    padding: 0;
    background-color: transparent;
    border-width: 0;
    color: #fff;
    font-size: 20px;
    font-family: inherit;
    opacity: 0.25;
}

.mana_plus {
    top: 0;
}
.mana_minus {
    top: 50%;
}

.mana_close {
    position: absolute;
    top: 0;
    right: 0;
    width: 56px;
    height: 56px;
    background-color: transparent;
    border-width: 0;
    color: #fff;
    font-size: 36px;
    font-family: inherit;
    opacity: 0.6;
    z-index: 11;
}

@media (min-aspect-ratio: 1/1) {
    .mana_toggle.player1 {
        top: 0;
        left: 0;
    }
    .mana_toggle.player2 {
        bottom: 0;
        right: 0;
    }

    .mana_panel.player1 {
        top: 0;
        left: 0;
        width: 50%;
        height: 100%;
    }
    .mana_panel.player2 {
        top: 0;
        left: 50%;
        width: 50%;
        height: 100%;
    }
}

@media (max-aspect-ratio: 1/1) {
    .mana_toggle.player1 {
        top: 0;
        left: 0;
    }
    .mana_toggle.player2 {
        bottom: 0;
        right: 0;
    }

    .mana_panel.player1 {
        top: 0;
        left: 0;
        width: 100%;
        height: 50%;
        transform: scale(-1, -1);
    }
    .mana_panel.player2 {
        top: 50%;
        left: 0;
        width: 100%;
        height: 50%;
    }
}
