:root {
  --encoding-byte-width: 40px;
  --encoding-byte-height: 40px;

  --encoding-bit-width: 4px;
  --encoding-bit-height: 4px;
  
  --encoding-bitset-color: rgb(184, 0, 0);
  --encoding-bits-bgcolor: rgb(31, 0, 0);

  --encoding-byte-fontfamily: monospace;
}

#encoding > #data {
    flex-shrink: 0;
    margin-top: 4px;
    border: 2px solid rgba(1, 13, 43);
    border-radius: 2px;
    height: 200px;
    overflow-y: scroll;
    overflow-x: hidden;
    width: calc((var(--encoding-byte-width) +2) * 11);
    padding-left: 2px;
    padding-top: 2px;

    div.line {
        box-sizing: border-box;
        width: calc((var(--encoding-byte-width) +2) * 11);
        height: var(--encoding-byte-height);
        margin-bottom: 2px;
    }

    div.byte {
        /*
        border: 1px solid rgb(16, 16, 16);
        border-radius: 2px;
        background-color: rgb(21, 21, 21);
        */
        background-color: rgb(201, 128, 83);
        border: 1px solid rgb(151, 54, 15);
        float: left;
        margin-right: 2px;
        text-align: center;

        font-family: var(--encoding-byte-fontfamily);
        font-size: 20px;

        box-sizing: border-box;
        width: var(--encoding-byte-width);
        height: var(--encoding-byte-height);
        color: #111;
        cursor: pointer;
    }

    div.byte:hover {
        border: 2px solid rgb(199, 68, 17);
    }

    div.bits {
        width: calc(var(--encoding-bit-width) * 8);
        height: var(--encoding-bit-height);
        border: 1px solid black;
        background-color: var(--encoding-bits-bgcolor);
        margin: auto;
    }

    /* bit is zero */
    div.bits > div.bit-clr {
        width: var(--encoding-bit-width);
        height: var(--encoding-bit-height);
        float: left;
    }

    div.bits > div.bit-set {
        width: var(--encoding-bit-width);
        height: var(--encoding-bit-height);
        background-color: var(--encoding-bitset-color);
        float: left;
    }
}

#encoding {
    border: solid 3px rgba(1, 13, 43);
    border-radius: 4px;
    padding: 10px 5px 5px 5px ;
}

#encoding > #preview {

    height: 120px;
    width: 300px;
    margin-left: auto;
    margin-right: auto;

    #pattern {
        float: left;
        width: 80px;
        height: 110px;
        margin-top: -30px;
        border: 1px solid rgba(1, 13, 43);
    }

    #pbits {
        box-sizing: content-box;
        margin-left: 110px;
        margin-top: 40px;
        width: 160px;
        height: 20px;
        border: 2px solid #111;
    }

    #hex {
        box-sizing: content-box;
        margin-left: 110px;
        width: 160px;
        font-family: var(--encoding-byte-fontfamily);
        font-size: 28px;
    }

    #hex #high {
        float: left;
        width: 80px;
        height: 40px;
        text-align: center;
    }

    #hex #low {
        float: left;
        width: 80px;
        height: 40px;
        text-align: center;
    }

    #pbits > div.pbit {
        float: left;
        box-sizing: border-box;
        width: 20px;
        height: 20px;
        background-color: #eee;
        text-align: center;
        font-family: var(--encoding-byte-fontfamily);
    }

    #pbits div:nth-child(4) {
        border-right: solid 2px #111;
    }

    #pbits > div.pbit-set {
        background-color: #d00;
    }
}

#encoding > #title {
    box-sizing: border-box;
    border: solid 3px rgba(1, 13, 43);
    border-radius: 4px;
    margin-left: -8px;
    margin-right: -16px;
    margin-top: -10px;
    background-color: rgba(1, 13, 43);
    text-align: center;
    width: calc(100% + 16px);
    height: 28px;
    font-family: Helvetica;
    font-weight: bold;
    color: #eee;
}

#encoding > span {
    background-color: rgba(1, 13, 43);
    padding: 5px 5px 5px 5px;
     font-family: Helvetica;
    font-weight: bold;
    color: #eee;
}