/* (c) Innings2, generated by Mathigon Studio */
x-math-canvas {
  --canvas-bg: #ffffff;
  --canvas-fg: #181824;
  --toolbar-bg: #292735;
  --toolbar-header-bg: #1e1c28;
  --accent-color: #5c9eff;
  --primary-color: #007bff;
  position: relative;
  display: block;
  background-color: var(--canvas-bg);
  border: 1px solid #ddd;
  border-radius: 8px;
  overflow: hidden;
  max-width: 100%;
}
x-math-canvas .outer-div {
  display: flex;
  flex-direction: column;
  width: 100%;
  height: 100%;
}
x-math-canvas .canvas-container {
  flex: 1;
  position: relative;
  background: var(--canvas-bg);
  min-height: 400px;
}
x-math-canvas .canvas-container canvas {
  display: block;
}
x-math-canvas #drawtools {
  display: none;
  padding: 8px 12px;
  background: var(--toolbar-bg);
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}
x-math-canvas #drawtools .toolbar-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
x-math-canvas #drawtools sl-button-group {
  --sl-spacing-x-small: 2px;
}
x-math-canvas #drawtools sl-button::part(base) {
  min-width: 36px;
  min-height: 36px;
}
x-math-canvas #drawtools sl-divider[vertical] {
  --color: rgba(255, 255, 255, 0.2);
  margin: 0 8px;
  height: 28px;
}
x-math-canvas .active-draw-tool::part(base) {
  background-color: var(--accent-color) !important;
  color: white !important;
}
x-math-canvas #toolbar {
  display: none;
  position: absolute;
  left: 8px;
  top: 56px;
  z-index: 100;
  width: 220px;
  max-height: calc(100% - 70px);
  overflow-y: auto;
  background: var(--toolbar-bg);
  border-radius: 12px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
}
x-math-canvas .toolbar-header {
  padding: 12px 16px;
  background: var(--toolbar-header-bg);
  border-radius: 12px 12px 0 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}
x-math-canvas .toolbar-title {
  color: #fff;
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.5px;
}
x-math-canvas .accordion-container {
  padding: 8px;
}
x-math-canvas .tool-group {
  background: transparent;
  border: none;
  margin-bottom: 4px;
  border-radius: 8px;
}
x-math-canvas .tool-group::part(base) {
  background: rgba(255, 255, 255, 0.05);
  border: none;
  border-radius: 8px;
}
x-math-canvas .tool-group::part(header) {
  padding: 10px 12px;
  font-size: 13px;
  font-weight: 500;
  color: #fff;
}
x-math-canvas .tool-group::part(summary-icon) {
  color: rgba(255, 255, 255, 0.6);
}
x-math-canvas .tool-group::part(content) {
  padding: 8px;
  padding-top: 0;
}
x-math-canvas .tool-group[open]::part(base) {
  background: rgba(255, 255, 255, 0.08);
}
x-math-canvas .tool-group:hover::part(base) {
  background: rgba(255, 255, 255, 0.1);
}
x-math-canvas .tool-group sl-icon[slot=expand-icon] {
  font-size: 16px;
  color: var(--accent-color);
  margin-right: 8px;
}
x-math-canvas .tool-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
}
x-math-canvas .tool-item {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  padding: 6px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  cursor: grab;
  transition: all 0.15s ease;
}
x-math-canvas .tool-item:hover {
  background: var(--accent-color);
  transform: scale(1.05);
}
x-math-canvas .tool-item:active {
  cursor: grabbing;
  transform: scale(0.95);
}
x-math-canvas .tool-item svg {
  width: 28px;
  height: 28px;
  stroke: #fff;
  stroke-width: 0.5px;
  fill: none;
}
x-math-canvas .tool-item svg path,
x-math-canvas .tool-item svg rect,
x-math-canvas .tool-item svg circle,
x-math-canvas .tool-item svg polygon {
  stroke: #fff;
}
x-math-canvas .popup {
  display: none;
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: var(--toolbar-bg);
  border-radius: 12px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.5);
  width: 90%;
  max-width: 320px;
  padding: 0;
  color: #fff;
  z-index: 1000;
  overflow: hidden;
}
x-math-canvas .popup-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 16px;
  background: var(--toolbar-header-bg);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}
