.typing-content {
  margin-bottom: 28px;
}

.typing-hero {
  width: 100vw;
  max-width: 100vw;
  margin-left: calc(50% - 50vw);
  margin-right: calc(50% - 50vw);
  background: linear-gradient(180deg, rgba(43, 132, 193, 0.95) 0%, rgba(26, 93, 146, 0.97) 100%);
  border-top: 1px solid rgba(255, 255, 255, 0.18);
  border-bottom: 1px solid rgba(0, 0, 0, 0.18);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.12),
    inset 0 -1px 0 rgba(0, 0, 0, 0.12);
  padding: 18px 14px 22px;
}

.typing-shell {
  width: min(1080px, 100%);
  margin: 0 auto;
}

.typing-header h1 {
  margin: 0;
  color: #fff;
  text-align: center;
  font-size: 2rem;
  font-weight: 600;
}

.typing-header p {
  margin: 8px 0 0;
  text-align: center;
  color: rgba(255, 255, 255, 0.88);
  font-size: 1rem;
}

.lesson-meta {
  margin-top: 14px;
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 10px;
}

.meta-card {
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.1);
  padding: 10px 12px;
}

.meta-label {
  margin: 0;
  font-size: 12px;
  color: rgba(255, 255, 255, 0.74);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.meta-value {
  margin: 6px 0 0;
  color: #fff;
  font-size: 1.26rem;
  font-weight: 600;
}

.lesson-stage {
  margin-top: 12px;
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 10px;
  padding: 12px;
  background: rgba(8, 23, 41, 0.26);
}

.lesson-status {
  margin: 0 0 10px;
  color: rgba(255, 255, 255, 0.92);
}

.text-display {
  min-height: 126px;
  border: 1px solid rgba(255, 255, 255, 0.24);
  border-radius: 10px;
  background: rgba(10, 22, 36, 0.42);
  padding: 14px;
  line-height: 1.75;
  font-size: 1.2rem;
  letter-spacing: 0.02em;
  color: rgba(255, 255, 255, 0.75);
  white-space: pre-wrap;
  word-break: break-word;
}

.char-correct {
  color: #d4ffe0;
}

.char-wrong {
  color: #ffd8de;
  background: rgba(203, 73, 89, 0.42);
  border-radius: 3px;
}

.char-current {
  color: #ffffff;
  background: rgba(255, 229, 152, 0.32);
  border-bottom: 2px solid rgba(255, 255, 255, 0.95);
}

.char-pending {
  color: rgba(255, 255, 255, 0.56);
}

.typing-input {
  position: absolute;
  left: -9999px;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.actions {
  margin-top: 10px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.keyboard-wrap {
  margin-top: 12px;
  border: 1px solid rgba(255, 255, 255, 0.24);
  border-radius: 10px;
  padding: 12px;
  background: rgba(8, 23, 41, 0.32);
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.keyboard-hint {
  margin: 0 0 8px;
  color: rgba(255, 255, 255, 0.92);
}

.keyboard-hint-detail {
  margin: -4px 0 10px;
  min-height: 1.5em;
  font-size: 0.95rem;
  line-height: 1.45;
  color: rgba(255, 255, 255, 0.78);
}

.virtual-keyboard {
  display: grid;
}

.keyboard-stack {
  position: relative;
  margin-top: 8px;
  min-height: 300px;
  /** 各键盘行 flex + nowrap；整体 width:max-content，窄屏由 .keyboard-wrap 横向滚动 */
  --kb-gap: 5px;
  --kb-unit: clamp(38px, 2.08vw + 26px, 54px);
  width: max-content;
  /* Light keyboard tray background like the original lesson page */
  background: #f8fafc;
  border-radius: 10px;
  padding: 10px 8px 6px;
  box-shadow: 0 1px 0 rgba(255,255,255,0.8) inset, 0 2px 6px rgba(15, 23, 42, 0.08);
}

.kb-hands-holder {
  position: absolute;
  inset: auto 4% -6px 4%;
  height: min(188px, 46vw);
  z-index: 4; /* above the keys so finger reach lines draw on top of keycaps */
  pointer-events: none;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}

.kb-hands-svg {
  width: 100%;
  max-width: 880px;
  height: auto;
  max-height: 100%;
  opacity: 0.94;
}

.keyboard-stack .kb-hand-finger.finger-on {
  stroke: #2563eb !important;
  stroke-width: 3.6px;
}

.keyboard-stack ellipse.kb-hand-finger.finger-on {
  fill: rgba(219, 234, 254, 0.92);
}

.virtual-keyboard.vc-keyboard-edclub {
  position: relative;
  z-index: 1; /* keys below the hand overlay */
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: var(--kb-gap);
  padding-bottom: 8px;
  width: max-content;
  max-width: none;
}

.vc-keyboard-edclub .kb-key {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  flex: 0 0 var(--kb-unit);
  min-width: var(--kb-unit);
  max-width: var(--kb-unit);
  min-height: 38px;
  padding: 0 4px;
  border-radius: 7px;
  background: #fcfcfc;
  border: 1px solid #cfd5df;
  color: #474f5c;
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.03em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  cursor: default;
  user-select: none;
  transition:
    transform 0.06s ease,
    background-color 0.12s ease,
    border-color 0.12s ease,
    color 0.12s ease;
}

.vc-keyboard-edclub .kb-key-muted {
  font-size: 11px;
  font-weight: 500;
  text-transform: none;
  letter-spacing: 0.01em;
  color: #5c6574;
}

.vc-keyboard-edclub .kb-row-bottom-mac .kb-key {
  font-size: 11px;
  font-weight: 500;
  color: #5c6574;
  text-transform: none;
}

.vc-keyboard-edclub .kb-key.key-wide,
.vc-keyboard-edclub .kb-key.key-tab,
.vc-keyboard-edclub .kb-key.key-caps,
.vc-keyboard-edclub .kb-key.key-enter,
.vc-keyboard-edclub .kb-key.key-shift {
  flex: 0 0 calc(2 * var(--kb-unit) + var(--kb-gap));
  min-width: calc(2 * var(--kb-unit) + var(--kb-gap));
  max-width: calc(2 * var(--kb-unit) + var(--kb-gap));
}

.kb-row {
  display: flex;
  flex-direction: row;
  flex-wrap: nowrap;
  align-items: stretch;
  gap: var(--kb-gap);
  width: 100%;
  justify-content: flex-start;
  flex-shrink: 0;
  box-sizing: border-box;
}

.kb-row-bottom-mac {
  display: flex;
  flex-direction: row;
  flex-wrap: nowrap;
  align-items: stretch;
  gap: var(--kb-gap);
  width: 100%;
  box-sizing: border-box;
}

.kb-row-bottom-mac > .kb-key {
  flex: 1 1 0;
  min-width: 0;
  max-width: none;
}

.kb-row-bottom-mac > .kb-key.key-space {
  flex: 4 1 0;
  justify-content: center;
  letter-spacing: 0.06em;
}

.kb-key.key-space {
  min-height: 40px;
}

.vc-keyboard-edclub .kb-key.is-active,
.vc-keyboard-edclub .kb-key.is-active-shift-target {
  background: #dbeafe;
  border-color: #2563eb;
  color: #0f172a;
}

.vc-keyboard-edclub .kb-key.is-active-modifier {
  background: #3b82f6;
  border-color: #1d4ed8;
  color: #ffffff;
}

.vc-keyboard-edclub .kb-key.is-pressed {
  transform: translateY(2px);
  filter: brightness(0.94);
}

.typing-content .about {
  margin-top: 20px;
}

@media (max-width: 980px) {
  .lesson-meta {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 760px) {
  .typing-header h1 {
    font-size: 1.7rem;
  }

  .text-display {
    font-size: 1.05rem;
    min-height: 108px;
  }
}

@media (max-width: 560px) {
  .typing-hero {
    padding: 14px 10px 16px;
  }

  .lesson-meta {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .meta-value {
    font-size: 1.15rem;
  }

  .vc-keyboard-edclub .kb-key {
    min-height: 34px;
    font-size: 12px;
  }

  .keyboard-stack {
    min-height: 256px;
    --kb-unit: 34px;
    --kb-gap: 4px;
  }

  .kb-hands-holder {
    height: min(148px, 54vw);
  }

  .vc-keyboard-edclub .kb-row-bottom-mac {
    flex-wrap: nowrap;
  }
}
