/* Virtual Keyboard — floating toggle + bottom-anchored keyboard */

#vk-toggle {
    position: fixed;
    top: 50%;
    right: 0.5rem;
    transform: translateY(-50%);
    z-index: var(--z-keyboard-toggle);
    width: 48px;
    height: 48px;
    border-radius: 50%;
    border: none;
    background: #0d6efd;
    color: #fff;
    font-size: 1.5rem;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(0,0,0,0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.15s;
}
#vk-toggle:hover {
    transform: translateY(-50%) scale(1.1);
}
#vk-toggle:active {
    transform: translateY(-50%) scale(0.95);
}

#vk-container {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: var(--z-keyboard);
    background: #1e1e1e;
    border-top: 2px solid #444;
    padding: 0.25rem;
    box-shadow: 0 -4px 16px rgba(0,0,0,0.4);
    max-height: 45vh;
    overflow-y: auto;
}

.vk-header {
    display: flex;
    align-items: center;
    padding: 0.15rem 0.5rem;
    gap: 0.5rem;
}

.vk-mode-label {
    color: #aaa;
    font-size: 0.75rem;
    flex: 1;
}

.vk-mode-btn {
    background: #333;
    color: #ccc;
    border: 1px solid #555;
    border-radius: var(--radius);
    padding: 0.5rem 1rem;
    font-size: 0.85rem;
    cursor: pointer;
    min-height: 44px;
    min-width: 44px;
    touch-action: manipulation;
}
.vk-mode-btn:hover {
    background: #444;
}
.vk-mode-btn:active {
    background: #0d6efd;
    color: #fff;
}

.vk-close {
    background: #333;
    border: 1px solid #555;
    border-radius: var(--radius);
    color: #ccc;
    font-size: 1.2rem;
    cursor: pointer;
    padding: 0.5rem 0.75rem;
    line-height: 1;
    min-height: 44px;
    min-width: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    touch-action: manipulation;
}
.vk-close:hover {
    background: #444;
}
.vk-close:active {
    background: #dc3545;
    color: #fff;
}

.vk-keys {
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.vk-row {
    display: flex;
    gap: 3px;
    justify-content: center;
}

.vk-key {
    flex: 1;
    min-width: 0;
    height: clamp(36px, 6vh, 52px);
    border: none;
    border-radius: var(--radius);
    background: #333;
    color: #eee;
    font-size: clamp(12px, 2vh, 18px);
    font-weight: 600;
    cursor: pointer;
    user-select: none;
    -webkit-user-select: none;
    touch-action: manipulation;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.08s;
}

.vk-key:hover {
    background: #444;
}

.vk-key.vk-active {
    background: #0d6efd;
    color: #fff;
}

/* Responsive: smaller on narrow screens */
@media (max-width: 600px) {
    #vk-container {
        padding: 0.15rem;
    }
    .vk-row {
        gap: 2px;
    }
    .vk-key {
        height: clamp(32px, 5vh, 44px);
        font-size: clamp(10px, 1.8vh, 14px);
        border-radius: var(--radius-xs);
    }
}

/* Keyboard-aware layout: while the keyboard is open, reserve room at the bottom
   so content (text boxes / controls) can scroll ABOVE the fixed keyboard instead
   of being trapped behind it. The document (body) is the scroller (html/body use
   min-height:100vh), so padding-bottom on it creates the scroll room; the JS then
   lifts the focused control above the keyboard. --vk-height is set live by
   virtual-keyboard.js and differs per mode (Navigation / Nummern / QWERTZ);
   45vh is the max-height fallback. */
html.vk-open body {
    padding-bottom: var(--vk-height, 45vh);
}
/* Load-bearing, not cosmetic: virtual-keyboard.js lifts the focused field with
   scrollIntoView({ block: 'nearest' }), and 'nearest' honours scroll-padding. This
   shrinks the scrollport by the keyboard height so the field lands just ABOVE the
   keyboard with the SMALLEST possible scroll. Without it 'nearest' would stop at the
   viewport edge — i.e. still behind the keyboard. */
html.vk-open {
    scroll-padding-bottom: var(--vk-height, 45vh);
}

/* Hide toggle button when keyboard is visible (JS controls this via style.display) */