x-math-canvas .popup-header span {
  font-weight: 600;
  font-size: 15px;
}
x-math-canvas .popup-header sl-icon-button::part(base) {
  color: rgba(255, 255, 255, 0.6);
}
x-math-canvas .popup-header sl-icon-button::part(base):hover {
  color: #fff;
}
x-math-canvas .popup-content {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  padding: 16px;
}
x-math-canvas .input-container {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
  min-width: 120px;
}
x-math-canvas .input-container label {
  font-size: 13px;
  color: rgba(255, 255, 255, 0.7);
  min-width: 35px;
}
x-math-canvas .input-container input,
x-math-canvas .input-container select {
  flex: 1;
  padding: 10px 12px;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.15);
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
  font-size: 14px;
  transition: all 0.15s ease;
}
x-math-canvas .input-container input:focus,
x-math-canvas .input-container select:focus {
  outline: none;
  border-color: var(--accent-color);
  background: rgba(255, 255, 255, 0.12);
}
x-math-canvas .input-container input::-moz-placeholder, x-math-canvas .input-container select::-moz-placeholder {
  color: rgba(255, 255, 255, 0.3);
}
x-math-canvas .input-container input::placeholder,
x-math-canvas .input-container select::placeholder {
  color: rgba(255, 255, 255, 0.3);
}
x-math-canvas .popup sl-button {
  margin: 0 16px 16px 16px;
  width: calc(100% - 32px);
}
x-math-canvas .slider-container {
  display: none;
  position: absolute;
  top: 56px;
  right: 8px;
  background: var(--toolbar-bg);
  padding: 12px 16px;
  border-radius: 10px;
  color: #fff;
  z-index: 100;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
}
x-math-canvas .slider-container label {
  font-size: 13px;
  margin-right: 8px;
  color: rgba(255, 255, 255, 0.8);
}
x-math-canvas .slider-container input[type=range] {
  width: 120px;
  cursor: pointer;
  vertical-align: middle;
}
x-math-canvas .slider-container span {
  margin-left: 8px;
  min-width: 35px;
  display: inline-block;
  font-weight: 500;
  color: var(--accent-color);
}
@media (max-width: 767px) {
  x-math-canvas #toolbar {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    top: auto;
    width: 100%;
    max-height: 50vh;
    border-radius: 16px 16px 0 0;
  }
  x-math-canvas #toolbar .tool-grid {
    grid-template-columns: repeat(5, 1fr);
  }
  x-math-canvas #drawtools .toolbar-row {
    justify-content: center;
  }
}
@media (min-width: 768px) {
  x-math-canvas {
    max-width: 1000px;
    min-height: 600px;
  }
  x-math-canvas .canvas-container {
    min-height: 500px;
  }
}
x-math-canvas #toolbar::-webkit-scrollbar {
  width: 6px;
}
x-math-canvas #toolbar::-webkit-scrollbar-track {
  background: transparent;
}
x-math-canvas #toolbar::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.2);
  border-radius: 3px;
}
x-math-canvas #toolbar::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.3);
}

x-buckets {
  display: block;
  margin: 1.5em 0;
  -webkit-user-select: none;
     -moz-user-select: none;
          user-select: none;
  color: #333;
  width: 100%;
}
x-buckets .inputs, x-buckets .bucket {
  position: relative;
}
x-buckets .inputs > *, x-buckets .bucket > * {
  position: absolute;
}
x-buckets .inputs {
  z-index: 1;
  width: 100%;
  min-height: 50px;
}
x-buckets .buckets {
  display: flex;
  margin: 0 -8px;
  flex-wrap: wrap;
  justify-content: center;
  width: 100%;
}
x-buckets .input {
  cursor: move;
  background: rgba(255, 255, 255, 0.6);
  box-sizing: border-box;
  padding: 5px 12px;
  margin: 6px 0;
  border-radius: 4px;
  width: 180px;
  font-size: 16px;
  line-height: 1.35;
  text-align: center;
  transition: left 0.2s, top 0.2s, box-shadow 0.2s, background 0.2s, color 0.2s;
}
x-buckets .input.touch-device {
  /* Increase tap target size on touch devices */
  padding: 8px 12px;
}
x-buckets .inputs .input {
  background: #c5c2cc;
}
x-buckets .input.error {
  background: #e9b0cb;
  color: #cd0e66;
}
x-buckets .input.correct {
  background: #b6dfb7;
  color: #22ab24;
}
x-buckets .input.active {
  z-index: 10; /* Ensure active items appear on top */
  background: white;
  box-shadow: 0 5px 20px rgba(0, 0, 0, 0.45);
  color: inherit;
}
x-buckets .bucket {
  width: 200px;
  border-radius: 8px;
  margin: 6px;
  position: relative;
  padding-bottom: 6px;
  background: #3a3645;
  transition: box-shadow 0.2s;
}
x-buckets .bucket .title {
  text-align: center;
  font-weight: 600;
  margin-top: 8px;
  color: white;
}
x-buckets .bucket.active {
  box-shadow: inset 0 0 0 5px rgba(0, 0, 0, 0.4);
}

