@media (prefers-color-scheme: dark) {
    :root {
        --bg: #181a1b;
        --border: #3b4245;
        --card: #232829;
        --text: #fbfbfb;
        --text-light: #d6dadc;
        --primary: #1b5f75;
        --primary-light: #24809f;
        --primary-text: #ceeaf4;
        --secondary: #9f2461;
        --secondary-text: #f4cee1;
        --secondary-light: #c92d7a;
        --error: #9f2424;
        --error-text: #f4cece;
        svg {
            filter: invert(1);
        }
    }
}
:root {
    --bg: #fbfbfb;
    --border: #dde0e2;
    --card: #eff0f1;
    --text: #232829;
    --text-light: #5e6a6e;
    --primary: #24809f;
    --primary-light: #2da1c9;
    --primary-text: #ceeaf4;
    --secondary: #9f2461;
    --secondary-text: #f4cee1;
    --secondary-light: #c92d7a;
    --error: #9f2424;
    --error-text: #f4cece;
}
:root:has(#toggle-theme:checked) {
    --bg: #181a1b;
    --border: #3b4245;
    --card: #232829;
    --text: #fbfbfb;
    --text-light: #d6dadc;
    --primary: #1b5f75;
    --primary-light: #24809f;
    --primary-text: #ceeaf4;
    --secondary: #9f2461;
    --secondary-text: #f4cee1;
    --secondary-light: #c92d7a;
    --error: #9f2424;
    --error-text: #f4cece;
    svg {
        filter: invert(1);
    }
}
.icon {
    filter: invert(1) brightness(2);
}

/* Toggle Switch Design */
.switch {
    position: fixed;
    top: 20px;
    right: 20px;
}

.switch input {
    display: none;
}
.slider {
    width: 50px;
    height: 25px;
    background: #ccc;
    border-radius: 30px;
    display: inline-block;
    position: relative;
}
.slider::before {
    content: "";
    width: 22px;
    height: 22px;
    background: white;
    border-radius: 50%;
    position: absolute;
    left: 2px;
    top: 1.5px;
    transition: .3s;
}
input:checked + .slider::before {
    transform: translateX(24px);
}

body {
    font-family: Helvetica, sans-serif;
    color: var(--text);
    background-color: var(--bg);
    margin: auto;
}

h1 {
    font-size: 36px;
}

h3 {
    font-size: 18px;
    font-weight: lighter;
    color: var(--text-light);
}

p {
    font-size: 14px;
}

a {
    color: var(--secondary);
}

a:visited {
    color: var(--secondary-light);
}

.top {
    max-width: 100%;
    text-align: center;
    background: var(--card);
    padding-top: 1px;
    padding-bottom: 1px;
    margin-bottom: 1em;
}

footer {
    max-width: 100%;
    text-align: center;
    background: var(--card);
    padding-top: 5px;
    padding-bottom: 5px;
}

.content {
    max-width: 100%;
    margin: auto;
}

input[type=text], input[type=number], textarea{
    flex-grow: 1;
    box-sizing:border-box;
    width: calc(100% - 5px);
    margin-left: 5px;
    padding: 6px 12px;
    font-size: 16px;
    line-height: 1.5;
    color: var(--text);
    background-color: var(--card);
    border: 1px solid var(--border);
    border-radius: 4px;
}

input[type=file] {
    width: 320px;
    height: 50px;
    max-width: 100%;
    color: var(--text);
    background-color: var(--bg);
    border: 1px solid var(--border);
    border-radius: 5px;
    margin-left: 10px;
}

input[type=file]::file-selector-button {
    margin-right: 20px;
    margin-left: 8px;
    margin-top: 8px;
    margin-bottom: 8px;
    border: none;
    background: var(--primary);
    padding: 10px 20px;
    border-radius: 4px;
    color: var(--primary-text);
    cursor: pointer;
    transition: background-color .2s ease-in-out;
}

input[type=file]::file-selector-button:hover {
    background: var(--primary-light);
}

input[type=checkbox] {
    width: 16px;
    height: 16px;
    color: var(--text);
    accent-color: var(--secondary);
    vertical-align: middle;
}


select {
    flex-grow: 1;
    box-sizing:border-box;
    width: calc(100% - 5px);
    margin-left: 5px;
    padding: 8px;
    font-size: 16px;
    line-height: 1.5;
    color: var(--text);
    background-color: var(--card);
    border: 1px solid var(--border);
    border-radius: 4px;
}

