.analysis-main {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.analysis-section {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.analysis-heading {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 0.75rem;
  align-items: baseline;
}

.analysis-heading h2 {
  margin: 0;
}

.analysis-meta {
  display: flex;
  gap: 1rem;
  font-size: 0.9rem;
  color: rgba(226, 232, 240, 0.78);
}

.analysis-description {
  margin: 0;
  color: rgba(226, 232, 240, 0.75);
  font-size: 0.92rem;
}

.analysis-main .table-wrapper {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
}

.analysis-main .table-wrapper::-webkit-scrollbar {
  height: 6px;
}

.analysis-main .table-wrapper::-webkit-scrollbar-thumb {
  background-color: rgba(148, 163, 184, 0.4);
  border-radius: 999px;
}

.analysis-main .stats-table-wrapper {
  max-height: 460px;
  overflow-y: auto;
  overflow-x: hidden;
}

.analysis-main .lotto-table {
  width: 100%;
  border-collapse: collapse;
  background-color: rgba(15, 23, 42, 0.65);
  border: 1px solid rgba(148, 163, 184, 0.2);
}

.analysis-main .lotto-table th,
.analysis-main .lotto-table td {
  padding: 0.7rem 0.6rem;
  text-align: center;
  border-bottom: 1px solid rgba(148, 163, 184, 0.18);
  white-space: nowrap;
  font-size: 0.92rem;
}

.analysis-main .lotto-table tbody tr:hover {
  background-color: rgba(30, 41, 59, 0.55);
}

.analysis-main .lotto-table th {
  font-weight: 600;
  color: rgba(226, 232, 240, 0.95);
  font-size: 0.95rem;
}

.analysis-main .table-sort-button {
  background: none;
  border: none;
  color: inherit;
  font: inherit;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0;
}

.analysis-main .table-sort-button:hover,
.analysis-main .table-sort-button:focus-visible {
  color: #facc15;
  outline: none;
}

.analysis-main .table-sort-button .table-sort-button-label {
  white-space: nowrap;
}

.analysis-main .lotto-table-number {
  text-align: center;
}

.analysis-main .lotto-number.lotto-table-ball {
  width: 42px;
  height: 42px;
  font-size: 0.9rem;
}

.analysis-main .lotto-number.lotto-range-ball {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 0.75rem;
  min-width: 52px;
  height: 42px;
  font-size: 0.85rem;
  border-radius: 999px;
}

@media (max-width: 640px) {
  .analysis-main {
    gap: clamp(0.45rem, 2.5vw, 0.7rem);
    padding: 0;
  }

  .analysis-main .model-section {
    padding: clamp(0.25rem, 2vw, 0.45rem) clamp(0.25rem, 2.4vw, 0.5rem);
    margin-bottom: clamp(0.3rem, 2.4vw, 0.55rem);
    width: 90%;
    margin-left: auto;
    margin-right: auto;
  }

  .analysis-main .model-section:last-of-type {
    margin-bottom: 0;
  }

  .analysis-heading {
    gap: clamp(0.3rem, 2.5vw, 0.5rem);
  }

  .analysis-meta {
    font-size: clamp(0.74rem, 2.5vw, 0.82rem);
  }

  .analysis-description {
    font-size: clamp(0.76rem, 2.7vw, 0.84rem);
  }

  .analysis-section .lotto-table th,
  .analysis-section .lotto-table td {
    padding: clamp(0.24rem, 1.8vw, 0.32rem) clamp(0.2rem, 1.6vw, 0.28rem);
    font-size: clamp(0.7rem, 2.2vw, 0.78rem);
    white-space: normal;
    overflow: visible;
    text-overflow: initial;
  }

  .analysis-section .lotto-table th {
    font-size: clamp(0.74rem, 2.4vw, 0.8rem);
  }

  .analysis-section .lotto-table {
    table-layout: fixed;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    margin: 0 auto;
  }

  .analysis-main .table-wrapper {
    width: 100%;
    max-width: 100%;
    margin: 0;
    box-sizing: border-box;
    overflow-x: visible;
  }

  .analysis-main .table-wrapper table {
    min-width: 100%;
  }

  .analysis-main .table-sort-button {
    font-size: clamp(0.7rem, 2.2vw, 0.78rem);
    gap: 0.15rem;
  }

  .analysis-section .lotto-table th:nth-child(1),
  .analysis-section .lotto-table td:nth-child(1) {
    width: 33%;
  }

  .analysis-section .lotto-table th:nth-child(2),
  .analysis-section .lotto-table td:nth-child(2) {
    width: 34%;
  }

  .analysis-section .lotto-table th:nth-child(3),
  .analysis-section .lotto-table td:nth-child(3) {
    width: 33%;
  }

  .analysis-section .lotto-table-number .lotto-table-ball {
    width: clamp(30px, 9vw, 36px);
    height: clamp(30px, 9vw, 36px);
    font-size: clamp(0.68rem, 2vw, 0.76rem);
  }

  .analysis-section .lotto-number.lotto-range-ball {
    padding: 0 clamp(0.4rem, 2.6vw, 0.65rem);
    min-width: clamp(42px, 12vw, 56px);
    height: clamp(30px, 9vw, 36px);
    font-size: clamp(0.68rem, 2vw, 0.76rem);
  }

  .analysis-main .stats-table-wrapper {
    overflow-x: visible;
  }
}

@media (max-width: 480px) {
  .analysis-section .lotto-table-number .lotto-table-ball {
    width: clamp(26px, 10vw, 30px);
    height: clamp(26px, 10vw, 30px);
    font-size: clamp(0.58rem, 2.3vw, 0.68rem);
  }

  .analysis-section .lotto-number.lotto-range-ball {
    min-width: clamp(38px, 14vw, 46px);
    height: clamp(26px, 10vw, 30px);
    font-size: clamp(0.58rem, 2.3vw, 0.68rem);
  }

  .analysis-section .lotto-table th,
  .analysis-section .lotto-table td,
  .analysis-main .table-sort-button {
    font-size: clamp(0.62rem, 2.4vw, 0.7rem);
  }

  .analysis-section .lotto-table th,
  .analysis-section .lotto-table td {
    padding: clamp(0.16rem, 2.4vw, 0.24rem) clamp(0.15rem, 2vw, 0.22rem);
  }
}