/* Media Queries for Responsiveness */
@media (max-width: 768px) {
  x-buckets .bucket {
    width: 180px; /* Slightly smaller buckets on tablets */
    margin: 4px;
  }
  x-buckets .input {
    width: 160px; /* Slightly smaller input items */
    font-size: 15px;
  }
}
@media (max-width: 480px) {
  x-buckets .buckets {
    margin: 0 -4px;
  }
  x-buckets .bucket {
    width: calc(50% - 8px); /* Half width minus margins on mobile */
    min-width: 140px; /* Ensure minimum readable width */
    margin: 4px;
  }
  x-buckets .bucket .title {
    font-size: 14px;
    margin-top: 6px;
  }
  x-buckets .input {
    width: 140px; /* Smaller input items on mobile */
    font-size: 14px;
    padding: 6px 8px;
    margin: 4px 0;
  }
  x-buckets .input.active {
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.45); /* Smaller shadow on mobile */
  }
}
/* Extra small devices */
@media (max-width: 360px) {
  x-buckets .bucket {
    width: 100%; /* Full width on very small devices */
    max-width: 260px;
    margin: 4px auto;
  }
  x-buckets .input {
    width: 130px;
    font-size: 13px;
  }
}
.overline {
  text-decoration: overline;
}

.base-10 {
  margin: 0 auto 1em;
}
.base-10 td {
  padding: 0;
  width: 1.5em;
}

.base-10-large {
  font-size: 1.8em;
  line-height: 1;
}

.factors-quiz {
  height: 240px;
}
.factors-quiz .slide {
  margin-top: 110px;
  height: auto;
  font-size: 1.2em;
  text-align: center;
}
.factors-quiz .circled {
  margin: 0 0.4em;
}
.factors-quiz .factor-value {
  display: inline-block;
  position: relative;
  width: 6em;
  height: 2em;
  margin: 0 0.5em -0.6em;
}
.factors-quiz .factor-bubble {
  width: 6em;
  position: absolute;
  transition: transform 0.2s;
  transition-delay: 0.1s;
}
.factors-quiz .factor-bubble:first-child {
  transform: translateY(-120%);
}
.factors-quiz .factor-bubble:last-child {
  transform: translateY(120%);
}
.factors-quiz .factor-bubble .btn {
  width: 80px;
}
.factors-quiz .factor-bubble .btn-red, .factors-quiz .factor-bubble .btn-green {
  pointer-events: none;
  z-index: 10;
  box-shadow: none;
}

.td-border-right {
  border-right: 1px solid #3a3645;
}

.td-border-bottom {
  border-bottom: 1px solid #3a3645;
}

.divisor-table {
  table-layout: fixed;
}

.divisor-table td {
  position: relative;
  padding: 0.5em 0.5em;
}

.divisor-pair {
  left: 20px;
  right: 20px;
  bottom: 2px;
  position: absolute;
  border: 3px solid #c5c2cc;
  border-radius: 50% / 100%;
  border-top-left-radius: 0;
  border-top-right-radius: 0;
  border-top: none;
}

.number-ball {
  display: inline-block;
  text-align: center;
  line-height: 30px;
  min-width: 20px;
  padding: 0 5px;
  border-radius: 20px;
  background: #cd0e66;
  color: white;
  position: relative;
}
.number-ball.blue {
  background: #0f82f2;
}
.number-ball.green {
  background: #22ab24;
}
.number-ball.yellow {
  background: #fd8c00;
}
.number-ball.l-blue {
  background: rgba(15, 130, 242, 0.4);
}
.number-ball.l-green {
  background: rgba(34, 171, 36, 0.4);
}
.number-ball.l-yellow {
  background: rgba(253, 140, 0, 0.4);
}
.number-ball.l-blue-green {
  background: linear-gradient(to bottom right, rgba(15, 130, 242, 0.4) 50%, rgba(34, 171, 36, 0.4) 50%);
}
.number-ball.small {
  padding: 0;
  width: 24px;
  line-height: 24px;
  font-size: 1em;
  margin: -6px 1px;
}
.number-ball.blue.cross {
  position: relative;
  background: rgba(15, 130, 242, 0.3);
}
.number-ball.cross:after {
  content: "";
  width: 150%;
  height: 2px;
  background: #c00;
  position: absolute;
  left: -25%;
  top: 50%;
  transform: rotate(-45deg);
  margin-top: -1px;
}
.number-ball.legs:before, .number-ball.legs:after {
  content: " ";
  display: block;
  position: absolute;
  width: 40px;
  height: 2px;
  background: #c5c2cc;
}
.number-ball.legs:before {
  transform: rotate(-45deg);
  top: 37px;
  right: 21px;
}
.number-ball.legs:after {
  transform: rotate(45deg);
  top: 37px;
  left: 21px;
}
.number-ball.legs.b:before {
  transform: rotate(-30deg);
  top: 33px;
  right: 24px;
}
.number-ball.legs.a:after {
  transform: rotate(30deg);
  top: 33px;
  left: 24px;
}

