/* バーチャルキーボードのコンテナ */
#virtual-keyboard {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 20px;
    background: linear-gradient(to bottom, rgba(40, 24, 18, 0.8), rgba(20, 10, 5, 0.9));
    border-radius: 15px;
    border: 2px solid #5d4037;
    box-shadow: 0 10px 30px rgba(0,0,0,0.6);
    user-select: none;
    margin-top: auto; /* 画面下部に配置 */
}

.keyboard-row {
    display: flex;
    gap: 8px;
}

/* キーの基本スタイル */
.key {
    width: 48px;
    height: 48px;
    background-color: #f4e4bc; /* 古紙のような色 */
    color: #3e2723;
    border-radius: 50%; /* タイプライター風の円形 */
    display: flex;
    justify-content: center;
    align-items: center;
    font-weight: bold;
    font-size: 1.2rem;
    box-shadow: 0 4px 0 #8d6e63, 0 0 5px rgba(0,0,0,0.2); /* 立体感と影 */
    border: 2px solid #a1887f; /* 金属リング風 */
    cursor: default;
    position: relative;
    transition: all 0.1s ease;
    text-transform: uppercase;
    font-family: 'IM Fell English SC', serif; /* アンティークフォント */
}

/* 特殊キーのサイズ調整 */
.key[data-key="Backspace"] { width: 80px; border-radius: 10px; font-size: 0.9rem; }
.key[data-key="Tab"] { width: 70px; border-radius: 10px; font-size: 0.9rem; }
.key[data-key="CapsLock"] { width: 80px; border-radius: 10px; font-size: 0.9rem; }
.key[data-key="Enter"] { width: 90px; border-radius: 10px; font-size: 0.9rem; }
.key[data-key="Shift"] { width: 100px; border-radius: 10px; font-size: 0.9rem; }
.key[data-key="Space"] { width: 300px; border-radius: 10px; }

/* キー押下時のアニメーション */
.key.active {
    transform: translateY(4px);
    box-shadow: 0 0 0 #8d6e63, 0 0 15px rgba(212, 175, 55, 0.6); /* 押したときに光る */
    background-color: #fff8e1;
    color: #d4af37;
    border-color: #d4af37;
}

/* --- 妨害エフェクト用スタイル --- */

/* ロック状態: 鎖で縛られ入力不可 */
.key.locked {
    background-color: #7f8c8d;
    color: rgba(255, 255, 255, 0.3);
    box-shadow: 0 4px 0 #566573;
    cursor: not-allowed;
}

.key.locked::after {
    content: '\f023'; /* fa-lock */
    font-family: "Font Awesome 6 Free";
    font-weight: 900;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 1.2rem;
    opacity: 0.9;
    filter: drop-shadow(0 2px 2px rgba(0,0,0,0.5));
}

/* ロック解除までの残り連打回数バッジ */
.lock-count {
    position: absolute;
    top: -8px;
    right: -8px;
    background-color: var(--ink-error-color);
    color: white;
    font-size: 0.8rem;
    font-weight: bold;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    box-shadow: 0 2px 4px rgba(0,0,0,0.4);
    z-index: 10;
    border: 2px solid #fff;
}

/* スワップ状態: 警告色 */
.key.swapped {
    background-color: #f1c40f; /* 黄色 */
    color: #d35400;
    box-shadow: 0 4px 0 #d35400;
    border: 2px solid #e67e22;
}

.key.swapped::before {
    content: '\f362'; /* fa-right-left */
    font-family: "Font Awesome 6 Free";
    font-weight: 900;
    position: absolute;
    top: 2px;
    right: 2px;
    font-size: 0.6rem;
    color: #c0392b;
    font-weight: bold;
}