/* =========================================================
   SPR EXAMPLE TABLE
   ========================================================= */

.bb-spr-example-table {
  width: 86%;
  margin: 0 auto;
  border-collapse: collapse;
  table-layout: fixed;
  font-family: "Times New Roman", Georgia, serif;
}

.bb-spr-example-table th,
.bb-spr-example-table td {
  border: 1px solid #777;
  padding: 14px 16px;
  text-align: center;
  vertical-align: middle;
}

.bb-spr-example-table th {
  background: #f6f6f6;
  font-size: 18px;
  font-weight: 600;
  line-height: 1.3;
}

.bb-spr-example-table td {
  font-size: 18px;
  line-height: 1.35;
}

.bb-spr-example-table .bb-answer {
  text-align: center;
  vertical-align: middle;
  font-size: 20px;
  line-height: 1.2;
}

.bb-spr-example-table td:nth-child(2),
.bb-spr-example-table td:nth-child(3) {
  font-size: 20px;
  line-height: 1.45;
  text-align: center;
  vertical-align: middle;
}

.bb-spr-example-table td:nth-child(2) code,
.bb-spr-example-table td:nth-child(3) code {
  font-size: 20px !important;
  line-height: 1.35 !important;
  font-family: "Courier New", Courier, monospace;
}

.bb-spr-example-table td:nth-child(2) div,
.bb-spr-example-table td:nth-child(3) div {
  text-align: center;
  margin: 0 0 6px 0;
}

.bb-spr-example-table td:nth-child(2) div:last-child,
.bb-spr-example-table td:nth-child(3) div:last-child {
  margin-bottom: 0;
}

.bb-spr-example-table .bb-answer mjx-container {
  font-size: 90% !important;
}

/* =========================================================
   SPR INPUT + PREVIEW
   ========================================================= */

.bb-spr-wrap {
  margin: 0 18px;
  display: flex;
  flex-direction: column;
  gap: 18px;
  position: relative;
}

.bb-spr-entry-row {
  display: flex;
  align-items: center;
  justify-content: flex-start;
}