button {
    display: inline-block;
    cursor: pointer;
    border-radius: 4px;
    font-size: 14px;
    line-height: 16px;
    padding: 2px;
    margin: 1em;
    height: 32px;
    min-width: 60px;
    min-height: 32px;
    border: none;
    color: var(--primary-text);
    background-color: var(--primary);
    transition: background-color .17s ease,color .17s ease;
}
button:hover {
    background-color: var(--primary-light);
}

#loading, #output {
    text-align: center;
    max-width: 1200px;
    margin-left: auto;
    margin-right: auto;
    padding-left: 1rem;
    padding-right: 1rem;
}

.bbuttons {
    display: flex;
    justify-content: space-between;
}

.hidden {
    display: none;
}

.modal {
    display: none;
    position: fixed;
    z-index: 10;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgb(0,0,0);
    background-color: rgba(0,0,0,0.2);
}
.modal-content {
    background-color: var(--card);
    margin: 15% auto;
    padding: 20px;
    border: 1px solid var(--border);
    width: 80%;
    animation-name: animatetop;
    animation-duration: 0.4s;
}
.close {
    color: var(--text-light);
    float: right;
    font-size: 28px;
    font-weight: bold;
}
.close:hover,
.close:focus {
    color: black;
    text-decoration: none;
    cursor: pointer;
}
@keyframes animatetop {
    from {top: -300px; opacity: 0}
    to {top: 0; opacity: 1}
}



.pyout {
    margin: 20px;
}

.glyphgrid {
    display: grid;
    margin-top: 25px;
    grid-template-columns: 2fr 1fr;
    grid-column-gap: 0px;
    margin-left: 10px;
    margin-right: 10px;
}

.datatable table {
    border-radius: 4px;
    border-spacing: 0;
}

.datatable td {
    padding-top: 8px;
    padding-bottom: 8px;
    padding-left: 1em;
    padding-right: 1em;
    border: 1px solid var(--border);
}

.datatable tr:nth-of-type(odd) {
    background-color: var(--card);
}


.tab-wrap {
    transition: 0.3s box-shadow ease;
    max-width: 100%;
    display: flex;
    flex-wrap: wrap;
    position: relative;
    list-style: none;
    margin: 5px 0;
    justify-content: center;
}

.tab {
    appearance: none;
}

.tab:hover + label {
    box-shadow: 0 -2px var(--secondary) inset;
    color: var(--secondary);
}
.tab:checked + label {
    box-shadow: 0 -2px 0 var(--primary) inset;
}
.tab:checked + label + .tab__content {
    opacity: 1;
    transition: 0.5s opacity ease-in, 0.8s transform ease;
    position: relative;
    top: 0;
    z-index: 1;
    text-shadow: 0 0 0;
}

.tab + label {
    box-shadow: 0 -1px 0 #ccc inset;
    border-radius: 6px 6px 0 0;
    cursor: pointer;
    display: block;
    text-decoration: none;
    color: #888;
    text-align: center;
    user-select: none;
    background-color: var(--background);
    transition: 0.3s background-color ease, 0.3s box-shadow ease;
    box-sizing: border-box;
    padding: 0 5px;
    font-size: medium;
}

.tab__content {
    padding: 2em 1em;
    background-color: transparent;
    position: absolute;
    width: 100%;
    z-index: -1;
    opacity: 0;
    left: 0;
    transform: translateY(-3px);
    border-radius: 6px;
    order: 99;
}


#textentry {
width: 80%;
}

#textsize {
    width: 70px;
}

#out_allglyphs td {
    color: var(--text-light);
    cursor: pointer;
    text-align: center;
    background-color: none;
}

#out_allglyphs td:hover {
background-color: var(--secondary-light);
}

#out_allglyphs,
#out_fontinfo {
overflow-y: scroll;
height: 500px;
}

#out_gsub {
text-align: center;
overflow-y: scroll;
height: 500px;
}

#out_gsub tr th {
padding: 5px;
padding-left: 10px;
padding-right: 10px;
}
#out_gsub tr:nth-of-type(odd) {
background-color: var(--card);
}
#character {
    width: 50px;
}
#glyphid {
    width: 100px;
}

.checkgrid {
    display: grid;
    margin-top: 25px;
    grid-template-columns: 1fr 1fr 1fr 1fr;
    grid-column-gap: 4px;
    margin-left: 10px;
    margin-right: 10px;
    justify-items: start;
}