.number-cell {
  width: 44px;
  height: 44px;
  line-height: 44px;
  margin: 6px;
  background: #c5c2cc;
  text-align: center;
  font-size: 20px;
  border-radius: 100%;
  position: relative;
  transition: color 0.2s, background 0.2s, opacity 0.4s, box-shadow 0.8s;
}
@media (max-width: 620px) {
  .number-cell {
    width: 36px;
    height: 36px;
    line-height: 36px;
    margin: 4px;
    font-size: 18px;
  }
}
@media (max-width: 500px) {
  .number-cell {
    width: 30px;
    height: 30px;
    line-height: 30px;
    margin: 3px;
    font-size: 16px;
  }
}
@media (max-width: 420px) {
  .number-cell {
    width: 24px;
    height: 24px;
    line-height: 24px;
    margin: 2px;
    font-size: 12px;
  }
}
.number-cell.off {
  opacity: 0.05;
}
.number-cell.red {
  color: white;
  background: #cd0e66;
}
.number-cell.blue {
  color: white;
  background: #0f82f2;
}
.number-cell.green {
  color: white;
  background: #22ab24;
}
.number-cell.yellow {
  color: white;
  background: #fd8c00;
}
#divisibility6 .number-cell.blue.yellow {
  background: linear-gradient(to bottom right, #0f82f2 50%, #fd8c00 50%);
}
#divisibility6 .number-cell.blue.yellow.green {
  box-shadow: inset 0 0 0 30px #22ab24;
}

.number-badge {
  font-size: 15px;
  line-height: 22px;
  width: 22px;
  position: absolute;
  background: #3a3645;
  border-radius: 100%;
  top: -7px;
  right: -7px;
  color: white;
  display: none;
}
@media (max-width: 500px) {
  .number-badge {
    width: 18px;
    line-height: 18px;
    top: -6px;
    right: -6px;
    font-size: 12px;
  }
}

.number-grid {
  max-width: 560px;
  margin: 1em auto;
  display: flex;
  flex-wrap: wrap;
}
.stage .number-grid {
  margin-bottom: 32px;
}
@media (max-width: 620px) {
  .number-grid {
    max-width: 440px;
  }
}
@media (max-width: 500px) {
  .number-grid {
    max-width: 360px;
  }
}
@media (max-width: 420px) {
  .number-grid {
    max-width: 280px;
  }
}
.number-grid.ulam-grid {
  max-width: 392px;
}
@media (max-width: 620px) {
  .number-grid.ulam-grid {
    max-width: 310px;
  }
}
@media (max-width: 500px) {
  .number-grid.ulam-grid {
    max-width: 252px;
  }
}
@media (max-width: 420px) {
  .number-grid.ulam-grid {
    max-width: 198px;
  }
}

#primefactor .td-border-bottom td {
  padding-bottom: 0.5em;
}

#primefactor .td-border-bottom + tr td {
  padding-top: 0.5em;
}

.twin {
  display: inline-block;
}
.twin .number-ball {
  margin: 2px 0 2px 8px;
}
.twin .number-ball:nth-child(odd):after {
  content: "";
  display: block;
  width: 10px;
  height: 4px;
  position: absolute;
  right: -9px;
  top: 13px;
  background: #cd0e66;
}
.twin .number-ball.blue:nth-child(odd):after {
  background: #0f82f2;
}
.twin .number-ball.green:nth-child(odd):after {
  background: #22ab24;
}
.twin .number-ball.yellow:nth-child(odd):after {
  background: #fd8c00;
}

x-buckets .input {
  width: 160px;
}
x-buckets .input {
  height: 120px;
}
x-buckets .bucket {
  width: 250px;
}
x-buckets .bucket:nth-child(1) {
  background: #f1a798;
}
x-buckets .bucket:nth-child(2) {
  background: #b8a1dd;
}

x-algebra-flow x-blank input {
  min-width: 74px;
  transition: min-width 0.2s;
}
x-algebra-flow x-blank.invalid input {
  min-width: 54px;
}