:root {
    --terminal-color: #ffffff;
}
.github-corner:hover .octo-arm {
    animation: octocat-wave 1500ms ease-in-out infinite;
}
@keyframes octocat-wave {
    0%,
    10% {
        transform: rotate(0);
    }
    20%,
    40% {
        transform: rotate(-25deg);
    }
    30%,
    50% {
        transform: rotate(10deg);
    }
    60%,
    100% {
        /* pause here */
        transform: rotate(0);
    }
}
@media (max-width: 500px) {
    .github-corner:hover .octo-arm {
        animation: none;
    }

    .github-corner .octo-arm {
        animation: octocat-wave 1500ms ease-in-out infinite;
    }
}
canvas {
    image-rendering: -moz-crisp-edges;
    image-rendering: -webkit-crisp-edges;
    image-rendering: pixelated;
}
html,
body {
    font-family: "VT323", monospace;
    font-size: 18px;
    line-height: 22px;
    color: var(--terminal-color);
    background-color: black;
    min-height: 100vh;
    margin: 0;
    padding: 0;
    background: #0b0b0d;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: auto;
}

.subtitle .brand {
    font-weight: 800;
    font-size: 1.5em;
    letter-spacing: 1px;
}
.page {
    margin-left: auto;
    margin-right: auto;
    display: flex;
    flex-direction: column;
    justify-content: center;
    justify-items: center;
    align-items: center;
}

.screen {
    width: 640px;
    height: 320px;
    border: 1px solid var(--terminal-color);
    padding: 5px;
    margin: 10px;
    max-width: 90vw; /* never exceeds screen */
}

.inputs {
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
    gap: 14px;
    padding: 10px;
    align-self: stretch;
}

.input-group {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: space-around;
    width: 190px;
    height: 40px;
    gap: 8px;
    padding: 4px 8px;
    border: 1px solid #8993aead; /* TI-80 dark-gray */
    border-radius: 6px; /* sharper */
    box-shadow: inset 0 0 3px #0004;
}

.separator {
    font-weight: bold;
    opacity: 0.7;
}

.title {
    font-size: 3rem;
    margin: 0.5rem 0;
}
.subtitle {
    font-size: 1.15rem;
    color: #ccc;
    line-height: 1rem;
}
.credit {
    font-size: 0.7rem;
    opacity: 0.9;
    letter-spacing: 1px;
}

.bezel-btn {
    background: #d4d6dd !important; /* slightly lighter than page */
    border: 1px solid #d4d6dd !important;
    box-shadow: 0 2px 0 #8b909b !important;
    color: white;
    border-radius: 6px;
    cursor: pointer;
    min-width: 20px;
    user-select: none;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
    outline: none;
    -webkit-user-select: none;
    -webkit-touch-callout: none;
    text-align: center;
}

.bezel-btn.pressed {
    box-shadow: 0 1px 0 #8b909b !important;
}

.file-btn {
    padding: 6px 12px;
    border-radius: 6px;
    cursor: pointer;
    line-height: 1;
    align-items: center;
    display: inline-flex;
    flex-direction: column;
}

.file-name {
    max-width: 125px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    display: inline-block;
}

#roms {
    padding: 8px 12px;
    border: 1px solid #aaa;
    border-radius: 6px;
    background: #fff;
    font-size: 14px;
    color: white;
    cursor: pointer;
    width: 125px;
    padding: 5px;
    text-overflow: ellipsis;
}

.color-picker {
    max-width: 25px;
    max-height: 25px;
}

