.keyboard-container {
  display: block;
  padding: 10px;
  box-sizing: border-box;
  border: 1px solid #dddddd;
  border-radius: 0;
  margin-top: 10px;
  width: 100%;
  height: auto;
  overflow: visible;
  background: #ffffff;
}

.keyboard-tabs-wrap {
  display: flex;
  align-items: center;
  gap: 5px;
  margin-bottom: 5px;
}

.keyboard-tabs {
  display: flex;
  gap: 5px;
  flex: 1 1 auto;
  min-width: 0;
  overflow-x: auto;
  scroll-behavior: smooth;
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.keyboard-tabs::-webkit-scrollbar {
  display: none;
}

.keyboard-tab-nav {
  flex: 0 0 auto;
  width: 26px;
  height: 38px;
  padding: 0;
  border: 1px solid #dddddd;
  border-radius: 0;
  background: #ffffff;
  color: #111111;
  font-family: KaTeX_Main, 'Asana Math', serif;
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  transition: background-color 0.2s ease, border-color 0.2s ease, opacity 0.2s ease;
}

.keyboard-tab-nav:hover {
  background: #f2f2f2;
  border-color: #cccccc;
}

.keyboard-tab-nav-off {
  opacity: 0.35;
  cursor: default;
}

.keyboard-tab-nav-off:hover {
  background: #ffffff;
  border-color: #dddddd;
}

.keyboard-tab-btn {
  flex: 0 0 118px;
  height: 38px;
  padding: 0 8px;
  border: 1px solid #dddddd;
  border-radius: 0;
  background: #ffffff;
  color: #111111;
  font-family: KaTeX_Main, 'Asana Math', serif;
  font-size: 13px;
  font-weight: 400;
  cursor: pointer;
  white-space: nowrap;
  transition: background-color 0.2s ease, border-color 0.2s ease;
}

.keyboard-tab-btn:hover {
  background: #f2f2f2;
  border-color: #cccccc;
}

.keyboard-tab-btn.active {
  background: #e9e9e9;
  border-color: #bbbbbb;
  color: #111111;
}

.keyboard-layout {
  display: grid;
  grid-template-columns: repeat(8, minmax(0, 1fr));
  gap: 5px;
  align-items: start;
}

.keyboard-basic-left {
  grid-column: span 4;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 5px;
  align-content: start;
}

.keyboard-right {
  grid-column: span 4;
  display: block;
  min-width: 0;
}

.keyboard-panel {
  display: none;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 5px;
  align-content: start;
}

.keyboard-panel.active {
  display: grid;
}

.key-btn {
  font-family: KaTeX_Main, 'Asana Math', serif;
  width: 100%;
  height: 38px;
  font-size: 13px;
  font-weight: 400;
  color: #111111;
  border: 1px solid #dddddd;
  border-radius: 0;
  background-color: #ffffff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background-color 0.2s ease, border-color 0.2s ease;
}

.key-number,
.key-basic,
.key-algebra,
.key-trig,
.key-calculus,
.key-statistics,
.key-linear {
  background-color: #ffffff;
  border-color: #dddddd;
}

.keyboard-arrow-key {
  font-size: 15px;
  line-height: 1;
}

.keyboard-mode-active {
  background-color: #e9e9e9;
  border-color: #bbbbbb;
}

.key-btn:hover {
  background-color: #f2f2f2;
  border-color: #cccccc;
}

.math-box,
.small-box {
  display: inline-block;
  width: 8px;
  height: 8px;
  border: 1px solid #111111;
  border-radius: 1px;
  box-sizing: border-box;
}

.fraction-key-icon {
  display: grid;
  grid-template-rows: 10px 1px 10px;
  align-items: center;
  justify-items: center;
  width: 24px;
  height: 24px;
}

.fraction-key-icon .fraction-line {
  width: 24px;
  height: 1px;
  background: #111111;
  border: none;
}

.root-key-icon {
  position: relative;
  display: inline-block;
  width: 26px;
  height: 15px;
  line-height: 1;
  transform: translate(0, 0);
}

.root-key-icon .root-symbol {
  position: absolute;
  left: 0;
  top: 1px;
  z-index: 2;
  display: block;
  font-family: 'Asana Math', serif;
  font-size: 14px;
  line-height: 14px;
  font-weight: 400;
}

.root-key-icon .root-radicand {
  position: absolute;
  left: 8px;
  top: 0;
  z-index: 1;
  display: inline-flex;
  align-items: flex-start;
  justify-content: center;
  width: 15px;
  min-width: 15px;
  height: 13px;
  border-top: 1px solid #111111;
  margin: 0;
  padding-top: 2px;
  box-sizing: border-box;
}

.root-key-icon .root-radicand .math-box {
  width: 8px;
  height: 8px;
  transform: translateX(-1px);
}

.nth-root-key-icon {
  position: relative;
  display: inline-block;
  width: 36px;
  height: 15px;
  line-height: 1;
  transform: translate(0, 0);
}

.nth-root-key-icon .small-box {
  position: absolute;
  left: 0;
  top: -3px;
  width: 8px;
  height: 8px;
  margin: 0;
  z-index: 3;
}

.nth-root-key-icon .root-symbol {
  position: absolute;
  left: 9px;
  top: 1px;
  z-index: 2;
  display: block;
  font-family: 'Asana Math', serif;
  font-size: 14px;
  line-height: 14px;
  font-weight: 400;
}

.nth-root-key-icon .root-radicand {
  position: absolute;
  left: 17px;
  top: 0;
  z-index: 1;
  display: inline-flex;
  align-items: flex-start;
  justify-content: center;
  width: 15px;
  min-width: 15px;
  height: 13px;
  border-top: 1px solid #111111;
  margin: 0;
  padding-top: 2px;
  box-sizing: border-box;
}

.nth-root-key-icon .root-radicand .math-box {
  width: 8px;
  height: 8px;
  transform: translateX(-1px);
}

.function-key-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 1px;
  line-height: 1;
  white-space: nowrap;
}

