/* chip8 demo */

.c8-layout {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    align-items: flex-start;
    gap: 1.25rem;
}

.c8-main {
    flex: 1 1 520px;
    max-width: 640px;
}

#c8-screen {
    display: block;
    width: 640px;
    max-width: 100%;
    height: auto;
    aspect-ratio: 2 / 1;
    image-rendering: pixelated;
    background: #000;
}

.c8-side {
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
    width: 260px;
    max-width: 100%;
}

.c8-keypad {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 6px;
    touch-action: none;
    user-select: none;
    -webkit-user-select: none;
}

.c8-keypad button {
    padding: 0.55rem 0;
    font-family: 'Cascadia Code', 'Fira Code', monospace;
    font-size: 1rem;
}

.c8-keypad button small {
    display: block;
    margin-top: 0.1rem;
    color: #6e7681;
    font-size: 0.65rem;
}

.c8-keypad button.down {
    background: #f0883e;
    color: #0d1117;
    border-color: #f0883e;
}

.c8-debug {
    font-family: 'Cascadia Code', 'Fira Code', monospace;
    font-size: 0.72rem;
    text-align: left;
}

.c8-regs {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 2px 8px;
    padding: 0.5rem;
    border: 1px solid #30363d;
    border-radius: 6px;
}

.c8-regs span b {
    color: #8b949e;
    font-weight: normal;
}

.c8-disasm {
    margin: 0.5rem 0 0;
    padding: 0.4rem 0.5rem;
    list-style: none;
    border: 1px solid #30363d;
    border-radius: 6px;
    white-space: pre;
    overflow-x: auto;
}

.c8-disasm li.pc {
    color: #0d1117;
    background: #f0883e;
    border-radius: 3px;
}

.c8-source {
    max-width: 920px;
    margin: 1.25rem auto 0;
    text-align: left;
}

.c8-source summary {
    cursor: pointer;
    color: #8b949e;
}

.c8-source textarea {
    box-sizing: border-box;
    width: 100%;
    margin-top: 0.6rem;
    padding: 0.6rem;
    background: #0d1117;
    color: #e6edf3;
    border: 1px solid #30363d;
    border-radius: 6px;
    font-family: 'Cascadia Code', 'Fira Code', monospace;
    font-size: 0.8rem;
    line-height: 1.45;
    tab-size: 4;
}

.c8-source-actions {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    margin-top: 0.4rem;
}
