/* The keyboard sits in its own viewport dock. The form uses its measured height. */
.bbc-keyboard-shell {
  --bbc-key-accent: var(--bbc-book-fill, #c6e7b9);
  --bbc-key-accent-ink: var(--bbc-book-ink, #14251b);
  --bbc-key-focus: #1d6544;
  position: fixed;
  z-index: 10000;
  inset: auto 0 0;
  margin: 0;
  padding: 0;
  background: #e1e6e8;
  color: #202729;
  box-shadow: 0 -1px 0 #a4afb44a, 0 -5px 22px #1d2c3419;
  isolation: isolate;
  overscroll-behavior: contain;
}
.bbc-keyboard-shell[hidden] { display: none; }
.bbc-keyboard {
  --bbc-key-height: clamp(45px, 6.8svh, 54px);
  --bbc-row-gap: 5px;
  --bbc-shortcut-height: 29px;
  --bbc-letter-height: var(--bbc-key-height);
  --bbc-key-gap: clamp(3px, 1vw, 6px);
  box-sizing: border-box;
  width: 100%;
  max-width: 780px;
  margin: 0 auto;
  padding: 6px max(4px, env(safe-area-inset-right, 0px)) max(7px, env(safe-area-inset-bottom, 0px)) max(4px, env(safe-area-inset-left, 0px));
  background: linear-gradient(180deg,#e9edef,#e0e5e8 42%,#dce2e5);
  color: #202729;
  font-family: -apple-system,BlinkMacSystemFont,"Segoe UI",Arial,sans-serif;
  -webkit-tap-highlight-color: transparent;
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
  touch-action: manipulation;
}
.bbc-keyboard * { box-sizing: border-box; }
.bbc-keyboard .bbc-key-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .75rem;
  min-height: 38px;
  margin: -2px 0 4px;
  padding: 0 2px 2px 6px;
  color: #37483c;
}
.bbc-keyboard .bbc-key-field-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 14px;
  font-weight: 600;
}
.bbc-keyboard .bbc-key-nav-action {
  flex: none;
  appearance: none;
  min-width: 68px;
  min-height: 35px;
  margin: 0;
  padding: 4px 14px;
  border: 0;
  border-radius: 9px;
  background: #e4eee1;
  color: var(--bbc-key-accent-ink);
  box-shadow: 0 1px 0 #91ab95;
  font: 660 15px/1.15 -apple-system,BlinkMacSystemFont,"Segoe UI",Arial,sans-serif;
  cursor: pointer;
  touch-action: manipulation;
}
.bbc-keyboard .bbc-key-nav-action:focus-visible { outline: 2px solid var(--bbc-key-focus); outline-offset: 1px; }
.bbc-keyboard .bbc-key-rows { display: grid; gap: var(--bbc-row-gap); }
.bbc-keyboard .bbc-key-row { display: flex; align-items: stretch; gap: var(--bbc-key-gap); height: var(--bbc-letter-height); }
.bbc-keyboard[data-shortcuts] { --bbc-letter-height: max(40px, calc(var(--bbc-key-height) - (var(--bbc-shortcut-height) + var(--bbc-row-gap)) / 4)); }
.bbc-keyboard .bbc-key-home-row { padding-inline: 5%; }
.bbc-keyboard .bbc-key {
  position: relative;
  display: grid;
  place-items: center;
  flex: 1 1 0;
  appearance: none;
  -webkit-appearance: none;
  min-width: 0;
  min-height: 0;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 7px;
  background: #fff;
  color: #202729;
  box-shadow: 0 1px 0 #9ca8ae;
  font: inherit;
  font-size: clamp(19px, 5.3vw, 25px);
  font-weight: 450;
  line-height: 1;
  text-align: center;
  text-transform: none;
  letter-spacing: normal;
  cursor: pointer;
  touch-action: manipulation;
  overflow: visible;
}
.bbc-keyboard .bbc-key:focus-visible { outline: 2px solid var(--bbc-key-focus); outline-offset: 1px; z-index: 5; }
.bbc-keyboard .bbc-key-face { display: inline-flex; align-items: center; justify-content: center; gap: 4px; pointer-events: none; }
.bbc-keyboard .bbc-key svg { display: block; width: 19px; height: 19px; stroke-width: 1.75; }
.bbc-keyboard .bbc-key-side,.bbc-keyboard .bbc-key-mode { background: #c3ccd1; }
.bbc-keyboard .bbc-key-mode,.bbc-keyboard .bbc-key-space,.bbc-keyboard .bbc-key-action { font-size: 15px; font-weight: 550; }
.bbc-keyboard .bbc-key-side { flex: 1.45 1 0; font-size: 15px; font-weight: 610; }
.bbc-keyboard .bbc-key-side[aria-pressed="true"] { background: #fafcfd; }
.bbc-keyboard .bbc-key-mode { flex: 0 0 clamp(45px, 14%, 72px); }
.bbc-keyboard .bbc-key-space { flex: 1 1 auto; font-weight: 450; }
.bbc-keyboard .bbc-key-action { flex: 0 0 clamp(68px, 19%, 100px); background: #e4eee1; color: var(--bbc-key-accent-ink); box-shadow: 0 1px 0 #81a586; }
.bbc-keyboard .bbc-key-action svg { width: 15px; height: 15px; stroke-width: 2; }
.bbc-keyboard .bbc-key-bottom-row > .bbc-key-plain { flex: 0 0 10%; font-size: 19px; }
.bbc-keyboard .bbc-key-shortcuts { display: grid; grid-template-columns: repeat(4,minmax(0,1fr)); gap: var(--bbc-key-gap); margin-bottom: var(--bbc-row-gap); }
.bbc-keyboard .bbc-key-shortcut { height: var(--bbc-shortcut-height); background: #f4f7f8; font-size: clamp(11px,3.2vw,14px); font-weight: 560; }
.bbc-keyboard .bbc-key-number-grid { display: grid; grid-template-columns: repeat(12,minmax(0,1fr)); gap: var(--bbc-row-gap) var(--bbc-key-gap); }
.bbc-keyboard .bbc-key-number-grid > .bbc-key { grid-column: span 4; height: var(--bbc-key-height); font-size: 24px; font-weight: 500; }
.bbc-keyboard .bbc-key-number-grid[data-kind="digits"] > [data-key="0"] { grid-column: 5 / span 4; }
.bbc-keyboard .bbc-key-number-grid[data-kind="number"] > .bbc-key:nth-child(n+10) { grid-column: span 3; }
/* Keep the button's hit box fixed. The cap and the glyph provide the visual feedback. */
.bbc-keyboard button[data-key] { position: relative; isolation: isolate; }
.bbc-keyboard button[data-key]::before {
  content: '';
  position: absolute;
  inset: 0;
  z-index: 0;
  border-radius: inherit;
  background: var(--bbc-key-accent);
  box-shadow: inset 0 0 0 1px #82ad83, 0 1px 0 #82a185;
  opacity: 0;
  pointer-events: none;
}
.bbc-keyboard button[data-key] .bbc-key-face { position: relative; z-index: 1; }
.bbc-keyboard button[data-key][data-active] { z-index: 2; background: var(--bbc-key-accent); color: var(--bbc-key-accent-ink); }
.bbc-keyboard button[data-key][data-active]::before { opacity: 1; }
@media (hover: hover) and (pointer: fine) {
  .bbc-keyboard .bbc-key:hover:not([data-active]) { outline: 1px solid #88988e; outline-offset: 0; }
  .bbc-keyboard .bbc-key:focus-visible { outline: 2px solid var(--bbc-key-focus); outline-offset: 1px; }
}
@media (prefers-reduced-motion: no-preference) {
  .bbc-keyboard { animation: bbc-board-in .18s cubic-bezier(.16,.74,.23,1); }
  .bbc-keyboard button[data-key]::before,
  .bbc-keyboard button[data-key] .bbc-key-face { transition: transform 65ms ease-out; }
  .bbc-keyboard button[data-key][data-active]::before { transform: scale(var(--bbc-press-width,1.04),1.04); transition-duration: 0s; }
  .bbc-keyboard .bbc-key-space { --bbc-press-width: 1.008; }
  .bbc-keyboard button[data-key][data-active] .bbc-key-face { transform: scale(1.04); transition-duration: 0s; }
  @keyframes bbc-board-in { from { transform: translateY(10px); opacity: .78; } to { transform: none; opacity: 1; } }
}
@media (max-height: 570px) {
  .bbc-keyboard { --bbc-key-height: 38px; --bbc-row-gap: 4px; --bbc-shortcut-height: 25px; }
  .bbc-keyboard[data-shortcuts] { --bbc-letter-height: 34px; }
}
@media (max-height: 440px) and (orientation: landscape) {
  .bbc-keyboard { --bbc-key-height: 33px; --bbc-row-gap: 3px; --bbc-shortcut-height: 23px; max-width: 650px; padding-top: 4px; padding-bottom: max(2px,env(safe-area-inset-bottom,0px)); }
  .bbc-keyboard[data-shortcuts] { --bbc-letter-height: 29px; }
  .bbc-keyboard .bbc-key-nav { min-height: 29px; margin-bottom: 3px; }
  .bbc-keyboard .bbc-key-nav-action { min-height: 27px; font-size: 14px; }
}
@media (forced-colors: active) {
  .bbc-keyboard .bbc-key { border: 1px solid ButtonText; }
  .bbc-keyboard button[data-key][data-active] { forced-color-adjust: none; color: HighlightText; background: Highlight; }
  .bbc-keyboard button[data-key][data-active]::before { background: Highlight; box-shadow: none; }
}
