/* Static reference keyboard. Load after the base and scene styles. */
.keyboard-reference {
  container: typing-keyboard / inline-size;
  margin-top: 20px;
  padding: 0 16px;
  border: 1px solid #dce4d3;
  border-radius: 14px;
  background: #fbfcf7;
}

.keyboard-reference > summary {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-inline: -16px;
  padding: 16px;
  color: #41583b;
  font-size: 14px;
  font-weight: 700;
  line-height: 1.5;
  list-style: none;
  cursor: pointer;
}

.keyboard-reference > summary::-webkit-details-marker { display: none; }
.keyboard-reference > summary::marker { content: ''; }
.keyboard-reference > summary::before {
  content: '+';
  display: grid;
  flex: 0 0 25px;
  place-items: center;
  width: 25px;
  height: 25px;
  border: 1px solid #d1dec5;
  border-radius: 7px;
  background: #eef3e5;
  color: #567344;
  font-size: 20px;
  font-weight: 500;
  line-height: 1;
}
.keyboard-reference[open] > summary::before { content: '−'; }
.keyboard-reference > summary > span {
  margin-left: auto;
  color: #7a8770;
  font-size: 11px;
  font-weight: 400;
}
.keyboard-reference > summary:focus-visible {
  outline: 3px solid #b18c51;
  outline-offset: 3px;
  border-radius: 12px;
}
.keyboard-reference[open] { padding-bottom: 14px; }
.keyboard-reference[open] > summary {
  border-bottom: 1px solid #e3e9db;
  margin-bottom: 12px;
}
.keyboard-hand-stage { position: relative; isolation: isolate; }
.keyboard-hand-stage.has-hand-guide { padding-bottom: var(--hand-guide-space, 75px); }
.keyboard-hand-overlay { position: absolute; inset: 0 0 auto; width: 100%; z-index: 2; pointer-events: none; }
/* Labels sit above the translucent hands and painted nails. */
.has-hand-guide .keyboard .key { z-index: auto; }
.has-hand-guide .key-label { position: relative; z-index: 3; }
.refined-hand-guide { overflow: visible; }
.keyboard-hand-overlay[hidden] { display: none; }
.keyboard-hands-art { display: block; width: 100%; height: 100%; overflow: visible; }
.hand-position-labels { display: none; position: absolute; bottom: 4px; left: 0; right: 0; justify-content: space-around; font-size: 11px; font-weight: 600; color: #5e7267; z-index: 3; pointer-events: none; }
.has-hand-guide .hand-position-labels { display: flex; }
.hand-position-labels span { background: #fbfcf7d9; padding: 5px 12px; border: 1px solid #dce4d3; border-radius: 20px; }
.hand-preview-tip { margin: 4px 0 13px; color: #7a8770; font-size: 11px; line-height: 1.6; }
.keyboard-hand-overlay, .keyboard-hand-overlay * { animation: none !important; transition: none !important; }
@media(max-width:760px) {
  .hand-position-labels { font-size: 9px; }
  .hand-position-labels span { padding: 4px 7px; }
  .hand-preview-tip { font-size: 9px; }
}
.keyboard-reference .keyboard-topline {
  padding: 7px 0 16px;
  color: #526a44;
  font-size: 12px;
  line-height: 1.6;
}
.keyboard-reference .keyboard-caption {
  color: #67755b;
  font-size: 10px;
  line-height: 1.6;
}

.keyboard.static-keyboard {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  padding: 14px 12px 17px;
  border: 1px solid #d4dacb;
  border-radius: 14px;
  background: linear-gradient(180deg, #edf0e6, #e4e8db);
  box-shadow: inset 0 1px 0 #fff, 0 5px 0 #cdd4c3;
}
.keyboard.static-keyboard .keyboard-row {
  display: flex;
  gap: 6px;
  width: 100%;
  min-width: 0;
  margin: 0 0 10px;
}
.keyboard.static-keyboard .keyboard-row:last-child {
  justify-content: center;
  margin-bottom: 0;
}
.keyboard.static-keyboard .key {
  --key-top: #fffef9;
  --key-bottom: #f2f2e8;
  --key-border: #d1d7c8;
  --key-edge: #bcc6b0;
  position: relative;
  display: grid;
  place-items: center;
  flex: 1 1 0;
  min-width: 0;
  height: 52px;
  padding: 0 2px;
  border: 1px solid var(--key-border);
  border-radius: 8px;
  background: linear-gradient(180deg, var(--key-top), var(--key-bottom)) !important;
  box-shadow: inset 0 2px 0 #ffffffa6, inset 0 -2px 0 #ffffff50,
    0 5px 0 var(--key-edge), 0 6px 1px #64765020;
  color: #354b32;
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
  font-size: 20px;
  font-weight: 650;
  line-height: 1;
  letter-spacing: 0;
  text-shadow: 0 1px #ffffffa6;
}
.keyboard.static-keyboard .key > .key-label {
  display: grid;
  place-items: center;
  width: 100%;
  max-width: 100%;
  height: 100%;
  overflow: hidden;
  white-space: nowrap;
  text-align: center;
}
.keyboard.static-keyboard .key.special {
  --key-top: #e9eedf;
  --key-bottom: #dce3d0;
  flex: 1.6 1 0;
  color: #516248;
  font-size: 12px;
  font-weight: 600;
}
.keyboard.static-keyboard .row-3 .key.special { flex: 2.2 1 0; }
.keyboard.static-keyboard .key.space-key {
  flex: 0 1 45%;
  width: 45%;
  max-width: 45%;
  height: 48px;
  margin-inline: auto;
  color: #40543a;
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
  font-size: 24px;
  font-weight: 600;
  letter-spacing: 0;
}
.keyboard.static-keyboard .home-bump {
  width: 12px;
  height: 3px;
  bottom: 5px;
  border-radius: 3px;
  background: currentColor;
  opacity: .5;
}
.keyboard.static-keyboard .key.colored.finger-pinky:not(.special):not(.space-key) {
  --key-top: #fcf1f5;
  --key-bottom: #efdee5;
  --key-edge: #cbb8c0;
  --key-border: #ddcdd4;
}
.keyboard.static-keyboard .key.colored.finger-ring:not(.special) {
  --key-top: #fcf7e5;
  --key-bottom: #eee5cb;
  --key-edge: #cec09d;
  --key-border: #dfd4b7;
}
.keyboard.static-keyboard .key.colored.finger-middle:not(.special) {
  --key-top: #f0f6e7;
  --key-bottom: #e0e9d3;
  --key-edge: #b7c7a4;
  --key-border: #ccd8be;
}
.keyboard.static-keyboard .key.colored.finger-index:not(.special) {
  --key-top: #eef6f2;
  --key-bottom: #dce8e1;
  --key-edge: #afc5b8;
  --key-border: #c6d8ce;
}
.keyboard.static-keyboard .key.shift-hint,
.keyboard.static-keyboard .key.shift-on {
  --key-top: #e9f1d7;
  --key-bottom: #d2e2b5;
  --key-edge: #91a976;
  border-color: #9ab781;
  color: #3e5930;
}
.keyboard.static-keyboard .key.target,
.keyboard.static-keyboard .key.colored.target {
  --key-top: #d4e8b4;
  --key-bottom: #adc98d;
  --key-edge: #748f57;
  border: 2px solid #7c9e5f;
  background: linear-gradient(180deg, #d4e8b4, #adc98d) !important;
  box-shadow: inset 0 2px 0 #f2ffdc, 0 5px 0 #748f57, 0 0 0 2px #afc58e40;
  color: #263f21;
}
.keyboard.static-keyboard .key.wrong {
  background: linear-gradient(180deg, #f9e7d7, #ecc7aa) !important;
  border-color: #c79d78;
  box-shadow: inset 0 2px 0 #fff6eb, 0 5px 0 #b58b69;
  color: #714b30;
}
.keyboard.static-keyboard .key:focus-visible {
  outline: 3px solid #9a7945;
  outline-offset: 3px;
}
.keyboard.static-keyboard .key.hand-preview-key {
  outline: 3px solid #49978b;
  outline-offset: 2px;
}

/* Keyboard input only changes static cues; all animated feedback stays on stage. */
.keyboard.static-keyboard,
.keyboard.static-keyboard *,
.keyboard.static-keyboard *::before,
.keyboard.static-keyboard *::after {
  animation: none !important;
  transition: none !important;
}
.keyboard.static-keyboard .key,
.keyboard.static-keyboard .key:active,
.keyboard.static-keyboard .key:hover,
.keyboard.static-keyboard .key > * {
  transform: none !important;
}
.keyboard.static-keyboard .key-animal,
.keyboard.static-keyboard .key-effect,
.keyboard.static-keyboard .animal,
.keyboard.static-keyboard .toy-hammer,
.keyboard.static-keyboard .keyboard-mole {
  display: none !important;
}

@container typing-keyboard (max-width: 660px) {
  .keyboard.static-keyboard { padding: 12px 9px 15px; }
  .keyboard.static-keyboard .keyboard-row { gap: 4px; }
  .keyboard.static-keyboard .key { height: 48px; font-size: 18px; }
  .keyboard.static-keyboard .key.special { font-size: 10px; }
  .keyboard.static-keyboard .key.space-key { height: 45px; font-size: 22px; }
}

@container typing-keyboard (max-width: 430px) {
  .keyboard-reference > summary { gap: 7px; font-size: 12px; }
  .keyboard-reference > summary > span { font-size: 10px; }
  .keyboard.static-keyboard { padding: 10px 5px 13px; border-radius: 9px; }
  .keyboard.static-keyboard .keyboard-row { gap: 3px; margin-bottom: 8px; }
  .keyboard.static-keyboard .keyboard-row:last-child { margin-bottom: 0; }
  .keyboard.static-keyboard .key { height: 40px; font-size: 15px; border-radius: 5px; padding: 0; }
  .keyboard.static-keyboard .key.special { font-size: 8px; }
  .keyboard.static-keyboard .key.space-key { height: 40px; font-size: 20px; }
  .keyboard.static-keyboard .home-bump { width: 8px; height: 2px; bottom: 4px; }
}

@container typing-keyboard (max-width: 310px) {
  .keyboard-reference > summary { flex-wrap: wrap; }
  .keyboard-reference > summary > span { margin-left: 35px; }
  .keyboard-reference .keyboard-topline { flex-wrap: wrap; padding-bottom: 12px; font-size: 10px; }
  .keyboard.static-keyboard .keyboard-row { gap: 2px; }
  .keyboard.static-keyboard .key { height: 35px; font-size: 12px; }
  .keyboard.static-keyboard .key.special { font-size: 7px; }
  .keyboard.static-keyboard .key.space-key { height: 36px; font-size: 18px; }
}
