/* Phase 7: remove stretched tool space and balance content-card endings */
.container {
  width: 100% !important;
  max-width: 1400px !important;
  min-width: 0 !important;
  box-sizing: border-box !important;
  align-items: start !important;
  padding-bottom: 20px !important;
}

.container > *,
.test-section,
.sidebar {
  width: 100% !important;
  max-width: 100% !important;
  min-width: 0 !important;
  box-sizing: border-box !important;
}

.header-row,
.controls,
.typing-area,
.stats,
.stats-container,
.time-selector,
.trending-section {
  max-width: 100% !important;
  min-width: 0 !important;
  box-sizing: border-box !important;
}

.container > .test-section,
.container > .sidebar {
  align-self: start !important;
}

.test-section {
  height: auto !important;
  min-height: 0 !important;
}

.test-section > :last-child {
  margin-bottom: 0 !important;
}

.content-section {
  margin-top: 0 !important;
  margin-bottom: 20px !important;
  padding-bottom: 0 !important;
}

.content-section .content-wrapper {
  display: grid !important;
  grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  grid-auto-rows: 8px !important;
  grid-auto-flow: row dense !important;
  column-count: initial !important;
  column-gap: 20px !important;
  row-gap: 20px !important;
  align-items: start !important;
  margin-bottom: 0 !important;
}

.content-section .content-wrapper > .content-block {
  display: block !important;
  width: auto !important;
  height: auto !important;
  min-height: 0 !important;
  margin: 0 !important;
  align-self: start !important;
  break-inside: auto !important;
}

.content-section .content-wrapper > .content-block > :last-child {
  margin-bottom: 0 !important;
}

@media (max-width: 900px) {
  .container {
    padding-left: 14px !important;
    padding-right: 14px !important;
    padding-bottom: 16px !important;
  }

  .content-section {
    margin-bottom: 16px !important;
  }

  .content-section .content-wrapper {
    grid-template-columns: 1fr !important;
    grid-auto-rows: auto !important;
    grid-auto-flow: row !important;
  }

  .content-section .content-wrapper > .content-block {
    grid-column: 1 !important;
    grid-row-end: auto !important;
  }

  .stats {
    grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
    gap: 8px !important;
  }

  .stats > .stat-box {
    min-width: 0 !important;
    padding: 10px 6px !important;
  }

  .stats > .stat-box .stat-label {
    font-size: 10px !important;
    letter-spacing: 0.4px !important;
    overflow-wrap: anywhere !important;
  }

  .stats > .stat-box .stat-value {
    font-size: clamp(20px, 7vw, 30px) !important;
  }
}