.bb-spr-input {
  width: 118px;
  height: 58px;
  padding: 8px 12px 18px 12px;
  box-sizing: border-box;

  border: 1.6px solid #777;
  border-radius: 12px;
  position: relative;

  background:
    linear-gradient(#555, #555) no-repeat center calc(100% - 11px) / calc(100% - 34px) 2px,
    #fff;

  font-family: Arial, Helvetica, sans-serif;
  font-size: 24px;
  line-height: 1;
  color: #111;
  text-align: left;
}

.bb-spr-input:focus,
.bb-spr-input:focus-visible,
.bb-spr-input:active {
  outline: none !important;
  border: 1.6px solid #777 !important;
  box-shadow: none !important;
}

.bb-spr-preview {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 40px;
}

.bb-spr-preview-label,
.bb-spr-preview-value {
  font-family: "Times New Roman", Georgia, serif;
  color: #111;
}

.bb-spr-preview-label {
  font-size: 30px;
  font-weight: 700;
  line-height: 1.2;
}

.bb-spr-preview-value {
  display: inline-flex;
  align-items: center;
  min-height: 40px;
  font-size: 20px;
  line-height: 1.2;
}

.bb-spr-preview-value mjx-container {
  margin: 0 !important;
  font-size: 118% !important;
  position: relative;
  top: 1px;
}

/* =========================================================
   SPR KEYPAD TOGGLE BUTTON
   ========================================================= */

.bb-spr-keypad-toggle-row {
  display: flex;
  justify-content: flex-start;
}

.bb-spr-keypad-toggle {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 10px;

  min-width: 210px;
  min-height: 42px;
  padding: 10px 16px 10px 62px;
  border-radius: 999px;

  font-family: Arial, Helvetica, sans-serif;
  font-size: 22px;
  font-weight: 400;
  line-height: 1;
  letter-spacing: -0.06em;

  cursor: pointer;
  transition: background-color 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.bb-spr-keypad-toggle::before {
  content: "";
  position: absolute;
  left: 16px;
  top: 50%;
  transform: translateY(-50%);

  width: 40px;
  height: 28px;
  background: url("../figures/assets/keypad-icon.svg") no-repeat center / contain;
}

.bb-spr-keypad-toggle.is-closed,
.bb-spr-keypad-toggle[aria-expanded="false"] {
  background: #ffffff !important;
  color: #111 !important;
  border: 1px solid #3d3d3d !important;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.14);
}

.bb-spr-keypad-toggle.is-closed::before,
.bb-spr-keypad-toggle[aria-expanded="false"]::before {
  filter: brightness(0) saturate(100%);
}

.bb-spr-keypad-toggle.is-open,
.bb-spr-keypad-toggle[aria-expanded="true"] {
  background: #1f1f1f !important;
  color: #ffffff !important;
  border: 1px solid #1f1f1f !important;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.18);
}

.bb-spr-keypad-toggle.is-open::before,
.bb-spr-keypad-toggle[aria-expanded="true"]::before {
  filter: brightness(0) invert(1);
}

/* =========================================================
   SPR KEYPAD PANEL
   ========================================================= */

:root {
  --bb-spr-keypad-width: 360px;
  --bb-spr-keypad-border: #a8a8a8;
  --bb-spr-keypad-shadow: 0 10px 22px rgba(0, 0, 0, 0.16);

  --bb-spr-keypad-head-h: 54px;
  --bb-spr-keypad-head-bg: #181818;
  --bb-spr-keypad-head-text: #ffffff;
  --bb-spr-keypad-head-title-size: 18px;
  --bb-spr-keypad-close-size: 38px;

  --bb-spr-key-size-h: 50px;
  --bb-spr-key-small-h: 48px;
  --bb-spr-key-radius: 12px;
  --bb-spr-key-border: #d0d0d0;
  --bb-spr-key-bg: #ffffff;
  --bb-spr-key-font: 42px;
  --bb-spr-key-gap: 8px;
}

.bb-spr-keypad {
  position: fixed;
  left: 0;
  top: 0;
  z-index: 7000;

  width: var(--bb-spr-keypad-width);
  background: #fff;
  border: 1px solid var(--bb-spr-keypad-border);
  box-shadow: var(--bb-spr-keypad-shadow);
  overflow: hidden;
}

.bb-spr-keypad[hidden] {
  display: none !important;
}

.bb-spr-keypad-head {
  height: var(--bb-spr-keypad-head-h);
  background: var(--bb-spr-keypad-head-bg);
  color: var(--bb-spr-keypad-head-text);

  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;

  padding: 0 12px;
  box-sizing: border-box;

  cursor: grab;
  user-select: none;
  touch-action: none;
}

.bb-spr-keypad.is-dragging .bb-spr-keypad-head {
  cursor: grabbing;
}

.bb-spr-keypad-title {
  justify-self: start;
  font-family: Arial, Helvetica, sans-serif;
  font-size: var(--bb-spr-keypad-head-title-size);
  font-weight: 700;
  line-height: 1;
  color: #fff;
}

.bb-spr-keypad-drag {
  justify-self: center;

  display: grid;
  grid-template-columns: repeat(3, 5px);
  grid-template-rows: repeat(2, 5px);
  gap: 4px;

  align-content: center;
  justify-content: center;

  width: 30px;
  height: 20px;
}

.bb-spr-keypad-drag span {
  display: block;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: #fff;
}

.bb-spr-keypad-close {
  justify-self: end;
  align-self: center;

  width: 26px;
  height: 26px;
  border: none;
  background: transparent;
  color: #fff;

  display: inline-flex;
  align-items: center;
  justify-content: center;

  font-size: var(--bb-spr-keypad-close-size);
  line-height: 1;
  font-weight: 100;
  cursor: pointer;
  padding: 0;
  position: relative;
  top: -1px;
}

.bb-spr-keypad-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: var(--bb-spr-key-gap);
  padding: 10px;
  box-sizing: border-box;
  background: #ffffff;
}

.bb-spr-key {
  grid-column: span 2;

  height: var(--bb-spr-key-size-h);
  border: 1px solid var(--bb-spr-key-border);
  border-radius: var(--bb-spr-key-radius);
  background: var(--bb-spr-key-bg);

  font-family: Arial, Helvetica, sans-serif;
  font-size: var(--bb-spr-key-font);
  font-weight: 400;
  line-height: 1;
  color: #222;

  cursor: pointer;

  display: inline-flex;
  align-items: center;
  justify-content: center;

  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.78),
    0 1px 2px rgba(0, 0, 0, 0.10);
}

.bb-spr-key:hover {
  background: #f5f5f5;
}

.bb-spr-key:active {
  background: #ededed;
  transform: translateY(1px);
}

.bb-spr-key[data-value="-"],
.bb-spr-key[data-value="."],
.bb-spr-key[data-value="/"],
.bb-spr-key-backspace {
  grid-column: span 1;
  height: var(--bb-spr-key-small-h);
}

.bb-spr-key[data-value="0"] {
  grid-column: span 2;
  height: var(--bb-spr-key-small-h);
}

.bb-spr-key-backspace {
  font-size: 26px;
}