.function-key-label {
  display: inline-block;
  font-size: 12px;
  line-height: 1;
  font-weight: 500;
}

.function-key-paren {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 8px;
  font-size: 13px;
  line-height: 8px;
  font-weight: 400;
  transform: translateY(-1px);
}

.function-key-icon .math-box {
  width: 8px;
  height: 8px;
  transform: none;
}

.power-key-icon {
  display: inline-flex;
  align-items: flex-start;
  justify-content: center;
  gap: 2px;
  line-height: 1;
}

.power-key-icon > span:first-child {
  font-size: 14px;
}

.power-key-icon .math-box {
  width: 8px;
  height: 8px;
  margin-top: -3px;
}

.square-power-key-icon {
  display: inline-flex;
  align-items: flex-start;
  justify-content: center;
  gap: 1px;
  line-height: 1;
}

.square-power-key-icon .math-box {
  width: 8px;
  height: 8px;
  margin-top: 4px;
}

.square-power-key-icon sup {
  font-size: 10px;
  line-height: 1;
}

.abs-key-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 2px;
  font-size: 16px;
  line-height: 1;
}

.abs-key-icon .math-box {
  transform: translateY(1px);
}

.log-base-key-icon {
  display: inline-flex;
  align-items: flex-end;
  justify-content: center;
  gap: 2px;
  line-height: 1;
}

.log-base-key-icon .math-box {
  width: 8px;
  height: 8px;
  margin-bottom: -2px;
}

.degree-key-icon {
  display: inline-flex;
  align-items: flex-start;
  justify-content: center;
  gap: 2px;
  line-height: 1;
}

.degree-key-icon .math-box {
  margin-top: 4px;
}

.degree-key-icon span:last-child {
  font-size: 15px;
}

.factorial-key-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 2px;
  line-height: 1;
}

.factorial-key-icon .math-box {
  transform: translateY(1px);
}

.factorial-key-icon span:last-child {
  font-size: 16px;
}

.derivative-key-icon,
.mixed-partial-key-icon {
  display: grid;
  grid-template-rows: 10px 1px 10px;
  align-items: center;
  justify-items: center;
  width: 30px;
  height: 24px;
  line-height: 1;
  font-size: 11px;
}

.mixed-partial-key-icon {
  width: 38px;
  font-size: 10px;
}

.derivative-line {
  width: 24px;
  height: 1px;
  background: #111111;
}

.mixed-partial-key-icon .derivative-line {
  width: 34px;
}

.limit-key-icon {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1px;
  line-height: 1;
}

.limit-key-icon > span:first-child {
  font-size: 13px;
}

.limit-key-icon > span:last-child {
  font-size: 9px;
  display: inline-flex;
  align-items: center;
  gap: 1px;
}

.limit-key-icon .math-box {
  width: 6px;
  height: 6px;
}

.limit-key-icon sup {
  font-size: 7px;
  line-height: 1;
}

.integral-key-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  line-height: 1;
}

.integral-symbol {
  font-size: 20px;
  line-height: 1;
}

.def-integral-key-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 3px;
  line-height: 1;
}

.def-integral-boxes {
  display: grid;
  grid-template-rows: 8px 8px;
  row-gap: 1px;
  align-items: center;
  justify-items: center;
}

