/* ==========================================================================
   EKRAN KLAVIATURASI
   Tugma o'lchami ekran balandligidan hisoblanadi: barmoq bilan bosiladigan
   nishon kichik ekranda ham 46px dan tushmaydi.
   ========================================================================== */
.kb {
  --kb-key: clamp(46px, 7.4vh, 80px);
  --kb-gap: clamp(5px, .8vh, 10px);
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 75;
  padding: clamp(10px, 1.4vh, 18px) clamp(10px, 2vw, 32px) calc(clamp(10px, 1.4vh, 18px) + env(safe-area-inset-bottom));
  background: linear-gradient(#e3e7ee, #cfd5df);
  border-top: 1px solid #bcc4d0;
  box-shadow: 0 -10px 34px rgba(20, 28, 40, .18);
  /* Animatsiyasiz: sahifa joyiga qaytgan paytda klaviatura hali surilayotgan
     bo'lsa, pastki panel uning ustiga chiqardi; sust qurilmada esa kadr
     qotib qolib, klaviatura ekran o'rtasida turib qolardi. */
  display: none;
  user-select: none; -webkit-user-select: none; touch-action: none;
}
.kb.is-open { display: block; }

.kb__in { max-width: 1320px; margin: 0 auto; display: flex; flex-direction: column; gap: var(--kb-gap); }
.kb__in--tel { max-width: 560px; }
.kb__row { display: flex; gap: var(--kb-gap); justify-content: center; }

.kb__key {
  position: relative; flex: 1 1 0; min-width: 0; height: var(--kb-key);
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: 0; border-radius: 10px; padding: 0 4px;
  background: linear-gradient(#fff, #f7f9fc); color: #1b2430;
  font-family: var(--f-body, Inter, sans-serif); font-size: clamp(20px, 3vh, 30px); font-weight: 500; line-height: 1;
  box-shadow: 0 2px 0 #a9b3c1, 0 3px 6px rgba(20, 28, 40, .16);
  cursor: pointer; touch-action: none; -webkit-tap-highlight-color: transparent;
  transition: transform .05s, box-shadow .05s, background .05s;
}
.kb__key svg { width: 1.15em; height: 1.15em; flex: none; pointer-events: none; }
.kb__key span { pointer-events: none; }
.kb__key.is-down { transform: translateY(2px); background: #dfe6f1; box-shadow: 0 0 0 #a9b3c1, 0 1px 2px rgba(20, 28, 40, .2); }

.kb__key--num { background: linear-gradient(#f6f8fb, #edf0f5); font-size: clamp(18px, 2.7vh, 27px); }
.kb__key--fn { background: linear-gradient(#c6cedb, #b8c1d0); box-shadow: 0 2px 0 #98a3b4, 0 3px 6px rgba(20, 28, 40, .16); font-size: clamp(16px, 2.2vh, 22px); font-weight: 600; }
.kb__key--fn.is-down { background: #a8b3c4; }
.kb__key--mid  { flex-grow: 1.5; }
.kb__key--wide { flex-grow: 1.9; }
.kb__key--lang { flex-grow: 2.2; }
.kb__key--space { flex-grow: 7; font-size: clamp(14px, 1.9vh, 18px); color: #6b7684; font-weight: 400; }
.kb__key--accent { background: linear-gradient(#2b62e6, #1d4ed8); color: #fff; box-shadow: 0 2px 0 #153a9f, 0 3px 6px rgba(20, 28, 40, .2); }
.kb__key--accent.is-down { background: #173fae; }
.kb__key.is-on { background: #fff; color: #1d4ed8; }
.kb__key.is-lock { background: #1d4ed8; color: #fff; }

/* Bosilgan harf kattalashib ko'rinadi: barmoq tugmani yopib turadi */
.kb__key[data-pop].is-down:not(.kb__key--space)::before {
  content: attr(data-pop);
  position: absolute; left: 50%; bottom: calc(100% + 4px); transform: translateX(-50%);
  min-width: 1.9em; padding: .34em .4em; border-radius: 12px;
  background: #fff; color: #1b2430; font-size: 1.35em; font-weight: 600; text-align: center;
  box-shadow: 0 6px 20px rgba(20, 28, 40, .28); pointer-events: none; z-index: 2;
}

/* Klaviatura ochiq: sahifa uning ustida qoladi, ostida yashirinmaydi.
   Savol sahifasining balandligi kiosk.css da: u har doim ekranga teng. */
.kb-on .kiosk { padding-bottom: var(--kb-h, 0px); }
/* Maydon ekranning emas, klaviatura ustidagi qismning o'rtasiga keladi */
.kb-on { scroll-padding-bottom: var(--kb-h, 0px); }
.kb-on .kiosk:has(.chat-shell--kiosk) .kiosk-session { display: none; }
.kb-on .kiosk__footer { display: none; }

/* Sarlavhadagi tugma */
.kiosk__kb { width: 48px; padding: 0; }
.kiosk__kb svg { width: 25px; height: 25px; }

/* Telefonning o'z klaviaturasi bor */
@media (max-width: 640px) {
  .kiosk__kb, .kb, .kb.is-open { display: none; }
  .kb-on .kiosk { padding-bottom: 0; }
}
@media (prefers-reduced-motion: reduce) {
  .kb__key { transition: none; }
}