.ti84 {
    width: 100%;
    border-radius: 35px;
    background: linear-gradient(180deg, #2f3f6a 0%, #253257 100%);
    color: white;
    box-sizing: border-box;
    padding: 20px 0px;
    border: 2px solid rgba(0, 0, 0, 0.25);
    /* --- 3D calculator body volume --- */
    box-shadow:
        0 8px 20px rgba(0, 0, 0, 0.45),
        /* big outer shadow */ inset 0 6px 12px rgba(255, 255, 255, 0.07),
        /* top highlight ridge */ inset 0 -8px 15px rgba(0, 0, 0, 0.35); /* bottom inner dark (depth) */
}

.bezel {
    /*background: #5555559e;*/
    background: #c1c4cc;
    padding: 12px;
    border-radius: 12px;
    box-shadow: inset 0 -3px 8px rgba(0, 0, 0, 0.06);
    margin-bottom: 15px;
    margin-left: 40px;
    margin-right: 40px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    /* --- recessed LCD effect --- */
    box-shadow:
        inset 0 3px 6px rgba(0, 0, 0, 0.45),
        /* strong inner shadow (depth) */ inset 0 -2px 3px
            rgba(255, 255, 255, 0.15),
        /* bottom highlight */ 0 2px 4px rgba(0, 0, 0, 0.4); /* drop shadow (gap from bezel) */

    border: 2px solid rgba(0, 0, 0, 0.35); /* LCD frame */
    transform: translateY(2px); /* pushes screen slightly down */
}

.screen {
    background: linear-gradient(180deg, #071017, #0d1418);
    border-radius: 6px;
    padding: 9px;
    position: relative;
    overflow: hidden;
}

.sound {
    background: #ffac418c !important;
    padding: 6px !important;
    border-radius: 10px !important;
    width: 80px !important;
    height: 40px !important;
    box-shadow: 0 3px 0 #b06b10 !important;
}

.ti-keys {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 14px;
    width: 90%;
    justify-items: center;
    margin-top: 25px;
}

/* Base button style */
.key {
    /*background: #3d4d7c;*/
    background: #858990;
    border: none;
    color: white;
    font-size: 18px;
    font-weight: bold;
    padding: 16px;
    border-radius: 50%;
    box-shadow: 0 4px 0 #323b55;
    transition: 0.1s ease;
    cursor: pointer;
    width: 150px;
    height: 70px;
    user-select: none;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
    outline: none;
    -webkit-user-select: none;
    -webkit-touch-callout: none;
}

.key-secondary {
    background: #3678b2;
}

.key.pressed {
    transform: translateY(3px);
    box-shadow: 0 1px 0 #202b4a;
}

.sound.pressed {
    box-shadow: 0 1px 0 #995907bd !important;
}

.footer {
    padding: 25px;
}

.grid {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    background-image:
        linear-gradient(
            to right,
            rgba(255, 255, 255, 0.2) 1px,
            transparent 1px
        ),
        linear-gradient(
            to bottom,
            rgba(255, 255, 255, 0.2) 1px,
            transparent 1px
        );
    background-size: calc(100% / 64) calc(100% / 32); /* CHIP-8 resolution */
}

.scale-control {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px;
    /*border: 1px solid #aaa;*/
    border-radius: 6px;
    background: #c1c4cc;
}

.scale-group {
    width: 150px;
}

.bezel-input {
    width: 15px;
    height: 15px;
    text-align: center;
    background: #c1c4cc;
    color: white;
    border: none;
}

.settings-btn {
    width: 50px;
    height: 40px;
    border-radius: 6px;
}

.settings-title {
    font-weight: 700;
}

.settings-panel {
    display: flex;
    flex-direction: column;
    gap: 5px;
    position: absolute;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    padding: 15px;
    border-radius: 6px;
    /*box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);*/
}

.settings-row {
    width: 260px !important;
    justify-content: space-between;
}

.settings-input {
    color: black;
    background: #e5e5e5 !important;
    border: 1px solid #8993aead;
    border-radius: 5px;
    width: 75px;
    height: 20;
}

.bar-loader {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 12px;
}

.bar-loader .label {
    opacity: 0.8;
}

.bar {
    display: flex;
    border: 2px solid white;
    padding: 4px;
    gap: 4px;
}

.bar span {
    display: block;
    width: 18px;
    height: 24px;
    background: transparent;
    opacity: 0.15;
    animation: fill 1.2s infinite;
}

.bar span:nth-child(1) {
    animation-delay: 0s;
}
.bar span:nth-child(2) {
    animation-delay: 0.1s;
}
.bar span:nth-child(3) {
    animation-delay: 0.2s;
}
.bar span:nth-child(4) {
    animation-delay: 0.3s;
}
.bar span:nth-child(5) {
    animation-delay: 0.4s;
}
.bar span:nth-child(6) {
    animation-delay: 0.5s;
}
.bar span:nth-child(7) {
    animation-delay: 0.6s;
}
.bar span:nth-child(8) {
    animation-delay: 0.7s;
}
.bar span:nth-child(9) {
    animation-delay: 0.8s;
}
.bar span:nth-child(10) {
    animation-delay: 0.9s;
}

@keyframes fill {
    0% {
        background: white;
        opacity: 0.2;
    }
    50% {
        background: white;
        opacity: 1;
    }
    100% {
        background: transparent;
        opacity: 0.2;
    }
}

.info {
    position: relative;
    display: inline-block;
    width: 16px;
    height: 16px;
    font-weight: bold;
    font-size: 14px;
    text-align: center;
    line-height: 16px;
    background: #d4d6dd;
    border: 1px solid #aaa;
    cursor: pointer;
    user-select: none;
    border-radius: 3px; /* optional */
}

#pause-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    justify-content: center;
    align-items: center;
    background: rgba(0, 0, 0, 0.9);
    font-size: 40px;
    font-weight: 700;
    color: white;
    text-shadow: 0 0 4px #000000;
    letter-spacing: 2px;
    transition: opacity 0.15s ease-out;
    display: none;
}
#pause-overlay.active {
    display: flex;
}

#info-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    justify-content: center;
    background: rgba(0, 0, 0, 0.9);
    color: white;
    white-space: pre-wrap;
    overflow-y: auto;
    padding: 20px;
}
