.keyboard-exhibit { position: relative; isolation: isolate; margin: 0; min-width: 0; padding: 32px 0 4px; }
.hero-mandarin {
  position: absolute;
  z-index: 0;
  top: -48px;
  right: 2%;
  width: clamp(144px, 20vw, 262px);
  aspect-ratio: 448 / 420;
  padding: 0;
  border: 0;
  background: none;
  perspective: 800px;
  -webkit-tap-highlight-color: transparent;
}
.hero-mandarin:disabled { cursor: default; }
.fruit-face {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  transform-origin: center;
  backface-visibility: hidden;
  transition: transform 550ms cubic-bezier(.3,.65,.25,1);
}
.fruit-face img { display: block; width: 100%; height: auto; pointer-events: none; }
.fruit-greeting { transform: rotateY(-180deg); }
.fruit-greeting > span {
  position: absolute;
  top: 51%;
  left: 50%;
  color: #4e220b;
  font: 800 clamp(12px, 1.65vw, 23px)/1 Consolas, monospace;
  text-shadow: 0 1px #ffcb7280;
  white-space: nowrap;
  transform: translateX(-50%) rotate(-9deg);
}
.hero-mandarin[aria-pressed="true"] .fruit-peel { transform: rotateY(180deg); }
.hero-mandarin[aria-pressed="true"] .fruit-greeting { transform: rotateY(0); }
.keyboard-console, .keyboard-spec { display: flex; justify-content: space-between; gap: 10px; padding-inline: 14px; font: 500 10px/1.5 Consolas, monospace; }
.keyboard-console { position: relative; color: var(--orange-ink); }
.keyboard-caption { letter-spacing: .08em; white-space: nowrap; }
.keyboard-output { min-width: 0; color: var(--text); text-align: end; overflow-wrap: anywhere; }
.keyboard-output > span:first-child { color: var(--orange-ink); }
.keyboard-spec { position: absolute; inset: auto 0 -8px; color: var(--muted); pointer-events: none; }
.keyboard-rig { position: relative; z-index: 1; padding-block: 18px 27px; perspective: 1000px; pointer-events: none; }
.keyboard-board {
  position: relative;
  display: grid;
  gap: clamp(5px, .8vw, 10px);
  padding: clamp(10px, 1.4vw, 18px);
  border: 1px solid #97c6e7;
  border-radius: 16px;
  background: #75a9ce;
  box-shadow: 0 10px #203e59, 0 17px 23px #0008;
  transform: rotateX(16deg) rotateZ(-4deg) scale(.94);
  transition: transform 220ms ease-out;
  pointer-events: auto;
  user-select: none;
}
@media (hover:hover) and (pointer:fine) {
  .keyboard-board:hover { transform: rotateX(8deg) rotateZ(-2deg) scale(.97); }
}
.keyboard-board:focus-within { transform: rotateX(9deg) rotateZ(-2deg) scale(.97); }
.keyboard-row { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: inherit; }
.keyboard-row .key {
  display: grid;
  place-items: center;
  aspect-ratio: 1;
  min-height: 44px;
  padding: 2px;
  border: 1px solid #eef1f4;
  border-bottom: 5px solid #b0b8be;
  border-radius: 9px;
  background: #f2eee9;
  color: #20384e;
  font: 700 clamp(8px, 1.05vw, 13px)/1 Consolas, monospace;
  text-align: center;
  overflow-wrap: anywhere;
}
.keyboard-row .key:hover, .keyboard-row .key:focus-visible { outline: 2px solid #254962; outline-offset: 1px; }
.keyboard-row .key:active { transform: translateY(2px); }
.keyboard-board.is-rgb .key { border-color: #a68bff; }
.keyboard-board.is-rgb .keyboard-row:nth-child(2n) .key { border-color: #61e0a8; }
.keyboard-board.is-rgb .keyboard-row:nth-child(3n) .key { border-color: #ff8296; }
.keyboard-board.is-booting::after { content: ""; position: absolute; inset: 0; border-radius: inherit; background: linear-gradient(transparent 35%, #ffc36c40, transparent 65%); pointer-events: none; animation: board-scan 780ms ease-out both; }
@keyframes board-scan { from { clip-path: inset(0 0 100% 0); opacity: 1; } to { clip-path: inset(90% 0 0 0); opacity: 0; } }
@media (max-width: 760px) {
  .keyboard-exhibit { margin: 0; padding-top: 22px; }
  .hero-mandarin { top: -12px; right: 1%; }
  .keyboard-board { transform: rotateX(13deg) rotateZ(-3deg) scale(.96); }
  .keyboard-rig { padding-bottom: 19px; }
}
@media (max-width: 380px) {
  .keyboard-console, .keyboard-spec { font-size: 9px; padding-inline: 5px; }
  .hero-mandarin { width: 128px; }
}
@media (prefers-reduced-motion: reduce) {
  .keyboard-board, .fruit-face { transition: none; }
  .keyboard-board.is-booting::after { animation: none; display: none; }
}
.browse-content { position: relative; isolation: isolate; }
.keyboard-scene {
  position: absolute;
  z-index: -1;
  inset: -90px 0 auto;
  width: 100%;
  height: clamp(800px, 72vw, 1100px);
  pointer-events: none;
  mask-image: linear-gradient(#000 85%, transparent);
}
.has-scene .keyboard-rig, .has-scene .hero-mandarin { opacity: 0; pointer-events: none; }
.has-scene .keyboard-board { pointer-events: none; }
.has-scene:focus-within { outline: 1px solid var(--line); outline-offset: 4px; border-radius: 12px; }
.keyboard-console { z-index: 3; pointer-events: none; }
.keyboard-response:not(:empty) { display: block; color: #ffb771; }
.keyboard-output { block-size: 4.5em; overflow: hidden; }
.keyboard-exhibit { min-height: clamp(315px, 32vw, 430px); }
@media (max-width: 640px) {
  .keyboard-exhibit { min-height: 285px; }
  .keyboard-scene { top: 0; height: clamp(920px, 175vw, 1150px); }
}
