:root {
    --key-size: 60px;
    --prim-color: #FFFFFF;
    /* Key border colors */
    --active: #519e80;
    --inactive: #925555;
    --col-transition: 0.05s;
    --transform-transition: 0.15s;
    --key-color: #7e7e7e22;

    /* App styles */
    --elem-border-radius: 10px;
    --app-bg: #181818;
    --elem-prim-bg: #212121b3;
    --elem-prim-border: #353b44;
    --elem-sec-bg: rgba(33, 33, 33, 0.98);
    --elem-sec-border: #555555;
    --elem-tert-bg: #4d4d4d;

    --btn-bg: #333333;
    --btn-active-bg: #4d4d4d;

    --input-bg: #3d3d3d;

    --text-prim: #f1f0f1;
    --text-sec: #969696;
    --text-tert: #acabaa;

    --wooting-yellow: #ecc457;
}

body {
    background-color: var(--app-bg);
    color: white;
    /* find monospace sans serif font famil */
    font-family: Consolas, monospace;
    -webkit-user-select: none;
    /* Safari */
    -ms-user-select: none;
    /* IE 10 and IE 11 */
    user-select: none;
    /* Standard syntax */
}


/* Universal */
* {
    transition: background-color 0.5s;
    color: var(--fg-color);
}

html {
    scroll-behavior: smooth;
    scrollbar-color: #aaa #ffffff20;
    /* Mozilla */
}

::-webkit-scrollbar {
    /* Blink browser scrollbar */
    background-color: transparent;
    width: 6px;
}

::-webkit-scrollbar-thumb {
    background-color: #7a7a7a;
    border-radius: 12px;
}

::-moz-selection {
    /* Code for Firefox */
    color: var(--wooting-yellow);
    background: transparent;
}

::selection {
    color: var(--wooting-yellow);
    background: transparent;
}

h2, h3 {
    margin: 0.5rem 0;
}


/* Floating menu */
#toolbar {
    position: fixed;
    top: 0;
    right: min(40vw, 500px);
    padding: 0 1.25em;
    background: var(--elem-prim-bg);
    backdrop-filter: blur(5px);
    min-width: 150px;
    min-height: 60px;
    border: 1px solid var(--elem-sec-border);
    border-top: 0;
    border-radius: 0 0 var(--elem-border-radius) var(--elem-border-radius);
    display: flex;
    gap: 1.1em;
    justify-content: space-evenly;
    transition: opacity 0.5s;
    opacity: 0;
}

.material-symbols-outlined {
    position: relative;
    color: var(--text-prim);
    font-size: 28px !important;
    line-height: 60px !important;
    cursor: pointer;
}

.material-symbols-outlined:hover .infoField {
    visibility: visible;
}

/* Hover hints */
.infoField {
    position: absolute;
    font-size: 0.75rem;
    top: 50px;
    min-width: 60px;
    text-align: center;
    padding: 0.25rem 0.5rem;
    left: -24px;
    line-height: 1rem;
    background-color: var(--btn-active-bg);
    color: var(--text-prim);
    font-family: Arial;
    border-radius: 6px;
    visibility: hidden;
}

/* Setting panels */
.tabmenu{
    background-color: var(--elem-sec-bg);
    border: 1px solid var(--elem-sec-border);
    border-radius: 12px;

    min-width: max(100%, 250px);
    min-height: 60px;
    max-height: calc(100vh - 80px);
    overflow-y: scroll;
    padding: 12px;
    box-sizing: border-box;

    position: absolute;
    top: 70px;

    display: flex;
    flex-direction: column;
    gap: 1em;

    overflow: auto;

    padding: 2em;
    box-sizing: border-box;

    visibility: hidden;
}


#savedPresets{
    display: grid;
    grid-template-columns: 1fr min-content;
    gap: 0.5em;
}

#defaultPresets{
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.5em;
}


/* Flex styles */
.flexRows{
    display: flex;
    flex-direction: column;
    gap: 0.5em;
}

