:root {
  --buttons-height: 45px;

  --input-width: 70px;
  --input-height: 50px;
  --input-font-size: 2rem;
  --input-grid-template-column: 75px;
  --input-grid-template-row: 50px;

  --carry-input-width: 40px;
  --carry-input-height: 40px;
  --carry-input-fonts-size: 1.5rem;

  --multiplication-sign: 2rem;

  --result-icon-font-size: 2.15rem;

  --space-xs: 4px;
  --space-sm: 5px;
  --space-md: 7px;
  --space-lg: 10px;

  --animation-fast: 0.8s;
  --animation-medium: 0.9s;
}

/*Iconos*/
#result-check,
#result-wrong {
  display: none;
  color: greenyellow;
  font-size: var(--result-icon-font-size);
  font-weight: bolder;
  margin-inline-start: var(--space-md);
}

#result-check {
  color: greenyellow;
}

#result-wrong {
  color: hsl(7, 100%, 50%);
  font-family: cursive;
}

/*Label Signo POR "X"*/
#multiplication-sign {
  font-size: var(--multiplication-sign);
  font-weight: bold;
  font-family: cursive;
  text-align: center;
}

/*Carry Inputs*/
#carry-area {
  grid-column: 1;
  grid-row: 1;
  grid-template-columns: repeat(3, var(--input-grid-template-column));
  justify-items: center;
  align-items: center;
}

.carry-input {
  border-radius: 50%;
  width: var(--carry-input-width);
  height: var(--carry-input-height);
  font-size: var(--carry-input-fonts-size);
  text-align: center;
  outline: none;
  border: none;
  font-weight: bold;
  cursor: pointer;
  color: rgb(255, 255, 77);
  background-color: rgba(78, 78, 78, 0.527);
}

.carry-input:focus {
  transform: scale(1.05);
  background-color: rgba(50, 50, 50, 0.5);
}

.carry-input:focus-visible {
  outline: 2px solid rgba(255, 255, 75, 0.7);
  outline-offset: 2px;
}

/* Inputs */
.inputs {
  height: var(--input-height);
  width: var(--input-width);
  font-size: var(--input-font-size);
}

#calculator-grid {
  display: grid;
  grid-template-columns: repeat(4, var(--input-grid-template-column));
  grid-template-rows: 45px var(--input-grid-template-row) repeat(2, var(--input-grid-template-row));
  align-content: center;
  padding: var(--space-lg);
  row-gap: var(--space-xs);
  position: relative;
  max-width: 100%;
  margin: 0 auto;
}

.result-divider {
  border-top: 4px solid rgb(7, 7, 7);
  padding-top: var(--space-xs);
  width: calc(var(--input-grid-template-column) * 4);
}

.calc-grid {
  display: grid;
}

/* Multiplicand Section */
#multiplicand-area {
  display: grid;
  grid-column: 2;
  grid-row: 2;
  grid-template-columns: repeat(3, var(--input-grid-template-column));
  row-gap: var(--space-xs);
}

.multiplicand::placeholder {
  color: rgb(158, 145, 202);
}

#multiplier-area {
  grid-column: 3;
  grid-row: 3;
  grid-template-columns: repeat(2, var(--input-grid-template-column));
}

.multiplier::placeholder {
  color: rgb(158, 145, 202);
}

/* Product Section */
#product-area {
  grid-column: 1;
  grid-row: 4;
  grid-template-columns: repeat(5, var(--input-grid-template-column));
}

.product {
  background-color: #fef2c8;
}

.product.is-correct {
  background-color: #4ffc4fc6;
}

.product.is-wrong {
  background-color: #ff3232c6;
}

/* Buttons */
.buttons-section {
  row-gap: var(--space-md);
}

.buttons {
  height: var(--buttons-height);
  display: grid;
  border-radius: 15px;
  align-items: center;
  text-align: center;
  justify-content: center;
}

/* Dropdown Button - Tables */
#tables-toggle {
  cursor: pointer;
  color: hsla(0, 10%, 10%);
  background-color: hsl(250, 10%, 90%);
  display: grid;
}

#tables-toggle::before {
  content: "Tables ⇩";
}

#tables-toggle:hover {
  background-color: hsl(250, 10%, 85%);
  box-shadow: 5px 5px 2px hsl(250, 10%, 45%, 0.7);
}

