.finger-guide {
    display: flex;
    justify-content: center;
    gap: 2rem;
    padding: 0.6rem 1rem;
    background: rgba(0,0,0,0.02);
    border-top: 1px solid rgba(0,0,0,0.06);
    transition: max-height 0.3s ease, opacity 0.3s ease, padding 0.3s ease;
    max-height: 120px;
    overflow: hidden;
}
.finger-guide.hidden {
    max-height: 0;
    opacity: 0;
    padding: 0 1rem;
}

.hand {
    display: flex;
    gap: 0.4rem;
    align-items: flex-end;
    position: relative;
    padding-bottom: 22px;
}
.hand::after {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    text-align: center;
    font-size: 0.75rem;
}
.hand-left::after { content: '左手'; }
.hand-right::after { content: '右手'; }
.finger-guide .finger { width: 26px; height: 46px; }
.finger-guide .finger[data-finger$="r"] { height: 60px; }
.finger-guide .finger[data-finger$="m"] { height: 68px; }
.finger-guide .finger[data-finger$="i"] { height: 72px; }
.finger-guide .finger[data-finger$="t"] { width: 60px; height: 34px; }
.finger-guide .finger span { max-width: 1em; line-height: 1.15; }
.finger-guide .finger[data-finger$="t"] span { max-width: none; }
.finger {
    width: 48px;
    height: 60px;
    border-radius: 12px 12px 6px 6px;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 0.65rem;
    font-weight: 600;
    color: #333;
    transition: all 0.15s;
    opacity: 0.5;
}
.finger span {
    pointer-events: none;
}

/* Finger zone colors */
.finger[data-zone="pink"]   { background: var(--key-zone-pink); }
.finger[data-zone="orange"] { background: var(--key-zone-orange); }
.finger[data-zone="yellow"] { background: var(--key-zone-yellow); }
.finger[data-zone="green"]  { background: var(--key-zone-green); }
.finger[data-zone="grey"]   { background: var(--key-zone-grey); }
.finger[data-zone="blue"]   { background: var(--key-zone-blue); }
.finger[data-zone="teal"]   { background: var(--key-zone-teal); }
.finger[data-zone="purple"] { background: var(--key-zone-purple); }
.finger[data-zone="rose"]   { background: var(--key-zone-rose); }

.finger.active {
    opacity: 1;
    transform: translateY(-6px) scale(1.1);
    box-shadow: 0 6px 20px rgba(255,255,255,0.2);
    animation: fingerPulse 0.8s infinite alternate;
}

/* ===== Virtual Keyboard ===== */
.keyboard-container {
    --hand-space: 280px;
    position: relative;
    isolation: isolate;
    --kb-size: clamp(28px, 5vw, 52px);
    --kb-gap: clamp(4px, 0.8vw, 8px);
    padding: 0.5rem 1rem 0.8rem;
    background: var(--color-bg-card);
    border-top: 1px solid rgba(0,0,0,0.08);
    box-shadow: 0 -2px 8px rgba(0,0,0,0.04);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--kb-gap);
}
.kb-row {
    display: grid;
    grid-template-columns: repeat(60, minmax(0, 1fr));
    width: min(100%, calc(15 * (var(--kb-size) + var(--kb-gap))));
}
.kb-key {
    width: auto;
    min-width: 0;
    margin-inline: calc(var(--kb-gap) / 2);
    height: var(--kb-size);
    flex-shrink: 0;
    border-radius: 8px;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: clamp(0.9rem, 2vw, 1.3rem);
    font-weight: 700;
    color: #4a4a4a;
    background: #fff;
    border: none;
    box-shadow: inset 0 -4px 0 rgba(0,0,0,0.12), 0 2px 4px rgba(0,0,0,0.08);
    transition: all 0.1s cubic-bezier(0.4, 0.0, 0.2, 1);
    text-transform: uppercase;
    position: relative;
    user-select: none;
}
.kb-key.pressed {
    transform: translateY(4px);
    box-shadow: inset 0 0px 0 rgba(0,0,0,0.12), 0 0px 0 rgba(0,0,0,0.08);
    filter: brightness(0.95);
}

/* Zone colors */
.kb-key[data-zone="pink"]   { background: var(--key-zone-pink); }
.kb-key[data-zone="orange"] { background: var(--key-zone-orange); }
.kb-key[data-zone="yellow"] { background: var(--key-zone-yellow); }
.kb-key[data-zone="green"]  { background: var(--key-zone-green); }
.kb-key[data-zone="blue"]   { background: var(--key-zone-blue); }
.kb-key[data-zone="teal"]   { background: var(--key-zone-teal); }
.kb-key[data-zone="purple"] { background: var(--key-zone-purple); }
.kb-key[data-zone="rose"]   { background: var(--key-zone-rose); }
.kb-key[data-zone="grey"]   { background: #e0e5f0; }

/* Target highlight */
.kb-key.target {
    animation: pulseKey 0.8s infinite alternate;
    z-index: 2;
    color: var(--color-accent);
    box-shadow: inset 0 -4px 0 rgba(0,0,0,0.12),
        0 0 0 4px rgba(255, 92, 141, 0.24),
        0 0 24px 8px rgba(255, 92, 141, 0.35);
}
.kb-key.error-shake {
    animation: shakeError 0.3s ease-in-out;
}
.kb-key.target::after {
    content: '';
    position: absolute;
    inset: -5px;
    border-radius: inherit;
    box-shadow: 0 0 0 5px rgba(255, 92, 141, 0.14),
        0 0 26px 10px rgba(255, 92, 141, 0.28);
    pointer-events: none;
}

/* Space bar */
.kb-key.space-key {
    font-size: 0.8rem;
    color: #666;
    letter-spacing: 2px;
}
.kb-key.function-key {
    text-transform: none;
}
.kb-key.dual-key {
    flex-direction: column;
    line-height: 1.05;
}

/* Non-interactive vector guide, positioned over the actual key geometry. */
.keyboard-hands {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: calc(100% + var(--hand-space));
    z-index: 3;
    pointer-events: none;
    overflow: hidden;
}
.hands-hidden .keyboard-hands { display: none; }
.supplied-hand-path[stroke] {
    stroke: rgba(73, 78, 91, 0.55);
}
.supplied-hand-path[fill] {
    fill-opacity: 0.08;
}
.supplied-hand-active {
    fill: none;
    stroke: var(--color-accent);
    stroke-width: 3;
    stroke-linecap: round;
    stroke-linejoin: round;
}
@media (prefers-reduced-motion: reduce) {
    .kb-key.target, .finger.active { animation: none; }
}
