.virtual-keyboard {
  display: grid;
  gap: 8px;
  transition: opacity 160ms ease, transform 160ms ease;
}

.virtual-keyboard.is-hidden {
  display: none;
}

.kb-row {
  display: grid;
  grid-template-columns: 1.1fr repeat(12, 1fr) 1.35fr;
  gap: 8px;
}

.kb-row:nth-child(2) {
  grid-template-columns: 1.5fr repeat(13, 1fr);
}

.kb-row:nth-child(3) {
  grid-template-columns: 1.8fr repeat(11, 1fr) 1.7fr;
}

.kb-row:nth-child(4) {
  grid-template-columns: 2.15fr repeat(10, 1fr) 2.25fr;
}

.kb-modifier-row {
  grid-template-columns: 1.2fr 1.2fr 1.2fr 6fr 1.2fr 1.2fr 1.2fr;
}

.kb-key {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-height: 70px;
  padding: 12px 14px;
  border-radius: 16px;
  border: 1px solid rgba(138, 153, 178, 0.18);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 1), rgba(244, 247, 252, 0.98));
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.95),
    0 6px 14px rgba(28, 44, 78, 0.06);
  color: var(--text-strong);
  user-select: none;
  transition:
    transform 110ms ease,
    border-color 110ms ease,
    box-shadow 110ms ease,
    background-color 110ms ease,
    color 110ms ease;
}

.kb-key::after {
  content: "";
  position: absolute;
  inset: auto 12px 10px;
  height: 2px;
  border-radius: 999px;
  background: transparent;
}

.virtual-keyboard[data-size="compact"] .kb-key {
  min-height: 58px;
  padding: 10px 11px;
  border-radius: 14px;
}

.kc-main,
.kc-label,
.kc-s,
.kc-p {
  font-weight: 700;
}

.kc-main {
  align-self: center;
  font-size: 1.45rem;
  letter-spacing: -0.04em;
}

.kc-label {
  font-size: 0.96rem;
}

.kc-s,
.kc-p {
  font-family: var(--font-mono);
}

.kc-s {
  font-size: 0.88rem;
  color: var(--text-muted);
}

.kc-p {
  font-size: 1.06rem;
}

.home-bump {
  position: absolute;
  bottom: 10px;
  left: 50%;
  width: 28px;
  height: 4px;
  border-radius: 999px;
  background: rgba(122, 133, 157, 0.24);
  transform: translateX(-50%);
}

.space-line {
  margin-top: auto;
  width: 44%;
  height: 4px;
  border-radius: 999px;
  background: rgba(69, 110, 245, 0.55);
  align-self: center;
}

.kb-key.is-current {
  border-color: rgba(69, 110, 245, 0.42);
  background: linear-gradient(180deg, rgba(232, 238, 255, 1), rgba(245, 248, 255, 1));
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.95),
    0 0 0 1px rgba(69, 110, 245, 0.1),
    0 10px 22px rgba(69, 110, 245, 0.12);
}

.kb-key.is-current::after {
  background: var(--accent-primary);
}

.kb-key.is-correct {
  border-color: rgba(40, 182, 122, 0.34);
  background: linear-gradient(180deg, rgba(235, 251, 244, 1), rgba(248, 255, 251, 1));
  color: #1f7a54;
}

.kb-key.is-correct::after {
  background: var(--success);
}

.kb-key.is-wrong {
  border-color: rgba(239, 95, 101, 0.38);
  background: linear-gradient(180deg, rgba(255, 239, 241, 1), rgba(255, 249, 250, 1));
  color: #bf4a50;
}

.kb-key.is-frequent {
  border-color: rgba(232, 163, 59, 0.35);
  background: linear-gradient(180deg, rgba(255, 246, 229, 1), rgba(255, 251, 244, 1));
  color: #a06b16;
}

.kb-key.is-weak {
  border-color: rgba(124, 108, 242, 0.34);
  background: linear-gradient(180deg, rgba(241, 238, 255, 1), rgba(250, 249, 255, 1));
  color: #5b4ad1;
}

.kb-key.is-disabled {
  background: linear-gradient(180deg, rgba(248, 249, 251, 1), rgba(241, 244, 248, 1));
  color: var(--unused);
}

.kb-key.is-modifier {
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.95),
    0 0 0 1px rgba(69, 110, 245, 0.08),
    0 10px 22px rgba(69, 110, 245, 0.1);
}

.kb-key.is-pressed {
  transform: translateY(2px);
}

@media (max-width: 1100px) {
  .kb-key {
    min-height: 64px;
    padding: 10px 11px;
  }

  .kc-main {
    font-size: 1.24rem;
  }
}

@media (max-width: 860px) {
  .keyboard-section {
    overflow-x: auto;
  }

  .virtual-keyboard {
    min-width: 980px;
  }
}

body[data-theme="dark"] .kb-key {
  border-color: rgba(173, 192, 221, 0.13);
  background: linear-gradient(180deg, #2a384e, #202c40);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06), 0 5px 12px rgba(0, 0, 0, 0.18);
}

body[data-theme="dark"] .kb-key.is-current {
  background: linear-gradient(180deg, #344d84, #293c68);
  border-color: rgba(128, 160, 255, 0.72);
}

body[data-theme="dark"] .kb-key.is-correct {
  background: linear-gradient(180deg, #214c42, #1d3d36);
  color: #87e5bd;
}

body[data-theme="dark"] .kb-key.is-wrong {
  background: linear-gradient(180deg, #56353e, #462d35);
  color: #ffb4bb;
}

body[data-theme="dark"] .kb-key.is-frequent {
  background: linear-gradient(180deg, #58472c, #483a25);
  color: #f7cf85;
}

body[data-theme="dark"] .kb-key.is-weak {
  background: linear-gradient(180deg, #453b6a, #393159);
  color: #c2b9ff;
}
