.sizechart-popup {
  position: fixed;
  inset: 0;
  z-index: 2147483100;
  display: flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  width: 100%;
  height: 100vh;
  height: 100dvh;
  padding: max(12px, env(safe-area-inset-top)) max(12px, env(safe-area-inset-right)) max(12px, env(safe-area-inset-bottom)) max(12px, env(safe-area-inset-left));
  overflow: hidden;
}

.sizechart-popup[hidden] {
  display: none !important;
}

.sizechart-popup .size-container {
  position: relative;
  inset: auto;
  display: flex;
  flex-direction: column;
  box-sizing: border-box;
  width: min(800px, 100%);
  height: auto;
  min-height: 0;
  max-height: calc(100vh - 24px);
  max-height: calc(100dvh - max(12px, env(safe-area-inset-top)) - max(12px, env(safe-area-inset-bottom)));
  margin: 0;
  padding: 24px;
  overflow: hidden;
  transform: none;
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 2px 10px rgb(0 0 0 / 10%);
  font-family: Jost, sans-serif;
}

.sizechart-popup .close-btn {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 3;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  padding: 10px;
  border: 0;
  background: #fff;
  cursor: pointer;
}

.sizechart-popup .close-btn img {
  width: 24px;
  height: 24px;
}

.sizechart-popup h2 {
  flex-shrink: 0;
  margin: 0;
  padding-right: 40px;
  font-size: 20px;
  font-weight: 500;
  line-height: 1.4;
}

.sizechart-popup .chips {
  display: flex;
  flex-shrink: 0;
  flex-wrap: wrap;
  gap: 8px;
  margin: 16px 0;
}

.sizechart-popup .chip {
  padding: 6px 14px;
  border: 1px solid #ccc;
  border-radius: 16px;
  background: #fff;
  color: #333;
  font: 500 12px Jost, sans-serif;
  cursor: pointer;
}

.sizechart-popup .chip.active {
  border-color: #333;
  background: #333;
  color: #fff;
}

.sizechart-popup .sizechart-scroll {
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  touch-action: pan-x pan-y;
}

.sizechart-popup table {
  width: 100%;
  border-collapse: collapse;
}

.sizechart-popup th,
.sizechart-popup td {
  padding: 10px 8px;
  border-bottom: 1px solid #e0e0e0;
  text-align: center;
  font-size: 14px;
}

.sizechart-popup th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: #fafafa;
  font-weight: 500;
}

.sizechart-popup tbody tr:hover {
  background: #f9f9f9;
}

@media (max-width: 767px) {
  .sizechart-popup .size-container {
    padding: 20px 16px 16px;
  }
}