.flexRows > div {
    display: flex;
    gap: 1em;
    justify-content: space-between;
    align-items: center;
    
}


/* Inputs and other styles */
input,
button,
textarea {
    background-color: var(--input-bg);
    border: none;
    accent-color: var(--wooting-yellow);
    flex-shrink: 1;
    max-width: 100%;
    min-width: 0;
    transition: color 0s;
}

input[type="text"] {
    padding: 0.5em 1em;
    border-radius: 6px;
    box-sizing: border-box;

}

button,
textarea {
    padding: 0.5em;
    border-radius: 6px;
    box-sizing: border-box;
}

button:hover {
    background-color: #666;
    cursor: pointer;
}

button:active {
    background-color: #777;
    cursor: pointer;
}

hr {
    opacity: 0.05;
    margin: 0.1em 0.1em;
}


/* Logging information */
#optionalInfo {
    visibility: hidden;
    background-color: var(--elem-prim-bg);
    border: 1px solid var(--elem-sec-border);
    border-radius: var(--elem-border-radius);
    margin: 1.5em;
    padding: 2em;
}


/* Key container */
#keyboard {
    width: 90vw;
    height: 75vh;
    box-sizing: border-box;
    position: relative;

    /* Disable text selection */
    -webkit-user-select: none;
    /* Safari */
    -ms-user-select: none;
    /* IE 10 and IE 11 */
    user-select: none;
    /* Standard syntax */
}


/* Key add menu */
#keyPool {
    /* width: 28vw; */
    width: min(420px, 32vw);
    min-width: 0;
    height: 94vh;
    position: fixed;
    top: 3vh;
    right: 3vh;
    background-color: var(--elem-prim-bg);
    border: 1px solid var(--elem-sec-border);
    backdrop-filter: blur(12px);
    border-radius: var(--elem-border-radius);
    padding: min(20px, 2vw);
    box-sizing: border-box;
    visibility: hidden;
    display: grid;
    grid-template-rows: min-content min-content 1fr;
    gap: 1em;

}

#keyPoolInput {
    font-size: 1em;
    padding: 0.5em;
    width: 100%;
    color: var(--text-prim);
    border-radius: 4px;
    box-sizing: border-box;
}

[type="search"]::-webkit-search-cancel-button {
    filter: brightness(10);
    cursor: pointer;
}

#keyPoolOptions {
    overflow-y: auto;
    font-size: max(min(1.1vmin, 0.825em), 8px);
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    align-content: flex-start;
}

.keyOption {
    width: 3.95em;
    text-align: center;
    line-height: 3.95em;
    height: 3.95em;
    background-color: var(--elem-tert-bg);
    color: var(--text-tert);
    font-size: 1.325em;
    display: inline-block;
    border-radius: 4px;
    cursor: pointer;
}

.keyOption:hover {
    opacity: 0.7;
}



/* Key graphics related styles */
.key {
    width: var(--key-size);
    height: var(--key-size);
    border: 3.8px solid var(--prim-color);
    background-color: var(--key-color);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: calc(var(--key-size) /3);
    font-weight: bold;
    color: var(--prim-color);

    border-radius: 4px;
    position: absolute;
    transition: opacity 0.5s, background-color 0.5s, border-color 0.35s;

    box-shadow: 3px 5px 10px 0px #13121250 inset;
}

.key:hover {
    border-color: var(--prim-color) var(--wooting-yellow) #37dd9d var(--prim-color);
    border-style: solid dashed dashed solid;
    background-color: #3e3f41;
}

/* Key labels */
.label {
    z-index: 0;
    text-shadow: 2px 2px 6px #1312123c;
    transition: color 0.5s;
}

/* Pressure progress on keys */
.progress {
    position: absolute;
    background-color: var(--inactive);
    transition: background-color var(--transform-transition), height var(--col-transition), width var(--col-transition), border-radius var(--col-transition);
    /* transition: background-color 0.15s, height 0.05s, width 0.05s, border-radius 0.05s; */
    /* transition: background-color 0.05s, height 0.025s, width 0.025s, border-radius 0.01s; */
}


