/* Modern Virtual Keyboard - Professional Redesign */
:root {
    --kbd-bg: #181c24;
    --kbd-key-bg: #23283a;
    --kbd-key-border: #3b4252;
    --kbd-key-active: #4f8cff;
    --kbd-key-pressed: #ec4899;
    --kbd-key-error: #d32f2f;
    --kbd-key-shadow: 0 2px 8px rgba(76, 140, 255, 0.10);
    --kbd-radius: 10px;
    --kbd-transition: all 0.18s cubic-bezier(.4,0,.2,1);
    --kbd-focus-outline: 2px solid #7c3aed;
}

.keyboard-section {
    margin: 28px 0 !important;
    position: relative !important;
    order: 3;
}

.keyboard-container {
    background: var(--kbd-bg);
    padding: 28px 18px;
    border-radius: var(--kbd-radius);
    box-shadow: 0 8px 32px rgba(44, 62, 80, 0.18);
    border: 1.5px solid var(--kbd-key-border);
    margin: 0 auto;
    max-width: 900px;
    position: relative !important;
}

.keyboard-container::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 3px;
    background: linear-gradient(90deg, #4f8cff, #7c3aed, #22c55e);
    border-radius: var(--kbd-radius) var(--kbd-radius) 0 0;
}

.keyboard {
    max-width: 850px;
    margin: 0 auto;
}

.keyboard-row {
    display: flex;
    justify-content: center;
    margin-bottom: 8px;
    gap: 8px;
}

.key {
    background: var(--kbd-key-bg);
    border: 1.5px solid var(--kbd-key-border);
    border-radius: 8px;
    padding: 0 18px;
    min-width: 44px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.15rem;
    font-weight: 600;
    color: #fff;
    cursor: pointer;
    transition: var(--kbd-transition);
    box-shadow: var(--kbd-key-shadow);
    position: relative;
    user-select: none;
    outline: none;
    touch-action: manipulation;
}
.key:focus {
    outline: var(--kbd-focus-outline);
    z-index: 2;
}
.key:hover, .key:active {
    background: #2d3346;
    filter: brightness(1.08);
}
.key.active {
    background: linear-gradient(90deg, var(--kbd-key-active), #7c3aed);
    color: #fff;
    border-color: var(--kbd-key-active);
    transform: scale(1.08);
    box-shadow: 0 0 18px rgba(79, 140, 255, 0.18);
    animation: kbdPulse 1s infinite;
}
.key.pressed {
    background: var(--kbd-key-pressed);
    color: #fff;
    transform: scale(0.97);
    box-shadow: 0 0 8px rgba(236, 72, 153, 0.18) inset;
}
.key.error {
    background: var(--kbd-key-error);
    color: #fff;
    animation: kbdShake 0.3s;
}
@keyframes kbdPulse {
    0% { box-shadow: 0 0 18px rgba(79, 140, 255, 0.18); }
    50% { box-shadow: 0 0 28px rgba(124, 58, 237, 0.22); }
    100% { box-shadow: 0 0 18px rgba(79, 140, 255, 0.18); }
}
@keyframes kbdShake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-3px); }
    75% { transform: translateX(3px); }
}

/* Special keys */
.key.space {
    min-width: 220px;
    background: linear-gradient(90deg, #23283a, #23283a 60%, #4f8cff 100%);
}
.key.tab, .key.caps, .key.shift, .key.enter, .key.backspace {
    font-size: 0.95rem;
    min-width: 70px;
    background: linear-gradient(90deg, #23283a, #7c3aed 100%);
}
.key.shift {
    min-width: 100px;
    background: linear-gradient(90deg, #23283a, #22c55e 100%);
    color: #fff;
}
.key.backspace {
    background: linear-gradient(90deg, #23283a, #ec4899 100%);
}

/* Touch improvements */
@media (hover: none) and (pointer: coarse) {
    .key {
        min-width: 54px;
        height: 54px;
        font-size: 1.25rem;
        padding: 0 22px;
    }
    .key.space {
        min-width: 160px;
    }
}

/* Mobile responsiveness */
@media (max-width: 900px) {
    .keyboard-container {
        padding: 18px 4vw;
    }
    .key {
        min-width: 36px;
        height: 40px;
        font-size: 1rem;
        padding: 0 10px;
    }
    .key.space {
        min-width: 100px;
    }
}
@media (max-width: 600px) {
    .keyboard-container {
        padding: 8px 2vw;
    }
    .key {
        min-width: 28px;
        height: 32px;
        font-size: 0.95rem;
        padding: 0 6px;
    }
    .key.space {
        min-width: 60px;
    }
}

/* Accessibility: focus indicator for keyboard navigation */
.key:focus-visible {
    outline: var(--kbd-focus-outline);
    box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.18);
    z-index: 2;
}