#tables-toggle:active {
  background-color: hsl(250, 10%, 95%);
  box-shadow: 5px 5px 2px hsl(250, 10%, 55%, 0.7);
}

/* Close Table Container Button */
.table-close-btn {
  width: 70%;
  height: 2rem;
  margin: 0 auto;
  background-color: rgb(70, 70, 70);
  color: silver;
  font-size: 1em;
  font-weight: bold;
  border: none;
  border-radius: 10px;
  cursor: pointer;
}

.table-close-btn:hover,
.table-close-btn:focus-visible {
  background-color: hsl(0, 0%, 50%);
}

/* Arrow Label & Buttons */
.arrow_labl {
  display: grid;
  font-size: 1rem;
  font-weight: bolder;
  align-items: center;
  align-content: center;
  grid-row: 1;
}

.arrow_buttons {
  display: grid;
  width: 42px;
  grid-row: 2;
  justify-content: center;
  height: 1.6rem;
  border-radius: 12px;
  border: none;
  cursor: pointer;
  background-color: rgb(170, 251, 170);
}

.arrow_buttons:focus-visible {
  outline: 2px solid rgba(0, 128, 0, 0.7);
  outline-offset: 2px;
}

/* Table Container (Dropdown) */
#tables-panel {
  display: none;
  justify-content: center;
  position: absolute;
  max-width: 250px;
  top: 20%;
  right: 50%;
  cursor: move;
  z-index: 1;
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  -khtml-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
  user-select: none;
}

.table-dropdown-item {
  color: silver;
  background: hsl(250, 10%, 80%);
  position: absolute;
  border-top-width: 5px;
  margin-top: 50px;
  row-gap: 7px;
  min-width: 120px;
  padding: var(--space-sm) 5px;
  font-size: 1rem;
  font-weight: bolder;
  display: grid;
  box-shadow: 5px 5px 2px hsl(250, 10%, 50%, 0.7);
  border-radius: 7px;
  text-align: center;
}

.table-dropdown-item a {
  color: hsl(0, 0%, 10%);
}

#table-heading {
  display: inline-grid;
  position: absolute;
  width: 120px;
  font-size: 1.125rem;
  font-weight: bolder;
  font-style: italic;
  font-family: 'Times New Roman', Times, serif;
  box-shadow: 5px 5px 2px hsl(250, 10%, 50%, 0.7);
  background-color: hsl(250, 50%, 100%);
  border-radius: 10px;
  justify-content: center;
  align-items: center;
  justify-items: center;
  font-weight: bolder;
  padding: 2px 0;
}

.table-multiplicand,
.table-result {
  font-weight: bolder;
}

/* Accessibility Utility */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

/* Animations */
@keyframes pulse-highlight {
  0% {
    box-shadow: 0 0 0 0 rgba(255, 200, 0, .7);
    background-color: #fff3b0;
  }

  60% {
    box-shadow: 0 0 0 8px rgba(255, 200, 0, 0);
    background-color: #fff3b0;
  }

  100% {
    box-shadow: 0 0 0 0 rgba(255, 200, 0, 0);
    /* background-color: transparent; */
  }
}

.highlight {
  animation: pulse-highlight var(--animation-medium) ease-out both;
}

.flying-digit {
  position: fixed;
  z-index: 1;
  font-weight: 700;
  font-size: 2.5rem;
  color: #000001;
  left: 0;
  top: 0;
  transform: translate(-50%, -50%);
  transition: transform var(--animation-fast) cubic-bezier(.22, 0.61, .36, 1);
  pointer-events: none;
  will-change: transform;
}

@media (prefers-reduced-motion: reduce) {
  .highlight {
    animation: none;
  }

  .flying-digit {
    transition: none;
  }
}

@media all and (max-width:375px) {
  :root {
    --input-width: 67px;
    --input-height: 48px;
    --input-font-size: 1.75rem;
    --input-grid-template-column: 71px;
    --multiplication-sign: 1.75rem;
    --result-icon-font-size: 2rem;
  }

  .board-title {
    font-size: 1rem;
  }

  .carry-text {
    font-size: .75rem;
  }
}

@media all and (max-width:350px) {
  .main {
    overflow: scroll;
  }
}