/* Fill directions */
.topLeft {
    inset: 0 auto auto 0;
    border-bottom-left-radius: 0 !important;
    border-top-left-radius: 0 !important;
    border-top-right-radius: 0 !important;
}

.topRight {
    inset: 0 0 auto auto;
    border-top-right-radius: 0 !important;
    border-top-left-radius: 0 !important;
    border-bottom-right-radius: 0 !important;
}

.bottomRight {
    inset: auto 0 0 auto;
    border-bottom-left-radius: 0 !important;
    border-bottom-right-radius: 0 !important;
    border-top-right-radius: 0 !important;
}

.bottomLeft {
    inset: auto auto 0 0;
    border-top-left-radius: 0 !important;
    border-bottom-left-radius: 0 !important;
    border-bottom-right-radius: 0 !important;
}

.top {
    top: 0;
    border-top-left-radius: 0 !important;
    border-top-right-radius: 0 !important;
    width: 100% !important;
}

.right {
    right: 0;
    border-top-right-radius: 0 !important;
    border-bottom-right-radius: 0 !important;
    height: 100% !important;
}

.bottom {
    bottom: 0;
    border-bottom-left-radius: 0 !important;
    border-bottom-right-radius: 0 !important;
    width: 100% !important;
}

.left {
    left: 0;
    border-top-left-radius: 0 !important;
    border-bottom-left-radius: 0 !important;
    height: 100% !important;
}

.horizontal {
    width: 100% !important;
}

.vertical {
    height: 100% !important;
}

#selectionhint{
    opacity: 0;
    transition: opacity 0.5s;
    position: fixed;
    bottom: 1em;
    left: 50%;
    transform: translateX(-50%);
    pointer-events: none;
}


/* Right click menu */
#keyOptionDialog {
    display: none;
    flex-direction: column;
    gap: 1em;
    position: fixed;
    width: 96px;
    min-height: 120px;
    border: 3px solid var(--text-prim);
    background-color: var(--elem-prim-bg);
    backdrop-filter: blur(12px);
    border-radius: 4px;
    box-shadow: 3px 5px 10px 0px #13121250 inset;
    padding: 1rem;
}

.directions {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0.25rem;
    table-layout: fixed;
}



.directions td {
    text-align: center;
    background-color: #666;
    line-height: 1.6rem;
    border-radius: 2px;
    cursor: pointer;
    gap: 5px;
}

.directions td:hover {
    background-color: rgb(129, 129, 129);
}

.directions td:active {
    background-color: rgb(155, 155, 155);
}

.deleteButton {
    background-color: #925555;
    display: block;
    text-align: center;
    line-height: 1.6rem;
    border-radius: 4px;
    width: 100%;
    cursor: pointer;
}

.deleteButton:hover {
    background-color: #c48282;
    color: black;
}

/* OTHER STYLES */
/* Custom switches */
.switch {
    position: relative;
    display: inline-block;
    font-size: 1.6em;
    width: 1.8em;
    height: 1em;
}

/* Hide default HTML checkbox */
.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

/* The slider */
.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #ccc;
    -webkit-transition: background-color .4s, transform .4s;
    transition: background-color .4s, transform .4s;
    border-radius: 34px;
}

.slider:before {
    position: absolute;
    content: "";
    height: calc(1em - 2px);
    width: calc(1em - 2px);
    left: 1px;
    bottom: 1px;
    background-color: var(--elem-sec-bg);
    -webkit-transition: background-color .4s, transform .4s;
    transition: background-color .4s, transform .4s;
    border-radius: 50%;
}

input:checked+.slider {
    background-color: var(--wooting-yellow);
}

input:focus+.slider {
    box-shadow: 0 0 1px var(--wooting-yellow);
}

input:checked+.slider:before {
    -webkit-transform: translateX(0.8em);
    -ms-transform: translateX(0.8em);
    transform: translateX(0.8em);
}