.dice-calculator__viewport {
  height: auto;
  min-height: 640px;
  overflow: auto;
  background: #0e0f13;
}

/* Slot previews inherit a dimming overlay; this tool is interactive immediately. */
.dice-calculator__viewport::after {
  content: none;
}

.dice-calculator__layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 330px;
  min-height: 500px;
}

.dice-calculator__stage {
  display: flex;
  min-width: 0;
  flex-direction: column;
  padding: 24px;
  background:
    radial-gradient(circle at 50% 38%, rgba(242, 7, 74, 0.13), transparent 37%),
    #111217;
}

.dice-calculator__summary {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.calculator-stat {
  min-width: 0;
  padding: 10px 12px;
  border: 1px solid #32343b;
  border-radius: 5px;
  background: #191b21;
}

.calculator-stat > span,
.calculator-stat > strong {
  display: block;
}

.calculator-stat > span {
  color: #9a9ba1;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.calculator-stat > strong {
  overflow: hidden;
  margin-top: 4px;
  color: #fff;
  font-size: 17px;
  font-variant-numeric: tabular-nums;
  line-height: 1.1;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dice-calculator__target-wrap {
  display: grid;
  flex: 1;
  min-height: 245px;
  place-items: center;
  padding: 18px 0;
}

.dice-calculator__target {
  position: relative;
  display: grid;
  width: 205px;
  aspect-ratio: 1;
  place-content: center;
  border: 1px solid var(--game-demo-accent);
  border-radius: 50%;
  background: linear-gradient(145deg, #242630, #111217);
  box-shadow: 0 18px 45px rgba(0, 0, 0, 0.38), 0 0 32px rgba(242, 7, 74, 0.13);
  text-align: center;
}

.dice-calculator__target::before {
  position: absolute;
  inset: 13px;
  border: 1px dashed #454852;
  border-radius: 50%;
  content: "";
}

.dice-calculator__target > * {
  position: relative;
}

.dice-calculator__target-label {
  margin-bottom: 7px;
  color: #9a9ba1;
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.dice-calculator__target strong {
  color: #fff;
  font-size: 37px;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.04em;
  line-height: 1.05;
}

.dice-calculator__target strong + span {
  margin-top: 7px;
  color: #ff7993;
  font-size: 11px;
  font-weight: 700;
}

.dice-calculator__range-panel {
  padding: 13px 14px;
  border: 1px solid #32343b;
  border-radius: 5px;
  background: #191b21;
}

.dice-calculator__range-heading {
  display: flex;
  gap: 12px;
  justify-content: space-between;
  margin-bottom: 12px;
}

.dice-calculator__range-heading span {
  color: #9a9ba1;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
}

.dice-calculator__range-heading strong {
  color: #fff;
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}

.dice-calculator__track {
  position: relative;
  height: 11px;
  border-radius: 999px;
  background: linear-gradient(90deg, #69c42d 0 var(--marker, 50%), rgba(242, 7, 74, 0.76) var(--marker, 50%) 100%);
  box-shadow: inset 0 1px 4px rgba(0, 0, 0, 0.48);
}

.dice-calculator__track[data-direction="over"] {
  background: linear-gradient(90deg, rgba(242, 7, 74, 0.76) 0 var(--marker, 50%), #69c42d var(--marker, 50%) 100%);
}

.dice-calculator__track-marker {
  position: absolute;
  top: 50%;
  left: var(--marker, 50%);
  width: 20px;
  height: 20px;
  border: 3px solid #fff;
  border-radius: 50%;
  background: #191b21;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.42);
  transform: translate(-50%, -50%);
}

.dice-calculator__track-labels {
  display: flex;
  justify-content: space-between;
  margin-top: 8px;
  color: #85868d;
  font-size: 8px;
  font-variant-numeric: tabular-nums;
}

.dice-calculator__numbers {
  display: grid;
  grid-template-columns: minmax(145px, 0.8fr) 1fr;
  gap: 14px;
  align-items: center;
  margin-top: 10px;
  padding: 12px 14px;
  border: 1px solid #32343b;
  border-radius: 5px;
  background: #191b21;
}

.dice-calculator__numbers > div span,
.dice-calculator__numbers > div small {
  display: block;
}

.dice-calculator__numbers > div span {
  color: #fff;
  font-size: 11px;
  font-weight: 700;
}

.dice-calculator__numbers > div small {
  margin-top: 2px;
  color: #8f9096;
  font-size: 9px;
}

.dice-calculator__numbers ol {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  justify-content: flex-end;
  margin: 0;
  padding: 0;
  list-style: none;
}

.dice-calculator__numbers li {
  min-width: 48px;
  padding: 6px 7px;
  border: 1px solid #4a4c54;
  border-radius: 999px;
  background: #111217;
  color: #fff;
  font-size: 10px;
  font-variant-numeric: tabular-nums;
  font-weight: 700;
  text-align: center;
}

.dice-calculator__controls {
  padding: 22px;
  border-left: 1px solid #32343b;
  background: #191b21;
}

.calculator-control {
  margin: 0 0 17px;
  padding: 0;
  border: 0;
}

.calculator-control__label,
.calculator-control legend {
  display: block;
  width: 100%;
  margin-bottom: 7px;
  color: #f4f4f5;
  font-size: 12px;
  font-weight: 700;
}

.calculator-control > small {
  display: block;
  margin-top: 5px;
  color: #85868d;
  font-size: 9px;
  line-height: 1.4;
}

.calculator-control__input-wrap {
  display: flex;
  min-height: 42px;
  overflow: hidden;
  border: 1px solid #4a4c54;
  border-radius: 4px;
  background: #111217;
}

.calculator-control__input-wrap:focus-within {
  border-color: var(--game-demo-accent-light);
  box-shadow: 0 0 0 2px rgba(242, 7, 74, 0.18);
}

.calculator-control__input-wrap input {
  min-width: 0;
  flex: 1;
  padding: 0 12px;
  border: 0;
  outline: 0;
  background: transparent;
  color: #fff;
  font: inherit;
  font-size: 14px;
  font-variant-numeric: tabular-nums;
  font-weight: 700;
}

.calculator-control__input-wrap > span {
  display: grid;
  padding: 0 12px;
  place-items: center;
  color: #9a9ba1;
  font-size: 10px;
  font-weight: 800;
}

.calculator-control select {
  width: 100%;
  min-height: 42px;
  padding: 0 38px 0 12px;
  border: 1px solid #4a4c54;
  border-radius: 4px;
  outline: 0;
  background: #111217;
  color: #fff;
  font: inherit;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
}

.calculator-control select:focus-visible {
  border-color: var(--game-demo-accent-light);
  box-shadow: 0 0 0 2px rgba(242, 7, 74, 0.18);
}

.calculator-control__choices {
  display: grid;
  gap: 5px;
}

.calculator-control__choices--three {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.calculator-control__choices label {
  position: relative;
  cursor: pointer;
}

.calculator-control__choices input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
}

.calculator-control__choices span {
  display: grid;
  min-height: 39px;
  place-items: center;
  border: 1px solid #4a4c54;
  border-radius: 4px;
  background: #22242b;
  color: #c7c8cd;
  font-size: 10px;
  font-weight: 700;
}

.calculator-control__choices input:checked + span {
  border-color: var(--game-demo-accent-light);
  background: rgba(242, 7, 74, 0.16);
  color: #fff;
}

.calculator-control__choices input:focus-visible + span {
  outline: 2px solid #fff;
  outline-offset: 2px;
}

.dice-calculator__figures {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 7px;
  margin: 2px 0 15px;
}

.dice-calculator__figures div {
  padding: 9px 10px;
  border: 1px solid #3d3f47;
  border-radius: 4px;
  background: #111217;
}

.dice-calculator__figures span,
.dice-calculator__figures strong {
  display: block;
}

.dice-calculator__figures span {
  color: #8f9096;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.dice-calculator__figures strong {
  margin-top: 3px;
  color: #fff;
  font-size: 13px;
  font-variant-numeric: tabular-nums;
}

.dice-calculator__figures strong span {
  display: inline;
  color: inherit;
  font-size: inherit;
  letter-spacing: 0;
  text-transform: none;
}

.dice-calculator__generate {
  width: 100%;
  min-height: 48px;
  border: 0;
  border-radius: 4px;
  background: linear-gradient(180deg, var(--game-demo-accent-light), var(--game-demo-accent) 55%, var(--game-demo-accent-dark));
  box-shadow: 0 8px 18px rgba(242, 7, 74, 0.25);
  color: #fff;
  font: inherit;
  font-size: 15px;
  font-weight: 800;
  cursor: pointer;
}

.dice-calculator__generate:hover {
  filter: brightness(1.08);
}

.dice-calculator__hint {
  margin: 8px 0 0;
  color: #8f9096;
  font-size: 9px;
  line-height: 1.4;
  text-align: center;
}

.dice-calculator__history {
  padding: 18px 22px 22px;
  border-top: 1px solid #32343b;
  background: #111217;
}

.dice-calculator__history h3 {
  margin: 0 0 9px;
  color: #fff;
  font-size: 14px;
}

.calculator-history__scroller {
  overflow-x: auto;
  border: 1px solid #32343b;
  border-radius: 4px;
}

.calculator-history__table {
  width: 100%;
  min-width: 560px;
  border-collapse: collapse;
  color: #e7e7ea;
  font-size: 11px;
  font-variant-numeric: tabular-nums;
}

.calculator-history__table th,
.calculator-history__table td {
  padding: 8px 10px;
  border-bottom: 1px solid #30323a;
  text-align: left;
}

.calculator-history__table th {
  color: #8f9096;
  font-size: 9px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.calculator-history__table tr:last-child td {
  border-bottom: 0;
}

.calculator-history__empty {
  color: #8f9096;
  text-align: center !important;
}

.dice-calculator__reset {
  min-height: 30px;
  padding: 0 12px;
  border: 1px solid #666871;
  border-radius: 4px;
  background: #111217;
  color: #fff;
  font: inherit;
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
}

.dice-calculator__reset:hover {
  border-color: var(--game-demo-accent-light);
  color: var(--game-demo-accent-light);
}

.dice-calculator .game-demo__footer {
  justify-content: space-between;
}

.dice-calculator__content-image {
  display: block;
  width: 100%;
  height: auto;
  margin: 22px 0 28px;
  border-radius: 8px;
}

.calculator-test-stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin: 26px 0;
}

.calculator-test-stats > div {
  padding: 18px 14px;
  border: 1px solid #dedede;
  border-radius: 8px;
  background: #f7f7f8;
  text-align: center;
}

.calculator-test-stats dt {
  color: #1e1e22;
  font-size: 25px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  line-height: 1.1;
}

.calculator-test-stats dd {
  margin: 7px 0 0;
  color: #65666d;
  font-size: 12px;
  font-weight: 600;
}

.calculator-test-stats > .calculator-test-stats__positive {
  border-color: #9bce78;
  background: #f1f9ec;
}

.calculator-test-stats__positive dt,
.calculator-test-table__positive {
  color: #39820a;
}

.calculator-test-table {
  margin: 0 0 25px;
  overflow-x: auto;
  border: 1px solid #dedede;
  border-radius: 8px;
}

.calculator-test-table table {
  width: 100%;
  min-width: 480px;
  border-collapse: collapse;
  font-variant-numeric: tabular-nums;
}

.calculator-test-table caption {
  padding: 13px 16px;
  border-bottom: 1px solid #dedede;
  background: #f7f7f8;
  color: #65666d;
  font-size: 11px;
  font-weight: 600;
  text-align: left;
}

.calculator-test-table th,
.calculator-test-table td {
  padding: 12px 16px;
  border-bottom: 1px solid #e7e7e8;
  font-size: 13px;
  text-align: left;
}

.calculator-test-table th {
  color: #45464c;
  font-weight: 600;
}

.calculator-test-table td {
  color: #1e1e22;
  font-weight: 700;
}

.calculator-test-table tr:last-child th,
.calculator-test-table tr:last-child td {
  border-bottom: 0;
}

.dice-calculator:fullscreen .dice-calculator__viewport {
  flex: 1 1 auto;
  overflow: auto;
}

.calculator-sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.dice-calculator :where(button, input, select):focus-visible {
  outline: 2px solid #fff;
  outline-offset: 2px;
}

@media (pointer: coarse) {
  .calculator-control__input-wrap,
  .calculator-control select,
  .calculator-control__choices span,
  .dice-calculator__generate {
    min-height: 48px;
  }
}

@media (max-width: 1040px) {
  .header__main-menu .main-menu__category:nth-child(4),
  .header__main-menu .main-menu__category:nth-child(5) {
    display: none;
  }
}

@media (max-width: 760px) {
  .dice-calculator__viewport {
    min-height: 0;
  }

  .dice-calculator__layout {
    grid-template-columns: 1fr;
  }

  .dice-calculator__stage,
  .dice-calculator__controls {
    padding: 18px;
  }

  .dice-calculator__controls {
    border-top: 1px solid #32343b;
    border-left: 0;
  }

  .dice-calculator__history {
    padding: 16px 18px 19px;
  }

  .calculator-test-stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 480px) {
  .dice-calculator__summary {
    grid-template-columns: 1fr 1fr;
  }

  .calculator-stat:first-child {
    grid-column: 1 / -1;
  }

  .dice-calculator__target-wrap {
    min-height: 220px;
  }

  .dice-calculator__target {
    width: 180px;
  }

  .dice-calculator__target strong {
    font-size: 32px;
  }

  .dice-calculator__numbers {
    grid-template-columns: 1fr;
  }

  .dice-calculator__numbers ol {
    justify-content: flex-start;
  }

  .dice-calculator__track-labels span:nth-child(even) {
    display: none;
  }

  .calculator-control__choices--three {
    grid-template-columns: 1fr;
  }

  .calculator-control__choices span {
    min-height: 44px;
  }

  .dice-calculator__figures {
    grid-template-columns: 1fr;
  }

  .dice-calculator .game-demo__footer {
    gap: 10px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .dice-calculator *,
  .dice-calculator *::before,
  .dice-calculator *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
  }
}
