#term-overlay {
    position: fixed;
    inset: 0;
    z-index: 100;
    display: none;
    flex-direction: column;
    background: #0d0d0d;
    overflow: hidden;
    overscroll-behavior: none;
    touch-action: none;
}

html.term-locked,
html.term-locked body,
body.term-open {
    overflow: hidden;
    overscroll-behavior: none;
}

#term-overlay.open { display: flex; }

#xterm-container {
    overflow: hidden;
    background: #0d0d0d;
    flex-shrink: 0;
}

.xterm { padding: 6px; }

#xterm-container,
#xterm-container .xterm,
#key-toolbar {
    touch-action: manipulation;
}

/* ── key toolbar ── */
#key-toolbar {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 3px;
    background: #111;
    border-top: 1px solid #222;
    padding: 3px 4px;
    user-select: none;
    -webkit-user-select: none;
}

.key-row {
    display: flex;
    gap: 3px;
    width: 100%;
}

.key-btn {
    flex: 1;
    min-width: 0;
    background: #1e1e1e;
    color: #ccc;
    border: 1px solid #333;
    border-radius: 5px;
    padding: 0;
    height: 28px;
    font-size: .65rem;
    font-family: "Cascadia Code", "Fira Code", monospace;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    white-space: nowrap;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
    transition: background .1s;
}

.key-btn:active { background: #2e2e2e; }

.key-btn.modifier { color: #7eb8f7; border-color: #2a4a6a; }
.key-btn.modifier.active {
    background: #1a3a5a;
    color: #a8d4ff;
    border-color: #4a8abf;
}

/* ── disconnected overlay ── */
#ws-overlay {
    display: none;
    position: absolute;
    inset: 0;
    background: rgba(0,0,0,.7);
    align-items: center;
    justify-content: center;
    z-index: 10;
}

#ws-overlay.show { display: flex; }

.ws-msg {
    background: #161616;
    border: 1px solid #333;
    border-radius: 8px;
    padding: 24px 32px;
    text-align: center;
    color: #aaa;
    font-size: .9rem;
}

.ws-msg button {
    margin-top: 14px;
    background: #2a2a2a;
    color: #ccc;
    border: none;
    border-radius: 5px;
    padding: 7px 18px;
    cursor: pointer;
    font-size: .85rem;
}

.ws-msg button:hover { background: #333; }

@media (min-width: 769px) {
    #key-toolbar { display: none !important; }
}
