.keyboard-container {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(180deg, rgba(17, 19, 43, 0.92), rgba(5, 5, 20, 0.98));
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    padding: 0.55rem clamp(0.25rem, 1vw, 0.6rem) max(0.6rem, env(safe-area-inset-bottom));
    box-shadow: 0 -10px 30px rgba(0, 0, 0, 0.55);
    z-index: 1000;
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.keyboard-row {
    display: flex;
    justify-content: center;
    gap: clamp(0.18rem, 0.8vw, 0.4rem);
    width: 100%;
}

.keyboard-key {
    flex: 1 1 0;
    /* Allows up to ~10 keys to share a row evenly on mobile. */
    min-width: 0;
    min-height: 2.6rem;
    height: clamp(2.6rem, 6.5vw + 1.2rem, 3.2rem);
    padding: 0;
    font-size: clamp(0.95rem, 2.4vw + 0.35rem, 1.15rem);
    font-weight: 700;
    /* Unused (available) keys: brighter, prominent. */
    background: linear-gradient(180deg, #353b5c, #1f2238);
    border: 1px solid rgba(255, 255, 255, 0.16);
    color: #f9fafb;
    border-radius: 0.55rem;
    cursor: pointer;
    transition: transform 0.08s ease, filter 0.15s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    user-select: none;
    -webkit-user-select: none;
    -webkit-tap-highlight-color: transparent;
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.08),
        0 1px 2px rgba(0, 0, 0, 0.4);
}

.keyboard-key:hover {
    filter: brightness(1.15);
}

.keyboard-key:active {
    transform: scale(0.94);
    background: linear-gradient(180deg, rgba(155, 89, 182, 0.55), rgba(99, 102, 241, 0.3));
    border-color: rgba(155, 89, 182, 0.7);
}

/* Used keys: flat, dim, strikethrough-looking */
.keyboard-key.used {
    background: rgba(255, 255, 255, 0.02);
    color: rgba(156, 163, 175, 0.45);
    border-color: rgba(255, 255, 255, 0.04);
    box-shadow: none;
    font-weight: 500;
}

.keyboard-key.used::after {
    content: "";
    position: absolute;
    left: 22%;
    right: 22%;
    top: 50%;
    height: 1px;
    background: rgba(156, 163, 175, 0.35);
    transform: translateY(-50%) rotate(-12deg);
    pointer-events: none;
}

/* Position required so ::after lines up with the key */
.keyboard-key {
    position: relative;
}

.keyboard-key.arrow {
    flex: 1.4 1 0;
    background: linear-gradient(180deg, #2a2e48, #181b2e);
    color: #d1d5db;
}

.keyboard-key.arrow:hover {
    color: #f9fafb;
}

.keyboard-key.arrow .material-icons {
    font-size: 1.3rem;
}