.integral-upper-box,
.integral-lower-box {
  width: 6px;
  height: 6px;
}

.double-integral-key-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 3px;
  line-height: 1;
}

.double-integral-part {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 2px;
}

.double-integral-part .integral-symbol {
  font-size: 20px;
  line-height: 1;
}

.double-integral-box-pair {
  display: grid;
  grid-template-rows: 8px 8px;
  row-gap: 1px;
  align-items: center;
  justify-items: center;
}

.double-integral-box-pair .math-box {
  width: 6px;
  height: 6px;
}

.input-container {
  position: relative;
  width: 100%;
}

.keyboard-toggle-btn {
  position: absolute;
  bottom: 0;
  left: 50%;
  transform: translate(-50%, -15%);
  z-index: 2;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background-color: #333333;
  border: none;
  cursor: pointer;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.3s ease;
  overflow: hidden;
}

.keyboard-toggle-btn::before {
  content: "";
  position: absolute;
  top: 0;
  left: -50%;
  width: 50%;
  height: 100%;
  background: linear-gradient(
    120deg,
    rgba(255, 255, 255, 0) 0%,
    rgba(255, 255, 255, 0.8) 50%,
    rgba(255, 255, 255, 0) 100%
  );
  transform: skewX(-25deg);
  opacity: 0;
  animation: shine 3s linear infinite;
}

@keyframes shine {
  0% {
    left: -50%;
    opacity: 0;
  }

  25% {
    left: 0%;
    opacity: 1;
  }

  75% {
    left: 100%;
    opacity: 1;
  }

  100% {
    left: 150%;
    opacity: 0;
  }
}


.keyboard-toggle-btn .feather-icon {
  transition: transform 0.3s ease;
}

.keyboard-toggle-btn.open .feather-icon {
  transform: rotate(180deg);
}

.keyboard-container-hidden {
  display: none;
}

.key-btn.key-memory-set {
  border-color: #888888;
  font-weight: 700;
}

@media (max-width: 850px) {
  .keyboard-layout {
    grid-template-columns: 1fr;
  }

  .keyboard-basic-left,
  .keyboard-right {
    grid-column: auto;
  }
}

.keyboard-spaced-token {
  display: inline-block;
  margin-left: 6px;
  margin-right: 6px;
  padding: 0;
  line-height: 1.15;
  vertical-align: baseline;
  pointer-events: none;
  white-space: nowrap;
}


.key-btn .key-latex {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  white-space: nowrap;
  line-height: normal;
  font-size: 15px;

  transform-origin: center center;
  font-family: KaTeX_Main, 'Times New Roman', serif;
  pointer-events: none;
  -webkit-user-select: none;
  user-select: none;

}

.key-btn .key-latex .ML__latex,
.key-btn .key-latex .ML__base {
  cursor: pointer;
  width: auto;
  vertical-align: middle;
}


.key-btn[data-key-latex*="\\frac"] .key-latex,
.key-btn[data-key-latex*="\\binom"] .key-latex,
.key-btn[data-key-latex*="\\sqrt"] .key-latex {
  font-size: 13px;
}


.key-btn[data-key-latex*="\\int"] .key-latex,
.key-btn[data-key-latex*="\\iint"] .key-latex,
.key-btn[data-key-latex*="\\sum"] .key-latex,
.key-btn[data-key-latex*="\\prod"] .key-latex,
.key-btn[data-key-latex*="\\lim"] .key-latex {
  font-size: 12px;
}


.key-trig .key-latex,
.key-linear .key-latex {
  font-size: 12px;
}

.key-btn[data-key-latex*="arc"] .key-latex,
.key-btn[data-key-latex*="matrix"] .key-latex {
  font-size: 10px;
}


.key-btn[data-key-latex*="{array}"] .key-latex {
  font-size: 8px;
}


.key-btn.key-fn {
  background-color: #FDF8EF;
  border-color: #FAC775;
}

.key-btn.key-fn:hover {
  background-color: #FBF0DE;
  border-color: #F5B94F;
}

.key-btn.key-op {
  background-color: #E6F1FB;
  border-color: #85B7EB;
}

.key-btn.key-op:hover {
  background-color: #D6E8F8;
  border-color: #5FA0E3;
}


.key-btn.key-mode.keyboard-mode-active {
  background-color: #FDF0F0;
  border-color: #F09595;
}

.key-btn.key-mode:hover {
  background-color: #FBE2E2;
  border-color: #E87A7A;
}

.key-btn[data-key-latex*="\\sum_"] .key-latex,
.key-btn[data-key-latex*="\\prod_"] .key-latex {
  font-size: 10px;
}